Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return type annotations are formatted as method annotations #109

Open
mernst opened this issue Dec 13, 2015 · 0 comments
Open

Return type annotations are formatted as method annotations #109

mernst opened this issue Dec 13, 2015 · 0 comments
Labels
Milestone

Comments

@mernst
Copy link
Member

mernst commented Dec 13, 2015

The proper style for a type annotation is to write it immediately before the type that it annotates. For example, this is wrong:

@Interned
String m1() {
    return "foo bar";
}

and this is correct:

@Interned String m1() {
    return "foo bar";
}

However, the insert-annotations-to-source program produces the former rather than the latter.

The same thing goes for fields: the annotation should be on the same line as the type, not above the type and indented.

I have attached files that reproduce the problem and that show the desired output. Run the following commands:

javac MethodReturnTest3.java
insert-annotations-to-source MethodReturnTest3.jaif MethodReturnTest3.java

type-annotation-formatting.zip

@dbrosoft dbrosoft self-assigned this Dec 14, 2015
@dbrosoft dbrosoft added the bug label Dec 14, 2015
@mernst mernst added this to the Low milestone Jan 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants