You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p><a href="https://github.com/JetBrains/kotlin/releases/tag/v2.1.20-RC" target="_blank">Release on GitHub</a></p>
46
+
<td><strong>2.1.20-RC2</strong>
47
+
<p>Released: <strong>March 6, 2025</strong></p>
48
+
<p><a href="https://github.com/JetBrains/kotlin/releases/tag/v2.1.20-RC2" target="_blank">Release on GitHub</a></p>
49
49
</td>
50
50
<td>
51
51
<p>A tooling release with K2 kapt enabled by default.</p>
52
-
<p>For more details, please refer to the <a href="https://github.com/JetBrains/kotlin/releases/tag/v2.1.20-RC">changelog</a> or <a href="whatsnew-eap.md">What's new in Kotlin 2.1.20-RC</a>.</p>
52
+
<p>For more details, please refer to the <a href="https://github.com/JetBrains/kotlin/releases/tag/v2.1.20-RC2">changelog</a> or <a href="whatsnew-eap.md">What's new in Kotlin 2.1.20-RC2</a>.</p>
*[Kotlin/Wasm: default custom formatters and migration to Provider API](#kotlin-wasm)
19
+
*[Gradle: support for Gradle 8.11, compatibility with Isolated Projects, and custom publication variants](#support-for-adding-custom-gradle-publication-variants)
20
+
*[Standard library: common atomic types, improved UUID support, and new time tracking functionality](#standard-library)
### Migration to Provider API for Kotlin/Wasm and Kotlin/JS properties
130
163
131
164
Previously, properties in Kotlin/Wasm and Kotlin/JS extensions were mutable (`var`) and assigned directly in build
132
165
scripts:
@@ -172,6 +205,36 @@ must update property assignments to use the `.set()` function.
172
205
### Support for version 8.11
173
206
Kotlin %kotlinEapVersion% is now compatible with the latest stable Gradle version, 8.11, and supports its features.
174
207
208
+
### Kotlin Gradle plugin compatible with Gradle's Isolated Projects
209
+
<primary-labelref="experimental-opt-in"/>
210
+
211
+
> This feature is currently in a pre-Alpha state in Gradle.
212
+
> Use it only with Gradle version 8.10 or higher and solely for evaluation purposes.
213
+
>
214
+
{style="warning"}
215
+
216
+
Since Kotlin 2.1.0, you've been able to [preview Gradle's Isolated Projects feature](whatsnew21.md#preview-gradle-s-isolated-projects-in-kotlin-multiplatform)
217
+
in your projects.
218
+
219
+
Previously, you had to configure the Kotlin Gradle plugin to make your project compatible with the Isolated Projects
220
+
feature before you could try it out. In Kotlin %kotlinEapVersion%, this additional step is no longer necessary.
221
+
222
+
Now, to enable the Isolated Projects feature, you only need to [set the system property](https://docs.gradle.org/current/userguide/isolated_projects.html#how_do_i_use_it).
223
+
224
+
Gradle’s Isolated Projects feature is supported in Kotlin Gradle plugins for both multiplatform projects and projects
225
+
that contain only the JVM or Android target.
226
+
227
+
Specifically for multiplatform projects, if you notice problems with your Gradle build after upgrading, you can opt out
228
+
of the new Kotlin Gradle plugin behavior by setting:
229
+
230
+
```none
231
+
kotlin.kmp.isolated-projects.support=disable
232
+
```
233
+
234
+
However, if you use this Gradle property in your multiplatform project, you can't use the Isolated Projects feature.
235
+
236
+
We would appreciate your feedback on this feature in [YouTrack](https://youtrack.jetbrains.com/issue/KT-57279/Support-Gradle-Project-Isolation-Feature-for-Kotlin-Multiplatform).
237
+
175
238
### Support for adding custom Gradle publication variants
176
239
<primary-labelref="experimental-opt-in"/>
177
240
@@ -182,9 +245,8 @@ This feature is available for multiplatform projects and projects targeting the
182
245
>
183
246
{style="note"}
184
247
185
-
This feature is [Experimental](components-stability.md#stability-levels-explained). To opt in,
186
-
use the `@OptIn(ExperimentalKotlinGradlePluginApi::class)` annotation or the compiler option
### Changes in UUID parsing and formatting functions
356
+
### Changes in UUID parsing, formatting, and comparability
295
357
<primary-labelref="experimental-opt-in"/>
296
358
297
359
The JetBrains team continues to improve the support for UUIDs [introduced to the standard library in 2.0.20](whatsnew2020.md#support-for-uuids-in-the-common-kotlin-standard-library).
@@ -309,8 +371,13 @@ and [`toHexString()`](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.uuid/
309
371
introduced earlier for the hexadecimal format. Explicit naming for parsing and formatting functionality should improve
310
372
code clarity and your overall experience with UUIDs.
311
373
374
+
UUIDs in Kotlin are now `Comparable`. Starting with Kotlin %kotlinEapVersion%, you can directly compare and sort values
375
+
of the `Uuid` type. This enables the use of the `<` and `>` operators, standard library extensions available exclusively
376
+
for `Comparable` types or their collections (such as `sorted()`), and allows passing UUIDs to any functions or APIs that
377
+
require the `Comparable` interface.
378
+
312
379
Remember that the UUID support in the standard library is still [Experimental](components-stability.md#stability-levels-explained).
313
-
To opt in, use the `@ExperimentalUuidApi` annotation or the compiler option `-opt-in=kotlin.uuid.ExperimentalUuidApi`:
380
+
To opt in, use the `@OptIn(ExperimentalUuidApi::class)` annotation or the compiler option `-opt-in=kotlin.uuid.ExperimentalUuidApi`:
Starting with Kotlin %kotlinEapVersion%, the standard library provides the ability to represent a moment in time.
415
+
This functionality was previously only available in [`kotlinx-datetime`](https://kotlinlang.org/api/kotlinx-datetime/),
416
+
an official Kotlin library.
417
+
418
+
The [kotlinx.datetime.Clock](https://kotlinlang.org/api/kotlinx-datetime/kotlinx-datetime/kotlinx.datetime/-clock/)
419
+
interface is introduced to the standard library as `kotlin.time.Clock` and the [`kotlinx.datetime.Instant`](https://kotlinlang.org/api/kotlinx-datetime/kotlinx-datetime/kotlinx.datetime/-instant/)
420
+
class as `kotlin.time.Instant`. These concepts naturally align with the `time` package in the standard library because
421
+
they’re only concerned with moments in time compared to a more complex calendar and timezone functionality that remains
422
+
in `kotlinx-datetime`.
423
+
424
+
`Instant` and `Clock` are useful when you need precise time tracking without considering time zones or dates.
425
+
For example, you can use them to log events with timestamps, measure durations between two points in time,
426
+
and obtain the current moment for system processes.
427
+
428
+
To provide interoperability with other languages, additional converter functions are available:
429
+
430
+
*`.toKotlinInstant()` converts a time value to a `kotlin.time.Instant` instance.
431
+
*`.toJavaInstant()` converts the `kotlin.time.Instant` value to a `java.time.Instant` value.
432
+
*`Instant.toJSDate()` converts the `kotlin.time.Instant` value to an instance of the JS `Date` class. This conversion
433
+
is not precise, JS uses millisecond precision to represent dates, while Kotlin allows for nanosecond resolution.
434
+
435
+
The new time features of the standard library are still [Experimental](components-stability.md#stability-levels-explained).
436
+
To opt in, use the `@OptIn(ExperimentalTime::class)` annotation:
437
+
438
+
```kotlin
439
+
importkotlin.time.*
440
+
441
+
@OptIn(ExperimentalTime::class)
442
+
funmain() {
443
+
444
+
// Get the current moment in time
445
+
val currentInstant =Clock.System.now()
446
+
println("Current time: $currentInstant")
447
+
448
+
// Find the difference between two moments in time
449
+
val pastInstant =Instant.parse("2023-01-01T00:00:00Z")
450
+
val duration = currentInstant - pastInstant
451
+
452
+
println("Time elapsed since 2023-01-01: $duration")
0 commit comments