Community
Participate
Working Groups
Build ID: I20070625-1500 Steps To Reproduce: Annotations often contain information which is important to the user. It would be beneficial, if the annotations (and values of the annotation attributes) are displayed in the Outline view More information:
We already show some e.g. if you add @Deprecated. Can you provide an example and also provide a mockup on how you'd like to see this in the Outline view?
Created attachment 77131 [details] Mock up for what would be nice to see
This is for @Stateless annotation defined on the type TT level
So - the proposal is to display all the annotations for a member directly above it?
*** Bug 341477 has been marked as a duplicate of this bug. ***
The solution introduced by Bug 341477 would be very nice, but you should be able to ignore certain standard annotations like Override and SuppressWarnings (e.g. via preferences). I guess most people are usually interested in annotations with application-specific meaning.
THis bug is more relevant than ever: - e4 is annotation based, so outline should show @PostConstruct, @PreDestroy and @Focus - JUnit4 is annotation based so these should be shown as well I think the annotation should be appended to the item in the Outline view and should be filterable.
As the Eclipse 4 programming model is primary using annotations to define the relevant methods, that feature request would be really helpful.
(In reply to Lars Vogel from comment #8) > As the Eclipse 4 programming model is primary using annotations to define > the relevant methods, that feature request would be really helpful. +1 on this 7-year-bug. It would be nice to organize by these nodes: Members injected members Methods injected methods injected context methods injected broker methods Command @Execute @CanExecute LifeCycle @PostConstruct @PreDestroy @Persist Application LifeCycle @PostContextCreate @ProcessAdditions @ProcessRemovals @PreSave @PostContextCreate Also show @optional and @named values / parameters in the outline.
(In reply to Steven Spungin from comment #9) > (In reply to Lars Vogel from comment #8) > > As the Eclipse 4 programming model is primary using annotations to define > > the relevant methods, that feature request would be really helpful. > > +1 on this 7-year-bug. It would be nice to organize by these nodes: Maybe you could provide a Gerrit review for this feature? I assume JDT would support any set of annotation and would not be able to implement any e4 based sorting.
(In reply to Lars Vogel from comment #10) > (In reply to Steven Spungin from comment #9) > > (In reply to Lars Vogel from comment #8) > > > As the Eclipse 4 programming model is primary using annotations to define > > > the relevant methods, that feature request would be really helpful. > > > > +1 on this 7-year-bug. It would be nice to organize by these nodes: > > Maybe you could provide a Gerrit review for this feature? I assume JDT > would support any set of annotation and would not be able to implement any > e4 based sorting. With time willing, I will provide a review to e4 tools project. I will make it extensible enough so JDT can reuse/pull-up the core. Should we re-file a bug on e4 tools?
(In reply to Steven Spungin from comment #11) > With time willing, I will provide a review to e4 tools project. I will make > it extensible enough so JDT can reuse/pull-up the core. > > Should we re-file a bug on e4 tools? +1 Just to clarify that, displayed annotations in the JDT outline view would benefit lots of users, e.g. JPA, Java EE, e4, etc.
Created attachment 246566 [details] screenshot: new appearance preferences
Created attachment 246567 [details] screenshot: annotations without parameters
Created attachment 246568 [details] screenshot: annotations with parameters
https://git.eclipse.org/r/#/c/32584/
(In reply to Steven Spungin from comment #16) > https://git.eclipse.org/r/#/c/32584/ Thanks a lot Steven, I think this looks awesome. I'm not a JDT developer but in platform.ui we try to keep changes as focused as possible. That makes review easier and later corrections if required. Can you rework this Gerrit change to only enable the annotation display in the Outline view and create a new Gerrit review for the filter and add it to Bug 443101?
The filter has been removed from latest Gerrit patch.
While this bug states "Java 5 annotations" - and perhaps should remain focussed on that for now - do you have some thoughts how this will extend to Java 8 type annotations? I assume with TYPE_USE annotation @Nullable this declaration ... @Optional @Nullable String field; ... will be rendered as ... field : @Nullable String [@Optional] ... right? (In reply to Steven Spungin from comment #13) > Created attachment 246566 [details] > screenshot: new appearance preferences I don't see anything new here, was this cropped more than intended?
The display of annotations does not distinguish between Java 7, Java 8, etc. An annotation is an annotation. > I assume with TYPE_USE annotation @Nullable this declaration ... > @Optional > @Nullable String field; > > ... will be rendered as ... > field : @Nullable String [@Optional] > > ... right? > > field: String [@Optional @Nullable] see screenshot https://bugs.eclipse.org/bugs/attachment.cgi?id=246567 > (In reply to Steven Spungin from comment #13) > > Created attachment 246566 [details] > > screenshot: new appearance preferences > > I don't see anything new here, was this cropped more than intended? I think bugzilla had an issue when that image was uploaded. I don't have the source image any more, and unfortunately we have temporary given up trying to contribute any of our code to the JDT project, so you will just have to use your imagination or pull down the patch from gerrit and see for yourself :)
(In reply to Steven Spungin from comment #20) > The display of annotations does not distinguish between Java 7, Java 8, etc. > An annotation is an annotation. Annotations do have different @Target;s. Annotations with @Target(TYPE_USE) are different from those available in Java 5. > > I assume with TYPE_USE annotation @Nullable this declaration ... > > @Optional > > @Nullable String field; > > > > ... will be rendered as ... > > field : @Nullable String [@Optional] > > > > ... right? > > > > > > field: String [@Optional @Nullable] > see screenshot https://bugs.eclipse.org/bugs/attachment.cgi?id=246567 That would be wrong, because a TYPE_USE annotation in this position is bound to the type, not to the field. For illustration: Eventually, we will also need to handle things like: List<@NonNull String> field; Nevermind, I guess we can handle the TYPE_USE case in a subsequent bug.
> Annotations do have different @Target;s. Annotations with @Target(TYPE_USE) > are different from those available in Java 5. > I see. Thanks for the insight. Is "field : @Nullable String [@Optional]" how you would desire to see the annotation?
(In reply to Stephan Herrmann from comment #21) > (In reply to Steven Spungin from comment #20) > > field: String [@Optional @Nullable] > > see screenshot https://bugs.eclipse.org/bugs/attachment.cgi?id=246567 > > That would be wrong, because a TYPE_USE annotation in this position is bound > to the type, not to the field. > > For illustration: Eventually, we will also need to handle things like: > List<@NonNull String> field; > > Nevermind, I guess we can handle the TYPE_USE case in a subsequent bug. For javadoc hover & view this has been implemented via bug 403917.