| Summary: | [1.7] Incorrect Javadoc shown for reference of invokeExact (missing PolymorphicSignature annotation) | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Deepak Azad <deepakazad> | ||||
| Component: | Core | Assignee: | Olivier Thomann <Olivier_Thomann> | ||||
| Status: | VERIFIED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | jarthana, markus.kell.r, Olivier_Thomann | ||||
| Version: | 3.7 | Flags: | Olivier_Thomann:
review?
(amj87.iitr) |
||||
| Target Milestone: | 3.7.1 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows XP | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
(In reply to comment #0) > 1) The method signature is shown as > "Object java.lang.invoke.MethodHandle.invokeExact(String args0, char args1) > throws Throwable" > Shouldn't it be "invokeExact(Object... args)" ? I think this should be handled directly in: org.eclipse.jdt.internal.ui.viewsupport.JavaElementLabelComposer.appendMethodLabel(IMethod, long) when the IMethod is polymorphic the declared types should be used. > 2) @PolymorphicSignature annotation is not shown in the javadoc. (The > annotation is there when hovering over declaration of invokeExact, but is > missing on the method reference) I am not sure why you expect the annotation on the reference. Created attachment 200106 [details]
Proposed fix + regression test
We indeed are returning method declaration annotation for method invocations. This patch should solve that part of the problem. I still believe the signature should be handled by the UI side.
Ayushman, please review. Released in BETA_JAVA7 branch only. Markus/Deepak, could you please confirm that the signature should be handled by the UI side ? Maybe we should add an isPolymorphic() method on IMethod to ease the check on the UI side. I am a little confused. When I hover over the declaration or a reference of java.util.Arrays.asList(T...), I do NOT see @SafeVarargs annotation in the javadoc hover.
However, when I create my own method and hover over its declaration or a reference I see the annotation in the javadoc hover.
@SafeVarargs
public static <T> List<T> asList(T... a) {
return null;
}
With the fix from comment 2, java.util.Arrays.asList(T...) is the only case I know at this point where a annotation is missing in the javadoc hover.
The signature is correct as it is rendered. The invocation of polymorphic methods is handled specially by the compiler: It always uses the static types of the actual argument expressions to determine the actually called method. The hover reinforces that by showing the actual signature. The fix for the PolymorphicSignature annotation works fine. (In reply to comment #5) > I am a little confused. When I hover over the declaration or a reference of > java.util.Arrays.asList(T...), I do NOT see @SafeVarargs annotation in the > javadoc hover. That's a separate issue. Filed bug 353093. Verified for 3.8M1 with build I20110729-1200. |
- Hover over invokeExact method call to bring up the Javadoc hover ---------------------------------------------------------------- public static void main(String[] args) throws Throwable { MethodHandles.Lookup lookup = MethodHandles.lookup(); MethodType mt = MethodType.methodType(String.class, String.class, char.class); MethodHandle mh = lookup.findStatic(InvokeExactAndGeneric1.class, "append", mt); mh.invokeExact("appen",'d'); //hover here } ---------------------------------------------------------------- Two things 1) The method signature is shown as "Object java.lang.invoke.MethodHandle.invokeExact(String args0, char args1) throws Throwable" Shouldn't it be "invokeExact(Object... args)" ? 2) @PolymorphicSignature annotation is not shown in the javadoc. (The annotation is there when hovering over declaration of invokeExact, but is missing on the method reference)