Fix for KT-9939: java.lang.VerifyError: Bad type on operand stack for Boolean convenience accessor
#KT-9939 Fixed
This commit is contained in:
@@ -1127,13 +1127,14 @@ public abstract class StackValue {
|
||||
|
||||
@Override
|
||||
public void storeSelector(@NotNull Type topOfStackType, @NotNull InstructionAdapter v) {
|
||||
coerceFrom(topOfStackType, v);
|
||||
if (setter == null) {
|
||||
coerceFrom(topOfStackType, v);
|
||||
assert fieldName != null : "Property should have either a setter or a field name: " + descriptor;
|
||||
assert backingFieldOwner != null : "Property should have either a setter or a backingFieldOwner: " + descriptor;
|
||||
v.visitFieldInsn(isStaticStore ? PUTSTATIC : PUTFIELD, backingFieldOwner.getInternalName(), fieldName, this.type.getDescriptor());
|
||||
}
|
||||
else {
|
||||
coerce(topOfStackType, ArraysKt.last(setter.getParameterTypes()), v);
|
||||
setter.genInvokeInstruction(v);
|
||||
}
|
||||
}
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
public class JavaClass {
|
||||
|
||||
private Boolean value;
|
||||
|
||||
public Boolean isValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(boolean value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
fun box(): String {
|
||||
val javaClass = JavaClass()
|
||||
|
||||
if (javaClass.isValue != null) return "fail 1"
|
||||
|
||||
javaClass.isValue = false
|
||||
if (javaClass.isValue != false) return "fail 2"
|
||||
|
||||
javaClass.isValue = true
|
||||
if (javaClass.isValue != true) return "fail 3"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
public class JavaClass {
|
||||
|
||||
private boolean value;
|
||||
|
||||
public boolean isValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(Boolean value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fun box(): String {
|
||||
val javaClass = JavaClass()
|
||||
|
||||
if (javaClass.isValue != false) return "fail 1"
|
||||
|
||||
javaClass.isValue = true
|
||||
|
||||
if (javaClass.isValue != true) return "fail 2"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+22
@@ -351,6 +351,28 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxWithJava/javaProperty")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class JavaProperty extends AbstractBlackBoxCodegenTest {
|
||||
public void testAllFilesPresentInJavaProperty() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/javaProperty"), Pattern.compile("^([^\\.]+)$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("boxedGetter")
|
||||
public void testBoxedGetter() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/javaProperty/boxedGetter/");
|
||||
doTestWithJava(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("boxedSetter")
|
||||
public void testBoxedSetter() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/javaProperty/boxedSetter/");
|
||||
doTestWithJava(fileName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxWithJava/jvmField")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user