A RetroSearch Logo

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

Search Query:

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

[java] ConstructorCallsOverridableMethod should consider method calls with var access · Issue #4099 · pmd/pmd · GitHub

Affects PMD Version:6.47.0

Rule:ConstructorCallsOverridableMethod

Please provide the rule name and a link to the rule documentation:
https://pmd.sourceforge.io/pmd-6.48.0/pmd_rules_java_errorprone.html#constructorcallsoverridablemethod

Description:
Hi, we are doing research in testing static analyzer. Our approach found a false negative about the rule ConstructorCallsOverridableMethod.

In the first example below, PMD should have reported a warning at line 4, but not. However, PMD can report the warning at line 3 in the second example. Hence, I think this is a false negative.

First example (False negative)

public class Foo {
  final boolean tag = true;
  public Foo() {
    bar(tag);  // should report a warning at this line
  }
  public void bar(boolean b) {}
}

Second example (Can be detected)

public class Foo {
  public Foo() {
    bar(true);  // should report a warning at this line
  }
  public void bar(boolean b) {}
}

Expected outcome:

PMD should report a violation at line 4, 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