[JVM_IR] Fix accessibility bridges for static protected fields.
Super-qualifiers have to be taken into account. Otherwise, too few accessibility bridges will be generated which can lead to binary compatibility issues.
This commit is contained in:
committed by
Alexander Udalov
parent
62897a194b
commit
6a959fefd0
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
// FILE: C.kt
|
||||
package test
|
||||
|
||||
class C: A.B() {
|
||||
// For binary compatibility, two accessibility bridges should be generated in C:
|
||||
// one for A.x and one for A.B.x.
|
||||
// Otherwise, if a static 'x' field is added to A.B either A.x or A.B.x will be ignored.
|
||||
// The JVM backend generates accessibility bridges for setters as well which is not necessary.
|
||||
fun f() = ({ A.x + x })()
|
||||
// Similarly for static functions. Two bridges should be generated for binary compatibility.
|
||||
fun g() = ({ A.h() + h() })
|
||||
}
|
||||
|
||||
// FILE: A.java
|
||||
public class A {
|
||||
protected static String x = "O";
|
||||
protected static String h() { return "O"; }
|
||||
public static class B extends A {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+39
@@ -0,0 +1,39 @@
|
||||
@kotlin.Metadata
|
||||
final class test/C$f$1 {
|
||||
// source: 'C.kt'
|
||||
enclosing method test/C.f()Ljava/lang/String;
|
||||
public final static field INSTANCE: test.C$f$1
|
||||
inner (anonymous) class test/C$f$1
|
||||
static method <clinit>(): void
|
||||
method <init>(): void
|
||||
public synthetic bridge method invoke(): java.lang.Object
|
||||
public final @org.jetbrains.annotations.NotNull method invoke(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
final class test/C$g$1 {
|
||||
// source: 'C.kt'
|
||||
enclosing method test/C.g()Lkotlin/jvm/functions/Function0;
|
||||
public final static field INSTANCE: test.C$g$1
|
||||
inner (anonymous) class test/C$g$1
|
||||
static method <clinit>(): void
|
||||
method <init>(): void
|
||||
public synthetic bridge method invoke(): java.lang.Object
|
||||
public final @org.jetbrains.annotations.NotNull method invoke(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class test/C {
|
||||
// source: 'C.kt'
|
||||
inner (anonymous) class test/C$f$1
|
||||
inner (anonymous) class test/C$g$1
|
||||
public method <init>(): void
|
||||
public synthetic final static method access$getX$p$s65(): java.lang.String
|
||||
public synthetic final static method access$getX$p$s66(): java.lang.String
|
||||
public synthetic final static method access$h$s65(): java.lang.String
|
||||
public synthetic final static method access$h$s66(): java.lang.String
|
||||
public synthetic final static method access$setX$p$s65(p0: java.lang.String): void
|
||||
public synthetic final static method access$setX$p$s66(p0: java.lang.String): void
|
||||
public final @org.jetbrains.annotations.NotNull method f(): java.lang.String
|
||||
public final @org.jetbrains.annotations.NotNull method g(): kotlin.jvm.functions.Function0
|
||||
}
|
||||
Vendored
+37
@@ -0,0 +1,37 @@
|
||||
@kotlin.Metadata
|
||||
final class test/C$f$1 {
|
||||
// source: 'C.kt'
|
||||
enclosing method test/C.f()Ljava/lang/String;
|
||||
public final static field INSTANCE: test.C$f$1
|
||||
inner (anonymous) class test/C$f$1
|
||||
static method <clinit>(): void
|
||||
method <init>(): void
|
||||
public synthetic bridge method invoke(): java.lang.Object
|
||||
public final @org.jetbrains.annotations.NotNull method invoke(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
final class test/C$g$1 {
|
||||
// source: 'C.kt'
|
||||
enclosing method test/C.g()Lkotlin/jvm/functions/Function0;
|
||||
public final static field INSTANCE: test.C$g$1
|
||||
inner (anonymous) class test/C$g$1
|
||||
static method <clinit>(): void
|
||||
method <init>(): void
|
||||
public synthetic bridge method invoke(): java.lang.Object
|
||||
public final @org.jetbrains.annotations.NotNull method invoke(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class test/C {
|
||||
// source: 'C.kt'
|
||||
inner (anonymous) class test/C$f$1
|
||||
inner (anonymous) class test/C$g$1
|
||||
public method <init>(): void
|
||||
public synthetic final static method access$getX$p$s65(): java.lang.String
|
||||
public synthetic final static method access$getX$p$s66(): java.lang.String
|
||||
public synthetic final static method access$h$s65(): java.lang.String
|
||||
public synthetic final static method access$h$s66(): java.lang.String
|
||||
public final @org.jetbrains.annotations.NotNull method f(): java.lang.String
|
||||
public final @org.jetbrains.annotations.NotNull method g(): kotlin.jvm.functions.Function0
|
||||
}
|
||||
Reference in New Issue
Block a user