You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@FieldDefaults is an experimental Lombok feature that along with a few sibling annotations allows users to forgo adding field modifiers to individual fields.
So
importlombok.AccessLevel;
importlombok.experimental.FieldDefaults;
importlombok.experimental.NonFinal;
importlombok.experimental.PackagePrivate;
@FieldDefaults(makeFinal=true, level=AccessLevel.PRIVATE)
publicclassFieldDefaultsExample {
publicfinalinta;
intb;
@NonFinalintc;
@PackagePrivateintd;
FieldDefaultsExample() {
a = 0;
b = 0;
d = 0;
}
}
Becomes
publicclassFieldDefaultsExample {
publicfinalinta;
privatefinalintb;
privateintc;
finalintd;
FieldDefaultsExample() {
a = 0;
b = 0;
d = 0;
}
}
which if you were to ask me does not improve readability for this small sample.
Given that it's an experimental feature, with an uncertain future given the last update ("this feature will not be leaving experimental in its current state"), there's bound to be an audience for removing these annotations with their one to one replacement modifiers.
I've placed the issue here as we have other lombok recipes/issues in this repository, and newer versions of Lombok or Java might have it make sense to be part of rewrite-migrate-java.
The text was updated successfully, but these errors were encountered:
@FieldDefaults is an experimental Lombok feature that along with a few sibling annotations allows users to forgo adding field modifiers to individual fields.
So
Becomes
which if you were to ask me does not improve readability for this small sample.
Given that it's an experimental feature, with an uncertain future given the last update ("this feature will not be leaving experimental in its current state"), there's bound to be an audience for removing these annotations with their one to one replacement modifiers.
I've placed the issue here as we have other lombok recipes/issues in this repository, and newer versions of Lombok or Java might have it make sense to be part of rewrite-migrate-java.
The text was updated successfully, but these errors were encountered: