boolean (PsiExpression expression) { if (!(expression instanceof PsiMethodCallExpression methodCallExpression)) { return false; } final PsiExpressionList argumentList = methodCallExpression.getArgumentList(); if (argumentList.getExpressionCount() != 1) { return false; } final PsiReferenceExpression methodExpression = methodCallExpression.getMethodExpression(); if (!"toArray".equals(methodExpression.getReferenceName())) { return false; } final PsiMethod method = methodCallExpression.resolveMethod(); if (method == null) { return false; } final PsiClass containingClass = method.getContainingClass(); return InheritanceUtil.isInheritor(containingClass, CommonClassNames.JAVA_UTIL_COLLECTION); }