Community
Participate
Working Groups
Build ID: I20080530-1730 Currently (Ganymede RC3, build id I20080530-1730), the Code Style formatter allows one to handle new lines after annotations in three specific ways depending on whether the annotated entity is a member, a parameter or a local variable (see bug #122247). I would propose yet a fourth "entity category" in addition to the three that we already have (MEMBER, PARAMETER, LOCAL_VARIABLE): RETURN_PARAMETER. This is the reason why: when annotating the return parameter of a method, I get the following: @MyAnnotation1 public @NonNull Set getReturnValue(@NonNull String myParam1) { return this.returnValue; } I would actually rather have the following: @MyAnnotation1 public @NonNull Set getReturnValue(@NonNull String myParam1) { return this.returnValue; } Which I find more legible. Thank you, Nicolas Damour.
(Copy of bug 122247 comment 45) Note that the Java language up to (including) 1.6 does not support annotations on the return type. All annotations that appear before the return type of a method belong to the whole method declaration. > @MyAnnotation1 > public @NonNull Set getReturnValue(@NonNull String myParam1) { From a language point of view, this is equivalent to @NonNull @MyAnnotation1 public Set getReturnValue(@NonNull String myParam1) { I think we shouldn't change the formatter right now. We should only add a new category if Java 1.7 introduces annotations on all type references.
Yeah, you're right. I somehow overlooked what you explained, so that my request makes no sense at all. Thank you for your contribution. Nicolas.
Verified for 3.5M1 using I20080805-1307