boolean (PsiElement element, PsiVariable indexVariable, PsiVariable listVariable) { if (!(element instanceof PsiExpression expression)) { return false; } if (!expressionIsListGetLookup(expression)) { return false; } final PsiMethodCallExpression methodCallExpression = (PsiMethodCallExpression)PsiUtil.skipParenthesizedExprDown(expression); if (methodCallExpression == null) { return false; } final PsiReferenceExpression methodExpression = methodCallExpression.getMethodExpression(); final PsiExpression qualifierExpression = PsiUtil.skipParenthesizedExprDown(methodExpression.getQualifierExpression()); final PsiExpressionList argumentList = methodCallExpression.getArgumentList(); final PsiExpression[] expressions = argumentList.getExpressions(); if (expressions.length != 1) { return false; } if (!ExpressionUtils.isReferenceTo(expressions[0], indexVariable)) { return false; } if (qualifierExpression == null || qualifierExpression instanceof PsiThisExpression || qualifierExpression instanceof PsiSuperExpression) { return listVariable == null; } if (!(qualifierExpression instanceof PsiReferenceExpression referenceExpression)) { return false; } final PsiExpression qualifier = PsiUtil.skipParenthesizedExprDown(referenceExpression.getQualifierExpression()); if (qualifier != null && !(qualifier instanceof PsiThisExpression) && !(qualifier instanceof PsiSuperExpression)) { return false; } final PsiElement target = referenceExpression.resolve(); return listVariable.equals(target); }