Community
Participate
Working Groups
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.
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.
key= "Ljava/util/Queue<TE;>;" signature= "Ljava.util.Queue<TE;>;"
Changed KeyToSignature to insert the type parameters before the 'L'. Changed BindingKeyTests#test009(), test010(), test029() and test032() to reflect this change in signature format.
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.
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)
You want to use Signature#getTypeVariable(...) with "T:" instead of Signature#toString(...) which is for type signatures, not for type parameter signatures.
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.
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.
Verified for 3.1 M7 using build I20050509-2010 + jdt.core HEAD.