in core/src/main/java/com/spotify/missinglink/ClassLoader.java [206:224]
private static List<TryCatchBlockNode> getTryCatchBlocksProtecting(
final List<AbstractInsnNode> instructions,
final AbstractInsnNode insn,
final MethodNode method) {
final List<TryCatchBlockNode> protectedByTryCatches = new ArrayList<>();
final int instructionIndex = instructions.indexOf(insn);
for (final TryCatchBlockNode tryCatchBlockNode : method.tryCatchBlocks) {
if (tryCatchBlockNode.type == null) {
continue;
}
final int catchStartIndex = instructions.indexOf(tryCatchBlockNode.start);
final int catchEndIndex = instructions.indexOf(tryCatchBlockNode.end);
if (instructionIndex > catchStartIndex && instructionIndex < catchEndIndex) {
protectedByTryCatches.add(tryCatchBlockNode);
}
}
return protectedByTryCatches;
}