diff --git a/README.md b/README.md
index b20381fbb9..0c1a0bdda9 100644
--- a/README.md
+++ b/README.md
@@ -6,10 +6,10 @@
[![Download](https://api.bintray.com/packages/kotlin/kotlinx/kotlinx.serialization.runtime/images/download.svg?version=1.0.0-RC) ](https://bintray.com/kotlin/kotlinx/kotlinx.serialization.runtime/1.0.0-RC)
Kotlin serialization consists of a compiler plugin, that generates visitor code for serializable classes,
- runtime libraries with core serialization API and JSON format, and support libraries with ProtoBuf, CBOR and properties formats.
+ runtime library with core serialization API and support libraries with various serialization formats.
* Supports Kotlin classes marked as `@Serializable` and standard collections.
-* Provides JSON (as a part of the core library), [Protobuf](formats/README.md#ProtoBuf), [CBOR](formats/README.md#CBOR), [Hocon](formats/README.md#HOCON) and [Properties](formats/README.md#properties) formats.
+* Provides [JSON](formats/README.md#JSON), [Protobuf](formats/README.md#ProtoBuf), [CBOR](formats/README.md#CBOR), [Hocon](formats/README.md#HOCON) and [Properties](formats/README.md#properties) formats.
* Complete multiplatform support: JVM, JS and Native.
## Table of contents
@@ -21,10 +21,10 @@ Kotlin serialization consists of a compiler plugin, that generates visitor code
* [Gradle](#gradle)
* [Using the `plugins` block](#using-the-plugins-block)
* [Using `apply plugin` (the old way)](#using-apply-plugin-the-old-way)
- * [Dependency on the runtime library](#dependency-on-the-runtime-library)
- * [Android/JVM](#androidjvm)
- * [Multiplatform (common, JS, Native)](#multiplatform-common-js-native)
- * [Maven/JVM](#mavenjvm)
+ * [Dependency on the JSON library](#dependency-on-the-json-library)
+ * [Android](#android)
+ * [Multiplatform (Common, JS, Native)](#multiplatform-common-js-native)
+ * [Maven](#maven)
@@ -133,9 +133,9 @@ apply plugin: 'kotlin' // or 'kotlin-multiplatform' for multiplatform projects
apply plugin: 'kotlinx-serialization'
```
-#### Dependency on the runtime library
+#### Dependency on the JSON library
-After setting up the plugin one way or another, you have to add a dependency on the serialization runtime library. Note that while the plugin has version the same as the compiler one, runtime library has different coordinates, repository and versioning.
+After setting up the plugin one way or another, you have to add a dependency on the serialization library. Note that while the plugin has version the same as the compiler one, runtime library has different coordinates, repository and versioning.
Kotlin DSL:
@@ -147,7 +147,7 @@ repositories {
dependencies {
implementation(kotlin("stdlib", KotlinCompilerVersion.VERSION)) // or "stdlib-jdk8"
- implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.0.0-RC") // JVM dependency
+ implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.0-RC") // JVM dependency
}
```
@@ -160,11 +160,13 @@ repositories {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" // or "kotlin-stdlib-jdk8"
- implementation "org.jetbrains.kotlinx:kotlinx-serialization-core:1.0.0-RC" // JVM dependency
+ implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.0-RC" // JVM dependency
}
```
-### Android/JVM
+>We also provide kotlinx-serialization-core artifact that contains all serialization API but does not have bundled serialization format with it
+
+### Android
Library should work on Android "as is". If you're using proguard, you need
to add this to your `proguard-rules.pro`:
@@ -190,14 +192,14 @@ You can add dependency to the required module right to the common source set:
```gradle
commonMain {
dependencies {
- implementation "org.jetbrains.kotlinx:kotlinx-serialization-core:$serialization_version"
+ implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:$serialization_version"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-protobuf:$serialization_version"
}
}
```
The same artifact coordinates can be used to depend on platform-specific artifact in platform-specific source-set.
-### Maven/JVM
+### Maven
Ensure the proper version of Kotlin and serialization version:
@@ -250,7 +252,7 @@ Add dependency on serialization runtime library:
```xml
org.jetbrains.kotlinx
- kotlinx-serialization-core
+ kotlinx-serialization-json
${serialization.version}
```
diff --git a/runtime/api/kotlinx-serialization-core.api b/core/api/kotlinx-serialization-core.api
similarity index 75%
rename from runtime/api/kotlinx-serialization-core.api
rename to core/api/kotlinx-serialization-core.api
index aee690cb25..99eea17ab2 100644
--- a/runtime/api/kotlinx-serialization-core.api
+++ b/core/api/kotlinx-serialization-core.api
@@ -928,6 +928,10 @@ public final class kotlinx/serialization/internal/IntSerializer : kotlinx/serial
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
}
+public final class kotlinx/serialization/internal/JsonInternalDependenciesKt {
+ public static final fun jsonCachedSerialNames (Lkotlinx/serialization/descriptors/SerialDescriptor;)Ljava/util/Set;
+}
+
public abstract class kotlinx/serialization/internal/KeyValueSerializer : kotlinx/serialization/KSerializer {
public synthetic fun (Lkotlinx/serialization/KSerializer;Lkotlinx/serialization/KSerializer;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
@@ -1346,451 +1350,6 @@ public final class kotlinx/serialization/internal/UnitSerializer : kotlinx/seria
public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lkotlin/Unit;)V
}
-public abstract class kotlinx/serialization/json/Json : kotlinx/serialization/StringFormat {
- public static final field Default Lkotlinx/serialization/json/Json$Default;
- public synthetic fun (Lkotlinx/serialization/json/internal/JsonConf;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
- public final fun decodeFromJsonElement (Lkotlinx/serialization/DeserializationStrategy;Lkotlinx/serialization/json/JsonElement;)Ljava/lang/Object;
- public final fun decodeFromString (Lkotlinx/serialization/DeserializationStrategy;Ljava/lang/String;)Ljava/lang/Object;
- public final fun encodeToJsonElement (Lkotlinx/serialization/SerializationStrategy;Ljava/lang/Object;)Lkotlinx/serialization/json/JsonElement;
- public final fun encodeToString (Lkotlinx/serialization/SerializationStrategy;Ljava/lang/Object;)Ljava/lang/String;
- public fun getSerializersModule ()Lkotlinx/serialization/modules/SerializersModule;
- public final fun parseToJsonElement (Ljava/lang/String;)Lkotlinx/serialization/json/JsonElement;
-}
-
-public final class kotlinx/serialization/json/Json$Default : kotlinx/serialization/json/Json {
-}
-
-public final class kotlinx/serialization/json/JsonArray : kotlinx/serialization/json/JsonElement, java/util/List, kotlin/jvm/internal/markers/KMappedMarker {
- public static final field Companion Lkotlinx/serialization/json/JsonArray$Companion;
- public fun (Ljava/util/List;)V
- public synthetic fun add (ILjava/lang/Object;)V
- public fun add (ILkotlinx/serialization/json/JsonElement;)V
- public synthetic fun add (Ljava/lang/Object;)Z
- public fun add (Lkotlinx/serialization/json/JsonElement;)Z
- public fun addAll (ILjava/util/Collection;)Z
- public fun addAll (Ljava/util/Collection;)Z
- public fun clear ()V
- public final fun contains (Ljava/lang/Object;)Z
- public fun contains (Lkotlinx/serialization/json/JsonElement;)Z
- public fun containsAll (Ljava/util/Collection;)Z
- public fun equals (Ljava/lang/Object;)Z
- public synthetic fun get (I)Ljava/lang/Object;
- public fun get (I)Lkotlinx/serialization/json/JsonElement;
- public fun getSize ()I
- public fun hashCode ()I
- public final fun indexOf (Ljava/lang/Object;)I
- public fun indexOf (Lkotlinx/serialization/json/JsonElement;)I
- public fun isEmpty ()Z
- public fun iterator ()Ljava/util/Iterator;
- public final fun lastIndexOf (Ljava/lang/Object;)I
- public fun lastIndexOf (Lkotlinx/serialization/json/JsonElement;)I
- public fun listIterator ()Ljava/util/ListIterator;
- public fun listIterator (I)Ljava/util/ListIterator;
- public synthetic fun remove (I)Ljava/lang/Object;
- public fun remove (I)Lkotlinx/serialization/json/JsonElement;
- public fun remove (Ljava/lang/Object;)Z
- public fun removeAll (Ljava/util/Collection;)Z
- public fun replaceAll (Ljava/util/function/UnaryOperator;)V
- public fun retainAll (Ljava/util/Collection;)Z
- public synthetic fun set (ILjava/lang/Object;)Ljava/lang/Object;
- public fun set (ILkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/json/JsonElement;
- public final fun size ()I
- public fun sort (Ljava/util/Comparator;)V
- public fun subList (II)Ljava/util/List;
- public fun toArray ()[Ljava/lang/Object;
- public fun toArray ([Ljava/lang/Object;)[Ljava/lang/Object;
- public fun toString ()Ljava/lang/String;
-}
-
-public final class kotlinx/serialization/json/JsonArray$Companion {
- public final fun serializer ()Lkotlinx/serialization/KSerializer;
-}
-
-public final class kotlinx/serialization/json/JsonArrayBuilder {
- public fun ()V
- public final fun add (Lkotlinx/serialization/json/JsonElement;)Z
- public final fun build ()Lkotlinx/serialization/json/JsonArray;
- public final fun unaryPlus (Ljava/lang/Boolean;)V
- public final fun unaryPlus (Ljava/lang/Number;)V
- public final fun unaryPlus (Ljava/lang/String;)V
- public final fun unaryPlus (Lkotlinx/serialization/json/JsonElement;)V
-}
-
-public final class kotlinx/serialization/json/JsonArraySerializer : kotlinx/serialization/KSerializer {
- public static final field INSTANCE Lkotlinx/serialization/json/JsonArraySerializer;
- public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
- public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lkotlinx/serialization/json/JsonArray;
- public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
- public synthetic fun patch (Lkotlinx/serialization/encoding/Decoder;Ljava/lang/Object;)Ljava/lang/Object;
- public fun patch (Lkotlinx/serialization/encoding/Decoder;Lkotlinx/serialization/json/JsonArray;)Lkotlinx/serialization/json/JsonArray;
- public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
- public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lkotlinx/serialization/json/JsonArray;)V
-}
-
-public final class kotlinx/serialization/json/JsonBuilder {
- public final fun buildConfiguration ()Lkotlinx/serialization/json/JsonConfiguration;
- public final fun buildModule ()Lkotlinx/serialization/modules/SerializersModule;
- public final fun getAllowSpecialFloatingPointValues ()Z
- public final fun getAllowStructuredMapKeys ()Z
- public final fun getClassDiscriminator ()Ljava/lang/String;
- public final fun getCoerceInputValues ()Z
- public final fun getEncodeDefaults ()Z
- public final fun getIgnoreUnknownKeys ()Z
- public final fun getIndent ()Ljava/lang/String;
- public final fun getPrettyPrint ()Z
- public final fun getPrettyPrintIndent ()Ljava/lang/String;
- public final fun getSerialModule ()Lkotlinx/serialization/modules/SerializersModule;
- public final fun getSerializeSpecialFloatingPointValues ()Z
- public final fun getSerializersModule ()Lkotlinx/serialization/modules/SerializersModule;
- public final fun getStrictMode ()Z
- public final fun getUnquoted ()Z
- public final fun getUnquotedPrint ()Z
- public final fun getUseArrayPolymorphism ()Z
- public final fun isLenient ()Z
- public final fun setAllowSpecialFloatingPointValues (Z)V
- public final fun setAllowStructuredMapKeys (Z)V
- public final fun setClassDiscriminator (Ljava/lang/String;)V
- public final fun setCoerceInputValues (Z)V
- public final fun setEncodeDefaults (Z)V
- public final fun setIgnoreUnknownKeys (Z)V
- public final fun setIndent (Ljava/lang/String;)V
- public final fun setLenient (Z)V
- public final fun setPrettyPrint (Z)V
- public final fun setPrettyPrintIndent (Ljava/lang/String;)V
- public final fun setSerialModule (Lkotlinx/serialization/modules/SerializersModule;)V
- public final fun setSerializeSpecialFloatingPointValues (Z)V
- public final fun setSerializersModule (Lkotlinx/serialization/modules/SerializersModule;)V
- public final fun setStrictMode (Z)V
- public final fun setUnquoted (Z)V
- public final fun setUnquotedPrint (Z)V
- public final fun setUseArrayPolymorphism (Z)V
-}
-
-public class kotlinx/serialization/json/JsonConfiguration {
- public static final field Companion Lkotlinx/serialization/json/JsonConfiguration$Companion;
- public fun ()V
- public fun (ZZZZZZZLjava/lang/String;ZZLjava/lang/String;)V
- public synthetic fun (ZZZZZZZLjava/lang/String;ZZLjava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
- public final fun copy (ZZZZZZZLjava/lang/String;ZZLjava/lang/String;)Lkotlinx/serialization/json/JsonConfiguration;
- public static synthetic fun copy$default (Lkotlinx/serialization/json/JsonConfiguration;ZZZZZZZLjava/lang/String;ZZLjava/lang/String;ILjava/lang/Object;)Lkotlinx/serialization/json/JsonConfiguration;
- public static final fun getDefault ()Lkotlinx/serialization/json/SubtypeToDetectDefault;
- public static final fun getStable ()Lkotlinx/serialization/json/SubtypeToDetectStable;
-}
-
-public final class kotlinx/serialization/json/JsonConfiguration$Companion {
- public final fun getDefault ()Lkotlinx/serialization/json/SubtypeToDetectDefault;
- public final fun getStable ()Lkotlinx/serialization/json/SubtypeToDetectStable;
-}
-
-public final class kotlinx/serialization/json/JsonConfigurationKt {
- public static final fun JsonConfiguration (ZZ)V
- public static synthetic fun JsonConfiguration$default (ZZILjava/lang/Object;)V
-}
-
-public abstract class kotlinx/serialization/json/JsonContentPolymorphicSerializer : kotlinx/serialization/KSerializer {
- public fun (Lkotlin/reflect/KClass;)V
- public final fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
- public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
- public fun patch (Lkotlinx/serialization/encoding/Decoder;Ljava/lang/Object;)Ljava/lang/Object;
- protected abstract fun selectDeserializer (Lkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/DeserializationStrategy;
- protected final fun selectSerializer (Lkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/KSerializer;
- public final fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
-}
-
-public abstract interface class kotlinx/serialization/json/JsonDecoder : kotlinx/serialization/encoding/CompositeDecoder, kotlinx/serialization/encoding/Decoder {
- public abstract fun decodeJsonElement ()Lkotlinx/serialization/json/JsonElement;
- public abstract fun getJson ()Lkotlinx/serialization/json/Json;
- public abstract synthetic fun getUpdateMode ()Lkotlinx/serialization/UpdateMode;
-}
-
-public final class kotlinx/serialization/json/JsonDecoder$DefaultImpls {
- public static fun beginStructure (Lkotlinx/serialization/json/JsonDecoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)Lkotlinx/serialization/encoding/CompositeDecoder;
- public static fun beginStructure (Lkotlinx/serialization/json/JsonDecoder;Lkotlinx/serialization/descriptors/SerialDescriptor;[Lkotlinx/serialization/KSerializer;)Lkotlinx/serialization/encoding/CompositeDecoder;
- public static fun decodeCollectionSize (Lkotlinx/serialization/json/JsonDecoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)I
- public static fun decodeNullableSerializableElement (Lkotlinx/serialization/json/JsonDecoder;Lkotlinx/serialization/descriptors/SerialDescriptor;ILkotlinx/serialization/DeserializationStrategy;)Ljava/lang/Object;
- public static fun decodeNullableSerializableElement (Lkotlinx/serialization/json/JsonDecoder;Lkotlinx/serialization/descriptors/SerialDescriptor;ILkotlinx/serialization/DeserializationStrategy;Ljava/lang/Object;)Ljava/lang/Object;
- public static fun decodeNullableSerializableValue (Lkotlinx/serialization/json/JsonDecoder;Lkotlinx/serialization/DeserializationStrategy;)Ljava/lang/Object;
- public static fun decodeSequentially (Lkotlinx/serialization/json/JsonDecoder;)Z
- public static fun decodeSerializableElement (Lkotlinx/serialization/json/JsonDecoder;Lkotlinx/serialization/descriptors/SerialDescriptor;ILkotlinx/serialization/DeserializationStrategy;)Ljava/lang/Object;
- public static fun decodeSerializableElement (Lkotlinx/serialization/json/JsonDecoder;Lkotlinx/serialization/descriptors/SerialDescriptor;ILkotlinx/serialization/DeserializationStrategy;Ljava/lang/Object;)Ljava/lang/Object;
- public static fun decodeSerializableValue (Lkotlinx/serialization/json/JsonDecoder;Lkotlinx/serialization/DeserializationStrategy;)Ljava/lang/Object;
- public static synthetic fun getUpdateMode (Lkotlinx/serialization/json/JsonDecoder;)Lkotlinx/serialization/UpdateMode;
- public static fun updateNullableSerializableElement (Lkotlinx/serialization/json/JsonDecoder;Lkotlinx/serialization/descriptors/SerialDescriptor;ILkotlinx/serialization/DeserializationStrategy;Ljava/lang/Object;)Ljava/lang/Object;
- public static fun updateNullableSerializableValue (Lkotlinx/serialization/json/JsonDecoder;Lkotlinx/serialization/DeserializationStrategy;Ljava/lang/Object;)Ljava/lang/Object;
- public static fun updateSerializableElement (Lkotlinx/serialization/json/JsonDecoder;Lkotlinx/serialization/descriptors/SerialDescriptor;ILkotlinx/serialization/DeserializationStrategy;Ljava/lang/Object;)Ljava/lang/Object;
- public static fun updateSerializableValue (Lkotlinx/serialization/json/JsonDecoder;Lkotlinx/serialization/DeserializationStrategy;Ljava/lang/Object;)Ljava/lang/Object;
-}
-
-public abstract class kotlinx/serialization/json/JsonElement {
- public static final field Companion Lkotlinx/serialization/json/JsonElement$Companion;
-}
-
-public final class kotlinx/serialization/json/JsonElement$Companion {
- public final fun serializer ()Lkotlinx/serialization/KSerializer;
-}
-
-public final class kotlinx/serialization/json/JsonElementBuildersKt {
- public static final fun add (Lkotlinx/serialization/json/JsonArrayBuilder;Ljava/lang/Boolean;)Z
- public static final fun add (Lkotlinx/serialization/json/JsonArrayBuilder;Ljava/lang/Number;)Z
- public static final fun add (Lkotlinx/serialization/json/JsonArrayBuilder;Ljava/lang/String;)Z
- public static final fun addJsonArray (Lkotlinx/serialization/json/JsonArrayBuilder;Lkotlin/jvm/functions/Function1;)Z
- public static final fun addJsonObject (Lkotlinx/serialization/json/JsonArrayBuilder;Lkotlin/jvm/functions/Function1;)Z
- public static final fun buildJsonArray (Lkotlin/jvm/functions/Function1;)Lkotlinx/serialization/json/JsonArray;
- public static final fun buildJsonObject (Lkotlin/jvm/functions/Function1;)Lkotlinx/serialization/json/JsonObject;
- public static final fun put (Lkotlinx/serialization/json/JsonObjectBuilder;Ljava/lang/String;Ljava/lang/Boolean;)Lkotlinx/serialization/json/JsonElement;
- public static final fun put (Lkotlinx/serialization/json/JsonObjectBuilder;Ljava/lang/String;Ljava/lang/Number;)Lkotlinx/serialization/json/JsonElement;
- public static final fun put (Lkotlinx/serialization/json/JsonObjectBuilder;Ljava/lang/String;Ljava/lang/String;)Lkotlinx/serialization/json/JsonElement;
- public static final fun putJsonArray (Lkotlinx/serialization/json/JsonObjectBuilder;Ljava/lang/String;Lkotlin/jvm/functions/Function1;)Lkotlinx/serialization/json/JsonElement;
- public static final fun putJsonObject (Lkotlinx/serialization/json/JsonObjectBuilder;Ljava/lang/String;Lkotlin/jvm/functions/Function1;)Lkotlinx/serialization/json/JsonElement;
-}
-
-public final class kotlinx/serialization/json/JsonElementKt {
- public static final fun JsonPrimitive (Ljava/lang/Boolean;)Lkotlinx/serialization/json/JsonPrimitive;
- public static final fun JsonPrimitive (Ljava/lang/Number;)Lkotlinx/serialization/json/JsonPrimitive;
- public static final fun JsonPrimitive (Ljava/lang/String;)Lkotlinx/serialization/json/JsonPrimitive;
- public static final fun getBoolean (Lkotlinx/serialization/json/JsonPrimitive;)Z
- public static final fun getBooleanOrNull (Lkotlinx/serialization/json/JsonPrimitive;)Ljava/lang/Boolean;
- public static final fun getContentOrNull (Lkotlinx/serialization/json/JsonPrimitive;)Ljava/lang/String;
- public static final fun getDouble (Lkotlinx/serialization/json/JsonPrimitive;)D
- public static final fun getDoubleOrNull (Lkotlinx/serialization/json/JsonPrimitive;)Ljava/lang/Double;
- public static final fun getFloat (Lkotlinx/serialization/json/JsonPrimitive;)F
- public static final fun getFloatOrNull (Lkotlinx/serialization/json/JsonPrimitive;)Ljava/lang/Float;
- public static final fun getInt (Lkotlinx/serialization/json/JsonPrimitive;)I
- public static final fun getIntOrNull (Lkotlinx/serialization/json/JsonPrimitive;)Ljava/lang/Integer;
- public static final fun getJsonArray (Lkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/json/JsonArray;
- public static final fun getJsonNull (Lkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/json/JsonNull;
- public static final fun getJsonObject (Lkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/json/JsonObject;
- public static final fun getJsonPrimitive (Lkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/json/JsonPrimitive;
- public static final fun getLong (Lkotlinx/serialization/json/JsonPrimitive;)J
- public static final fun getLongOrNull (Lkotlinx/serialization/json/JsonPrimitive;)Ljava/lang/Long;
- public static final fun unexpectedJson (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Void;
-}
-
-public final class kotlinx/serialization/json/JsonElementSerializer : kotlinx/serialization/KSerializer {
- public static final field INSTANCE Lkotlinx/serialization/json/JsonElementSerializer;
- public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
- public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lkotlinx/serialization/json/JsonElement;
- public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
- public synthetic fun patch (Lkotlinx/serialization/encoding/Decoder;Ljava/lang/Object;)Ljava/lang/Object;
- public fun patch (Lkotlinx/serialization/encoding/Decoder;Lkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/json/JsonElement;
- public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
- public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lkotlinx/serialization/json/JsonElement;)V
-}
-
-public abstract interface class kotlinx/serialization/json/JsonEncoder : kotlinx/serialization/encoding/CompositeEncoder, kotlinx/serialization/encoding/Encoder {
- public abstract fun encodeJsonElement (Lkotlinx/serialization/json/JsonElement;)V
- public abstract fun getJson ()Lkotlinx/serialization/json/Json;
-}
-
-public final class kotlinx/serialization/json/JsonEncoder$DefaultImpls {
- public static fun beginCollection (Lkotlinx/serialization/json/JsonEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;I)Lkotlinx/serialization/encoding/CompositeEncoder;
- public static fun beginCollection (Lkotlinx/serialization/json/JsonEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;I[Lkotlinx/serialization/KSerializer;)Lkotlinx/serialization/encoding/CompositeEncoder;
- public static fun beginStructure (Lkotlinx/serialization/json/JsonEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)Lkotlinx/serialization/encoding/CompositeEncoder;
- public static fun beginStructure (Lkotlinx/serialization/json/JsonEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;[Lkotlinx/serialization/KSerializer;)Lkotlinx/serialization/encoding/CompositeEncoder;
- public static fun encodeNonSerializableElement (Lkotlinx/serialization/json/JsonEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;ILjava/lang/Object;)V
- public static fun encodeNotNullMark (Lkotlinx/serialization/json/JsonEncoder;)V
- public static fun encodeNullableSerializableValue (Lkotlinx/serialization/json/JsonEncoder;Lkotlinx/serialization/SerializationStrategy;Ljava/lang/Object;)V
- public static fun encodeSerializableValue (Lkotlinx/serialization/json/JsonEncoder;Lkotlinx/serialization/SerializationStrategy;Ljava/lang/Object;)V
- public static fun shouldEncodeElementDefault (Lkotlinx/serialization/json/JsonEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;I)Z
-}
-
-public abstract interface class kotlinx/serialization/json/JsonInput {
- public abstract fun decodeJson ()Lkotlinx/serialization/json/JsonElement;
-}
-
-public final class kotlinx/serialization/json/JsonKt {
- public static final fun Json ()Lkotlinx/serialization/json/Json;
- public static final fun Json (Lkotlinx/serialization/json/Json;Lkotlin/jvm/functions/Function1;)Lkotlinx/serialization/json/Json;
- public static final fun Json (Lkotlinx/serialization/json/JsonConfiguration;Lkotlinx/serialization/modules/SerializersModule;)Lkotlinx/serialization/json/Json;
- public static final fun Json (Lkotlinx/serialization/json/SubtypeToDetectDefault;)Lkotlinx/serialization/json/Json;
- public static final fun Json (Lkotlinx/serialization/json/SubtypeToDetectDefault;Lkotlinx/serialization/modules/SerializersModule;)Lkotlinx/serialization/json/Json;
- public static final fun Json (Lkotlinx/serialization/json/SubtypeToDetectStable;)Lkotlinx/serialization/json/Json;
- public static final fun Json (Lkotlinx/serialization/modules/SerializersModule;)Lkotlinx/serialization/json/Json;
- public static synthetic fun Json$default (Lkotlinx/serialization/json/Json;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lkotlinx/serialization/json/Json;
- public static synthetic fun Json$default (Lkotlinx/serialization/json/JsonConfiguration;Lkotlinx/serialization/modules/SerializersModule;ILjava/lang/Object;)Lkotlinx/serialization/json/Json;
-}
-
-public final class kotlinx/serialization/json/JsonMigrationsKt {
- public static final fun JsonLiteral (Ljava/lang/Object;)Lkotlinx/serialization/json/JsonPrimitive;
- public static final fun contains (Lkotlinx/serialization/json/JsonElement;Ljava/lang/String;)Z
- public static final fun decodeJson (Lkotlinx/serialization/json/JsonDecoder;)Lkotlinx/serialization/json/JsonElement;
- public static final fun encodeJson (Lkotlinx/serialization/json/JsonEncoder;Lkotlinx/serialization/json/JsonElement;)V
- public static final fun fromJson (Lkotlinx/serialization/json/Json;Lkotlinx/serialization/DeserializationStrategy;Lkotlinx/serialization/json/JsonElement;)Ljava/lang/Object;
- public static final fun fromJson (Lkotlinx/serialization/json/Json;Lkotlinx/serialization/json/JsonElement;)Ljava/lang/Object;
- public static final fun getArray (Lkotlinx/serialization/json/JsonArray;I)Lkotlinx/serialization/json/JsonArray;
- public static final fun getArray (Lkotlinx/serialization/json/JsonObject;Ljava/lang/String;)Lkotlinx/serialization/json/JsonArray;
- public static final fun getArrayOrNull (Lkotlinx/serialization/json/JsonArray;I)Lkotlinx/serialization/json/JsonArray;
- public static final fun getArrayOrNull (Lkotlinx/serialization/json/JsonObject;Ljava/lang/String;)Lkotlinx/serialization/json/JsonArray;
- public static final fun getAs (Lkotlinx/serialization/json/JsonArray;I)Lkotlinx/serialization/json/JsonElement;
- public static final fun getAs (Lkotlinx/serialization/json/JsonObject;Ljava/lang/String;)Lkotlinx/serialization/json/JsonElement;
- public static final fun getAsOrNull (Lkotlinx/serialization/json/JsonArray;I)Lkotlinx/serialization/json/JsonElement;
- public static final fun getAsOrNull (Lkotlinx/serialization/json/JsonObject;Ljava/lang/String;)Lkotlinx/serialization/json/JsonElement;
- public static final fun getBoolean (Lkotlinx/serialization/json/JsonElement;)Z
- public static final fun getBooleanOrNull (Lkotlinx/serialization/json/JsonElement;)Ljava/lang/Boolean;
- public static final fun getContent (Lkotlinx/serialization/json/JsonElement;)Ljava/lang/String;
- public static final fun getContentOrNull (Lkotlinx/serialization/json/JsonElement;)Ljava/lang/String;
- public static final fun getDouble (Lkotlinx/serialization/json/JsonElement;)D
- public static final fun getDoubleOrNull (Lkotlinx/serialization/json/JsonElement;)Ljava/lang/Double;
- public static final fun getFloat (Lkotlinx/serialization/json/JsonElement;)F
- public static final fun getFloatOrNull (Lkotlinx/serialization/json/JsonElement;)Ljava/lang/Float;
- public static final fun getIndented (Lkotlinx/serialization/json/Json$Default;)Lkotlinx/serialization/json/Json;
- public static final fun getInt (Lkotlinx/serialization/json/JsonElement;)I
- public static final fun getIntOrNull (Lkotlinx/serialization/json/JsonElement;)Ljava/lang/Integer;
- public static final fun getLong (Lkotlinx/serialization/json/JsonElement;)J
- public static final fun getLongOrNull (Lkotlinx/serialization/json/JsonElement;)Ljava/lang/Long;
- public static final fun getNonstrict (Lkotlinx/serialization/json/Json$Default;)Lkotlinx/serialization/json/Json;
- public static final fun getObject (Lkotlinx/serialization/json/JsonArray;I)Lkotlinx/serialization/json/JsonObject;
- public static final fun getObject (Lkotlinx/serialization/json/JsonObject;Ljava/lang/String;)Lkotlinx/serialization/json/JsonObject;
- public static final fun getObjectOrNull (Lkotlinx/serialization/json/JsonArray;I)Lkotlinx/serialization/json/JsonObject;
- public static final fun getObjectOrNull (Lkotlinx/serialization/json/JsonObject;Ljava/lang/String;)Lkotlinx/serialization/json/JsonObject;
- public static final fun getPlain (Lkotlinx/serialization/json/Json$Default;)Lkotlinx/serialization/json/Json;
- public static final fun getPrimitive (Lkotlinx/serialization/json/JsonArray;I)Lkotlinx/serialization/json/JsonPrimitive;
- public static final fun getPrimitive (Lkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/json/JsonPrimitive;
- public static final fun getPrimitive (Lkotlinx/serialization/json/JsonObject;Ljava/lang/String;)Lkotlinx/serialization/json/JsonPrimitive;
- public static final fun getPrimitiveOrNull (Lkotlinx/serialization/json/JsonArray;I)Lkotlinx/serialization/json/JsonPrimitive;
- public static final fun getPrimitiveOrNull (Lkotlinx/serialization/json/JsonObject;Ljava/lang/String;)Lkotlinx/serialization/json/JsonPrimitive;
- public static final fun getUnquoted (Lkotlinx/serialization/json/Json$Default;)Lkotlinx/serialization/json/Json;
- public static final fun isNull (Lkotlinx/serialization/json/JsonElement;)Z
- public static final fun json (Lkotlin/jvm/functions/Function1;)Lkotlinx/serialization/json/JsonObject;
- public static final fun jsonArray (Lkotlin/jvm/functions/Function1;)Lkotlinx/serialization/json/JsonArray;
- public static final fun parseJson (Lkotlinx/serialization/json/Json;Ljava/lang/String;)Lkotlinx/serialization/json/JsonElement;
- public static final fun toJson (Lkotlinx/serialization/json/Json;Ljava/lang/Object;)Lkotlinx/serialization/json/JsonElement;
- public static final fun toJson (Lkotlinx/serialization/json/Json;Lkotlinx/serialization/SerializationStrategy;Ljava/lang/Object;)Lkotlinx/serialization/json/JsonElement;
-}
-
-public final class kotlinx/serialization/json/JsonNull : kotlinx/serialization/json/JsonPrimitive {
- public static final field INSTANCE Lkotlinx/serialization/json/JsonNull;
- public fun getContent ()Ljava/lang/String;
- public fun isString ()Z
-}
-
-public final class kotlinx/serialization/json/JsonNullSerializer : kotlinx/serialization/KSerializer {
- public static final field INSTANCE Lkotlinx/serialization/json/JsonNullSerializer;
- public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
- public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lkotlinx/serialization/json/JsonNull;
- public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
- public synthetic fun patch (Lkotlinx/serialization/encoding/Decoder;Ljava/lang/Object;)Ljava/lang/Object;
- public fun patch (Lkotlinx/serialization/encoding/Decoder;Lkotlinx/serialization/json/JsonNull;)Lkotlinx/serialization/json/JsonNull;
- public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
- public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lkotlinx/serialization/json/JsonNull;)V
-}
-
-public final class kotlinx/serialization/json/JsonObject : kotlinx/serialization/json/JsonElement, java/util/Map, kotlin/jvm/internal/markers/KMappedMarker {
- public static final field Companion Lkotlinx/serialization/json/JsonObject$Companion;
- public fun (Ljava/util/Map;)V
- public fun clear ()V
- public synthetic fun compute (Ljava/lang/Object;Ljava/util/function/BiFunction;)Ljava/lang/Object;
- public fun compute (Ljava/lang/String;Ljava/util/function/BiFunction;)Lkotlinx/serialization/json/JsonElement;
- public synthetic fun computeIfAbsent (Ljava/lang/Object;Ljava/util/function/Function;)Ljava/lang/Object;
- public fun computeIfAbsent (Ljava/lang/String;Ljava/util/function/Function;)Lkotlinx/serialization/json/JsonElement;
- public synthetic fun computeIfPresent (Ljava/lang/Object;Ljava/util/function/BiFunction;)Ljava/lang/Object;
- public fun computeIfPresent (Ljava/lang/String;Ljava/util/function/BiFunction;)Lkotlinx/serialization/json/JsonElement;
- public final fun containsKey (Ljava/lang/Object;)Z
- public fun containsKey (Ljava/lang/String;)Z
- public final fun containsValue (Ljava/lang/Object;)Z
- public fun containsValue (Lkotlinx/serialization/json/JsonElement;)Z
- public final fun entrySet ()Ljava/util/Set;
- public fun equals (Ljava/lang/Object;)Z
- public final fun get (Ljava/lang/Object;)Ljava/lang/Object;
- public fun get (Ljava/lang/String;)Lkotlinx/serialization/json/JsonElement;
- public fun getEntries ()Ljava/util/Set;
- public fun getKeys ()Ljava/util/Set;
- public fun getSize ()I
- public fun getValues ()Ljava/util/Collection;
- public fun hashCode ()I
- public fun isEmpty ()Z
- public final fun keySet ()Ljava/util/Set;
- public synthetic fun merge (Ljava/lang/Object;Ljava/lang/Object;Ljava/util/function/BiFunction;)Ljava/lang/Object;
- public fun merge (Ljava/lang/String;Lkotlinx/serialization/json/JsonElement;Ljava/util/function/BiFunction;)Lkotlinx/serialization/json/JsonElement;
- public synthetic fun put (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
- public fun put (Ljava/lang/String;Lkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/json/JsonElement;
- public fun putAll (Ljava/util/Map;)V
- public synthetic fun putIfAbsent (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
- public fun putIfAbsent (Ljava/lang/String;Lkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/json/JsonElement;
- public fun remove (Ljava/lang/Object;)Ljava/lang/Object;
- public fun remove (Ljava/lang/Object;Ljava/lang/Object;)Z
- public synthetic fun replace (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
- public synthetic fun replace (Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Z
- public fun replace (Ljava/lang/String;Lkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/json/JsonElement;
- public fun replace (Ljava/lang/String;Lkotlinx/serialization/json/JsonElement;Lkotlinx/serialization/json/JsonElement;)Z
- public fun replaceAll (Ljava/util/function/BiFunction;)V
- public final fun size ()I
- public fun toString ()Ljava/lang/String;
- public final fun values ()Ljava/util/Collection;
-}
-
-public final class kotlinx/serialization/json/JsonObject$Companion {
- public final fun serializer ()Lkotlinx/serialization/KSerializer;
-}
-
-public final class kotlinx/serialization/json/JsonObjectBuilder {
- public fun ()V
- public final fun build ()Lkotlinx/serialization/json/JsonObject;
- public final fun put (Ljava/lang/String;Lkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/json/JsonElement;
- public final fun to (Ljava/lang/String;Ljava/lang/Boolean;)V
- public final fun to (Ljava/lang/String;Ljava/lang/Number;)V
- public final fun to (Ljava/lang/String;Ljava/lang/String;)V
- public final fun to (Ljava/lang/String;Lkotlinx/serialization/json/JsonElement;)V
-}
-
-public final class kotlinx/serialization/json/JsonObjectSerializer : kotlinx/serialization/KSerializer {
- public static final field INSTANCE Lkotlinx/serialization/json/JsonObjectSerializer;
- public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
- public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lkotlinx/serialization/json/JsonObject;
- public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
- public synthetic fun patch (Lkotlinx/serialization/encoding/Decoder;Ljava/lang/Object;)Ljava/lang/Object;
- public fun patch (Lkotlinx/serialization/encoding/Decoder;Lkotlinx/serialization/json/JsonObject;)Lkotlinx/serialization/json/JsonObject;
- public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
- public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lkotlinx/serialization/json/JsonObject;)V
-}
-
-public abstract interface class kotlinx/serialization/json/JsonOutput {
- public abstract fun encodeJson (Lkotlinx/serialization/json/JsonElement;)V
-}
-
-public abstract class kotlinx/serialization/json/JsonPrimitive : kotlinx/serialization/json/JsonElement {
- public static final field Companion Lkotlinx/serialization/json/JsonPrimitive$Companion;
- public abstract fun getContent ()Ljava/lang/String;
- public abstract fun isString ()Z
- public fun toString ()Ljava/lang/String;
-}
-
-public final class kotlinx/serialization/json/JsonPrimitive$Companion {
- public final fun serializer ()Lkotlinx/serialization/KSerializer;
-}
-
-public final class kotlinx/serialization/json/JsonPrimitiveSerializer : kotlinx/serialization/KSerializer {
- public static final field INSTANCE Lkotlinx/serialization/json/JsonPrimitiveSerializer;
- public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
- public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lkotlinx/serialization/json/JsonPrimitive;
- public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
- public synthetic fun patch (Lkotlinx/serialization/encoding/Decoder;Ljava/lang/Object;)Ljava/lang/Object;
- public fun patch (Lkotlinx/serialization/encoding/Decoder;Lkotlinx/serialization/json/JsonPrimitive;)Lkotlinx/serialization/json/JsonPrimitive;
- public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
- public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lkotlinx/serialization/json/JsonPrimitive;)V
-}
-
-public abstract class kotlinx/serialization/json/JsonTransformingSerializer : kotlinx/serialization/KSerializer {
- public fun (Lkotlinx/serialization/KSerializer;)V
- public fun (Lkotlinx/serialization/KSerializer;Ljava/lang/String;)V
- public final fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
- public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
- public fun patch (Lkotlinx/serialization/encoding/Decoder;Ljava/lang/Object;)Ljava/lang/Object;
- protected final fun readTransform (Lkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/json/JsonElement;
- public final fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
- protected fun transformDeserialize (Lkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/json/JsonElement;
- protected fun transformSerialize (Lkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/json/JsonElement;
- protected final fun writeTransform (Lkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/json/JsonElement;
-}
-
-public final class kotlinx/serialization/json/SubtypeToDetectDefault : kotlinx/serialization/json/JsonConfiguration {
- public fun ()V
-}
-
-public final class kotlinx/serialization/json/SubtypeToDetectStable : kotlinx/serialization/json/JsonConfiguration {
- public fun ()V
-}
-
public final class kotlinx/serialization/modules/ModulesMigrationsKt {
public static final fun defaultPolymorphic (Lkotlinx/serialization/modules/SerializersModuleCollector;Lkotlin/reflect/KClass;Lkotlin/jvm/functions/Function1;)V
public static final fun getContextual (Lkotlinx/serialization/modules/SerializersModule;)Lkotlinx/serialization/KSerializer;
diff --git a/runtime/build.gradle b/core/build.gradle
similarity index 100%
rename from runtime/build.gradle
rename to core/build.gradle
diff --git a/runtime/commonMain/src/kotlinx/serialization/Annotations.kt b/core/commonMain/src/kotlinx/serialization/Annotations.kt
similarity index 98%
rename from runtime/commonMain/src/kotlinx/serialization/Annotations.kt
rename to core/commonMain/src/kotlinx/serialization/Annotations.kt
index 5593f72ed3..cba3f973dc 100644
--- a/runtime/commonMain/src/kotlinx/serialization/Annotations.kt
+++ b/core/commonMain/src/kotlinx/serialization/Annotations.kt
@@ -7,8 +7,6 @@
package kotlinx.serialization
import kotlinx.serialization.descriptors.*
-import kotlinx.serialization.json.*
-import kotlinx.serialization.modules.*
import kotlin.reflect.*
/**
@@ -93,7 +91,7 @@ public annotation class Serializer(
/**
* Overrides the name of a class or a property in the corresponding [SerialDescriptor].
* Names and serial names are used by text-based serial formats in order to encode the name of the class or
- * the name of the property, e.g. by [Json].
+ * the name of the property, e.g. by `Json`.
*
* By default, [SerialDescriptor.serialName] and [SerialDescriptor.getElementName]
* are associated with fully-qualified name of the target class and the name of the property respectively.
diff --git a/runtime/commonMain/src/kotlinx/serialization/ContextualSerializer.kt b/core/commonMain/src/kotlinx/serialization/ContextualSerializer.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/ContextualSerializer.kt
rename to core/commonMain/src/kotlinx/serialization/ContextualSerializer.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/KSerializer.kt b/core/commonMain/src/kotlinx/serialization/KSerializer.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/KSerializer.kt
rename to core/commonMain/src/kotlinx/serialization/KSerializer.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/Migrations.kt b/core/commonMain/src/kotlinx/serialization/Migrations.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/Migrations.kt
rename to core/commonMain/src/kotlinx/serialization/Migrations.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/PolymorphicSerializer.kt b/core/commonMain/src/kotlinx/serialization/PolymorphicSerializer.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/PolymorphicSerializer.kt
rename to core/commonMain/src/kotlinx/serialization/PolymorphicSerializer.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/SealedSerializer.kt b/core/commonMain/src/kotlinx/serialization/SealedSerializer.kt
similarity index 97%
rename from runtime/commonMain/src/kotlinx/serialization/SealedSerializer.kt
rename to core/commonMain/src/kotlinx/serialization/SealedSerializer.kt
index 55a67bcf01..96d08c0890 100644
--- a/runtime/commonMain/src/kotlinx/serialization/SealedSerializer.kt
+++ b/core/commonMain/src/kotlinx/serialization/SealedSerializer.kt
@@ -68,9 +68,8 @@ import kotlin.reflect.*
* }
* ```
*/
-@PublishedApi
-@OptIn(ExperimentalSerializationApi::class)
-internal class SealedClassSerializer(
+@InternalSerializationApi
+public class SealedClassSerializer(
serialName: String,
override val baseClass: KClass,
subclasses: Array>,
diff --git a/runtime/commonMain/src/kotlinx/serialization/SerialFormat.kt b/core/commonMain/src/kotlinx/serialization/SerialFormat.kt
similarity index 98%
rename from runtime/commonMain/src/kotlinx/serialization/SerialFormat.kt
rename to core/commonMain/src/kotlinx/serialization/SerialFormat.kt
index 41cb788c03..9b0c66b972 100644
--- a/runtime/commonMain/src/kotlinx/serialization/SerialFormat.kt
+++ b/core/commonMain/src/kotlinx/serialization/SerialFormat.kt
@@ -6,7 +6,6 @@ package kotlinx.serialization
import kotlinx.serialization.internal.*
import kotlinx.serialization.encoding.*
-import kotlinx.serialization.json.*
import kotlinx.serialization.modules.*
/**
@@ -15,7 +14,7 @@ import kotlinx.serialization.modules.*
* It does not impose any restrictions on a serialized form or underlying storage, neither it exposes them.
*
* Concrete data types and API for user-interaction are responsibility of a concrete subclass or subinterface,
- * for example [StringFormat], [BinaryFormat] or [Json].
+ * for example [StringFormat], [BinaryFormat] or `Json`.
*
* Typically, formats have their specific [Encoder] and [Decoder] implementations
* as private classes and do not expose them.
diff --git a/runtime/commonMain/src/kotlinx/serialization/SerializationException.kt b/core/commonMain/src/kotlinx/serialization/SerializationException.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/SerializationException.kt
rename to core/commonMain/src/kotlinx/serialization/SerializationException.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/Serializers.kt b/core/commonMain/src/kotlinx/serialization/Serializers.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/Serializers.kt
rename to core/commonMain/src/kotlinx/serialization/Serializers.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/builtins/BuiltinSerializers.kt b/core/commonMain/src/kotlinx/serialization/builtins/BuiltinSerializers.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/builtins/BuiltinSerializers.kt
rename to core/commonMain/src/kotlinx/serialization/builtins/BuiltinSerializers.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/builtins/BuiltinsMigrations.kt b/core/commonMain/src/kotlinx/serialization/builtins/BuiltinsMigrations.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/builtins/BuiltinsMigrations.kt
rename to core/commonMain/src/kotlinx/serialization/builtins/BuiltinsMigrations.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/builtins/LongAsStringSerializer.kt b/core/commonMain/src/kotlinx/serialization/builtins/LongAsStringSerializer.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/builtins/LongAsStringSerializer.kt
rename to core/commonMain/src/kotlinx/serialization/builtins/LongAsStringSerializer.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/descriptors/ContextAware.kt b/core/commonMain/src/kotlinx/serialization/descriptors/ContextAware.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/descriptors/ContextAware.kt
rename to core/commonMain/src/kotlinx/serialization/descriptors/ContextAware.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/descriptors/SerialDescriptor.kt b/core/commonMain/src/kotlinx/serialization/descriptors/SerialDescriptor.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/descriptors/SerialDescriptor.kt
rename to core/commonMain/src/kotlinx/serialization/descriptors/SerialDescriptor.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/descriptors/SerialDescriptors.kt b/core/commonMain/src/kotlinx/serialization/descriptors/SerialDescriptors.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/descriptors/SerialDescriptors.kt
rename to core/commonMain/src/kotlinx/serialization/descriptors/SerialDescriptors.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/descriptors/SerialKinds.kt b/core/commonMain/src/kotlinx/serialization/descriptors/SerialKinds.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/descriptors/SerialKinds.kt
rename to core/commonMain/src/kotlinx/serialization/descriptors/SerialKinds.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/encoding/AbstractDecoder.kt b/core/commonMain/src/kotlinx/serialization/encoding/AbstractDecoder.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/encoding/AbstractDecoder.kt
rename to core/commonMain/src/kotlinx/serialization/encoding/AbstractDecoder.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/encoding/AbstractEncoder.kt b/core/commonMain/src/kotlinx/serialization/encoding/AbstractEncoder.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/encoding/AbstractEncoder.kt
rename to core/commonMain/src/kotlinx/serialization/encoding/AbstractEncoder.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/encoding/Decoding.kt b/core/commonMain/src/kotlinx/serialization/encoding/Decoding.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/encoding/Decoding.kt
rename to core/commonMain/src/kotlinx/serialization/encoding/Decoding.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/encoding/Encoding.kt b/core/commonMain/src/kotlinx/serialization/encoding/Encoding.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/encoding/Encoding.kt
rename to core/commonMain/src/kotlinx/serialization/encoding/Encoding.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/internal/AbstractPolymorphicSerializer.kt b/core/commonMain/src/kotlinx/serialization/internal/AbstractPolymorphicSerializer.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/internal/AbstractPolymorphicSerializer.kt
rename to core/commonMain/src/kotlinx/serialization/internal/AbstractPolymorphicSerializer.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/internal/CollectionDescriptors.kt b/core/commonMain/src/kotlinx/serialization/internal/CollectionDescriptors.kt
similarity index 94%
rename from runtime/commonMain/src/kotlinx/serialization/internal/CollectionDescriptors.kt
rename to core/commonMain/src/kotlinx/serialization/internal/CollectionDescriptors.kt
index 4253c804d2..dc7c4e8108 100644
--- a/runtime/commonMain/src/kotlinx/serialization/internal/CollectionDescriptors.kt
+++ b/core/commonMain/src/kotlinx/serialization/internal/CollectionDescriptors.kt
@@ -107,6 +107,7 @@ internal const val HASH_MAP_NAME = "kotlin.collections.HashMap"
*
* Can be obtained from corresponding serializers (e.g. [ByteArraySerializer.descriptor])
*/
+@OptIn(ExperimentalSerializationApi::class)
internal class PrimitiveArrayDescriptor internal constructor(
primitive: SerialDescriptor
) : ListLikeDescriptor(primitive) {
@@ -121,9 +122,6 @@ internal class ArrayListClassDesc(elementDesc: SerialDescriptor) : ListLikeDescr
override val serialName: String get() = ARRAY_LIST_NAME
}
-internal class NamedListClassDescriptor(override val serialName: String, elementDescriptor: SerialDescriptor) :
- ListLikeDescriptor(elementDescriptor)
-
internal class LinkedHashSetClassDesc(elementDesc: SerialDescriptor) : ListLikeDescriptor(elementDesc) {
override val serialName: String get() = LINKED_HASH_SET_NAME
}
@@ -132,9 +130,6 @@ internal class HashSetClassDesc(elementDesc: SerialDescriptor) : ListLikeDescrip
override val serialName: String get() = HASH_SET_NAME
}
-internal class NamedMapClassDescriptor(name: String, keyDescriptor: SerialDescriptor, valueDescriptor: SerialDescriptor) :
- MapLikeDescriptor(name, keyDescriptor, valueDescriptor)
-
internal class LinkedHashMapClassDesc(keyDesc: SerialDescriptor, valueDesc: SerialDescriptor) :
MapLikeDescriptor(LINKED_HASH_MAP_NAME, keyDesc, valueDesc)
diff --git a/runtime/commonMain/src/kotlinx/serialization/internal/CollectionSerializers.kt b/core/commonMain/src/kotlinx/serialization/internal/CollectionSerializers.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/internal/CollectionSerializers.kt
rename to core/commonMain/src/kotlinx/serialization/internal/CollectionSerializers.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/internal/Enums.kt b/core/commonMain/src/kotlinx/serialization/internal/Enums.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/internal/Enums.kt
rename to core/commonMain/src/kotlinx/serialization/internal/Enums.kt
diff --git a/core/commonMain/src/kotlinx/serialization/internal/JsonInternalDependencies.kt b/core/commonMain/src/kotlinx/serialization/internal/JsonInternalDependencies.kt
new file mode 100644
index 0000000000..d79cb8b99e
--- /dev/null
+++ b/core/commonMain/src/kotlinx/serialization/internal/JsonInternalDependencies.kt
@@ -0,0 +1,14 @@
+package kotlinx.serialization.internal
+
+import kotlinx.serialization.*
+import kotlinx.serialization.descriptors.*
+
+/*
+ * Methods that are required for kotlinx-serialization-json, but are not effectively public
+ * and actually represent our own technical debt.
+ * This methods are not intended for public use
+ */
+
+@InternalSerializationApi
+@Deprecated(message = "Should not be used", level = DeprecationLevel.ERROR)
+public fun SerialDescriptor.jsonCachedSerialNames(): Set = cachedSerialNames()
diff --git a/runtime/commonMain/src/kotlinx/serialization/internal/LongAsStringSerializer.kt b/core/commonMain/src/kotlinx/serialization/internal/LongAsStringSerializer.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/internal/LongAsStringSerializer.kt
rename to core/commonMain/src/kotlinx/serialization/internal/LongAsStringSerializer.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/internal/NullableSerializer.kt b/core/commonMain/src/kotlinx/serialization/internal/NullableSerializer.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/internal/NullableSerializer.kt
rename to core/commonMain/src/kotlinx/serialization/internal/NullableSerializer.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/internal/ObjectSerializer.kt b/core/commonMain/src/kotlinx/serialization/internal/ObjectSerializer.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/internal/ObjectSerializer.kt
rename to core/commonMain/src/kotlinx/serialization/internal/ObjectSerializer.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/internal/Platform.common.kt b/core/commonMain/src/kotlinx/serialization/internal/Platform.common.kt
similarity index 78%
rename from runtime/commonMain/src/kotlinx/serialization/internal/Platform.common.kt
rename to core/commonMain/src/kotlinx/serialization/internal/Platform.common.kt
index 8fc6ce0186..0ada97b533 100644
--- a/runtime/commonMain/src/kotlinx/serialization/internal/Platform.common.kt
+++ b/core/commonMain/src/kotlinx/serialization/internal/Platform.common.kt
@@ -70,7 +70,6 @@ internal object InternalHexConverter {
}
internal fun SerialDescriptor.cachedSerialNames(): Set {
- @Suppress("DEPRECATION_ERROR")
if (this is PluginGeneratedSerialDescriptor) return namesSet
val result = HashSet(elementsCount)
for (i in 0 until elementsCount) {
@@ -89,28 +88,6 @@ private val EMPTY_DESCRIPTOR_ARRAY: Array = arrayOf()
internal fun List?.compactArray(): Array =
takeUnless { it.isNullOrEmpty() }?.toTypedArray() ?: EMPTY_DESCRIPTOR_ARRAY
-/**
- * Returns serial descriptor that delegates all the calls to descriptor returned by [deferred] block.
- * Used to resolve cyclic dependencies between recursive serializable structures.
- */
-internal fun defer(deferred: () -> SerialDescriptor): SerialDescriptor = object : SerialDescriptor {
-
- private val original: SerialDescriptor by lazy(deferred)
-
- override val serialName: String
- get() = original.serialName
- override val kind: SerialKind
- get() = original.kind
- override val elementsCount: Int
- get() = original.elementsCount
-
- override fun getElementName(index: Int): String = original.getElementName(index)
- override fun getElementIndex(name: String): Int = original.getElementIndex(name)
- override fun getElementAnnotations(index: Int): List = original.getElementAnnotations(index)
- override fun getElementDescriptor(index: Int): SerialDescriptor = original.getElementDescriptor(index)
- override fun isElementOptional(index: Int): Boolean = original.isElementOptional(index)
-}
-
@Suppress("UNCHECKED_CAST", "NOTHING_TO_INLINE")
@PublishedApi
internal inline fun KSerializer<*>.cast(): KSerializer = this as KSerializer
@@ -171,17 +148,6 @@ internal expect fun ArrayList.toNativeArrayImpl(eClass: KCl
*/
internal expect fun Any.isInstanceOf(kclass: KClass<*>): Boolean
-/**
- * Same as [SerialDescriptor.getElementIndex], but throws [SerializationException] if
- * given [name] is not associated with any element in the descriptor.
- */
-internal fun SerialDescriptor.getElementIndexOrThrow(name: String): Int {
- val index = getElementIndex(name)
- if (index == CompositeDecoder.UNKNOWN_NAME)
- throw SerializationException("$serialName does not contain element with name '$name'")
- return index
-}
-
internal inline fun Iterable.elementsHashCodeBy(selector: (T) -> K): Int {
return fold(1) { hash, element -> 31 * hash + selector(element).hashCode() }
}
diff --git a/runtime/commonMain/src/kotlinx/serialization/internal/PluginGeneratedSerialDescriptor.kt b/core/commonMain/src/kotlinx/serialization/internal/PluginGeneratedSerialDescriptor.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/internal/PluginGeneratedSerialDescriptor.kt
rename to core/commonMain/src/kotlinx/serialization/internal/PluginGeneratedSerialDescriptor.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/internal/PluginHelperInterfaces.kt b/core/commonMain/src/kotlinx/serialization/internal/PluginHelperInterfaces.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/internal/PluginHelperInterfaces.kt
rename to core/commonMain/src/kotlinx/serialization/internal/PluginHelperInterfaces.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/internal/PrimitiveArraysSerializers.kt b/core/commonMain/src/kotlinx/serialization/internal/PrimitiveArraysSerializers.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/internal/PrimitiveArraysSerializers.kt
rename to core/commonMain/src/kotlinx/serialization/internal/PrimitiveArraysSerializers.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/internal/Primitives.kt b/core/commonMain/src/kotlinx/serialization/internal/Primitives.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/internal/Primitives.kt
rename to core/commonMain/src/kotlinx/serialization/internal/Primitives.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/internal/SerializationConstructorMarker.kt b/core/commonMain/src/kotlinx/serialization/internal/SerializationConstructorMarker.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/internal/SerializationConstructorMarker.kt
rename to core/commonMain/src/kotlinx/serialization/internal/SerializationConstructorMarker.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/internal/Tagged.kt b/core/commonMain/src/kotlinx/serialization/internal/Tagged.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/internal/Tagged.kt
rename to core/commonMain/src/kotlinx/serialization/internal/Tagged.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/internal/Tuples.kt b/core/commonMain/src/kotlinx/serialization/internal/Tuples.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/internal/Tuples.kt
rename to core/commonMain/src/kotlinx/serialization/internal/Tuples.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/modules/ModulesMigrations.kt b/core/commonMain/src/kotlinx/serialization/modules/ModulesMigrations.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/modules/ModulesMigrations.kt
rename to core/commonMain/src/kotlinx/serialization/modules/ModulesMigrations.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/modules/PolymorphicModuleBuilder.kt b/core/commonMain/src/kotlinx/serialization/modules/PolymorphicModuleBuilder.kt
similarity index 99%
rename from runtime/commonMain/src/kotlinx/serialization/modules/PolymorphicModuleBuilder.kt
rename to core/commonMain/src/kotlinx/serialization/modules/PolymorphicModuleBuilder.kt
index 4a1a5c53da..0ef5327b52 100644
--- a/runtime/commonMain/src/kotlinx/serialization/modules/PolymorphicModuleBuilder.kt
+++ b/core/commonMain/src/kotlinx/serialization/modules/PolymorphicModuleBuilder.kt
@@ -6,7 +6,6 @@ package kotlinx.serialization.modules
import kotlinx.serialization.*
import kotlinx.serialization.internal.*
-import kotlinx.serialization.json.*
import kotlin.reflect.*
/**
diff --git a/runtime/commonMain/src/kotlinx/serialization/modules/SerializersModule.kt b/core/commonMain/src/kotlinx/serialization/modules/SerializersModule.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/modules/SerializersModule.kt
rename to core/commonMain/src/kotlinx/serialization/modules/SerializersModule.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/modules/SerializersModuleBuilders.kt b/core/commonMain/src/kotlinx/serialization/modules/SerializersModuleBuilders.kt
similarity index 98%
rename from runtime/commonMain/src/kotlinx/serialization/modules/SerializersModuleBuilders.kt
rename to core/commonMain/src/kotlinx/serialization/modules/SerializersModuleBuilders.kt
index 8d8334ff99..11ffc1c119 100644
--- a/runtime/commonMain/src/kotlinx/serialization/modules/SerializersModuleBuilders.kt
+++ b/core/commonMain/src/kotlinx/serialization/modules/SerializersModuleBuilders.kt
@@ -4,7 +4,6 @@
package kotlinx.serialization.modules
import kotlinx.serialization.*
-import kotlinx.serialization.json.*
import kotlin.jvm.*
import kotlin.reflect.*
@@ -68,7 +67,7 @@ public class SerializersModuleBuilder @PublishedApi internal constructor() : Ser
* Adds a default serializers provider associated with the given [baseClass] to the resulting module.
* [defaultSerializerProvider] is invoked when no polymorphic serializers associated with the `className`
* were found. `className` could be `null` for formats that support nullable class discriminators
- * (currently only [Json] with [useArrayPolymorphism][JsonBuilder.useArrayPolymorphism] set to `false`)
+ * (currently only `Json` with `useArrayPolymorphism` set to `false`)
*
* @see PolymorphicModuleBuilder.default
*/
diff --git a/runtime/commonMain/src/kotlinx/serialization/modules/SerializersModuleCollector.kt b/core/commonMain/src/kotlinx/serialization/modules/SerializersModuleCollector.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/modules/SerializersModuleCollector.kt
rename to core/commonMain/src/kotlinx/serialization/modules/SerializersModuleCollector.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/BasicTypesSerializationTest.kt b/core/commonTest/src/kotlinx/serialization/BasicTypesSerializationTest.kt
similarity index 96%
rename from runtime/commonTest/src/kotlinx/serialization/BasicTypesSerializationTest.kt
rename to core/commonTest/src/kotlinx/serialization/BasicTypesSerializationTest.kt
index 44d3fb5a65..74a9e6702a 100644
--- a/runtime/commonTest/src/kotlinx/serialization/BasicTypesSerializationTest.kt
+++ b/core/commonTest/src/kotlinx/serialization/BasicTypesSerializationTest.kt
@@ -6,6 +6,7 @@ package kotlinx.serialization
import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.*
+import kotlinx.serialization.encoding.CompositeDecoder.Companion.UNKNOWN_NAME
import kotlinx.serialization.internal.*
import kotlin.test.*
@@ -64,7 +65,8 @@ class BasicTypesSerializationTest {
val name = inp.nextUntil(':', '}')
if (name.isEmpty())
return CompositeDecoder.DECODE_DONE
- val index = descriptor.getElementIndexOrThrow(name)
+ val index = descriptor.getElementIndex(name)
+ check(index != UNKNOWN_NAME)
inp.expect(':')
return index
}
diff --git a/core/commonTest/src/kotlinx/serialization/PolymorphismTestData.kt b/core/commonTest/src/kotlinx/serialization/PolymorphismTestData.kt
new file mode 100644
index 0000000000..dedc8795c4
--- /dev/null
+++ b/core/commonTest/src/kotlinx/serialization/PolymorphismTestData.kt
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2017-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
+ */
+
+package kotlinx.serialization
+
+import kotlinx.serialization.modules.*
+
+@Serializable
+open class PolyBase(val id: Int) {
+ override fun hashCode(): Int {
+ return id
+ }
+
+ override fun toString(): String {
+ return "PolyBase(id=$id)"
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (other == null || this::class != other::class) return false
+ other as PolyBase
+ if (id != other.id) return false
+ return true
+ }
+
+}
+
+@Serializable
+data class PolyDerived(val s: String) : PolyBase(1)
+
+val BaseAndDerivedModule = SerializersModule {
+ polymorphic(PolyBase::class, PolyBase.serializer()) {
+ subclass(PolyDerived.serializer())
+ }
+}
diff --git a/runtime/commonTest/src/kotlinx/serialization/SerialDescriptorAnnotationsTest.kt b/core/commonTest/src/kotlinx/serialization/SerialDescriptorAnnotationsTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/SerialDescriptorAnnotationsTest.kt
rename to core/commonTest/src/kotlinx/serialization/SerialDescriptorAnnotationsTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/SerialDescriptorBuilderTest.kt b/core/commonTest/src/kotlinx/serialization/SerialDescriptorBuilderTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/SerialDescriptorBuilderTest.kt
rename to core/commonTest/src/kotlinx/serialization/SerialDescriptorBuilderTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/SerialDescriptorEqualityTest.kt b/core/commonTest/src/kotlinx/serialization/SerialDescriptorEqualityTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/SerialDescriptorEqualityTest.kt
rename to core/commonTest/src/kotlinx/serialization/SerialDescriptorEqualityTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/SerialDescriptorSpecificationTest.kt b/core/commonTest/src/kotlinx/serialization/SerialDescriptorSpecificationTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/SerialDescriptorSpecificationTest.kt
rename to core/commonTest/src/kotlinx/serialization/SerialDescriptorSpecificationTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/SerializersLookupEnumTest.kt b/core/commonTest/src/kotlinx/serialization/SerializersLookupEnumTest.kt
similarity index 96%
rename from runtime/commonTest/src/kotlinx/serialization/SerializersLookupEnumTest.kt
rename to core/commonTest/src/kotlinx/serialization/SerializersLookupEnumTest.kt
index 36eed43753..0e12348655 100644
--- a/runtime/commonTest/src/kotlinx/serialization/SerializersLookupEnumTest.kt
+++ b/core/commonTest/src/kotlinx/serialization/SerializersLookupEnumTest.kt
@@ -6,13 +6,12 @@ package kotlinx.serialization
import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.*
-import kotlinx.serialization.json.*
import kotlinx.serialization.test.*
import kotlin.test.*
// This is unimplemented functionality that should be
@Suppress("RemoveExplicitTypeArguments") // This is exactly what's being tested
-class SerializersLookupEnumTest : JsonTestBase() {
+class SerializersLookupEnumTest {
@Serializable(with = EnumExternalObjectSerializer::class)
enum class EnumExternalObject
diff --git a/runtime/commonTest/src/kotlinx/serialization/TaggedTest.kt b/core/commonTest/src/kotlinx/serialization/TaggedTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/TaggedTest.kt
rename to core/commonTest/src/kotlinx/serialization/TaggedTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/TestId.kt b/core/commonTest/src/kotlinx/serialization/TestId.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/TestId.kt
rename to core/commonTest/src/kotlinx/serialization/TestId.kt
diff --git a/core/commonTest/src/kotlinx/serialization/UmbrellaTypes.kt b/core/commonTest/src/kotlinx/serialization/UmbrellaTypes.kt
new file mode 100644
index 0000000000..61e42f6173
--- /dev/null
+++ b/core/commonTest/src/kotlinx/serialization/UmbrellaTypes.kt
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2017-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
+ */
+
+package kotlinx.serialization
+
+import kotlin.native.concurrent.*
+
+@Serializable
+data class IntData(val intV: Int)
+
+enum class Attitude { POSITIVE, NEUTRAL, NEGATIVE }
+
+@Serializable
+data class Tree(val name: String, val left: Tree? = null, val right: Tree? = null)
+
+@Serializable
+data class TypesUmbrella(
+ val unit: Unit,
+ val boolean: Boolean,
+ val byte: Byte,
+ val short: Short,
+ val int: Int,
+ val long: Long,
+ val float: Float,
+ val double: Double,
+ val char: Char,
+ val string: String,
+ val enum: Attitude,
+ val intData: IntData,
+ val unitN: Unit?,
+ val booleanN: Boolean?,
+ val byteN: Byte?,
+ val shortN: Short?,
+ val intN: Int?,
+ val longN: Long?,
+ val floatN: Float?,
+ val doubleN: Double?,
+ val charN: Char?,
+ val stringN: String?,
+ val enumN: Attitude?,
+ val intDataN: IntData?,
+ val listInt: List,
+ val listIntN: List,
+ val listNInt: Set?,
+ val listNIntN: MutableSet?,
+ val listListEnumN: List>,
+ val listIntData: List,
+ val listIntDataN: MutableList,
+ val tree: Tree,
+ val mapStringInt: Map,
+ val mapIntStringN: Map,
+ val arrays: ArraysUmbrella
+)
+
+@Serializable
+data class ArraysUmbrella(
+ val arrByte: Array,
+ val arrInt: Array,
+ val arrIntN: Array,
+ val arrIntData: Array
+) {
+ override fun equals(other: Any?) = other is ArraysUmbrella &&
+ arrByte.contentEquals(other.arrByte) &&
+ arrInt.contentEquals(other.arrInt) &&
+ arrIntN.contentEquals(other.arrIntN) &&
+ arrIntData.contentEquals(other.arrIntData)
+}
+
+@SharedImmutable
+val umbrellaInstance = TypesUmbrella(
+ Unit, true, 10, 20, 30, 40, 50.1f, 60.1, 'A', "Str0", Attitude.POSITIVE, IntData(70),
+ null, null, 11, 21, 31, 41, 51.1f, 61.1, 'B', "Str1", Attitude.NEUTRAL, null,
+ listOf(1, 2, 3),
+ listOf(4, 5, null),
+ setOf(6, 7, 8),
+ mutableSetOf(null, 9, 10),
+ listOf(listOf(Attitude.NEGATIVE, null)),
+ listOf(IntData(1), IntData(2), IntData(3)),
+ mutableListOf(IntData(1), null, IntData(3)),
+ Tree("root", Tree("left"), Tree("right", Tree("right.left"), Tree("right.right"))),
+ mapOf("one" to 1, "two" to 2, "three" to 3),
+ mapOf(0 to null, 1 to "first", 2 to "second"),
+ ArraysUmbrella(
+ arrayOf(1, 2, 3),
+ arrayOf(100, 200, 300),
+ arrayOf(null, -1, -2),
+ arrayOf(IntData(1), IntData(2))
+ )
+)
diff --git a/runtime/commonTest/src/kotlinx/serialization/features/SchemaTest.kt b/core/commonTest/src/kotlinx/serialization/features/SchemaTest.kt
similarity index 96%
rename from runtime/commonTest/src/kotlinx/serialization/features/SchemaTest.kt
rename to core/commonTest/src/kotlinx/serialization/features/SchemaTest.kt
index 2a4c04611a..dece1704d4 100644
--- a/runtime/commonTest/src/kotlinx/serialization/features/SchemaTest.kt
+++ b/core/commonTest/src/kotlinx/serialization/features/SchemaTest.kt
@@ -13,6 +13,11 @@ import kotlin.test.*
class SchemaTest {
+ enum class SampleEnum { OptionA, OptionB, OptionC }
+
+ @Serializable
+ data class Box(val boxed: T)
+
@Serializable
data class Data1(val l: List = emptyList(), val s: String) {
@Serializer(forClass = Data1::class)
@@ -113,7 +118,7 @@ class SchemaTest {
fun testEnumDescriptors() {
val dataDescriptor = DataWithEnum.serializer().descriptor
val enumDesc = dataDescriptor.getElementDescriptor(1)
- val serialName = "kotlinx.serialization.SampleEnum"
+ val serialName = "kotlinx.serialization.features.SchemaTest.SampleEnum"
val manualSerializer = EnumSerializer(serialName)
assertEquals(enumDesc, manualSerializer.descriptor)
assertEquals(enumDesc, dataDescriptor.getElementDescriptor(2).getElementDescriptor(0))
diff --git a/runtime/commonTest/src/kotlinx/serialization/modules/ModuleBuildersTest.kt b/core/commonTest/src/kotlinx/serialization/modules/ModuleBuildersTest.kt
similarity index 98%
rename from runtime/commonTest/src/kotlinx/serialization/modules/ModuleBuildersTest.kt
rename to core/commonTest/src/kotlinx/serialization/modules/ModuleBuildersTest.kt
index cae6975e66..708cc25e46 100644
--- a/runtime/commonTest/src/kotlinx/serialization/modules/ModuleBuildersTest.kt
+++ b/core/commonTest/src/kotlinx/serialization/modules/ModuleBuildersTest.kt
@@ -7,11 +7,8 @@
package kotlinx.serialization.modules
import kotlinx.serialization.*
-import kotlinx.serialization.PolyBase
-import kotlinx.serialization.PolyDerived
import kotlinx.serialization.builtins.*
import kotlinx.serialization.descriptors.*
-import kotlinx.serialization.test.*
import kotlin.reflect.*
import kotlin.test.*
diff --git a/runtime/commonTest/src/kotlinx/serialization/test/CurrentPlatform.common.kt b/core/commonTest/src/kotlinx/serialization/test/CurrentPlatform.common.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/test/CurrentPlatform.common.kt
rename to core/commonTest/src/kotlinx/serialization/test/CurrentPlatform.common.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/test/TestHelpers.kt b/core/commonTest/src/kotlinx/serialization/test/TestHelpers.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/test/TestHelpers.kt
rename to core/commonTest/src/kotlinx/serialization/test/TestHelpers.kt
diff --git a/runtime/jsMain/src/kotlinx/serialization/Serializers.kt b/core/jsMain/src/kotlinx/serialization/Serializers.kt
similarity index 100%
rename from runtime/jsMain/src/kotlinx/serialization/Serializers.kt
rename to core/jsMain/src/kotlinx/serialization/Serializers.kt
diff --git a/runtime/jsMain/src/kotlinx/serialization/internal/Platform.kt b/core/jsMain/src/kotlinx/serialization/internal/Platform.kt
similarity index 100%
rename from runtime/jsMain/src/kotlinx/serialization/internal/Platform.kt
rename to core/jsMain/src/kotlinx/serialization/internal/Platform.kt
diff --git a/runtime/jsTest/src/kotlinx/serialization/test/CurrentPlatform.kt b/core/jsTest/src/kotlinx/serialization/test/CurrentPlatform.kt
similarity index 100%
rename from runtime/jsTest/src/kotlinx/serialization/test/CurrentPlatform.kt
rename to core/jsTest/src/kotlinx/serialization/test/CurrentPlatform.kt
diff --git a/runtime/jvmMain/src/kotlinx/serialization/SerializersJvm.kt b/core/jvmMain/src/kotlinx/serialization/SerializersJvm.kt
similarity index 100%
rename from runtime/jvmMain/src/kotlinx/serialization/SerializersJvm.kt
rename to core/jvmMain/src/kotlinx/serialization/SerializersJvm.kt
diff --git a/runtime/jvmMain/src/kotlinx/serialization/internal/Platform.kt b/core/jvmMain/src/kotlinx/serialization/internal/Platform.kt
similarity index 100%
rename from runtime/jvmMain/src/kotlinx/serialization/internal/Platform.kt
rename to core/jvmMain/src/kotlinx/serialization/internal/Platform.kt
diff --git a/runtime/jvmTest/src/kotlinx/serialization/SerializationMethodInvocationOrderTest.kt b/core/jvmTest/src/kotlinx/serialization/SerializationMethodInvocationOrderTest.kt
similarity index 100%
rename from runtime/jvmTest/src/kotlinx/serialization/SerializationMethodInvocationOrderTest.kt
rename to core/jvmTest/src/kotlinx/serialization/SerializationMethodInvocationOrderTest.kt
diff --git a/runtime/jvmTest/src/kotlinx/serialization/SerializeFlatTest.kt b/core/jvmTest/src/kotlinx/serialization/SerializeFlatTest.kt
similarity index 100%
rename from runtime/jvmTest/src/kotlinx/serialization/SerializeFlatTest.kt
rename to core/jvmTest/src/kotlinx/serialization/SerializeFlatTest.kt
diff --git a/runtime/jvmTest/src/kotlinx/serialization/features/SerializerJvmSpecificTest.kt b/core/jvmTest/src/kotlinx/serialization/features/SerializerJvmSpecificTest.kt
similarity index 100%
rename from runtime/jvmTest/src/kotlinx/serialization/features/SerializerJvmSpecificTest.kt
rename to core/jvmTest/src/kotlinx/serialization/features/SerializerJvmSpecificTest.kt
diff --git a/runtime/jvmTest/src/kotlinx/serialization/privateclasstest/PrivateDataOutOfKotlinXSerializationPackageTest.kt b/core/jvmTest/src/kotlinx/serialization/privateclasstest/PrivateDataOutOfKotlinXSerializationPackageTest.kt
similarity index 100%
rename from runtime/jvmTest/src/kotlinx/serialization/privateclasstest/PrivateDataOutOfKotlinXSerializationPackageTest.kt
rename to core/jvmTest/src/kotlinx/serialization/privateclasstest/PrivateDataOutOfKotlinXSerializationPackageTest.kt
diff --git a/runtime/jvmTest/src/kotlinx/serialization/test/CurrentPlatform.kt b/core/jvmTest/src/kotlinx/serialization/test/CurrentPlatform.kt
similarity index 100%
rename from runtime/jvmTest/src/kotlinx/serialization/test/CurrentPlatform.kt
rename to core/jvmTest/src/kotlinx/serialization/test/CurrentPlatform.kt
diff --git a/runtime/nativeMain/src/kotlinx/serialization/Serializers.kt b/core/nativeMain/src/kotlinx/serialization/Serializers.kt
similarity index 100%
rename from runtime/nativeMain/src/kotlinx/serialization/Serializers.kt
rename to core/nativeMain/src/kotlinx/serialization/Serializers.kt
diff --git a/runtime/nativeMain/src/kotlinx/serialization/internal/Platform.kt b/core/nativeMain/src/kotlinx/serialization/internal/Platform.kt
similarity index 100%
rename from runtime/nativeMain/src/kotlinx/serialization/internal/Platform.kt
rename to core/nativeMain/src/kotlinx/serialization/internal/Platform.kt
diff --git a/runtime/nativeTest/src/kotlinx/serialization/test/CurrentPlatform.kt b/core/nativeTest/src/kotlinx/serialization/test/CurrentPlatform.kt
similarity index 100%
rename from runtime/nativeTest/src/kotlinx/serialization/test/CurrentPlatform.kt
rename to core/nativeTest/src/kotlinx/serialization/test/CurrentPlatform.kt
diff --git a/formats/README.md b/formats/README.md
index 8c90560ecb..e07591e016 100644
--- a/formats/README.md
+++ b/formats/README.md
@@ -5,6 +5,12 @@ were not included in the core library.
For convenience, they have same `groupId`, versioning and release cycle as core library.
+## JSON
+
+* Artifact id: `kotlinx-serialization-json`
+* Platform: all supported platforms
+* Status: stable
+
## HOCON
* Artifact id: `kotlinx-serialization-hocon`
diff --git a/formats/json/api/kotlinx-serialization-json.api b/formats/json/api/kotlinx-serialization-json.api
new file mode 100644
index 0000000000..e86e6ad6d7
--- /dev/null
+++ b/formats/json/api/kotlinx-serialization-json.api
@@ -0,0 +1,445 @@
+public abstract class kotlinx/serialization/json/Json : kotlinx/serialization/StringFormat {
+ public static final field Default Lkotlinx/serialization/json/Json$Default;
+ public synthetic fun (Lkotlinx/serialization/json/internal/JsonConf;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
+ public final fun decodeFromJsonElement (Lkotlinx/serialization/DeserializationStrategy;Lkotlinx/serialization/json/JsonElement;)Ljava/lang/Object;
+ public final fun decodeFromString (Lkotlinx/serialization/DeserializationStrategy;Ljava/lang/String;)Ljava/lang/Object;
+ public final fun encodeToJsonElement (Lkotlinx/serialization/SerializationStrategy;Ljava/lang/Object;)Lkotlinx/serialization/json/JsonElement;
+ public final fun encodeToString (Lkotlinx/serialization/SerializationStrategy;Ljava/lang/Object;)Ljava/lang/String;
+ public fun getSerializersModule ()Lkotlinx/serialization/modules/SerializersModule;
+ public final fun parseToJsonElement (Ljava/lang/String;)Lkotlinx/serialization/json/JsonElement;
+}
+
+public final class kotlinx/serialization/json/Json$Default : kotlinx/serialization/json/Json {
+}
+
+public final class kotlinx/serialization/json/JsonArray : kotlinx/serialization/json/JsonElement, java/util/List, kotlin/jvm/internal/markers/KMappedMarker {
+ public static final field Companion Lkotlinx/serialization/json/JsonArray$Companion;
+ public fun (Ljava/util/List;)V
+ public synthetic fun add (ILjava/lang/Object;)V
+ public fun add (ILkotlinx/serialization/json/JsonElement;)V
+ public synthetic fun add (Ljava/lang/Object;)Z
+ public fun add (Lkotlinx/serialization/json/JsonElement;)Z
+ public fun addAll (ILjava/util/Collection;)Z
+ public fun addAll (Ljava/util/Collection;)Z
+ public fun clear ()V
+ public final fun contains (Ljava/lang/Object;)Z
+ public fun contains (Lkotlinx/serialization/json/JsonElement;)Z
+ public fun containsAll (Ljava/util/Collection;)Z
+ public fun equals (Ljava/lang/Object;)Z
+ public synthetic fun get (I)Ljava/lang/Object;
+ public fun get (I)Lkotlinx/serialization/json/JsonElement;
+ public fun getSize ()I
+ public fun hashCode ()I
+ public final fun indexOf (Ljava/lang/Object;)I
+ public fun indexOf (Lkotlinx/serialization/json/JsonElement;)I
+ public fun isEmpty ()Z
+ public fun iterator ()Ljava/util/Iterator;
+ public final fun lastIndexOf (Ljava/lang/Object;)I
+ public fun lastIndexOf (Lkotlinx/serialization/json/JsonElement;)I
+ public fun listIterator ()Ljava/util/ListIterator;
+ public fun listIterator (I)Ljava/util/ListIterator;
+ public synthetic fun remove (I)Ljava/lang/Object;
+ public fun remove (I)Lkotlinx/serialization/json/JsonElement;
+ public fun remove (Ljava/lang/Object;)Z
+ public fun removeAll (Ljava/util/Collection;)Z
+ public fun replaceAll (Ljava/util/function/UnaryOperator;)V
+ public fun retainAll (Ljava/util/Collection;)Z
+ public synthetic fun set (ILjava/lang/Object;)Ljava/lang/Object;
+ public fun set (ILkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/json/JsonElement;
+ public final fun size ()I
+ public fun sort (Ljava/util/Comparator;)V
+ public fun subList (II)Ljava/util/List;
+ public fun toArray ()[Ljava/lang/Object;
+ public fun toArray ([Ljava/lang/Object;)[Ljava/lang/Object;
+ public fun toString ()Ljava/lang/String;
+}
+
+public final class kotlinx/serialization/json/JsonArray$Companion {
+ public final fun serializer ()Lkotlinx/serialization/KSerializer;
+}
+
+public final class kotlinx/serialization/json/JsonArrayBuilder {
+ public fun ()V
+ public final fun add (Lkotlinx/serialization/json/JsonElement;)Z
+ public final fun build ()Lkotlinx/serialization/json/JsonArray;
+ public final fun unaryPlus (Ljava/lang/Boolean;)V
+ public final fun unaryPlus (Ljava/lang/Number;)V
+ public final fun unaryPlus (Ljava/lang/String;)V
+ public final fun unaryPlus (Lkotlinx/serialization/json/JsonElement;)V
+}
+
+public final class kotlinx/serialization/json/JsonArraySerializer : kotlinx/serialization/KSerializer {
+ public static final field INSTANCE Lkotlinx/serialization/json/JsonArraySerializer;
+ public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
+ public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lkotlinx/serialization/json/JsonArray;
+ public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
+ public synthetic fun patch (Lkotlinx/serialization/encoding/Decoder;Ljava/lang/Object;)Ljava/lang/Object;
+ public fun patch (Lkotlinx/serialization/encoding/Decoder;Lkotlinx/serialization/json/JsonArray;)Lkotlinx/serialization/json/JsonArray;
+ public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
+ public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lkotlinx/serialization/json/JsonArray;)V
+}
+
+public final class kotlinx/serialization/json/JsonBuilder {
+ public final fun buildConfiguration ()Lkotlinx/serialization/json/JsonConfiguration;
+ public final fun buildModule ()Lkotlinx/serialization/modules/SerializersModule;
+ public final fun getAllowSpecialFloatingPointValues ()Z
+ public final fun getAllowStructuredMapKeys ()Z
+ public final fun getClassDiscriminator ()Ljava/lang/String;
+ public final fun getCoerceInputValues ()Z
+ public final fun getEncodeDefaults ()Z
+ public final fun getIgnoreUnknownKeys ()Z
+ public final fun getIndent ()Ljava/lang/String;
+ public final fun getPrettyPrint ()Z
+ public final fun getPrettyPrintIndent ()Ljava/lang/String;
+ public final fun getSerialModule ()Lkotlinx/serialization/modules/SerializersModule;
+ public final fun getSerializeSpecialFloatingPointValues ()Z
+ public final fun getSerializersModule ()Lkotlinx/serialization/modules/SerializersModule;
+ public final fun getStrictMode ()Z
+ public final fun getUnquoted ()Z
+ public final fun getUnquotedPrint ()Z
+ public final fun getUseArrayPolymorphism ()Z
+ public final fun isLenient ()Z
+ public final fun setAllowSpecialFloatingPointValues (Z)V
+ public final fun setAllowStructuredMapKeys (Z)V
+ public final fun setClassDiscriminator (Ljava/lang/String;)V
+ public final fun setCoerceInputValues (Z)V
+ public final fun setEncodeDefaults (Z)V
+ public final fun setIgnoreUnknownKeys (Z)V
+ public final fun setIndent (Ljava/lang/String;)V
+ public final fun setLenient (Z)V
+ public final fun setPrettyPrint (Z)V
+ public final fun setPrettyPrintIndent (Ljava/lang/String;)V
+ public final fun setSerialModule (Lkotlinx/serialization/modules/SerializersModule;)V
+ public final fun setSerializeSpecialFloatingPointValues (Z)V
+ public final fun setSerializersModule (Lkotlinx/serialization/modules/SerializersModule;)V
+ public final fun setStrictMode (Z)V
+ public final fun setUnquoted (Z)V
+ public final fun setUnquotedPrint (Z)V
+ public final fun setUseArrayPolymorphism (Z)V
+}
+
+public class kotlinx/serialization/json/JsonConfiguration {
+ public static final field Companion Lkotlinx/serialization/json/JsonConfiguration$Companion;
+ public fun ()V
+ public fun (ZZZZZZZLjava/lang/String;ZZLjava/lang/String;)V
+ public synthetic fun (ZZZZZZZLjava/lang/String;ZZLjava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
+ public final fun copy (ZZZZZZZLjava/lang/String;ZZLjava/lang/String;)Lkotlinx/serialization/json/JsonConfiguration;
+ public static synthetic fun copy$default (Lkotlinx/serialization/json/JsonConfiguration;ZZZZZZZLjava/lang/String;ZZLjava/lang/String;ILjava/lang/Object;)Lkotlinx/serialization/json/JsonConfiguration;
+ public static final fun getDefault ()Lkotlinx/serialization/json/SubtypeToDetectDefault;
+ public static final fun getStable ()Lkotlinx/serialization/json/SubtypeToDetectStable;
+}
+
+public final class kotlinx/serialization/json/JsonConfiguration$Companion {
+ public final fun getDefault ()Lkotlinx/serialization/json/SubtypeToDetectDefault;
+ public final fun getStable ()Lkotlinx/serialization/json/SubtypeToDetectStable;
+}
+
+public final class kotlinx/serialization/json/JsonConfigurationKt {
+ public static final fun JsonConfiguration (ZZ)V
+ public static synthetic fun JsonConfiguration$default (ZZILjava/lang/Object;)V
+}
+
+public abstract class kotlinx/serialization/json/JsonContentPolymorphicSerializer : kotlinx/serialization/KSerializer {
+ public fun (Lkotlin/reflect/KClass;)V
+ public final fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
+ public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
+ public fun patch (Lkotlinx/serialization/encoding/Decoder;Ljava/lang/Object;)Ljava/lang/Object;
+ protected abstract fun selectDeserializer (Lkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/DeserializationStrategy;
+ protected final fun selectSerializer (Lkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/KSerializer;
+ public final fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
+}
+
+public abstract interface class kotlinx/serialization/json/JsonDecoder : kotlinx/serialization/encoding/CompositeDecoder, kotlinx/serialization/encoding/Decoder {
+ public abstract fun decodeJsonElement ()Lkotlinx/serialization/json/JsonElement;
+ public abstract fun getJson ()Lkotlinx/serialization/json/Json;
+ public abstract synthetic fun getUpdateMode ()Lkotlinx/serialization/UpdateMode;
+}
+
+public final class kotlinx/serialization/json/JsonDecoder$DefaultImpls {
+ public static fun beginStructure (Lkotlinx/serialization/json/JsonDecoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)Lkotlinx/serialization/encoding/CompositeDecoder;
+ public static fun beginStructure (Lkotlinx/serialization/json/JsonDecoder;Lkotlinx/serialization/descriptors/SerialDescriptor;[Lkotlinx/serialization/KSerializer;)Lkotlinx/serialization/encoding/CompositeDecoder;
+ public static fun decodeCollectionSize (Lkotlinx/serialization/json/JsonDecoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)I
+ public static fun decodeNullableSerializableElement (Lkotlinx/serialization/json/JsonDecoder;Lkotlinx/serialization/descriptors/SerialDescriptor;ILkotlinx/serialization/DeserializationStrategy;)Ljava/lang/Object;
+ public static fun decodeNullableSerializableElement (Lkotlinx/serialization/json/JsonDecoder;Lkotlinx/serialization/descriptors/SerialDescriptor;ILkotlinx/serialization/DeserializationStrategy;Ljava/lang/Object;)Ljava/lang/Object;
+ public static fun decodeNullableSerializableValue (Lkotlinx/serialization/json/JsonDecoder;Lkotlinx/serialization/DeserializationStrategy;)Ljava/lang/Object;
+ public static fun decodeSequentially (Lkotlinx/serialization/json/JsonDecoder;)Z
+ public static fun decodeSerializableElement (Lkotlinx/serialization/json/JsonDecoder;Lkotlinx/serialization/descriptors/SerialDescriptor;ILkotlinx/serialization/DeserializationStrategy;)Ljava/lang/Object;
+ public static fun decodeSerializableElement (Lkotlinx/serialization/json/JsonDecoder;Lkotlinx/serialization/descriptors/SerialDescriptor;ILkotlinx/serialization/DeserializationStrategy;Ljava/lang/Object;)Ljava/lang/Object;
+ public static fun decodeSerializableValue (Lkotlinx/serialization/json/JsonDecoder;Lkotlinx/serialization/DeserializationStrategy;)Ljava/lang/Object;
+ public static synthetic fun getUpdateMode (Lkotlinx/serialization/json/JsonDecoder;)Lkotlinx/serialization/UpdateMode;
+ public static fun updateNullableSerializableElement (Lkotlinx/serialization/json/JsonDecoder;Lkotlinx/serialization/descriptors/SerialDescriptor;ILkotlinx/serialization/DeserializationStrategy;Ljava/lang/Object;)Ljava/lang/Object;
+ public static fun updateNullableSerializableValue (Lkotlinx/serialization/json/JsonDecoder;Lkotlinx/serialization/DeserializationStrategy;Ljava/lang/Object;)Ljava/lang/Object;
+ public static fun updateSerializableElement (Lkotlinx/serialization/json/JsonDecoder;Lkotlinx/serialization/descriptors/SerialDescriptor;ILkotlinx/serialization/DeserializationStrategy;Ljava/lang/Object;)Ljava/lang/Object;
+ public static fun updateSerializableValue (Lkotlinx/serialization/json/JsonDecoder;Lkotlinx/serialization/DeserializationStrategy;Ljava/lang/Object;)Ljava/lang/Object;
+}
+
+public abstract class kotlinx/serialization/json/JsonElement {
+ public static final field Companion Lkotlinx/serialization/json/JsonElement$Companion;
+}
+
+public final class kotlinx/serialization/json/JsonElement$Companion {
+ public final fun serializer ()Lkotlinx/serialization/KSerializer;
+}
+
+public final class kotlinx/serialization/json/JsonElementBuildersKt {
+ public static final fun add (Lkotlinx/serialization/json/JsonArrayBuilder;Ljava/lang/Boolean;)Z
+ public static final fun add (Lkotlinx/serialization/json/JsonArrayBuilder;Ljava/lang/Number;)Z
+ public static final fun add (Lkotlinx/serialization/json/JsonArrayBuilder;Ljava/lang/String;)Z
+ public static final fun addJsonArray (Lkotlinx/serialization/json/JsonArrayBuilder;Lkotlin/jvm/functions/Function1;)Z
+ public static final fun addJsonObject (Lkotlinx/serialization/json/JsonArrayBuilder;Lkotlin/jvm/functions/Function1;)Z
+ public static final fun buildJsonArray (Lkotlin/jvm/functions/Function1;)Lkotlinx/serialization/json/JsonArray;
+ public static final fun buildJsonObject (Lkotlin/jvm/functions/Function1;)Lkotlinx/serialization/json/JsonObject;
+ public static final fun put (Lkotlinx/serialization/json/JsonObjectBuilder;Ljava/lang/String;Ljava/lang/Boolean;)Lkotlinx/serialization/json/JsonElement;
+ public static final fun put (Lkotlinx/serialization/json/JsonObjectBuilder;Ljava/lang/String;Ljava/lang/Number;)Lkotlinx/serialization/json/JsonElement;
+ public static final fun put (Lkotlinx/serialization/json/JsonObjectBuilder;Ljava/lang/String;Ljava/lang/String;)Lkotlinx/serialization/json/JsonElement;
+ public static final fun putJsonArray (Lkotlinx/serialization/json/JsonObjectBuilder;Ljava/lang/String;Lkotlin/jvm/functions/Function1;)Lkotlinx/serialization/json/JsonElement;
+ public static final fun putJsonObject (Lkotlinx/serialization/json/JsonObjectBuilder;Ljava/lang/String;Lkotlin/jvm/functions/Function1;)Lkotlinx/serialization/json/JsonElement;
+}
+
+public final class kotlinx/serialization/json/JsonElementKt {
+ public static final fun JsonPrimitive (Ljava/lang/Boolean;)Lkotlinx/serialization/json/JsonPrimitive;
+ public static final fun JsonPrimitive (Ljava/lang/Number;)Lkotlinx/serialization/json/JsonPrimitive;
+ public static final fun JsonPrimitive (Ljava/lang/String;)Lkotlinx/serialization/json/JsonPrimitive;
+ public static final fun getBoolean (Lkotlinx/serialization/json/JsonPrimitive;)Z
+ public static final fun getBooleanOrNull (Lkotlinx/serialization/json/JsonPrimitive;)Ljava/lang/Boolean;
+ public static final fun getContentOrNull (Lkotlinx/serialization/json/JsonPrimitive;)Ljava/lang/String;
+ public static final fun getDouble (Lkotlinx/serialization/json/JsonPrimitive;)D
+ public static final fun getDoubleOrNull (Lkotlinx/serialization/json/JsonPrimitive;)Ljava/lang/Double;
+ public static final fun getFloat (Lkotlinx/serialization/json/JsonPrimitive;)F
+ public static final fun getFloatOrNull (Lkotlinx/serialization/json/JsonPrimitive;)Ljava/lang/Float;
+ public static final fun getInt (Lkotlinx/serialization/json/JsonPrimitive;)I
+ public static final fun getIntOrNull (Lkotlinx/serialization/json/JsonPrimitive;)Ljava/lang/Integer;
+ public static final fun getJsonArray (Lkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/json/JsonArray;
+ public static final fun getJsonNull (Lkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/json/JsonNull;
+ public static final fun getJsonObject (Lkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/json/JsonObject;
+ public static final fun getJsonPrimitive (Lkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/json/JsonPrimitive;
+ public static final fun getLong (Lkotlinx/serialization/json/JsonPrimitive;)J
+ public static final fun getLongOrNull (Lkotlinx/serialization/json/JsonPrimitive;)Ljava/lang/Long;
+ public static final fun unexpectedJson (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Void;
+}
+
+public final class kotlinx/serialization/json/JsonElementSerializer : kotlinx/serialization/KSerializer {
+ public static final field INSTANCE Lkotlinx/serialization/json/JsonElementSerializer;
+ public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
+ public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lkotlinx/serialization/json/JsonElement;
+ public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
+ public synthetic fun patch (Lkotlinx/serialization/encoding/Decoder;Ljava/lang/Object;)Ljava/lang/Object;
+ public fun patch (Lkotlinx/serialization/encoding/Decoder;Lkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/json/JsonElement;
+ public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
+ public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lkotlinx/serialization/json/JsonElement;)V
+}
+
+public abstract interface class kotlinx/serialization/json/JsonEncoder : kotlinx/serialization/encoding/CompositeEncoder, kotlinx/serialization/encoding/Encoder {
+ public abstract fun encodeJsonElement (Lkotlinx/serialization/json/JsonElement;)V
+ public abstract fun getJson ()Lkotlinx/serialization/json/Json;
+}
+
+public final class kotlinx/serialization/json/JsonEncoder$DefaultImpls {
+ public static fun beginCollection (Lkotlinx/serialization/json/JsonEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;I)Lkotlinx/serialization/encoding/CompositeEncoder;
+ public static fun beginCollection (Lkotlinx/serialization/json/JsonEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;I[Lkotlinx/serialization/KSerializer;)Lkotlinx/serialization/encoding/CompositeEncoder;
+ public static fun beginStructure (Lkotlinx/serialization/json/JsonEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)Lkotlinx/serialization/encoding/CompositeEncoder;
+ public static fun beginStructure (Lkotlinx/serialization/json/JsonEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;[Lkotlinx/serialization/KSerializer;)Lkotlinx/serialization/encoding/CompositeEncoder;
+ public static fun encodeNonSerializableElement (Lkotlinx/serialization/json/JsonEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;ILjava/lang/Object;)V
+ public static fun encodeNotNullMark (Lkotlinx/serialization/json/JsonEncoder;)V
+ public static fun encodeNullableSerializableValue (Lkotlinx/serialization/json/JsonEncoder;Lkotlinx/serialization/SerializationStrategy;Ljava/lang/Object;)V
+ public static fun encodeSerializableValue (Lkotlinx/serialization/json/JsonEncoder;Lkotlinx/serialization/SerializationStrategy;Ljava/lang/Object;)V
+ public static fun shouldEncodeElementDefault (Lkotlinx/serialization/json/JsonEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;I)Z
+}
+
+public abstract interface class kotlinx/serialization/json/JsonInput {
+ public abstract fun decodeJson ()Lkotlinx/serialization/json/JsonElement;
+}
+
+public final class kotlinx/serialization/json/JsonKt {
+ public static final fun Json ()Lkotlinx/serialization/json/Json;
+ public static final fun Json (Lkotlinx/serialization/json/Json;Lkotlin/jvm/functions/Function1;)Lkotlinx/serialization/json/Json;
+ public static final fun Json (Lkotlinx/serialization/json/JsonConfiguration;Lkotlinx/serialization/modules/SerializersModule;)Lkotlinx/serialization/json/Json;
+ public static final fun Json (Lkotlinx/serialization/json/SubtypeToDetectDefault;)Lkotlinx/serialization/json/Json;
+ public static final fun Json (Lkotlinx/serialization/json/SubtypeToDetectDefault;Lkotlinx/serialization/modules/SerializersModule;)Lkotlinx/serialization/json/Json;
+ public static final fun Json (Lkotlinx/serialization/json/SubtypeToDetectStable;)Lkotlinx/serialization/json/Json;
+ public static final fun Json (Lkotlinx/serialization/modules/SerializersModule;)Lkotlinx/serialization/json/Json;
+ public static synthetic fun Json$default (Lkotlinx/serialization/json/Json;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lkotlinx/serialization/json/Json;
+ public static synthetic fun Json$default (Lkotlinx/serialization/json/JsonConfiguration;Lkotlinx/serialization/modules/SerializersModule;ILjava/lang/Object;)Lkotlinx/serialization/json/Json;
+}
+
+public final class kotlinx/serialization/json/JsonMigrationsKt {
+ public static final fun JsonLiteral (Ljava/lang/Object;)Lkotlinx/serialization/json/JsonPrimitive;
+ public static final fun contains (Lkotlinx/serialization/json/JsonElement;Ljava/lang/String;)Z
+ public static final fun decodeJson (Lkotlinx/serialization/json/JsonDecoder;)Lkotlinx/serialization/json/JsonElement;
+ public static final fun encodeJson (Lkotlinx/serialization/json/JsonEncoder;Lkotlinx/serialization/json/JsonElement;)V
+ public static final fun fromJson (Lkotlinx/serialization/json/Json;Lkotlinx/serialization/DeserializationStrategy;Lkotlinx/serialization/json/JsonElement;)Ljava/lang/Object;
+ public static final fun fromJson (Lkotlinx/serialization/json/Json;Lkotlinx/serialization/json/JsonElement;)Ljava/lang/Object;
+ public static final fun getArray (Lkotlinx/serialization/json/JsonArray;I)Lkotlinx/serialization/json/JsonArray;
+ public static final fun getArray (Lkotlinx/serialization/json/JsonObject;Ljava/lang/String;)Lkotlinx/serialization/json/JsonArray;
+ public static final fun getArrayOrNull (Lkotlinx/serialization/json/JsonArray;I)Lkotlinx/serialization/json/JsonArray;
+ public static final fun getArrayOrNull (Lkotlinx/serialization/json/JsonObject;Ljava/lang/String;)Lkotlinx/serialization/json/JsonArray;
+ public static final fun getAs (Lkotlinx/serialization/json/JsonArray;I)Lkotlinx/serialization/json/JsonElement;
+ public static final fun getAs (Lkotlinx/serialization/json/JsonObject;Ljava/lang/String;)Lkotlinx/serialization/json/JsonElement;
+ public static final fun getAsOrNull (Lkotlinx/serialization/json/JsonArray;I)Lkotlinx/serialization/json/JsonElement;
+ public static final fun getAsOrNull (Lkotlinx/serialization/json/JsonObject;Ljava/lang/String;)Lkotlinx/serialization/json/JsonElement;
+ public static final fun getBoolean (Lkotlinx/serialization/json/JsonElement;)Z
+ public static final fun getBooleanOrNull (Lkotlinx/serialization/json/JsonElement;)Ljava/lang/Boolean;
+ public static final fun getContent (Lkotlinx/serialization/json/JsonElement;)Ljava/lang/String;
+ public static final fun getContentOrNull (Lkotlinx/serialization/json/JsonElement;)Ljava/lang/String;
+ public static final fun getDouble (Lkotlinx/serialization/json/JsonElement;)D
+ public static final fun getDoubleOrNull (Lkotlinx/serialization/json/JsonElement;)Ljava/lang/Double;
+ public static final fun getFloat (Lkotlinx/serialization/json/JsonElement;)F
+ public static final fun getFloatOrNull (Lkotlinx/serialization/json/JsonElement;)Ljava/lang/Float;
+ public static final fun getIndented (Lkotlinx/serialization/json/Json$Default;)Lkotlinx/serialization/json/Json;
+ public static final fun getInt (Lkotlinx/serialization/json/JsonElement;)I
+ public static final fun getIntOrNull (Lkotlinx/serialization/json/JsonElement;)Ljava/lang/Integer;
+ public static final fun getLong (Lkotlinx/serialization/json/JsonElement;)J
+ public static final fun getLongOrNull (Lkotlinx/serialization/json/JsonElement;)Ljava/lang/Long;
+ public static final fun getNonstrict (Lkotlinx/serialization/json/Json$Default;)Lkotlinx/serialization/json/Json;
+ public static final fun getObject (Lkotlinx/serialization/json/JsonArray;I)Lkotlinx/serialization/json/JsonObject;
+ public static final fun getObject (Lkotlinx/serialization/json/JsonObject;Ljava/lang/String;)Lkotlinx/serialization/json/JsonObject;
+ public static final fun getObjectOrNull (Lkotlinx/serialization/json/JsonArray;I)Lkotlinx/serialization/json/JsonObject;
+ public static final fun getObjectOrNull (Lkotlinx/serialization/json/JsonObject;Ljava/lang/String;)Lkotlinx/serialization/json/JsonObject;
+ public static final fun getPlain (Lkotlinx/serialization/json/Json$Default;)Lkotlinx/serialization/json/Json;
+ public static final fun getPrimitive (Lkotlinx/serialization/json/JsonArray;I)Lkotlinx/serialization/json/JsonPrimitive;
+ public static final fun getPrimitive (Lkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/json/JsonPrimitive;
+ public static final fun getPrimitive (Lkotlinx/serialization/json/JsonObject;Ljava/lang/String;)Lkotlinx/serialization/json/JsonPrimitive;
+ public static final fun getPrimitiveOrNull (Lkotlinx/serialization/json/JsonArray;I)Lkotlinx/serialization/json/JsonPrimitive;
+ public static final fun getPrimitiveOrNull (Lkotlinx/serialization/json/JsonObject;Ljava/lang/String;)Lkotlinx/serialization/json/JsonPrimitive;
+ public static final fun getUnquoted (Lkotlinx/serialization/json/Json$Default;)Lkotlinx/serialization/json/Json;
+ public static final fun isNull (Lkotlinx/serialization/json/JsonElement;)Z
+ public static final fun json (Lkotlin/jvm/functions/Function1;)Lkotlinx/serialization/json/JsonObject;
+ public static final fun jsonArray (Lkotlin/jvm/functions/Function1;)Lkotlinx/serialization/json/JsonArray;
+ public static final fun parseJson (Lkotlinx/serialization/json/Json;Ljava/lang/String;)Lkotlinx/serialization/json/JsonElement;
+ public static final fun toJson (Lkotlinx/serialization/json/Json;Ljava/lang/Object;)Lkotlinx/serialization/json/JsonElement;
+ public static final fun toJson (Lkotlinx/serialization/json/Json;Lkotlinx/serialization/SerializationStrategy;Ljava/lang/Object;)Lkotlinx/serialization/json/JsonElement;
+}
+
+public final class kotlinx/serialization/json/JsonNull : kotlinx/serialization/json/JsonPrimitive {
+ public static final field INSTANCE Lkotlinx/serialization/json/JsonNull;
+ public fun getContent ()Ljava/lang/String;
+ public fun isString ()Z
+}
+
+public final class kotlinx/serialization/json/JsonNullSerializer : kotlinx/serialization/KSerializer {
+ public static final field INSTANCE Lkotlinx/serialization/json/JsonNullSerializer;
+ public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
+ public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lkotlinx/serialization/json/JsonNull;
+ public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
+ public synthetic fun patch (Lkotlinx/serialization/encoding/Decoder;Ljava/lang/Object;)Ljava/lang/Object;
+ public fun patch (Lkotlinx/serialization/encoding/Decoder;Lkotlinx/serialization/json/JsonNull;)Lkotlinx/serialization/json/JsonNull;
+ public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
+ public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lkotlinx/serialization/json/JsonNull;)V
+}
+
+public final class kotlinx/serialization/json/JsonObject : kotlinx/serialization/json/JsonElement, java/util/Map, kotlin/jvm/internal/markers/KMappedMarker {
+ public static final field Companion Lkotlinx/serialization/json/JsonObject$Companion;
+ public fun (Ljava/util/Map;)V
+ public fun clear ()V
+ public synthetic fun compute (Ljava/lang/Object;Ljava/util/function/BiFunction;)Ljava/lang/Object;
+ public fun compute (Ljava/lang/String;Ljava/util/function/BiFunction;)Lkotlinx/serialization/json/JsonElement;
+ public synthetic fun computeIfAbsent (Ljava/lang/Object;Ljava/util/function/Function;)Ljava/lang/Object;
+ public fun computeIfAbsent (Ljava/lang/String;Ljava/util/function/Function;)Lkotlinx/serialization/json/JsonElement;
+ public synthetic fun computeIfPresent (Ljava/lang/Object;Ljava/util/function/BiFunction;)Ljava/lang/Object;
+ public fun computeIfPresent (Ljava/lang/String;Ljava/util/function/BiFunction;)Lkotlinx/serialization/json/JsonElement;
+ public final fun containsKey (Ljava/lang/Object;)Z
+ public fun containsKey (Ljava/lang/String;)Z
+ public final fun containsValue (Ljava/lang/Object;)Z
+ public fun containsValue (Lkotlinx/serialization/json/JsonElement;)Z
+ public final fun entrySet ()Ljava/util/Set;
+ public fun equals (Ljava/lang/Object;)Z
+ public final fun get (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun get (Ljava/lang/String;)Lkotlinx/serialization/json/JsonElement;
+ public fun getEntries ()Ljava/util/Set;
+ public fun getKeys ()Ljava/util/Set;
+ public fun getSize ()I
+ public fun getValues ()Ljava/util/Collection;
+ public fun hashCode ()I
+ public fun isEmpty ()Z
+ public final fun keySet ()Ljava/util/Set;
+ public synthetic fun merge (Ljava/lang/Object;Ljava/lang/Object;Ljava/util/function/BiFunction;)Ljava/lang/Object;
+ public fun merge (Ljava/lang/String;Lkotlinx/serialization/json/JsonElement;Ljava/util/function/BiFunction;)Lkotlinx/serialization/json/JsonElement;
+ public synthetic fun put (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
+ public fun put (Ljava/lang/String;Lkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/json/JsonElement;
+ public fun putAll (Ljava/util/Map;)V
+ public synthetic fun putIfAbsent (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
+ public fun putIfAbsent (Ljava/lang/String;Lkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/json/JsonElement;
+ public fun remove (Ljava/lang/Object;)Ljava/lang/Object;
+ public fun remove (Ljava/lang/Object;Ljava/lang/Object;)Z
+ public synthetic fun replace (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
+ public synthetic fun replace (Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Z
+ public fun replace (Ljava/lang/String;Lkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/json/JsonElement;
+ public fun replace (Ljava/lang/String;Lkotlinx/serialization/json/JsonElement;Lkotlinx/serialization/json/JsonElement;)Z
+ public fun replaceAll (Ljava/util/function/BiFunction;)V
+ public final fun size ()I
+ public fun toString ()Ljava/lang/String;
+ public final fun values ()Ljava/util/Collection;
+}
+
+public final class kotlinx/serialization/json/JsonObject$Companion {
+ public final fun serializer ()Lkotlinx/serialization/KSerializer;
+}
+
+public final class kotlinx/serialization/json/JsonObjectBuilder {
+ public fun ()V
+ public final fun build ()Lkotlinx/serialization/json/JsonObject;
+ public final fun put (Ljava/lang/String;Lkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/json/JsonElement;
+ public final fun to (Ljava/lang/String;Ljava/lang/Boolean;)V
+ public final fun to (Ljava/lang/String;Ljava/lang/Number;)V
+ public final fun to (Ljava/lang/String;Ljava/lang/String;)V
+ public final fun to (Ljava/lang/String;Lkotlinx/serialization/json/JsonElement;)V
+}
+
+public final class kotlinx/serialization/json/JsonObjectSerializer : kotlinx/serialization/KSerializer {
+ public static final field INSTANCE Lkotlinx/serialization/json/JsonObjectSerializer;
+ public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
+ public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lkotlinx/serialization/json/JsonObject;
+ public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
+ public synthetic fun patch (Lkotlinx/serialization/encoding/Decoder;Ljava/lang/Object;)Ljava/lang/Object;
+ public fun patch (Lkotlinx/serialization/encoding/Decoder;Lkotlinx/serialization/json/JsonObject;)Lkotlinx/serialization/json/JsonObject;
+ public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
+ public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lkotlinx/serialization/json/JsonObject;)V
+}
+
+public abstract interface class kotlinx/serialization/json/JsonOutput {
+ public abstract fun encodeJson (Lkotlinx/serialization/json/JsonElement;)V
+}
+
+public abstract class kotlinx/serialization/json/JsonPrimitive : kotlinx/serialization/json/JsonElement {
+ public static final field Companion Lkotlinx/serialization/json/JsonPrimitive$Companion;
+ public abstract fun getContent ()Ljava/lang/String;
+ public abstract fun isString ()Z
+ public fun toString ()Ljava/lang/String;
+}
+
+public final class kotlinx/serialization/json/JsonPrimitive$Companion {
+ public final fun serializer ()Lkotlinx/serialization/KSerializer;
+}
+
+public final class kotlinx/serialization/json/JsonPrimitiveSerializer : kotlinx/serialization/KSerializer {
+ public static final field INSTANCE Lkotlinx/serialization/json/JsonPrimitiveSerializer;
+ public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
+ public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lkotlinx/serialization/json/JsonPrimitive;
+ public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
+ public synthetic fun patch (Lkotlinx/serialization/encoding/Decoder;Ljava/lang/Object;)Ljava/lang/Object;
+ public fun patch (Lkotlinx/serialization/encoding/Decoder;Lkotlinx/serialization/json/JsonPrimitive;)Lkotlinx/serialization/json/JsonPrimitive;
+ public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
+ public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lkotlinx/serialization/json/JsonPrimitive;)V
+}
+
+public abstract class kotlinx/serialization/json/JsonTransformingSerializer : kotlinx/serialization/KSerializer {
+ public fun (Lkotlinx/serialization/KSerializer;)V
+ public fun (Lkotlinx/serialization/KSerializer;Ljava/lang/String;)V
+ public final fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
+ public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
+ public fun patch (Lkotlinx/serialization/encoding/Decoder;Ljava/lang/Object;)Ljava/lang/Object;
+ protected final fun readTransform (Lkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/json/JsonElement;
+ public final fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
+ protected fun transformDeserialize (Lkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/json/JsonElement;
+ protected fun transformSerialize (Lkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/json/JsonElement;
+ protected final fun writeTransform (Lkotlinx/serialization/json/JsonElement;)Lkotlinx/serialization/json/JsonElement;
+}
+
+public final class kotlinx/serialization/json/SubtypeToDetectDefault : kotlinx/serialization/json/JsonConfiguration {
+ public fun ()V
+}
+
+public final class kotlinx/serialization/json/SubtypeToDetectStable : kotlinx/serialization/json/JsonConfiguration {
+ public fun ()V
+}
+
diff --git a/formats/json/build.gradle b/formats/json/build.gradle
new file mode 100644
index 0000000000..7bb7785020
--- /dev/null
+++ b/formats/json/build.gradle
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2017-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
+ */
+
+apply plugin: 'kotlin-multiplatform'
+apply plugin: 'kotlinx-serialization'
+apply from: rootProject.file("gradle/targets.gradle")
+apply from: rootProject.file("gradle/native_mpp.gradle")
+apply from: rootProject.file("gradle/configureSourceSets.gradle")
+
+kotlin {
+
+ sourceSets {
+ commonMain {
+ dependencies {
+ api project(":kotlinx-serialization-core")
+ }
+ }
+
+ jvmTest {
+ dependencies {
+ implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.5'
+ }
+ }
+ }
+}
diff --git a/runtime/commonMain/src/kotlinx/serialization/json/Json.kt b/formats/json/commonMain/src/kotlinx/serialization/json/Json.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/json/Json.kt
rename to formats/json/commonMain/src/kotlinx/serialization/json/Json.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/json/JsonConfiguration.kt b/formats/json/commonMain/src/kotlinx/serialization/json/JsonConfiguration.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/json/JsonConfiguration.kt
rename to formats/json/commonMain/src/kotlinx/serialization/json/JsonConfiguration.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/json/JsonContentPolymorphicSerializer.kt b/formats/json/commonMain/src/kotlinx/serialization/json/JsonContentPolymorphicSerializer.kt
similarity index 91%
rename from runtime/commonMain/src/kotlinx/serialization/json/JsonContentPolymorphicSerializer.kt
rename to formats/json/commonMain/src/kotlinx/serialization/json/JsonContentPolymorphicSerializer.kt
index d5663fbcee..453b3fd5a9 100644
--- a/runtime/commonMain/src/kotlinx/serialization/json/JsonContentPolymorphicSerializer.kt
+++ b/formats/json/commonMain/src/kotlinx/serialization/json/JsonContentPolymorphicSerializer.kt
@@ -7,7 +7,6 @@ package kotlinx.serialization.json
import kotlinx.serialization.*
import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.*
-import kotlinx.serialization.internal.*
import kotlinx.serialization.modules.*
import kotlin.reflect.*
@@ -106,6 +105,15 @@ public abstract class JsonContentPolymorphicSerializer(private val base
* Determines a particular strategy for deserialization by looking on a parsed JSON [element].
*/
protected abstract fun selectDeserializer(element: JsonElement): DeserializationStrategy
+
+ private fun throwSubtypeNotRegistered(subClass: KClass<*>, baseClass: KClass<*>): Nothing {
+ val subClassName = subClass.simpleName ?: "$subClass"
+ val scope = "in the scope of '${baseClass.simpleName}'"
+ throw SerializationException(
+ "Class '${subClassName}' is not registered for polymorphic serialization $scope.\n" +
+ "Mark the base class as 'sealed' or register the serializer explicitly.")
+ }
+
}
@Deprecated(
diff --git a/runtime/commonMain/src/kotlinx/serialization/json/JsonDecoder.kt b/formats/json/commonMain/src/kotlinx/serialization/json/JsonDecoder.kt
similarity index 96%
rename from runtime/commonMain/src/kotlinx/serialization/json/JsonDecoder.kt
rename to formats/json/commonMain/src/kotlinx/serialization/json/JsonDecoder.kt
index d0c9a20f96..2137b5dfda 100644
--- a/runtime/commonMain/src/kotlinx/serialization/json/JsonDecoder.kt
+++ b/formats/json/commonMain/src/kotlinx/serialization/json/JsonDecoder.kt
@@ -7,7 +7,6 @@ package kotlinx.serialization.json
import kotlinx.serialization.*
import kotlinx.serialization.encoding.*
import kotlinx.serialization.descriptors.*
-import kotlinx.serialization.encoding.updateModeDeprecated
/**
* Decoder used by [Json] during deserialization.
@@ -93,7 +92,7 @@ public interface JsonDecoder : Decoder, CompositeDecoder {
// Class 'JsonDecoder' must override public open val updateMode: UpdateMode defined in kotlinx.serialization.encoding.Decoder
// because it inherits multiple interface methods of it
@Suppress("DEPRECATION")
- @Deprecated(updateModeDeprecated, level = DeprecationLevel.HIDDEN)
+ @Deprecated(kotlinx.serialization.json.internal.updateModeDeprecated, level = DeprecationLevel.HIDDEN)
override val updateMode: UpdateMode
get() = UpdateMode.OVERWRITE
}
diff --git a/runtime/commonMain/src/kotlinx/serialization/json/JsonElement.kt b/formats/json/commonMain/src/kotlinx/serialization/json/JsonElement.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/json/JsonElement.kt
rename to formats/json/commonMain/src/kotlinx/serialization/json/JsonElement.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/json/JsonElementBuilders.kt b/formats/json/commonMain/src/kotlinx/serialization/json/JsonElementBuilders.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/json/JsonElementBuilders.kt
rename to formats/json/commonMain/src/kotlinx/serialization/json/JsonElementBuilders.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/json/JsonElementSerializers.kt b/formats/json/commonMain/src/kotlinx/serialization/json/JsonElementSerializers.kt
similarity index 81%
rename from runtime/commonMain/src/kotlinx/serialization/json/JsonElementSerializers.kt
rename to formats/json/commonMain/src/kotlinx/serialization/json/JsonElementSerializers.kt
index e142baaa1d..12d0b4749f 100644
--- a/runtime/commonMain/src/kotlinx/serialization/json/JsonElementSerializers.kt
+++ b/formats/json/commonMain/src/kotlinx/serialization/json/JsonElementSerializers.kt
@@ -144,12 +144,13 @@ private object JsonLiteralSerializer : KSerializer {
@Serializer(forClass = JsonObject::class)
@PublishedApi
internal object JsonObjectSerializer : KSerializer {
- override val descriptor: SerialDescriptor =
- NamedMapClassDescriptor(
- "kotlinx.serialization.json.JsonObject",
- String.serializer().descriptor,
- JsonElementSerializer.descriptor
- )
+
+ private object JsonObjectDescriptor : SerialDescriptor by serialDescriptor>() {
+ @ExperimentalSerializationApi
+ override val serialName: String = "kotlinx.serialization.json.JsonObject"
+ }
+
+ override val descriptor: SerialDescriptor = JsonObjectDescriptor
override fun serialize(encoder: Encoder, value: JsonObject) {
verify(encoder)
@@ -170,10 +171,12 @@ internal object JsonObjectSerializer : KSerializer {
@PublishedApi
internal object JsonArraySerializer : KSerializer {
- override val descriptor: SerialDescriptor = NamedListClassDescriptor(
- "kotlinx.serialization.json.JsonArray",
- JsonElementSerializer.descriptor
- )
+ private object JsonArrayDescriptor : SerialDescriptor by serialDescriptor>() {
+ @ExperimentalSerializationApi
+ override val serialName: String = "kotlinx.serialization.json.JsonArray"
+ }
+
+ override val descriptor: SerialDescriptor = JsonArrayDescriptor
override fun serialize(encoder: Encoder, value: JsonArray) {
verify(encoder)
@@ -205,3 +208,27 @@ internal fun Encoder.asJsonEncoder() = this as? JsonEncoder
"This serializer can be used only with Json format." +
"Expected Encoder to be JsonEncoder, got ${this::class}"
)
+
+
+/**
+ * Returns serial descriptor that delegates all the calls to descriptor returned by [deferred] block.
+ * Used to resolve cyclic dependencies between recursive serializable structures.
+ */
+@OptIn(ExperimentalSerializationApi::class)
+private fun defer(deferred: () -> SerialDescriptor): SerialDescriptor = object : SerialDescriptor {
+
+ private val original: SerialDescriptor by lazy(deferred)
+
+ override val serialName: String
+ get() = original.serialName
+ override val kind: SerialKind
+ get() = original.kind
+ override val elementsCount: Int
+ get() = original.elementsCount
+
+ override fun getElementName(index: Int): String = original.getElementName(index)
+ override fun getElementIndex(name: String): Int = original.getElementIndex(name)
+ override fun getElementAnnotations(index: Int): List = original.getElementAnnotations(index)
+ override fun getElementDescriptor(index: Int): SerialDescriptor = original.getElementDescriptor(index)
+ override fun isElementOptional(index: Int): Boolean = original.isElementOptional(index)
+}
diff --git a/runtime/commonMain/src/kotlinx/serialization/json/JsonEncoder.kt b/formats/json/commonMain/src/kotlinx/serialization/json/JsonEncoder.kt
similarity index 99%
rename from runtime/commonMain/src/kotlinx/serialization/json/JsonEncoder.kt
rename to formats/json/commonMain/src/kotlinx/serialization/json/JsonEncoder.kt
index e8f78c7021..01fc150383 100644
--- a/runtime/commonMain/src/kotlinx/serialization/json/JsonEncoder.kt
+++ b/formats/json/commonMain/src/kotlinx/serialization/json/JsonEncoder.kt
@@ -4,7 +4,6 @@
package kotlinx.serialization.json
-import kotlinx.serialization.*
import kotlinx.serialization.encoding.*
/**
diff --git a/runtime/commonMain/src/kotlinx/serialization/json/JsonMigrations.kt b/formats/json/commonMain/src/kotlinx/serialization/json/JsonMigrations.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/json/JsonMigrations.kt
rename to formats/json/commonMain/src/kotlinx/serialization/json/JsonMigrations.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/json/JsonTransformingSerializer.kt b/formats/json/commonMain/src/kotlinx/serialization/json/JsonTransformingSerializer.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/json/JsonTransformingSerializer.kt
rename to formats/json/commonMain/src/kotlinx/serialization/json/JsonTransformingSerializer.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/json/internal/JsonConf.kt b/formats/json/commonMain/src/kotlinx/serialization/json/internal/JsonConf.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/json/internal/JsonConf.kt
rename to formats/json/commonMain/src/kotlinx/serialization/json/internal/JsonConf.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/json/internal/JsonExceptions.kt b/formats/json/commonMain/src/kotlinx/serialization/json/internal/JsonExceptions.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/json/internal/JsonExceptions.kt
rename to formats/json/commonMain/src/kotlinx/serialization/json/internal/JsonExceptions.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/json/internal/JsonParser.kt b/formats/json/commonMain/src/kotlinx/serialization/json/internal/JsonParser.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/json/internal/JsonParser.kt
rename to formats/json/commonMain/src/kotlinx/serialization/json/internal/JsonParser.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/json/internal/JsonReader.kt b/formats/json/commonMain/src/kotlinx/serialization/json/internal/JsonReader.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/json/internal/JsonReader.kt
rename to formats/json/commonMain/src/kotlinx/serialization/json/internal/JsonReader.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/json/internal/Polymorphic.kt b/formats/json/commonMain/src/kotlinx/serialization/json/internal/Polymorphic.kt
similarity index 91%
rename from runtime/commonMain/src/kotlinx/serialization/json/internal/Polymorphic.kt
rename to formats/json/commonMain/src/kotlinx/serialization/json/internal/Polymorphic.kt
index 45abaab793..bceb808627 100644
--- a/runtime/commonMain/src/kotlinx/serialization/json/internal/Polymorphic.kt
+++ b/formats/json/commonMain/src/kotlinx/serialization/json/internal/Polymorphic.kt
@@ -16,7 +16,7 @@ internal inline fun JsonEncoder.encodePolymorphically(serializer: Serializat
serializer.serialize(this, value)
return
}
- val actualSerializer = findActualSerializer(serializer.cast(), value as Any)
+ val actualSerializer = findActualSerializer(serializer as SerializationStrategy, value as Any)
ifPolymorphic()
actualSerializer.serialize(this, value)
}
@@ -39,7 +39,8 @@ private fun validateIfSealed(
classDiscriminator: String
) {
if (serializer !is SealedClassSerializer<*>) return
- if (classDiscriminator in actualSerializer.descriptor.cachedSerialNames()) {
+ @Suppress("DEPRECATION_ERROR")
+ if (classDiscriminator in actualSerializer.descriptor.jsonCachedSerialNames()) {
val baseName = serializer.descriptor.serialName
val actualName = actualSerializer.descriptor.serialName
error(
@@ -65,9 +66,11 @@ internal fun JsonDecoder.decodeSerializableValuePolymorphic(deserializer: De
val jsonTree = cast(decodeJsonElement(), deserializer.descriptor)
val discriminator = json.configuration.classDiscriminator
val type = jsonTree[discriminator]?.jsonPrimitive?.content
- val actualSerializer = deserializer.findPolymorphicSerializerOrNull(this, type)?.cast()
+ val actualSerializer = deserializer.findPolymorphicSerializerOrNull(this, type)
?: throwSerializerNotFound(type, jsonTree)
- return json.readPolymorphicJson(discriminator, jsonTree, actualSerializer)
+
+ @Suppress("UNCHECKED_CAST")
+ return json.readPolymorphicJson(discriminator, jsonTree, actualSerializer as DeserializationStrategy)
}
private fun throwSerializerNotFound(type: String?, jsonTree: JsonObject): Nothing {
diff --git a/runtime/commonMain/src/kotlinx/serialization/json/internal/PolymorphismValidator.kt b/formats/json/commonMain/src/kotlinx/serialization/json/internal/PolymorphismValidator.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/json/internal/PolymorphismValidator.kt
rename to formats/json/commonMain/src/kotlinx/serialization/json/internal/PolymorphismValidator.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/json/internal/StreamingJsonDecoder.kt b/formats/json/commonMain/src/kotlinx/serialization/json/internal/StreamingJsonDecoder.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/json/internal/StreamingJsonDecoder.kt
rename to formats/json/commonMain/src/kotlinx/serialization/json/internal/StreamingJsonDecoder.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/json/internal/StreamingJsonEncoder.kt b/formats/json/commonMain/src/kotlinx/serialization/json/internal/StreamingJsonEncoder.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/json/internal/StreamingJsonEncoder.kt
rename to formats/json/commonMain/src/kotlinx/serialization/json/internal/StreamingJsonEncoder.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/json/internal/StringOps.kt b/formats/json/commonMain/src/kotlinx/serialization/json/internal/StringOps.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/json/internal/StringOps.kt
rename to formats/json/commonMain/src/kotlinx/serialization/json/internal/StringOps.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/json/internal/TreeJsonDecoder.kt b/formats/json/commonMain/src/kotlinx/serialization/json/internal/TreeJsonDecoder.kt
similarity index 93%
rename from runtime/commonMain/src/kotlinx/serialization/json/internal/TreeJsonDecoder.kt
rename to formats/json/commonMain/src/kotlinx/serialization/json/internal/TreeJsonDecoder.kt
index 1c53e54828..36ade24880 100644
--- a/runtime/commonMain/src/kotlinx/serialization/json/internal/TreeJsonDecoder.kt
+++ b/formats/json/commonMain/src/kotlinx/serialization/json/internal/TreeJsonDecoder.kt
@@ -10,7 +10,6 @@ package kotlinx.serialization.json.internal
import kotlinx.serialization.*
import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.*
-import kotlinx.serialization.encoding.updateModeDeprecated
import kotlinx.serialization.internal.*
import kotlinx.serialization.json.*
import kotlinx.serialization.modules.*
@@ -210,7 +209,8 @@ private open class JsonTreeDecoder(
override fun endStructure(descriptor: SerialDescriptor) {
if (configuration.ignoreUnknownKeys || descriptor.kind is PolymorphicKind) return
// Validate keys
- val names = descriptor.cachedSerialNames()
+ @Suppress("DEPRECATION_ERROR")
+ val names = descriptor.jsonCachedSerialNames()
for (key in value.keys) {
if (key !in names && key != polyDiscriminator) {
throw UnknownKeyException(key, value.toString())
@@ -264,3 +264,17 @@ private class JsonTreeListDecoder(json: Json, override val value: JsonArray) : A
return CompositeDecoder.DECODE_DONE
}
}
+
+internal const val updateModeDeprecated = "Update mode in Decoder is deprecated for removal. " +
+ "Update behaviour is now considered an implementation detail of the format that should not concern serializer."
+
+/**
+ * Same as [SerialDescriptor.getElementIndex], but throws [SerializationException] if
+ * given [name] is not associated with any element in the descriptor.
+ */
+internal fun SerialDescriptor.getElementIndexOrThrow(name: String): Int {
+ val index = getElementIndex(name)
+ if (index == CompositeDecoder.UNKNOWN_NAME)
+ throw SerializationException("$serialName does not contain element with name '$name'")
+ return index
+}
diff --git a/runtime/commonMain/src/kotlinx/serialization/json/internal/TreeJsonEncoder.kt b/formats/json/commonMain/src/kotlinx/serialization/json/internal/TreeJsonEncoder.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/json/internal/TreeJsonEncoder.kt
rename to formats/json/commonMain/src/kotlinx/serialization/json/internal/TreeJsonEncoder.kt
diff --git a/runtime/commonMain/src/kotlinx/serialization/json/internal/WriteMode.kt b/formats/json/commonMain/src/kotlinx/serialization/json/internal/WriteMode.kt
similarity index 100%
rename from runtime/commonMain/src/kotlinx/serialization/json/internal/WriteMode.kt
rename to formats/json/commonMain/src/kotlinx/serialization/json/internal/WriteMode.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/ClassWithMultipleMasksTest.kt b/formats/json/commonTest/src/kotlinx/serialization/ClassWithMultipleMasksTest.kt
similarity index 96%
rename from runtime/commonTest/src/kotlinx/serialization/ClassWithMultipleMasksTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/ClassWithMultipleMasksTest.kt
index 62d297c118..cc0158c192 100644
--- a/runtime/commonTest/src/kotlinx/serialization/ClassWithMultipleMasksTest.kt
+++ b/formats/json/commonTest/src/kotlinx/serialization/ClassWithMultipleMasksTest.kt
@@ -80,6 +80,6 @@ class ClassWithMultipleMasksTest {
assertEquals("f", field39)
assertEquals("required", requiredLast)
}
- assertFailsWith { Json.decodeFromString(BigDummyData.serializer(), """{"regular": "0"}""") }
+ assertFailsWith { Json.decodeFromString(BigDummyData.serializer(), """{"regular": "0"}""") }
}
}
diff --git a/runtime/commonTest/src/kotlinx/serialization/EnumSerializationTest.kt b/formats/json/commonTest/src/kotlinx/serialization/EnumSerializationTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/EnumSerializationTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/EnumSerializationTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/PolymorphismTestData.kt b/formats/json/commonTest/src/kotlinx/serialization/PolymorphismTestData.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/PolymorphismTestData.kt
rename to formats/json/commonTest/src/kotlinx/serialization/PolymorphismTestData.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/SerializableClasses.kt b/formats/json/commonTest/src/kotlinx/serialization/SerializableClasses.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/SerializableClasses.kt
rename to formats/json/commonTest/src/kotlinx/serialization/SerializableClasses.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/SerializationForNullableTypeOnFileTest.kt b/formats/json/commonTest/src/kotlinx/serialization/SerializationForNullableTypeOnFileTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/SerializationForNullableTypeOnFileTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/SerializationForNullableTypeOnFileTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/SerializerForNullableTypeTest.kt b/formats/json/commonTest/src/kotlinx/serialization/SerializerForNullableTypeTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/SerializerForNullableTypeTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/SerializerForNullableTypeTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/SerializersLookupTest.kt b/formats/json/commonTest/src/kotlinx/serialization/SerializersLookupTest.kt
similarity index 98%
rename from runtime/commonTest/src/kotlinx/serialization/SerializersLookupTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/SerializersLookupTest.kt
index 9fa5c34897..9927cc6658 100644
--- a/runtime/commonTest/src/kotlinx/serialization/SerializersLookupTest.kt
+++ b/formats/json/commonTest/src/kotlinx/serialization/SerializersLookupTest.kt
@@ -208,4 +208,7 @@ class SerializersLookupTest : JsonTestBase() {
val serial = serializer()
assertEquals(expected, json.encodeToString(serial, value))
}
+
+ inline fun KSerializer<*>.cast(): KSerializer = this as KSerializer
+
}
diff --git a/runtime/commonTest/src/kotlinx/serialization/TuplesTest.kt b/formats/json/commonTest/src/kotlinx/serialization/TuplesTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/TuplesTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/TuplesTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/UmbrellaTypes.kt b/formats/json/commonTest/src/kotlinx/serialization/UmbrellaTypes.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/UmbrellaTypes.kt
rename to formats/json/commonTest/src/kotlinx/serialization/UmbrellaTypes.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/UnknownElementIndexTest.kt b/formats/json/commonTest/src/kotlinx/serialization/UnknownElementIndexTest.kt
similarity index 86%
rename from runtime/commonTest/src/kotlinx/serialization/UnknownElementIndexTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/UnknownElementIndexTest.kt
index 38bd1dff9c..185f821714 100644
--- a/runtime/commonTest/src/kotlinx/serialization/UnknownElementIndexTest.kt
+++ b/formats/json/commonTest/src/kotlinx/serialization/UnknownElementIndexTest.kt
@@ -1,7 +1,3 @@
-/*
- * Copyright 2017-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
package kotlinx.serialization
import kotlinx.serialization.descriptors.*
@@ -25,7 +21,7 @@ class UnknownElementIndexTest {
@Test
fun testCompilerComplainsAboutIncorrectIndex() {
- assertFailsWith(UnknownFieldException::class) {
+ assertFailsWith(SerializationException::class) {
MalformedReader().decodeSerializableValue(Holder.serializer())
}
}
diff --git a/runtime/commonTest/src/kotlinx/serialization/builtins/KeyValueSerializersTest.kt b/formats/json/commonTest/src/kotlinx/serialization/builtins/KeyValueSerializersTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/builtins/KeyValueSerializersTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/builtins/KeyValueSerializersTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/features/BinaryPayloadExampleTest.kt b/formats/json/commonTest/src/kotlinx/serialization/features/BinaryPayloadExampleTest.kt
similarity index 94%
rename from runtime/commonTest/src/kotlinx/serialization/features/BinaryPayloadExampleTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/features/BinaryPayloadExampleTest.kt
index f9ef4e1d05..c1a9873551 100644
--- a/runtime/commonTest/src/kotlinx/serialization/features/BinaryPayloadExampleTest.kt
+++ b/formats/json/commonTest/src/kotlinx/serialization/features/BinaryPayloadExampleTest.kt
@@ -8,8 +8,8 @@ import kotlinx.serialization.*
import kotlinx.serialization.builtins.*
import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.*
-import kotlinx.serialization.internal.*
import kotlinx.serialization.json.Json
+import kotlinx.serialization.test.*
import kotlin.test.Test
import kotlin.test.assertEquals
@@ -44,8 +44,8 @@ class BinaryPayloadExampleTest {
}
dec.endStructure(descriptor)
return BinaryPayload(
- req ?: throw MissingFieldException("req"),
- res ?: throw MissingFieldException("res")
+ req ?: throw SerializationException("MFE: req"),
+ res ?: throw SerializationException("MFE: res")
)
}
}
diff --git a/runtime/commonTest/src/kotlinx/serialization/features/ByteArraySerializerTest.kt b/formats/json/commonTest/src/kotlinx/serialization/features/ByteArraySerializerTest.kt
similarity index 97%
rename from runtime/commonTest/src/kotlinx/serialization/features/ByteArraySerializerTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/features/ByteArraySerializerTest.kt
index d6e41a22f5..aa1ad2d038 100644
--- a/runtime/commonTest/src/kotlinx/serialization/features/ByteArraySerializerTest.kt
+++ b/formats/json/commonTest/src/kotlinx/serialization/features/ByteArraySerializerTest.kt
@@ -7,6 +7,7 @@ package kotlinx.serialization.features
import kotlinx.serialization.*
import kotlinx.serialization.builtins.*
import kotlinx.serialization.json.Json
+import kotlinx.serialization.test.*
import kotlin.test.*
class ByteArraySerializerTest {
diff --git a/runtime/commonTest/src/kotlinx/serialization/features/ContextAndPolymorphicTest.kt b/formats/json/commonTest/src/kotlinx/serialization/features/ContextAndPolymorphicTest.kt
similarity index 99%
rename from runtime/commonTest/src/kotlinx/serialization/features/ContextAndPolymorphicTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/features/ContextAndPolymorphicTest.kt
index 9d9e25f267..eb9cb398d0 100644
--- a/runtime/commonTest/src/kotlinx/serialization/features/ContextAndPolymorphicTest.kt
+++ b/formats/json/commonTest/src/kotlinx/serialization/features/ContextAndPolymorphicTest.kt
@@ -12,6 +12,7 @@ import kotlinx.serialization.encoding.*
import kotlinx.serialization.internal.*
import kotlinx.serialization.json.*
import kotlinx.serialization.modules.*
+import kotlinx.serialization.test.InternalHexConverter
import kotlin.test.*
class ContextAndPolymorphicTest {
diff --git a/runtime/commonTest/src/kotlinx/serialization/features/GenericCustomSerializerTest.kt b/formats/json/commonTest/src/kotlinx/serialization/features/GenericCustomSerializerTest.kt
similarity index 98%
rename from runtime/commonTest/src/kotlinx/serialization/features/GenericCustomSerializerTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/features/GenericCustomSerializerTest.kt
index 33d2a382da..20b626f210 100644
--- a/runtime/commonTest/src/kotlinx/serialization/features/GenericCustomSerializerTest.kt
+++ b/formats/json/commonTest/src/kotlinx/serialization/features/GenericCustomSerializerTest.kt
@@ -8,8 +8,8 @@ import kotlinx.serialization.*
import kotlinx.serialization.builtins.*
import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.*
-import kotlinx.serialization.internal.*
import kotlinx.serialization.json.*
+import kotlinx.serialization.test.InternalHexConverter
import kotlin.test.*
class CheckedData(val data: T, val checkSum: ByteArray) {
diff --git a/runtime/commonTest/src/kotlinx/serialization/features/InheritanceTest.kt b/formats/json/commonTest/src/kotlinx/serialization/features/InheritanceTest.kt
similarity index 95%
rename from runtime/commonTest/src/kotlinx/serialization/features/InheritanceTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/features/InheritanceTest.kt
index ce53f8d2bf..f91fde93b4 100644
--- a/runtime/commonTest/src/kotlinx/serialization/features/InheritanceTest.kt
+++ b/formats/json/commonTest/src/kotlinx/serialization/features/InheritanceTest.kt
@@ -8,7 +8,9 @@ package kotlinx.serialization.features
import kotlinx.serialization.*
import kotlinx.serialization.json.Json
+import kotlinx.serialization.test.*
import kotlin.test.*
+import kotlin.test.assertTrue
@Serializable
abstract class AbstractSerializable {
@@ -91,7 +93,7 @@ class InheritanceTest {
val d2 = Json.decodeFromString(SerializableBase.serializer(), msg)
assertEquals(SerializableBase(), d2)
// no derivedState
- assertFailsWith { Json.decodeFromString(Derived.serializer(), msg) }
+ assertFailsWithMissingField { Json.decodeFromString(Derived.serializer(), msg) }
}
@Test
diff --git a/runtime/commonTest/src/kotlinx/serialization/features/LongAsStringTest.kt b/formats/json/commonTest/src/kotlinx/serialization/features/LongAsStringTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/features/LongAsStringTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/features/LongAsStringTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/features/ObjectSerialization.kt b/formats/json/commonTest/src/kotlinx/serialization/features/ObjectSerialization.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/features/ObjectSerialization.kt
rename to formats/json/commonTest/src/kotlinx/serialization/features/ObjectSerialization.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/features/PartiallyCustomSerializerTest.kt b/formats/json/commonTest/src/kotlinx/serialization/features/PartiallyCustomSerializerTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/features/PartiallyCustomSerializerTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/features/PartiallyCustomSerializerTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/features/PolymorphicOnClassesTest.kt b/formats/json/commonTest/src/kotlinx/serialization/features/PolymorphicOnClassesTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/features/PolymorphicOnClassesTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/features/PolymorphicOnClassesTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/features/PolymorphismTest.kt b/formats/json/commonTest/src/kotlinx/serialization/features/PolymorphismTest.kt
similarity index 99%
rename from runtime/commonTest/src/kotlinx/serialization/features/PolymorphismTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/features/PolymorphismTest.kt
index 4e3a23e56d..fd9cfe4047 100644
--- a/runtime/commonTest/src/kotlinx/serialization/features/PolymorphismTest.kt
+++ b/formats/json/commonTest/src/kotlinx/serialization/features/PolymorphismTest.kt
@@ -7,6 +7,7 @@ package kotlinx.serialization.features
import kotlinx.serialization.*
import kotlinx.serialization.json.*
import kotlinx.serialization.modules.*
+import kotlinx.serialization.test.*
import kotlin.test.*
class PolymorphismTest : JsonTestBase() {
diff --git a/runtime/commonTest/src/kotlinx/serialization/features/PolymorphismWithAnyTest.kt b/formats/json/commonTest/src/kotlinx/serialization/features/PolymorphismWithAnyTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/features/PolymorphismWithAnyTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/features/PolymorphismWithAnyTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/features/PrimitiveArraySerializersTest.kt b/formats/json/commonTest/src/kotlinx/serialization/features/PrimitiveArraySerializersTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/features/PrimitiveArraySerializersTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/features/PrimitiveArraySerializersTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/features/SealedClassesSerializationTest.kt b/formats/json/commonTest/src/kotlinx/serialization/features/SealedClassesSerializationTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/features/SealedClassesSerializationTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/features/SealedClassesSerializationTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/features/SealedPolymorphismTest.kt b/formats/json/commonTest/src/kotlinx/serialization/features/SealedPolymorphismTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/features/SealedPolymorphismTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/features/SealedPolymorphismTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/features/SerializableOnTypeUsageTest.kt b/formats/json/commonTest/src/kotlinx/serialization/features/SerializableOnTypeUsageTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/features/SerializableOnTypeUsageTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/features/SerializableOnTypeUsageTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/features/SerializableWithTest.kt b/formats/json/commonTest/src/kotlinx/serialization/features/SerializableWithTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/features/SerializableWithTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/features/SerializableWithTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/features/SkipDefaults.kt b/formats/json/commonTest/src/kotlinx/serialization/features/SkipDefaults.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/features/SkipDefaults.kt
rename to formats/json/commonTest/src/kotlinx/serialization/features/SkipDefaults.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/features/UseSerializersTest.kt b/formats/json/commonTest/src/kotlinx/serialization/features/UseSerializersTest.kt
similarity index 60%
rename from runtime/commonTest/src/kotlinx/serialization/features/UseSerializersTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/features/UseSerializersTest.kt
index 79b4f9726a..69907efd1d 100644
--- a/runtime/commonTest/src/kotlinx/serialization/features/UseSerializersTest.kt
+++ b/formats/json/commonTest/src/kotlinx/serialization/features/UseSerializersTest.kt
@@ -1,17 +1,5 @@
/*
- * Copyright 2019 JetBrains s.r.o.
- *
- * Licensed 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.
+ * Copyright 2017-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
@file:UseSerializers(MultiplyingIntHolderSerializer::class, MultiplyingIntSerializer::class)
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/BasicTypesSerializationTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/BasicTypesSerializationTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/BasicTypesSerializationTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/BasicTypesSerializationTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/JsonBuildersTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/JsonBuildersTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/JsonBuildersTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/JsonBuildersTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/JsonConfigurationTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/JsonConfigurationTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/JsonConfigurationTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/JsonConfigurationTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/JsonCustomSerializersTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/JsonCustomSerializersTest.kt
similarity index 99%
rename from runtime/commonTest/src/kotlinx/serialization/json/JsonCustomSerializersTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/JsonCustomSerializersTest.kt
index 713dcd9de5..d3fc33c5e8 100644
--- a/runtime/commonTest/src/kotlinx/serialization/json/JsonCustomSerializersTest.kt
+++ b/formats/json/commonTest/src/kotlinx/serialization/json/JsonCustomSerializersTest.kt
@@ -10,6 +10,7 @@ import kotlinx.serialization.builtins.*
import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.*
import kotlinx.serialization.modules.*
+import kotlinx.serialization.test.*
import kotlin.test.*
class JsonCustomSerializersTest : JsonTestBase() {
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/JsonDefaultContextTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/JsonDefaultContextTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/JsonDefaultContextTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/JsonDefaultContextTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/JsonEncoderDecoderRecursiveTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/JsonEncoderDecoderRecursiveTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/JsonEncoderDecoderRecursiveTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/JsonEncoderDecoderRecursiveTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/JsonGenericTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/JsonGenericTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/JsonGenericTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/JsonGenericTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/JsonMapKeysTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/JsonMapKeysTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/JsonMapKeysTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/JsonMapKeysTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/JsonModesTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/JsonModesTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/JsonModesTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/JsonModesTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/JsonNumericKeysTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/JsonNumericKeysTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/JsonNumericKeysTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/JsonNumericKeysTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/JsonOptionalTests.kt b/formats/json/commonTest/src/kotlinx/serialization/json/JsonOptionalTests.kt
similarity index 95%
rename from runtime/commonTest/src/kotlinx/serialization/json/JsonOptionalTests.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/JsonOptionalTests.kt
index 1167ec625e..570e2ca42e 100644
--- a/runtime/commonTest/src/kotlinx/serialization/json/JsonOptionalTests.kt
+++ b/formats/json/commonTest/src/kotlinx/serialization/json/JsonOptionalTests.kt
@@ -5,6 +5,7 @@
package kotlinx.serialization.json
import kotlinx.serialization.*
+import kotlinx.serialization.test.*
import kotlin.test.*
class JsonOptionalTests : JsonTestBase() {
@@ -45,9 +46,8 @@ class JsonOptionalTests : JsonTestBase() {
@Test
fun testThrowMissingField() = parametrizedTest { useStreaming ->
- assertFailsWith(MissingFieldException::class) {
+ assertFailsWithMissingField {
lenient.decodeFromString(Data.serializer(), "{b:0}", useStreaming)
}
}
-
}
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/JsonParserFailureModesTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/JsonParserFailureModesTest.kt
similarity index 93%
rename from runtime/commonTest/src/kotlinx/serialization/json/JsonParserFailureModesTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/JsonParserFailureModesTest.kt
index 17ff8902cd..e1ab08e6fc 100644
--- a/runtime/commonTest/src/kotlinx/serialization/json/JsonParserFailureModesTest.kt
+++ b/formats/json/commonTest/src/kotlinx/serialization/json/JsonParserFailureModesTest.kt
@@ -6,6 +6,7 @@ package kotlinx.serialization.json
import kotlinx.serialization.*
import kotlinx.serialization.json.internal.*
+import kotlinx.serialization.test.*
import kotlin.test.*
class JsonParserFailureModesTest : JsonTestBase() {
@@ -26,7 +27,7 @@ class JsonParserFailureModesTest : JsonTestBase() {
assertFailsWith { default.decodeFromString(Holder.serializer(), """{"id}""", it) }
assertFailsWith { default.decodeFromString(Holder.serializer(), """{"i}""", it) }
assertFailsWith { default.decodeFromString(Holder.serializer(), """{"}""", it) }
- assertFailsWith { default.decodeFromString(Holder.serializer(), """{}""", it) }
+ assertFailsWithMissingField { default.decodeFromString(Holder.serializer(), """{}""", it) }
assertFailsWith { default.decodeFromString(Holder.serializer(), """{""", it) }
assertFailsWith { default.decodeFromString(Holder.serializer(), """}""", it) }
assertFailsWith { default.decodeFromString(Holder.serializer(), """{""", it) }
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/JsonParserTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/JsonParserTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/JsonParserTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/JsonParserTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/JsonReifiedCollectionsTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/JsonReifiedCollectionsTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/JsonReifiedCollectionsTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/JsonReifiedCollectionsTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/JsonRootLevelNullTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/JsonRootLevelNullTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/JsonRootLevelNullTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/JsonRootLevelNullTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/JsonSealedSubclassTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/JsonSealedSubclassTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/JsonSealedSubclassTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/JsonSealedSubclassTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/JsonTestBase.kt b/formats/json/commonTest/src/kotlinx/serialization/json/JsonTestBase.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/JsonTestBase.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/JsonTestBase.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/JsonTransformingSerializerTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/JsonTransformingSerializerTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/JsonTransformingSerializerTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/JsonTransformingSerializerTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/JsonTransientTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/JsonTransientTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/JsonTransientTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/JsonTransientTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/JsonTreeAndMapperTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/JsonTreeAndMapperTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/JsonTreeAndMapperTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/JsonTreeAndMapperTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/JsonTreeTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/JsonTreeTest.kt
similarity index 96%
rename from runtime/commonTest/src/kotlinx/serialization/json/JsonTreeTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/JsonTreeTest.kt
index f1e1bbae40..3506e1f8b7 100644
--- a/runtime/commonTest/src/kotlinx/serialization/json/JsonTreeTest.kt
+++ b/formats/json/commonTest/src/kotlinx/serialization/json/JsonTreeTest.kt
@@ -5,7 +5,9 @@
package kotlinx.serialization.json
import kotlinx.serialization.*
+import kotlinx.serialization.test.*
import kotlin.test.*
+import kotlin.test.assertTrue
class JsonTreeTest : JsonTestBase() {
@Serializable
@@ -77,7 +79,7 @@ class JsonTreeTest : JsonTestBase() {
val tree2 = prepare("""{s:"foo"}""")
assertEquals(DataWrapper("foo", null), lenient.decodeFromJsonElement(DataWrapper.serializer(), tree1))
- assertFailsWith(MissingFieldException::class) { lenient.decodeFromJsonElement(DataWrapper.serializer(), tree2) }
+ assertFailsWithMissingField { lenient.decodeFromJsonElement(DataWrapper.serializer(), tree2) }
}
@Test
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/JsonUnionEnumTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/JsonUnionEnumTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/JsonUnionEnumTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/JsonUnionEnumTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/JsonUpdateModeTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/JsonUpdateModeTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/JsonUpdateModeTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/JsonUpdateModeTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/JsonUseDefaultOnNullAndUnknownTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/JsonUseDefaultOnNullAndUnknownTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/JsonUseDefaultOnNullAndUnknownTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/JsonUseDefaultOnNullAndUnknownTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/LenientTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/LenientTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/LenientTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/LenientTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/MapLikeSerializerTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/MapLikeSerializerTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/MapLikeSerializerTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/MapLikeSerializerTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/SpecialFloatingPointValuesTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/SpecialFloatingPointValuesTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/SpecialFloatingPointValuesTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/SpecialFloatingPointValuesTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/polymorphic/JsonContentPolymorphicSerializerTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonContentPolymorphicSerializerTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/polymorphic/JsonContentPolymorphicSerializerTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonContentPolymorphicSerializerTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/polymorphic/JsonDeserializePolymorphicTwiceTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonDeserializePolymorphicTwiceTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/polymorphic/JsonDeserializePolymorphicTwiceTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonDeserializePolymorphicTwiceTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/polymorphic/JsonListPolymorphismTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonListPolymorphismTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/polymorphic/JsonListPolymorphismTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonListPolymorphismTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/polymorphic/JsonMapPolymorphismTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonMapPolymorphismTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/polymorphic/JsonMapPolymorphismTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonMapPolymorphismTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/polymorphic/JsonNestedPolymorphismTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonNestedPolymorphismTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/polymorphic/JsonNestedPolymorphismTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonNestedPolymorphismTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/polymorphic/JsonNullablePolymorphicTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonNullablePolymorphicTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/polymorphic/JsonNullablePolymorphicTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonNullablePolymorphicTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPolymorphicClassDescriptorTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPolymorphicClassDescriptorTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPolymorphicClassDescriptorTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPolymorphicClassDescriptorTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPolymorphicObjectTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPolymorphicObjectTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPolymorphicObjectTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPolymorphicObjectTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPolymorphismExceptionTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPolymorphismExceptionTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPolymorphismExceptionTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPolymorphismExceptionTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/polymorphic/JsonProhibitedPolymorphicKindsTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonProhibitedPolymorphicKindsTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/polymorphic/JsonProhibitedPolymorphicKindsTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonProhibitedPolymorphicKindsTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPropertyPolymorphicTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPropertyPolymorphicTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPropertyPolymorphicTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/JsonPropertyPolymorphicTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/polymorphic/PolymorphicClasses.kt b/formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/PolymorphicClasses.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/polymorphic/PolymorphicClasses.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/polymorphic/PolymorphicClasses.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/serializers/JsonArraySerializerTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonArraySerializerTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/serializers/JsonArraySerializerTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonArraySerializerTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/serializers/JsonNativePrimitivesTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonNativePrimitivesTest.kt
similarity index 79%
rename from runtime/commonTest/src/kotlinx/serialization/json/serializers/JsonNativePrimitivesTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonNativePrimitivesTest.kt
index f97b24de04..0afbc052d4 100644
--- a/runtime/commonTest/src/kotlinx/serialization/json/serializers/JsonNativePrimitivesTest.kt
+++ b/formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonNativePrimitivesTest.kt
@@ -4,11 +4,9 @@
package kotlinx.serialization.json.serializers
-import kotlinx.serialization.SampleEnum
import kotlinx.serialization.json.JsonTestBase
import kotlinx.serialization.*
import kotlinx.serialization.builtins.*
-import kotlinx.serialization.test.EnumSerializer
import kotlin.Char.*
import kotlin.test.Test
@@ -25,10 +23,6 @@ class JsonNativePrimitivesTest : JsonTestBase() {
@Test
fun testTopLevelNativeBoolean() = assertJsonFormAndRestored(Boolean.serializer(), true, "true", default)
- @Test
- fun testTopLevelNativeEnum() =
- assertJsonFormAndRestored(EnumSerializer("SampleEnum"), SampleEnum.OptionB, "\"OptionB\"", default)
-
@Test
fun testTopLevelNativeNullable() =
assertJsonFormAndRestored(Int.serializer().nullable, null, "null", default)
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/serializers/JsonNullSerializerTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonNullSerializerTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/serializers/JsonNullSerializerTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonNullSerializerTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/serializers/JsonObjectSerializerTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonObjectSerializerTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/serializers/JsonObjectSerializerTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonObjectSerializerTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/serializers/JsonPrimitiveSerializerTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonPrimitiveSerializerTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/serializers/JsonPrimitiveSerializerTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonPrimitiveSerializerTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/serializers/JsonSerializerInGenericsTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonSerializerInGenericsTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/serializers/JsonSerializerInGenericsTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonSerializerInGenericsTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/serializers/JsonTreeTest.kt b/formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonTreeTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/serializers/JsonTreeTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/serializers/JsonTreeTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/json/serializers/Primitives.kt b/formats/json/commonTest/src/kotlinx/serialization/json/serializers/Primitives.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/json/serializers/Primitives.kt
rename to formats/json/commonTest/src/kotlinx/serialization/json/serializers/Primitives.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/modules/SerialNameCollisionInSealedClassesTest.kt b/formats/json/commonTest/src/kotlinx/serialization/modules/SerialNameCollisionInSealedClassesTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/modules/SerialNameCollisionInSealedClassesTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/modules/SerialNameCollisionInSealedClassesTest.kt
diff --git a/runtime/commonTest/src/kotlinx/serialization/modules/SerialNameCollisionTest.kt b/formats/json/commonTest/src/kotlinx/serialization/modules/SerialNameCollisionTest.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/modules/SerialNameCollisionTest.kt
rename to formats/json/commonTest/src/kotlinx/serialization/modules/SerialNameCollisionTest.kt
diff --git a/formats/json/commonTest/src/kotlinx/serialization/test/CurrentPlatform.common.kt b/formats/json/commonTest/src/kotlinx/serialization/test/CurrentPlatform.common.kt
new file mode 100644
index 0000000000..c4a6b986a6
--- /dev/null
+++ b/formats/json/commonTest/src/kotlinx/serialization/test/CurrentPlatform.common.kt
@@ -0,0 +1,16 @@
+/*
+ * Copyright 2017-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
+ */
+
+package kotlinx.serialization.test
+
+enum class Platform {
+ JVM, JS_LEGACY, JS_IR, NATIVE
+}
+
+public expect val currentPlatform: Platform
+
+public fun isJs(): Boolean = currentPlatform == Platform.JS_LEGACY || currentPlatform == Platform.JS_IR
+public fun isJsLegacy(): Boolean = currentPlatform == Platform.JS_LEGACY
+public fun isJvm(): Boolean = currentPlatform == Platform.JVM
+public fun isNative(): Boolean = currentPlatform == Platform.NATIVE
diff --git a/formats/json/commonTest/src/kotlinx/serialization/test/InternalHexConverter.kt b/formats/json/commonTest/src/kotlinx/serialization/test/InternalHexConverter.kt
new file mode 100644
index 0000000000..413ce70cba
--- /dev/null
+++ b/formats/json/commonTest/src/kotlinx/serialization/test/InternalHexConverter.kt
@@ -0,0 +1,47 @@
+package kotlinx.serialization.test
+
+object InternalHexConverter {
+ private const val hexCode = "0123456789ABCDEF"
+
+ fun parseHexBinary(s: String): ByteArray {
+ val len = s.length
+ require(len % 2 == 0) { "HexBinary string must be even length" }
+ val bytes = ByteArray(len / 2)
+ var i = 0
+
+ while (i < len) {
+ val h = hexToInt(s[i])
+ val l = hexToInt(s[i + 1])
+ require(!(h == -1 || l == -1)) { "Invalid hex chars: ${s[i]}${s[i+1]}" }
+
+ bytes[i / 2] = ((h shl 4) + l).toByte()
+ i += 2
+ }
+
+ return bytes
+ }
+
+ private fun hexToInt(ch: Char): Int = when (ch) {
+ in '0'..'9' -> ch - '0'
+ in 'A'..'F' -> ch - 'A' + 10
+ in 'a'..'f' -> ch - 'a' + 10
+ else -> -1
+ }
+
+ fun printHexBinary(data: ByteArray, lowerCase: Boolean = false): String {
+ val r = StringBuilder(data.size * 2)
+ for (b in data) {
+ r.append(hexCode[b.toInt() shr 4 and 0xF])
+ r.append(hexCode[b.toInt() and 0xF])
+ }
+ return if (lowerCase) r.toString().toLowerCase() else r.toString()
+ }
+
+ fun toHexString(n: Int): String {
+ val arr = ByteArray(4)
+ for (i in 0 until 4) {
+ arr[i] = (n shr (24 - i * 8)).toByte()
+ }
+ return printHexBinary(arr, true).trimStart('0').takeIf { it.isNotEmpty() } ?: "0"
+ }
+}
diff --git a/formats/json/commonTest/src/kotlinx/serialization/test/TestHelpers.kt b/formats/json/commonTest/src/kotlinx/serialization/test/TestHelpers.kt
new file mode 100644
index 0000000000..de6bd7e283
--- /dev/null
+++ b/formats/json/commonTest/src/kotlinx/serialization/test/TestHelpers.kt
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2017-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
+ */
+package kotlinx.serialization.test
+
+import kotlinx.serialization.*
+import kotlinx.serialization.descriptors.*
+import kotlin.test.*
+
+fun SerialDescriptor.assertDescriptorEqualsTo(other: SerialDescriptor) {
+ assertEquals(serialName, other.serialName)
+ assertEquals(elementsCount, other.elementsCount)
+ assertEquals(isNullable, other.isNullable)
+ assertEquals(annotations, other.annotations)
+ assertEquals(kind, other.kind)
+ for (i in 0 until elementsCount) {
+ getElementDescriptor(i).assertDescriptorEqualsTo(other.getElementDescriptor(i))
+ val name = getElementName(i)
+ val otherName = other.getElementName(i)
+ assertEquals(name, otherName)
+ assertEquals(getElementAnnotations(i), other.getElementAnnotations(i))
+ assertEquals(name, otherName)
+ assertEquals(isElementOptional(i), other.isElementOptional(i))
+ }
+}
+
+inline fun noJs(test: () -> Unit) {
+ if (!isJs()) test()
+}
+
+inline fun jvmOnly(test: () -> Unit) {
+ if (isJvm()) test()
+}
+
+inline fun assertFailsWithMissingField(block: () -> Unit) {
+ val e = assertFailsWith(block = block)
+ assertTrue(e.message?.contains("but it was missing") ?: false)
+}
diff --git a/formats/json/commonTest/src/kotlinx/serialization/test/TestId.kt b/formats/json/commonTest/src/kotlinx/serialization/test/TestId.kt
new file mode 100644
index 0000000000..c4af25e511
--- /dev/null
+++ b/formats/json/commonTest/src/kotlinx/serialization/test/TestId.kt
@@ -0,0 +1,12 @@
+/*
+ * Copyright 2017-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
+ */
+
+package kotlinx.serialization.test
+
+import kotlinx.serialization.*
+import kotlinx.serialization.descriptors.*
+
+@SerialInfo
+@Target(AnnotationTarget.PROPERTY)
+annotation class Id(val id: Int)
diff --git a/runtime/commonTest/src/kotlinx/serialization/test/TestingFramework.kt b/formats/json/commonTest/src/kotlinx/serialization/test/TestingFramework.kt
similarity index 100%
rename from runtime/commonTest/src/kotlinx/serialization/test/TestingFramework.kt
rename to formats/json/commonTest/src/kotlinx/serialization/test/TestingFramework.kt
diff --git a/runtime/jsMain/src/kotlinx/serialization/Dynamics.kt b/formats/json/jsMain/src/kotlinx/serialization/Dynamics.kt
similarity index 100%
rename from runtime/jsMain/src/kotlinx/serialization/Dynamics.kt
rename to formats/json/jsMain/src/kotlinx/serialization/Dynamics.kt
diff --git a/runtime/jsMain/src/kotlinx/serialization/DynamicsMigration.kt b/formats/json/jsMain/src/kotlinx/serialization/DynamicsMigration.kt
similarity index 94%
rename from runtime/jsMain/src/kotlinx/serialization/DynamicsMigration.kt
rename to formats/json/jsMain/src/kotlinx/serialization/DynamicsMigration.kt
index 4121bb4a5a..c39001de39 100644
--- a/runtime/jsMain/src/kotlinx/serialization/DynamicsMigration.kt
+++ b/formats/json/jsMain/src/kotlinx/serialization/DynamicsMigration.kt
@@ -48,3 +48,7 @@ public fun Json.serialize(strategy: SerializationStrategy, obj: T): dynam
@Deprecated(serializerMessage, ReplaceWith("encodeToDynamic(obj)"), level = DeprecationLevel.ERROR)
public inline fun Json.serialize(obj: T): dynamic = noImpl()
+
+@PublishedApi
+internal fun noImpl(): Nothing = throw UnsupportedOperationException("Not implemented, should not be called")
+
diff --git a/runtime/jsMain/src/kotlinx/serialization/internal/DynamicObjectParser.kt b/formats/json/jsMain/src/kotlinx/serialization/internal/DynamicObjectParser.kt
similarity index 92%
rename from runtime/jsMain/src/kotlinx/serialization/internal/DynamicObjectParser.kt
rename to formats/json/jsMain/src/kotlinx/serialization/internal/DynamicObjectParser.kt
index de5bc99d0d..3ee6edf57e 100644
--- a/runtime/jsMain/src/kotlinx/serialization/internal/DynamicObjectParser.kt
+++ b/formats/json/jsMain/src/kotlinx/serialization/internal/DynamicObjectParser.kt
@@ -7,7 +7,6 @@ package kotlinx.serialization.internal
import kotlinx.serialization.*
import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.*
-import kotlinx.serialization.json.*
import kotlinx.serialization.json.internal.*
import kotlinx.serialization.modules.*
import kotlin.math.*
@@ -43,8 +42,8 @@ internal class DynamicObjectParser(
return CompositeDecoder.DECODE_DONE
}
- override fun decodeTaggedEnum(tag: String, enumDescription: SerialDescriptor): Int =
- enumDescription.getElementIndexOrThrow(getByTag(tag) as String)
+ override fun decodeTaggedEnum(tag: String, enumDescriptor: SerialDescriptor): Int =
+ enumDescriptor.getElementIndexOrThrow(getByTag(tag) as String)
protected open fun getByTag(tag: String): dynamic = obj[tag]
@@ -70,17 +69,21 @@ internal class DynamicObjectParser(
}
override fun decodeTaggedValue(tag: String): Any {
- val o = getByTag(tag) ?: throw MissingFieldException(tag)
+ val o = getByTag(tag) ?: throwMissingTag(tag)
return o as Any
}
override fun decodeTaggedNotNullMark(tag: String): Boolean {
val o = getByTag(tag)
- if (o === undefined) throw MissingFieldException(tag)
+ if (o === undefined) throwMissingTag(tag)
@Suppress("SENSELESS_COMPARISON") // null !== undefined !
return o != null
}
+ private fun throwMissingTag(tag: String) {
+ throw SerializationException("Value for field $tag is missing")
+ }
+
override fun beginStructure(descriptor: SerialDescriptor): CompositeDecoder {
val curObj = currentTagOrNull?.let { obj[it] } ?: obj
val kind = when (descriptor.kind) {
diff --git a/runtime/jsMain/src/kotlinx/serialization/internal/DynamicObjectSerializer.kt b/formats/json/jsMain/src/kotlinx/serialization/internal/DynamicObjectSerializer.kt
similarity index 99%
rename from runtime/jsMain/src/kotlinx/serialization/internal/DynamicObjectSerializer.kt
rename to formats/json/jsMain/src/kotlinx/serialization/internal/DynamicObjectSerializer.kt
index 3204cc3c8b..7cc27308c5 100644
--- a/runtime/jsMain/src/kotlinx/serialization/internal/DynamicObjectSerializer.kt
+++ b/formats/json/jsMain/src/kotlinx/serialization/internal/DynamicObjectSerializer.kt
@@ -12,7 +12,6 @@ import kotlinx.serialization.json.internal.*
import kotlinx.serialization.modules.*
import kotlin.math.*
-
/**
* Converts Kotlin data structures to plain Javascript objects
*
diff --git a/runtime/jsTest/src/kotlinx/serialization/DynamicParserTest.kt b/formats/json/jsTest/src/kotlinx/serialization/json/DynamicParserTest.kt
similarity index 96%
rename from runtime/jsTest/src/kotlinx/serialization/DynamicParserTest.kt
rename to formats/json/jsTest/src/kotlinx/serialization/json/DynamicParserTest.kt
index bfdde9032c..2660450689 100644
--- a/runtime/jsTest/src/kotlinx/serialization/DynamicParserTest.kt
+++ b/formats/json/jsTest/src/kotlinx/serialization/json/DynamicParserTest.kt
@@ -2,13 +2,15 @@
* Copyright 2017-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.serialization
+package kotlinx.serialization.json
import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.*
-import kotlinx.serialization.json.*
+import kotlinx.serialization.*
import kotlinx.serialization.modules.*
+import kotlinx.serialization.test.*
import kotlin.test.*
+import kotlin.test.assertFailsWith
class DynamicParserTest {
@Serializable
@@ -116,13 +118,13 @@ class DynamicParserTest {
val dyn3 = js("""({s:"foo", d: undefined})""")
assertEquals(DataWrapper("foo", null), Json.decodeFromDynamic(DataWrapper.serializer(), dyn1))
- assertFailsWith(MissingFieldException::class) {
+ assertFailsWithMissingField {
Json.decodeFromDynamic(
DataWrapper.serializer(),
dyn2
)
}
- assertFailsWith(MissingFieldException::class) {
+ assertFailsWithMissingField {
Json.decodeFromDynamic(
DataWrapper.serializer(),
dyn3
diff --git a/runtime/jsTest/src/kotlinx/serialization/DynamicSerializerTest.kt b/formats/json/jsTest/src/kotlinx/serialization/json/DynamicSerializerTest.kt
similarity index 99%
rename from runtime/jsTest/src/kotlinx/serialization/DynamicSerializerTest.kt
rename to formats/json/jsTest/src/kotlinx/serialization/json/DynamicSerializerTest.kt
index 71e591eb74..65d047f494 100644
--- a/runtime/jsTest/src/kotlinx/serialization/DynamicSerializerTest.kt
+++ b/formats/json/jsTest/src/kotlinx/serialization/json/DynamicSerializerTest.kt
@@ -2,14 +2,14 @@
* Copyright 2017-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.serialization
+package kotlinx.serialization.json
import kotlinx.serialization.builtins.*
import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.*
import kotlinx.serialization.internal.DynamicObjectSerializer
import kotlinx.serialization.internal.MAX_SAFE_INTEGER
-import kotlinx.serialization.json.*
+import kotlinx.serialization.*
import kotlinx.serialization.json.internal.*
import kotlinx.serialization.modules.*
import kotlin.test.*
diff --git a/runtime/jsTest/src/kotlinx/serialization/DynamicToLongTest.kt b/formats/json/jsTest/src/kotlinx/serialization/json/DynamicToLongTest.kt
similarity index 96%
rename from runtime/jsTest/src/kotlinx/serialization/DynamicToLongTest.kt
rename to formats/json/jsTest/src/kotlinx/serialization/json/DynamicToLongTest.kt
index 7e38adf2e7..35b037cd7a 100644
--- a/runtime/jsTest/src/kotlinx/serialization/DynamicToLongTest.kt
+++ b/formats/json/jsTest/src/kotlinx/serialization/json/DynamicToLongTest.kt
@@ -2,10 +2,10 @@
* Copyright 2017-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.serialization
+package kotlinx.serialization.json
import kotlinx.serialization.internal.*
-import kotlinx.serialization.json.*
+import kotlinx.serialization.*
import kotlin.test.*
class DynamicToLongTest {
diff --git a/formats/json/jsTest/src/kotlinx/serialization/test/CurrentPlatform.kt b/formats/json/jsTest/src/kotlinx/serialization/test/CurrentPlatform.kt
new file mode 100644
index 0000000000..b87276e8da
--- /dev/null
+++ b/formats/json/jsTest/src/kotlinx/serialization/test/CurrentPlatform.kt
@@ -0,0 +1,12 @@
+/*
+ * Copyright 2017-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
+ */
+
+package kotlinx.serialization.test
+
+public actual val currentPlatform: Platform = if (isLegacyBackend()) Platform.JS_LEGACY else Platform.JS_IR
+
+// from https://github.com/JetBrains/kotlin/blob/569187a7516e2e5ab217158a3170d4beb0c5cb5a/js/js.translator/testData/_commonFiles/testUtils.kt#L3
+private fun isLegacyBackend(): Boolean =
+ // Using eval to prevent DCE from thinking that following code depends on Kotlin module.
+ eval("(typeof Kotlin != \"undefined\" && typeof Kotlin.kotlin != \"undefined\")").unsafeCast()
diff --git a/runtime/jvmTest/resources/corner_cases/listing.txt b/formats/json/jvmTest/resources/corner_cases/listing.txt
similarity index 100%
rename from runtime/jvmTest/resources/corner_cases/listing.txt
rename to formats/json/jvmTest/resources/corner_cases/listing.txt
diff --git a/runtime/jvmTest/resources/corner_cases/number_1.0.json b/formats/json/jvmTest/resources/corner_cases/number_1.0.json
similarity index 100%
rename from runtime/jvmTest/resources/corner_cases/number_1.0.json
rename to formats/json/jvmTest/resources/corner_cases/number_1.0.json
diff --git a/runtime/jvmTest/resources/corner_cases/number_1.000000000000000005.json b/formats/json/jvmTest/resources/corner_cases/number_1.000000000000000005.json
similarity index 100%
rename from runtime/jvmTest/resources/corner_cases/number_1.000000000000000005.json
rename to formats/json/jvmTest/resources/corner_cases/number_1.000000000000000005.json
diff --git a/runtime/jvmTest/resources/corner_cases/number_1000000000000000.json b/formats/json/jvmTest/resources/corner_cases/number_1000000000000000.json
similarity index 100%
rename from runtime/jvmTest/resources/corner_cases/number_1000000000000000.json
rename to formats/json/jvmTest/resources/corner_cases/number_1000000000000000.json
diff --git a/runtime/jvmTest/resources/corner_cases/number_10000000000000000999.json b/formats/json/jvmTest/resources/corner_cases/number_10000000000000000999.json
similarity index 100%
rename from runtime/jvmTest/resources/corner_cases/number_10000000000000000999.json
rename to formats/json/jvmTest/resources/corner_cases/number_10000000000000000999.json
diff --git a/runtime/jvmTest/resources/corner_cases/number_1e-999.json b/formats/json/jvmTest/resources/corner_cases/number_1e-999.json
similarity index 100%
rename from runtime/jvmTest/resources/corner_cases/number_1e-999.json
rename to formats/json/jvmTest/resources/corner_cases/number_1e-999.json
diff --git a/runtime/jvmTest/resources/corner_cases/number_1e6.json b/formats/json/jvmTest/resources/corner_cases/number_1e6.json
similarity index 100%
rename from runtime/jvmTest/resources/corner_cases/number_1e6.json
rename to formats/json/jvmTest/resources/corner_cases/number_1e6.json
diff --git a/runtime/jvmTest/resources/corner_cases/object_key_nfc_nfd.json b/formats/json/jvmTest/resources/corner_cases/object_key_nfc_nfd.json
similarity index 100%
rename from runtime/jvmTest/resources/corner_cases/object_key_nfc_nfd.json
rename to formats/json/jvmTest/resources/corner_cases/object_key_nfc_nfd.json
diff --git a/runtime/jvmTest/resources/corner_cases/object_key_nfd_nfc.json b/formats/json/jvmTest/resources/corner_cases/object_key_nfd_nfc.json
similarity index 100%
rename from runtime/jvmTest/resources/corner_cases/object_key_nfd_nfc.json
rename to formats/json/jvmTest/resources/corner_cases/object_key_nfd_nfc.json
diff --git a/runtime/jvmTest/resources/corner_cases/object_same_key_different_values.json b/formats/json/jvmTest/resources/corner_cases/object_same_key_different_values.json
similarity index 100%
rename from runtime/jvmTest/resources/corner_cases/object_same_key_different_values.json
rename to formats/json/jvmTest/resources/corner_cases/object_same_key_different_values.json
diff --git a/runtime/jvmTest/resources/corner_cases/object_same_key_same_value.json b/formats/json/jvmTest/resources/corner_cases/object_same_key_same_value.json
similarity index 100%
rename from runtime/jvmTest/resources/corner_cases/object_same_key_same_value.json
rename to formats/json/jvmTest/resources/corner_cases/object_same_key_same_value.json
diff --git a/runtime/jvmTest/resources/corner_cases/object_same_key_unclear_values.json b/formats/json/jvmTest/resources/corner_cases/object_same_key_unclear_values.json
similarity index 100%
rename from runtime/jvmTest/resources/corner_cases/object_same_key_unclear_values.json
rename to formats/json/jvmTest/resources/corner_cases/object_same_key_unclear_values.json
diff --git a/runtime/jvmTest/resources/corner_cases/string_1_escaped_invalid_codepoint.json b/formats/json/jvmTest/resources/corner_cases/string_1_escaped_invalid_codepoint.json
similarity index 100%
rename from runtime/jvmTest/resources/corner_cases/string_1_escaped_invalid_codepoint.json
rename to formats/json/jvmTest/resources/corner_cases/string_1_escaped_invalid_codepoint.json
diff --git a/runtime/jvmTest/resources/corner_cases/string_1_invalid_codepoint.json b/formats/json/jvmTest/resources/corner_cases/string_1_invalid_codepoint.json
similarity index 100%
rename from runtime/jvmTest/resources/corner_cases/string_1_invalid_codepoint.json
rename to formats/json/jvmTest/resources/corner_cases/string_1_invalid_codepoint.json
diff --git a/runtime/jvmTest/resources/corner_cases/string_2_escaped_invalid_codepoints.json b/formats/json/jvmTest/resources/corner_cases/string_2_escaped_invalid_codepoints.json
similarity index 100%
rename from runtime/jvmTest/resources/corner_cases/string_2_escaped_invalid_codepoints.json
rename to formats/json/jvmTest/resources/corner_cases/string_2_escaped_invalid_codepoints.json
diff --git a/runtime/jvmTest/resources/corner_cases/string_2_invalid_codepoints.json b/formats/json/jvmTest/resources/corner_cases/string_2_invalid_codepoints.json
similarity index 100%
rename from runtime/jvmTest/resources/corner_cases/string_2_invalid_codepoints.json
rename to formats/json/jvmTest/resources/corner_cases/string_2_invalid_codepoints.json
diff --git a/runtime/jvmTest/resources/corner_cases/string_3_escaped_invalid_codepoints.json b/formats/json/jvmTest/resources/corner_cases/string_3_escaped_invalid_codepoints.json
similarity index 100%
rename from runtime/jvmTest/resources/corner_cases/string_3_escaped_invalid_codepoints.json
rename to formats/json/jvmTest/resources/corner_cases/string_3_escaped_invalid_codepoints.json
diff --git a/runtime/jvmTest/resources/corner_cases/string_3_invalid_codepoints.json b/formats/json/jvmTest/resources/corner_cases/string_3_invalid_codepoints.json
similarity index 100%
rename from runtime/jvmTest/resources/corner_cases/string_3_invalid_codepoints.json
rename to formats/json/jvmTest/resources/corner_cases/string_3_invalid_codepoints.json
diff --git a/runtime/jvmTest/resources/corner_cases/string_with_escaped_NULL.json b/formats/json/jvmTest/resources/corner_cases/string_with_escaped_NULL.json
similarity index 100%
rename from runtime/jvmTest/resources/corner_cases/string_with_escaped_NULL.json
rename to formats/json/jvmTest/resources/corner_cases/string_with_escaped_NULL.json
diff --git a/runtime/jvmTest/resources/spec_cases/listing.txt b/formats/json/jvmTest/resources/spec_cases/listing.txt
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/listing.txt
rename to formats/json/jvmTest/resources/spec_cases/listing.txt
diff --git a/runtime/jvmTest/resources/spec_cases/n_array_1_true_without_comma.json b/formats/json/jvmTest/resources/spec_cases/n_array_1_true_without_comma.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_array_1_true_without_comma.json
rename to formats/json/jvmTest/resources/spec_cases/n_array_1_true_without_comma.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_array_a_invalid_utf8.json b/formats/json/jvmTest/resources/spec_cases/n_array_a_invalid_utf8.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_array_a_invalid_utf8.json
rename to formats/json/jvmTest/resources/spec_cases/n_array_a_invalid_utf8.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_array_colon_instead_of_comma.json b/formats/json/jvmTest/resources/spec_cases/n_array_colon_instead_of_comma.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_array_colon_instead_of_comma.json
rename to formats/json/jvmTest/resources/spec_cases/n_array_colon_instead_of_comma.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_array_comma_after_close.json b/formats/json/jvmTest/resources/spec_cases/n_array_comma_after_close.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_array_comma_after_close.json
rename to formats/json/jvmTest/resources/spec_cases/n_array_comma_after_close.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_array_comma_and_number.json b/formats/json/jvmTest/resources/spec_cases/n_array_comma_and_number.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_array_comma_and_number.json
rename to formats/json/jvmTest/resources/spec_cases/n_array_comma_and_number.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_array_double_comma.json b/formats/json/jvmTest/resources/spec_cases/n_array_double_comma.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_array_double_comma.json
rename to formats/json/jvmTest/resources/spec_cases/n_array_double_comma.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_array_double_extra_comma.json b/formats/json/jvmTest/resources/spec_cases/n_array_double_extra_comma.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_array_double_extra_comma.json
rename to formats/json/jvmTest/resources/spec_cases/n_array_double_extra_comma.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_array_extra_close.json b/formats/json/jvmTest/resources/spec_cases/n_array_extra_close.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_array_extra_close.json
rename to formats/json/jvmTest/resources/spec_cases/n_array_extra_close.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_array_extra_comma.json b/formats/json/jvmTest/resources/spec_cases/n_array_extra_comma.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_array_extra_comma.json
rename to formats/json/jvmTest/resources/spec_cases/n_array_extra_comma.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_array_incomplete.json b/formats/json/jvmTest/resources/spec_cases/n_array_incomplete.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_array_incomplete.json
rename to formats/json/jvmTest/resources/spec_cases/n_array_incomplete.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_array_incomplete_invalid_value.json b/formats/json/jvmTest/resources/spec_cases/n_array_incomplete_invalid_value.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_array_incomplete_invalid_value.json
rename to formats/json/jvmTest/resources/spec_cases/n_array_incomplete_invalid_value.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_array_inner_array_no_comma.json b/formats/json/jvmTest/resources/spec_cases/n_array_inner_array_no_comma.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_array_inner_array_no_comma.json
rename to formats/json/jvmTest/resources/spec_cases/n_array_inner_array_no_comma.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_array_invalid_utf8.json b/formats/json/jvmTest/resources/spec_cases/n_array_invalid_utf8.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_array_invalid_utf8.json
rename to formats/json/jvmTest/resources/spec_cases/n_array_invalid_utf8.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_array_items_separated_by_semicolon.json b/formats/json/jvmTest/resources/spec_cases/n_array_items_separated_by_semicolon.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_array_items_separated_by_semicolon.json
rename to formats/json/jvmTest/resources/spec_cases/n_array_items_separated_by_semicolon.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_array_just_comma.json b/formats/json/jvmTest/resources/spec_cases/n_array_just_comma.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_array_just_comma.json
rename to formats/json/jvmTest/resources/spec_cases/n_array_just_comma.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_array_just_minus.json b/formats/json/jvmTest/resources/spec_cases/n_array_just_minus.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_array_just_minus.json
rename to formats/json/jvmTest/resources/spec_cases/n_array_just_minus.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_array_missing_value.json b/formats/json/jvmTest/resources/spec_cases/n_array_missing_value.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_array_missing_value.json
rename to formats/json/jvmTest/resources/spec_cases/n_array_missing_value.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_array_newlines_unclosed.json b/formats/json/jvmTest/resources/spec_cases/n_array_newlines_unclosed.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_array_newlines_unclosed.json
rename to formats/json/jvmTest/resources/spec_cases/n_array_newlines_unclosed.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_array_number_and_comma.json b/formats/json/jvmTest/resources/spec_cases/n_array_number_and_comma.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_array_number_and_comma.json
rename to formats/json/jvmTest/resources/spec_cases/n_array_number_and_comma.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_array_number_and_several_commas.json b/formats/json/jvmTest/resources/spec_cases/n_array_number_and_several_commas.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_array_number_and_several_commas.json
rename to formats/json/jvmTest/resources/spec_cases/n_array_number_and_several_commas.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_array_spaces_vertical_tab_formfeed.json b/formats/json/jvmTest/resources/spec_cases/n_array_spaces_vertical_tab_formfeed.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_array_spaces_vertical_tab_formfeed.json
rename to formats/json/jvmTest/resources/spec_cases/n_array_spaces_vertical_tab_formfeed.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_array_star_inside.json b/formats/json/jvmTest/resources/spec_cases/n_array_star_inside.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_array_star_inside.json
rename to formats/json/jvmTest/resources/spec_cases/n_array_star_inside.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_array_unclosed.json b/formats/json/jvmTest/resources/spec_cases/n_array_unclosed.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_array_unclosed.json
rename to formats/json/jvmTest/resources/spec_cases/n_array_unclosed.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_array_unclosed_trailing_comma.json b/formats/json/jvmTest/resources/spec_cases/n_array_unclosed_trailing_comma.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_array_unclosed_trailing_comma.json
rename to formats/json/jvmTest/resources/spec_cases/n_array_unclosed_trailing_comma.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_array_unclosed_with_new_lines.json b/formats/json/jvmTest/resources/spec_cases/n_array_unclosed_with_new_lines.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_array_unclosed_with_new_lines.json
rename to formats/json/jvmTest/resources/spec_cases/n_array_unclosed_with_new_lines.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_array_unclosed_with_object_inside.json b/formats/json/jvmTest/resources/spec_cases/n_array_unclosed_with_object_inside.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_array_unclosed_with_object_inside.json
rename to formats/json/jvmTest/resources/spec_cases/n_array_unclosed_with_object_inside.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_incomplete_false.json b/formats/json/jvmTest/resources/spec_cases/n_incomplete_false.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_incomplete_false.json
rename to formats/json/jvmTest/resources/spec_cases/n_incomplete_false.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_incomplete_null.json b/formats/json/jvmTest/resources/spec_cases/n_incomplete_null.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_incomplete_null.json
rename to formats/json/jvmTest/resources/spec_cases/n_incomplete_null.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_incomplete_true.json b/formats/json/jvmTest/resources/spec_cases/n_incomplete_true.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_incomplete_true.json
rename to formats/json/jvmTest/resources/spec_cases/n_incomplete_true.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_multidigit_number_then_00.json b/formats/json/jvmTest/resources/spec_cases/n_multidigit_number_then_00.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_multidigit_number_then_00.json
rename to formats/json/jvmTest/resources/spec_cases/n_multidigit_number_then_00.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_object_bad_value.json b/formats/json/jvmTest/resources/spec_cases/n_object_bad_value.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_object_bad_value.json
rename to formats/json/jvmTest/resources/spec_cases/n_object_bad_value.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_object_bracket_key.json b/formats/json/jvmTest/resources/spec_cases/n_object_bracket_key.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_object_bracket_key.json
rename to formats/json/jvmTest/resources/spec_cases/n_object_bracket_key.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_object_comma_instead_of_colon.json b/formats/json/jvmTest/resources/spec_cases/n_object_comma_instead_of_colon.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_object_comma_instead_of_colon.json
rename to formats/json/jvmTest/resources/spec_cases/n_object_comma_instead_of_colon.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_object_double_colon.json b/formats/json/jvmTest/resources/spec_cases/n_object_double_colon.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_object_double_colon.json
rename to formats/json/jvmTest/resources/spec_cases/n_object_double_colon.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_object_emoji.json b/formats/json/jvmTest/resources/spec_cases/n_object_emoji.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_object_emoji.json
rename to formats/json/jvmTest/resources/spec_cases/n_object_emoji.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_object_garbage_at_end.json b/formats/json/jvmTest/resources/spec_cases/n_object_garbage_at_end.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_object_garbage_at_end.json
rename to formats/json/jvmTest/resources/spec_cases/n_object_garbage_at_end.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_object_key_with_single_quotes.json b/formats/json/jvmTest/resources/spec_cases/n_object_key_with_single_quotes.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_object_key_with_single_quotes.json
rename to formats/json/jvmTest/resources/spec_cases/n_object_key_with_single_quotes.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_object_lone_continuation_byte_in_key_and_trailing_comma.json b/formats/json/jvmTest/resources/spec_cases/n_object_lone_continuation_byte_in_key_and_trailing_comma.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_object_lone_continuation_byte_in_key_and_trailing_comma.json
rename to formats/json/jvmTest/resources/spec_cases/n_object_lone_continuation_byte_in_key_and_trailing_comma.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_object_missing_colon.json b/formats/json/jvmTest/resources/spec_cases/n_object_missing_colon.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_object_missing_colon.json
rename to formats/json/jvmTest/resources/spec_cases/n_object_missing_colon.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_object_missing_key.json b/formats/json/jvmTest/resources/spec_cases/n_object_missing_key.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_object_missing_key.json
rename to formats/json/jvmTest/resources/spec_cases/n_object_missing_key.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_object_missing_semicolon.json b/formats/json/jvmTest/resources/spec_cases/n_object_missing_semicolon.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_object_missing_semicolon.json
rename to formats/json/jvmTest/resources/spec_cases/n_object_missing_semicolon.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_object_missing_value.json b/formats/json/jvmTest/resources/spec_cases/n_object_missing_value.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_object_missing_value.json
rename to formats/json/jvmTest/resources/spec_cases/n_object_missing_value.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_object_no-colon.json b/formats/json/jvmTest/resources/spec_cases/n_object_no-colon.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_object_no-colon.json
rename to formats/json/jvmTest/resources/spec_cases/n_object_no-colon.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_object_non_string_key.json b/formats/json/jvmTest/resources/spec_cases/n_object_non_string_key.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_object_non_string_key.json
rename to formats/json/jvmTest/resources/spec_cases/n_object_non_string_key.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_object_non_string_key_but_huge_number_instead.json b/formats/json/jvmTest/resources/spec_cases/n_object_non_string_key_but_huge_number_instead.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_object_non_string_key_but_huge_number_instead.json
rename to formats/json/jvmTest/resources/spec_cases/n_object_non_string_key_but_huge_number_instead.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_object_repeated_null_null.json b/formats/json/jvmTest/resources/spec_cases/n_object_repeated_null_null.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_object_repeated_null_null.json
rename to formats/json/jvmTest/resources/spec_cases/n_object_repeated_null_null.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_object_several_trailing_commas.json b/formats/json/jvmTest/resources/spec_cases/n_object_several_trailing_commas.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_object_several_trailing_commas.json
rename to formats/json/jvmTest/resources/spec_cases/n_object_several_trailing_commas.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_object_single_quote.json b/formats/json/jvmTest/resources/spec_cases/n_object_single_quote.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_object_single_quote.json
rename to formats/json/jvmTest/resources/spec_cases/n_object_single_quote.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_object_trailing_comma.json b/formats/json/jvmTest/resources/spec_cases/n_object_trailing_comma.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_object_trailing_comma.json
rename to formats/json/jvmTest/resources/spec_cases/n_object_trailing_comma.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_object_trailing_comment.json b/formats/json/jvmTest/resources/spec_cases/n_object_trailing_comment.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_object_trailing_comment.json
rename to formats/json/jvmTest/resources/spec_cases/n_object_trailing_comment.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_object_trailing_comment_open.json b/formats/json/jvmTest/resources/spec_cases/n_object_trailing_comment_open.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_object_trailing_comment_open.json
rename to formats/json/jvmTest/resources/spec_cases/n_object_trailing_comment_open.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_object_trailing_comment_slash_open.json b/formats/json/jvmTest/resources/spec_cases/n_object_trailing_comment_slash_open.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_object_trailing_comment_slash_open.json
rename to formats/json/jvmTest/resources/spec_cases/n_object_trailing_comment_slash_open.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_object_trailing_comment_slash_open_incomplete.json b/formats/json/jvmTest/resources/spec_cases/n_object_trailing_comment_slash_open_incomplete.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_object_trailing_comment_slash_open_incomplete.json
rename to formats/json/jvmTest/resources/spec_cases/n_object_trailing_comment_slash_open_incomplete.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_object_two_commas_in_a_row.json b/formats/json/jvmTest/resources/spec_cases/n_object_two_commas_in_a_row.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_object_two_commas_in_a_row.json
rename to formats/json/jvmTest/resources/spec_cases/n_object_two_commas_in_a_row.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_object_unquoted_key.json b/formats/json/jvmTest/resources/spec_cases/n_object_unquoted_key.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_object_unquoted_key.json
rename to formats/json/jvmTest/resources/spec_cases/n_object_unquoted_key.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_object_unterminated-value.json b/formats/json/jvmTest/resources/spec_cases/n_object_unterminated-value.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_object_unterminated-value.json
rename to formats/json/jvmTest/resources/spec_cases/n_object_unterminated-value.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_object_with_single_string.json b/formats/json/jvmTest/resources/spec_cases/n_object_with_single_string.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_object_with_single_string.json
rename to formats/json/jvmTest/resources/spec_cases/n_object_with_single_string.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_object_with_trailing_garbage.json b/formats/json/jvmTest/resources/spec_cases/n_object_with_trailing_garbage.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_object_with_trailing_garbage.json
rename to formats/json/jvmTest/resources/spec_cases/n_object_with_trailing_garbage.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_single_space.json b/formats/json/jvmTest/resources/spec_cases/n_single_space.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_single_space.json
rename to formats/json/jvmTest/resources/spec_cases/n_single_space.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape.json b/formats/json/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape.json
rename to formats/json/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape_u.json b/formats/json/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape_u.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape_u.json
rename to formats/json/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape_u.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape_u1.json b/formats/json/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape_u1.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape_u1.json
rename to formats/json/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape_u1.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape_u1x.json b/formats/json/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape_u1x.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape_u1x.json
rename to formats/json/jvmTest/resources/spec_cases/n_string_1_surrogate_then_escape_u1x.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_string_accentuated_char_no_quotes.json b/formats/json/jvmTest/resources/spec_cases/n_string_accentuated_char_no_quotes.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_string_accentuated_char_no_quotes.json
rename to formats/json/jvmTest/resources/spec_cases/n_string_accentuated_char_no_quotes.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_string_backslash_00.json b/formats/json/jvmTest/resources/spec_cases/n_string_backslash_00.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_string_backslash_00.json
rename to formats/json/jvmTest/resources/spec_cases/n_string_backslash_00.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_string_escape_x.json b/formats/json/jvmTest/resources/spec_cases/n_string_escape_x.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_string_escape_x.json
rename to formats/json/jvmTest/resources/spec_cases/n_string_escape_x.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_string_escaped_backslash_bad.json b/formats/json/jvmTest/resources/spec_cases/n_string_escaped_backslash_bad.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_string_escaped_backslash_bad.json
rename to formats/json/jvmTest/resources/spec_cases/n_string_escaped_backslash_bad.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_string_escaped_ctrl_char_tab.json b/formats/json/jvmTest/resources/spec_cases/n_string_escaped_ctrl_char_tab.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_string_escaped_ctrl_char_tab.json
rename to formats/json/jvmTest/resources/spec_cases/n_string_escaped_ctrl_char_tab.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_string_escaped_emoji.json b/formats/json/jvmTest/resources/spec_cases/n_string_escaped_emoji.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_string_escaped_emoji.json
rename to formats/json/jvmTest/resources/spec_cases/n_string_escaped_emoji.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_string_incomplete_escape.json b/formats/json/jvmTest/resources/spec_cases/n_string_incomplete_escape.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_string_incomplete_escape.json
rename to formats/json/jvmTest/resources/spec_cases/n_string_incomplete_escape.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_string_incomplete_escaped_character.json b/formats/json/jvmTest/resources/spec_cases/n_string_incomplete_escaped_character.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_string_incomplete_escaped_character.json
rename to formats/json/jvmTest/resources/spec_cases/n_string_incomplete_escaped_character.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_string_incomplete_surrogate.json b/formats/json/jvmTest/resources/spec_cases/n_string_incomplete_surrogate.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_string_incomplete_surrogate.json
rename to formats/json/jvmTest/resources/spec_cases/n_string_incomplete_surrogate.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_string_incomplete_surrogate_escape_invalid.json b/formats/json/jvmTest/resources/spec_cases/n_string_incomplete_surrogate_escape_invalid.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_string_incomplete_surrogate_escape_invalid.json
rename to formats/json/jvmTest/resources/spec_cases/n_string_incomplete_surrogate_escape_invalid.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_string_invalid-utf-8-in-escape.json b/formats/json/jvmTest/resources/spec_cases/n_string_invalid-utf-8-in-escape.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_string_invalid-utf-8-in-escape.json
rename to formats/json/jvmTest/resources/spec_cases/n_string_invalid-utf-8-in-escape.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_string_invalid_backslash_esc.json b/formats/json/jvmTest/resources/spec_cases/n_string_invalid_backslash_esc.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_string_invalid_backslash_esc.json
rename to formats/json/jvmTest/resources/spec_cases/n_string_invalid_backslash_esc.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_string_invalid_unicode_escape.json b/formats/json/jvmTest/resources/spec_cases/n_string_invalid_unicode_escape.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_string_invalid_unicode_escape.json
rename to formats/json/jvmTest/resources/spec_cases/n_string_invalid_unicode_escape.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_string_invalid_utf8_after_escape.json b/formats/json/jvmTest/resources/spec_cases/n_string_invalid_utf8_after_escape.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_string_invalid_utf8_after_escape.json
rename to formats/json/jvmTest/resources/spec_cases/n_string_invalid_utf8_after_escape.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_string_leading_uescaped_thinspace.json b/formats/json/jvmTest/resources/spec_cases/n_string_leading_uescaped_thinspace.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_string_leading_uescaped_thinspace.json
rename to formats/json/jvmTest/resources/spec_cases/n_string_leading_uescaped_thinspace.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_string_no_quotes_with_bad_escape.json b/formats/json/jvmTest/resources/spec_cases/n_string_no_quotes_with_bad_escape.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_string_no_quotes_with_bad_escape.json
rename to formats/json/jvmTest/resources/spec_cases/n_string_no_quotes_with_bad_escape.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_string_single_doublequote.json b/formats/json/jvmTest/resources/spec_cases/n_string_single_doublequote.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_string_single_doublequote.json
rename to formats/json/jvmTest/resources/spec_cases/n_string_single_doublequote.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_string_single_quote.json b/formats/json/jvmTest/resources/spec_cases/n_string_single_quote.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_string_single_quote.json
rename to formats/json/jvmTest/resources/spec_cases/n_string_single_quote.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_string_single_string_no_double_quotes.json b/formats/json/jvmTest/resources/spec_cases/n_string_single_string_no_double_quotes.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_string_single_string_no_double_quotes.json
rename to formats/json/jvmTest/resources/spec_cases/n_string_single_string_no_double_quotes.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_string_start_escape_unclosed.json b/formats/json/jvmTest/resources/spec_cases/n_string_start_escape_unclosed.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_string_start_escape_unclosed.json
rename to formats/json/jvmTest/resources/spec_cases/n_string_start_escape_unclosed.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_string_unescaped_crtl_char.json b/formats/json/jvmTest/resources/spec_cases/n_string_unescaped_crtl_char.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_string_unescaped_crtl_char.json
rename to formats/json/jvmTest/resources/spec_cases/n_string_unescaped_crtl_char.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_string_unescaped_newline.json b/formats/json/jvmTest/resources/spec_cases/n_string_unescaped_newline.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_string_unescaped_newline.json
rename to formats/json/jvmTest/resources/spec_cases/n_string_unescaped_newline.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_string_unescaped_tab.json b/formats/json/jvmTest/resources/spec_cases/n_string_unescaped_tab.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_string_unescaped_tab.json
rename to formats/json/jvmTest/resources/spec_cases/n_string_unescaped_tab.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_string_unicode_CapitalU.json b/formats/json/jvmTest/resources/spec_cases/n_string_unicode_CapitalU.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_string_unicode_CapitalU.json
rename to formats/json/jvmTest/resources/spec_cases/n_string_unicode_CapitalU.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_string_with_trailing_garbage.json b/formats/json/jvmTest/resources/spec_cases/n_string_with_trailing_garbage.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_string_with_trailing_garbage.json
rename to formats/json/jvmTest/resources/spec_cases/n_string_with_trailing_garbage.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_100000_opening_arrays.json b/formats/json/jvmTest/resources/spec_cases/n_structure_100000_opening_arrays.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_100000_opening_arrays.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_100000_opening_arrays.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_U+2060_word_joined.json b/formats/json/jvmTest/resources/spec_cases/n_structure_U+2060_word_joined.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_U+2060_word_joined.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_U+2060_word_joined.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_UTF8_BOM_no_data.json b/formats/json/jvmTest/resources/spec_cases/n_structure_UTF8_BOM_no_data.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_UTF8_BOM_no_data.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_UTF8_BOM_no_data.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_angle_bracket_..json b/formats/json/jvmTest/resources/spec_cases/n_structure_angle_bracket_..json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_angle_bracket_..json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_angle_bracket_..json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_angle_bracket_null.json b/formats/json/jvmTest/resources/spec_cases/n_structure_angle_bracket_null.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_angle_bracket_null.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_angle_bracket_null.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_array_trailing_garbage.json b/formats/json/jvmTest/resources/spec_cases/n_structure_array_trailing_garbage.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_array_trailing_garbage.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_array_trailing_garbage.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_array_with_extra_array_close.json b/formats/json/jvmTest/resources/spec_cases/n_structure_array_with_extra_array_close.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_array_with_extra_array_close.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_array_with_extra_array_close.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_array_with_unclosed_string.json b/formats/json/jvmTest/resources/spec_cases/n_structure_array_with_unclosed_string.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_array_with_unclosed_string.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_array_with_unclosed_string.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_ascii-unicode-identifier.json b/formats/json/jvmTest/resources/spec_cases/n_structure_ascii-unicode-identifier.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_ascii-unicode-identifier.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_ascii-unicode-identifier.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_capitalized_True.json b/formats/json/jvmTest/resources/spec_cases/n_structure_capitalized_True.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_capitalized_True.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_capitalized_True.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_close_unopened_array.json b/formats/json/jvmTest/resources/spec_cases/n_structure_close_unopened_array.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_close_unopened_array.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_close_unopened_array.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_comma_instead_of_closing_brace.json b/formats/json/jvmTest/resources/spec_cases/n_structure_comma_instead_of_closing_brace.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_comma_instead_of_closing_brace.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_comma_instead_of_closing_brace.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_double_array.json b/formats/json/jvmTest/resources/spec_cases/n_structure_double_array.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_double_array.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_double_array.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_end_array.json b/formats/json/jvmTest/resources/spec_cases/n_structure_end_array.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_end_array.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_end_array.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_incomplete_UTF8_BOM.json b/formats/json/jvmTest/resources/spec_cases/n_structure_incomplete_UTF8_BOM.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_incomplete_UTF8_BOM.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_incomplete_UTF8_BOM.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_lone-invalid-utf-8.json b/formats/json/jvmTest/resources/spec_cases/n_structure_lone-invalid-utf-8.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_lone-invalid-utf-8.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_lone-invalid-utf-8.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_lone-open-bracket.json b/formats/json/jvmTest/resources/spec_cases/n_structure_lone-open-bracket.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_lone-open-bracket.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_lone-open-bracket.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_no_data.json b/formats/json/jvmTest/resources/spec_cases/n_structure_no_data.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_no_data.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_no_data.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_null-byte-outside-string.json b/formats/json/jvmTest/resources/spec_cases/n_structure_null-byte-outside-string.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_null-byte-outside-string.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_null-byte-outside-string.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_number_with_trailing_garbage.json b/formats/json/jvmTest/resources/spec_cases/n_structure_number_with_trailing_garbage.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_number_with_trailing_garbage.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_number_with_trailing_garbage.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_object_followed_by_closing_object.json b/formats/json/jvmTest/resources/spec_cases/n_structure_object_followed_by_closing_object.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_object_followed_by_closing_object.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_object_followed_by_closing_object.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_object_unclosed_no_value.json b/formats/json/jvmTest/resources/spec_cases/n_structure_object_unclosed_no_value.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_object_unclosed_no_value.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_object_unclosed_no_value.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_object_with_comment.json b/formats/json/jvmTest/resources/spec_cases/n_structure_object_with_comment.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_object_with_comment.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_object_with_comment.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_object_with_trailing_garbage.json b/formats/json/jvmTest/resources/spec_cases/n_structure_object_with_trailing_garbage.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_object_with_trailing_garbage.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_object_with_trailing_garbage.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_open_array_apostrophe.json b/formats/json/jvmTest/resources/spec_cases/n_structure_open_array_apostrophe.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_open_array_apostrophe.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_open_array_apostrophe.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_open_array_comma.json b/formats/json/jvmTest/resources/spec_cases/n_structure_open_array_comma.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_open_array_comma.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_open_array_comma.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_open_array_object.json b/formats/json/jvmTest/resources/spec_cases/n_structure_open_array_object.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_open_array_object.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_open_array_object.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_open_array_open_object.json b/formats/json/jvmTest/resources/spec_cases/n_structure_open_array_open_object.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_open_array_open_object.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_open_array_open_object.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_open_array_open_string.json b/formats/json/jvmTest/resources/spec_cases/n_structure_open_array_open_string.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_open_array_open_string.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_open_array_open_string.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_open_array_string.json b/formats/json/jvmTest/resources/spec_cases/n_structure_open_array_string.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_open_array_string.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_open_array_string.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_open_object.json b/formats/json/jvmTest/resources/spec_cases/n_structure_open_object.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_open_object.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_open_object.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_open_object_close_array.json b/formats/json/jvmTest/resources/spec_cases/n_structure_open_object_close_array.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_open_object_close_array.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_open_object_close_array.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_open_object_comma.json b/formats/json/jvmTest/resources/spec_cases/n_structure_open_object_comma.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_open_object_comma.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_open_object_comma.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_open_object_open_array.json b/formats/json/jvmTest/resources/spec_cases/n_structure_open_object_open_array.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_open_object_open_array.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_open_object_open_array.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_open_object_open_string.json b/formats/json/jvmTest/resources/spec_cases/n_structure_open_object_open_string.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_open_object_open_string.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_open_object_open_string.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_open_object_string_with_apostrophes.json b/formats/json/jvmTest/resources/spec_cases/n_structure_open_object_string_with_apostrophes.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_open_object_string_with_apostrophes.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_open_object_string_with_apostrophes.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_open_open.json b/formats/json/jvmTest/resources/spec_cases/n_structure_open_open.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_open_open.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_open_open.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_single_star.json b/formats/json/jvmTest/resources/spec_cases/n_structure_single_star.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_single_star.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_single_star.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_trailing_#.json b/formats/json/jvmTest/resources/spec_cases/n_structure_trailing_#.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_trailing_#.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_trailing_#.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_uescaped_LF_before_string.json b/formats/json/jvmTest/resources/spec_cases/n_structure_uescaped_LF_before_string.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_uescaped_LF_before_string.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_uescaped_LF_before_string.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_unclosed_array.json b/formats/json/jvmTest/resources/spec_cases/n_structure_unclosed_array.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_unclosed_array.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_unclosed_array.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_unclosed_array_partial_null.json b/formats/json/jvmTest/resources/spec_cases/n_structure_unclosed_array_partial_null.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_unclosed_array_partial_null.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_unclosed_array_partial_null.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_unclosed_array_unfinished_false.json b/formats/json/jvmTest/resources/spec_cases/n_structure_unclosed_array_unfinished_false.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_unclosed_array_unfinished_false.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_unclosed_array_unfinished_false.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_unclosed_array_unfinished_true.json b/formats/json/jvmTest/resources/spec_cases/n_structure_unclosed_array_unfinished_true.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_unclosed_array_unfinished_true.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_unclosed_array_unfinished_true.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_unclosed_object.json b/formats/json/jvmTest/resources/spec_cases/n_structure_unclosed_object.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_unclosed_object.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_unclosed_object.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_unicode-identifier.json b/formats/json/jvmTest/resources/spec_cases/n_structure_unicode-identifier.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_unicode-identifier.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_unicode-identifier.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_whitespace_U+2060_word_joiner.json b/formats/json/jvmTest/resources/spec_cases/n_structure_whitespace_U+2060_word_joiner.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_whitespace_U+2060_word_joiner.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_whitespace_U+2060_word_joiner.json
diff --git a/runtime/jvmTest/resources/spec_cases/n_structure_whitespace_formfeed.json b/formats/json/jvmTest/resources/spec_cases/n_structure_whitespace_formfeed.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/n_structure_whitespace_formfeed.json
rename to formats/json/jvmTest/resources/spec_cases/n_structure_whitespace_formfeed.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_array_arraysWithSpaces.json b/formats/json/jvmTest/resources/spec_cases/y_array_arraysWithSpaces.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_array_arraysWithSpaces.json
rename to formats/json/jvmTest/resources/spec_cases/y_array_arraysWithSpaces.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_array_empty-string.json b/formats/json/jvmTest/resources/spec_cases/y_array_empty-string.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_array_empty-string.json
rename to formats/json/jvmTest/resources/spec_cases/y_array_empty-string.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_array_empty.json b/formats/json/jvmTest/resources/spec_cases/y_array_empty.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_array_empty.json
rename to formats/json/jvmTest/resources/spec_cases/y_array_empty.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_array_ending_with_newline.json b/formats/json/jvmTest/resources/spec_cases/y_array_ending_with_newline.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_array_ending_with_newline.json
rename to formats/json/jvmTest/resources/spec_cases/y_array_ending_with_newline.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_array_false.json b/formats/json/jvmTest/resources/spec_cases/y_array_false.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_array_false.json
rename to formats/json/jvmTest/resources/spec_cases/y_array_false.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_array_heterogeneous.json b/formats/json/jvmTest/resources/spec_cases/y_array_heterogeneous.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_array_heterogeneous.json
rename to formats/json/jvmTest/resources/spec_cases/y_array_heterogeneous.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_array_null.json b/formats/json/jvmTest/resources/spec_cases/y_array_null.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_array_null.json
rename to formats/json/jvmTest/resources/spec_cases/y_array_null.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_array_with_1_and_newline.json b/formats/json/jvmTest/resources/spec_cases/y_array_with_1_and_newline.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_array_with_1_and_newline.json
rename to formats/json/jvmTest/resources/spec_cases/y_array_with_1_and_newline.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_array_with_leading_space.json b/formats/json/jvmTest/resources/spec_cases/y_array_with_leading_space.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_array_with_leading_space.json
rename to formats/json/jvmTest/resources/spec_cases/y_array_with_leading_space.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_array_with_several_null.json b/formats/json/jvmTest/resources/spec_cases/y_array_with_several_null.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_array_with_several_null.json
rename to formats/json/jvmTest/resources/spec_cases/y_array_with_several_null.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_array_with_trailing_space.json b/formats/json/jvmTest/resources/spec_cases/y_array_with_trailing_space.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_array_with_trailing_space.json
rename to formats/json/jvmTest/resources/spec_cases/y_array_with_trailing_space.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_number.json b/formats/json/jvmTest/resources/spec_cases/y_number.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_number.json
rename to formats/json/jvmTest/resources/spec_cases/y_number.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_number_0e+1.json b/formats/json/jvmTest/resources/spec_cases/y_number_0e+1.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_number_0e+1.json
rename to formats/json/jvmTest/resources/spec_cases/y_number_0e+1.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_number_0e1.json b/formats/json/jvmTest/resources/spec_cases/y_number_0e1.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_number_0e1.json
rename to formats/json/jvmTest/resources/spec_cases/y_number_0e1.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_number_after_space.json b/formats/json/jvmTest/resources/spec_cases/y_number_after_space.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_number_after_space.json
rename to formats/json/jvmTest/resources/spec_cases/y_number_after_space.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_number_double_close_to_zero.json b/formats/json/jvmTest/resources/spec_cases/y_number_double_close_to_zero.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_number_double_close_to_zero.json
rename to formats/json/jvmTest/resources/spec_cases/y_number_double_close_to_zero.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_number_int_with_exp.json b/formats/json/jvmTest/resources/spec_cases/y_number_int_with_exp.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_number_int_with_exp.json
rename to formats/json/jvmTest/resources/spec_cases/y_number_int_with_exp.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_number_minus_zero.json b/formats/json/jvmTest/resources/spec_cases/y_number_minus_zero.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_number_minus_zero.json
rename to formats/json/jvmTest/resources/spec_cases/y_number_minus_zero.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_number_negative_int.json b/formats/json/jvmTest/resources/spec_cases/y_number_negative_int.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_number_negative_int.json
rename to formats/json/jvmTest/resources/spec_cases/y_number_negative_int.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_number_negative_one.json b/formats/json/jvmTest/resources/spec_cases/y_number_negative_one.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_number_negative_one.json
rename to formats/json/jvmTest/resources/spec_cases/y_number_negative_one.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_number_negative_zero.json b/formats/json/jvmTest/resources/spec_cases/y_number_negative_zero.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_number_negative_zero.json
rename to formats/json/jvmTest/resources/spec_cases/y_number_negative_zero.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_number_real_capital_e.json b/formats/json/jvmTest/resources/spec_cases/y_number_real_capital_e.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_number_real_capital_e.json
rename to formats/json/jvmTest/resources/spec_cases/y_number_real_capital_e.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_number_real_capital_e_neg_exp.json b/formats/json/jvmTest/resources/spec_cases/y_number_real_capital_e_neg_exp.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_number_real_capital_e_neg_exp.json
rename to formats/json/jvmTest/resources/spec_cases/y_number_real_capital_e_neg_exp.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_number_real_capital_e_pos_exp.json b/formats/json/jvmTest/resources/spec_cases/y_number_real_capital_e_pos_exp.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_number_real_capital_e_pos_exp.json
rename to formats/json/jvmTest/resources/spec_cases/y_number_real_capital_e_pos_exp.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_number_real_exponent.json b/formats/json/jvmTest/resources/spec_cases/y_number_real_exponent.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_number_real_exponent.json
rename to formats/json/jvmTest/resources/spec_cases/y_number_real_exponent.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_number_real_fraction_exponent.json b/formats/json/jvmTest/resources/spec_cases/y_number_real_fraction_exponent.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_number_real_fraction_exponent.json
rename to formats/json/jvmTest/resources/spec_cases/y_number_real_fraction_exponent.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_number_real_neg_exp.json b/formats/json/jvmTest/resources/spec_cases/y_number_real_neg_exp.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_number_real_neg_exp.json
rename to formats/json/jvmTest/resources/spec_cases/y_number_real_neg_exp.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_number_real_pos_exponent.json b/formats/json/jvmTest/resources/spec_cases/y_number_real_pos_exponent.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_number_real_pos_exponent.json
rename to formats/json/jvmTest/resources/spec_cases/y_number_real_pos_exponent.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_number_simple_int.json b/formats/json/jvmTest/resources/spec_cases/y_number_simple_int.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_number_simple_int.json
rename to formats/json/jvmTest/resources/spec_cases/y_number_simple_int.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_number_simple_real.json b/formats/json/jvmTest/resources/spec_cases/y_number_simple_real.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_number_simple_real.json
rename to formats/json/jvmTest/resources/spec_cases/y_number_simple_real.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_object.json b/formats/json/jvmTest/resources/spec_cases/y_object.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_object.json
rename to formats/json/jvmTest/resources/spec_cases/y_object.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_object_basic.json b/formats/json/jvmTest/resources/spec_cases/y_object_basic.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_object_basic.json
rename to formats/json/jvmTest/resources/spec_cases/y_object_basic.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_object_duplicated_key.json b/formats/json/jvmTest/resources/spec_cases/y_object_duplicated_key.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_object_duplicated_key.json
rename to formats/json/jvmTest/resources/spec_cases/y_object_duplicated_key.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_object_duplicated_key_and_value.json b/formats/json/jvmTest/resources/spec_cases/y_object_duplicated_key_and_value.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_object_duplicated_key_and_value.json
rename to formats/json/jvmTest/resources/spec_cases/y_object_duplicated_key_and_value.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_object_empty.json b/formats/json/jvmTest/resources/spec_cases/y_object_empty.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_object_empty.json
rename to formats/json/jvmTest/resources/spec_cases/y_object_empty.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_object_empty_key.json b/formats/json/jvmTest/resources/spec_cases/y_object_empty_key.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_object_empty_key.json
rename to formats/json/jvmTest/resources/spec_cases/y_object_empty_key.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_object_escaped_null_in_key.json b/formats/json/jvmTest/resources/spec_cases/y_object_escaped_null_in_key.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_object_escaped_null_in_key.json
rename to formats/json/jvmTest/resources/spec_cases/y_object_escaped_null_in_key.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_object_extreme_numbers.json b/formats/json/jvmTest/resources/spec_cases/y_object_extreme_numbers.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_object_extreme_numbers.json
rename to formats/json/jvmTest/resources/spec_cases/y_object_extreme_numbers.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_object_long_strings.json b/formats/json/jvmTest/resources/spec_cases/y_object_long_strings.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_object_long_strings.json
rename to formats/json/jvmTest/resources/spec_cases/y_object_long_strings.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_object_simple.json b/formats/json/jvmTest/resources/spec_cases/y_object_simple.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_object_simple.json
rename to formats/json/jvmTest/resources/spec_cases/y_object_simple.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_object_string_unicode.json b/formats/json/jvmTest/resources/spec_cases/y_object_string_unicode.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_object_string_unicode.json
rename to formats/json/jvmTest/resources/spec_cases/y_object_string_unicode.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_object_with_newlines.json b/formats/json/jvmTest/resources/spec_cases/y_object_with_newlines.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_object_with_newlines.json
rename to formats/json/jvmTest/resources/spec_cases/y_object_with_newlines.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_1_2_3_bytes_UTF-8_sequences.json b/formats/json/jvmTest/resources/spec_cases/y_string_1_2_3_bytes_UTF-8_sequences.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_1_2_3_bytes_UTF-8_sequences.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_1_2_3_bytes_UTF-8_sequences.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_accepted_surrogate_pair.json b/formats/json/jvmTest/resources/spec_cases/y_string_accepted_surrogate_pair.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_accepted_surrogate_pair.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_accepted_surrogate_pair.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_accepted_surrogate_pairs.json b/formats/json/jvmTest/resources/spec_cases/y_string_accepted_surrogate_pairs.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_accepted_surrogate_pairs.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_accepted_surrogate_pairs.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_allowed_escapes.json b/formats/json/jvmTest/resources/spec_cases/y_string_allowed_escapes.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_allowed_escapes.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_allowed_escapes.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_backslash_and_u_escaped_zero.json b/formats/json/jvmTest/resources/spec_cases/y_string_backslash_and_u_escaped_zero.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_backslash_and_u_escaped_zero.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_backslash_and_u_escaped_zero.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_backslash_doublequotes.json b/formats/json/jvmTest/resources/spec_cases/y_string_backslash_doublequotes.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_backslash_doublequotes.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_backslash_doublequotes.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_comments.json b/formats/json/jvmTest/resources/spec_cases/y_string_comments.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_comments.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_comments.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_double_escape_a.json b/formats/json/jvmTest/resources/spec_cases/y_string_double_escape_a.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_double_escape_a.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_double_escape_a.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_double_escape_n.json b/formats/json/jvmTest/resources/spec_cases/y_string_double_escape_n.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_double_escape_n.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_double_escape_n.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_escaped_control_character.json b/formats/json/jvmTest/resources/spec_cases/y_string_escaped_control_character.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_escaped_control_character.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_escaped_control_character.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_escaped_noncharacter.json b/formats/json/jvmTest/resources/spec_cases/y_string_escaped_noncharacter.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_escaped_noncharacter.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_escaped_noncharacter.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_in_array.json b/formats/json/jvmTest/resources/spec_cases/y_string_in_array.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_in_array.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_in_array.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_in_array_with_leading_space.json b/formats/json/jvmTest/resources/spec_cases/y_string_in_array_with_leading_space.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_in_array_with_leading_space.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_in_array_with_leading_space.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_last_surrogates_1_and_2.json b/formats/json/jvmTest/resources/spec_cases/y_string_last_surrogates_1_and_2.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_last_surrogates_1_and_2.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_last_surrogates_1_and_2.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_nbsp_uescaped.json b/formats/json/jvmTest/resources/spec_cases/y_string_nbsp_uescaped.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_nbsp_uescaped.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_nbsp_uescaped.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_nonCharacterInUTF-8_U+10FFFF.json b/formats/json/jvmTest/resources/spec_cases/y_string_nonCharacterInUTF-8_U+10FFFF.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_nonCharacterInUTF-8_U+10FFFF.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_nonCharacterInUTF-8_U+10FFFF.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_nonCharacterInUTF-8_U+FFFF.json b/formats/json/jvmTest/resources/spec_cases/y_string_nonCharacterInUTF-8_U+FFFF.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_nonCharacterInUTF-8_U+FFFF.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_nonCharacterInUTF-8_U+FFFF.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_null_escape.json b/formats/json/jvmTest/resources/spec_cases/y_string_null_escape.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_null_escape.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_null_escape.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_one-byte-utf-8.json b/formats/json/jvmTest/resources/spec_cases/y_string_one-byte-utf-8.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_one-byte-utf-8.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_one-byte-utf-8.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_pi.json b/formats/json/jvmTest/resources/spec_cases/y_string_pi.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_pi.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_pi.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_reservedCharacterInUTF-8_U+1BFFF.json b/formats/json/jvmTest/resources/spec_cases/y_string_reservedCharacterInUTF-8_U+1BFFF.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_reservedCharacterInUTF-8_U+1BFFF.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_reservedCharacterInUTF-8_U+1BFFF.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_simple_ascii.json b/formats/json/jvmTest/resources/spec_cases/y_string_simple_ascii.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_simple_ascii.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_simple_ascii.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_space.json b/formats/json/jvmTest/resources/spec_cases/y_string_space.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_space.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_space.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_surrogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF.json b/formats/json/jvmTest/resources/spec_cases/y_string_surrogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_surrogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_surrogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_three-byte-utf-8.json b/formats/json/jvmTest/resources/spec_cases/y_string_three-byte-utf-8.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_three-byte-utf-8.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_three-byte-utf-8.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_two-byte-utf-8.json b/formats/json/jvmTest/resources/spec_cases/y_string_two-byte-utf-8.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_two-byte-utf-8.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_two-byte-utf-8.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_u+2028_line_sep.json b/formats/json/jvmTest/resources/spec_cases/y_string_u+2028_line_sep.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_u+2028_line_sep.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_u+2028_line_sep.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_u+2029_par_sep.json b/formats/json/jvmTest/resources/spec_cases/y_string_u+2029_par_sep.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_u+2029_par_sep.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_u+2029_par_sep.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_uEscape.json b/formats/json/jvmTest/resources/spec_cases/y_string_uEscape.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_uEscape.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_uEscape.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_uescaped_newline.json b/formats/json/jvmTest/resources/spec_cases/y_string_uescaped_newline.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_uescaped_newline.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_uescaped_newline.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_unescaped_char_delete.json b/formats/json/jvmTest/resources/spec_cases/y_string_unescaped_char_delete.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_unescaped_char_delete.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_unescaped_char_delete.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_unicode.json b/formats/json/jvmTest/resources/spec_cases/y_string_unicode.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_unicode.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_unicode.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_unicodeEscapedBackslash.json b/formats/json/jvmTest/resources/spec_cases/y_string_unicodeEscapedBackslash.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_unicodeEscapedBackslash.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_unicodeEscapedBackslash.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_unicode_2.json b/formats/json/jvmTest/resources/spec_cases/y_string_unicode_2.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_unicode_2.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_unicode_2.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_unicode_U+10FFFE_nonchar.json b/formats/json/jvmTest/resources/spec_cases/y_string_unicode_U+10FFFE_nonchar.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_unicode_U+10FFFE_nonchar.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_unicode_U+10FFFE_nonchar.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_unicode_U+1FFFE_nonchar.json b/formats/json/jvmTest/resources/spec_cases/y_string_unicode_U+1FFFE_nonchar.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_unicode_U+1FFFE_nonchar.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_unicode_U+1FFFE_nonchar.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_unicode_U+200B_ZERO_WIDTH_SPACE.json b/formats/json/jvmTest/resources/spec_cases/y_string_unicode_U+200B_ZERO_WIDTH_SPACE.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_unicode_U+200B_ZERO_WIDTH_SPACE.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_unicode_U+200B_ZERO_WIDTH_SPACE.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_unicode_U+2064_invisible_plus.json b/formats/json/jvmTest/resources/spec_cases/y_string_unicode_U+2064_invisible_plus.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_unicode_U+2064_invisible_plus.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_unicode_U+2064_invisible_plus.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_unicode_U+FDD0_nonchar.json b/formats/json/jvmTest/resources/spec_cases/y_string_unicode_U+FDD0_nonchar.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_unicode_U+FDD0_nonchar.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_unicode_U+FDD0_nonchar.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_unicode_U+FFFE_nonchar.json b/formats/json/jvmTest/resources/spec_cases/y_string_unicode_U+FFFE_nonchar.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_unicode_U+FFFE_nonchar.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_unicode_U+FFFE_nonchar.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_unicode_escaped_double_quote.json b/formats/json/jvmTest/resources/spec_cases/y_string_unicode_escaped_double_quote.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_unicode_escaped_double_quote.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_unicode_escaped_double_quote.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_utf8.json b/formats/json/jvmTest/resources/spec_cases/y_string_utf8.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_utf8.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_utf8.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_string_with_del_character.json b/formats/json/jvmTest/resources/spec_cases/y_string_with_del_character.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_string_with_del_character.json
rename to formats/json/jvmTest/resources/spec_cases/y_string_with_del_character.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_structure_lonely_false.json b/formats/json/jvmTest/resources/spec_cases/y_structure_lonely_false.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_structure_lonely_false.json
rename to formats/json/jvmTest/resources/spec_cases/y_structure_lonely_false.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_structure_lonely_int.json b/formats/json/jvmTest/resources/spec_cases/y_structure_lonely_int.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_structure_lonely_int.json
rename to formats/json/jvmTest/resources/spec_cases/y_structure_lonely_int.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_structure_lonely_negative_real.json b/formats/json/jvmTest/resources/spec_cases/y_structure_lonely_negative_real.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_structure_lonely_negative_real.json
rename to formats/json/jvmTest/resources/spec_cases/y_structure_lonely_negative_real.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_structure_lonely_null.json b/formats/json/jvmTest/resources/spec_cases/y_structure_lonely_null.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_structure_lonely_null.json
rename to formats/json/jvmTest/resources/spec_cases/y_structure_lonely_null.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_structure_lonely_string.json b/formats/json/jvmTest/resources/spec_cases/y_structure_lonely_string.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_structure_lonely_string.json
rename to formats/json/jvmTest/resources/spec_cases/y_structure_lonely_string.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_structure_lonely_true.json b/formats/json/jvmTest/resources/spec_cases/y_structure_lonely_true.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_structure_lonely_true.json
rename to formats/json/jvmTest/resources/spec_cases/y_structure_lonely_true.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_structure_string_empty.json b/formats/json/jvmTest/resources/spec_cases/y_structure_string_empty.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_structure_string_empty.json
rename to formats/json/jvmTest/resources/spec_cases/y_structure_string_empty.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_structure_trailing_newline.json b/formats/json/jvmTest/resources/spec_cases/y_structure_trailing_newline.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_structure_trailing_newline.json
rename to formats/json/jvmTest/resources/spec_cases/y_structure_trailing_newline.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_structure_true_in_array.json b/formats/json/jvmTest/resources/spec_cases/y_structure_true_in_array.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_structure_true_in_array.json
rename to formats/json/jvmTest/resources/spec_cases/y_structure_true_in_array.json
diff --git a/runtime/jvmTest/resources/spec_cases/y_structure_whitespace_array.json b/formats/json/jvmTest/resources/spec_cases/y_structure_whitespace_array.json
similarity index 100%
rename from runtime/jvmTest/resources/spec_cases/y_structure_whitespace_array.json
rename to formats/json/jvmTest/resources/spec_cases/y_structure_whitespace_array.json
diff --git a/runtime/jvmTest/src/kotlinx/serialization/JavaCollectionsTest.kt b/formats/json/jvmTest/src/kotlinx/serialization/JavaCollectionsTest.kt
similarity index 100%
rename from runtime/jvmTest/src/kotlinx/serialization/JavaCollectionsTest.kt
rename to formats/json/jvmTest/src/kotlinx/serialization/JavaCollectionsTest.kt
diff --git a/runtime/jvmTest/src/kotlinx/serialization/SerializationCasesTest.kt b/formats/json/jvmTest/src/kotlinx/serialization/SerializationCasesTest.kt
similarity index 100%
rename from runtime/jvmTest/src/kotlinx/serialization/SerializationCasesTest.kt
rename to formats/json/jvmTest/src/kotlinx/serialization/SerializationCasesTest.kt
diff --git a/runtime/jvmTest/src/kotlinx/serialization/features/SerializeJavaClassTest.kt b/formats/json/jvmTest/src/kotlinx/serialization/SerializeJavaClassTest.kt
similarity index 97%
rename from runtime/jvmTest/src/kotlinx/serialization/features/SerializeJavaClassTest.kt
rename to formats/json/jvmTest/src/kotlinx/serialization/SerializeJavaClassTest.kt
index 3d962d5cef..db79b47798 100644
--- a/runtime/jvmTest/src/kotlinx/serialization/features/SerializeJavaClassTest.kt
+++ b/formats/json/jvmTest/src/kotlinx/serialization/SerializeJavaClassTest.kt
@@ -2,7 +2,7 @@
* Copyright 2017-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.serialization.features
+package kotlinx.serialization
import kotlinx.serialization.*
import kotlinx.serialization.descriptors.*
diff --git a/runtime/jvmTest/src/kotlinx/serialization/SerializerForNullableJavaTypeTest.kt b/formats/json/jvmTest/src/kotlinx/serialization/SerializerForNullableJavaTypeTest.kt
similarity index 100%
rename from runtime/jvmTest/src/kotlinx/serialization/SerializerForNullableJavaTypeTest.kt
rename to formats/json/jvmTest/src/kotlinx/serialization/SerializerForNullableJavaTypeTest.kt
diff --git a/runtime/jvmTest/src/kotlinx/serialization/features/ContextualSerializationOnFileTest.kt b/formats/json/jvmTest/src/kotlinx/serialization/features/ContextualSerializationOnFileTest.kt
similarity index 100%
rename from runtime/jvmTest/src/kotlinx/serialization/features/ContextualSerializationOnFileTest.kt
rename to formats/json/jvmTest/src/kotlinx/serialization/features/ContextualSerializationOnFileTest.kt
diff --git a/runtime/jvmTest/src/kotlinx/serialization/features/InternalInheritanceTest.kt b/formats/json/jvmTest/src/kotlinx/serialization/features/InternalInheritanceTest.kt
similarity index 100%
rename from runtime/jvmTest/src/kotlinx/serialization/features/InternalInheritanceTest.kt
rename to formats/json/jvmTest/src/kotlinx/serialization/features/InternalInheritanceTest.kt
diff --git a/runtime/jvmTest/src/kotlinx/serialization/features/JsonUpdateCustomTest.kt b/formats/json/jvmTest/src/kotlinx/serialization/features/JsonUpdateCustomTest.kt
similarity index 100%
rename from runtime/jvmTest/src/kotlinx/serialization/features/JsonUpdateCustomTest.kt
rename to formats/json/jvmTest/src/kotlinx/serialization/features/JsonUpdateCustomTest.kt
diff --git a/runtime/jvmTest/src/kotlinx/serialization/features/SerializerByTypeTest.kt b/formats/json/jvmTest/src/kotlinx/serialization/features/SerializerByTypeTest.kt
similarity index 100%
rename from runtime/jvmTest/src/kotlinx/serialization/features/SerializerByTypeTest.kt
rename to formats/json/jvmTest/src/kotlinx/serialization/features/SerializerByTypeTest.kt
diff --git a/runtime/jvmTest/src/kotlinx/serialization/formats/json/GsonCompatibilityTest.kt b/formats/json/jvmTest/src/kotlinx/serialization/json/GsonCompatibilityTest.kt
similarity index 97%
rename from runtime/jvmTest/src/kotlinx/serialization/formats/json/GsonCompatibilityTest.kt
rename to formats/json/jvmTest/src/kotlinx/serialization/json/GsonCompatibilityTest.kt
index 158d0e3b97..15b6226751 100644
--- a/runtime/jvmTest/src/kotlinx/serialization/formats/json/GsonCompatibilityTest.kt
+++ b/formats/json/jvmTest/src/kotlinx/serialization/json/GsonCompatibilityTest.kt
@@ -1,4 +1,4 @@
-package kotlinx.serialization.formats.json
+package kotlinx.serialization.json
import com.google.gson.*
import kotlinx.serialization.*
diff --git a/runtime/jvmTest/src/kotlinx/serialization/formats/json/SpecConformanceTest.kt b/formats/json/jvmTest/src/kotlinx/serialization/json/SpecConformanceTest.kt
similarity index 98%
rename from runtime/jvmTest/src/kotlinx/serialization/formats/json/SpecConformanceTest.kt
rename to formats/json/jvmTest/src/kotlinx/serialization/json/SpecConformanceTest.kt
index ebce51d26e..a36a3e5ef7 100644
Binary files a/runtime/jvmTest/src/kotlinx/serialization/formats/json/SpecConformanceTest.kt and b/formats/json/jvmTest/src/kotlinx/serialization/json/SpecConformanceTest.kt differ
diff --git a/formats/json/jvmTest/src/kotlinx/serialization/test/CurrentPlatform.kt b/formats/json/jvmTest/src/kotlinx/serialization/test/CurrentPlatform.kt
new file mode 100644
index 0000000000..91aa17f050
--- /dev/null
+++ b/formats/json/jvmTest/src/kotlinx/serialization/test/CurrentPlatform.kt
@@ -0,0 +1,8 @@
+/*
+ * Copyright 2017-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
+ */
+
+package kotlinx.serialization.test
+
+
+public actual val currentPlatform: Platform = Platform.JVM
diff --git a/formats/json/nativeTest/src/kotlinx/serialization/test/CurrentPlatform.kt b/formats/json/nativeTest/src/kotlinx/serialization/test/CurrentPlatform.kt
new file mode 100644
index 0000000000..5824904487
--- /dev/null
+++ b/formats/json/nativeTest/src/kotlinx/serialization/test/CurrentPlatform.kt
@@ -0,0 +1,8 @@
+/*
+ * Copyright 2017-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
+ */
+
+package kotlinx.serialization.test
+
+
+public actual val currentPlatform: Platform = Platform.NATIVE
diff --git a/gradle/dokka.gradle b/gradle/dokka.gradle
index 1c090ec275..e59945bdf4 100644
--- a/gradle/dokka.gradle
+++ b/gradle/dokka.gradle
@@ -10,6 +10,7 @@ dokka {
outputDirectory = "$buildDir/dokka"
subProjects = ["kotlinx-serialization-core",
+ "kotlinx-serialization-json",
"kotlinx-serialization-cbor",
"kotlinx-serialization-properties",
// "kotlinx-serialization-hocon", todo: fix publishing of jvm-only docs
diff --git a/gradle/publishing.gradle b/gradle/publishing.gradle
index b27d99d0bd..8d9f9ce1b0 100644
--- a/gradle/publishing.gradle
+++ b/gradle/publishing.gradle
@@ -11,7 +11,7 @@ apply plugin: 'maven-publish'
apply from: project.rootProject.file('gradle/mavenMetadata.gradle')
-def isMultiplatform = project.name in ["kotlinx-serialization-core", "kotlinx-serialization-protobuf",
+def isMultiplatform = project.name in ["kotlinx-serialization-core", "kotlinx-serialization-json","kotlinx-serialization-protobuf",
"kotlinx-serialization-cbor", "kotlinx-serialization-properties"]
def isKotlin137x = VersionNumber.parse(kotlin_version) <= VersionNumber.parse("1.3.79")
@@ -115,7 +115,6 @@ task bintrayUpload(dependsOn: publish)
// This is required for K/N publishing
bintrayUpload.dependsOn publishToMavenLocal
-
private void disableMetadataPublicationKotlinJvm() {
publishing.publications.each { pub ->
pub.moduleDescriptorGenerator = null
diff --git a/guide/build.gradle b/guide/build.gradle
index b3974d0dbb..19eabd04a0 100644
--- a/guide/build.gradle
+++ b/guide/build.gradle
@@ -5,6 +5,7 @@ dependencies {
testImplementation "org.jetbrains.kotlin:kotlin-test-junit"
testImplementation "org.jetbrains.kotlinx:kotlinx-knit-test:$knit_version"
testImplementation project(":kotlinx-serialization-core")
+ testImplementation project(":kotlinx-serialization-json")
testImplementation project(":kotlinx-serialization-cbor")
testImplementation project(":kotlinx-serialization-protobuf")
testImplementation project(":kotlinx-serialization-properties")
diff --git a/integration-test/build.gradle b/integration-test/build.gradle
index 4cb6d16f2d..ab82141454 100644
--- a/integration-test/build.gradle
+++ b/integration-test/build.gradle
@@ -59,6 +59,7 @@ kotlin {
dependencies {
implementation kotlin('stdlib-common')
implementation "org.jetbrains.kotlinx:kotlinx-serialization-core:$serialization_version"
+ implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:$serialization_version"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-protobuf:$serialization_version"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-cbor:$serialization_version"
}
diff --git a/runtime/commonTest/src/kotlinx/serialization/features/PolymorphismDocumentationSample.kt b/runtime/commonTest/src/kotlinx/serialization/features/PolymorphismDocumentationSample.kt
deleted file mode 100644
index 3861fb15d8..0000000000
--- a/runtime/commonTest/src/kotlinx/serialization/features/PolymorphismDocumentationSample.kt
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright 2017-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package kotlinx.serialization.features
-
-import kotlinx.serialization.SerialName
-import kotlinx.serialization.Serializable
-import kotlinx.serialization.json.Json
-import kotlinx.serialization.modules.*
-import kotlinx.serialization.test.assertStringFormAndRestored
-import kotlin.test.Test
-
-class PolymorphismDocumentationSample {
-
- interface Message
-
- @Serializable
- data class StringMessage(val message: String) : Message
-
- @Serializable
- @SerialName("msg_number")
- data class IntMessage(val number: Int) : Message
-
- val messageModule = SerializersModule {
- polymorphic(Message::class) {
- subclass(StringMessage.serializer())
- subclass(IntMessage.serializer())
- }
- }
-
- val json = Json { serializersModule = messageModule }
-
- val jsonWithArrays = Json {
- useArrayPolymorphism = true
- serializersModule = messageModule
- }
-
- @Serializable
- data class MessageWrapper(val m: Message)
-
- @Test
- fun testStringMessage() = assertStringFormAndRestored(
- """{"m":{"type":"kotlinx.serialization.features.PolymorphismDocumentationSample.StringMessage","message":"string"}}""",
- MessageWrapper(StringMessage("string")),
- MessageWrapper.serializer(),
- json
- )
-
- @Test
- fun testIntMessage() = assertStringFormAndRestored(
- """{"m":["msg_number",{"number":121}]}""",
- MessageWrapper(IntMessage(121)),
- MessageWrapper.serializer(),
- jsonWithArrays
- )
-}
diff --git a/runtime/jsTest/src/kotlinx/serialization/StringTest.kt b/runtime/jsTest/src/kotlinx/serialization/StringTest.kt
deleted file mode 100644
index a0edd60681..0000000000
--- a/runtime/jsTest/src/kotlinx/serialization/StringTest.kt
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright 2017-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package kotlinx.serialization
-
-import kotlinx.serialization.internal.InternalHexConverter
-import kotlin.test.Test
-import kotlin.test.assertEquals
-
-class StringTest {
- @Test
- fun testCreateString() {
- val charArr = charArrayOf('a', 'b', 'c', 'd')
- val content = String(charArr, 0, 2)
- assertEquals("ab", content)
- }
-}
diff --git a/settings.gradle b/settings.gradle
index 29e9469f43..88bcb9427e 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -6,7 +6,10 @@ rootProject.name = 'kotlinx-serialization'
enableFeaturePreview('GRADLE_METADATA')
include ':kotlinx-serialization-core'
-project(':kotlinx-serialization-core').projectDir = file('./runtime')
+project(':kotlinx-serialization-core').projectDir = file('./core')
+
+include ':kotlinx-serialization-json'
+project(':kotlinx-serialization-json').projectDir = file('./formats/json')
include ':kotlinx-serialization-protobuf'
project(':kotlinx-serialization-protobuf').projectDir = file('./formats/protobuf')