All posts
TELEGRAM27 Nov 2024

Kotlin 2.1.0 was released a few hours ago, and I decided to revisit a long-awaited K2 feature: "explicit backing fields."

Just before running the program, you need to:

  1. Update Kotlin to version 2.0.0 or higher.
  2. Enable K2 in the IDE "Settings -> Languages & Frameworks -> Kotlin: Check the 'Enable K2 Kotlin Mode' box
  3. And enable "ExplicitBackingFields" by adding the following to \app\build.gradle.kts kotlin { sourceSets.all { languageSettings.enableLanguageFeature("ExplicitBackingFields") } }

Now you’re all set!

This post is synced with the @developerbox channel

This page was machine-translated from Russian

RU