Skip to content

Commit

Permalink
Update the KotlinUnsafeCastOperatorFilter for Kotlin 1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
poseidon-mysugr committed Nov 18, 2021
1 parent 70d5b98 commit 21db2f1
Showing 1 changed file with 7 additions and 0 deletions.
Expand Up @@ -46,6 +46,13 @@ public void match(final String exceptionType,
}
cursor = start;
final JumpInsnNode jumpInsnNode = (JumpInsnNode) cursor;
AbstractInsnNode optionalPop = cursor.getNext();
if (optionalPop != null && optionalPop.getOpcode() == Opcodes.POP) {
// Kotlin 1.6.0 DUPs the variable that's being casted and POPs it here, previous versions instead load
// the variable twice, once before IFNONNULL, and once before CHECKCAST. To be compatible with both, we
// can just skip the POP.
next();
}
nextIsType(Opcodes.NEW, exceptionType);
nextIs(Opcodes.DUP);
nextIs(Opcodes.LDC);
Expand Down

0 comments on commit 21db2f1

Please sign in to comment.