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

[FEATURE] Enable Setters for lazy getters #3806

Open
GregDThomas opened this issue Jan 6, 2025 · 0 comments
Open

[FEATURE] Enable Setters for lazy getters #3806

GregDThomas opened this issue Jan 6, 2025 · 0 comments

Comments

@GregDThomas
Copy link

GregDThomas commented Jan 6, 2025

Describe the feature
Currently, a @Getter(lazy = true) requires the annotated field to be marked final.

It would be great if this requirement was lifted, and a generated setter for that field was something like (extending the sample for the docs) ...

With lombok:

@Getter(lazy=true) @Setter private double[] cached = expensive();

Without lombok:

public double[] getCached()  {
   ... unchanged from current behaviour ...
}

public void setCached(double[] actualValue) {
    this.cached.set(actualValue == null ? this.cached : actualValue);
}

Describe the target audience
This would be useful anywhere the "expensive" value is not immutable.

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

1 participant