forked from JavaTX/JavaCompilerCore
Fehler in ASTFactory Generierung von Superinterfaces beheben
This commit is contained in:
parent
06bb978cf6
commit
72f27fab7a
@ -59,7 +59,7 @@ public class ASTFactory {
|
|||||||
superClass = (RefType) createType(java.lang.Object.class, name, "");
|
superClass = (RefType) createType(java.lang.Object.class, name, "");
|
||||||
}
|
}
|
||||||
List<RefType> implementedInterfaces = new ArrayList<>();
|
List<RefType> implementedInterfaces = new ArrayList<>();
|
||||||
for(java.lang.Class jreInterface : jreClass.getInterfaces()){
|
for(Type jreInterface : jreClass.getGenericInterfaces()){
|
||||||
implementedInterfaces.add((RefType) createType(jreInterface, name, ""));
|
implementedInterfaces.add((RefType) createType(jreInterface, name, ""));
|
||||||
}
|
}
|
||||||
GenericDeclarationList genericDeclarationList = createGenerics(jreClass.getTypeParameters(), jreClass, null);
|
GenericDeclarationList genericDeclarationList = createGenerics(jreClass.getTypeParameters(), jreClass, null);
|
||||||
@ -193,7 +193,12 @@ public class ASTFactory {
|
|||||||
params.add(createType(t, parentClass, parentMethod));
|
params.add(createType(t, parentClass, parentMethod));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RefType ret = new RefType(new JavaClassName(type.getTypeName()), params, new NullToken());
|
String name = type.getTypeName();
|
||||||
|
if(name.contains("<")){ //Komischer fix. Type von Generischen Typen kann die Generics im Namen enthalten Type<A>
|
||||||
|
//Diese entfernen:
|
||||||
|
name = name.split("<")[0];
|
||||||
|
}
|
||||||
|
RefType ret = new RefType(new JavaClassName(name), params, new NullToken());
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,6 @@ public class SuperInterfacesTest {
|
|||||||
public void testGeneric() throws ClassNotFoundException {
|
public void testGeneric() throws ClassNotFoundException {
|
||||||
Collection<ClassOrInterface> classes = new ArrayList<>();
|
Collection<ClassOrInterface> classes = new ArrayList<>();
|
||||||
classes.add(ASTFactory.createClass(TestClassGeneric.class));
|
classes.add(ASTFactory.createClass(TestClassGeneric.class));
|
||||||
//TODO: Die ASTFactory generiert hier den Supertyp falsch. Es fehlt die Parameterliste
|
|
||||||
System.out.println(FCGenerator.toFC(classes));
|
System.out.println(FCGenerator.toFC(classes));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user