jw
12/09/2016, 5:58 PMabstract class Base(number: Int)
class One : Base(ONE) {
companion object {
const val ONE = 1
}
}
class Two : Base(TWO) {
companion object {
private const val TWO = 2
}
}
In this example the <init>
of Two
uses a synthetic accessor method access$getTWO$cp
to trampoline to the TWO
constant whereas One
can directly load the static field. Both constants, however, are present on their enclosing class as static fields which can be loaded directly. Bug? Or is there something else that I'm missing here?