Kotlin 2.0.0 stable version released, K2 compiler has been stabilized

Source: OSCHINA
Edit: game
2024-05-23 10:40:00

5.24 Update:

JetBrains officially launched on KotlinConf 2024 Official announcement Kotlin 2.0, It is said that the new version is fast, intelligent, and supports multiple platforms, which can significantly improve daily work efficiency.

  • Multi platform support from scratch
  • Compilation speed doubled
  • Enhanced code analysis

Related Documents


The stable version of Kotlin 2.0.0 was released - but not completely released, because its team plans to officially announce it at today's KotlinConf 2024 conference.

However, the new version features and source code have been provided:

Kotlin 2.0 Highlights

  1. K2 compiler

    • stable : It is used for all platforms by default, and the performance is significantly improved.
  2. IDE support

    • The new Kotlin plug-in is bundled in IntelliJ IDEA and Android Studio.
  3. Gradle integration

    • New DSL : Experimental compiler option configuration for multi platform projects.
    • Compose plug-in : Enhance support for Jetpack Compose.
  4. Lambda function

    • invokedynamic : Generates smaller binaries, but lambda is not serializable.
  5. Kotlinx metadata jvm library

    • Stable version, which provides APIs for reading and modifying the metadata of JVM binary files.
  6. Kotlin/Native enhancements

    • GC monitoring : Improve garbage collection performance monitoring on the Apple platform.
    • Method conflict resolution : Improve conflict handling with Objective-C method.
  7. Kotlin/Wasm

    • Support named exports and unsigned primitive types @JsExport Function.
  8. Intelligent type conversion

    • improvement if when and while Block to reduce manual type assertion.

In general, there are no new features in the Kotlin 2.0.0 language layer, mainly the introduction of the K2 compiler, which improves the performance. According to the official introduction, the front end of K2 compiler is not only a reconstruction of the old compiler front end, but a complete rewrite based on the new architecture from scratch.

The development team said that they had minimized the number and impact of disruptive changes, so they would "consciously avoid introducing any new features in Kotlin 2.0" during the development phase, and "try their best to minimize the impact of code migration from Kotlin 1.9 to Kotlin 2.0".

Read more: K2 compiler will enter stable state in Kotlin 2.0

Expand to read the full text
Click to join the discussion 🔥 (4) Post and join the discussion 🔥
This wonderful review
The team's skills are uneven, so it's better not to use kt, or else it will increase the output of Shishan
2024-05-23 18:15
three fabulous
report
four comment
four Collection
 Back to top
Top