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 4968482
Showing 1 changed file with 6 additions and 0 deletions.
Expand Up @@ -46,6 +46,12 @@ public void match(final String exceptionType,
}
cursor = start;
final JumpInsnNode jumpInsnNode = (JumpInsnNode) cursor;
if (cursor.getNext().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.
cursor = cursor.getNext();
}
nextIsType(Opcodes.NEW, exceptionType);
nextIs(Opcodes.DUP);
nextIs(Opcodes.LDC);
Expand Down

0 comments on commit 4968482

Please sign in to comment.