https://kotlinlang.org logo
Title
t

Tarun

04/10/2018, 9:17 AM
Hey I am working on a library in Kotlin In this library, if I have some variable inside
companion object
, than those variable are treated as static in Java But when I try to access those variable in a java project, which is using library, It is like :
MyClass.Companion.abcVariable
I searched and found I had to append @JvmStatic in front of variable so that java can access it directly like :
MyClass.abcVariable
This works for
classes
but for
interfaces
it requires a min API level of 24 and my Min API level is 21 Is there any other way to directly access companion object variables for
interface
in API projects supporting min API level less than 24 like :
MyClass.abcVariable
c

Czar

04/10/2018, 9:27 AM
Seems your problem is related to #android you'll probably have more luck in that channel.
t

Tarun

04/10/2018, 9:29 AM
yes I am working on android, and sure, will share it in #android, thanks for sharing
👍 1