A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/807 below:

[java] AccessorMethodGeneration false positive with overloads · Issue #807 · pmd/pmd · GitHub

Affects PMD Version: 5.8.1, 6.0.0 (and probably 5.5.4 upwards since the rule was introduced)

Rule: AccessorMethodGeneration

Description: overloaded method tricks the rule into thinking there will be an accessor method generated.

Code Sample demonstrating the issue:

@SuppressWarnings({"unused", "StaticMethodOnlyUsedInOneClass", "SameParameterValue", "PMD.UseUtilityClass"})
class Outer {

  static void outerMethod(int i) {
    // package private method, safe to call, and is called from Inner.f()
  }

  private static void outerMethod(String s) {
    // private method, not used anywhere, yet triggers AccessorMethodGeneration
  }

  static class Inner {
    void f() {
      outerMethod(0);
    }
  }
}

Running PMD through: Gradle (5.8.1) and CLI (6.0.0 pmd -d . -format text -R java-design)


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4