A RetroSearch Logo

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

Search Query:

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

false positive with lombok's @Value · Issue #4510 · pmd/pmd · GitHub

Affects PMD Version:7.0.0-rc1

Rule: ConstructorCallsOverridableMethod

Please provide the rule name and a link to the rule documentation:
https://docs.pmd-code.org/latest/pmd_rules_java_errorprone.html#constructorcallsoverridablemethod

Description:
The first code sample uses the annotation @Value which can make the class Foo1 final. So the analysis results of the two cases should be equivalent because these two cases are equivalent. However, PMD reports a warning in the first sample and no warnings in the second one because PMD ignores the annotation @Value. PMD should not report a warning in Case1 like the Case2.

Code Sample demonstrating the issue:
Case1

import lombok.Value;
@Value
class Foo1 {
    public Foo1(String bar) {
        bar();  //  report a warning
    }
    public void bar() {}
}

Case2

final class Foo2 {
    public Foo2(String bar) {
        bar();  //  report no warning
    }
    public void bar() {}
}

Expected outcome:

PMD reports a violation at line 5 in the first case, but that's wrong. That's a false positive.


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