@Nullable
  static TypeConversionDescriptor getToArrayDescriptor(PsiType initialType, PsiExpression expression) {
    if (!(initialType instanceof PsiClassType)) {
      return null;
    }
    final PsiType[] parameters = ((PsiClassType)initialType).getParameters();
    if (parameters.length != 1) {
      return null;
    }
    final PsiElement methodCall = expression.getParent();
    if (!(methodCall instanceof PsiMethodCallExpression)) {
      return null;
    }

    final PsiExpression[] expressions = ((PsiMethodCallExpression)methodCall).getArgumentList().getExpressions();
    if (expressions.length != 1) {
      return null;
    }
    final PsiExpression classTypeExpression = expressions[0];
    final PsiType targetType = classTypeExpression.getType();
    if (!(targetType instanceof PsiClassType)) {
      return null;
    }
    final PsiType[] targetParameters = ((PsiClassType)targetType).getParameters();
    if (targetParameters.length != 1) {
      return null;
    }
    if (PsiTypesUtil.compareTypes(parameters[0], targetParameters[0], false)) {
      return new TypeConversionDescriptor("$q$.toArray($type$)", null) {
        final PsiType myType = parameters[0];

        @Override
        public PsiExpression replace(PsiExpression expression, @NotNull TypeEvaluator evaluator) throws IncorrectOperationException {
          if (!JavaGenericsUtil.isReifiableType(myType)) {
            final String chosenName = chooseName(expression, PsiTypes.intType());
            final PsiType arrayType;
            if (myType instanceof PsiClassType) {
              final PsiClass resolvedClass = ((PsiClassType)myType).resolve();
              if (resolvedClass == null) return expression;
              if (resolvedClass instanceof PsiTypeParameter) {
                arrayType = PsiType.getJavaLangObject(expression.getManager(), expression.getResolveScope());
              } else {
                arrayType = JavaPsiFacade.getElementFactory(expression.getProject()).createType(resolvedClass);
              }
            }  else {
              return null;
            }
            setReplaceByString("$q$.toArray(" + chosenName + " -> " + "(" + myType.getCanonicalText(false) + "[]) new " +
                               arrayType.getCanonicalText(false) + "[" + chosenName + "])");
          } else {
            setReplaceByString("$q$.toArray(" + myType.getCanonicalText(false) + "[]::new)");
          }
          return super.replace(expression, evaluator);
        }
      };
    }
    return null;
  }
@Nullable
  static TypeConversionDescriptor getToArrayDescriptor(PsiType initialType, PsiExpression expression)