From 48b810c24df7a52a45bf59790fc9077a4ea95b6a Mon Sep 17 00:00:00 2001 From: Tagir Valeev Date: Tue, 26 Sep 2017 16:06:58 +0700 Subject: [PATCH] DataFlowRunner: check MAX_STATES_PER_BRANCH when there are no loops --- .../intellij/codeInspection/dataFlow/DataFlowRunner.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowRunner.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowRunner.java index 56ca3f866c2b..7bb4521b2d74 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowRunner.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowRunner.java @@ -148,6 +148,10 @@ public class DataFlowRunner { int count = 0; while (!queue.isEmpty()) { List states = queue.getNextInstructionStates(joinInstructions); + if (states.size() > MAX_STATES_PER_BRANCH) { + LOG.trace("Too complex because too many different possible states"); + return RunnerResult.TOO_COMPLEX; + } for (DfaInstructionState instructionState : states) { if (count++ > stateLimit) { LOG.trace("Too complex data flow: too many instruction states processed"); @@ -171,7 +175,7 @@ public class DataFlowRunner { } if (processed.size() > MAX_STATES_PER_BRANCH) { LOG.trace("Too complex because too many different possible states"); - return RunnerResult.TOO_COMPLEX; // Too complex :( + return RunnerResult.TOO_COMPLEX; } if (loopNumber[branching.getIndex()] != 0) { processedStates.putValue(branching, instructionState.getMemoryState().createCopy());