Community
Participate
Working Groups
I would like there to be a way to get eclipse to display annotations (that the required retention policy) to be visible in package explorer, in the outline and text editor as a pop up the way the javadoc comments are seen. Since annotations can be reflected I don't see why eclipse does not have an option to display them the way it can display javadoc comments. This would allow developers to communicate infromation through annotations.
Moving to JDT/UI
Showing the annotation in the hover is a good idea, I think. Ok, if I change the title of the request to 'Seeing Java Annotations in the hover'?
In the unlikely case that you were asking me, your sugested change is fine with me.
I actually meant you, Troy :-) (You filed the bug, so before I change the title of the bug I rather ask..) Moving to Platform/Text
Just to clarify: this means you would only see it inside the Java editor when hovering over an element. Not in Package Explorer's or Outline's hover.
We should do the same as javadoc tool generates. This means we should show those annotations in the hover that have the @Documented annotation.
*** Bug 200817 has been marked as a duplicate of this bug. ***
*** Bug 171214 has been marked as a duplicate of this bug. ***
My use case of annotations would really benefit from this feature. I create proxies of interfaces which include i18-related methods like this: @MessageFormatPattern("Element {0,number,integer} is null of {1}.") String nullArrayElement(int index, String name); My proxy impl uses that message pattern along with the method arguments. The property keys are the fully qualified method names. An apt-based build tool plugin generates the default properties file. Anyways, with this enhancement my i18n messages would be automatically documented in the javadoc hover.
Created attachment 114538 [details] annotation placement variants Where in the hover would you expect annotations to show up? I made some experiments (see attached image), but I'm not sure where and how to put the annotations. The problem is that annotations can become long, and putting them in front of the header line would move the header image and label far away from where users expect them. Putting them between the header and the description potentially moves the description out of sight. Any opinions? I'm tending towards solution 4 (between header and description, with visible links).
Created attachment 114539 [details] work in progress 1
Number 4 looks good. The content ordering seems natural. Having the annotations linkable is really useful. Thanks for the great work Markus.
Just a sidenote: I am not that familiar with GWT, but it looks like the GWT i18n framework users will really find this enhancement useful. Check out the "Complete Annotations Example" section of the com.google.gwt.i18n.client.Messages javadoc - http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/gwt/i18n/client/Messages.html
Are annotation that important in practice? I fear that showing annotations at the beginning of the Javadoc hover (also proposed solution 4 between header and description) would too often move the really important parts (main description and parameter descriptions) out of sight. Would it be a big problem if we moved the annotations to the very end of the Javadoc? That would in fact show them at the same place as they are in source (i.e. after the /** Javadoc */ block). Tip: If you want to quickly see the annotations of something, just use the Source hover ('Shift + hover' by default, modifier can be configured on the 'Hovers' preference page).
I'm not sure to understand why bug 245689 blocks this one.
>I'm not sure to understand why bug 245689 blocks this one. Maybe because the problem appears more often with annotations? Will have to wait for Markus for the answer.
> >I'm not sure to understand why bug 245689 blocks this one. > Maybe because the problem appears more often with annotations? Yep, if links don't work in standard annotations, this bug cannot be completely FIXED. (In reply to bug 245689 comment #1) > The same problem occurs in I20080930-0921 when I open > javax.annotation.Generated from jdk6 and try to resolve "Documented", > "Retention", etc. which are imported with "import java.lang.annotation.*;".
>I'm not sure to understand why bug 245689 blocks this one. Actually, the latest work in progress does not to resolve annotation types from source names any more (I need bindings for other reasons, so I can also generate the resolved links from the bindings). Removing bug 245689 from blocking bugs.
Sorry, I ran out of time for 3.5. The fix needs to create more ASTs than normal Javadoc hovers, and I don't want to risk breaking or delaying the hovers at this stage.
*** Bug 289966 has been marked as a duplicate of this bug. ***
Created attachment 166009 [details] Fix
Fixed in HEAD.
Verified for 3.6 M7 with I20100426-0852.
*** Bug 133345 has been marked as a duplicate of this bug. ***