[java-decompiler] Check cancelled inside StrongConnectivityHelper

Should improve IDEA-289496 Intellij editor freezes randomly during decompilation

GitOrigin-RevId: 0f30240c4e873044cd102b8fb0df926eeb1eaf71
This commit is contained in:
Tagir Valeev
2023-07-17 15:42:48 +02:00
committed by intellij-monorepo-bot
parent 0ab9627c63
commit 3bafdf240b

View File

@@ -1,7 +1,9 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.java.decompiler.modules.decompiler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.java.decompiler.main.CancellationManager;
import org.jetbrains.java.decompiler.main.DecompilerContext;
import org.jetbrains.java.decompiler.modules.decompiler.StatEdge.EdgeDirection;
import org.jetbrains.java.decompiler.modules.decompiler.StatEdge.EdgeType;
import org.jetbrains.java.decompiler.modules.decompiler.stats.Statement;
@@ -54,6 +56,8 @@ public class StrongConnectivityHelper {
}
private void visit(@NotNull Statement statement) {
CancellationManager cancellationManager = DecompilerContext.getCancellationManager();
cancellationManager.checkCanceled();
component.push(statement);
indices.put(statement, nextIndex);
lowIndices.put(statement, nextIndex);
@@ -92,7 +96,7 @@ public class StrongConnectivityHelper {
for (Statement statement : component) {
statements.remove(statement);
}
return statements.size() == 0;
return statements.isEmpty();
}
public @NotNull List<Statement> getExitReps() {