Hi guys, I am new here so excuse me if I shouldn't...
# compiler
ç
Hi guys, I am new here so excuse me if I shouldn't post this to this channel. I am working on a Lombok like compiler plugin that enhances Kotlin classes. For now I have implementation for equals, hashcode and toString methods. My existing logic is based on FIR declaring empty bodies and IR implementing them. IR implementations are very similar to DataClassMemberGenerator... code which you can find here: https://github.com/bivektor/lombokt/blob/main/lombokt-plugin/backend/src/main/kotlin/com/bivektor/lombokt/ToStringIrVisitor.kt If I wanted to support K1 as well, what is the proper way to declare a method which already has a fake override? Is removing the fake override and adding the new function safe? I couldn't find any example code that replaces such fake override methods.
d
I would recommend to not support K1
j
Is it necessary to use FIR? I think you can do everything on IR as
toString
, `hashcode`and
equals
are already there 🤔
d
FWIW Poko does this and supports both K1 and K2.
🙌 1
Mutating the fake override method has worked pretty well for the last few years 😄
harold 1
ç
Wow I don't understand how I couldn't find Poko so far. That's great work man. Thanks
blob no problem 1
d
@dmitriy.novozhilov don’t worry, that code will die with K1
ç
@Drew Hamilton Do you have any plans to separate EqualsHashcode and ToString into different annotations?
d
I dream about the moment when K1 actually dies in kotlin.git. For users it would be dead since 2.3, but in the repo we need to keep it at least for a year from now
slow parrot 3
d
@Çağatay Kalan I have actually been considering that approach as a solution to #50, yes. If you have another use case for that approach please add a comment!
ç
Cool. I'll take the discussion to there then. Thanks guys.
👍 1