KT-12152 : constructor consistency: handle non-final classes
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
open class Base {
|
||||
init {
|
||||
register(<!DEBUG_INFO_LEAKING_THIS!>this<!>)
|
||||
<!DEBUG_INFO_LEAKING_THIS!>foo<!>()
|
||||
}
|
||||
|
||||
open fun foo() {}
|
||||
}
|
||||
|
||||
fun register(arg: Base) {
|
||||
arg.foo()
|
||||
}
|
||||
|
||||
class Derived(val x: Int) : Base() {
|
||||
override fun foo() {
|
||||
x.hashCode() // NPE in Base constructor
|
||||
}
|
||||
}
|
||||
|
||||
enum class MyEnum {
|
||||
FIRST() {
|
||||
val x: Int = 42
|
||||
|
||||
override fun foo() {
|
||||
x.hashCode() // NPE in MyEnum constructor
|
||||
}
|
||||
};
|
||||
|
||||
init {
|
||||
<!DEBUG_INFO_LEAKING_THIS!>foo<!>()
|
||||
}
|
||||
|
||||
abstract fun foo()
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package
|
||||
|
||||
public fun register(/*0*/ arg: Base): kotlin.Unit
|
||||
|
||||
public open class Base {
|
||||
public constructor Base()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Derived : Base {
|
||||
public constructor Derived(/*0*/ x: kotlin.Int)
|
||||
public final val x: kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final enum class MyEnum : kotlin.Enum<MyEnum> {
|
||||
enum entry FIRST
|
||||
|
||||
private constructor MyEnum()
|
||||
public final override /*1*/ /*fake_override*/ val name: kotlin.String
|
||||
public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int
|
||||
protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: MyEnum): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit
|
||||
public abstract fun foo(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class<MyEnum!>!
|
||||
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
// Static members
|
||||
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): MyEnum
|
||||
public final /*synthesized*/ fun values(): kotlin.Array<MyEnum>
|
||||
}
|
||||
Reference in New Issue
Block a user