Bug 92237 - IType resolved key: key.toSignature has wrong format
Summary: IType resolved key: key.toSignature has wrong format
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.1 M7   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-21 11:13 EDT by Martin Aeschlimann CLA
Modified: 2005-05-12 09:34 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Aeschlimann CLA 2005-04-21 11:13:44 EDT
20050421

The type hierarchy now uses the resolved keys to render the type names:
Set a breakpoint in JavaElementLabels.getTypeLabel line 791 (at
Signature.getTypeParameters(key.toSignature()))
In a workspace with a 5.0 project, open 'java.util.List' in the type hierarchy.

The types contain type parameters but are not correctly extracted using
Signature.getTypeParameters.
The type signature returned is "Ljava.util.Collection<+TE;>;",
Signature.getTypeParameters expects a signature starting with C_GENERIC_START.

See bug 92233 for the problem that not all types have type parameters in their
signature.
Comment 1 Martin Aeschlimann CLA 2005-04-21 11:33:47 EDT
To change the hierarchy label provider to use the resolved key change
HierarchyLabelProvider#BUG_92233_AND_92237 to false.

HierarchyLabelProvider#BUG_92233_AND_92237 is currently 'true' so the resolved
key is not yet used.
Comment 2 Martin Aeschlimann CLA 2005-04-22 04:47:57 EDT
key= "Ljava/util/Queue<TE;>;"
signature= "Ljava.util.Queue<TE;>;"


Comment 3 Jerome Lanneluc CLA 2005-04-22 05:24:58 EDT
Changed KeyToSignature to insert the type parameters before the 'L'.
Changed BindingKeyTests#test009(), test010(), test029() and test032() to reflect
this change in signature format.
Comment 4 Jerome Lanneluc CLA 2005-04-22 09:45:30 EDT
Fix was not quite right. The signature must be: <E:>Ljava.util.Queue;.
Fixed KeyToSignature#comsumeType() to create the signature with the right format.
Updated BindingKeyTests#test009(), test010(), test029() and test032().

Also fixed Signature#getTypeParameters(char[]) to handle signatures with one
type parameter with no bounds.
Comment 5 Martin Aeschlimann CLA 2005-04-26 06:44:16 EDT
I still have problems with I20050426:

- set HierarchyLabelProvider#BUG_92233_AND_92237 to 'false'
- open type hierarchy on List<E>

key= "Ljava/lang/Iterable<TT;>;"
signature= "<T:>Ljava.lang.Iterable;"
Signature.getTypeParameters(signature)= { "T:" }
Signature.toString("T:") -> IllegalArgumentException


java.lang.IllegalArgumentException
	at
org.eclipse.jdt.internal.core.util.Util.scanTypeVariableSignature(Util.java:2407)
	at org.eclipse.jdt.core.Signature.appendTypeSignature(Signature.java:2271)
	at org.eclipse.jdt.core.Signature.appendTypeSignature(Signature.java:2215)
	at org.eclipse.jdt.core.Signature.toCharArray(Signature.java:2194)
	at org.eclipse.jdt.core.Signature.toString(Signature.java:2642)
	at
org.eclipse.jdt.ui.JavaElementLabels.getTypeSignatureLabel(JavaElementLabels.java:701)
	at
org.eclipse.jdt.ui.JavaElementLabels.getTypeArgumentSignaturesLabel(JavaElementLabels.java:729)
	at org.eclipse.jdt.ui.JavaElementLabels.getTypeLabel(JavaElementLabels.java:792)
	at org.eclipse.jdt.ui.JavaElementLabels.getElementLabel(JavaElementLabels.java:397)
	at org.eclipse.jdt.ui.JavaElementLabels.getElementLabel(JavaElementLabels.java:362)
	at org.eclipse.jdt.ui.JavaElementLabels.getTextLabel(JavaElementLabels.java:345)
	at
org.eclipse.jdt.internal.ui.viewsupport.JavaUILabelProvider.getText(JavaUILabelProvider.java:161)
Comment 6 Jerome Lanneluc CLA 2005-04-26 07:07:26 EDT
You want to use Signature#getTypeVariable(...) with "T:" instead of
Signature#toString(...) which is for type signatures, not for type parameter
signatures.
Comment 7 Martin Aeschlimann CLA 2005-04-26 08:04:52 EDT
So a type parameter signature is not a type signature and can't be used with
toString and getTypeSignatureKind.
I guess I can learn that, but I have to say that thing get quit complicated now.   
Comment 8 Jerome Lanneluc CLA 2005-04-26 09:51:23 EDT
That's right. Note the formats are different not because we want because to make
it harder for you, but because this is how it is spec'ed in the JLS3.
Comment 9 Frederic Fusier CLA 2005-05-12 09:34:37 EDT
Verified for 3.1 M7 using build I20050509-2010 + jdt.core HEAD.