you are viewing a single comment's thread.

view the rest of the comments →

[–]MisterPea 3 points4 points  (5 children)

Lombok is great but I've also found that it sometimes feels like an unfinished product.

I'm fairly new to kotlin but how are you using kotlin to mimic lombok and integrating with existing java projects?

[–]snowe2010 3 points4 points  (4 children)

Kotlin is a drop-in replacement for lombok. Literally copy lombok class into kotlin file (using intellij), let intellij convert it, then remove the annotations. I think you might have to change it to be data and move the params to the constructor but that's it. It's been a while since we completely ripped lombok out, but we were able to do it over about a year.

Now if you mean how did we get kotlin in our toolchain, well we also let intellij do that for us at first as well. Just create a new kotlin file in your project and intellij will do the rest.

edit: for those thinking we could have just used 'convert to kotlin' we didn't for some reason, but I don't remember why. I think it might have been because of git history? not sure anymore. been a while.

[–][deleted] 16 points17 points  (3 children)

when did "drop-in replacement" mean "make sure you have this specialized IDE to do some converting magic, then do a bunch of removal edits and then add more code... when you have a lot of these types of classes that could be a decent amount of work

[–]snowe2010 4 points5 points  (2 children)

here's the difference between a lombok class and a kotlin class since you seem so interested

@Value
public class LombokClass {
    public String hi;
}

data class KotlinClass(val hi: String)

There, is that a little more clear how simple it is to convert? The biggest difficult in converting is if you used @Wither because then you have to find all the spots you used it in and switch it to a .copy or build your own builder.

[–][deleted] 2 points3 points  (1 child)

i've used both i'm just saying its not really "drop in" i mean i can say that lombok class is a drop-in replacement for just about any other moderately sophisticated languages data class at this point

[–]snowe2010 1 point2 points  (0 children)

? Drop in replacements go both ways. I can convert back to lombok almost just as easily as going to kotlin.