Skip to content

Commit 920f589

Browse files
authored
Prepare 1.3.0-RC release (#1658)
1 parent 779acb2 commit 920f589

File tree

3 files changed

+91
-10
lines changed

3 files changed

+91
-10
lines changed

CHANGELOG.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,78 @@
1+
1.3.0-RC / 2021-09-06
2+
==================
3+
4+
This is a release candidate for the next version. It contains a lot of interesting features and improvements,
5+
so we ask you to evaluate it and share your feedback.
6+
Kotlin 1.5.30 is used by default.
7+
8+
### Java IO stream-based JSON serialization
9+
10+
Finally, in `kotlinx.serialization` 1.3.0 we’re presenting the first experimental version of the serialization API for IO streams:
11+
`Json.encodeToStream` and `Json.decodeFromStream` extension functions.
12+
With this API, you can decode objects directly from files, network connections, and other data sources without reading the data to strings beforehand.
13+
The opposite operation is also available: you can send encoded objects directly to files and other streams in a single API call.
14+
IO stream serialization is available only on the JVM platform and for the JSON format for now.
15+
16+
Check out more in the [PR](https://github.com/Kotlin/kotlinx.serialization/pull/1569).
17+
18+
### Property-level control over defaults values encoding
19+
20+
Previous versions of the library allowed to specify whether to encode or drop default properties values with
21+
format configuration flags such as `Json { encodeDefaults = false }`.
22+
In 1.3.0 we’re extending this feature by adding a new way to fine-tune the serialization of default values:
23+
you can now control it on the property level using the new `@EncodeDefaults` annotation.
24+
25+
`@EncodeDefaults` annotation has a higher priority over the `encodeDefaults` property and takes one of two possible values:
26+
- `ALWAYS` (default value) encodes a property value even if it equals to default.
27+
- `NEVER` doesn’t encode the default value regardless of the format configuration.
28+
29+
Encoding of the annotated properties is not affected by `encodeDefault` format flag
30+
and works as described for all serialization formats, not only JSON.
31+
32+
To learn more, check corresponding [PR](https://github.com/Kotlin/kotlinx.serialization/pull/1528).
33+
34+
### Excluding null values from JSON serialization
35+
36+
In 1.3.0, we’re introducing one more way to reduce the size of the generated JSON strings: omitting null values.
37+
A new JSON configuration property `explicitNulls` defines whether `null` property values should be included in the serialized JSON string.
38+
The difference from `encodeDefaults` is that `explicitNulls = false` flag drops null values even if the property does not have a default value.
39+
Upon deserializing such a missing property, a `null` or default value (if it exists) will be used.
40+
41+
To maintain backwards compatibility, this flag is set to `true` by default.
42+
You can learn more in the [documentation](docs/json.md#explicit-nulls) or the [PR](https://github.com/Kotlin/kotlinx.serialization/pull/1535).
43+
44+
### Per-hierarchy polymorphic class discriminators
45+
46+
In previous versions, you could change the discriminator name using the
47+
[classDiscriminator](https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/json.md#class-discriminator) property of the `Json` instance.
48+
In 1.3.0, we’re adding a way to set a custom discriminator name for each class hierarchy to enable more flexible serialization.
49+
You can do it by annotating a class with `@JsonClassDiscriminator` with the discriminator name as its argument.
50+
A custom discriminator is applied to the annotated class and its subclasses.
51+
Only one custom discriminator can be used in each class hierarchy, thanks to the new `@InheritableSerialInfo` annotation.
52+
53+
Check out corresponding [PR](https://github.com/Kotlin/kotlinx.serialization/pull/1608) for details.
54+
55+
### Support for Java module system
56+
57+
Now all kotlinx.serialization runtime libraries are shipped as a multi-release JAR with `module-info.class` file for Java versions 9 and higher.
58+
This enables possibilities to use kotlinx.serialization with modern tools such as `jlink` and various technologies such as `TorandoFX`.
59+
60+
Many thanks to our contributor [Gerard de Leeuw](https://github.com/lion7) and his [PR](https://github.com/Kotlin/kotlinx.serialization/pull/1624) for making this possible.
61+
62+
### Native targets for Apple Silicon
63+
64+
This release includes klibs for new targets, introduced in Kotlin/Native 1.5.30 —
65+
`macosArm64`, `iosSimulatorArm64`, `watchosSimulatorArm64`, and `tvosSimulatorArm64`.
66+
67+
### Bugfixes and improvements
68+
69+
* Properly handle quoted 'null' literals in lenient mode (#1637)
70+
* Switch on deep recursive function when nested level of JSON is too deep (#1596)
71+
* Support for local serializable classes in IR compiler
72+
* Support default values for `@SerialInfo` annotations in IR compiler
73+
* Improve error message for JsonTreeReader (#1597)
74+
* Add guide for delegating serializers and wrapping serial descriptor (#1591)
75+
* Set target JVM version to 8 for Hocon module in Gradle metadata (#1661)
176

277
1.2.2 / 2021-07-08
378
==================

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![official JetBrains project](https://jb.gg/badges/official.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)
44
[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0)
55
[![TeamCity build](https://img.shields.io/teamcity/http/teamcity.jetbrains.com/s/KotlinTools_KotlinxSerialization_Ko.svg)](https://teamcity.jetbrains.com/viewType.html?buildTypeId=KotlinTools_KotlinxSerialization_Ko&guest=1)
6-
[![Kotlin](https://img.shields.io/badge/kotlin-1.5.20-blue.svg?logo=kotlin)](http://kotlinlang.org)
6+
[![Kotlin](https://img.shields.io/badge/kotlin-1.5.30-blue.svg?logo=kotlin)](http://kotlinlang.org)
77
[![Maven Central](https://img.shields.io/maven-central/v/org.jetbrains.kotlinx/kotlinx-serialization-core/1.2.2)](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-serialization-core/1.2.2/pom)
88
[![KDoc link](https://img.shields.io/badge/API_reference-KDoc-blue)](https://kotlin.github.io/kotlinx.serialization/)
99
[![Slack channel](https://img.shields.io/badge/chat-slack-blue.svg?logo=slack)](https://kotlinlang.slack.com/messages/serialization/)
@@ -88,17 +88,17 @@ Kotlin DSL:
8888

8989
```kotlin
9090
plugins {
91-
kotlin("jvm") version "1.5.20" // or kotlin("multiplatform") or any other kotlin plugin
92-
kotlin("plugin.serialization") version "1.5.20"
91+
kotlin("jvm") version "1.5.30" // or kotlin("multiplatform") or any other kotlin plugin
92+
kotlin("plugin.serialization") version "1.5.30"
9393
}
9494
```
9595

9696
Groovy DSL:
9797

9898
```gradle
9999
plugins {
100-
id 'org.jetbrains.kotlin.multiplatform' version '1.5.20'
101-
id 'org.jetbrains.kotlin.plugin.serialization' version '1.5.20'
100+
id 'org.jetbrains.kotlin.multiplatform' version '1.5.30'
101+
id 'org.jetbrains.kotlin.plugin.serialization' version '1.5.30'
102102
}
103103
```
104104

@@ -115,7 +115,7 @@ buildscript {
115115
repositories { mavenCentral() }
116116

117117
dependencies {
118-
val kotlinVersion = "1.5.20"
118+
val kotlinVersion = "1.5.30"
119119
classpath(kotlin("gradle-plugin", version = kotlinVersion))
120120
classpath(kotlin("serialization", version = kotlinVersion))
121121
}
@@ -126,7 +126,7 @@ Groovy DSL:
126126

127127
```gradle
128128
buildscript {
129-
ext.kotlin_version = '1.5.20'
129+
ext.kotlin_version = '1.5.30'
130130
repositories { mavenCentral() }
131131
132132
dependencies {
@@ -222,7 +222,7 @@ Ensure the proper version of Kotlin and serialization version:
222222

223223
```xml
224224
<properties>
225-
<kotlin.version>1.5.20</kotlin.version>
225+
<kotlin.version>1.5.30</kotlin.version>
226226
<serialization.version>1.2.2</serialization.version>
227227
</properties>
228228
```

buildSrc/build.gradle.kts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import org.jetbrains.kotlin.gradle.plugin.*
21
import java.util.*
2+
import java.io.FileInputStream
33

44
plugins {
55
`kotlin-dsl`
@@ -9,8 +9,14 @@ repositories {
99
mavenCentral()
1010
}
1111

12+
val kotlinVersion = FileInputStream(file("../gradle.properties")).use { propFile ->
13+
val ver = Properties().apply { load(propFile) }["kotlin.version"]
14+
require(ver is String) { "kotlin.version must be string in ../gradle.properties, got $ver instead" }
15+
ver
16+
}
17+
1218
dependencies {
13-
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.30-RC")
19+
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
1420
}
1521

1622
kotlinDslPluginOptions {

0 commit comments

Comments
 (0)