A RetroSearch Logo

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

Search Query:

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

[java] AccessorClassGeneration false positive for private constructors · Issue #755 · pmd/pmd · GitHub

Rule Set:
Design: AccessorClassGeneration

Description:
When there are both private and public constructors in inner class, with the same number of arguments but different types, PMD assumes that private is called from the outer class even public is actually called.

Code Sample demonstrating the issue:

public class Outer
{
  public static class Inner {
    private Inner(int x) { }
    public Inner(Object x) { }
  }
  
  public static void main(String[] args)
  {
    // PMD.AccessorClassGeneration
    // Avoid instantiation through private constructors from outside of the constructors class.
    new Inner(null); // complains as if Inner(int) is was called
  }
}

Running PMD through: [Gradle]


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