|
1 |
| |
|
2 |
| |
|
3 |
| package net.sourceforge.pmd.ast; |
|
4 |
| |
|
5 |
| import net.sourceforge.pmd.Rule; |
|
6 |
| |
|
7 |
| public class ASTClassOrInterfaceBodyDeclaration extends SimpleJavaNode implements CanSuppressWarnings { |
|
8 |
| |
|
9 |
0
| public ASTClassOrInterfaceBodyDeclaration(int id) {
|
|
10 |
0
| super(id);
|
|
11 |
| } |
|
12 |
| |
|
13 |
1834
| public ASTClassOrInterfaceBodyDeclaration(JavaParser p, int id) {
|
|
14 |
1834
| super(p, id);
|
|
15 |
| } |
|
16 |
| |
|
17 |
| |
|
18 |
569
| public boolean hasSuppressWarningsAnnotationFor(Rule rule) {
|
|
19 |
569
| for (int i = 0; i < jjtGetNumChildren(); i++) {
|
|
20 |
569
| if (jjtGetChild(i) instanceof ASTAnnotation) {
|
|
21 |
4
| ASTAnnotation a = (ASTAnnotation) jjtGetChild(i);
|
|
22 |
4
| if (a.suppresses(rule)) {
|
|
23 |
4
| return true;
|
|
24 |
| } |
|
25 |
| } |
|
26 |
| } |
|
27 |
565
| return false;
|
|
28 |
| } |
|
29 |
| |
|
30 |
| |
|
31 |
| |
|
32 |
| |
|
33 |
5119
| public Object jjtAccept(JavaParserVisitor visitor, Object data) {
|
|
34 |
5119
| return visitor.visit(this, data);
|
|
35 |
| } |
|
36 |
| |
|
37 |
1795
| public boolean isAnonymousInnerClass() {
|
|
38 |
1795
| return jjtGetParent().jjtGetParent() instanceof ASTAllocationExpression;
|
|
39 |
| } |
|
40 |
| |
|
41 |
1737
| public boolean isEnumChild() {
|
|
42 |
1737
| return jjtGetParent().jjtGetParent() instanceof ASTEnumConstant;
|
|
43 |
| } |
|
44 |
| |
|
45 |
0
| public void dump(String prefix) {
|
|
46 |
0
| String isAnonyString = isAnonymousInnerClass() ? ": (anonymous inner class)" : "";
|
|
47 |
0
| System.out.println(toString(prefix) + isAnonyString);
|
|
48 |
0
| dumpChildren(prefix);
|
|
49 |
| } |
|
50 |
| |
|
51 |
| } |