Community
Participate
Working Groups
I20050112-1200 Look at the static nested class MethodArray in java.lang.Class of an 1.5 JDK. The bindings for the type declaration and the reference in void addAll(MethodArray ma) { ... } are not identical, but their ITypeBinding#getKey()s are the same. ITypeBinding#isEqualTo(..) also thinks they are different. AFAICS, the difference is that the declaration's declaring class is the generic type and the reference's declaring class is the raw type.
This is probably the same problem: The bindings for declaration and reference to "value" have the same key but are not identical: class A<E> { @I(12) @interface I { @I(value=13) int value(); } }
Simpler test case: public class X<T> { static class Y { Y y; } } The binding for the field's type Y is a ParameterizedTypeBinding with no argument. The binding for the class declaration Y is a MemberTypeBinding. Their genericTypeSignature() is the same.
It isn't clear yet if the compiler's bindings are going to change to be consistent, or if we will work around this in the DOM AST bindings.
Y declaration is MemberTypeBinding, where field type is ParameterizedTypeBinding with null arguments, and raw X enclosing type (since Y is static).
*** Bug 83228 has been marked as a duplicate of this bug. ***
Defer
To be considered for 3.1 M4
I meant 3.2 M4
Declarations are still going to be associated with generic types (SourceTypeBinding), but references will be made consistent; i.e. references to generic types from within body of this type are no longer SourceTypeBinding in cases. I believe the situation we see here will not be affected. Clients have to figure whether they consider a type reference or a type declaration; but at least now, all type references will look the same, no matter where they reside.
Jerome: This being said, the binding key should likely tell the difference.
Changed the binding key for parameterized type with a raw enclosing type to include "<>". Added regression test ASTConverter15Test#test204/205
Verified for 3.2 M4 using build I20051212-0010