]
Jose Freire updated JASSIST-101:
--------------------------------
Attachment: ResolveGenericTypeTestCase.java
Test class for GenericReflectionUtil.java
Support for generic types
-------------------------
Key: JASSIST-101
URL:
https://jira.jboss.org/jira/browse/JASSIST-101
Project: Javassist
Issue Type: Feature Request
Environment: Java >= 5.0
Reporter: Jose Freire
Assignee: Shigeru Chiba
Attachments: GenericReflectionUtil.java, ResolveGenericTypeTestCase.java
Javassist currently doesn't support generic types, coercing the generic properties to
Object.class.
As an example, if we have:
public class GenericsTest<E extends Object> {
private E value;
public E getValue() {
return value;
}
public void setValue(E value) {
this.value = value;
}
}
and we have:
public class IntegerTest extends GenericsTest<Integer> {
}
Javassist will not recognize the property "value" type as Integer.class, but as
Object.class, like:
public class IntegerTest$$javassist$$ {
private Object value;
public Object getValue() {
return value;
}
public void setValue(Object value) {
this.value = value;
}
}
What has do be done, while processing the property descriptors of class is:
1) is the propertyDescriptor.getPropertyType == Object.class? If yes then continue to
step 2
2) is java version >= 1.5.0? If yes then continue to step 3
3) return GenericReflectionUtil.resolveGenericType(<Class>,
<propertyDescriptor>);
I'll upload GenericReflectionUtil.java and ResolveGenericTypeTestCase.java for your
review.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: