Merge branch 'issue-1512' of https://github.com/Monits/pmd into pr-156

This commit is contained in:
Andreas Dangel
2017-01-03 09:29:56 +01:00
4 changed files with 3 additions and 64 deletions

View File

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

View File

@ -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"

View File

@ -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");

View File

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