diff --git a/docs/topics/annotations.md b/docs/topics/annotations.md index e1f49c1410a..ea740bd4164 100644 --- a/docs/topics/annotations.md +++ b/docs/topics/annotations.md @@ -291,7 +291,7 @@ data class User( val username: String, // Applies `@Email` to `param`, `field` and `get` @all:Email val email: String, - // Applies `@Email` to `param`, `field`, `get`, and `set_param` + // Applies `@Email` to `param`, `field`, `get`, and `setparam` @all:Email var name: String, ) { // Applies `@Email` to `field` and `getter` (no `param` since it's not in the constructor) @@ -474,4 +474,4 @@ annotation class Tags(val value: Array) To extract Kotlin or Java repeatable annotations via reflection, use the [`KAnnotatedElement.findAnnotations()`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.reflect.full/find-annotations.html) function. -Learn more about Kotlin repeatable annotations in [this KEEP](https://github.com/Kotlin/KEEP/blob/master/proposals/repeatable-annotations.md). \ No newline at end of file +Learn more about Kotlin repeatable annotations in [this KEEP](https://github.com/Kotlin/KEEP/blob/master/proposals/repeatable-annotations.md). diff --git a/docs/topics/build-tools-api.md b/docs/topics/build-tools-api.md index 1fca0a0d56d..31156a3fa44 100644 --- a/docs/topics/build-tools-api.md +++ b/docs/topics/build-tools-api.md @@ -49,20 +49,20 @@ import org.jetbrains.kotlin.buildtools.api.ExperimentalBuildToolsApi import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi plugins { - kotlin("jvm") version "2.2.0" + kotlin("jvm") version "2.2.0" } group = "org.jetbrains.example" version = "1.0-SNAPSHOT" repositories { - mavenCentral() + mavenCentral() } kotlin { - jvmToolchain(8) - @OptIn(ExperimentalBuildToolsApi::class, ExperimentalKotlinGradlePluginApi::class) - compilerVersion.set("2.1.21") // <-- different version than 2.2.0 + jvmToolchain(8) + @OptIn(ExperimentalBuildToolsApi::class, ExperimentalKotlinGradlePluginApi::class) + compilerVersion.set("2.1.21") // <-- different version than 2.2.0 } ``` @@ -105,4 +105,4 @@ From Kotlin 2.2.0, the BTA is enabled by default in the [`kotlin-maven-plugin`]( Although the BTA doesn't give direct benefits for Maven users yet, it provides a solid foundation for developing features like: * [Kotlin daemon support](https://youtrack.jetbrains.com/issue/KT-77587) -* [Incremental compilation stabilization](https://youtrack.jetbrains.com/issue/KT-77086) \ No newline at end of file +* [Incremental compilation stabilization](https://youtrack.jetbrains.com/issue/KT-77086) diff --git a/docs/topics/coding-conventions.md b/docs/topics/coding-conventions.md index dbce520e84e..528f1cafcde 100644 --- a/docs/topics/coding-conventions.md +++ b/docs/topics/coding-conventions.md @@ -172,9 +172,9 @@ in method names are also allowed in test code. ```kotlin class MyTestCase { - @Test fun `ensure everything works`() { /*...*/ } - - @Test fun ensureEverythingWorks_onAndroid() { /*...*/ } + @Test fun `ensure everything works`() { /*...*/ } + + @Test fun ensureEverythingWorks_onAndroid() { /*...*/ } } ``` @@ -214,7 +214,7 @@ class C { private val _elementList = mutableListOf() val elementList: List - get() = _elementList + get() = _elementList } ``` @@ -302,9 +302,9 @@ abstract class Foo : IFoo { class FooImpl : Foo() { constructor(x: String) : this(x) { /*...*/ } - + val x = object : IFoo { /*...*/ } -} +} ``` ### Class headers @@ -606,10 +606,10 @@ If the parameter list is too long to fit on a line, put the arrow on a separate ```kotlin foo { - context: Context, - environment: Env - -> - context.configureEnv(environment) + context: Context, + environment: Env + -> + context.configureEnv(environment) } ``` @@ -876,15 +876,15 @@ to treat the dollar sign chars `$` as string literals: ```kotlin val KClass<*>.jsonSchema : String -get() = $$""" - { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://example.com/product.schema.json", - "$dynamicAnchor": "meta", - "title": "$${simpleName ?: qualifiedName ?: "unknown"}", - "type": "object" - } - """ + get() = $$""" + { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://example.com/product.schema.json", + "$dynamicAnchor": "meta", + "title": "$${simpleName ?: qualifiedName ?: "unknown"}", + "type": "object" + } + """ ``` ## Idiomatic use of language features @@ -986,7 +986,7 @@ else when(x) { 0 -> return "zero" else -> return "nonzero" -} +} ``` ### if versus when @@ -1060,25 +1060,25 @@ indentation, or `trimMargin` when internal indentation is required: ```kotlin fun main() { //sampleStart - println(""" - Not - trimmed - text - """ - ) - - println(""" - Trimmed - text - """.trimIndent() - ) - - println() - - val a = """Trimmed to margin text: - |if(a > 1) { - | return a - |}""".trimMargin() + println(""" + Not + trimmed + text + """ + ) + + println(""" + Trimmed + text + """.trimIndent() + ) + + println() + + val a = """Trimmed to margin text: + |if(a > 1) { + | return a + |}""".trimMargin() println(a) //sampleEnd diff --git a/docs/topics/compatibility-guides/compatibility-guide-22.md b/docs/topics/compatibility-guides/compatibility-guide-22.md index af68d5b6f50..61d716f04e3 100644 --- a/docs/topics/compatibility-guides/compatibility-guide-22.md +++ b/docs/topics/compatibility-guides/compatibility-guide-22.md @@ -565,9 +565,9 @@ perspective (for example, from Java) is out of the scope of this document. > > **Short summary**: The experimental `kotlinArtifacts` API is deprecated. Use the current DSL available in the Kotlin Gradle > plugin to [build final native binaries](https://www.jetbrains.com/help/kotlin-multiplatform-dev/multiplatform-build-native-binaries.html). -> If it's not sufficient for migration, leave a comment in [this YT issue](https://youtrack.jetbrains.com/issue/KT-74953). +> If it's not sufficient for migration, leave a comment in [this YouTrack issue](https://youtrack.jetbrains.com/issue/KT-74953). > > **Deprecation cycle**: > > - 2.2.0: report a warning when the `kotlinArtifacts` API is used -> - 2.3.0: raise this warning to an error \ No newline at end of file +> - 2.3.0: raise this warning to an error diff --git a/docs/topics/coroutines-overview.md b/docs/topics/coroutines-overview.md index 5ffde77ce8d..a0ea3441054 100644 --- a/docs/topics/coroutines-overview.md +++ b/docs/topics/coroutines-overview.md @@ -33,7 +33,7 @@ The `suspend` keyword marks functions that can perform long-running operations a To launch new coroutines, use coroutine builders like [`.launch()`](https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/launch.html) and [`.async()`](https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/async.html). These builders are extension functions on [`CoroutineScope`](https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/), -which defines the coroutine’s lifecycle and provides the coroutine context. +which defines the coroutine's lifecycle and provides the coroutine context. You can learn more about these builders in [Coroutine basics](coroutines-basics.md) and [Composing suspend functions](coroutines-and-channels.md). diff --git a/docs/topics/data-analysis/data-analysis-work-with-api.md b/docs/topics/data-analysis/data-analysis-work-with-api.md index 7f439f3c9ff..3bf95845fe1 100644 --- a/docs/topics/data-analysis/data-analysis-work-with-api.md +++ b/docs/topics/data-analysis/data-analysis-work-with-api.md @@ -64,27 +64,25 @@ This ensures you gather data across multiple pages: ```kotlin fun load(path: String, maxPages: Int): AnyFrame { - // Initializes a mutable list to store rows of data. val rows = mutableListOf() - + // Sets the initial page path for data loading. var pagePath = path do { - // Loads data from the current page path. val row = load(pagePath) // Adds the loaded data as a row to the list. rows.add(row) - + // Retrieves the token for the next page, if available. val next = row.getValueOrNull("nextPageToken") // Updates the page path for the next iteration, including the new token. pagePath = path + "&pageToken=" + next - + // Continues loading pages until there's no next page. } while (next != null && rows.size < maxPages) - + // Concatenates and returns all loaded rows as a DataFrame. return rows.concat() } diff --git a/docs/topics/gradle/gradle-binary-compatibility-validation.md b/docs/topics/gradle/gradle-binary-compatibility-validation.md index bbd4aa2cbd7..c434e423ab1 100644 --- a/docs/topics/gradle/gradle-binary-compatibility-validation.md +++ b/docs/topics/gradle/gradle-binary-compatibility-validation.md @@ -36,7 +36,7 @@ kotlin { -```kotlin +```groovy kotlin { abiValidation { enabled = true @@ -56,7 +56,7 @@ If your project has multiple modules where you want to check for binary compatib To check for potentially binary incompatible issues after making changes to your code, run the `checkLegacyAbi` Gradle task in IntelliJ IDEA or use the following command in your project directory: -```kotlin +```bash ./gradlew checkLegacyAbi ``` @@ -68,7 +68,7 @@ make changes to your code to preserve binary compatibility. To update the reference ABI dump that Gradle uses to check your latest changes, run the `updateLegacyAbi` task in IntelliJ IDEA or use the following command in your project directory: -```kotlin +```bash ./gradlew updateLegacyAbi ``` @@ -121,7 +121,7 @@ kotlin { -```kotlin +```groovy kotlin { abiValidation { filters { @@ -177,7 +177,7 @@ kotlin { -```kotlin +```groovy kotlin { abiValidation { klib { @@ -191,4 +191,4 @@ kotlin { If a target is unsupported and inference is disabled, the `checkLegacyAbi` task fails because it can't generate a complete -ABI dump. This behavior may be useful if you'd prefer the task to fail rather than risk missing a binary-incompatible change. \ No newline at end of file +ABI dump. This behavior may be useful if you'd prefer the task to fail rather than risk missing a binary-incompatible change. diff --git a/docs/topics/gradle/gradle-compiler-options.md b/docs/topics/gradle/gradle-compiler-options.md index ddce6c70769..0e250ca7f22 100644 --- a/docs/topics/gradle/gradle-compiler-options.md +++ b/docs/topics/gradle/gradle-compiler-options.md @@ -21,7 +21,7 @@ configuration of compiler options. It is available for [Kotlin Multiplatform](ht With the Gradle DSL, you can configure compiler options within the build script at three levels: * **[Extension level](#extension-level)**, in the `kotlin {}` block for all targets and shared source sets. * **[Target level](#target-level)**, in the block for a specific target. -* **[Compilation unit level](#compilation-unit-level),** usually in a specific compilation task. +* **[Compilation unit level](#compilation-unit-level)**, usually in a specific compilation task. ![Kotlin compiler options levels](compiler-options-levels.svg){width=700} @@ -57,7 +57,7 @@ kotlin { compilerOptions { optIn.add("kotlin.RequiresOptIn") } -} +} ``` ### Target level @@ -67,7 +67,7 @@ in the `compilerOptions {}` block inside the `target {}` block: ```kotlin kotlin { - target { + target { compilerOptions { optIn.add("kotlin.RequiresOptIn") } @@ -83,7 +83,7 @@ specific target. For example, `jvm { compilerOptions {}}`. For more information, You can configure compiler options for a specific compilation unit or task in a `compilerOptions {}` block inside the task configuration: -```Kotlin +```kotlin tasks.named("compileKotlin"){ compilerOptions { optIn.add("kotlin.RequiresOptIn") @@ -93,7 +93,7 @@ tasks.named("compileKotlin"){ You can also access and configure compiler options at a compilation unit level via `KotlinCompilation`: -```Kotlin +```kotlin kotlin { target { val main by compilations.getting { @@ -293,8 +293,8 @@ Update it to: ```kotlin plugins { - id("com.android.application") - kotlin("android") + id("com.android.application") + kotlin("android") } kotlin { diff --git a/docs/topics/gradle/gradle-configure-project.md b/docs/topics/gradle/gradle-configure-project.md index 55feedfcfe2..6a376265cf4 100644 --- a/docs/topics/gradle/gradle-configure-project.md +++ b/docs/topics/gradle/gradle-configure-project.md @@ -63,7 +63,7 @@ In the following table, there are the minimum and maximum **fully supported** ve | 1.7.0–1.7.10 | 6.7.1–7.0.2 | 3.4.3–7.0.2 | | 1.6.20–1.6.21 | 6.1.1–7.0.2 | 3.4.3–7.0.2 | -> *Kotlin 2.0.20–2.0.21 and Kotlin 2.1.0–2.1.10 are fully compatible with Gradle up to 8.6. +> Kotlin 2.0.20–2.0.21 and Kotlin 2.1.0–2.1.10 are fully compatible with Gradle up to 8.6. > Gradle versions 8.7–8.10 are also supported, with only one exception: If you use the Kotlin Multiplatform Gradle plugin, > you may see deprecation warnings in your multiplatform projects calling the `withJava()` function in the JVM target. > For more information, see [Java source sets created by default](https://www.jetbrains.com/help/kotlin-multiplatform-dev/multiplatform-compatibility-guide.html#java-source-sets-created-by-default). diff --git a/docs/topics/js/js-project-setup.md b/docs/topics/js/js-project-setup.md index 9ed20bd556c..20d0b259c62 100644 --- a/docs/topics/js/js-project-setup.md +++ b/docs/topics/js/js-project-setup.md @@ -100,7 +100,7 @@ You can enable all the supported ES2015 features at once by adding the `es2015` ```kotlin tasks.withType().configureEach { - kotlinOptions { + compilerOptions { target = "es2015" } } diff --git a/docs/topics/jvm/java-to-kotlin-interop.md b/docs/topics/jvm/java-to-kotlin-interop.md index 064487c4168..9b65aa07235 100644 --- a/docs/topics/jvm/java-to-kotlin-interop.md +++ b/docs/topics/jvm/java-to-kotlin-interop.md @@ -363,7 +363,7 @@ The Kotlin visibility modifiers map to Java in the following way: if accessed from within a class. * `protected` remains `protected`. (Note that Java allows accessing protected members from other classes in the same package and Kotlin doesn't, so Java classes will have broader access to the code.) -* `internal` declarations become `public` in Java. Members of `internal` classes go through name mangling, to make. +* `internal` declarations become `public` in Java. Members of `internal` classes go through name mangling, to make it harder to accidentally use them from Java and to allow overloading for members with the same signature that don't see each other according to Kotlin rules. * `public` remains `public`. diff --git a/docs/topics/jvm/jvm-records.md b/docs/topics/jvm/jvm-records.md index a60ccf82bfb..5c30b51493d 100644 --- a/docs/topics/jvm/jvm-records.md +++ b/docs/topics/jvm/jvm-records.md @@ -110,7 +110,7 @@ For example: ```kotlin @Target(AnnotationTarget.CLASS, AnnotationTarget.PROPERTY) @java.lang.annotation.Target(ElementType.CLASS, ElementType.RECORD_COMPONENT) -annotation class exampleClass +annotation class ExampleClass ``` You can now apply `@ExampleClass` to Kotlin classes and properties, as well as Java classes and record components. diff --git a/docs/topics/scripting/custom-script-deps-tutorial.md b/docs/topics/scripting/custom-script-deps-tutorial.md index aeddb38b46b..6efa43f1e37 100644 --- a/docs/topics/scripting/custom-script-deps-tutorial.md +++ b/docs/topics/scripting/custom-script-deps-tutorial.md @@ -134,7 +134,6 @@ In this tutorial, this includes support for the `@Repository` and `@DependsOn` a implementation 'org.jetbrains.kotlin:kotlin-scripting-dependencies-maven' // coroutines dependency is required for this particular definition implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:%coroutinesVersion%' - } ``` @@ -313,11 +312,11 @@ To check how your scripting host works, prepare a script to execute and a run co ```kotlin @file:Repository("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven") @file:DependsOn("org.jetbrains.kotlinx:kotlinx-html-jvm:0.7.3") - + import kotlinx.html.*; import kotlinx.html.stream.*; import kotlinx.html.attributes.* - + val addressee = "World" - + print( createHTML().html { body { @@ -326,7 +325,7 @@ To check how your scripting host works, prepare a script to execute and a run co } ) ``` - + It uses functions from the `kotlinx-html-jvm` library which is referenced in the `@DependsOn` annotation argument. 2. Create a run configuration that starts the scripting host and executes this file: diff --git a/docs/topics/serialization.md b/docs/topics/serialization.md index 5904a3a5195..1b84c6ee0ae 100644 --- a/docs/topics/serialization.md +++ b/docs/topics/serialization.md @@ -93,7 +93,7 @@ in the Kotlin Gradle DSL). ```kotlin dependencies { implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:%serializationVersion%") - } + } ``` @@ -102,7 +102,7 @@ in the Kotlin Gradle DSL). ```groovy dependencies { implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:%serializationVersion%' - } + } ``` @@ -115,53 +115,53 @@ and its format-specific subpackages, such as `kotlinx.serialization.json`. 1. Make a class serializable by annotating it with `@Serializable`. -```kotlin -import kotlinx.serialization.Serializable - -@Serializable -data class Data(val a: Int, val b: String) -``` + ```kotlin + import kotlinx.serialization.Serializable + + @Serializable + data class Data(val a: Int, val b: String) + ``` 2. Serialize an instance of this class by calling `Json.encodeToString()`. -```kotlin -import kotlinx.serialization.Serializable -import kotlinx.serialization.json.Json -import kotlinx.serialization.encodeToString - -@Serializable -data class Data(val a: Int, val b: String) - -fun main() { - val json = Json.encodeToString(Data(42, "str")) -} -``` + ```kotlin + import kotlinx.serialization.Serializable + import kotlinx.serialization.json.Json + import kotlinx.serialization.encodeToString + + @Serializable + data class Data(val a: Int, val b: String) + + fun main() { + val json = Json.encodeToString(Data(42, "str")) + } + ``` -As a result, you get a string containing the state of this object in the JSON format: `{"a": 42, "b": "str"}` + As a result, you get a string containing the state of this object in the JSON format: `{"a": 42, "b": "str"}` -> You can also serialize object collections, such as lists, in a single call: -> -> ```kotlin -> val dataList = listOf(Data(42, "str"), Data(12, "test")) -> val jsonList = Json.encodeToString(dataList) -> ``` -> -{style="note"} + > You can also serialize object collections, such as lists, in a single call: + > + > ```kotlin + > val dataList = listOf(Data(42, "str"), Data(12, "test")) + > val jsonList = Json.encodeToString(dataList) + > ``` + > + {style="note"} 3. Use the `decodeFromString()` function to deserialize an object from JSON: -```kotlin -import kotlinx.serialization.Serializable -import kotlinx.serialization.json.Json -import kotlinx.serialization.decodeFromString - -@Serializable -data class Data(val a: Int, val b: String) - -fun main() { - val obj = Json.decodeFromString("""{"a":42, "b": "str"}""") -} -``` + ```kotlin + import kotlinx.serialization.Serializable + import kotlinx.serialization.json.Json + import kotlinx.serialization.decodeFromString + + @Serializable + data class Data(val a: Int, val b: String) + + fun main() { + val obj = Json.decodeFromString("""{"a":42, "b": "str"}""") + } + ``` That's it! You have successfully serialized objects into JSON strings and deserialized them back into objects. diff --git a/docs/topics/spring-ai-guide.md b/docs/topics/spring-ai-guide.md index c35a376ac85..791005c173f 100644 --- a/docs/topics/spring-ai-guide.md +++ b/docs/topics/spring-ai-guide.md @@ -142,7 +142,7 @@ Create a Spring `@RestController` to search documents and store them in the Qdra ```kotlin package org.example.springaidemo - + // Imports the required Spring and utility classes import org.slf4j.LoggerFactory import org.springframework.ai.document.Document @@ -160,10 +160,10 @@ Create a Spring `@RestController` to search documents and store them in the Qdra @RestController @RequestMapping("/kotlin") class KotlinSTDController( - private val restTemplate: RestTemplate, - private val vectorStore: VectorStore, + private val restTemplate: RestTemplate, + private val vectorStore: VectorStore, ) { - private val logger = LoggerFactory.getLogger(this::class.java) + private val logger = LoggerFactory.getLogger(this::class.java) @OptIn(ExperimentalUuidApi::class) @PostMapping("/load-docs") @@ -215,19 +215,18 @@ Create a Spring `@RestController` to search documents and store them in the Qdra ```kotlin package org.example.springaidemo - + import org.springframework.boot.autoconfigure.SpringBootApplication import org.springframework.boot.runApplication import org.springframework.context.annotation.Bean import org.springframework.web.client.RestTemplate - + @SpringBootApplication class SpringAiDemoApplication { - @Bean fun restTemplate(): RestTemplate = RestTemplate() } - + fun main(args: Array) { runApplication(*args) } diff --git a/docs/topics/tour/kotlin-tour-intermediate-classes-interfaces.md b/docs/topics/tour/kotlin-tour-intermediate-classes-interfaces.md index 231ec7d19c7..873934152aa 100644 --- a/docs/topics/tour/kotlin-tour-intermediate-classes-interfaces.md +++ b/docs/topics/tour/kotlin-tour-intermediate-classes-interfaces.md @@ -295,20 +295,21 @@ class Circle : Drawable { override fun draw() { TODO("An example implementation") } - + override fun resize() { TODO("An example implementation") } - override val color = null + + override val color = null } ``` -If you wanted to create a child class of the `Circle` class which had the same behavior **except** for the value of the -`color` property, you still need to add implementations for each member function of the `Circle` class: +If you wanted to create a new class which implements the `Drawable` interface, and have the same behavior with `Circle` +class **except** for the value of the `color` property, you still need to add implementations for each member function +of the `Drawable` interface: ```kotlin -class RedCircle(val circle: Circle) : Circle { - +class RedCircle(val circle: Circle) : Drawable { // Start of boilerplate code override fun draw() { circle.draw() @@ -317,8 +318,8 @@ class RedCircle(val circle: Circle) : Circle { override fun resize() { circle.resize() } - // End of boilerplate code + override val color = "red" } ``` @@ -327,8 +328,8 @@ You can see that if you have a large number of member functions in the `Drawable code in the `RedCircle` class can be very large. However, there is an alternative. In Kotlin, you can use delegation to delegate the interface implementation to an instance of a class. For example, -you can create an instance of the `Circle` class and delegate the implementations of the member functions of the `Circle` -class to this instance. To do this, use the `by` keyword. For example: +you can create an instance of the `Circle` class and delegate the implementations of the member functions of the +`Drawable` interface to this instance. To do this, use the `by` keyword. For example: ```kotlin class RedCircle(param: Circle) : Drawable by param diff --git a/docs/topics/type-aliases.md b/docs/topics/type-aliases.md index d60adf0dc2c..7002811085a 100644 --- a/docs/topics/type-aliases.md +++ b/docs/topics/type-aliases.md @@ -63,9 +63,9 @@ don't capture type parameters from their outer class: ```kotlin class Dijkstra { - typealias VisitedNodes = Set + typealias VisitedNodes = Set - private fun step(visited: VisitedNodes, ...) = ... + private fun step(visited: VisitedNodes, ...) = ... } ``` @@ -119,5 +119,3 @@ kotlin { } } ``` - - diff --git a/docs/topics/wasm/wasm-debugging.md b/docs/topics/wasm/wasm-debugging.md index 584d9f19ade..79a69052cbb 100644 --- a/docs/topics/wasm/wasm-debugging.md +++ b/docs/topics/wasm/wasm-debugging.md @@ -37,7 +37,7 @@ Create a project using the Kotlin Multiplatform wizard: > {style="note"} -2. In **composeApp** | **Tasks** | **kotlin browser**, select and run the **wasmJsBrowserDevelopmentRun** task. +2. In **wasmdemo** | **Tasks** | **kotlin browser**, select and run the **wasmJsBrowserDevelopmentRun** task. ![Run the Gradle task](wasm-gradle-task-window.png){width=450} @@ -84,7 +84,7 @@ build file. For more information about how to configure your browser for debuggi #### Enable access to project's sources By default, browsers can't access some of the project's sources necessary for debugging. To provide access, you can configure the Webpack DevServer -to serve these sources. In the `ComposeApp` directory, add the following code snippets to your `build.gradle.kts` file. +to serve these sources. In the `WasmDemo` root directory, add the following code snippets to your `build.gradle.kts` file. Add this import as a top-level declaration: @@ -110,10 +110,10 @@ The resulting code block looks like this: kotlin { @OptIn(ExperimentalWasmDsl::class) wasmJs { - moduleName = "composeApp" + moduleName = "wasmDemo" browser { commonWebpackConfig { - outputFileName = "composeApp.js" + outputFileName = "wasmDemo.js" devServer = (devServer ?: KotlinWebpackConfig.DevServer()).apply { static = (static ?: mutableListOf()).apply { // Serve sources to debug inside browser diff --git a/docs/topics/whatsnew/whatsnew22.md b/docs/topics/whatsnew/whatsnew22.md index 7a650d44373..2a980f6407b 100644 --- a/docs/topics/whatsnew/whatsnew22.md +++ b/docs/topics/whatsnew/whatsnew22.md @@ -235,7 +235,7 @@ This feature tells the compiler to apply the annotation to all relevant parts of * **`get`**: the getter method. -* **`set_param`**: the parameter of the setter method, if the property is defined as `var`. +* **`setparam`**: the parameter of the setter method, if the property is defined as `var`. * **`RECORD_COMPONENT`**: if the class is a `@JvmRecord`, the annotation applies to the [Java record component](#improved-support-for-annotating-jvm-records). This behavior mimics the way Java handles annotations on record components. @@ -247,12 +247,12 @@ In the example below, the `@Email` annotation is applied to all relevant targets data class User( val username: String, - // Applies @Email to param, property, field, - // get, and set_param (if var) + // Applies @Email to `param`, `property`, `field`, + // `get`, and `setparam` (if var) @all:Email val email: String, ) { - // Applies @Email to property, field, and getter - // (no param since it's not in the constructor) + // Applies @Email to `property`, `field`, and `get` + // (no `param` since it's not in the constructor) @all:Email val secondaryEmail: String? = null } ``` @@ -1333,7 +1333,7 @@ for a complete overview of all breaking changes and deprecations in this release * The deprecated `kotlin-android-extensions` plugin is [removed in Kotlin 2.2.0](compatibility-guide-22.md#deprecate-kotlin-android-extensions-plugin). Use the `kotlin-parcelize` plugin for the `Parcelable` implementation generator and the Android Jetpack's [view bindings](https://developer.android.com/topic/libraries/view-binding) for synthetic views instead. * Experimental `kotlinArtifacts` API is [deprecated in Kotlin 2.2.0](compatibility-guide-22.md#deprecate-kotlinartifacts-api). - Use the current DSL available in the Kotlin Gradle plugin to [build final native binaries](https://www.jetbrains.com/help/kotlin-multiplatform-dev/multiplatform-build-native-binaries.html). If it's not sufficient for migration, leave a comment in [this YT issue](https://youtrack.jetbrains.com/issue/KT-74953). + Use the current DSL available in the Kotlin Gradle plugin to [build final native binaries](https://www.jetbrains.com/help/kotlin-multiplatform-dev/multiplatform-build-native-binaries.html). If it's not sufficient for migration, leave a comment in [this YouTrack issue](https://youtrack.jetbrains.com/issue/KT-74953). * `KotlinCompilation.source`, deprecated in Kotlin 1.9.0, is now [removed from the Kotlin Gradle plugin](compatibility-guide-22.md#deprecate-kotlincompilation-source-api). * The parameters for experimental commonization modes are [deprecated in Kotlin 2.2.0](compatibility-guide-22.md#deprecate-commonization-parameters). Clear the commonization cache to delete invalid compilation artifacts. @@ -1385,4 +1385,4 @@ The survey takes around 15 minutes to complete, and your input will help shape t The Kotlin plugin is distributed as a bundled plugin in IntelliJ IDEA and Android Studio. To update to the new Kotlin version, [change the Kotlin version](releases.md#update-to-a-new-kotlin-version) -to 2.2.0 in your build scripts. \ No newline at end of file +to 2.2.0 in your build scripts.