-
Bug
-
Resolution: Done
-
Major
-
1.1.1.Final
forge doesn't support correctly generics.
some use case, improperly parsed:
JavaClass c1 = JavaParser.parse(JavaClass.class, "package it.coopservice.test; public class Bar<T> {}");
JavaClass javaClass = JavaParser.create(JavaClass.class);
javaClass.setName("TBarTest");
javaClass.setSuperType(c1);
javaClass.setPackage("it.coopservice.test");
javaClass.addImport("it.coopservice.test.Bar");
produces:
public class TBarTest extends Bar{}
and this:
JavaClass c0 = JavaParser.parse(JavaClass.class, "package it.coopservice.test; public class Foo {}");
JavaClass c1 = JavaParser.parse(JavaClass.class, "package it.coopservice.test; public class Bar<Foo> {}");
JavaClass javaClass = JavaParser.create(JavaClass.class);
javaClass.setName("FooBarDirectTest");
javaClass.setPackage("it.coopservice.test");
javaClass.addImport("it.coopservice.test.Bar");
javaClass.addImport("it.coopservice.test.Foo");
javaClass.setSuperType("Bar<Foo>");
produces:
java.lang.IllegalArgumentException
my complete test code and output:
https://gist.github.com/3746475