Partial fix for KT-14989: Missed null check for platform type

This commit is contained in:
Mikhael Bogdanov
2016-11-25 14:33:42 +01:00
parent 88f0c32b2c
commit f9b40585cd
3 changed files with 36 additions and 2 deletions
@@ -660,13 +660,15 @@ public class AsmUtil {
@Override
public void putSelector(@NotNull Type type, @NotNull InstructionAdapter v) {
stackValue.put(type, v);
if (type.getSort() == Type.OBJECT || type.getSort() == Type.ARRAY) {
Type innerType = stackValue.type;
stackValue.put(innerType, v);
if (innerType.getSort() == Type.OBJECT || innerType.getSort() == Type.ARRAY) {
v.dup();
v.visitLdcInsn(runtimeAssertionInfo.getMessage());
v.invokestatic("kotlin/jvm/internal/Intrinsics", "checkExpressionValueIsNotNull",
"(Ljava/lang/Object;Ljava/lang/String;)V", false);
}
StackValue.coerce(innerType, type, v);
}
};
}
@@ -0,0 +1,26 @@
//WITH_RUNTIME
// FILE: JavaClass.java
public class JavaClass {
public Double test() {
return null;
}
}
// FILE: b.kt
fun test(s: Double) {
}
fun box(): String {
try {
test(JavaClass().test())
}
catch (e: IllegalStateException) {
return "OK"
}
return "fail"
}
@@ -368,6 +368,12 @@ public class BlackBoxAgainstJavaCodegenTestGenerated extends AbstractBlackBoxAga
doTest(fileName);
}
@TestMetadata("kt14989.kt")
public void testKt14989() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/platformTypes/kt14989.kt");
doTest(fileName);
}
@TestMetadata("specializedMapFull.kt")
public void testSpecializedMapFull() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/platformTypes/specializedMapFull.kt");