boolean (PsiExpression expression) { PsiExpression parent = ObjectUtils.tryCast(PsiUtil.skipParenthesizedExprUp(expression.getParent()), PsiExpression.class); if (parent == null) return false; if (parent instanceof PsiPolyadicExpression || parent instanceof PsiUnaryExpression || parent instanceof PsiInstanceOfExpression || parent instanceof PsiConditionalExpression) { return goesToSameArray(parent); } if (parent instanceof PsiAssignmentExpression) { PsiExpression left = PsiUtil.skipParenthesizedExprDown(((PsiAssignmentExpression)parent).getLExpression()); if (left instanceof PsiArrayAccessExpression && !PsiTreeUtil.isAncestor(left, expression, false)) { PsiExpression arrayExpression = ((PsiArrayAccessExpression)left).getArrayExpression(); return ExpressionUtils.isReferenceTo(arrayExpression, myVariable); } } return false; }