|
@@ -298,19 +298,7 @@ public class JavaNativeModule {
|
298
|
298
|
}
|
299
|
299
|
}
|
300
|
300
|
|
301
|
|
- TypeVariableContext context = new TypeVariableContext();
|
302
|
|
- TypeVariable<Class<T>>[] javaTypeParameters = cls.getTypeParameters();
|
303
|
|
- TypeParameter[] typeParameters = new TypeParameter[cls.getTypeParameters().length];
|
304
|
|
- for (int i = 0; i < javaTypeParameters.length; i++) {
|
305
|
|
- TypeVariable<Class<T>> typeVariable = javaTypeParameters[i];
|
306
|
|
- TypeParameter parameter = new TypeParameter(CodePosition.NATIVE, typeVariable.getName());
|
307
|
|
- for (AnnotatedType bound : typeVariable.getAnnotatedBounds()) {
|
308
|
|
- TypeID type = loadType(context, bound).type;
|
309
|
|
- parameter.addBound(new ParameterTypeBound(CodePosition.NATIVE, type));
|
310
|
|
- }
|
311
|
|
- typeParameters[i] = parameter;
|
312
|
|
- context.put(typeVariable, parameter);
|
313
|
|
- }
|
|
301
|
+
|
314
|
302
|
|
315
|
303
|
HighLevelDefinition definition;
|
316
|
304
|
String internalName = getInternalName(cls);
|
|
@@ -327,12 +315,34 @@ public class JavaNativeModule {
|
327
|
315
|
} else {
|
328
|
316
|
definition = new ClassDefinition(CodePosition.NATIVE, module, classPkg, className, Modifiers.PUBLIC);
|
329
|
317
|
javaClass = JavaClass.fromInternalName(internalName, JavaClass.Kind.CLASS);
|
330
|
|
-
|
331
|
|
- if (cls.getAnnotatedSuperclass() != null && shouldLoadType(cls.getAnnotatedSuperclass().getType())) {
|
332
|
|
- definition.setSuperType(loadType(context, cls.getAnnotatedSuperclass()).type);
|
|
318
|
+
|
|
319
|
+ }
|
|
320
|
+
|
|
321
|
+ //Moved up here so that circular dependencies are caught (hopefully)
|
|
322
|
+ definitionByClass.put(cls, definition);
|
|
323
|
+
|
|
324
|
+ TypeVariableContext context = new TypeVariableContext();
|
|
325
|
+ TypeVariable<Class<T>>[] javaTypeParameters = cls.getTypeParameters();
|
|
326
|
+ TypeParameter[] typeParameters = new TypeParameter[cls.getTypeParameters().length];
|
|
327
|
+ for (int i = 0; i < javaTypeParameters.length; i++) {
|
|
328
|
+ TypeVariable<Class<T>> typeVariable = javaTypeParameters[i];
|
|
329
|
+ TypeParameter parameter = new TypeParameter(CodePosition.NATIVE, typeVariable.getName());
|
|
330
|
+ for (AnnotatedType bound : typeVariable.getAnnotatedBounds()) {
|
|
331
|
+ TypeID type = loadType(context, bound).type;
|
|
332
|
+ parameter.addBound(new ParameterTypeBound(CodePosition.NATIVE, type));
|
333
|
333
|
}
|
|
334
|
+ typeParameters[i] = parameter;
|
|
335
|
+ context.put(typeVariable, parameter);
|
334
|
336
|
}
|
335
|
|
-
|
|
337
|
+
|
|
338
|
+ if (definition instanceof ClassDefinition && cls.getAnnotatedSuperclass() != null && shouldLoadType(cls.getAnnotatedSuperclass().getType())) {
|
|
339
|
+ definition.setSuperType(loadType(context, cls.getAnnotatedSuperclass()).type);
|
|
340
|
+ }
|
|
341
|
+
|
|
342
|
+ if (definition.getSuperType() == null && cls != Object.class) {
|
|
343
|
+ definition.setSuperType(loadType(context, Object.class, false, false).type);
|
|
344
|
+ }
|
|
345
|
+
|
336
|
346
|
for (AnnotatedType iface : cls.getAnnotatedInterfaces()) {
|
337
|
347
|
if (shouldLoadType(iface.getType())) {
|
338
|
348
|
TypeID type = loadType(context, iface).type;
|
|
@@ -344,7 +354,6 @@ public class JavaNativeModule {
|
344
|
354
|
|
345
|
355
|
definition.typeParameters = typeParameters;
|
346
|
356
|
compiled.setClassInfo(definition, javaClass);
|
347
|
|
- definitionByClass.put(cls, definition);
|
348
|
357
|
|
349
|
358
|
StoredType thisType = new StoredType(registry.getForMyDefinition(definition), AutoStorageTag.INSTANCE);
|
350
|
359
|
for (Field field : cls.getDeclaredFields()) {
|