Fix for: KT-8089 NoSuchFieldError
#KT-8089 Fixed
This commit is contained in:
@@ -2239,7 +2239,14 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
|||||||
fieldName = ((FieldOwnerContext) backingFieldContext).getFieldName(propertyDescriptor, isDelegatedProperty);
|
fieldName = ((FieldOwnerContext) backingFieldContext).getFieldName(propertyDescriptor, isDelegatedProperty);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fieldName = JvmAbi.getDefaultFieldNameForProperty(propertyDescriptor.getName(), isDelegatedProperty);
|
Name name;
|
||||||
|
if (propertyDescriptor instanceof AccessorForPropertyDescriptor) {
|
||||||
|
name = ((AccessorForPropertyDescriptor) propertyDescriptor).getCalleeDescriptor().getName();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
name = propertyDescriptor.getName();
|
||||||
|
}
|
||||||
|
fieldName = JvmAbi.getDefaultFieldNameForProperty(name, isDelegatedProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
return StackValue.property(propertyDescriptor, backingFieldOwner,
|
return StackValue.property(propertyDescriptor, backingFieldOwner,
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
class C {
|
||||||
|
companion object {
|
||||||
|
private val s: String
|
||||||
|
private var s2: String
|
||||||
|
|
||||||
|
init {
|
||||||
|
s = "O"
|
||||||
|
s2 = "O"
|
||||||
|
}
|
||||||
|
|
||||||
|
fun foo() = s
|
||||||
|
|
||||||
|
fun foo2() = s2
|
||||||
|
|
||||||
|
fun bar2() { s2 = "K" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
return C.foo() + {C.bar2(); C.foo2()}()
|
||||||
|
}
|
||||||
+6
@@ -7057,6 +7057,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt8089.kt")
|
||||||
|
public void testKt8089() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/staticFields/kt8089.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("syntheticAccessor.kt")
|
@TestMetadata("syntheticAccessor.kt")
|
||||||
public void testSyntheticAccessor() throws Exception {
|
public void testSyntheticAccessor() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/staticFields/syntheticAccessor.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/staticFields/syntheticAccessor.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user