|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
ASTAnnotation.java | 50% | 66.7% | 75% | 64.7% |
|
1 | /* Generated By:JJTree: Do not edit this line. ASTAnnotation.java */ | |
2 | ||
3 | package net.sourceforge.pmd.ast; | |
4 | ||
5 | import net.sourceforge.pmd.Rule; | |
6 | ||
7 | public class ASTAnnotation extends SimpleJavaNode { | |
8 | 0 | public ASTAnnotation(int id) { |
9 | 0 | super(id); |
10 | } | |
11 | ||
12 | 17 | public ASTAnnotation(JavaParser p, int id) { |
13 | 17 | super(p, id); |
14 | } | |
15 | ||
16 | ||
17 | 10 | public boolean suppresses(Rule rule) { |
18 | /* Check for "suppress all warnings" case | |
19 | @SuppressWarnings("") | |
20 | TypeDeclaration | |
21 | Annotation | |
22 | NormalAnnotation | |
23 | Name:SuppressWarnings | |
24 | */ | |
25 | 10 | if (jjtGetChild(0) instanceof ASTSingleMemberAnnotation) { |
26 | 10 | ASTSingleMemberAnnotation n = (ASTSingleMemberAnnotation) jjtGetChild(0); |
27 | 10 | if (n.jjtGetChild(0) instanceof ASTName && ((ASTName) n.jjtGetChild(0)).getImage().equals("SuppressWarnings")) { |
28 | 10 | return true; |
29 | } | |
30 | 0 | return false; |
31 | } | |
32 | ||
33 | /* Check for "suppress some warnings" case | |
34 | @SuppressWarnings({"hi","hey"}) | |
35 | TypeDeclaration | |
36 | Annotation | |
37 | SingleMemberAnnotation | |
38 | Name:SuppressWarnings | |
39 | MemberValue | |
40 | MemberValueArrayInitializer | |
41 | MemberValue | |
42 | PrimaryExpression | |
43 | PrimaryPrefix | |
44 | Literal:"hi" | |
45 | MemberValue | |
46 | PrimaryExpression | |
47 | PrimaryPrefix | |
48 | Literal:"hey" | |
49 | */ | |
50 | /* | |
51 | ||
52 | if (!(jjtGetChild(0) instanceof ASTName)) { | |
53 | return false; | |
54 | } | |
55 | ASTName n = (ASTName)jjtGetChild(0); | |
56 | if (n.getImage() == null || n.getImage().equals("SuppressWarnings")) { | |
57 | return false; | |
58 | } | |
59 | ||
60 | //List values = findChildrenOfType() | |
61 | */ | |
62 | 0 | return false; |
63 | } | |
64 | ||
65 | ||
66 | /** | |
67 | * Accept the visitor. * | |
68 | */ | |
69 | 38 | public Object jjtAccept(JavaParserVisitor visitor, Object data) { |
70 | 38 | return visitor.visit(this, data); |
71 | } | |
72 | } |
|