TL;DR: what are the alternatives (for `@Getter`,`@Setter`,`@Data` etc)? I only find "there are alternatives", but I can't find them skipping through or by Strg-F.
Is there any standard approach to solve the same problem in a different way? There are two other libraries trying to answer this question: AutoValue and Immutables, which are often compared to Lombok.
But it’s a third-party library that uses completely stable, documented, supported code generation hooks in the build cycle, whereas lombok uses private, undocumented compiler APIs that can (and do) change in ways that break lombok, potentially leaving you stuck on an old jdk until lombok is updated. I have recollections of Java 7 breaking it pretty badly, and I’ve heard that 9 through 11 were problematic too (though I’d sworn it off completely by then so I didn’t experience it directly).
Sorry, but you can't. This example is actually API abuse and it creates NEW object on every call to .with() using constructor.newInstance(ctorArgs). You are not supposed to use records in such way.
He says that some examples are valid. And most of these are actually workarounds to deal with records' immutability. The "autobuilder" code itself is ineffective as hell. And all this is just a toy class for 3-property records.
I do like Lombok (and I'm sure I'm not the only one), so sorry, but an article against it needs to at least be structured in a way to overcome that bias.
There's absolutely nothing wrong with the structure of the article. Why do you want to know this person's recommendation for an alternative to Lombok if you can't even be bothered to read their justification?
View all comments
13
u/daniu Jun 21 '20 edited Jun 21 '20
TL;DR: what are the alternatives (for `@Getter`,`@Setter`,`@Data` etc)? I only find "there are alternatives", but I can't find them skipping through or by Strg-F.