Is it possible to write the equivalent of Java
interface Foo {
public static final INSTANCE = new Foo {};
}
in Kotlin?
If Foo were a class, I could use:
class Foo {
companion object {
@JvmField
val INSTANCE = object : Foo() {}
}
}
but with an interface it gives an error:
JvmField cannot be applied to a property defined in companion object of interface
@JvmStatic doesn't work either.