Java grammar enhanced to include AnnotationMethodDeclaration as parent node of method related children of AnnotationTypeMemberDeclaration.

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/branches/pmd/4.2.x@6385 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Ryan Gustafson 2008-08-24 06:01:18 +00:00
parent 3d0d4436de
commit 8b9942436d
8 changed files with 782 additions and 708 deletions

View File

@ -1,6 +1,7 @@
???? - 4.2.3:
JavaCC generated artifacts updated to JavaCC 4.1d1.
Java grammar enhanced to include AnnotationMethodDeclaration as parent node of method related children of AnnotationTypeMemberDeclaration
Fixes for exclude-pattern
Updates to RuleChain to honor RuleSet exclude-pattern
Upgrading UselessOperationOnImmutable to detect more use cases, especially on String and fix false positives

View File

@ -2072,7 +2072,7 @@ void AnnotationTypeMemberDeclaration():
{
modifiers = Modifiers()
(
LOOKAHEAD( Type() <IDENTIFIER> "(" ) Type() <IDENTIFIER> "(" ")" [ DefaultValue() ] ";"
LOOKAHEAD(3) AnnotationMethodDeclaration(modifiers)
|
ClassOrInterfaceDeclaration(modifiers)
|
@ -2086,6 +2086,18 @@ void AnnotationTypeMemberDeclaration():
( ";" )
}
void AnnotationMethodDeclaration(int modifiers):
{
Token t;
jjtThis.setModifiers(modifiers);
}
{
Type() t=<IDENTIFIER> "(" ")" [ DefaultValue() ] ";"
{
jjtThis.setImage(t.image);
}
}
void DefaultValue():
{}
{

View File

@ -244,6 +244,10 @@ public abstract class AbstractJavaRule extends CommonAbstractRule implements
return visit((SimpleJavaNode)node, data);
}
public Object visit(ASTAnnotationMethodDeclaration node, Object data) {
return visit((SimpleJavaNode)node, data);
}
public Object visit(ASTDefaultValue node, Object data) {
return visit((SimpleJavaNode)node, data);
}

View File

@ -0,0 +1,20 @@
/* Generated By:JJTree: Do not edit this line. ASTAnnotationMethodDeclaration.java Version 4.1 */
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=true,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY= */
package net.sourceforge.pmd.ast;
public class ASTAnnotationMethodDeclaration extends SimpleJavaAccessNode {
public ASTAnnotationMethodDeclaration(int id) {
super(id);
}
public ASTAnnotationMethodDeclaration(JavaParser p, int id) {
super(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(JavaParserVisitor visitor, Object data) {
return visitor.visit(this, data);
}
}
/* JavaCC - OriginalChecksum=a7d49e7cf6718be1fa077ebd79e8a8fe (do not edit this line) */

File diff suppressed because it is too large Load Diff

View File

@ -110,7 +110,8 @@ public interface JavaParserTreeConstants
public int JJTANNOTATIONTYPEDECLARATION = 104;
public int JJTANNOTATIONTYPEBODY = 105;
public int JJTANNOTATIONTYPEMEMBERDECLARATION = 106;
public int JJTDEFAULTVALUE = 107;
public int JJTANNOTATIONMETHODDECLARATION = 107;
public int JJTDEFAULTVALUE = 108;
public String[] jjtNodeName = {
@ -221,7 +222,8 @@ public interface JavaParserTreeConstants
"AnnotationTypeDeclaration",
"AnnotationTypeBody",
"AnnotationTypeMemberDeclaration",
"AnnotationMethodDeclaration",
"DefaultValue",
};
}
/* JavaCC - OriginalChecksum=84dc535132ac2ef71223e2496178a69c (do not edit this line) */
/* JavaCC - OriginalChecksum=820b9c854bfffdbd622ba16bbdc68ff2 (do not edit this line) */

View File

@ -110,6 +110,7 @@ public interface JavaParserVisitor
public Object visit(ASTAnnotationTypeDeclaration node, Object data);
public Object visit(ASTAnnotationTypeBody node, Object data);
public Object visit(ASTAnnotationTypeMemberDeclaration node, Object data);
public Object visit(ASTAnnotationMethodDeclaration node, Object data);
public Object visit(ASTDefaultValue node, Object data);
}
/* JavaCC - OriginalChecksum=8062e66dafa9bc73800febea5f02f0c1 (do not edit this line) */
/* JavaCC - OriginalChecksum=6f9222a800daef876471227b5e8c50ac (do not edit this line) */

View File

@ -115,6 +115,10 @@ public class JavaParserVisitorAdapter implements JavaParserVisitor {
return visit((SimpleJavaNode) node, data);
}
public Object visit(ASTAnnotationMethodDeclaration node, Object data) {
return visit((SimpleJavaNode) node, data);
}
public Object visit(ASTDefaultValue node, Object data) {
return visit((SimpleJavaNode) node, data);
}