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

@Value and @FieldDefaults should skip static fields #1254

Closed
rspilker opened this issue Dec 5, 2016 · 3 comments
Closed

@Value and @FieldDefaults should skip static fields #1254

rspilker opened this issue Dec 5, 2016 · 3 comments

Comments

@rspilker
Copy link
Collaborator

rspilker commented Dec 5, 2016

@Value and @FieldDefaults add the private and final modifiers to the fields if possible. This behavior is influenced by @NonFinal and @PackagePrivate.

For instance fields, this makes sense. But for package private static non-final fields, this is an unexpected side-effect of adding @Value

@rspilker rspilker changed the title @Value and @FieldDefaults should skip static fields @Value and @FieldDefaults should skip static fields Dec 5, 2016
@gjroelofs
Copy link

Would it be possible to add optional support for static fields in @FieldDefaults?

@Maze-fr
Copy link

Maze-fr commented Apr 28, 2017

I'm just upgrading my Lombok JAR from 1.16.10 to 1.16.16 and this "correction" just killed all my projects.

My very simple use case is to put @UtilityClass and @FieldDefaults(makeFinal = true, level = AccessLevel.PUBLIC) to get a class to store my constants.

Now, everything is broken in all my projects and it makes Lombock useless for that kind of configuration.
I go back to do everything manualy.

@Maze-fr
Copy link

Maze-fr commented May 2, 2017

Another simple use case : on my "POJO beans" (ex : @Entity @Data serializable classes), I use @FieldDefaults(level = AccessLevel.PRIVATE), as certainly almost everybody using Lombok.
Now I have to manually write that serialVersionUID is private.

But, in fact, I use it in a "lombok.config" file to have it by default on the entire project. So I have to search for all my static fields and manually make them private where needed...

It looks like 2 little things (combined with my previous post), but in the big company I'm working for, because all the newly (last 2 years) created applications (at least a dozen) use a parent Maven dependency configuration including Lombok, that king of modification causes a not so little work to do when updating...

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

3 participants