This commit is contained in:
oowekyala
2017-07-29 20:07:13 +02:00
parent 92fc1e4fbe
commit 3b48ef6407
2 changed files with 27 additions and 0 deletions

View File

@ -12,6 +12,7 @@ import net.sourceforge.pmd.lang.ast.Node;
import net.sourceforge.pmd.lang.java.ast.ASTAnnotation;
import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceDeclaration;
import net.sourceforge.pmd.lang.java.ast.ASTCompilationUnit;
import net.sourceforge.pmd.lang.java.ast.ASTEnumDeclaration;
import net.sourceforge.pmd.lang.java.ast.ASTImportDeclaration;
import net.sourceforge.pmd.lang.java.ast.ASTName;
@ -59,6 +60,12 @@ public class AbstractLombokAwareRule extends AbstractJavaRule {
return super.visit(node, data);
}
@Override
public Object visit(ASTEnumDeclaration node, Object data) {
classHasLombokAnnotation = hasLombokAnnotation(node);
return super.visit(node, data);
}
/**
* Returns whether there have been class level Lombok annotations found.
* Note: this can only be queried after the class declaration node has been

View File

@ -605,4 +605,24 @@ public final class Test {
}
]]></code>
</test-code>
<test-code>
<description>#527 [java] Lombok getter annotation on enum is not recognized correctly</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
import lombok.Getter;
@Getter
public enum Foo {
BAR(1);
private final int number;
Foo(final int number) {
this.number = number;
}
}
]]></code>
</test-code>
</test-data>