Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The State of Kotlin | FOSDEM 2023

The State of Kotlin | FOSDEM 2023

Kotlin ecosystem is rapidly evolving over the years and 2022 was not an exception. Let's gather to recap everything that happened with Kotlin in the past year and to have a closer look at the language roadmap: from the new K2 compiler, to stable Kotlin Multiplatform and beyond.

Talk did together with Sergei Rybalkin

Marco Gomiero

February 04, 2023
Tweet

More Decks by Marco Gomiero

Other Decks in Programming

Transcript

  1. K2. SOLVING MAJOR INFRA PROBLEMS 6 ✦ IDE Stability &

    performance ✦ Build Speed ✦ Build Setup
  2. K2 9 ✦ K2 is in alpha with a promising

    impact on builds https://kotlinlang.org/docs/whatsnew17.html#new-kotlin-k2-compiler-for-the-jvm-in-alpha
  3. K2. FOR IMPATIENT 10 ✦ 1.6.21 to 1.7.x upgrade brings

    build improvements https://youtrack.jetbrains.com/issue/KT-48233/Switching-to-JVM-IR-backend-increases-compilation-time-by-more-than-15? _ga=2.68902353.1999403185.1669283102-592211788.1665648011&_gl=1*1fxko5p*_ga*NTkyMjExNzg4LjE2NjU2NDgwMTE.*_ga_9J976DJZ68*MTY2OTI4MzEwMi4zLjEuMTY2OTI4MzE4NS4wLjAuMA..#focus=Comments-27-6114542.0-0
  4. K2. BETA PLANS 11 ✦ Should be a fully-functional compiler

    ✦ Plans • Support the Multiplatform, Native, and JS backends. • Support Compose, kapt, KSP, Serializable, and other necessary plugins. https://youtrack.jetbrains.com/issue/KT-52604?_ga=2.93711642.642620354.1675451237-592211788.1665648011&_gl=1*df7plt*_ga*NTkyMjExNzg4LjE2NjU2NDgwMTE.*_ga_9J976DJZ68*MTY3NTQ1MTIzNy43LjAuMTY3NTQ1MTIzNy4wLjAuMA..
  5. K2. PLUGINS 12 ✦ kotlinx-serialization ✦ allopen, noarg ✦ lombok

    ✦ no support in KAPT ✦ no support in KSP
  6. K2 IDE 18 ✦ Performance ✦ Stability • K2 interaction

    with Analysis API ✦ Fewer features. A “Lightweight” release, as not all IDE features are implemented
  7. K2 IDE 19 ✦ Full code highlighting ✦ Basic code

    completion ✦ Debugger ✦ Basic Refactoring and Diagnostics ✦ Code formatter ✦ Run con fi gurations + gutters ✦ Gradle.kts support ✦ Kotlin Multiplatform support in all of the above features
  8. HIERARCHICAL PROJECT STRUCTURE ✦ Now enabled by default ✦ Share

    code between several similar targets: 
 e.g. iosArm64 and iosX64 21 https://kotlinlang.org/docs/whatsnew1620.html#hierarchical-structure-support-for-multiplatform-projects 1.6.20
  9. KOTLIN/NATIVE PERFORMANCE IMPROVEMENTS ✦ 15% reduction in execution time ✦

    20% reduction in the code size of both release and debug binaries ✦ 26% reduction in the compilation time of release binaries 22 1.6.20 https://kotlinlang.org/docs/whatsnew1620.html#performance-improvements
  10. NEW KOTLIN/NATIVE MEMORY MANAGER ✦ Now enabled by default ✦

    From deferred reference-counting GC to tracing GC ✦ No restrictions on object sharing between threads ✦ Fully leak-free concurrent programming primitives ✦ No more freezing 🥶 23 https://kotlinlang.org/docs/whatsnew1720.html#the-new-kotlin-native-memory-manager-enabled-by-default https://blog.jetbrains.com/kotlin/2021/05/kotlin-native-memory-management-update/ https://kotlinlang.org/docs/native-memory-manager.html 1.7.20
  11. KOTLIN MULTIPLATFORM MOBILE PROMOTED TO BETA 24 1.7.20 ✦ 🎉

    ✦ The technology is almost done and is safe to use in your projects ✦ Some more work on the toolchain is required ✦ Start using and learning KMM, it’s fun! https://blog.jetbrains.com/kotlin/2022/10/kmm-beta/
  12. IMPROVED OBJECTIVE-C/SWIFT INTEROPERABILITY 27 https://kotlinlang.org/docs/whatsnew18.html#improved-objective-c-swift-interoperability 1.8.0 @ShouldRefineInSwift The Kotlin compiler

    will mark a function or property as swift_private in the generated Objective-C API. 
 Such declarations get the __ pre fi x, which makes them “invisible” to Swift code.
  13. NEW ANDROID SOURCE SET LAYOUT 28 1.8.0 ✦ No more

    androidTest and androidAndroidTest 😅 ✦ Say hello to androidUnitTest and androidInstrumentedTest https://kotlinlang.org/docs/whatsnew18.html#kotlin-multiplatform-a-new-android-source-set-layout
  14. NEW ANDROID SOURCE SET LAYOUT 29 1.8.0 ✦ More clarity

    on the Manifest location https://kotlinlang.org/docs/whatsnew18.html#kotlin-multiplatform-a-new-android-source-set-layout
  15. NEW ANDROID SOURCE SET LAYOUT 30 1.8.0 ✦ Enable the

    new layout with a Gradle Option kotlin.mpp.androidSourceSetLayoutVersion=2 https://kotlinlang.org/docs/whatsnew18.html#kotlin-multiplatform-a-new-android-source-set-layout
  16. STABLE KOTLIN/JS IR COMPILER BACKEND 31 1.8.0 ✦ Kotlin/JS IR

    compiler backend is now Stable ✦ Incremental compilation enabled by default ✦ All the three backends now works with the same IR for Kotlin code https://kotlinlang.org/docs/whatsnew18.html#stable-js-ir-compiler-backend
  17. KOTLIN/NATIVE: BINARY COMPATIBILITY BETWEEN INCREMENTAL RELEASES 32 https://youtrack.jetbrains.com/issue/KT-42293 ✦ Releases

    from 1.4.0 to 1.8.0 are experimentally binary backward compatible. ✦ Processes have been set up to keep binary backward compatibility between releases
  18. IN THIS YEAR ROADMAP 🔮 37 https://kotlinlang.org/docs/roadmap.html ✦ Improve the

    new Kotlin/Native memory manager robustness and performance and deprecate the old one ✦ Improve Kotlin/Native compilation time ✦ Improve exporting Kotlin code to Objective-C ✦ Stabilise klib: keep binary compatibility easier for library authors
  19. ✦ Promote Kotlin Multiplatform Mobile to Stable IN THIS YEAR

    ROADMAP 🔮 38 https://kotlinlang.org/docs/roadmap.html • Remove old and outdated pieces of the Multiplatform toolchain (non-hierarchical project support, old Gradle plugins, etc.). • Finalize the switch to the new Kotlin/Native memory model. • Provide clear compatibility guarantees for all pieces of the Multiplatform toolchain and support them with thorough testing and tight time-to-respond for any issues that might arise. • Improve Android support in Multiplatform projects. • Prototype the support for Kotlin Multiplatform in K2. • Stabilize the Multiplatform toolchain based on our adopters’ use cases. • Improve our build tool’s usability, including special support for the Android target in multiplatform projects. • Improve Kotlin/Native’s interoperability with the iOS world. • Make our onboarding more user-friendly and our documentation more comprehensive.