[jboss-jira] [JBoss JIRA] Updated: (JASSIST-101) Support for generic types

Jose Freire (JIRA) jira-events at lists.jboss.org
Fri Dec 18 12:14:32 EST 2009


     [ https://jira.jboss.org/jira/browse/JASSIST-101?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jose Freire updated JASSIST-101:
--------------------------------

    Attachment: GenericReflectionUtil.java


Utility class to process generic types

> 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
>
>
> 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: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list