use of jadx.core.dex.trycatch.TryCatchBlockAttr in project jadx by skylot.
the class BlockExceptionHandler method connectSplittersAndHandlers.
private static void connectSplittersAndHandlers(TryCatchBlockAttr tryCatchBlock, BlockNode topSplitterBlock, @Nullable BlockNode bottomSplitterBlock) {
for (ExceptionHandler handler : tryCatchBlock.getHandlers()) {
BlockNode handlerBlock = handler.getHandlerBlock();
BlockSplitter.connect(topSplitterBlock, handlerBlock);
if (bottomSplitterBlock != null) {
BlockSplitter.connect(bottomSplitterBlock, handlerBlock);
}
}
TryCatchBlockAttr outerTryBlock = tryCatchBlock.getOuterTryBlock();
if (outerTryBlock != null) {
connectSplittersAndHandlers(outerTryBlock, topSplitterBlock, bottomSplitterBlock);
}
}
use of jadx.core.dex.trycatch.TryCatchBlockAttr in project jadx by skylot.
the class BlockExceptionHandler method sortHandlers.
private static void sortHandlers(MethodNode mth, List<TryCatchBlockAttr> tryBlocks) {
TypeCompare typeCompare = mth.root().getTypeCompare();
Comparator<ArgType> comparator = typeCompare.getReversedComparator();
for (TryCatchBlockAttr tryBlock : tryBlocks) {
for (ExceptionHandler handler : tryBlock.getHandlers()) {
handler.getCatchTypes().sort((first, second) -> compareByTypeAndName(comparator, first, second));
}
tryBlock.getHandlers().sort((first, second) -> {
if (first.equals(second)) {
throw new JadxRuntimeException("Same handlers in try block: " + tryBlock);
}
if (first.isCatchAll()) {
return 1;
}
if (second.isCatchAll()) {
return -1;
}
return compareByTypeAndName(comparator, ListUtils.first(first.getCatchTypes()), ListUtils.first(second.getCatchTypes()));
});
}
}
Aggregations