https://kotlinlang.org logo
#announcements
Title
# announcements
s

Stephan Schroeder

07/22/2021, 7:15 AM
We have several old Java projects using Lombok that we'd like to convert to Kotlin. We used the @Builder-annotation extensively and it's not yet supported by Kotlin. Unfortunately converting this code manually turned out to be too much of a hassle. If you're in a similar situation, maybe vote up the youtrack ticket: https://youtrack.jetbrains.com/issue/KT-46959?_gl=1*q24pg*_ga*NDY2MzY3ODA3LjE2MjY2NzUwND[…]_ga=2.20803896.1078897134.1626675045-466367807.1626675045
t

tddmonkey

07/22/2021, 8:17 AM
Dunno if it’s any use to you, but when we first migrated to Kotlin I wrote an annotation processor to generate builders from Kotlin data classes -> https://github.com/Masabi/kotlinbuilder
e

ephemient

07/22/2021, 8:24 AM
in the short term, delombok might be a workable hack?
I also wrote an annotation-based builder generator: https://github.com/ephemient/builder-generator
but apt-based approaches will always have some differences to lombok
I did do some digging into lombok-compiler-plugin, and I think the trickiest thing about
@Builder
is that it creates a whole new nested class, which the compiler's SyntheticJavaResolveExtension just isn't set up to allow for
6 Views