java: formatting of type annotations inside references

This commit is contained in:
Roman Shevchenko
2014-03-05 20:02:40 +01:00
parent 50bf5a3a8b
commit 9ae96233a3
2 changed files with 18 additions and 1 deletions
@@ -1480,9 +1480,12 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
else if (myRole2 == ChildRole.REFERENCE_PARAMETER_LIST) {
createSpaceInCode(mySettings.SPACE_BEFORE_TYPE_PARAMETER_LIST);
}
else if (myRole2 == ChildRole.DOT){
else if (myRole2 == ChildRole.DOT) {
createSpaceInCode(false);
}
else if (myType1 == JavaElementType.ANNOTATION) {
createSpaceInCode(true);
}
}
@Override
@@ -540,4 +540,18 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
getJavaSettings().SPACE_AROUND_TYPE_BOUNDS_IN_TYPE_PARAMETERS = false;
doTextTest(before, "public class Foo<T extends Bar&Abba, U> {\n}");
}
public void testInnerTypeAnnotations() {
doTextTest(
"class C<@TA(1)T> {\n" +
" L<@TA(2)A> f = (@TA(3) A) new @TA(4) A() {\n" +
" };\n" +
"}",
"class C<@TA(1) T> {\n" +
" L<@TA(2) A> f = (@TA(3) A) new @TA(4) A() {\n" +
" };\n" +
"}"
);
}
}