diff --git a/.teamcity/BuildParams.kt b/.teamcity/BuildParams.kt
index d681b16c5a1..f65357e2c45 100644
--- a/.teamcity/BuildParams.kt
+++ b/.teamcity/BuildParams.kt
@@ -2,7 +2,7 @@ object BuildParams {
const val DOKKA_TEMPLATES_VERSION = "1.9.0-dev-218"
const val KOTLINX_COROUTINES_RELEASE_TAG = "1.7.1"
- const val KOTLINX_SERIALIZATION_RELEASE_TAG = "v1.6.0-RC"
+ const val KOTLINX_SERIALIZATION_RELEASE_TAG = "v1.6.0"
const val KOTLINX_DATETIME_RELEASE_TAG = "v0.4.0"
const val KOTLINX_METADATA_JVM_RELEASE_TAG = "v0.7.0"
diff --git a/.teamcity/builds/kotlinlang/buidTypes/BuildReferenceDocs.kt b/.teamcity/builds/kotlinlang/buidTypes/BuildReferenceDocs.kt
index 8417234e84d..6b05b8fb249 100644
--- a/.teamcity/builds/kotlinlang/buidTypes/BuildReferenceDocs.kt
+++ b/.teamcity/builds/kotlinlang/buidTypes/BuildReferenceDocs.kt
@@ -18,7 +18,7 @@ object BuildReferenceDocs : BuildType({
""".trimIndent()
params {
- param("WEBHELP_FRONTEND_VERSION", "5.13.0")
+ param("WEBHELP_FRONTEND_VERSION", "5.15.0")
param("WH_DOCS_PATH_REGEX", "docs")
param("WH_PROJECT_NAME", "kotlin-reference")
}
diff --git a/data/events.yml b/data/events.yml
index 447a12b7233..ccd85bc4d98 100644
--- a/data/events.yml
+++ b/data/events.yml
@@ -7,13 +7,13 @@
subject : 'KKON'
url: https://rheinwerk-kkon.de/
- lang: en
- startDate: '2023-11-16'
- endDate: '2023-11-16'
+ startDate: '2023-09-21'
+ endDate: '2023-09-22'
location: Amsterdam, Netherlands
- speaker : 'Sebastian Aigner'
+ speaker : 'Garth Gilmour'
title : ''
- subject : 'Kotlin Dev Day'
- url: https://kotlindevday.com/
+ subject : 'Kotlin Training Day'
+ url: https://pages.xebia.com/kotlin-training-day
- lang: en
startDate: '2023-09-14'
endDate: '2023-09-15'
diff --git a/data/releases.yml b/data/releases.yml
index 857d80f3f92..46115006790 100644
--- a/data/releases.yml
+++ b/data/releases.yml
@@ -1,6 +1,6 @@
url: https://github.com/JetBrains/kotlin/releases
latest:
- version: 1.9.0
- url: https://github.com/JetBrains/kotlin/releases/tag/v1.9.0
+ version: 1.9.10
+ url: https://github.com/JetBrains/kotlin/releases/tag/v1.9.10
diff --git a/data/testimonials.yml b/data/testimonials.yml
index 9940a39c407..4ad78d74f3f 100644
--- a/data/testimonials.yml
+++ b/data/testimonials.yml
@@ -5,7 +5,7 @@
url: https://www.corda.net/2017/01/10/kotlin/
text: Corda is an open-source distributed ledger platform, supported by major banks, and built entirely in Kotlin
- company: Evernote
- url: https://blog.evernote.com/tech/2017/01/26/android-state-library/
+ url: https://evernote.com/blog/android-state-library/
text: Evernote recently integrated Kotlin into their Android client
- company: Coursera
url: https://building.coursera.org/blog/2016/03/16/becoming-bilingual-coursera/
diff --git a/docs/images/data-science/kotlin-notebook.png b/docs/images/data-science/kotlin-notebook.png
index c9ef9827de1..f0980977064 100644
Binary files a/docs/images/data-science/kotlin-notebook.png and b/docs/images/data-science/kotlin-notebook.png differ
diff --git a/docs/images/multiplatform/multiplatform-hierarchy-completion.animated.gif b/docs/images/multiplatform/multiplatform-hierarchy-completion.animated.gif
new file mode 100644
index 00000000000..c6cd4cfef0c
Binary files /dev/null and b/docs/images/multiplatform/multiplatform-hierarchy-completion.animated.gif differ
diff --git a/docs/images/multiplatform/multiplatform-hierarchy-completion.png b/docs/images/multiplatform/multiplatform-hierarchy-completion.png
new file mode 100644
index 00000000000..9a5f253c6fe
Binary files /dev/null and b/docs/images/multiplatform/multiplatform-hierarchy-completion.png differ
diff --git a/docs/kr.tree b/docs/kr.tree
index 1a77f7b947d..62b15b40ad1 100644
--- a/docs/kr.tree
+++ b/docs/kr.tree
@@ -34,9 +34,9 @@
Kotlin provides built-in support for nullable types. In Kotlin, the type system distinguishes between references that can hold null
(nullable references) and those that cannot (non-nullable references).
+
Kotlin provides built-in support for nullable types. In Kotlin, the type system distinguishes between references that can hold null
(nullable references) and those that cannot (non-nullable references).
For example, a regular variable of type String
cannot hold null
. To allow nulls, you can declare a variable as a nullable string by writing String?
.
The id
property of the Message
class is declared as a nullable type this time.
diff --git a/docs/topics/keyword-reference.md b/docs/topics/keyword-reference.md
index 8d0d7a6fd06..625dbd9e62c 100644
--- a/docs/topics/keyword-reference.md
+++ b/docs/topics/keyword-reference.md
@@ -104,7 +104,7 @@ in other contexts:
* `inline` tells the compiler to [inline a function and the lambdas passed to it at the call site](inline-functions.md).
* `inner` allows referring to an outer class instance from a [nested class](nested-classes.md).
* `internal` marks a declaration as [visible in the current module](visibility-modifiers.md).
- * `lateinit` allows initializing a [non-null property outside of a constructor](properties.md#late-initialized-properties-and-variables).
+ * `lateinit` allows initializing a [non-nullable property outside of a constructor](properties.md#late-initialized-properties-and-variables).
* `noinline` turns off [inlining of a lambda passed to an inline function](inline-functions.md#noinline).
* `open` allows [subclassing a class or overriding a member](classes.md#inheritance).
* `operator` marks a function as [overloading an operator or implementing a convention](operator-overloading.md).
@@ -143,13 +143,13 @@ Kotlin supports the following operators and special symbols:
* `===`, `!==` - [referential equality operators](equality.md#referential-equality).
* `<`, `>`, `<=`, `>=` - [comparison operators](operator-overloading.md#comparison-operators) (translated to calls of `compareTo()` for non-primitive types).
* `[`, `]` - [indexed access operator](operator-overloading.md#indexed-access-operator) (translated to calls of `get` and `set`).
- * `!!` [asserts that an expression is non-null](null-safety.md#the-operator).
- * `?.` performs a [safe call](null-safety.md#safe-calls) (calls a method or accesses a property if the receiver is non-null).
+ * `!!` [asserts that an expression is non-nullable](null-safety.md#the-operator).
+ * `?.` performs a [safe call](null-safety.md#safe-calls) (calls a method or accesses a property if the receiver is non-nullable).
* `?:` takes the right-hand value if the left-hand value is null (the [elvis operator](null-safety.md#elvis-operator)).
* `::` creates a [member reference](reflection.md#function-references) or a [class reference](reflection.md#class-references).
* `..`, `..<` create [ranges](ranges.md).
* `:` separates a name from a type in a declaration.
- * `?` marks a type as [nullable](null-safety.md#nullable-types-and-non-null-types).
+ * `?` marks a type as [nullable](null-safety.md#nullable-types-and-non-nullable-types).
* `->`
- separates the parameters and body of a [lambda expression](lambdas.md#lambda-expression-syntax).
- separates the parameters and return type declaration in a [function type](lambdas.md#function-types).
diff --git a/docs/topics/kotlin-evolution.md b/docs/topics/kotlin-evolution.md
index 8c0c677c3e3..564ae5c4c08 100644
--- a/docs/topics/kotlin-evolution.md
+++ b/docs/topics/kotlin-evolution.md
@@ -73,7 +73,7 @@ Compilers are complicated software and despite the best effort of their develope
[JetBrains](https://jetbrains.com), the original creator of Kotlin, is driving its progress with the help of the community and in accord with the [Kotlin Foundation](https://kotlinfoundation.org/).
All changes to the Kotlin Programming Language are overseen by the [Lead Language Designer](https://kotlinfoundation.org/structure/) (currently Roman Elizarov). The Lead Designer has the final say in all matters related to language evolution. Additionally, incompatible changes to fully stable components have to be approved to by the [Language Committee](https://kotlinfoundation.org/structure/) designated
-under the [Kotlin Foundation](https://kotlinfoundation.org/structure/) (currently comprised of Jeffrey van Gogh, William R. Cook and Roman Elizarov).
+under the [Kotlin Foundation](https://kotlinfoundation.org/structure/) (currently comprised of Jeffrey van Gogh, Werner Dietl, and Roman Elizarov).
The Language Committee makes final decisions on what incompatible changes will be made and what exact measures should be taken to make user updates comfortable. In doing so, it relies on a set of guidelines available [here](https://kotlinfoundation.org/language-committee-guidelines/).
diff --git a/docs/topics/kotlin-hands-on.md b/docs/topics/kotlin-hands-on.md
new file mode 100644
index 00000000000..4b1308eeae7
--- /dev/null
+++ b/docs/topics/kotlin-hands-on.md
@@ -0,0 +1,76 @@
+[//]: # (title: Kotlin hands-on)
+
+A series of hands-on tutorials where you can create applications with Kotlin using a variety of different technologies and targeting multiple platforms.
+The exercises are divided into a series of steps, walking you through each section.
+
+## Building Reactive Spring Boot applications with Kotlin coroutines and RSocket
+
+Build a simple chat application using Spring Boot and Kotlin, and learn about the benefits of using Kotlin for server-side development from a syntax perspective.
+
+[**Start**](https://spring.io/guides/tutorials/spring-webflux-kotlin-rsocket/)
+
+## Building web applications with React and Kotlin/JS
+
+Create a React Application using Kotlin/JS, and see how you can leverage Kotlin's type system, library ecosystem, and interoperability features.
+
+[**Start**](js-react.md)
+
+## Building web applications with Spring Boot and Kotlin
+
+Build a sample blog application by combining the power of Spring Boot and Kotlin.
+
+[**Start**](https://spring.io/guides/tutorials/spring-boot-kotlin/)
+
+## Creating HTTP APIs with Ktor
+
+Create a backend API for your application that responds to HTTP requests.
+
+[**Start**](https://ktor.io/docs/creating-http-apis.html)
+
+## Creating a WebSocket chat with Ktor
+
+Create a simple Chat application using Ktor including both a JVM server and a JVM client.
+
+[**Start**](https://ktor.io/docs/creating-web-socket-chat.html)
+
+## Creating an interactive website with Ktor
+
+Learn how to serve files, use templating engines such as Freemarker and the kotlinx.html DSL, and work with form input from Ktor.
+
+[**Start**](https://ktor.io/docs/creating-interactive-website.html)
+
+## Building a full stack web app with Kotlin Multiplatform
+
+Create an application with Kotlin/JVM and Kotlin/JS, and explore topics around code sharing, serialization, server- and client-side development.
+
+[**Start**](multiplatform-full-stack-app.md)
+
+## Introduction to Kotlin coroutines and channels
+
+Learn about coroutines in Kotlin and how you can communicate between them using channels.
+
+[**Start**](coroutines-and-channels.md)
+
+## Introduction to Kotlin/Native
+
+Create a simple HTTP client that can run natively on multiple platforms using Kotlin/Native and libcurl.
+
+[**Start**](native-app-with-c-and-libcurl.md)
+
+## Introduction to Kotlin/Native concurrency
+
+Learn about the concurrency model in Kotlin/Native, and how to work with state in a multithreaded environment.
+
+[**Start**](multiplatform-mobile-concurrency-overview.md)
+
+## Kotlin Multiplatform: networking and data storage
+
+Learn how to create a mobile application for Android and iOS using Kotlin Multiplatform with Ktor and SQLDelight.
+
+[**Start**](multiplatform-mobile-ktor-sqldelight.md)
+
+## Targeting iOS and Android with Kotlin Multiplatform
+
+Learn how to create a mobile application that can target both iOS and Android using Kotlin Multiplatform.
+
+[**Start**](multiplatform-mobile-create-first-app.md)
\ No newline at end of file
diff --git a/docs/topics/ksp/ksp-overview.md b/docs/topics/ksp/ksp-overview.md
index 442a1f4b879..5a21f9caa37 100644
--- a/docs/topics/ksp/ksp-overview.md
+++ b/docs/topics/ksp/ksp-overview.md
@@ -2,10 +2,10 @@
Kotlin Symbol Processing (_KSP_) is an API that you can use to develop lightweight compiler plugins.
KSP provides a simplified compiler plugin API that leverages the power of Kotlin while keeping the learning curve at
-a minimum. Compared to [kapt](kapt.md), annotation processors that use KSP can run up to 2 times faster.
+a minimum. Compared to [kapt](kapt.md), annotation processors that use KSP can run up to two times faster.
-To learn more about how KSP compares to kapt, check out [why KSP](ksp-why-ksp.md).
-To get started writing a KSP processor, take a look at the [KSP quickstart](ksp-quickstart.md).
+* To learn more about how KSP compares to kapt, check out [why KSP](ksp-why-ksp.md).
+* To get started writing a KSP processor, take a look at the [KSP quickstart](ksp-quickstart.md).
## Overview
@@ -157,26 +157,26 @@ class HelloFunctionFinderProcessor : SymbolProcessor() {
## Supported libraries
-The table below includes a list of popular libraries on Android and their various stages of support for KSP.
-
-|Library|Status|Tracking issue for KSP|
-|---|---|---|
-|Room|[Officially supported](https://developer.android.com/jetpack/androidx/releases/room#2.3.0-beta02)| |
-|Moshi|[Officially supported](https://github.com/square/moshi/)| |
-|RxHttp|[Officially supported](https://github.com/liujingxing/rxhttp)| |
-|Kotshi|[Officially supported](https://github.com/ansman/kotshi)| |
-|Lyricist|[Officially supported](https://github.com/adrielcafe/lyricist)| |
-|Lich SavedState|[Officially supported](https://github.com/line/lich/tree/master/savedstate)| |
-|gRPC Dekorator|[Officially supported](https://github.com/mottljan/grpc-dekorator)| |
-|EasyAdapter|[Officially supported](https://github.com/AmrDeveloper/EasyAdapter)| |
-|Koin Annotations|[Officially supported](https://github.com/InsertKoinIO/koin-annotations)| |
-|Auto Factory|Not yet supported|[Link](https://github.com/google/auto/issues/982)|
-|Dagger|Not yet supported|[Link](https://github.com/google/dagger/issues/2349)|
-|Hilt|Not yet supported|[Link](https://issuetracker.google.com/179057202)|
-|Glide|[Officially supported](https://github.com/bumptech/glide)| |
-|DeeplinkDispatch|[Supported via airbnb/DeepLinkDispatch#323](https://github.com/airbnb/DeepLinkDispatch/pull/323)| |
-|Micronaut|In Progress|[Link](https://github.com/micronaut-projects/micronaut-core/issues/6781)|
-|Epoxy|[Officially supported](https://github.com/airbnb/epoxy)||
-|Paris|[Officially supported](https://github.com/airbnb/paris)||
-|Auto Dagger|[Officially supported](https://github.com/ansman/auto-dagger)||
-|SealedX|[Officially supported](https://github.com/skydoves/sealedx)||
+The table includes a list of popular libraries on Android and their various stages of support for KSP:
+
+|Library|Status|
+|---|---|
+|Room|[Officially supported](https://developer.android.com/jetpack/androidx/releases/room#2.3.0-beta02)|
+|Moshi|[Officially supported](https://github.com/square/moshi/)|
+|RxHttp|[Officially supported](https://github.com/liujingxing/rxhttp)|
+|Kotshi|[Officially supported](https://github.com/ansman/kotshi)|
+|Lyricist|[Officially supported](https://github.com/adrielcafe/lyricist)|
+|Lich SavedState|[Officially supported](https://github.com/line/lich/tree/master/savedstate)|
+|gRPC Dekorator|[Officially supported](https://github.com/mottljan/grpc-dekorator)|
+|EasyAdapter|[Officially supported](https://github.com/AmrDeveloper/EasyAdapter)|
+|Koin Annotations|[Officially supported](https://github.com/InsertKoinIO/koin-annotations)|
+|Glide|[Officially supported](https://github.com/bumptech/glide)|
+|Micronaut|[Officially supported](https://micronaut.io/2023/07/14/micronaut-framework-4-0-0-released/)|
+|Epoxy|[Officially supported](https://github.com/airbnb/epoxy)|
+|Paris|[Officially supported](https://github.com/airbnb/paris)|
+|Auto Dagger|[Officially supported](https://github.com/ansman/auto-dagger)|
+|SealedX|[Officially supported](https://github.com/skydoves/sealedx)|
+|DeeplinkDispatch|[Supported via airbnb/DeepLinkDispatch#323](https://github.com/airbnb/DeepLinkDispatch/pull/323)|
+|Dagger|[Alpha](https://dagger.dev/dev-guide/ksp)|
+|Hilt|[In progress](https://dagger.dev/dev-guide/ksp)|
+|Auto Factory|[Not yet supported](https://github.com/google/auto/issues/982)|
diff --git a/docs/topics/lambdas.md b/docs/topics/lambdas.md
index ec630e536de..8580d6458c3 100644
--- a/docs/topics/lambdas.md
+++ b/docs/topics/lambdas.md
@@ -88,7 +88,7 @@ These types have a special notation that corresponds to the signatures of the fu
The function type notation can optionally include names for the function parameters: `(x: Int, y: Int) -> Point`.
These names can be used for documenting the meaning of the parameters.
-To specify that a function type is [nullable](null-safety.md#nullable-types-and-non-null-types), use parentheses as follows:
+To specify that a function type is [nullable](null-safety.md#nullable-types-and-non-nullable-types), use parentheses as follows:
`((Int, Int) -> Int)?`.
Function types can also be combined using parentheses: `(Int) -> ((Int) -> Unit)`.
diff --git a/docs/topics/learning-materials-overview.md b/docs/topics/learning-materials-overview.md
index 6c6d38c6763..2e6716cb2ff 100644
--- a/docs/topics/learning-materials-overview.md
+++ b/docs/topics/learning-materials-overview.md
@@ -12,6 +12,6 @@ You can use the following materials and resources for learning Kotlin:
* [Kotlin books](books.md) – find books we've reviewed and recommend for learning Kotlin.
* [Kotlin tips](kotlin-tips.md) – watch short videos where the Kotlin team shows you how to use Kotlin in a more efficient and idiomatic way, so you can have more fun when writing code.
* [Advent of Code puzzles](advent-of-code.md) – learn idiomatic Kotlin and test your language skills by completing short and fun tasks.
-* [Kotlin hands-on tutorials](https://play.kotlinlang.org/hands-on/overview) – complete long-form tutorials to fully grasp a technology. These tutorials guide you through a self-contained project related to a specific topic.
+* [Kotlin hands-on tutorials](kotlin-hands-on.md) – complete long-form tutorials to fully grasp a technology. These tutorials guide you through a self-contained project related to a specific topic.
* [Kotlin for Java Developers](https://www.coursera.org/learn/kotlin-for-java-developers) – learn the similarities and differences between Java and Kotlin in this course on Coursera.
* [Kotlin documentation in PDF format](kotlin-pdf.md) – read our documentation offline.
diff --git a/docs/topics/multiplatform-mobile/multiplatform-mobile-concurrency-and-coroutines.md b/docs/topics/multiplatform-mobile/multiplatform-mobile-concurrency-and-coroutines.md
index a2c9dbe2911..e02d7f3c7d4 100644
--- a/docs/topics/multiplatform-mobile/multiplatform-mobile-concurrency-and-coroutines.md
+++ b/docs/topics/multiplatform-mobile/multiplatform-mobile-concurrency-and-coroutines.md
@@ -3,7 +3,9 @@
> This page describes the features of the legacy memory manager. Check out [Kotlin/Native memory management](native-memory-manager.md)
> to learn about the new memory manager, which has been enabled by default since Kotlin 1.7.20.
>
-{type="note"}
+> For more information on the concurrent programming in Kotlin, see the [Coroutines guide](coroutines-guide.md).
+>
+{type="warning"}
When working with mobile platforms, you may need to write multithreaded code that runs in parallel. For this,
you can use the [standard](#coroutines) `kotlinx.coroutines` library or its [multithreaded version](#multithreaded-coroutines)
diff --git a/docs/topics/multiplatform-mobile/multiplatform-mobile-concurrency-overview.md b/docs/topics/multiplatform-mobile/multiplatform-mobile-concurrency-overview.md
index c87abad4711..458f0d0df27 100644
--- a/docs/topics/multiplatform-mobile/multiplatform-mobile-concurrency-overview.md
+++ b/docs/topics/multiplatform-mobile/multiplatform-mobile-concurrency-overview.md
@@ -3,7 +3,9 @@
> This page describes the features of the legacy memory manager. Check out [Kotlin/Native memory management](native-memory-manager.md)
> to learn about the new memory manager, which has been enabled by default since Kotlin 1.7.20.
>
-{type="note"}
+> For more information on the concurrent programming in Kotlin, see the [Coroutines guide](coroutines-guide.md).
+>
+{type="warning"}
When you extend your development experience from Android to Kotlin Multiplatform for mobile, you will encounter a different state
and concurrency model for iOS. This is a Kotlin/Native model that compiles Kotlin code to native binaries that can run without a virtual machine, for example on iOS.
diff --git a/docs/topics/multiplatform-mobile/multiplatform-mobile-concurrent-mutability.md b/docs/topics/multiplatform-mobile/multiplatform-mobile-concurrent-mutability.md
index 53d9a9550cf..83917d6289d 100644
--- a/docs/topics/multiplatform-mobile/multiplatform-mobile-concurrent-mutability.md
+++ b/docs/topics/multiplatform-mobile/multiplatform-mobile-concurrent-mutability.md
@@ -3,7 +3,9 @@
> This page describes the features of the legacy memory manager. Check out [Kotlin/Native memory management](native-memory-manager.md)
> to learn about the new memory manager, which has been enabled by default since Kotlin 1.7.20.
>
-{type="note"}
+> For more information on the concurrent programming in Kotlin, see the [Coroutines guide](coroutines-guide.md).
+>
+{type="warning"}
When it comes to working with iOS, [Kotlin/Native's state and concurrency model](multiplatform-mobile-concurrency-overview.md) has [two simple rules](multiplatform-mobile-concurrency-overview.md#rules-for-state-sharing).
diff --git a/docs/topics/multiplatform-mobile/multiplatform-mobile-samples.md b/docs/topics/multiplatform-mobile/multiplatform-mobile-samples.md
index ed6f482ecbc..36a47596814 100644
--- a/docs/topics/multiplatform-mobile/multiplatform-mobile-samples.md
+++ b/docs/topics/multiplatform-mobile/multiplatform-mobile-samples.md
@@ -70,7 +70,7 @@ This is a curated list of cross-platform mobile projects created with Kotlin Mul
Released: August 23, 2023
+ +A bug fix release for Kotlin 1.9.0.
+Learn more about Kotlin 1.9.0 in What's new in Kotlin 1.9.0.
+Released: July 6, 2023
diff --git a/docs/topics/run-code-snippets.md b/docs/topics/run-code-snippets.md index 3dcc97f9794..64498db522c 100644 --- a/docs/topics/run-code-snippets.md +++ b/docs/topics/run-code-snippets.md @@ -22,7 +22,7 @@ IntelliJ IDEA and Android Studio support Kotlin [scratch files and worksheets](h in a project, such as educational or demo materials. To create a Kotlin worksheet in a project directory, right-click the directory in the project tree and select - **New** | **Kotlin Worksheet**. + **New** | **Kotlin Class/File** | **Kotlin Worksheet**. Syntax highlighting, auto-completion, and other IntelliJ IDEA code editing features are supported in scratches and worksheets. There's no need to declare the `main()` function diff --git a/docs/topics/scope-functions.md b/docs/topics/scope-functions.md index 327d0885b68..0a3831d7a07 100644 --- a/docs/topics/scope-functions.md +++ b/docs/topics/scope-functions.md @@ -75,7 +75,7 @@ Detailed information about these functions is provided in the dedicated sections Here is a short guide for choosing scope functions depending on the intended purpose: -* Executing a lambda on non-null objects: `let` +* Executing a lambda on non-nullable objects: `let` * Introducing an expression as a variable in local scope: `let` * Object configuration: `apply` * Object configuration and computing the result: `run` diff --git a/docs/topics/tour/kotlin-tour-null-safety.md b/docs/topics/tour/kotlin-tour-null-safety.md index a2d1fc2c586..b6d76cf33c9 100644 --- a/docs/topics/tour/kotlin-tour-null-safety.md +++ b/docs/topics/tour/kotlin-tour-null-safety.md @@ -41,7 +41,7 @@ fun main() { nullable = null // By default, null values aren't accepted - var inferredNonNull = "The compiler assumes non-null" + var inferredNonNull = "The compiler assumes non-nullable" // Throws a compiler error inferredNonNull = null diff --git a/docs/topics/typecasts.md b/docs/topics/typecasts.md index 7f025115800..43d609d2ccb 100644 --- a/docs/topics/typecasts.md +++ b/docs/topics/typecasts.md @@ -1,5 +1,12 @@ [//]: # (title: Type checks and casts) +In Kotlin, you can perform type checks to check the type of an object at runtime. Type casts convert objects to a +different type. + +> To learn specifically about **generics** type checks and casts, for example `List
+ val local variables
+ |
+ + Always, except local delegated properties. + | +
+ val properties
+ |
+
+ If the property is private , internal , or if the check is performed in the same module where the property is declared. Smart casts can't be used on open properties or properties that have custom getters.
+ |
+
+ var local variables
+ |
+ + If the variable is not modified between the check and its usage, is not captured in a lambda that modifies it, and is not a local delegated property. + | +
+ var properties
+ |
+ + Never, because the variable can be modified at any time by other code. + | +
Kotlin 1.9.0 and earlier (a standard setup) | +Kotlin 1.9.20-Beta | +
-* Provide your feedback directly to K2 developers in the Kotlin Slack – [get an invite](https://surveys.jetbrains.com/s3/kotlin-slack-sign-up?_gl=1*ju6cbn*_ga*MTA3MTk5NDkzMC4xNjQ2MDY3MDU4*_ga_9J976DJZ68*MTY1ODMzNzA3OS4xMDAuMS4xNjU4MzQwODEwLjYw) - and join the [#k2-early-adopters](https://kotlinlang.slack.com/archives/C03PK0PE257) channel. -* Report any problems you've faced with the new K2 compiler via [our issue tracker](https://kotl.in/issue). -* [Enable the **Send usage statistics** option](https://www.jetbrains.com/help/idea/settings-usage-statistics.html) to - allow JetBrains to collect anonymous data about K2 usage. +```kotlin +kotlin { + androidTarget() + iosArm64() + iosSimulatorArm64() -## Stable replacement of the enum class values function + sourceSets { + val commonMain by getting -In 1.8.20, the `entries` property for enum classes was introduced as an Experimental feature. The `entries` property is intended to be a modern and performant replacement for the synthetic `values()` function. In 1.9.0-RC, the `entries` property is [Stable](components-stability.md#stability-levels-explained). + val iosMain by creating { + dependsOn(commonMain) + } -> The `values()` function is still supported, but we recommend that you use the `entries` property instead. -> -{type="tip"} + val iosArm64Main by getting { + dependsOn(iosMain) + } -```kotlin -enum class Color(val colorName: String, val rgb: String) { - RED("Red", "#FF0000"), - ORANGE("Orange", "#FF7F00"), - YELLOW("Yellow", "#FFFF00") + val iosSimulatorArm64Main by getting { + dependsOn(iosMain) + } + } } +``` + + | +-fun findByRgb(rgb: String): Color? = Color.entries.find { it.rgb == rgb } +```kotlin +kotlin { + androidTarget() + iosArm64() + iosSimulatorArm64() + + // The iosMain source set is created automatically +} ``` -{validate="false"} -For more information about the `entries` property for enum classes, see [What's new in Kotlin 1.8.20](whatsnew1820.md#a-modern-and-performant-replacement-of-the-enum-class-values-function). + | +