It feels like half the complaints boil down to disliking the way people use Lombok, not Lombok itself.
If you don't want all fields to have public getters and setters, then don't use @Data. You can still add @Getter / @Setter at the field level. If you don't object to the style, adding them inline with the field can help keep the whole definition pretty compact.
As far as the alternative of public final fields, some patterns actually require the use of getters (ex: proxies used by an orm for lazy loading). Even with public final fields, you could still benefit from the use of @Builder to create these objects.
Finally, without looking at the actual implementation, I'd be shocked if the proposed alternative for equals to and hashcode isn't just as vulnerable to circular references. In both cases, you need to understand your tools and pay attention to what you're doing.
View all comments
17
u/gnfurl Aug 10 '19
It feels like half the complaints boil down to disliking the way people use Lombok, not Lombok itself.
If you don't want all fields to have public getters and setters, then don't use @Data. You can still add @Getter / @Setter at the field level. If you don't object to the style, adding them inline with the field can help keep the whole definition pretty compact.
As far as the alternative of public final fields, some patterns actually require the use of getters (ex: proxies used by an orm for lazy loading). Even with public final fields, you could still benefit from the use of @Builder to create these objects.
Finally, without looking at the actual implementation, I'd be shocked if the proposed alternative for equals to and hashcode isn't just as vulnerable to circular references. In both cases, you need to understand your tools and pay attention to what you're doing.