boolean (PsiReferenceExpression referenceExpression, PsiElement thenContext, PsiElement elseContext) { final PsiElement target = referenceExpression.resolve(); if (!(target instanceof PsiVariable variable)) { return false; } if (thenContext != null && (contextExits(thenContext) || VariableAccessUtils.variableIsAssigned(variable, thenContext))) { return false; } if (elseContext == null || VariableAccessUtils.variableIsUsed(variable, elseContext)) { return false; } return true; }