Merge branch 'pr-1366'

This commit is contained in:
Andreas Dangel
2018-10-04 19:03:41 +02:00
3 changed files with 20 additions and 1 deletions

View File

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

View File

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

View File

@ -673,6 +673,20 @@ enum Foo {
private Foo(String s) {
name = s;
}
}
]]></code>
</test-code>
<test-code>
<description>Static Modifier on interface</description>
<expected-problems>1</expected-problems>
<expected-messages>
<message>Unnecessary modifier 'static' on interface 'Bar': types nested within an interface type are implicitly static</message>
</expected-messages>
<code><![CDATA[
class Foo{
public static interface Bar{
void method(){ }
}
}
]]></code>
</test-code>