diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index b8f8783555..7e7ada589c 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -16,9 +16,14 @@ This is a {{ site.pmd.release_type }} release. ### Fixed Issues +* java-codestyle + * [#1356](https://github.com/pmd/pmd/issues/1356): \[java] UnnecessaryModifier wrong message public->static + ### API Changes ### External Contributions +* [#1366](https://github.com/pmd/pmd/pull/1366): \[Java] Static Modifier on Internal Interface pmd #1356 - [avishvat](https://github.com/vishva007) + {% endtocmaker %} diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryModifierRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryModifierRule.java index ea61b03767..79a85447cb 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryModifierRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryModifierRule.java @@ -169,7 +169,7 @@ public class UnnecessaryModifierRule extends AbstractJavaRule { if ((node.isInterface() || isParentInterfaceOrAnnotation) && node.isStatic()) { // a static interface or class nested within an interface - reportUnnecessaryModifiers(data, node, Modifier.PUBLIC, "types nested within an interface type are implicitly static"); + reportUnnecessaryModifiers(data, node, Modifier.STATIC, "types nested within an interface type are implicitly static"); } return data; diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/UnnecessaryModifier.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/UnnecessaryModifier.xml index c3212d803a..936436a89e 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/UnnecessaryModifier.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/UnnecessaryModifier.xml @@ -673,6 +673,20 @@ enum Foo { private Foo(String s) { name = s; } +} + ]]> + + + Static Modifier on interface + 1 + + Unnecessary modifier 'static' on interface 'Bar': types nested within an interface type are implicitly static + +