[weld-issues] [JBoss JIRA] (WELD-1132) TypeVariableResolverTest.testVariableArray() test is failing on JDK 7

Marko Lukša (JIRA) jira-events at lists.jboss.org
Wed May 16 05:17:18 EDT 2012


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

Marko Lukša resolved WELD-1132.
-------------------------------

    Fix Version/s: 1.1.9.Final
       Resolution: Done

    
> TypeVariableResolverTest.testVariableArray() test is failing on JDK 7
> ---------------------------------------------------------------------
>
>                 Key: WELD-1132
>                 URL: https://issues.jboss.org/browse/WELD-1132
>             Project: Weld
>          Issue Type: Bug
>    Affects Versions: 1.1.8.Final
>            Reporter: Marko Lukša
>            Assignee: Marko Lukša
>             Fix For: 1.1.9.Final
>
>
> The problem is with how java reflection handles arrays. Different JDKs and supposedly even different methods in the same JDK use two different representations of an array:
> From http://weblogs.java.net/blog/kohsuke/archive/2008/12/introspecting_g.html
> {quote}
> Note that there's a little overlap between Class and GenericArrayType. a type like String[] can be represented either as String[].class or GenericArrayType(String.class). Different JDK methods return different forms (I filed a bug on this but forgot which one), so your code should anticipate both patterns.
> {quote}
> In JDK6 {{new TypeLiteral<Integer[]>() {}.getType()}} returns {{GenericArrayType(Integer.class)}}, while in JDK7 it returns {{Integer[].class}}. 
> Since {{Integer[]}} is not a generic array, we can skip using {{TypeLiteral}} and simply use {{Integer[].class}} as the expected value. However, {{TypeVariableResolver}} should also be modified so it never returns {{GenericArrayType}}, when the array isn't generic.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the weld-issues mailing list