test case for [ 2429017 ] Failed parsing byte[].class.hashCode()
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@6755 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
1 parent
673b9fc4ad
commit
6253bb9c0e
1 file changed
+17
@@ -5,6 +5,7 @@ import net.sourceforge.pmd.PMD;
|
||||
import org.junit.Test;
|
||||
|
||||
import test.net.sourceforge.pmd.testframework.ParserTst;
|
||||
import test.net.sourceforge.pmd.testframework.TestDescriptor;
|
||||
|
||||
public class ParserCornersTest extends ParserTst {
|
||||
|
||||
@@ -13,6 +14,15 @@ public class ParserCornersTest extends ParserTst {
|
||||
parseJava14(ABSTRACT_METHOD_LEVEL_CLASS_DECL);
|
||||
}
|
||||
|
||||
@Test
|
||||
public final void testCastLookaheadProblem() throws Throwable {
|
||||
if (TestDescriptor.inRegressionTestMode()) {
|
||||
// skip this test if we're only running regression tests
|
||||
return;
|
||||
}
|
||||
parseJava14(CAST_LOOKAHEAD_PROBLEM);
|
||||
}
|
||||
|
||||
private static final String ABSTRACT_METHOD_LEVEL_CLASS_DECL =
|
||||
"public class Test {" + PMD.EOL +
|
||||
" void bar() {" + PMD.EOL +
|
||||
@@ -23,6 +33,13 @@ public class ParserCornersTest extends ParserTst {
|
||||
" }" + 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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user