Anyone familiar with the latest on lombok + kotlin...
# server
s
Anyone familiar with the latest on lombok + kotlin? For reference, we have a very large java codebase with lombok littered all over and it makes introducing Kotlin very difficult since — as far as I can tell — in mixed java/kotlin source modules, there's no way to get the kotlin compiler to see the lombok generated code. I would love to be wrong about that though. Does anyone have experience with this or has found a smooth way around it?
c
Lombok is a hack on the Java Compiler, using many APIs that are supposed to be hidden or are only for certain Java compilers. It’s not really something that even could be made to work well with Kotlin. It works cross-module because the other module is a dependency, so Lombok transformations are just bytecode at that point. My team finally decided to remove Lombok entirely with the “delombok” tool, and it has made our lives so much easier (as well as encouraging greater usage of Kotlin in the codebase).
4
s
interesting
e
agreed. asi i understand it, in mixed projects, it’s actually kotlinc that’s compiling the java code (modulo a few details) so lombok isn’t invoked.
t
We also just delomboked with a view to replacing our code with pure Kotlin instead
👍🏻 1
e
Even for java i’m not a lombok fan
1
s
Why became Lombok such a thing actually?
was it before IDEs wouldn’t auto-generate these methods?
I mean the idea is neat, to declutter the code base.
nobody wants to see probably Getter/Setter if they are trivial
t
Even with IDE generation, I would rather remove the need for someone to have to remember how to do it when it can all be handled automatically
a
A hack or a useful tool, Lombok is a reality in many Java projects. It's a pity it doesn't work smoothly in mixed Java-Kotlin projects, I felt that pain too... I guess one of the main points of Kotlin (and distinguish factor from other JVM langs) was to make step-by-step migration from Java easy. With Lombok on board, this feature has fallen short 😭
j
I've had similar pains with AspectJ+Java mixing with Kotlin Luckily i don't have to deal with AspectJ anymore