forked from phoedos/pmd
Merge pull request #3742 from dykov:hotfix/3701
[java] Fix #3701 - fix MissingStaticMethodInNonInstantiatableClass for method local classes #3742 * pr-3742: [doc] Update release notes (#3701, #3742) #3701 - fix MissingStaticMethodInNonInstantiatableClass for method local classes
This commit is contained in:
@ -41,6 +41,7 @@ This is a {{ site.pmd.release_type }} release.
|
||||
* [#3679](https://github.com/pmd/pmd/issues/3679): \[java] Make FinalFieldCouldBeStatic detect constant variable
|
||||
* java-errorprone
|
||||
* [#3686](https://github.com/pmd/pmd/issues/3686): \[java] ReturnEmptyCollectionRatherThanNull - false negative with conditioned returns
|
||||
* [#3701](https://github.com/pmd/pmd/issues/3701): \[java] MissingStaticMethodInNonInstantiatableClass false positive with method inner classes
|
||||
* java-performance
|
||||
* [#3492](https://github.com/pmd/pmd/issues/3492): \[java] UselessStringValueOf: False positive when there is no initial String to append to
|
||||
|
||||
@ -57,6 +58,7 @@ This is a {{ site.pmd.release_type }} release.
|
||||
* [#3719](https://github.com/pmd/pmd/pull/3719): \[java] Upgrade log4j to 2.17.1 - [Daniel Paul Searles](https://github.com/squaresurf)
|
||||
* [#3720](https://github.com/pmd/pmd/pull/3720): \[java] New rule: FinalParameterInAbstractMethod - [Vincent Galloy](https://github.com/vgalloy)
|
||||
* [#3724](https://github.com/pmd/pmd/pull/3724): \[java] Fix for #3686 - fix FinalFieldCouldBeStatic - [Oleksii Dykov](https://github.com/dykov)
|
||||
* [#3742](https://github.com/pmd/pmd/pull/3742): \[java] Fix #3701 - fix MissingStaticMethodInNonInstantiatableClass for method local classes - [Oleksii Dykov](https://github.com/dykov)
|
||||
* [#3744](https://github.com/pmd/pmd/pull/3744): \[core] Updated SaxonXPathRuleQueryTest.java - [Vyom Yadav](https://github.com/Vyom-Yadav)
|
||||
|
||||
{% endtocmaker %}
|
||||
|
@ -2547,7 +2547,7 @@ See the property `annotations`.
|
||||
<property name="xpath">
|
||||
<value>
|
||||
<![CDATA[
|
||||
//ClassOrInterfaceDeclaration[@Nested= false()]
|
||||
//ClassOrInterfaceDeclaration[@Nested= false() and @Local= false()]
|
||||
[
|
||||
(
|
||||
(: at least one constructor :)
|
||||
|
@ -346,6 +346,36 @@ public abstract class MyADT {
|
||||
return onInt.apply(integer);
|
||||
}
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
<test-code>
|
||||
<description>#3701 - false positive with method inner class</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class Scratch {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Scratch scratch = new Scratch();
|
||||
|
||||
scratch.callMethod();
|
||||
}
|
||||
|
||||
void callMethod() {
|
||||
|
||||
class InnerClass {
|
||||
private InnerClass() {
|
||||
}
|
||||
|
||||
void display() {
|
||||
System.out.println("Works OK!");
|
||||
}
|
||||
}
|
||||
|
||||
InnerClass innerClass = new InnerClass();
|
||||
innerClass.display();
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
Reference in New Issue
Block a user