IDEA-79836 Java formatter: Correct processing of incomplete method call expression with anonymous class arguments

This commit is contained in:
Denis.Zhdanov
2012-01-12 13:03:13 +04:00
parent 9005510f19
commit e1817ca159
3 changed files with 25 additions and 3 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -150,7 +150,7 @@ public class JavaFormatterBracesTest extends AbstractJavaFormatterTest {
"class Test \n" +
"{\n" +
" void foo() {\n" +
" bind(new TypeLiteral<MyType>(){}).toProvider(MyProvider.class);\n" +
" bind(new TypeLiteral<MyType>() {}).toProvider(MyProvider.class);\n" +
" }\n" +
"}";
doTextTest(text, text);
@@ -467,4 +467,26 @@ public class JavaFormatterIndentationTest extends AbstractJavaFormatterTest {
"}";
doTextTest(text, text);
}
public void testIncompleteMethodCall() throws Exception {
// Inspired by IDEA-79836.
doMethodTest(
"test(new Runnable() {\n" +
" public void run() {\n" +
" }\n" +
" }, new Runnable() {\n" +
" public void run() {\n" +
" }\n" +
" }, )",
"test(new Runnable() {\n" +
" public void run() {\n" +
" }\n" +
" }, new Runnable() {\n" +
" public void run() {\n" +
" }\n" +
" },\n" +
")"
);
}
}