diff --git a/pmd-java/etc/grammar/Java.jjt b/pmd-java/etc/grammar/Java.jjt index d9b55cf20d..7aa22f060f 100644 --- a/pmd-java/etc/grammar/Java.jjt +++ b/pmd-java/etc/grammar/Java.jjt @@ -2989,6 +2989,7 @@ void CatchParameter() : {boolean isFinal = false;} { isFinal=LocalVarModifierList() UnionType() VariableDeclaratorId() + {jjtThis.setFinal(isFinal);} } // Special type for catch formal parameters diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTCatchParameter.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTCatchParameter.java index c6184a42cc..7b09cd5ff7 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTCatchParameter.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTCatchParameter.java @@ -4,16 +4,11 @@ package net.sourceforge.pmd.lang.java.ast; -import net.sourceforge.pmd.annotation.InternalApi; - - /** * Formal parameter of a {@linkplain ASTCatchStatement catch statement}. * The type node may be a {@link ASTUnionType union type}, which represents * multi-catch clauses. * - * TODO warning suppression - * *
* * CatchParameter ::= ( "final" | {@link ASTAnnotation Annotation} )* {@link ASTType Type} {@link ASTVariableDeclaratorId VariableDeclaratorId} @@ -24,9 +19,7 @@ public class ASTCatchParameter extends AbstractJavaTypeNode implements Annotatab private boolean isFinal; - @InternalApi - @Deprecated - public ASTCatchParameter(int id) { + ASTCatchParameter(int id) { super(id); } @@ -43,10 +36,6 @@ public class ASTCatchParameter extends AbstractJavaTypeNode implements Annotatab isFinal = f; } - public String getName() { - return getVariableId().getVariableName(); - } - @Override public Object jjtAccept(JavaParserVisitor visitor, Object data) { return visitor.visit(this, data); @@ -58,10 +47,12 @@ public class ASTCatchParameter extends AbstractJavaTypeNode implements Annotatab visitor.visit(this, data); } + /** Returns the name of the variable. */ + public String getName() { + return getVariableId().getVariableName(); + } - /** - * Returns the declarator ID of this catch parameter. - */ + /** Returns the declarator ID of this catch parameter. */ public ASTVariableDeclaratorId getVariableId() { return (ASTVariableDeclaratorId) getLastChild(); }