I have a Java library that creates a proxy using ASM.
At one point, user sends a Kotlin class to it. I can detect it is a Kotlin class from Java, but I don't know how can I make a proxy from it? Everything what I read from such class is meaningless.
The scenario is the following
what would be the best way to do so?
I just realized that one of the reasons why I can't override Kotlin functions is because they are generated as final
methods in the bytecode. Is there a way to tell Kotlin not to do so?
The issue I had was that generated classes and methods are final
. The ASM code I am using was not processing final methods as they can not be overwritten.
The solution is to mark classes and functions in Kotlin as open
. You can do this manually or using all-open
plugin.
Here is a page that explains the issue: https://blog.frankel.ch/open-your-classes-and-methods-in-kotlin/