I’m trying to find out what is the best way to represent static final fields in Kotlin. Imagine this simple case:
Java:
class Foo {
public static final String BLA=“bla”
// non static members below
}
While I can represent this as a companion object like this:
class Foo {
companion object {
const val BLA = “bla”
}
}
It generates two classes in the resulting bytecode - one for Foo and the other one for the companion object - that’s fairly expensive. Is there a way how to avoid this? This seems to be fairly expensive, especially when on Android many classes always define just one static final field (TAG) …