Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS False Positive #435

Open
fullben opened this issue Oct 26, 2022 · 1 comment
Open

PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS False Positive #435

fullben opened this issue Oct 26, 2022 · 1 comment

Comments

@fullben
Copy link

fullben commented Oct 26, 2022

The plugin reports Constructor makes call to non-final method when a constructor calls a private method.

Environment

  • com.github.spotbugs version 5.0.13
  • fb-contrib version 7.4.3.sb
  • Gradle-based Java project, project has classes such as the one outlined below:
public class SomeClass {

  private final String s;

  public SomeClass(String s) {
    doSomething();
    this.s = s;
  }

  private void doSomething() {
    ...
  }
}

Current Behavior

A bug (Constructor makes call to non-final method) is reported.

Expected Behavior

No bug is reported, as private methods are implicitly final and cannot be overridden, therefore do not pose an issue.

@mebigfatguy
Copy link
Owner

does doSomething call public methods in the class?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants