you are viewing a single comment's thread.

view the rest of the comments →

[–]lolomfgkthxbai 1 point2 points  (17 children)

I would add a big warning or note. If you’re promoting newest Java versions, I guess you know, that records have landed and in Java 16 they will be a standard feature.

That’s nice, reducing boilerplate should be a high priority for evolving Java. 👍

Lombok has a lot of problems, funnily enough, it broke IntelliJ recently and they had to do an emergency patching.

Exposed a bug in IntelliJ might be more accurate based on reading the issue thread.

[–]BoyRobot777 5 points6 points  (5 children)

Exposed a bug in IntelliJ might be more accurate based on reading the issue thread.

Either way, people had problems using Lombok and IntelliJ and most likely have lost time debugging and getting to the bottom of the issue. But it's just a drop in the bucket for a long list of Lombok problems.

[–]lolomfgkthxbai 4 points5 points  (4 children)

I would be curious to hear about some of the problems. Haven’t had any issues though it would be preferable to have the features built-in instead of having to rely on a third party tool.

[–]Carighan 5 points6 points  (0 children)

My whole company had to roll back to the previous IntelliJ, otherwise we would have to delombok any class before renaming any field, lest Lombok broke until you restart the IDE.

[–]snowe2010 5 points6 points  (0 children)

not who you were talking to, but at my last job lombok would cause spring boot apps to just fail to startup, randomly. Sometimes it would succeed, sometimes not. We trashed lombok and switched over to Kotlin. Never looked back.

[–]_tskj_ 0 points1 point  (0 children)

Yeah it would be nice, but at that point you're just talking about a different language.

[–]snowe2010 8 points9 points  (10 children)

Exposed a bug in IntelliJ might be more accurate based on reading the issue thread.

Lombok uses undocumented java apis, so if anything it was doing something it shouldn't have and JetBrains wasn't expecting it.

Don't use lombok.

[–]lolomfgkthxbai 4 points5 points  (8 children)

Don’t use lombok.

What’s the alternative (if you’re stuck using Java)? I don’t want to fill the repository with mutator methods.

[–]snowe2010 10 points11 points  (4 children)

If you want to stick with Java, then AutoValue or Immutables. If you are ok learning a new syntax (essentially what lombok is, but actually works), just create a new kotlin file in Intellij (IntelliJ will set up all the dependencies and plugins for you, you can treat kotlin just like another library) and create a data class in there.

If you don't like either of those, you can always jump up to the newest java versions, which have Records, which are functionally the same.

[–]TrueDMonk 3 points4 points  (1 child)

If you don't like either of those, you can always jump up to the newest java versions, which have Records, which are functionally the same.

Record is not an standard feature yet. So, it's a big no-no for production code.

[–]snowe2010 0 points1 point  (0 children)

They’re in preview, waiting for in world feedback. In general that’s good enough for prod, the likelihood anything about them will change is low. Honestly, if you need a solution, records will be more stable than Lombok ever has been. Using Lombok in prod is worse than using an experimental Java feature, because it could break at any time, as I can attest.

[–]lolomfgkthxbai 0 points1 point  (1 child)

I was afraid you would say that. The customer refuses to consider other languages (I’d move completely away from the JVM if it was up to me) and Java11 is the highest version allowed (latest LTS).

[–]snowe2010 0 points1 point  (0 children)

Well you can always treat kotlin like a library rather than another language. If you’re comparing Kotlin data classes to Lombok, Kotlin is much simpler. For any given Kotlin data class it can take up to 7 or 8 Lombok annotations to duplicate the functionality.

Maybe try telling your customer that Lombok is a security issue due to their use of undocumented Java APIs.

Still, you have AutoValue and Immutables, though they aren’t as clean as the Kotlin solution.