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/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 305d1f22e76..e355b4c8c04 100644 --- a/data/testimonials.yml +++ b/data/testimonials.yml @@ -5,7 +5,7 @@ url: https://www.corda.net/2017/01/10/kotlin/ text: Corda 是一个开源分布式分类账号平台,由各大银行提供支持,完全由 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 最近将 Kotlin 集成到了他们的 Android 客户端 - 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/kr.tree b/docs/kr.tree index 1a77f7b947d..20c65acf3fe 100644 --- a/docs/kr.tree +++ b/docs/kr.tree @@ -394,6 +394,7 @@ + diff --git a/docs/topics/gradle/gradle-compiler-options.md b/docs/topics/gradle/gradle-compiler-options.md index ef33dfc419c..9d40bcfe291 100644 --- a/docs/topics/gradle/gradle-compiler-options.md +++ b/docs/topics/gradle/gradle-compiler-options.md @@ -59,7 +59,7 @@ For both the JVM and Android projects, it's possible to define options using the ```kotlin kotlin { compilerOptions { - apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9) + apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.%gradleApiVersion%) } } ``` @@ -70,7 +70,7 @@ kotlin { ```groovy kotlin { compilerOptions { - apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 + apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.%gradleApiVersion% } } ``` @@ -235,10 +235,10 @@ tasks.named('compileKotlin', KotlinCompilationTask) { ### JVM 与 JS 的公共属性 -| 名称 | 描述 | 可能的值 |默认值 | -|------|-------------|-----------------|--------------| -| `apiVersion` | 限制只使用来自内置库的指定版本中的声明 | "1.3"(已弃用)、 "1.4"(已弃用)、 "1.5"、 "1.6"、 "1.7", "1.8", "1.9"(实验性的) | | -| `languageVersion` | 提供与指定 Kotlin 版本源代码级兼容 | "1.3"(已弃用)、 "1.4"(已弃用)、 "1.5"、 "1.6"、 "1.7", "1.8", "1.9"(实验性的) | | +| 名称 | 描述 | 可能的值 |默认值 | +|------|-------------|--------------------------------------------------------------------------|--------------| +| `apiVersion` | 限制只使用来自内置库的指定版本中的声明 | "1.4"(已弃用)、 "1.5"、 "1.6"、 "1.7"、 "1.8"、 "1.9"、 "2.0"(实验性的)、 "2.1"(实验性的) | | +| `languageVersion` | 提供与指定 Kotlin 版本源代码级兼容 | "1.4"(已弃用)、 "1.5"、 "1.6"、 "1.7"、 "1.8"、 "1.9"、 "2.0"(实验性的)、 "2.1"(实验性的) | | #### Example of setting a languageVersion @@ -254,7 +254,7 @@ tasks compilerOptions .languageVersion .set( - org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 + org.jetbrains.kotlin.gradle.dsl.KotlinVersion.%gradleLanguageVersion% ) } ``` @@ -267,7 +267,7 @@ tasks .withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask.class) .configureEach { compilerOptions.languageVersion = - org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 + org.jetbrains.kotlin.gradle.dsl.KotlinVersion.%gradleLanguageVersion% } ``` @@ -299,7 +299,7 @@ Some of the `compilerOptions` use the new types instead of the `String` type: | Option | Type | Example | |--------|------|---------| | `jvmTarget` | [`JvmTarget`](https://github.com/JetBrains/kotlin/blob/1.8.0/libraries/tools/kotlin-gradle-compiler-types/src/generated/kotlin/org/jetbrains/kotlin/gradle/dsl/JvmTarget.kt) | `compilerOptions.jvmTarget.set(JvmTarget.JVM_11)` | -| `apiVersion` and `languageVersion` | [`KotlinVersion`](https://github.com/JetBrains/kotlin/blob/1.8.0/libraries/tools/kotlin-gradle-compiler-types/src/generated/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinVersion.kt) | `compilerOptions.languageVersion.set(KotlinVersion.KOTLIN_1_9)` | +| `apiVersion` and `languageVersion` | [`KotlinVersion`](https://github.com/JetBrains/kotlin/blob/1.8.0/libraries/tools/kotlin-gradle-compiler-types/src/generated/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinVersion.kt) | `compilerOptions.languageVersion.set(KotlinVersion.%gradleLanguageVersion%)` | | `main` | [`JsMainFunctionExecutionMode`](https://github.com/JetBrains/kotlin/blob/1.8.0/libraries/tools/kotlin-gradle-compiler-types/src/generated/kotlin/org/jetbrains/kotlin/gradle/dsl/JsMainFunctionExecutionMode.kt) | `compilerOptions.main.set(JsMainFunctionExecutionMode.NO_CALL)` | | `moduleKind` | [`JsModuleKind`](https://github.com/JetBrains/kotlin/blob/1.8.0/libraries/tools/kotlin-gradle-compiler-types/src/generated/kotlin/org/jetbrains/kotlin/gradle/dsl/JsModuleKind.kt) | `compilerOptions.moduleKind.set(JsModuleKind.MODULE_ES)` | | `sourceMapEmbedSources` | [`JsSourceMapEmbedMode`](https://github.com/JetBrains/kotlin/blob/1.8.0/libraries/tools/kotlin-gradle-compiler-types/src/generated/kotlin/org/jetbrains/kotlin/gradle/dsl/JsSourceMapEmbedMode.kt) | `compilerOptions.sourceMapEmbedSources.set(JsSourceMapEmbedMode.SOURCE_MAP_SOURCE_CONTENT_INLINING)` | diff --git a/docs/topics/home.xml b/docs/topics/home.xml index 2da320ce4f5..0ad50e9deca 100644 --- a/docs/topics/home.xml +++ b/docs/topics/home.xml @@ -50,7 +50,7 @@ 心印 JetBrains 学院 Advent of Code - 动手实践教程 + 动手实践教程 IntelliJ IDEA 中的 JetBrains 学院 diff --git a/docs/topics/kotlin-evolution.md b/docs/topics/kotlin-evolution.md index 0d98e97ac16..d914c539f91 100644 --- a/docs/topics/kotlin-evolution.md +++ b/docs/topics/kotlin-evolution.md @@ -73,7 +73,7 @@ Kotlin 旨在成为程序员的实用工具。在语言演进方面,它的实 [JetBrains](https://jetbrains.com)是 Kotlin 的原始创建者,它在社区的帮助下并根据 [Kotlin 基金会](https://kotlinfoundation.org/)来推动 kotlin 的发展。 [首席语言设计师](https://kotlinfoundation.org/structure/)(现为 Roman Elizarov)负责监督 Kotlin 编程语言的所有更改。首席设计师在与语言发展有关的所有事务中拥有最终决定权。 此外,对完全稳定的组件进行不兼容的更改必须完全由[Kotlin 基金会](https://kotlinfoundation.org/structure/)指定的[语言委员会](https://kotlinfoundation.org/structure/)(目前由 Jeffrey van Gogh,William R. Cook 与 Roman Elizarov 组成)批准。 +-->[语言委员会](https://kotlinfoundation.org/structure/)(目前由 Jeffrey van Gogh,Werner Dietl 与 Roman Elizarov 组成)批准。 语言委员会对将进行哪些不兼容的更改以及应采取什么确切的措施使用户感到满意做出最终决定。为此,它依赖[此处](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/learning-materials-overview.md b/docs/topics/learning-materials-overview.md index 96448670095..1063bf40e47 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/releases.md b/docs/topics/releases.md index 8180f3d7299..a4595dd83a4 100644 --- a/docs/topics/releases.md +++ b/docs/topics/releases.md @@ -53,6 +53,17 @@ You can also use [preview versions of Kotlin](eap.md#build-details). 版本信息 版本重点 + + 1.9.10 +

Released: August 23, 2023

+

Release on GitHub

+ + +

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.

+ For Android Studio Giraffe and Hedgehog, the Kotlin plugin 1.9.10 will be delivered with upcoming Android Studios updates. + + 1.9.0

Released: July 6, 2023

diff --git a/docs/topics/typecasts.md b/docs/topics/typecasts.md index be5b945cfbb..5eb519bffdd 100644 --- a/docs/topics/typecasts.md +++ b/docs/topics/typecasts.md @@ -1,5 +1,12 @@ [//]: # (title: 类型检测与类型转换) +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`, `Map`, see [Generics type checks and casts](generics.md#generics-type-checks-and-casts). +> +{type="tip"} + ## is 与 !is 操作符 使用 `is` 操作符或其否定形式 `!is` 在运行时检测对象是否符合给定类型: @@ -60,13 +67,46 @@ when (x) { } ``` -请注意,当编译器能保证变量在检测和使用之间不可改变时,智能转换才有效。 -更具体地,智能转换适用于以下情形: - -* `val` 局部变量——总是可以,[局部委托属性除外](delegated-properties.md)。 -* `val` 属性——如果属性是 private 或 internal,或者该检测在声明属性的同一[模块](visibility-modifiers.md#模块)中执行。智能转换不能用于 open 的属性或者具有自定义 getter 的属性。 -* `var` 局部变量——如果变量在检测和使用之间没有修改、没有在会修改它的 lambda 中捕获、并且不是局部委托属性。 -* `var` 属性——决不可能(因为该变量可以随时被其他代码修改)。 +> 请注意,当编译器能保证变量在检测及其使用之间不可改变时,智能转换才有效。 +> +{type="warning"} + +智能转换适用于以下情形: + + + + + + + + + + + + + + + + + + +
+ val 局部变量 + + 总是可以,局部委托属性除外。 +
+ val 属性 + + 如果属性是 privateinternal,或者该检测在声明属性的同一模块中执行。 智能转换不能用于 open 的属性或者具有自定义 getter 的属性。 +
+ var 局部变量 + + 如果变量在检测及其使用之间未修改、没有在会修改它的 lambda 中捕获、并且不是局部委托属性。 +
+ var 属性 + + 决不可能,因为该变量可以随时被其他代码修改。 +
## “不安全的”转换操作符 @@ -94,8 +134,3 @@ val x: String? = y as? String ``` 请注意,尽管事实上 `as?` 的右边是一个非空类型的 `String`,但是其转换的结果是可空的。 - -## 泛型类型检测与类型转换 - -请参见[泛型文档页](generics.md#泛型类型检测与类型转换)中相应部分了解可以使用泛型进行类型检测与类型转换的信息。 diff --git a/docs/v.list b/docs/v.list index eff72d1ce26..8f0f4f95836 100644 --- a/docs/v.list +++ b/docs/v.list @@ -4,13 +4,13 @@ - + - + - + @@ -28,6 +28,10 @@ + + + +