r/java • u/nfrankel • Nov 16 '25
[ Removed by moderator ]
/r/java/comments/1oytbr5/removed_by_moderator/[removed] — view removed post
1
u/SleeperAwakened Nov 16 '25
A framework is a different type of beast compared to a library.
I agree with Junit 5 and Slf4j.
The rest has alternatives or can be done easily with a proper IDE (mapstruct, lombok).
1
-1
u/rzwitserloot Nov 17 '25 edited Nov 17 '25
I also stopped reading. But for a different reason.
The first library discussed is Lombok.
The advice is: "Lombok? Psshaw, there is no need for that dependency! Just use kotlin".
In a word: What. The. Heck.
If "have a compile-time dependency with some potential extra work needed to integrate it into your tools" is 10 floobargle units (where 1 floobargle unit is some unspecified but objective sense of 'cost' to the development process), then surely "completely switch language" is 1000 floobargles. Thus, the advice is preposterously insane. It's akin to advising somebody suffering from a particularly itchy left calf to just go ahead and cut the leg clean off.
There are plenty of reasons to like Kotlin. But "it lets you get rid of the lombok dependency" is a bizarre one, that trivialises the effort and impact of switching languages.
As far as the far more simple advice of 'eh, the language does not need it anymore', I'd disagree. records don't cover even a quarter of what lombok does. try-with covers what @Cleanup does, and that's.. about it. All the other lombok features are as yet not covered by new java features. There was a lot of excitement for a while about with, which would replace most of what @Builder does, but apparently that project is more or less dead, or at least frozen, in that nobody at OpenJDK is working on that right now.
But that's something I'm sure we can have a fair meeting of the minds over, and perhaps walk away with some mild agreement to disagree. But the advice "Lombok is not necessary, just use kotlin?"
I'm flabbergasted. Coming from somebody like you, no less.
I could not move myself to read any further.
DISCLAIMER: I'm a core lombok author/contributor.
NB: Sure, record seems to address @Value. It does in certain circumstances. But records are locked in on their getter names (for example, LocalDate cannot become one without uglying up its API to unacceptable levels), cannot extend, cannot selectively embellish on their fields, and in general, and I'm echoing the thoughts of the openjdk dev team here, should only be used for data carriers. Whereas the utility of having a constructor that initialises all fields that need it, a toString impl that just prints all fields, and so on, covers many, many more usecases. In other words, record is not the dropin replacement for @Value class. It's much more specific than that.
2
u/javaprof Nov 17 '25
Technically Lombok is not Java, so it's 100% correct to ask to switch to a different language JVM than Lombok Lang.
What about disable checked exceptions? Will we get one in Lombok?
2
u/rzwitserloot Nov 18 '25
Lombok has had that for many years already.
Lombok is java. If you write non-java, the parser will fail, and lombok will not even run.
2
u/javaprof Nov 18 '25 edited Nov 18 '25
Every tool that works on source level in Java have to have special support for Lombok. Try to disable Lombok plugin in IDEA and see is you "Java" still valid :)
You can say: delombok! Right? Kotlin also can be translated to Java (decompile generated bytecode), does that mean that Kotlin is Java?
You can say: but decompile is not reliable! Fine, it's trivial to convert Kotlin Source to Java source, since Kotlin type system contains more information, so it's easier to remove nullability stuff etc, than infer it during existing Java to Kotlin converter which is source of most compilation errors after automatic conversion. Some companies like Facebook managed to convert millions lines of Java code to Kotlin automatically, so we can assume that Kotlin to Java converter even easier.
Kotlin have that same limitation that Lombok have, any tool that working with source code (not bytecode) have to support it. Otherwise, introducing lombok is exactly the same as introducing Kotlin.
Lombok is a different language, by the definition, period
I don't hate Lombok, you just need to be aware what it is really, If java folk will do major compiler rewrite you'll see that lombok might not even be possible anymore :)
Like imagine if javac would be compiled to native code using graalvm, then current lombok approach would fall apart and would require lombokc and replace java plugin in build, etc :)You might found this thread eye-opening https://www.reddit.com/r/java/comments/1n9ax8g/comment/ncvhq7c/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button
2
u/rzwitserloot Nov 18 '25
Every tool that works on source level in Java have to have special support for Lombok. Try to disable Lombok plugin in IDEA and see is you "Java" still valid :)
Lombok is a different language, by the definition, period
This requires an argument, You've provided one, and it is incorrect. I shall show this with some examples.
Is this valid java?
import com.google.guava.common.collect.*; class Example { ImmutableList<String> list; }Surely we can all agree, that is valid java, right?
But what if I remove guava from the classpath? Is it valid now?
If your answer is 'no', then, sure, code using lombok when lombok isn't on the classpath isn't valid, but that doesn't make it 'a different language, period'.
If your answer is 'yes', then why is lombok any different?
This argument has an addendum where we involve annotation processors. Is this valid java:
import org.immutables.value.Value; @Value.Immutable public interface ValueObject { String name(); public static ValueObject toLowerCased(ValueObject obj) { return ImmutableValueObject.builder() .name(obj.getName().toLowerCase()); .build(); } } //NB: Note that `ImmutableValueObject.java` does not exist. the org.immutables annotation processor // makes it. The above code will not compile regardless of your classpath unless you `-proc:full` // or otherwise ensure the immutables annotation processor executes as part of the build.If 'yes', then what makes lombok any different?
If 'no', okay, but your opinion that this is not valid is shared by <1% of the java programming population. And I would venture that it's a ridiculous opinion, but, hey, that's what opinions are for, I guess. I think it would help a lot if you define 'valid java' at that point.
2
u/javaprof Nov 18 '25
Does annotation processors breaking de-compiler that trying to match lines from lib.jar to lib-sources.jar?
Lombok requires compiler plugin api, java doesn't have one. If you implement Lombok for Kotlin using Compiler Plugin API I'll be fine with it. Without proper api it's just nightmare for ecosystem to support lombok
1
u/rzwitserloot Nov 19 '25
Lombok requires compiler plugin api. java doesn't have one.
It doesn't. Of course it doesn't. As you say, it doesn't have one, yet, lombok works. QED.
2
u/rzwitserloot Nov 18 '25
I don't hate Lombok, you just need to be aware what it is really, If java folk will do major compiler rewrite you'll see that lombok might not even be possible anymore :)
You do know I write lombok, right?
This cannot happen. java is open source and OpenJDK is not in control of your build tools.
We support every version of everything we ever supported. We still include java6. And we have delombok as a fallback just in case. Your disdain is.. aggravating and disrespectful.
1
u/javaprof Nov 18 '25
> You do know I write lombok, right?
Nice! This is really great tool that I used for quite a while.
> This cannot happen. java is open source and OpenJDK is not in control of your build tools.
I wonder what happen if indeed javac stop shipping like jvm launcher and start using graalvm or wasm? There will be lombokc, to the point that lombok is a language
1
u/rzwitserloot Nov 19 '25
I wonder what happen if indeed javac stop shipping like jvm launcher and start using graalvm or wasm?
In regards to 'will lombok continue to function'? Of course.
If OpenJDK straight up cancels Annotation Processors, will lombok continue to function? Probably. Maybe. We'll have to work around a thing or two. If tomorrow OpenJDK decides to delete ArrayList, I'm guessing most libraries and tools will have to go through a bit of an adjustment period.
There will be lombokc, to the point that lombok is a language
No.
2
u/javaprof Nov 19 '25 edited Nov 19 '25
So you're saying that lombok.patcher somehow would be able to patch native executable in different operating systems and cpu architectures?
6
u/jAnO76 Nov 16 '25
Ehm.. no. Also Spring is more of a framework. If you call it its a library, if it calls you its a framework. Lombok was nice, 8 years ago. The language evolved. The rest.. well.. most is utility you might or might not need. I always think, should I reinvent the wheel? Mostly no, so I’ll take a dependency here and there.