A RetroSearch Logo

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

Search Query:

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

[java] ClassWithOnlyPrivateConstructorsShouldBeFinal - false negative when a compilation unit contains two class declarations · Issue #3851 · pmd/pmd · GitHub

Affects PMD Version: 6.43.0

Rule: ClassWithOnlyPrivateConstructorsShouldBeFinal
https://pmd.github.io/pmd-6.42.0/pmd_rules_java_design.html#classwithonlyprivateconstructorsshouldbefinal

Description:
In this case, Example is a class having only one private constructor. According to the rule, the class should be declared final. However, PMD misses this case.

Code Sample demonstrating the issue:

public class Example { // false-negative here
    private Example() {
    }
}

class Another {
}

Expected outcome:

PMD should report a violation at line 1, but doesn't. This is a false-negative.

Running PMD through: [CLI]


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