Whitespaces

This commit is contained in:
Andreas Dangel
2015-04-13 19:22:53 +02:00
parent 9ec438c97d
commit cf22d5841b

View File

@ -15,31 +15,22 @@ import net.sourceforge.pmd.lang.java.ParserTst;
import org.apache.commons.io.IOUtils;
import org.junit.Test;
public class ParserCornersTest extends ParserTst {
/**
* #1107 PMD 5.0.4 couldn't parse call of parent outer java class method from inner class
* @throws Exception any error
* #1107 PMD 5.0.4 couldn't parse call of parent outer java class method
* from inner class
*
* @throws Exception
* any error
*/
@Test
public void testInnerOuterClass() throws Exception {
parseJava17("/**\n" +
" * @author azagorulko\n" +
" *\n" +
" */\n" +
"public class TestInnerClassCallsOuterParent {\n" +
"\n" +
" public void test() {\n" +
" new Runnable() {\n" +
" @Override\n" +
" public void run() {\n" +
" TestInnerClassCallsOuterParent.super.toString();\n" +
" }\n" +
" };\n" +
" }\n" +
"}\n"
);
parseJava17("/**\n" + " * @author azagorulko\n" + " *\n" + " */\n"
+ "public class TestInnerClassCallsOuterParent {\n" + "\n" + " public void test() {\n"
+ " new Runnable() {\n" + " @Override\n" + " public void run() {\n"
+ " TestInnerClassCallsOuterParent.super.toString();\n" + " }\n"
+ " };\n" + " }\n" + "}\n");
}
@Test
@ -53,8 +44,8 @@ public class ParserCornersTest extends ParserTst {
}
/**
* Tests a specific generic notation for calling methods.
* See: https://jira.codehaus.org/browse/MPMD-139
* Tests a specific generic notation for calling methods. See:
* https://jira.codehaus.org/browse/MPMD-139
*/
@Test
public void testGenericsProblem() {
@ -82,7 +73,9 @@ public class ParserCornersTest extends ParserTst {
parseJava15(code);
fail("Expected exception");
} catch (ParseException e) {
assertEquals("Line 1, Column 94: Cannot catch multiple exceptions when running in JDK inferior to 1.7 mode!", e.getMessage());
assertEquals(
"Line 1, Column 94: Cannot catch multiple exceptions when running in JDK inferior to 1.7 mode!",
e.getMessage());
}
try {
@ -104,31 +97,14 @@ public class ParserCornersTest extends ParserTst {
}
}
private static final String GENERICS_PROBLEM =
"public class Test {" + PMD.EOL +
" public void test() {" + PMD.EOL +
" String o = super.<String> doStuff(\"\");" + PMD.EOL +
" }" + PMD.EOL +
"}";
private static final String GENERICS_PROBLEM = "public class Test {" + PMD.EOL + " public void test() {" + PMD.EOL
+ " String o = super.<String> doStuff(\"\");" + PMD.EOL + " }" + PMD.EOL + "}";
private static final String ABSTRACT_METHOD_LEVEL_CLASS_DECL =
"public class Test {" + PMD.EOL +
" void bar() {" + PMD.EOL +
" abstract class X { public abstract void f(); }" + PMD.EOL +
" class Y extends X { public void f() {" + PMD.EOL +
" new Y().f();" + PMD.EOL +
" }}" + PMD.EOL +
" }" + PMD.EOL +
"}";
private static final String ABSTRACT_METHOD_LEVEL_CLASS_DECL = "public class Test {" + PMD.EOL + " void bar() {"
+ PMD.EOL + " abstract class X { public abstract void f(); }" + PMD.EOL
+ " class Y extends X { public void f() {" + PMD.EOL + " new Y().f();" + PMD.EOL + " }}" + PMD.EOL
+ " }" + PMD.EOL + "}";
private static final String CAST_LOOKAHEAD_PROBLEM =
"public class BadClass {" + PMD.EOL +
" public Class foo() {" + PMD.EOL +
" return (byte[].class);" + PMD.EOL +
" }" + PMD.EOL +
"}";
public static junit.framework.Test suite() {
return new junit.framework.JUnit4TestAdapter(ParserCornersTest.class);
}
private static final String CAST_LOOKAHEAD_PROBLEM = "public class BadClass {" + PMD.EOL + " public Class foo() {"
+ PMD.EOL + " return (byte[].class);" + PMD.EOL + " }" + PMD.EOL + "}";
}