forked from phoedos/pmd
Parsing fails when assert is used as an identifier when in JDK 1.4 mode
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@2257 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -532,6 +532,9 @@ void VariableDeclaratorId() :
|
||||
}
|
||||
( "[" "]" )*
|
||||
{
|
||||
if (!usingAssertAsIdentifier && s.equals("assert")) {
|
||||
throw new ParseException("Can't use 'assert' as an identifier when running in JDK 1.4 mode!");
|
||||
}
|
||||
jjtThis.setImage( s );
|
||||
}
|
||||
}
|
||||
|
@ -16,8 +16,6 @@ public class AssertTest extends TestCase {
|
||||
new JavaParser(new StringReader(TEST4)).CompilationUnit();
|
||||
}
|
||||
|
||||
/*
|
||||
TODO
|
||||
public void testAssertAsIdentifierFailsWith1_4() {
|
||||
try {
|
||||
new JavaParser(new StringReader(TEST5)).CompilationUnit();
|
||||
@ -26,10 +24,11 @@ TODO
|
||||
// cool
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
public void testAssertAsIdentifierSucceedsWith1_3() {
|
||||
new JavaParser(new StringReader(TEST6)).CompilationUnit();
|
||||
JavaParser jp = new JavaParser(new StringReader(TEST6));
|
||||
jp.setAssertAsIdentifier();
|
||||
jp.CompilationUnit();
|
||||
}
|
||||
|
||||
public void testAssertAsKeywordFailsWith1_3() {
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user