@Override
  public @NotNull PsiDeclarationStatement createVariableDeclarationStatement(@NotNull String name,
                                                                             @NotNull PsiType type,
                                                                             @Nullable PsiExpression initializer,
                                                                             @Nullable PsiElement context) throws IncorrectOperationException {
    if (!isIdentifier(name)) {
      throw new IncorrectOperationException("\"" + name + "\" is not an identifier.");
    }
    if (PsiTypes.nullType().equals(type)) {
      throw new IncorrectOperationException("Cannot create variable with type \"null\".");
    }

    String text = "X " + name + (initializer != null ? " = x" : "") + ";";
    PsiDeclarationStatement statement = (PsiDeclarationStatement)createStatementFromText(text, context);

    PsiVariable variable = (PsiVariable)statement.getDeclaredElements()[0];
    replace(variable.getTypeElement(), createTypeElement(GenericsUtil.getVariableTypeByExpressionType(type)), text);

    boolean generateFinalLocals =
      context != null && JavaFileCodeStyleFacade.forContext(context.getContainingFile()).isGenerateFinalLocals();
    PsiUtil.setModifierProperty(variable, PsiModifier.FINAL, generateFinalLocals);

    if (initializer != null) {
      replace(variable.getInitializer(), initializer, text);
    }

    GeneratedMarkerVisitor.markGenerated(statement);
    return statement;
  }
@Override
  public @NotNull PsiDeclarationStatement createVariableDeclarationStatement(@NotNull String name,
                                                                             @NotNull PsiType type,
                                                                             @Nullable PsiExpression initializer,
                                                                             @Nullable PsiElement context)