Fixed bug 683465; postprocessed JavaCC generated parser to use RuntimeExceptions vs Errors
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@1412 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -86,6 +86,12 @@
|
||||
<jjtree target="etc/Java1.4-c.jjt" outputdirectory="src/net/sourceforge/pmd/ast" javacchome="c:/javacc2.1"/>
|
||||
<javacc target="src/net/sourceforge/pmd/ast/Java1.4-c.jj" outputdirectory="src/net/sourceforge/pmd/ast" javacchome="c:/javacc2.1"/>
|
||||
<delete file="src/net/sourceforge/pmd/ast/Java1.4-c.jj"/>
|
||||
<replace file="src/net/sourceforge/pmd/ast/JavaCharStream.java" token="throw new Error" value="throw new RuntimeException"/>
|
||||
<replace file="src/net/sourceforge/pmd/ast/JavaParser.java" token="throw new Error" value="throw new RuntimeException"/>
|
||||
<replace file="src/net/sourceforge/pmd/ast/JavaParser.java" token="(Error)" value="(RuntimeException)"/>
|
||||
<replace file="src/net/sourceforge/pmd/ast/JavaParserTokenManager.java" token="throw new Error" value="throw new RuntimeException"/>
|
||||
<replace file="src/net/sourceforge/pmd/ast/ParseException.java" token="throw new Error" value="throw new RuntimeException"/>
|
||||
<replace file="src/net/sourceforge/pmd/ast/TokenMgrError.java" token="extends Error" value="extends RuntimeException"/>
|
||||
</target>
|
||||
|
||||
<target name="clean" depends="delete,compile"/>
|
||||
|
@ -6,6 +6,7 @@ Fixed bug 674393 - OnlyOneReturn rule no longer counts returns that are inside a
|
||||
Fixed bug 674420 - AvoidReassigningParametersRule no longer counts parameter field reassignment as a violation. Thx to C. Lamont Gilbert for the bug report.
|
||||
Fixed bug 673662 - The Ant task's "failOnError" attribute works again. Changed the semantics of this attribute, though, so it fails the build if errors occurred. A new attribute 'failOnRuleViolation' serves the purpose of stopping the build if rule violations are found.
|
||||
Fixed bug 676340 - Symbol table now creates new scope level when it encounters a switch statement. See the bug for code details; generally, this bug would have triggered runtime exceptions on certain blocks of code.
|
||||
Fixed bug 683465 - JavaCC parser no longer has ability to throw java.lang.Error; now it only throws java.lang.RuntimeExceptions. Thx to Gunnlaugur Thor Briem for a good discussion on this topic.
|
||||
Fixed bug in OverrideBothEqualsAndHashcodeRule - it no longer bails out with a NullPtrException on interfaces that declare a method signature "equals(Object)". Thx to Don Leckie for catching that.
|
||||
Added an optional Ant task formatter attribute 'isReportFilePathAbsolute'. Thx to Andriy Rozeluk for the feedback.
|
||||
Added an optional Ant task attribute 'failOnRuleViolation'. This stops the build if any rule violations are found.
|
||||
|
@ -3,7 +3,6 @@ set CVSROOT=:ext:tomcopeland@cvs.pmd.sourceforge.net:/cvsroot/pmd
|
||||
set CVS_RSH=c:\bin\ssh\ssh
|
||||
set HOME=c:
|
||||
set ANT_HOME=c:\ant
|
||||
set PATH=%PATH%;c:\maven\bin
|
||||
set CLASSPATH=../build/
|
||||
set CLASSPATH=%CLASSPATH%;../test-data/
|
||||
set CLASSPATH=%CLASSPATH%;../
|
||||
|
@ -118,7 +118,7 @@ public final class JavaCharStream
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
throw new Error(t.getMessage());
|
||||
throw new RuntimeException(t.getMessage());
|
||||
}
|
||||
|
||||
available = (bufsize += 2048);
|
||||
@ -317,7 +317,7 @@ public final class JavaCharStream
|
||||
}
|
||||
catch(java.io.IOException e)
|
||||
{
|
||||
throw new Error("Invalid escape character at line " + line +
|
||||
throw new RuntimeException("Invalid escape character at line " + line +
|
||||
" column " + column + ".");
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1464,7 +1464,7 @@ protected char curChar;
|
||||
public JavaParserTokenManager(JavaCharStream stream)
|
||||
{
|
||||
if (JavaCharStream.staticFlag)
|
||||
throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
|
||||
throw new RuntimeException("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
|
||||
input_stream = stream;
|
||||
}
|
||||
public JavaParserTokenManager(JavaCharStream stream, int lexState)
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 2.1 */
|
||||
package net.sourceforge.pmd.ast;
|
||||
|
||||
public class TokenMgrError extends Error
|
||||
public class TokenMgrError extends RuntimeException
|
||||
{
|
||||
/*
|
||||
* Ordinals for various reasons why an Error of this type can be thrown.
|
||||
|
@ -6,12 +6,12 @@ import net.sourceforge.pmd.ast.ASTPrimarySuffix;
|
||||
import net.sourceforge.pmd.ast.ASTPrimaryPrefix;
|
||||
import net.sourceforge.pmd.ast.ASTName;
|
||||
import net.sourceforge.pmd.ast.ASTExplicitConstructorInvocation;
|
||||
import net.sourceforge.pmd.ast.ASTArguments;
|
||||
|
||||
public class SymbolTableTestRule extends AbstractRule implements Rule {
|
||||
|
||||
public Object visit(ASTExplicitConstructorInvocation node, Object data) {
|
||||
System.out.println("ASTExplicitConstructorInvocation: isSuper: " + node.isSuper());
|
||||
System.out.println("ASTExplicitConstructorInvocation: isThis: " + node.isThis());
|
||||
System.out.println("ASTExplicitConstructorInvocation: arg count = " + ((ASTArguments)node.jjtGetChild(0)).getArgumentCount());
|
||||
return super.visit(node,data);
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
<section name="Credits">
|
||||
<subsection name="Individuals">
|
||||
<ul>
|
||||
<li>Gunnlaugur Thor Briem - bug report on JavaCC parser's use of java.lang.Error</li>
|
||||
<li>C. Lamont Gilbert - bug reports, feature requests, and documentation improvements</li>
|
||||
<li>Vladimir Bossicard - numerous feature requests and bug reports, several rule suggestions derived from <a href="http://junit-addons.sf.net/">JUnit-Addons</a>, evangelism :-)</li>
|
||||
<li>Frédéric Harper - bug report and subsequent troubleshooting</li>
|
||||
|
Reference in New Issue
Block a user