I am not sure what exactly is being generated and how you do that without seeing any code and the exception. However, from the information you have provided you want to create a JavaType with generics. The best way to go about this is to look at the existing sources which generate similar things to what you want to achieve. Here is an example:
Code:
List<JavaType> params = new ArrayList<JavaType>();
params.add(new JavaType("com.foo.Order"));
JavaType setType = new JavaType("java.util.Set", 0, DataType.TYPE, null, params);
This would generate a Set<Order>.
Does this help?