[apex] Fix suppress warnings support
This commit is contained in:
@ -7,8 +7,6 @@ package net.sourceforge.pmd.lang.apex.ast;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import net.sourceforge.pmd.Rule;
|
import net.sourceforge.pmd.Rule;
|
||||||
|
|
||||||
@ -16,8 +14,6 @@ import apex.jorje.semantic.ast.modifier.Annotation;
|
|||||||
|
|
||||||
public class ASTAnnotation extends AbstractApexNode<Annotation> {
|
public class ASTAnnotation extends AbstractApexNode<Annotation> {
|
||||||
|
|
||||||
private static final Pattern IMAGE_EXTRACTOR = Pattern.compile("value = ([^\\)]*)\\)");
|
|
||||||
|
|
||||||
public ASTAnnotation(Annotation annotation) {
|
public ASTAnnotation(Annotation annotation) {
|
||||||
super(annotation);
|
super(annotation);
|
||||||
}
|
}
|
||||||
@ -28,11 +24,7 @@ public class ASTAnnotation extends AbstractApexNode<Annotation> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getImage() {
|
public String getImage() {
|
||||||
final Matcher m = IMAGE_EXTRACTOR.matcher(node.toString());
|
return node.getType().getApexName();
|
||||||
if (m.find()) {
|
|
||||||
return m.group(1);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean suppresses(Rule rule) {
|
public boolean suppresses(Rule rule) {
|
||||||
|
@ -4,15 +4,10 @@
|
|||||||
|
|
||||||
package net.sourceforge.pmd.lang.apex.ast;
|
package net.sourceforge.pmd.lang.apex.ast;
|
||||||
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import apex.jorje.semantic.ast.modifier.AnnotationParameter;
|
import apex.jorje.semantic.ast.modifier.AnnotationParameter;
|
||||||
|
|
||||||
public class ASTAnnotationParameter extends AbstractApexNode<AnnotationParameter> {
|
public class ASTAnnotationParameter extends AbstractApexNode<AnnotationParameter> {
|
||||||
|
|
||||||
private static final Pattern IMAGE_EXTRACTOR = Pattern.compile("value = ([^\\)]*)\\)");
|
|
||||||
|
|
||||||
public ASTAnnotationParameter(AnnotationParameter annotationParameter) {
|
public ASTAnnotationParameter(AnnotationParameter annotationParameter) {
|
||||||
super(annotationParameter);
|
super(annotationParameter);
|
||||||
}
|
}
|
||||||
@ -24,12 +19,8 @@ public class ASTAnnotationParameter extends AbstractApexNode<AnnotationParameter
|
|||||||
@Override
|
@Override
|
||||||
public String getImage() {
|
public String getImage() {
|
||||||
if (node.getValue() != null) {
|
if (node.getValue() != null) {
|
||||||
final Matcher m = IMAGE_EXTRACTOR.matcher(node.getValue().toString());
|
return node.getValueAsString();
|
||||||
if (m.find()) {
|
|
||||||
return m.group(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user