/*
 *  Licensed to the Apache Software Foundation (ASF) under one or more
 *  contributor license agreements.  See the NOTICE file distributed with
 *  this work for additional information regarding copyright ownership.
 *  The ASF licenses this file to You under the Apache License, Version 2.0
 *  (the "License"); you may not use this file except in compliance with
 *  the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

package java.lang;

import java.io.Serializable;
import javaemul.internal.annotations.KtName;
import javaemul.internal.annotations.KtNative;
import jsinterop.annotations.JsNonNull;

@KtNative("kotlin.text.StringBuilder")
public final class StringBuilder implements Appendable, CharSequence, Serializable {
  public StringBuilder() {}

  public StringBuilder(int capacity) {}

  public StringBuilder(@JsNonNull CharSequence seq) {}

  public StringBuilder(@JsNonNull String str) {}

  public native StringBuilder append(boolean b);

  public native StringBuilder append(char c);

  public native StringBuilder append(int i);

  public native StringBuilder append(long l);

  public native StringBuilder append(float f);

  public native StringBuilder append(double d);

  public native StringBuilder append(Object obj);

  public native StringBuilder append(String str);

  // TODO(b/224969395): Add once StringBuffer is available
  // public native StringBuilder append(StringBuffer sb);

  public native StringBuilder append(char[] chars);

  public native StringBuilder append(char[] str, int offset, int len);

  public native StringBuilder append(CharSequence csq);

  public native StringBuilder append(CharSequence csq, int start, int end);

  public native StringBuilder appendCodePoint(int codePoint);

  public native char charAt(int index);

  public native StringBuilder delete(int start, int end);

  public native StringBuilder deleteCharAt(int index);

  public native StringBuilder insert(int offset, boolean b);

  public native StringBuilder insert(int offset, char c);

  public native StringBuilder insert(int offset, int i);

  public native StringBuilder insert(int offset, long l);

  public native StringBuilder insert(int offset, float f);

  public native StringBuilder insert(int offset, double d);

  public native StringBuilder insert(int offset, Object obj);

  public native StringBuilder insert(int offset, String str);

  public native StringBuilder insert(int offset, char @JsNonNull [] ch);

  public native StringBuilder insert(int offset, char @JsNonNull [] str, int strOffset, int strLen);

  public native StringBuilder insert(int offset, CharSequence s);

  public native StringBuilder insert(int offset, CharSequence s, int start, int end);

  public native int length();

  @KtName("setRange")
  public native StringBuilder replace(int start, int end, @JsNonNull String string);

  public native StringBuilder reverse();

  public native CharSequence subSequence(int start, int end);

  @Override
  public native String toString();
}

@@ -2114,24 +2114,57 @@
 odePoint);%0A%0A
+  public native int capacity();%0A%0A
   public nat
@@ -2299,32 +2299,91 @@
 At(int index);%0A%0A
+  public native void ensureCapacity(int minimumCapacity);%0A%0A
   public native 
@@ -3205,209 +3205,634 @@
 int 
-length();%0A%0A  @KtName(%22setRange%22)%0A  public native StringBuilder replace(int start, int end, @JsNonNull String string);%0A%0A  public native StringBuilder reverse();%0A%0A  public native CharSequence subSequence
+indexOf(String str);%0A%0A  public native int indexOf(String str, int fromIndex);%0A%0A  public native int lastIndexOf(String str);%0A%0A  public native int lastIndexOf(String str, int fromIndex);%0A%0A  public native int length();%0A%0A  @KtName(%22setRange%22)%0A  public native StringBuilder replace(int start, int end, @JsNonNull String string);%0A%0A  public native StringBuilder reverse();%0A%0A  @KtName(%22set%22)%0A  public native void setCharAt(int index, char ch);%0A%0A  public native void setLength(int newLength);%0A%0A  public native CharSequence subSequence(int start, int end);%0A%0A  public native String substring(int start);%0A%0A  public native String substring
 (int
@@ -3896,11 +3896,47 @@
 tring();
+%0A%0A  public native void trimToSize();
 %0A%7D%0A

Add a number of 1:1 mappable `StringBuilder` methods