package org.jetbrains.jsonProtocol;

import com.google.gson.stream.JsonWriter;
import org.jetbrains.annotations.NotNull;

import java.io.IOException;
import java.lang.reflect.Method;
import java.util.Collection;

public final class JsonWriters {
  public static final Method JSON_WRITE_DEFERRED_NAME;

  static {
    try {
      JSON_WRITE_DEFERRED_NAME = JsonWriter.class.getDeclaredMethod("writeDeferredName");
      JSON_WRITE_DEFERRED_NAME.setAccessible(true);
    }
    catch (NoSuchMethodException e) {
      throw new RuntimeException(e);
    }
  }

  private JsonWriters() {
  }

  public static void writeStringList(@NotNull JsonWriter writer, @NotNull String name, @NotNull Collection<String> value) throws IOException {
    writer.name(name).beginArray();
    for (String item : value) {
      writer.value(item);
    }
    writer.endArray();
  }
}
@@ -27,17 +27,16 @@
 Protocol
-;
 %0A%0Aimport
@@ -73,205 +73,68 @@
 iter
-;%0Aimport org.jetbrains.annotations.NotNull;%0A%0Aimport java.io.IOException;%0Aimport java.lang.reflect.Method;%0Aimport java.util.Collection;%0A%0Apublic final class JsonWriters %7B%0A  public static final Method
+%0Aimport java.lang.reflect.Method%0A%0Aobject JsonWriters %7B%0A  val
  JSO
@@ -158,29 +158,24 @@
 NAME
-;%0A%0A  static %7B%0A    try
+: Method%0A%0A  init
  %7B%0A 
@@ -220,15 +220,21 @@
 iter
-.
+::
 class.
+java.
 getD
@@ -267,17 +267,16 @@
 edName%22)
-;
 %0A      J
@@ -303,11 +303,10 @@
 AME.
+i
 s
-et
 Acce
@@ -315,159 +315,26 @@
 ible
-(true);%0A    %7D%0A    catch (NoSuchMethodException e) %7B%0A      throw new RuntimeException(e);%0A    %7D%0A  %7D%0A%0A  private JsonWriters() %7B%0A  %7D%0A%0A  public static void
+ = true%0A  %7D%0A%0A  fun
  wri
@@ -346,24 +346,23 @@
 ingList(
-@NotNull
+writer:
  JsonWri
@@ -368,92 +368,50 @@
 iter
- writer, @NotNull String name, @NotNull Collection%3CString%3E value) throws IOException
+, name: String, value: Collection%3CString%3E)
  %7B%0A 
@@ -443,17 +443,16 @@
 nArray()
-;
 %0A    for
@@ -457,21 +457,15 @@
 or (
-String 
 item 
-:
+in
  val
@@ -494,17 +494,16 @@
 ue(item)
-;
 %0A    %7D%0A 
@@ -526,9 +526,8 @@
 ay()
-;
 %0A  %7D

convert JsonWriters to kotlin