Community
Participate
Working Groups
I20050923-1000 Raw ITypeBindings don't deliver what the javadocs of getTypeArguments() and getTypeParameters() tell. public class Generic<E> { } class User { Generic raw; java.util.Collection rawCollection; } Currently, these values are returned: Raw reference to source type Generic: getTypeParameters() == { E }, getTypeArguments() == {} Raw reference to binary type Collection: getTypeParameters() == {}, getTypeArguments() == {} I would expect these answers for both raw references: getTypeParameters() == {}, getTypeArguments() == { Object }
Is this still an issue ?
Yes, has not been changed in HEAD compared to I20050923-1000.
getTypeParameters() and getTypeArguments() should return an empty array in this case. I willa adjust the specifications of getTypeArguments() and fix the implementation of getTypeParameters(). Patch to follow. Philippe, +1 for RC2?
Created attachment 39293 [details] Proposed fix
Created attachment 39294 [details] Regression test
+1 for 3.2-RC2, assuming JDT/UI is ok with the change.
Added org.eclipse.jdt.core.tests.dom.ASTConverter15Test.test0217. An empty array is returned in all cases described in comment 0. Fixed and released in HEAD.
I'm OK with the code change for getTypeParameters() (unless we get test failures in the N-build, but I don't think we will ...). However, I think the original API of ITypeBindings#getTypeArguments() would have been quite useful if it worked. E.g. here: class Generic<E extends List<String>> { } class User { Generic raw; } , I currently see no way to get at the type argument for E from the raw binding (a raw List here).
Verified with I20060427-1600 for RC2. Markus, Why not using getTypeDeclaration() on the raw type binding.
getTypeDeclaration() returns a generic binding, from which I can get the type parameters, but not the type arguments of the raw binding. Since getErasure() on the individual type parameters also doesn't return raw types, I don't think there's currently a way to solve the puzzler in comment 7.