@NlsSafe
  private static CharSequence generateMethodText(@Nullable String modifier,
                                                 @NotNull String name,
                                                 @Nullable String type,
                                                 String @NotNull [] paramTypes,
                                                 String @NotNull [] paramNames,
                                                 @Nullable String body,
                                                 boolean isConstructor) {
    @NlsSafe StringBuilder builder = new StringBuilder();

    if (modifier != null) {
      builder.append(modifier);
      builder.append(" ");
    }

    if (!isConstructor) {
      builder.append("def ");
    }

    //This is for constructor creation
    if (type != null) {
      builder.append(type);
      builder.append(" ");
    }

    builder.append(name);
    builder.append("(");

    for (int i = 0; i < paramNames.length; i++) {
      String paramType = paramTypes == null ? null : paramTypes[i];

      if (i > 0) builder.append(", ");

      if (paramType != null) {
        builder.append(paramType);
        builder.append(" ");
      }
      builder.append(paramNames[i]);
    }

    builder.append(")");
    if (body != null) {
      builder.append(body);
    }
    else {
      builder.append("{");
      builder.append("}");
    }

    return builder;
  }
@NlsSafe
  private static CharSequence generateMethodText(@Nullable String modifier,
                                                 @NotNull String name,
                                                 @Nullable String type,
                                                 String @NotNull [] paramTypes,
                                                 String @NotNull [] paramNames,
                                                 @Nullable String body,
                                                 boolean isConstructor)