Bug 103654 - BindingKey.getTypeArguments bug with qualified types
Summary: BindingKey.getTypeArguments bug with qualified types
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.4 M1   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-13 10:13 EDT by Martin Aeschlimann CLA
Modified: 2007-08-03 10:50 EDT (History)
0 users

See Also:


Attachments
Proposed fix and regression tests (5.15 KB, patch)
2007-07-05 12:18 EDT, Jerome Lanneluc CLA
no flags Details | Diff
Proposed fix (fixed typo) and regression tests (5.15 KB, patch)
2007-07-09 07:44 EDT, Jerome Lanneluc CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Aeschlimann CLA 2005-07-13 10:13:05 EDT
3.1

get the hover of 'B' in the field declaration. The hover shows pack.A.B<String,
String>.

Setting a breakpoint in JavaElementLabels.getTypeLabel you can see that
  BindingKey key= new BindingKey(type.getKey());
  String[] typeArguments= key.getTypeArguments();
returns 2 type arguments for B instead of one.


public class A<U> {
	class B<V> {
	}
	A<String>.B<String> s = new A<String>().new B<String>();
}
Comment 1 Olivier Thomann CLA 2005-08-04 14:18:09 EDT
The bug comes from the fact that the getTypeArguments() returns all the type
arguments for the key, not just the one for the selected type.
So in this case you get the type argument that applies to A and the one that
applies to B.
According to the javadoc, this might not be wrong. It might not be what you
expect, but this seems to behave as specified.
Moving to Jérôme for clarification on the spec.
Comment 2 Jerome Lanneluc CLA 2007-06-22 07:30:07 EDT
I disagree with Olivier. The binding key is for type B<String>, so its type arguments should only include String. getTypeArguments() should be fixed.
Comment 3 Jerome Lanneluc CLA 2007-07-05 12:18:23 EDT
Created attachment 73135 [details]
Proposed fix and regression tests
Comment 4 Jerome Lanneluc CLA 2007-07-09 07:44:24 EDT
Created attachment 73305 [details]
Proposed fix (fixed typo) and regression tests
Comment 5 Jerome Lanneluc CLA 2007-07-09 10:24:10 EDT
Fix and tests released for 3.4M1 in HEAD.
Comment 6 Frederic Fusier CLA 2007-08-03 10:50:26 EDT
Verified for 3.4M1 using build I20070802-0800.