Community
Participate
Working Groups
R3.6. The 'Add newline after annotations on ...' option also adds newlines for each annotation if enabled. Have this: import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Documented @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.ANNOTATION_TYPE) public @interface Documented { } Format ==> it also puts each annotation on a new line. Either we have to rename the options or add a new preference that controls forced wrapping of annotations.
Ayush, can you take a look at this? Thanks
i think i was about to log a duplicate ... i want to be able to format so that multiple annotations on the same element (method, field, parameter) all appear on the same line, however a new line is inserted after the last annotation, ie: @Override @SuppressWarnings("all") @FeedTheCat public static final synchronized void goDoSomeWork(Person me) {} I guess wrapping might be important too.
I think we should have another option under New Lines>Annotation [x] Insert new line after each annotation Iff this option is selected, we will put each annotation on a fresh line, otherwise we will leave the formatting(specifically wrapping) between annotations as it is, while still cleaning up useless whitespaces, etc. The other alternative is to leave wrapping between annotations untouched and add no new option. Dani, what do you think?
> The other alternative is to leave wrapping between annotations untouched and > add no new option. This is not an option since the current behavior doesn't match what the UI says. >[x] Insert new line after each annotation This would be a contradiction to the other options. Better: [x] Insert new line between annotations Given API freeze we could consider to adjust the UI for 3.7: "Add newline after annotations on ..." ==> "Add newline after and between annotations on ...'
(In reply to comment #4) > Given API freeze we could consider to adjust the UI for 3.7: > > "Add newline after annotations on ..." > ==> > "Add newline after and between annotations on ...' or "Add newline after each annotation on ..." So, i'll change the target for this bug to 3.8 and we can have the UI fix for 3.7. For 3.8, we'll change the UI back to what it is now and add the new option "Insert new line between annotations".
(In reply to comment #4) > > The other alternative is to leave wrapping between annotations untouched and > > add no new option. > This is not an option since the current behavior doesn't match what the UI > says. Btw, with that statement I basically meant changing the behaviour so that formatting the code @Documented @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.ANNOTATION_TYPE) public @interface Documented {} leads to @Documented @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.ANNOTATION_TYPE) public @interface Documented {} (i.e. new line inserted only after the last annotation) Why is this not acceptable?
Created attachment 193239 [details] possible fix A fix illustrating comment 6. IMO, this is better than changing the UI because this does exactly what the UI says right now i.e. insert new line after annotation*s* on xxxx.
(In reply to comment #7) > Created attachment 193239 [details] [diff] > possible fix > > A fix illustrating comment 6. > > IMO, this is better than changing the UI because this does exactly what the UI > says right now i.e. insert new line after annotation*s* on xxxx. No it is not better: the annotations are wrapped since 3.1. Changing that after 5 years is just not an option. And since the bug is in there since 3.1 we won't update the UI for 3.7.
(In reply to comment #8) > [..] > No it is not better: the annotations are wrapped since 3.1. Changing that after > 5 years is just not an option. > > And since the bug is in there since 3.1 we won't update the UI for 3.7. Hmm, will target the new option for 3.8 then.
If you plan to include a fix for this in 3.8 M7, please adjust the target suitably, so it becomes easier to track.
Do we want to really target this for 3.8? I believe it is late and we could probably push it.
I'm OK moving this to 3.9.
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.
Hi Guys Is there any update on this? I would love to have this option of putting annotations on one line.