Skip to content

Commit 69050a3

Browse files
authored
Prepare 1.8.0-RC release (#2880)
1 parent c4f798c commit 69050a3

File tree

4 files changed

+78
-14
lines changed

4 files changed

+78
-14
lines changed

CHANGELOG.md

+64
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,67 @@
1+
1.8.0-RC / 2024-13-10
2+
==================
3+
4+
This is a release candidate for the next version. It is based on Kotlin 2.1.0 and includes a few new features, as well
5+
as bugfixes and improvements:
6+
7+
## `@JsonIgnoreUnknownKeys` annotation
8+
9+
Previously, only global setting `JsonBuilder.ignoreUnknownKeys` controlled whether Json parser would throw exception if
10+
input contained a property that was not declared in a `@Serializable` class.
11+
There were [a lot of complaints](https://github.com/Kotlin/kotlinx.serialization/issues/1420) that this setting is not
12+
flexible enough.
13+
To address them, we added new `@JsonIgnoreUnknownKeys` annotation that can be applied on a per-class basis.
14+
With this annotation, it is possible to allow unknown properties for annotated classes, while
15+
general decoding methods (such as `Json.decodeFromString` and others) would still reject them for everything else.
16+
See details in the corresponding [PR](https://github.com/Kotlin/kotlinx.serialization/pull/2874).
17+
18+
## Stabilization of `SerialDescriptor` API and `@SealedSerializationApi` annotation
19+
20+
`SerialDescriptor`, `SerialKind`, and related API has been around for a long time and has proven itself useful.
21+
The main reason `@ExperimentalSerializationApi` was on SerialDescriptor's properties is that we wanted to discourage
22+
people from subclassing it.
23+
Fortunately, Kotlin 2.1 provides a special mechanism for such a
24+
case — [SubclassOptInRequired](https://kotlinlang.org/docs/opt-in-requirements.html#opt-in-to-inherit-from-a-class-or-interface).
25+
New `kotlinx.serialization.SealedSerializationApi` annotation designates APIs
26+
as public for use, but closed for implementation — the case for SerialDescriptor, which is a non-sealed interface for
27+
technical reasons.
28+
Now you can use most of `SerialDescriptor` and its builders API without the need to opt-in into experimental
29+
serialization API.
30+
See the [PR](https://github.com/Kotlin/kotlinx.serialization/pull/2827) for more details.
31+
32+
_Note_: All `SerialKind`s are stable API now, except `PolymorphicKind` — we may want to expand it in the future.
33+
34+
## Generate Java 8's default method implementations in interfaces
35+
36+
**TL;DR This change ensures better binary compatibility in the future for library. You should not experience any
37+
difference from it.**
38+
39+
kotlinx.serialization library contains a lot of interfaces with default method implementations. Historically, Kotlin
40+
compiled a synthetic `DefaultImpls` class for them.
41+
[Starting from Kotlin 1.4](https://blog.jetbrains.com/kotlin/2020/07/kotlin-1-4-m3-generating-default-methods-in-interfaces/),
42+
it was possible to compile them using as Java 8's `default` methods to ensure
43+
that new methods can still be added to interfaces without the need for implementors to recompile.
44+
To preserve binary compatibility with existing clients, a special `all-compatbility` mode is supported in compiler
45+
to generate both `default` methods and synthetic `DefaultImpls` class.
46+
47+
Now, kotlinx.serialization finally makes use of this `all-compatibility` mode,
48+
which potentially allows us to add new methods to interfaces such as `SerialDescriptor`, `Encoder`, `Decoder`, etc.,
49+
without breaking existing clients. This change is expected to have no effect on existing clients, and no action from
50+
your side is required.
51+
Note that Kotlin 2.2 plans to enable `all-compatibility`
52+
mode [by default](https://youtrack.jetbrains.com/issue/KTLC-269).
53+
54+
## Other bugfixes and improvements
55+
56+
* Correctly skip structures with Cbor.ignoreUnknownKeys setting (#2873)
57+
* Handle missing system property without NPE (#2867)
58+
* Fixed keeping INSTANCE field and serializer function for serializable objects in R8 full mode (#2865)
59+
* Correctly parse invalid numbers in JsonLiteral.long and other extensions (#2852)
60+
* Correctly handle serial name conflict for different classes in SerializersModule.overwriteWith (#2856)
61+
* Add inline reified version of encodeToString as a Json member to streamline the experience for newcomers. (#2853)
62+
* Do not check kind or discriminator collisions for subclasses' polymorphic serializers if Json.classDiscriminatorMode
63+
is set to NONE (#2833)
64+
165
1.7.3 / 2024-09-19
266
==================
367

README.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
[![JetBrains official project](https://jb.gg/badges/official.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)
55
[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0)
66
[![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)
7-
[![Kotlin](https://img.shields.io/badge/kotlin-2.0.20-blue.svg?logo=kotlin)](http://kotlinlang.org)
8-
[![Maven Central](https://img.shields.io/maven-central/v/org.jetbrains.kotlinx/kotlinx-serialization-core/1.7.3)](https://central.sonatype.com/artifact/org.jetbrains.kotlinx/kotlinx-serialization-core/1.7.3)
7+
[![Kotlin](https://img.shields.io/badge/kotlin-2.1.0-blue.svg?logo=kotlin)](http://kotlinlang.org)
8+
[![Maven Central](https://img.shields.io/maven-central/v/org.jetbrains.kotlinx/kotlinx-serialization-core/1.8.0-RC)](https://central.sonatype.com/artifact/org.jetbrains.kotlinx/kotlinx-serialization-core/1.8.0-RC)
99
[![KDoc link](https://img.shields.io/badge/API_reference-KDoc-blue)](https://kotlinlang.org/api/kotlinx.serialization/)
1010
[![Slack channel](https://img.shields.io/badge/chat-slack-blue.svg?logo=slack)](https://kotlinlang.slack.com/messages/serialization/)
1111

@@ -95,17 +95,17 @@ Kotlin DSL:
9595

9696
```kotlin
9797
plugins {
98-
kotlin("jvm") version "2.0.20" // or kotlin("multiplatform") or any other kotlin plugin
99-
kotlin("plugin.serialization") version "2.0.20"
98+
kotlin("jvm") version "2.1.0" // or kotlin("multiplatform") or any other kotlin plugin
99+
kotlin("plugin.serialization") version "2.1.0"
100100
}
101101
```
102102

103103
Groovy DSL:
104104

105105
```gradle
106106
plugins {
107-
id 'org.jetbrains.kotlin.multiplatform' version '2.0.20'
108-
id 'org.jetbrains.kotlin.plugin.serialization' version '2.0.20'
107+
id 'org.jetbrains.kotlin.multiplatform' version '2.1.0'
108+
id 'org.jetbrains.kotlin.plugin.serialization' version '2.1.0'
109109
}
110110
```
111111

@@ -123,7 +123,7 @@ buildscript {
123123
repositories { mavenCentral() }
124124

125125
dependencies {
126-
val kotlinVersion = "2.0.20"
126+
val kotlinVersion = "2.1.0"
127127
classpath(kotlin("gradle-plugin", version = kotlinVersion))
128128
classpath(kotlin("serialization", version = kotlinVersion))
129129
}
@@ -134,7 +134,7 @@ Groovy DSL:
134134

135135
```gradle
136136
buildscript {
137-
ext.kotlin_version = '2.0.20'
137+
ext.kotlin_version = '2.1.0'
138138
repositories { mavenCentral() }
139139
140140
dependencies {
@@ -164,7 +164,7 @@ repositories {
164164
}
165165

166166
dependencies {
167-
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3")
167+
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.0-RC")
168168
}
169169
```
170170

@@ -176,7 +176,7 @@ repositories {
176176
}
177177
178178
dependencies {
179-
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3"
179+
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.0-RC"
180180
}
181181
```
182182

@@ -266,8 +266,8 @@ Ensure the proper version of Kotlin and serialization version:
266266

267267
```xml
268268
<properties>
269-
<kotlin.version>2.0.20</kotlin.version>
270-
<serialization.version>1.7.3</serialization.version>
269+
<kotlin.version>2.1.0</kotlin.version>
270+
<serialization.version>1.8.0-RC</serialization.version>
271271
</properties>
272272
```
273273

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44

55
group=org.jetbrains.kotlinx
6-
version=1.7.4-SNAPSHOT
6+
version=1.8.0-SNAPSHOT
77
jdk_toolchain_version=11
88

99
# This version takes precedence if 'bootstrap' property passed to project

integration-test/gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44

55
mainKotlinVersion=2.1.0
6-
mainLibVersion=1.7.4-SNAPSHOT
6+
mainLibVersion=1.8.0-SNAPSHOT
77

88
kotlin.code.style=official
99
kotlin.js.compiler=ir

0 commit comments

Comments
 (0)