[apex] Fix suppress warnings support

This commit is contained in:
Andreas Dangel
2017-12-03 20:45:05 +01:00
parent 892a673c9f
commit 38bc6bf1fa
2 changed files with 2 additions and 19 deletions

View File

@ -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) {

View File

@ -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;
}
}