Merge pull request #3298 from oowekyala:update-AbstractClassWithoutAnyMethod
[java] Update rule AbstractClassWithoutAnyMethod #3298
This commit is contained in:
4 files changed
+15
-8
No files matched your search
@@ -119,7 +119,7 @@
|
||||
|
||||
<!-- design.xml -->
|
||||
|
||||
<!-- <rule ref="category/java/design.xml/AbstractClassWithoutAnyMethod"/> -->
|
||||
<rule ref="category/java/design.xml/AbstractClassWithoutAnyMethod"/>
|
||||
<!-- <rule ref="category/java/design.xml/AvoidCatchingGenericException"/> -->
|
||||
<!-- <rule ref="category/java/design.xml/AvoidDeeplyNestedIfStmts"/> -->
|
||||
<rule ref="category/java/design.xml/AvoidRethrowingException"/>
|
||||
|
||||
@@ -26,10 +26,9 @@ protected constructor in order to prevent instantiation than make the class misl
|
||||
<value>
|
||||
<![CDATA[
|
||||
//ClassOrInterfaceDeclaration
|
||||
[@Abstract = true()]
|
||||
[not(./ClassOrInterfaceBody/*/ConstructorDeclaration)]
|
||||
[not(./ClassOrInterfaceBody/*/MethodDeclaration)]
|
||||
[not(../Annotation/MarkerAnnotation/Name[pmd-java:typeIs('com.google.auto.value.AutoValue')])]
|
||||
[@Abstract = true() and @Interface = false()]
|
||||
[ClassOrInterfaceBody[not(ConstructorDeclaration | MethodDeclaration)]]
|
||||
[not(pmd-java:hasAnnotation('com.google.auto.value.AutoValue'))]
|
||||
]]>
|
||||
</value>
|
||||
</property>
|
||||
|
||||
-1
@@ -6,7 +6,6 @@ package net.sourceforge.pmd.lang.java.rule.design;
|
||||
|
||||
import net.sourceforge.pmd.testframework.PmdRuleTst;
|
||||
|
||||
@org.junit.Ignore("Rule has not been updated yet")
|
||||
public class AbstractClassWithoutAnyMethodTest extends PmdRuleTst {
|
||||
// no additional unit tests
|
||||
}
|
||||
+11
-2
@@ -57,7 +57,7 @@ public abstract class Foo {
|
||||
<code><![CDATA[
|
||||
import com.google.auto.value.AutoValue;
|
||||
|
||||
@AutoValue public abstract class Something implements Some {
|
||||
@AutoValue public abstract class Something implements java.util.RandomAccess {
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
@@ -66,7 +66,7 @@ import com.google.auto.value.AutoValue;
|
||||
<description>#438 An abstract AutoValue class with no methods and fully qualified annotation, no violation</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
@com.google.auto.value.AutoValue public abstract class Something implements Some {
|
||||
@com.google.auto.value.AutoValue public abstract class Something implements java.util.RandomAccess {
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
@@ -102,4 +102,13 @@ class Foo {
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
<test-code>
|
||||
<description>Interfaces are ignored</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
interface Some {
|
||||
// no abstract
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
</test-data>
|
||||
Reference in new issue
Block a user