Merge pull request #497 from bintree/master

Fixed KT-5493: NPE fix
This commit is contained in:
Evgeny Gerashchenko
2014-07-17 18:46:48 +04:00
3 changed files with 14 additions and 1 deletions
@@ -56,7 +56,7 @@ public class RedundantNullCheckMethodTransformer extends MethodTransformer {
AbstractInsnNode insn = insnList.get(i);
if ((insn.getOpcode() == Opcodes.IFNULL || insn.getOpcode() == Opcodes.IFNONNULL) &&
frame.getStack(frame.getStackSize() - 1) instanceof BoxedBasicValue) {
frame != null && frame.getStack(frame.getStackSize() - 1) instanceof BoxedBasicValue) {
insnsToOptimize.add(insn);
}
@@ -0,0 +1,8 @@
fun box() : String {
try {
return "OK"
}
finally {
null?.hashCode()
}
}
@@ -119,6 +119,11 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/boxingOptimization/fold.kt");
}
@TestMetadata("kt5493.kt")
public void testKt5493() throws Exception {
doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/boxingOptimization/kt5493.kt");
}
@TestMetadata("nullCheck.kt")
public void testNullCheck() throws Exception {
doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/boxingOptimization/nullCheck.kt");