JVM IR: change generation scheme of property $delegate methods
Generate $delegate method as instance method in PropertyReferenceDelegationLowering, and remove dispatch receiver later in MakePropertyDelegateMethodsStatic. The method needs to be static to be non-overridable (see delegateMethodIsNonOverridable.kt), and public to be accessible in reflection. Otherwise we generated incorrect IR where a static function accessed an instance field of the containing class, which failed in multiple places including LocalDeclarationsLowering. #KT-48350 Fixed
This commit is contained in:
committed by
Alexander Udalov
parent
50508da156
commit
04c5bbdcf8
Vendored
+65
@@ -0,0 +1,65 @@
|
||||
@kotlin.Metadata
|
||||
synthetic final class C$x$2$1 {
|
||||
// source: 'delegateMethodIsNonOverridable.kt'
|
||||
public final static field INSTANCE: kotlin.reflect.KProperty0
|
||||
static method <clinit>(): void
|
||||
method <init>(): void
|
||||
public @org.jetbrains.annotations.Nullable method get(): java.lang.Object
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
synthetic final class C$y$2 {
|
||||
// source: 'delegateMethodIsNonOverridable.kt'
|
||||
public final static field INSTANCE: kotlin.reflect.KProperty0
|
||||
static method <clinit>(): void
|
||||
method <init>(): void
|
||||
public @org.jetbrains.annotations.Nullable method get(): java.lang.Object
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public class C {
|
||||
// source: 'delegateMethodIsNonOverridable.kt'
|
||||
private final @org.jetbrains.annotations.NotNull field x$delegate: kotlin.reflect.KProperty0
|
||||
private final @org.jetbrains.annotations.NotNull field y$delegate: kotlin.reflect.KProperty0
|
||||
public method <init>(): void
|
||||
public method getX(): int
|
||||
public method getY(): int
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
synthetic final class D$x$2$1 {
|
||||
// source: 'delegateMethodIsNonOverridable.kt'
|
||||
public final static field INSTANCE: kotlin.reflect.KProperty0
|
||||
static method <clinit>(): void
|
||||
method <init>(): void
|
||||
public @org.jetbrains.annotations.Nullable method get(): java.lang.Object
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
synthetic final class D$y$2 {
|
||||
// source: 'delegateMethodIsNonOverridable.kt'
|
||||
public final static field INSTANCE: kotlin.reflect.KProperty0
|
||||
static method <clinit>(): void
|
||||
method <init>(): void
|
||||
public @org.jetbrains.annotations.Nullable method get(): java.lang.Object
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class D {
|
||||
// source: 'delegateMethodIsNonOverridable.kt'
|
||||
private final @org.jetbrains.annotations.NotNull field x$delegate: kotlin.reflect.KProperty0
|
||||
private final @org.jetbrains.annotations.NotNull field y$delegate: kotlin.reflect.KProperty0
|
||||
public method <init>(): void
|
||||
public method getX(): int
|
||||
public method getY(): int
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class DelegateMethodIsNonOverridableKt {
|
||||
// source: 'delegateMethodIsNonOverridable.kt'
|
||||
private final static field a: int
|
||||
private final static field b: int
|
||||
static method <clinit>(): void
|
||||
public final static method getA(): int
|
||||
public final static method getB(): int
|
||||
}
|
||||
Reference in New Issue
Block a user