Merge branch 'issue-1512' of https://github.com/Monits/pmd into pr-156
This commit is contained in:
@ -61,6 +61,9 @@ public class RuleSetFactoryCompatibility {
|
||||
addFilterRuleMoved("java", "basic", "unnecessary", "UselessOperationOnImmutable");
|
||||
addFilterRuleMoved("java", "basic", "unnecessary", "UnusedNullCheckInEquals");
|
||||
addFilterRuleMoved("java", "basic", "unnecessary", "UselessParentheses");
|
||||
|
||||
// PMD 5.6.0
|
||||
addFilterRuleRenamed("java", "design", "AvoidConstantsInterface", "ConstantsInInterface");
|
||||
}
|
||||
|
||||
void addFilterRuleRenamed(String language, String ruleset, String oldName, String newName) {
|
||||
|
@ -1431,42 +1431,6 @@ public Foo() {
|
||||
</example>
|
||||
</rule>
|
||||
|
||||
<rule name="AvoidConstantsInterface"
|
||||
language="java"
|
||||
since="3.5"
|
||||
message="An Interface should be used only to model a behaviour; consider converting this to a class."
|
||||
class="net.sourceforge.pmd.lang.rule.XPathRule"
|
||||
externalInfoUrl="${pmd.website.baseurl}/rules/java/design.html#AvoidConstantsInterface">
|
||||
<description>
|
||||
An interface should be used only to characterize the external behaviour of an
|
||||
implementing class: using an interface as a container of constants is a poor
|
||||
usage pattern and not recommended.
|
||||
</description>
|
||||
<priority>3</priority>
|
||||
<properties>
|
||||
<property name="xpath">
|
||||
<value>
|
||||
<![CDATA[
|
||||
//ClassOrInterfaceDeclaration[@Interface="true"]
|
||||
[
|
||||
count(.//MethodDeclaration)=0
|
||||
and
|
||||
count(.//FieldDeclaration)>0
|
||||
]
|
||||
]]>
|
||||
</value>
|
||||
</property>
|
||||
</properties>
|
||||
<example>
|
||||
<![CDATA[
|
||||
public interface ConstantsInterface {
|
||||
public static final int CONSTANT1=0;
|
||||
public static final String CONSTANT2="1";
|
||||
}
|
||||
]]>
|
||||
</example>
|
||||
</rule>
|
||||
|
||||
<rule name="UnsynchronizedStaticDateFormatter"
|
||||
since="3.6"
|
||||
message="Static DateFormatter objects should be accessed in a synchronized manner"
|
||||
|
@ -19,7 +19,6 @@ public class DesignRulesTest extends SimpleAggregatorTst {
|
||||
addRule(RULESET, "AbstractClassWithoutAnyMethod");
|
||||
addRule(RULESET, "AccessorClassGeneration");
|
||||
addRule(RULESET, "AssignmentToNonFinalStatic");
|
||||
addRule(RULESET, "AvoidConstantsInterface");
|
||||
addRule(RULESET, "AvoidDeeplyNestedIfStmts");
|
||||
addRule(RULESET, "AvoidInstanceofChecksInCatchClause");
|
||||
addRule(RULESET, "AvoidProtectedFieldInFinalClass");
|
||||
|
@ -1,27 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<test-data>
|
||||
<test-code>
|
||||
<description><![CDATA[
|
||||
clear rule violation
|
||||
]]></description>
|
||||
<expected-problems>1</expected-problems>
|
||||
<code><![CDATA[
|
||||
public interface Foo {
|
||||
public static final int FOO = 2;
|
||||
public static final String BAR = "bar";
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
<test-code>
|
||||
<description><![CDATA[
|
||||
ok
|
||||
]]></description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
public interface Foo {
|
||||
public static final int FOO = 2;
|
||||
public void buz();
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
</test-data>
|
Reference in New Issue
Block a user