Skip to content

PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS False Positive #435

@fullben

Description

@fullben

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions