Browse Source

JavaNative: Moved loading of method return type to a latter time

Background: If the return type was a generic parameter, that early it wouldn't have been populated yet, and why load the return type as first thing in a method anyways?
kindlich 4 years ago
parent
commit
ee949a7bd1
No known key found for this signature in database

+ 1
- 1
JavaIntegration/src/main/java/org/openzen/zencode/java/JavaNativeModule.java View File

803
 			Parameter[] javaParameters,
803
 			Parameter[] javaParameters,
804
 			TypeVariable<Method>[] javaTypeParameters,
804
 			TypeVariable<Method>[] javaTypeParameters,
805
 			AnnotatedType[] exceptionTypes) {
805
 			AnnotatedType[] exceptionTypes) {
806
-		StoredType returnType = javaReturnType == null ? BasicTypeID.VOID.stored : loadStoredType(context, javaReturnType);
807
 
806
 
808
 
807
 
809
 		TypeParameter[] typeParameters = new TypeParameter[javaTypeParameters.length];
808
 		TypeParameter[] typeParameters = new TypeParameter[javaTypeParameters.length];
835
 		if (exceptionTypes.length > 1)
834
 		if (exceptionTypes.length > 1)
836
 			throw new IllegalArgumentException("A method can only throw a single exception type!");
835
 			throw new IllegalArgumentException("A method can only throw a single exception type!");
837
 
836
 
837
+		StoredType returnType = javaReturnType == null ? BasicTypeID.VOID.stored : loadStoredType(context, javaReturnType);
838
 		StoredType thrownType = exceptionTypes.length == 0 ? null : loadStoredType(context, exceptionTypes[0]);
838
 		StoredType thrownType = exceptionTypes.length == 0 ? null : loadStoredType(context, exceptionTypes[0]);
839
 		return new FunctionHeader(typeParameters, returnType, thrownType, AutoStorageTag.INSTANCE, parameters);
839
 		return new FunctionHeader(typeParameters, returnType, thrownType, AutoStorageTag.INSTANCE, parameters);
840
 	}
840
 	}

Loading…
Cancel
Save