Fix VerifyError with @JvmStatic annotated getter
The problem was that for property getter 'context.getContextDescriptor()' references the containing property, while 'context.getFunctionDescriptor()' the accessor itself #KT-15594 Fixed
This commit is contained in:
@@ -3192,7 +3192,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
|||||||
boolean isSingleton = calleeContainingClass.getKind().isSingleton();
|
boolean isSingleton = calleeContainingClass.getKind().isSingleton();
|
||||||
if (isSingleton) {
|
if (isSingleton) {
|
||||||
if (calleeContainingClass.equals(context.getThisDescriptor()) &&
|
if (calleeContainingClass.equals(context.getThisDescriptor()) &&
|
||||||
!CodegenUtilKt.isJvmStaticInObjectOrClass(context.getContextDescriptor())) {
|
!CodegenUtilKt.isJvmStaticInObjectOrClass(context.getFunctionDescriptor())) {
|
||||||
return StackValue.local(0, typeMapper.mapType(calleeContainingClass));
|
return StackValue.local(0, typeMapper.mapType(calleeContainingClass));
|
||||||
}
|
}
|
||||||
else if (isEnumEntry(calleeContainingClass)) {
|
else if (isEnumEntry(calleeContainingClass)) {
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
// WITH_RUNTIME
|
||||||
|
// TARGET_BACKEND: JVM
|
||||||
|
object ObjectThisTest {
|
||||||
|
|
||||||
|
val testValue: String
|
||||||
|
@JvmStatic get() = this.testValue2
|
||||||
|
|
||||||
|
val testValue2: String
|
||||||
|
get() = "OK"
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box() = ObjectThisTest.testValue
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
@kotlin.Metadata
|
||||||
|
public final class ObjectThisTest {
|
||||||
|
public final static field INSTANCE: ObjectThisTest
|
||||||
|
private method <init>(): void
|
||||||
|
public final static @kotlin.jvm.JvmStatic @org.jetbrains.annotations.NotNull method getTestValue(): java.lang.String
|
||||||
|
public final @org.jetbrains.annotations.NotNull method getTestValue2(): java.lang.String
|
||||||
|
}
|
||||||
|
|
||||||
|
@kotlin.Metadata
|
||||||
|
public final class PropertyGetterDelegatesToAnotherKt {
|
||||||
|
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||||
|
}
|
||||||
+6
@@ -9740,6 +9740,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("propertyGetterDelegatesToAnother.kt")
|
||||||
|
public void testPropertyGetterDelegatesToAnother() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/jvmStatic/propertyGetterDelegatesToAnother.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("simple.kt")
|
@TestMetadata("simple.kt")
|
||||||
public void testSimple() throws Exception {
|
public void testSimple() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/jvmStatic/simple.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/jvmStatic/simple.kt");
|
||||||
|
|||||||
@@ -9740,6 +9740,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("propertyGetterDelegatesToAnother.kt")
|
||||||
|
public void testPropertyGetterDelegatesToAnother() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/jvmStatic/propertyGetterDelegatesToAnother.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("simple.kt")
|
@TestMetadata("simple.kt")
|
||||||
public void testSimple() throws Exception {
|
public void testSimple() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/jvmStatic/simple.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/jvmStatic/simple.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user