// TARGET_BACKEND: JVM // WITH_RUNTIME // FILE: SingletonCollection.kt package test open class SingletonCollection(val value: T) : AbstractCollection() { override val size = 1 override fun iterator(): Iterator = listOf(value).iterator() protected override final fun toArray(): Array = arrayOf(value) protected override final fun toArray(a: Array): Array { a[0] = value as E return a } } open class SingletonCollection2(val value: T) : AbstractCollection() { override val size = 1 override fun iterator(): Iterator = listOf(value).iterator() } // FILE: DerivedSingletonCollection.kt package test2 import test.* class DerivedSingletonCollection(value: T) : SingletonCollection(value) { fun test() = object { fun test() = toArray() }.test() fun test(a: Array) = object { fun test() = toArray(a) }.test() } class DerivedSingletonCollection2(value: T) : SingletonCollection2(value) { fun test() = object { fun test() = toArray() }.test() fun test(a: Array) = object { fun test() = toArray(a) }.test() } // @test/SingletonCollection.class: // 0 access\$ // 2 public final toArray // 0 \.toArray // @test/SingletonCollection2.class: // 0 access\$ // 0 toArray // @test2/DerivedSingletonCollection.class: // 0 access\$ // 0 toArray // @test2/DerivedSingletonCollection2.class: // 0 access\$ // 0 toArray