public List<? extends Root> getChildren() {
return children;
}
public void setChildren(List<? extends Root> children) {
this.children = children;
}
Root cause:
Caused by: java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.WildcardTypeImpl cannot be cast to java.lang.Class
at uk.co.buildergenerator.BuilderGeneratorUtils.getTargetTypeClass(BuilderGeneratorUtils.java:141)
at uk.co.buildergenerator.BuilderGeneratorUtils.getParameterType(BuilderGeneratorUtils.java:176)
at uk.co.buildergenerator.WithMethodFactory.createWithMethod(WithMethodFactory.java:20)
at uk.co.buildergenerator.WithMethodList.(WithMethodList.java:22)
... 6 more
Wild card example:
Root cause:
Caused by: java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.WildcardTypeImpl cannot be cast to java.lang.Class at uk.co.buildergenerator.BuilderGeneratorUtils.getTargetTypeClass(BuilderGeneratorUtils.java:141) at uk.co.buildergenerator.BuilderGeneratorUtils.getParameterType(BuilderGeneratorUtils.java:176) at uk.co.buildergenerator.WithMethodFactory.createWithMethod(WithMethodFactory.java:20) at uk.co.buildergenerator.WithMethodList.(WithMethodList.java:22)
... 6 more
Wild cards to consider:
? ? extends Number ? super T
See: http://docs.oracle.com/javase/7/docs/api/javax/lang/model/type/WildcardType.html http://docs.oracle.com/javase/7/docs/api/javax/lang/model/type/TypeMirror.html