IDEA-65987 Java Formatter: Correct anonymous classes instances as method arguments processing

1. 'Enforce parent indent' option is added to indent construction API;
2. Corresponding support is added to formatter's core;
3. Corresponding support is added to java blocks construction algorithm;
4. Corresponding test is added;
This commit is contained in:
Denis Zhdanov
2011-03-01 08:24:42 +03:00
parent 01629855cc
commit 4b851fb856
8 changed files with 227 additions and 68 deletions
@@ -307,4 +307,29 @@ public class JavaFormatterIndentationTest extends AbstractJavaFormatterTest {
doClassTest(precededBySingleLineComment, precededBySingleLineComment);
doClassTest(precededByMultiLineComment, precededByMultiLineComment);
}
public void testAnonymousClassInstancesAsMethodCallArguments() throws Exception {
// Inspired by IDEA-65987
doMethodTest(
"foo(\"long string as the first argument\", new Runnable() {\n" +
"public void run() { \n" +
"} \n" +
"}, \n" +
"new Runnable() { \n" +
"public void run() { \n" +
"} \n" +
"} \n" +
"); ",
"foo(\"long string as the first argument\", new Runnable() {\n" +
" public void run() { \n" +
" } \n" +
" }, \n" +
" new Runnable() { \n" +
" public void run() { \n" +
" } \n" +
" } \n" +
"); "
);
}
}