boolean (PsiElement element) { final PsiElement parent = element.getParent(); if (parent instanceof PsiVariable variable) { final PsiType variableType = variable.getType(); if (isObsoleteCollectionType(variableType)) { return true; } } else if (parent instanceof PsiReturnStatement) { final PsiType returnType = PsiTypesUtil.getMethodReturnType(parent); if (isObsoleteCollectionType(returnType)) { return true; } } else if (parent instanceof PsiAssignmentExpression assignmentExpression) { final PsiExpression lhs = assignmentExpression.getLExpression(); final PsiType lhsType = lhs.getType(); if (isObsoleteCollectionType(lhsType)) { return true; } } else if (parent instanceof PsiMethodCallExpression) { return isRequiredObsoleteCollectionElement(parent); } if (!(parent instanceof PsiExpressionList argumentList)) { return false; } final PsiElement grandParent = parent.getParent(); if (!(grandParent instanceof PsiCallExpression callExpression)) { return false; } final int index = getIndexOfArgument(argumentList, element); final PsiMethod method = callExpression.resolveMethod(); if (method == null) { return false; } final PsiParameterList parameterList = method.getParameterList(); final PsiParameter[] parameters = parameterList.getParameters(); if (index >= parameters.length) { final PsiParameter lastParameter = parameters[parameters.length - 1]; if (!lastParameter.isVarArgs()) { return false; } final PsiType type = lastParameter.getType(); if (!(type instanceof PsiEllipsisType ellipsisType)) { return false; } final PsiType componentType = ellipsisType.getComponentType(); return isObsoleteCollectionType(componentType); } final PsiParameter parameter = parameters[index]; final PsiType type = parameter.getType(); return isObsoleteCollectionType(type); }