[java-decompiler] IDEA-346312 adapt patches

- fix switch in more working way

GitOrigin-RevId: 485da13352e66780cf9a83dab105d3ecddbb6c60
This commit is contained in:
Mikhail Pyltsin
2024-09-13 19:34:21 +02:00
committed by intellij-monorepo-bot
parent f0c639a4a2
commit 7e62370666
2 changed files with 3 additions and 5 deletions

View File

@@ -89,7 +89,7 @@ public final class InitializerProcessor {
for (MethodWrapper method : wrapper.getMethods()) {
if (CodeConstants.INIT_NAME.equals(method.methodStruct.getName()) && method.root != null) {
Statement firstData = Statements.findFirstData(method.root);
if (firstData == null || firstData.getExprents().isEmpty()) {
if (firstData == null || firstData.getExprents() == null || firstData.getExprents().isEmpty()) {
return;
}

View File

@@ -18,7 +18,6 @@ public final class EliminateLoopsHelper {
if(ret) {
SequenceHelper.condenseSequences(root);
StackVarsProcessor.simplifyStackVars(root, mt, cl);
Set<Integer> setReorderedIfs = new HashSet<>();
@@ -82,10 +81,9 @@ public final class EliminateLoopsHelper {
for (Statement statement : switchStatement.getCaseStatements()) {
allEdges.addAll(statement.getAllSuccessorEdges());
}
Statement finalParentloop = parentloop;
//not a good workaround, but there is not another key, because edges are broken at this moment
if (allEdges.stream()
.anyMatch(edge -> edge.getType() == StatEdge.EdgeType.BREAK &&
edge.closure == finalParentloop)) {
.anyMatch(edge -> edge.closure.type == Statement.StatementType.DO)) {
return false;
}
}