Skip to content

Commit 2133f72

Browse files
committed
Try catch bug is magically fixed
1 parent d21ba2d commit 2133f72

File tree

1 file changed

+6
-17
lines changed
  • src/org/jetbrains/java/decompiler/modules/decompiler/decompose

1 file changed

+6
-17
lines changed

src/org/jetbrains/java/decompiler/modules/decompiler/decompose/DomHelper2.java

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -704,20 +704,11 @@ private static void addEdges(
704704
}
705705
}
706706
} else if (block instanceof DomTryCatchBlock tryCatchBlock) {
707-
SequenceStatement stat = (SequenceStatement) blockToStatement.get(block);
708-
CatchStatement tryCatch = (CatchStatement) stat.getStats().get(0);
709-
Statement body = tryCatch.getFirst();
710-
BasicBlockStatement postStat = (BasicBlockStatement) stat.getStats().get(1);
711-
body.addSuccessor(new StatEdge(StatEdge.TYPE_BREAK, body, postStat, tryCatch));
712-
body.addSuccessor(new StatEdge(StatEdge.TYPE_REGULAR, tryCatch, postStat));
713-
for (var edge : body.getAllSuccessorEdges()) {
714-
if (edge.getType() == StatEdge.TYPE_BREAK) {
715-
edge.changeSource(postStat);
716-
}
717-
}
718-
for (var edge : stat.getLabelEdges()) {
707+
CatchStatement tryCatch = (CatchStatement) blockToStatement.get(block);
708+
709+
for (var edge : tryCatch.getLabelEdges()) {
719710
if (edge.getType() == StatEdge.TYPE_BREAK) {
720-
stat.addSuccessor(new StatEdge(StatEdge.TYPE_REGULAR, stat, edge.getDestination()));
711+
tryCatch.addSuccessor(new StatEdge(StatEdge.TYPE_REGULAR, tryCatch, edge.getDestination()));
721712
break; // only add regular out edge
722713
}
723714
}
@@ -757,10 +748,8 @@ private static Statement convertToStatement(
757748
handlers.put(entry.getValue().exceptionTypes, handler);
758749
}
759750
CatchStatement tryCatch = new CatchStatement(head, handlers);
760-
Statement postStat = BasicBlockStatement.create();
761-
SequenceStatement stat = new SequenceStatement(new ArrayList<>(Arrays.asList(tryCatch, postStat)));
762-
blockToStatement.put(block, stat);
763-
return stat;
751+
blockToStatement.put(block, tryCatch);
752+
return tryCatch;
764753
} else if (block instanceof DomCatchBlock) {
765754
Statement stat = BasicBlockStatement.create();
766755
blockToStatement.put(block, stat);

0 commit comments

Comments
 (0)