History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEABKL-4424
Type: New Feature New Feature
Status: Open Open
Priority: Normal Normal
Assignee: Unassigned
Reporter: Keith Lea
Votes: 1
Watchers: 0
Available Workflow Actions

Mark as Stalled
Operations

If you were logged in you would be able to see more operations.
IDEA: Backlog

Allow specification of annotations sort order in modifier list

Created: 11 Jan 06 22:44   Updated: 09 Nov 06 20:34
Component/s: Code Formatting and Code Style
Affects Version/s: None
Fix Version/s: None

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown

Build: 4,109
Severity: Low


 Description  « Hide
@Nullable and @NotNull are annotations on the return type of the method, so it makes sense to place them after all modifiers, like public static @NotNull String doSomething(). However, @Override is an annotation on the method itself, so it makes sense to place it before all modifiers and possibly on a new line, like @Override public final void something(). Currently IDEA will not allow me to tell the formatter to do things like this. I suggest either providing a new tab in Code Style settings where I could add @Nullable and @NotNull to a list of after-modifiers annotations, OR, preferably, add a new annotation to annotations.jar called @ReturnTypeAnnotation which applies to annotations. Then @Nullable and @NotNull could be declared with this annotation.

 All   Comments   Work Log   Change History      Sort Order:
Maxim Shafirov - 12 Jan 06 02:03
Personally I do not like your second suggestion since you'll only be able to control formatting of the annotations you have control over, i.e. your own.
BTW, most of the time we put @Nullable declaration on the previous line like
@Nullable
public abstract String foo();

I.e. like with any other code style aspect it's just a styling aspect and people will tend to change the defautls.