This is a common question. Say I have an extension function written in kotlin that converts DP to PX and returns NonNull Int
fun Int.toPx() { }
A function in java will look something like this:
public int toPx(int $receiver) { }
In my opinion, $receiver
makes Java-interop feel generated and unattractive.
I know that you can use annotation @JvmName
with some combinations, such as @file:JvmName
to change the name in java.
When I try to use @JvmName
with the target site receiver
, it says
"This annotation is not applicable to the target type usage
and uses the target @receiver
"
Is there a way to overcome this and change the name of the recipient, and if there is no better alternative.