boolean (PsiInstanceOfExpression psiInstanceOfExpression) { List<PsiPatternVariable> variables = JavaPsiPatternUtil.getExposedPatternVariables(psiInstanceOfExpression); PsiElement upperLevel = getUpperLevelOfCondition(psiInstanceOfExpression); for (PsiPatternVariable variable : variables) { if (VariableAccessUtils.variableIsAssigned(variable, upperLevel)) { return true; } } PsiConditionalLoopStatement conditionalLoopStatement = PsiTreeUtil.getParentOfType(psiInstanceOfExpression, PsiConditionalLoopStatement.class); if (conditionalLoopStatement instanceof PsiForStatement forStatement) { PsiStatement update = forStatement.getUpdate(); for (PsiPatternVariable variable : variables) { if (VariableAccessUtils.variableIsAssigned(variable, update)) { return true; } } } return false; }