Browse Source

Maybe fixed type arguments, added more logger info

Jared 5 years ago
parent
commit
1d02904fea
No account linked to committer's email address

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

@@ -5,14 +5,8 @@
5 5
  */
6 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 8
 import org.openzen.zenscript.codemodel.GenericMapper;
9
+import org.openzen.zenscript.codemodel.GenericName;
16 10
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
17 11
 import org.openzen.zenscript.codemodel.definition.AliasDefinition;
18 12
 import org.openzen.zenscript.codemodel.definition.EnumDefinition;
@@ -21,6 +15,13 @@ import org.openzen.zenscript.codemodel.definition.VariantDefinition;
21 15
 import org.openzen.zenscript.codemodel.generic.TypeParameter;
22 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 27
  * @author Hoofdgebruiker
@@ -42,7 +43,7 @@ public class DefinitionTypeID implements TypeID {
42 43
 		if (typeArguments == null)
43 44
 			throw new NullPointerException("typeParameters cannot be null");
44 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 47
 		if (definition.isInnerDefinition() && !definition.isStatic() && outer == null)
47 48
 			throw new IllegalArgumentException("Inner definition requires outer instance");
48 49
 		if ((!definition.isInnerDefinition() || definition.isStatic()) && outer != null)

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

@@ -300,7 +300,7 @@ public class JavaNativeModule {
300 300
 
301 301
 		TypeVariableContext context = new TypeVariableContext();
302 302
 		TypeVariable<Class<T>>[] javaTypeParameters = cls.getTypeParameters();
303
-		TypeParameter[] typeParameters = new TypeParameter[cls.getTypeParameters().length];
303
+        definition.typeParameters = new TypeParameter[cls.getTypeParameters().length];
304 304
 		for (int i = 0; i < javaTypeParameters.length; i++) {
305 305
 			TypeVariable<Class<T>> typeVariable = javaTypeParameters[i];
306 306
 			TypeParameter parameter = new TypeParameter(CodePosition.NATIVE, typeVariable.getName());
@@ -308,10 +308,10 @@ public class JavaNativeModule {
308 308
 				TypeID type = loadType(context, bound).type;
309 309
 				parameter.addBound(new ParameterTypeBound(CodePosition.NATIVE, type));
310 310
 			}
311
-			typeParameters[i] = parameter;
311
+            definition.typeParameters[i] = parameter;
312 312
 			context.put(typeVariable, parameter);
313 313
 		}
314
-
314
+  
315 315
 		if (definition instanceof ClassDefinition && cls.getAnnotatedSuperclass() != null && shouldLoadType(cls.getAnnotatedSuperclass().getType())) {
316 316
 			definition.setSuperType(loadType(context, cls.getAnnotatedSuperclass()).type);
317 317
 		}
@@ -329,7 +329,7 @@ public class JavaNativeModule {
329 329
 			}
330 330
 		}
331 331
 		
332
-		definition.typeParameters = typeParameters;
332
+		
333 333
 		compiled.setClassInfo(definition, javaClass);
334 334
 		
335 335
 		StoredType thisType = new StoredType(registry.getForMyDefinition(definition), AutoStorageTag.INSTANCE);

Loading…
Cancel
Save