-
Bug
-
Resolution: Done
-
Major
-
1.1.8.Final
-
None
-
None
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
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.
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.