View Javadoc

    1   /* Generated By:JJTree: Do not edit this line. ASTClassOrInterfaceBodyDeclaration.java */
    2
    3   package net.sourceforge.pmd.lang.java.ast;
    4
    5   import net.sourceforge.pmd.Rule;
    6
    7   public class ASTClassOrInterfaceBodyDeclaration extends AbstractJavaNode implements CanSuppressWarnings {
    8
    9       public ASTClassOrInterfaceBodyDeclaration(int id) {
    10          super(id);
    11      }
    12
    13      public ASTClassOrInterfaceBodyDeclaration(JavaParser p, int id) {
    14          super(p, id);
    15      }
    16
    17      @Override
    18      public boolean isFindBoundary() {
    19  	return isAnonymousInnerClass();
    20      }
    21
    22      public boolean hasSuppressWarningsAnnotationFor(Rule rule) {
    23          for (int i = 0; i < jjtGetNumChildren(); i++) {
    24              if (jjtGetChild(i) instanceof ASTAnnotation) {
    25                  ASTAnnotation a = (ASTAnnotation) jjtGetChild(i);
    26                  if (a.suppresses(rule)) {
    27                      return true;
    28                  }
    29              }
    30          }
    31          return false;
    32      }
    33
    34      /**
    35       * Accept the visitor. *
    36       */
    37      public Object jjtAccept(JavaParserVisitor visitor, Object data) {
    38          return visitor.visit(this, data);
    39      }
    40
    41      public boolean isAnonymousInnerClass() {
    42          return jjtGetParent().jjtGetParent() instanceof ASTAllocationExpression;
    43      }
    44
    45      public boolean isEnumChild() {
    46          return jjtGetParent().jjtGetParent() instanceof ASTEnumConstant;
    47      }
    48  }