boolean (@NotNull PsiExpression cond1, @NotNull PsiExpression cond2) { Project project = cond1.getProject(); PsiPolyadicExpression expr = (PsiPolyadicExpression)JavaPsiFacade.getElementFactory(project).createExpressionFromText("a && b", cond1); PsiExpression[] operands = expr.getOperands(); operands[0].replace(cond1); operands[1].replace(cond2); DfaValueFactory factory = new DfaValueFactory(project); ControlFlow flow = ControlFlowAnalyzer.buildFlow(expr, factory, true); if (flow == null) return false; var listener = new JavaDfaListener() { final Set<DfType> results = new HashSet<>(); @Override public void beforeExpressionPush(@NotNull DfaValue value, @NotNull PsiExpression expression, @NotNull DfaMemoryState state) { if (expression == expr) { results.add(value.getDfType()); } } }; StandardDataFlowInterpreter interpreter = new StandardDataFlowInterpreter(flow, listener); if (interpreter.interpret(new DfaMemoryStateImpl(factory)) != RunnerResult.OK) return false; return DfTypes.FALSE.equals(ContainerUtil.getOnlyItem(listener.results)); }