Skip to content

Fix SpotBugs UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR warning in IndentationCheck #18843

@smita1078

Description

@smita1078

SpotBugs reports a UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR warning for the incorrectIndentationLines field in IndentationCheck. This field is not initialized in the constructor, which violates best practices.

Current Problem

private Set<Integer> incorrectIndentationLines;

@Override
public void beginTree(DetailAST rootAST) {
    incorrectIndentationLines = new HashSet<>();
    // ...
}

The field is assigned in beginTree() instead of being initialized at declaration or in the constructor.

This issue addresses only the SpotBugs warning. It does not fully resolve the circular dependency problem described in #14121, which requires broader architectural refactoring.

Related Issues
Part of #14121 (circular dependency elimination)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions