Bug 328611

Summary: different key value for second level member class of a generic type
Product: [Eclipse Project] JDT Reporter: Zsolt Thalmeiner <thaliga>
Component: CoreAssignee: Jay Arthanareeswaran <jarthana>
Status: VERIFIED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: Olivier_Thomann, srikanth_sankaran
Version: 3.6   
Target Milestone: 3.7 M4   
Hardware: PC   
OS: Windows Server 2003   
Whiteboard:
Attachments:
Description Flags
Example project
none
workaround patch
none
Test case none

Description Zsolt Thalmeiner CLA 2010-10-25 10:34:41 EDT
Build Identifier: I20100608-0911

When editing the example code, different keys will be generated for class C but not for class B.

1.
If the source A.java is modified, generated keys are
"Leclipse/bug/A<TT;>.B;" for generic member class B, respectivelly
"Leclipse/bug/A<TT;>.B.C;" for generic member class C.
In this case binding objects are MemberTypeBinding.

2.
If the source Test.java  is modified, generated keys are
"Leclipse/bug/A<TT;>.B;" for generic member class B, respectivelly
"Leclipse/bug/A$B$C;" for generic member class C.
In this case binding objects are BinaryTypeBinding.

I find the difference in ResourceBinding.computeGenericTypeSignature(TypeVariableBinding[]) method.
As I see the MemberTypeBinding object for class B has the ExtraCompilerModifiers.AccGenericSignature flag, but the BinaryTypeBinding object for class B hasn't.

I don't know if it is a problem.

Reproducible: Always
Comment 1 Zsolt Thalmeiner CLA 2010-10-25 10:38:22 EDT
Created attachment 181642 [details]
Example project
Comment 2 Zsolt Thalmeiner CLA 2010-10-26 03:23:16 EDT
Created attachment 181699 [details]
workaround patch
Comment 3 Jay Arthanareeswaran CLA 2010-11-29 09:30:56 EST
Created attachment 184040 [details]
Test case

Zsolt, can you provide us a test case or the steps to reproduce the problem? The attached test case produces a similar error but in a different part of the code. 

Between, you meant ReferenceBinding and not ResourceBinding, right?
Comment 4 Jay Arthanareeswaran CLA 2010-11-29 09:31:22 EST
Thanks for the test case, Srikanth.
Comment 5 Zsolt Thalmeiner CLA 2010-11-29 10:08:56 EST
(In reply to comment #3)
> Zsolt, can you provide us a test case or the steps to reproduce the problem?
> The attached test case produces a similar error but in a different part of the
> code.
Sorry, I have no test case for this problem :(

Our AST visitor (extension of org.eclipse.jdt.internal.compiler.ASTVisitor) stores the type bindings in a map using string keys:
String key = String.valueOf(typeBinding.computeUniqueKey());

These key values are different, as I described in the description.

> Between, you meant ReferenceBinding and not ResourceBinding, right?
Yes, I meant ReferenceBinding.

I hope this will help you. If not, I should try to make small working example.
Comment 6 Srikanth Sankaran CLA 2010-11-29 22:24:47 EST
(In reply to comment #4)
> Thanks for the test case, Srikanth.

Just for the record, this test case elicits a very similar but not
identical issue.
Comment 7 Jay Arthanareeswaran CLA 2010-12-01 08:23:45 EST
(In reply to comment #5)
> I hope this will help you. If not, I should try to make small working example.

I would really appreciate an example. I am not able to come up with something myself.
Comment 8 Zsolt Thalmeiner CLA 2010-12-08 10:23:54 EST
(In reply to comment #7)
> I would really appreciate an example. I am not able to come up with something
> myself.
I'm working on it but it is not so simple...
Comment 9 Zsolt Thalmeiner CLA 2010-12-10 09:50:24 EST
As I see the mentioned problem appears only in our code because we are doing a project-wide analysis where binary and source bindings must have the same keys. As I see, the JDT compiler works in different way so I think this problem is not a JDT bug.
Thanks, and I am sorry for wasting your time.
Comment 10 Olivier Thomann CLA 2011-01-25 11:17:01 EST
Verified.