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