Bug 83064 - [plan][1.5] Unidentical bindings for declaration of and reference to Class.MethodArray
Summary: [plan][1.5] Unidentical bindings for declaration of and reference to Class.Me...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 M4   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 83228 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-01-18 04:32 EST by Markus Keller CLA
Modified: 2005-12-13 08:04 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2005-01-18 04:32:28 EST
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.
Comment 1 Markus Keller CLA 2005-01-20 09:42:32 EST
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();
    }
}
Comment 2 Jerome Lanneluc CLA 2005-01-23 14:50:37 EST
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.
Comment 3 Jerome Lanneluc CLA 2005-01-24 11:13:05 EST
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.
Comment 4 Philipe Mulet CLA 2005-04-19 08:02:03 EDT
Y declaration is MemberTypeBinding, where field type is ParameterizedTypeBinding
with null arguments, and raw X enclosing type (since Y is static).
Comment 5 Philipe Mulet CLA 2005-04-19 08:03:11 EDT
*** Bug 83228 has been marked as a duplicate of this bug. ***
Comment 6 Philipe Mulet CLA 2005-06-09 09:42:56 EDT
Defer
Comment 7 Jerome Lanneluc CLA 2005-09-22 12:58:40 EDT
To be considered for 3.1 M4
Comment 8 Jerome Lanneluc CLA 2005-09-22 12:59:05 EDT
I meant 3.2 M4
Comment 9 Philipe Mulet CLA 2005-11-15 07:34:20 EST
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.
Comment 10 Philipe Mulet CLA 2005-11-15 07:34:59 EST
Jerome: This being said, the binding key should likely tell the difference.
Comment 11 Jerome Lanneluc CLA 2005-12-08 06:44:37 EST
Changed the binding key for parameterized type with a raw enclosing type to include "<>".

Added regression test ASTConverter15Test#test204/205
Comment 12 David Audel CLA 2005-12-13 08:04:49 EST
Verified for 3.2 M4 using build I20051212-0010