Hello, I am completely new to Kotlin (about 3 days now). And this is my first post.
Overall, I’m very impressed with the design of the language and how easy it is to map Kotlin concepts to Java concepts.
With that out of the way, I have a question.
Now, first of all, assume that I have to do this. I know it sounds odd, but I do have a solid reason for this.
In Java, I have a set of classes with member variable getters and setters that use the number 1 as a way to avoid API collisions (this involves a code generator). For example
void set1MySystemField(String value)
Now, I tried to translate this to Kotlin via the folling construct:
var 1MySystemField : String = ""
I think as I wrote it I could guess it would not work. Obviously in Java, variable names cannot start with numerics, but the part after a getter and setter have no such problem.
My question is, is there a way to interoperate with Java such that I can call get1MySystemField2() and set1MySystemField1() from Java and still be using Kotlin
Only way to work is with leading underscore:
Underscore gets in the way (want set1MySystemField() and get1MySystemField().
Tried to make Kotlin ignore underscore via @JvmName annotation but the compiler does not accept it:
Is there anyway to make Kotlin map to this getter and setter name pair?