forked from phoedos/pmd
#1831 resolved the issue
This commit is contained in:
@ -5,6 +5,7 @@
|
||||
package net.sourceforge.pmd.lang.java.rule.errorprone;
|
||||
|
||||
import net.sourceforge.pmd.lang.ast.NodeStream;
|
||||
|
||||
import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceDeclaration;
|
||||
import net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration;
|
||||
import net.sourceforge.pmd.lang.java.ast.JModifier;
|
||||
@ -24,7 +25,7 @@ public class DetachedTestCaseRule extends AbstractJavaRulechainRule {
|
||||
// looks like a test case
|
||||
methods.filter(m -> m.getArity() == 0
|
||||
&& m.isVoid()
|
||||
&& !m.getModifiers().hasAny(JModifier.STATIC, JModifier.PRIVATE, JModifier.PROTECTED))
|
||||
&& !m.getModifiers().hasAny(JModifier.STATIC, JModifier.PRIVATE, JModifier.PROTECTED, JModifier.ABSTRACT))
|
||||
// the method itself has no annotation
|
||||
.filter(it -> it.getDeclaredAnnotations().isEmpty())
|
||||
.forEach(m -> addViolation(data, m));
|
||||
|
Reference in New Issue
Block a user