DfaInstructionState[] (@NotNull DataFlowInterpreter interpreter, @NotNull DfaMemoryState stateBefore) { final DfaValueFactory factory = interpreter.getFactory(); PsiType fromType = getCasted().getType(); TypeConstraint constraint = TypeConstraints.instanceOf(myCastTo); boolean castPossible = true; List<DfaInstructionState> result = new ArrayList<>(); if (myTransferValue != null) { DfaMemoryState castFail = stateBefore.createCopy(); if (fromType != null && myCastTo.isConvertibleFrom(fromType)) { if (!castTopOfStack(factory, stateBefore, constraint)) { castPossible = false; } else { result.add(nextState(interpreter, stateBefore)); pushResult(interpreter, stateBefore, stateBefore.pop()); } } DfaValue value = castFail.peek(); DfaCondition notNullCondition = value.cond(RelationType.NE, NULL); DfaCondition notTypeCondition = value.cond(RelationType.IS_NOT, typedObject(myCastTo, Nullability.NOT_NULL)); if (castFail.applyCondition(notNullCondition) && castFail.applyCondition(notTypeCondition)) { List<DfaInstructionState> states = myTransferValue.dispatch(castFail, interpreter); for (DfaInstructionState cceState : states) { cceState.getMemoryState().markEphemeral(); } result.addAll(states); } } else { if (fromType != null && myCastTo.isConvertibleFrom(fromType)) { if (!castTopOfStack(factory, stateBefore, constraint)) { castPossible = false; } } result.add(nextState(interpreter, stateBefore)); pushResult(interpreter, stateBefore, stateBefore.pop()); } UnsatisfiedConditionProblem problem = getConditionProblem(); if (problem != null) { interpreter.getListener().onCondition(problem, stateBefore.peek(), castPossible ? ThreeState.UNSURE : ThreeState.YES, stateBefore); } return result.toArray(DfaInstructionState.EMPTY_ARRAY); }