diff --git a/pmd/etc/changelog.txt b/pmd/etc/changelog.txt
index 8549438f8b..712a270762 100644
--- a/pmd/etc/changelog.txt
+++ b/pmd/etc/changelog.txt
@@ -3,6 +3,7 @@ New rules:
Migration ruleset: IntegerInstantiation
JUnit ruleset: UseAssertNullInsteadOfAssertTrue
Strings ruleset: AppendCharacterWithChar
+ Design ruleset: AvoidConstantsInterface
Fixed bug 1277373 - InefficientStringBuffering now catches more cases.
Fixed bug 1371757 - Misleading example in AvoidSynchronizedAtMethodLevel
Fixed bug 1371980 - InefficientStringBuffering no longer flags StringBuffer methods other than append().
@@ -20,8 +21,10 @@ Modified renderers to support disabling printing of suppressed warnings. Introd
Added current CLASSPATH to pmd.bat.
UnusedFormalParameter now catches unused constructor parameters, and its warning message now reflects whether it caught a method or a constructor param.
Rebuilt JavaCC parser with JavaCC 4.0beta1.
-Added David Corley's Javascript report, more details are here: http://tomcopeland.blogs.com/juniordeveloper/2005/12/demo_of_some_ni.html
-TODO: Removed old-style CPD command line options that were deprecated in 3.4.
+Added David Corley's Javascript report, more details are here: http://tomcopeland.blogs.com/juniordeveloper/2005/12/demo_of_some_ni.html
+
+***** TODO: Remove old-style CPD command line options that were deprecated in 3.4.
+***** TODO: Remove deprecated RuleViolation.getLine()
November 30, 2005 - 3.4:
New rules:
diff --git a/pmd/regress/test/net/sourceforge/pmd/rules/design/AvoidConstantsInterfaceTest.java b/pmd/regress/test/net/sourceforge/pmd/rules/design/AvoidConstantsInterfaceTest.java
new file mode 100644
index 0000000000..2824c21195
--- /dev/null
+++ b/pmd/regress/test/net/sourceforge/pmd/rules/design/AvoidConstantsInterfaceTest.java
@@ -0,0 +1,36 @@
+package test.net.sourceforge.pmd.rules.design;
+
+import test.net.sourceforge.pmd.testframework.SimpleAggregatorTst;
+import test.net.sourceforge.pmd.testframework.TestDescriptor;
+import net.sourceforge.pmd.Rule;
+import net.sourceforge.pmd.RuleSetNotFoundException;
+import net.sourceforge.pmd.PMD;
+
+public class AvoidConstantsInterfaceTest extends SimpleAggregatorTst {
+
+ private Rule rule;
+
+ public void setUp() throws RuleSetNotFoundException {
+ rule = findRule("design", "AvoidConstantsInterface");
+ }
+
+ public void testAll() {
+ runTests(new TestDescriptor[] {
+ new TestDescriptor(TEST1, "clear rule violation", 1, rule),
+ new TestDescriptor(TEST2, "ok", 0, rule),
+ });
+ }
+
+ private static final String TEST1 =
+ "public interface Foo {" + PMD.EOL +
+ " public static final int FOO = 2;" + PMD.EOL +
+ " public static final String BAR = \"bar\";" + PMD.EOL +
+ "}";
+
+ private static final String TEST2 =
+ "public interface Foo {" + PMD.EOL +
+ " public static final int FOO = 2;" + PMD.EOL +
+ " public void buz();" + PMD.EOL +
+ "}";
+
+}
diff --git a/pmd/rulesets/design.xml b/pmd/rulesets/design.xml
index 9c1700593b..595505734c 100644
--- a/pmd/rulesets/design.xml
+++ b/pmd/rulesets/design.xml
@@ -1213,4 +1213,36 @@ public Foo() {
+
+
+ An interface should be used only to model a behaviour of a
+ class: using an interface as a container of constants is a poor usage pattern.
+
+
+
+
+ 0
+ ]
+ ]]>
+
+
+
+ 3
+
+
+
+
+
diff --git a/pmd/xdocs/credits.xml b/pmd/xdocs/credits.xml
index 0ecd0193c2..feb6782254 100644
--- a/pmd/xdocs/credits.xml
+++ b/pmd/xdocs/credits.xml
@@ -45,6 +45,7 @@
+ - Fabio Insaccanebbia - AvoidConstantsInterface, AvoidDecimalLiteralsInBigDecimalConstructor, ClassCastExceptionWithToArray
- David Corley - Nifty Javascript folding for XML report, demo is here
- George Sexton - Bug report 1379701 for CompareObjectsWithEquals, suggested new rule for Additional String Concatenation Warnings in StringBuffer.
- Didier Duquennoy - several bug reports for InefficientStringBuffering, bug report for ImmutableField, suggestions for improving Benchmark utility, bug report for InefficientStringBuffering, bug report for AvoidConcateningNonLiteralsInStringBuffer, reported a missed hit for EqualsNull, bug report for MissingStaticMethodInNonInstantiatableClass, pmd-netbeans feedback
@@ -59,7 +60,6 @@
- Wim Deblauwe - suggested UseAssertNullInsteadOfAssertTrue, bug report 1373510 for UseAssertSameInsteadOfAssertTrue, suggested putting property names/values in generated docs, UselessOverridingMethod, reported bug in JUnitTestsShouldContainAsserts, front page and "how to make a ruleset" patches, noted problems with web site rule index, bug report for JUnitTestsShouldContainAsserts, Clover license coordination and implementation, UseCorrectExceptionLogging, coordinated and coded a much nicer asXML() implementation, suggested cleanup of UnusedFormalParameter, Javadoc patch, SystemPrintln bug report, helped get Ant task and CLI squared away with JDK 1.5 params, JDK 1.5-specific bug reports, suggested improvements for ExceptionSignatureDeclaration
- Sean Montgomery - bug report 1371980 for InefficientStringBuffering
- Jean-Marc Vanel - suggested enhancements to the PMD scoreboard
- - Fabio Insaccanebbia - AvoidDecimalLiteralsInBigDecimalConstructor, ClassCastExceptionWithToArray
- Andriy Rozeluk - suggested UseStringBufferLength, bug report 1306180 for AvoidConcatenatingNonLiteralsInStringBuffer, reported bug 1293157 for UnusedPrivateMethod, suggested UnnecessaryCaseChange, bug report for SimplifyConditional, suggested UnnecessaryLocalBeforeReturn, suggestions for improving BooleanInstantiation, UnnecessaryReturn, AvoidDuplicateLiterals RFEs and bug reports, various other RFEs and thoughtful discussions as well
- Bruno Juillet - suggested reporting suppressed warnings, bug report for missing package/class/method names, patch for Ant task's excludeMarker attribute, bug report on ruleset overrides
- Chris Erskine - documentation suggestions