Community
Participate
Working Groups
With the following in the same file: package p1; class Test< T extends Test<T, B>, B extends Key<T, B>> { } class Key< T extends Test<T, K>, K extends Key<T, K>> { } Exception in thread "Text Viewer Hover Presenter" java.lang.IllegalArgumentException at o.e.j.core.Signature.getTypeParameters(Signature.java:1374) at o.e.j.core.Signature.getTypeParameters(Signature.java:1431) at o.e.j.ui.JavaElementLabels.getTypeLabel(JavaElementLabels.java:821) at o.e.j.ui.JavaElementLabels.getElementLabel(JavaElementLabels.java:398) at o.e.j.ui.JavaElementLabels.getElementLabel(JavaElementLabels.java:363) at o.e.j.internal.ui.text.java.hover.JavadocHover.getInfoText (JavadocHover.java:142) at o.e.j.internal.ui.text.java.hover.JavadocHover.getHoverInfo (JavadocHover.java:118) at o.e.j.internal.ui.text.java.hover.AbstractJavaEditorTextHover.getHoverInfo (AbstractJavaEditorTextHover.java:120) at o.e.j.internal.ui.text.java.hover.BestMatchHover.getHoverInfo (BestMatchHover.java:102) at o.e.j.internal.ui.text.java.hover.JavaEditorTextHoverProxy.getHoverInfo (JavaEditorTextHoverProxy.java:69) at org.eclipse.jface.text.TextViewerHoverManager$4.run (TextViewerHoverManager.java:160)
This is suspicious. The binding key is: Lp/X~Test<TT;TB;>; And the corresponding signature ends up being: <T:>Lp.X~Test; The label seems wrong. We end up with Test<T> instead of the expecting Test<T, B>. This leads to a wrong label when hovering on Test in "T extends Test<T, B>". For Key in "B extends Key<T, B>", the binding key is: Lp/X~Key<Lp/X~Test;:TT;Lp/X~Test;:TB;>; And then the label is as expected: Key<T, B>. Moving to JDT/UI to investigate if KeyToSignature is working as expected. Philippe, I put you in CC, because the binding for Test<T, B> is seen as a generic type and the binding for Key<T, B> is seend as a parameterized type. This doesn't look consistent.
Olivier, I actually don't understand your question. The code on JDT/UI side looks as follows: if (getFlag(flags, T_TYPE_PARAMETERS)) { if (getFlag(flags, USE_RESOLVED) && type.isResolved()) { BindingKey key= new BindingKey(type.getKey()); if (key.isParameterizedType()) { String[] typeArguments= key.getTypeArguments(); getTypeArgumentSignaturesLabel(typeArguments, flags, buf); } else { String[] typeParameters= Signature.getTypeParameters(key.internalToSignature()); getTypeParameterSignaturesLabel(typeParameters, flags, buf); } } else if (type.exists()) { ... } } KeyToSignature is an internal JDT/Core class. However what we expect is that BindingKey#getTypeArguments (which uses KeyToSignature) returns an array of type signatures for parameterized types. Moving back to JDT/Core.
Indeed, problem is on our side. Thanks Dirk.
Created attachment 21932 [details] Proposed fix
Created attachment 21933 [details] Regression test
+1 for RC2
Released fix and test.
Verified in N20050606-0010
Verified for 3.1 RC2 using build I20050610-0010