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

FCBL_FIELD_COULD_BE_LOCAL False positive #428

Open
victorherraiz-santander opened this issue Jan 4, 2022 · 0 comments
Open

FCBL_FIELD_COULD_BE_LOCAL False positive #428

victorherraiz-santander opened this issue Jan 4, 2022 · 0 comments

Comments

@victorherraiz-santander
Copy link

victorherraiz-santander commented Jan 4, 2022

Version 7.4.7 (latest) reports an issue on Builder nested class attribute data. It cannot be local because is used at the WithBuilderconstructor.

public final class WithBuilder {
    private final Integer data;

    private WithBuilder(Builder builder) {
        this.data = builder.data;
    }

    public Integer getData() {
        return data;
    }

    public static Builder builder() {
        return new Builder();
    }

    private final static class Builder {
        private Integer data = 0;

        public void setData(Integer data) {
            this.data = data;
        }

        public WithBuilder build() {
            return new WithBuilder(this);
        }
    }
}

The above code is only an example of a class much more complex that actually requires a builder pattern.

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

No branches or pull requests

2 participants