Browse Source

Merge remote-tracking branch 'jared/development' into genericParams

kindlich 5 years ago
parent
commit
fe4fd443d5
No known key found for this signature in database

+ 9
- 8
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/DefinitionTypeID.java View File

5
  */
5
  */
6
 package org.openzen.zenscript.codemodel.type;
6
 package org.openzen.zenscript.codemodel.type;
7
 
7
 
8
-import org.openzen.zenscript.codemodel.GenericName;
9
-import java.util.Arrays;
10
-import java.util.HashMap;
11
-import java.util.List;
12
-import java.util.Map;
13
-import java.util.Objects;
14
-import java.util.Set;
15
 import org.openzen.zenscript.codemodel.GenericMapper;
8
 import org.openzen.zenscript.codemodel.GenericMapper;
9
+import org.openzen.zenscript.codemodel.GenericName;
16
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
10
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
17
 import org.openzen.zenscript.codemodel.definition.AliasDefinition;
11
 import org.openzen.zenscript.codemodel.definition.AliasDefinition;
18
 import org.openzen.zenscript.codemodel.definition.EnumDefinition;
12
 import org.openzen.zenscript.codemodel.definition.EnumDefinition;
21
 import org.openzen.zenscript.codemodel.generic.TypeParameter;
15
 import org.openzen.zenscript.codemodel.generic.TypeParameter;
22
 import org.openzen.zenscript.codemodel.type.storage.StorageTag;
16
 import org.openzen.zenscript.codemodel.type.storage.StorageTag;
23
 
17
 
18
+import java.util.Arrays;
19
+import java.util.HashMap;
20
+import java.util.List;
21
+import java.util.Map;
22
+import java.util.Objects;
23
+import java.util.Set;
24
+
24
 /**
25
 /**
25
  *
26
  *
26
  * @author Hoofdgebruiker
27
  * @author Hoofdgebruiker
42
 		if (typeArguments == null)
43
 		if (typeArguments == null)
43
 			throw new NullPointerException("typeParameters cannot be null");
44
 			throw new NullPointerException("typeParameters cannot be null");
44
 		if (typeArguments.length != definition.getNumberOfGenericParameters())
45
 		if (typeArguments.length != definition.getNumberOfGenericParameters())
45
-			throw new IllegalArgumentException("Wrong number of type parameters!");
46
+			throw new IllegalArgumentException("Wrong number of type parameters! " + definition.name + " expected: " + definition.getNumberOfGenericParameters() + " got: " + typeArguments.length);
46
 		if (definition.isInnerDefinition() && !definition.isStatic() && outer == null)
47
 		if (definition.isInnerDefinition() && !definition.isStatic() && outer == null)
47
 			throw new IllegalArgumentException("Inner definition requires outer instance");
48
 			throw new IllegalArgumentException("Inner definition requires outer instance");
48
 		if ((!definition.isInnerDefinition() || definition.isStatic()) && outer != null)
49
 		if ((!definition.isInnerDefinition() || definition.isStatic()) && outer != null)

+ 3
- 2
JavaBytecodeCompiler/build.gradle View File

14
 }
14
 }
15
 
15
 
16
 dependencies {
16
 dependencies {
17
-	compile 'org.ow2.asm:asm-debug-all:6.0_BETA'
18
-	compile project(':CodeModel')
17
+    compile group: 'org.ow2.asm', name: 'asm', version: '7.2'
18
+    compile group: 'org.ow2.asm', name: 'asm-commons', version: '7.2'
19
+    compile project(':CodeModel')
19
 	compile project(':JavaShared')
20
 	compile project(':JavaShared')
20
 }
21
 }

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

274
 				} else if (specifiedName.indexOf('.') >= 0) {
274
 				} else if (specifiedName.indexOf('.') >= 0) {
275
 					if (!specifiedName.startsWith(pkg.fullName))
275
 					if (!specifiedName.startsWith(pkg.fullName))
276
 						throw new IllegalArgumentException("Specified @Name as \"" + specifiedName + "\" for class: \"" + cls
276
 						throw new IllegalArgumentException("Specified @Name as \"" + specifiedName + "\" for class: \"" + cls
277
-								.toString() + "\" but it's not in the module root package");
277
+								.toString() + "\" but it's not in the module root package: \"" + pkg.fullName + "\"");
278
 
278
 
279
 					classPkg = getPackage(basePackage + specifiedName.substring(pkg.fullName.length()));
279
 					classPkg = getPackage(basePackage + specifiedName.substring(pkg.fullName.length()));
280
 					className = specifiedName.substring(specifiedName.lastIndexOf('.') + 1);
280
 					className = specifiedName.substring(specifiedName.lastIndexOf('.') + 1);
306
 
306
 
307
 		//TypeVariableContext context = new TypeVariableContext();
307
 		//TypeVariableContext context = new TypeVariableContext();
308
 		TypeVariable<Class<T>>[] javaTypeParameters = cls.getTypeParameters();
308
 		TypeVariable<Class<T>>[] javaTypeParameters = cls.getTypeParameters();
309
-		TypeParameter[] typeParameters = new TypeParameter[cls.getTypeParameters().length];
309
+        TypeParameter[] typeParameters = new TypeParameter[cls.getTypeParameters().length];
310
 		definition.typeParameters = typeParameters;
310
 		definition.typeParameters = typeParameters;
311
-
312
 		for (int i = 0; i < javaTypeParameters.length; i++) {
311
 		for (int i = 0; i < javaTypeParameters.length; i++) {
313
 			//Put up here for nested parameters?
312
 			//Put up here for nested parameters?
314
 			TypeVariable<Class<T>> typeVariable = javaTypeParameters[i];
313
 			TypeVariable<Class<T>> typeVariable = javaTypeParameters[i];
324
 				TypeID type = loadType(context, bound).type;
323
 				TypeID type = loadType(context, bound).type;
325
 				parameter.addBound(new ParameterTypeBound(CodePosition.NATIVE, type));
324
 				parameter.addBound(new ParameterTypeBound(CodePosition.NATIVE, type));
326
 			}
325
 			}
327
-			typeParameters[i] = parameter;
326
+            typeParameters[i] = parameter;
328
 		}
327
 		}
329
 
328
 
330
 		if (!foundRegistry && definition instanceof ClassDefinition && cls.getAnnotatedSuperclass() != null && shouldLoadType(cls.getAnnotatedSuperclass().getType())) {
329
 		if (!foundRegistry && definition instanceof ClassDefinition && cls.getAnnotatedSuperclass() != null && shouldLoadType(cls.getAnnotatedSuperclass().getType())) {
343
 				compiled.setImplementationInfo(member, new JavaImplementation(true, javaClass));
342
 				compiled.setImplementationInfo(member, new JavaImplementation(true, javaClass));
344
 			}
343
 			}
345
 		}
344
 		}
346
-
347
 		compiled.setClassInfo(definition, javaClass);
345
 		compiled.setClassInfo(definition, javaClass);
348
 
346
 
349
 		StoredType thisType = new StoredType(registry.getForMyDefinition(definition), AutoStorageTag.INSTANCE);
347
 		StoredType thisType = new StoredType(registry.getForMyDefinition(definition), AutoStorageTag.INSTANCE);

Loading…
Cancel
Save