Fixed bug in fix for KT 3492: Bug in bytecode generation for labeled super call from inner class & Property generation refactoring
This commit is contained in:
@@ -1734,6 +1734,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
|||||||
JvmClassName owner;
|
JvmClassName owner;
|
||||||
CallableMethod callableMethod = callableGetter != null ? callableGetter : callableSetter;
|
CallableMethod callableMethod = callableGetter != null ? callableGetter : callableSetter;
|
||||||
|
|
||||||
|
propertyDescriptor = unwrapFakeOverride(propertyDescriptor);
|
||||||
if (callableMethod == null) {
|
if (callableMethod == null) {
|
||||||
owner = typeMapper.getOwner(propertyDescriptor, contextKind(), isInsideModule);
|
owner = typeMapper.getOwner(propertyDescriptor, contextKind(), isInsideModule);
|
||||||
}
|
}
|
||||||
@@ -1741,7 +1742,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
|||||||
owner = callableMethod.getOwner();
|
owner = callableMethod.getOwner();
|
||||||
}
|
}
|
||||||
|
|
||||||
return StackValue.property(propertyDescriptor, owner, asmType(unwrapFakeOverride(propertyDescriptor).getOriginal().getType()),
|
return StackValue.property(propertyDescriptor, owner, asmType(propertyDescriptor.getOriginal().getType()),
|
||||||
isStatic, callableGetter, callableSetter, state);
|
isStatic, callableGetter, callableSetter, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -889,7 +889,7 @@ public abstract class StackValue {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Method method = getter.getSignature().getAsmMethod();
|
Method method = getter.getSignature().getAsmMethod();
|
||||||
v.visitMethodInsn(getter.getInvokeOpcode(), methodOwner.getInternalName(), method.getName(), method.getDescriptor());
|
v.visitMethodInsn(getter.getInvokeOpcode(), getter.getOwner().getInternalName(), method.getName(), method.getDescriptor());
|
||||||
}
|
}
|
||||||
coerceTo(type, v);
|
coerceTo(type, v);
|
||||||
}
|
}
|
||||||
@@ -902,7 +902,7 @@ public abstract class StackValue {
|
|||||||
this.type.getDescriptor()); }
|
this.type.getDescriptor()); }
|
||||||
else {
|
else {
|
||||||
Method method = setter.getSignature().getAsmMethod();
|
Method method = setter.getSignature().getAsmMethod();
|
||||||
v.visitMethodInsn(setter.getInvokeOpcode(), methodOwner.getInternalName(), method.getName(), method.getDescriptor());
|
v.visitMethodInsn(setter.getInvokeOpcode(), setter.getOwner().getInternalName(), method.getName(), method.getDescriptor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
class FieldAccess {
|
||||||
|
public String fieldO;
|
||||||
|
|
||||||
|
public static String fieldK;
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
class MyWrongClass : FieldAccess() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box() : String {
|
||||||
|
val clazz = MyWrongClass()
|
||||||
|
clazz.fieldO = "O"
|
||||||
|
FieldAccess.fieldK = "K"
|
||||||
|
return clazz.fieldO!! + FieldAccess.fieldK!!
|
||||||
|
}
|
||||||
+15
-1
@@ -31,7 +31,7 @@ import org.jetbrains.jet.codegen.generated.AbstractBlackBoxCodegenTest;
|
|||||||
/** This class is generated by {@link org.jetbrains.jet.generators.tests.GenerateTests}. DO NOT MODIFY MANUALLY */
|
/** This class is generated by {@link org.jetbrains.jet.generators.tests.GenerateTests}. DO NOT MODIFY MANUALLY */
|
||||||
@SuppressWarnings("all")
|
@SuppressWarnings("all")
|
||||||
@TestMetadata("compiler/testData/codegen/boxWithJava")
|
@TestMetadata("compiler/testData/codegen/boxWithJava")
|
||||||
@InnerTestClasses({BlackBoxWithJavaCodegenTestGenerated.Enum.class, BlackBoxWithJavaCodegenTestGenerated.Functions.class, BlackBoxWithJavaCodegenTestGenerated.StaticFun.class, BlackBoxWithJavaCodegenTestGenerated.Visibility.class})
|
@InnerTestClasses({BlackBoxWithJavaCodegenTestGenerated.Enum.class, BlackBoxWithJavaCodegenTestGenerated.Functions.class, BlackBoxWithJavaCodegenTestGenerated.Property.class, BlackBoxWithJavaCodegenTestGenerated.StaticFun.class, BlackBoxWithJavaCodegenTestGenerated.Visibility.class})
|
||||||
public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||||
public void testAllFilesPresentInBoxWithJava() throws Exception {
|
public void testAllFilesPresentInBoxWithJava() throws Exception {
|
||||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/codegen/boxWithJava"), Pattern.compile("^(.+)\\.kt$"), true);
|
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/codegen/boxWithJava"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||||
@@ -98,6 +98,19 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("compiler/testData/codegen/boxWithJava/property")
|
||||||
|
public static class Property extends AbstractBlackBoxCodegenTest {
|
||||||
|
public void testAllFilesPresentInProperty() throws Exception {
|
||||||
|
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/codegen/boxWithJava/property"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("FieldAccess.kt")
|
||||||
|
public void testFieldAccess() throws Exception {
|
||||||
|
doTestWithJava("compiler/testData/codegen/boxWithJava/property/FieldAccess.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/boxWithJava/staticFun")
|
@TestMetadata("compiler/testData/codegen/boxWithJava/staticFun")
|
||||||
public static class StaticFun extends AbstractBlackBoxCodegenTest {
|
public static class StaticFun extends AbstractBlackBoxCodegenTest {
|
||||||
public void testAllFilesPresentInStaticFun() throws Exception {
|
public void testAllFilesPresentInStaticFun() throws Exception {
|
||||||
@@ -257,6 +270,7 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege
|
|||||||
suite.addTestSuite(BlackBoxWithJavaCodegenTestGenerated.class);
|
suite.addTestSuite(BlackBoxWithJavaCodegenTestGenerated.class);
|
||||||
suite.addTestSuite(Enum.class);
|
suite.addTestSuite(Enum.class);
|
||||||
suite.addTestSuite(Functions.class);
|
suite.addTestSuite(Functions.class);
|
||||||
|
suite.addTestSuite(Property.class);
|
||||||
suite.addTestSuite(StaticFun.class);
|
suite.addTestSuite(StaticFun.class);
|
||||||
suite.addTest(Visibility.innerSuite());
|
suite.addTest(Visibility.innerSuite());
|
||||||
return suite;
|
return suite;
|
||||||
|
|||||||
Reference in New Issue
Block a user