From 75d91d8357cfb0b56c26617932a9528b1130e918 Mon Sep 17 00:00:00 2001 From: Ying Li Date: Thu, 21 Mar 2024 15:41:24 +0900 Subject: [PATCH] minor update --- data/_nav_zh.yml | 2 +- data/releases.yml | 8 ++--- pages/docs/reference_zh/all-open-plugin.md | 2 +- .../reference_zh/cross-platform-frameworks.md | 3 +- pages/docs/reference_zh/eap.md | 7 ++-- .../gradle/gradle-configure-project.md | 2 +- pages/docs/reference_zh/iterators.md | 35 +++++++++++++++++-- .../multiplatform-expect-actual.md | 4 +-- .../reference_zh/sam-with-receiver-plugin.md | 23 ++++++++++-- pages/docs/reference_zh/whatsnew-eap.md | 4 +-- 10 files changed, 70 insertions(+), 20 deletions(-) diff --git a/data/_nav_zh.yml b/data/_nav_zh.yml index 6af368b9aee..670652a6f76 100644 --- a/data/_nav_zh.yml +++ b/data/_nav_zh.yml @@ -122,7 +122,7 @@ reference: - url: /docs/reference_zh/whatsnew19.html title: Kotlin 1.9.0 - url: /docs/reference_zh/whatsnew-eap.html - title: Kotlin 2.0.0-Beta4 + title: Kotlin 2.0.0-Beta5 - title: 早期版本 content: - url: /docs/reference_zh/whatsnew1820.html diff --git a/data/releases.yml b/data/releases.yml index 72e6266bf7b..34289c0b998 100644 --- a/data/releases.yml +++ b/data/releases.yml @@ -11,10 +11,10 @@ latest: coroutines: version: 1.7.3 -latestDocDate: 2024/03/13 +latestDocDate: 2024/03/21 -kotlinEapVersion: 2.0.0-Beta4 -kotlinEapReleaseDate: 2024/02/13 +kotlinEapVersion: 2.0.0-Beta5 +kotlinEapReleaseDate: 2024/03/20 coroutinesEapVersion: 1.7.3 @@ -45,7 +45,7 @@ dateTimeVersion: 0.4.0 foojayResolver: 0.5.0 -lincheckVersion: 2.26 +lincheckVersion: 2.28 jctoolsVersion: 3.3.0 lombokVersion: 1.18.22 diff --git a/pages/docs/reference_zh/all-open-plugin.md b/pages/docs/reference_zh/all-open-plugin.md index 5faac33ed3b..6857d3c1bab 100644 --- a/pages/docs/reference_zh/all-open-plugin.md +++ b/pages/docs/reference_zh/all-open-plugin.md @@ -30,7 +30,7 @@ Kotlin 为 `all-open` 插件提供了 Gradle 和 Maven 支持, 并带有完整 ```kotlin plugins { - id("org.jetbrains.kotlin.plugin.allopen") version "{{ site.data.releases.latest.version }}" + kotlin("plugin.allopen") version "{{ site.data.releases.latest.version }}" } ``` diff --git a/pages/docs/reference_zh/cross-platform-frameworks.md b/pages/docs/reference_zh/cross-platform-frameworks.md index d88cc1ae881..8c1a93e0632 100644 --- a/pages/docs/reference_zh/cross-platform-frameworks.md +++ b/pages/docs/reference_zh/cross-platform-frameworks.md @@ -64,7 +64,8 @@ Flutter 拥有遍及全世界、相对活跃的用户社区, 并被很多开发 **编程语言:** JavaScript. -**移动应用程序示例:** Skype, Bloomberg, Shopify, [Facebook 和 Instagram](https://itcraftapps.com/blog/7-react-native-myths-vs-reality/#facebook-instagram-in-react-native) 中的很多小模块. +**移动应用程序示例:** React Native 被应用于 Microsoft 公司的 Office, Skype, 以及 Xbox Game Pass; Meta 公司的 Facebook, Desktop Messenger, 以及 Oculus. +更多案例请参见 [React Native 案例展示](https://reactnative.dev/showcase). **主要功能特性:** diff --git a/pages/docs/reference_zh/eap.md b/pages/docs/reference_zh/eap.md index ee601a6210e..87df9424c07 100644 --- a/pages/docs/reference_zh/eap.md +++ b/pages/docs/reference_zh/eap.md @@ -64,14 +64,15 @@ title: "参加 Kotlin EAP 项目" 重要功能 - 2.0.0-Beta4 -

发布日期: 2024/02/13

+ 2.0.0-Beta5 +

发布日期: 2024/03/20

GitHub 上的 Release 页面

Kotlin K2 编译器的稳定发布版.

包括 Gradle 构建工具的改进.

-

更多详情, 请参见 changelogKotlin 2.0.0-Beta4 中的新功能.

+

Kotlin/Wasm 与 JavaScript 交互能力的改进.

+

更多详情, 请参见 changelogKotlin 2.0.0-Beta5 中的新功能.

diff --git a/pages/docs/reference_zh/gradle/gradle-configure-project.md b/pages/docs/reference_zh/gradle/gradle-configure-project.md index 83776556759..ec50dea1358 100644 --- a/pages/docs/reference_zh/gradle/gradle-configure-project.md +++ b/pages/docs/reference_zh/gradle/gradle-configure-project.md @@ -55,7 +55,7 @@ plugins { | KGP 版本 | Gradle 最低和最高版本 | AGP 最低和最高版本 | |---------------|---------------------------------------|-----------------------------------------------------| -| 1.9.20 | {{ site.data.releases.minGradleVersion }}–{{ site.data.releases.maxGradleVersion }} | {{ site.data.releases.minAndroidGradleVersion }}–{{ site.data.releases.maxAndroidGradleVersion }} | +| 1.9.20–1.9.23 | {{ site.data.releases.minGradleVersion }}–{{ site.data.releases.maxGradleVersion }} | {{ site.data.releases.minAndroidGradleVersion }}–{{ site.data.releases.maxAndroidGradleVersion }} | | 1.9.0–1.9.10 | 6.8.3–7.6.0 | 4.2.2–7.4.0 | | 1.8.20–1.8.22 | 6.8.3–7.6.0 | 4.1.3–7.4.0 | | 1.8.0–1.8.11 | 6.8.3–7.3.3 | 4.1.3–7.2.1 | diff --git a/pages/docs/reference_zh/iterators.md b/pages/docs/reference_zh/iterators.md index e42810b3f29..d32f9f05284 100644 --- a/pages/docs/reference_zh/iterators.md +++ b/pages/docs/reference_zh/iterators.md @@ -36,6 +36,11 @@ fun main() { val numbersIterator = numbers.iterator() while (numbersIterator.hasNext()) { println(numbersIterator.next()) + // 输出结果为 + // one + // two + // three + // four } //sampleEnd } @@ -55,6 +60,11 @@ fun main() { val numbers = listOf("one", "two", "three", "four") for (item in numbers) { println(item) + // 输出结果为 + // one + // two + // three + // four } //sampleEnd } @@ -73,6 +83,11 @@ fun main() { val numbers = listOf("one", "two", "three", "four") numbers.forEach { println(it) + // 输出结果为 + // one + // two + // three + // four } //sampleEnd } @@ -106,9 +121,15 @@ fun main() { val listIterator = numbers.listIterator() while (listIterator.hasNext()) listIterator.next() println("Iterating backwards:") + // 反向遍历: while (listIterator.hasPrevious()) { print("Index: ${listIterator.previousIndex()}") println(", value: ${listIterator.previous()}") + // 输出结果为 + // Index: 3, value: four + // Index: 2, value: three + // Index: 1, value: two + // Index: 0, value: one } //sampleEnd } @@ -135,8 +156,10 @@ fun main() { val mutableIterator = numbers.iterator() mutableIterator.next() - mutableIterator.remove() + mutableIterator.remove() println("After removal: $numbers") + // 输出结果为 + // After removal: [two, three, four] //sampleEnd } ``` @@ -144,7 +167,10 @@ fun main() { 对于可变的 list, 可以使用 [`MutableListIterator`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list-iterator/index.html). -除了删除元素之外, 这个迭代器还可以在遍历 list 的过程中添加元素, 或替换元素. +除了删除元素之外, 这个迭代器还可以在遍历 list 的过程中, +使用 [`add()`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list-iterator/add.html) +和 [`set()`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list-iterator/set.html) 函数, +添加或替换元素.
@@ -157,9 +183,12 @@ fun main() { mutableListIterator.next() mutableListIterator.add("two") + println(numbers) + // 输出结果为 [one, two, four, four] mutableListIterator.next() - mutableListIterator.set("three") + mutableListIterator.set("three") println(numbers) + // 输出结果为 [one, two, three, four] //sampleEnd } ``` diff --git a/pages/docs/reference_zh/multiplatform/multiplatform-expect-actual.md b/pages/docs/reference_zh/multiplatform/multiplatform-expect-actual.md index 39f1c0e50c6..36666d4f550 100644 --- a/pages/docs/reference_zh/multiplatform/multiplatform-expect-actual.md +++ b/pages/docs/reference_zh/multiplatform/multiplatform-expect-actual.md @@ -494,8 +494,8 @@ actual enum class Department { IT, HR, Sales, Marketing } fun matchOnDepartment(dept: Department) { when (dept) { Department.IT -> println("The IT Department") - Department.HR -> println("The IT Department") - Department.Sales -> println("The IT Department") + Department.HR -> println("The HR Department") + Department.Sales -> println("The Sales Department") else -> println("Some other department") } } diff --git a/pages/docs/reference_zh/sam-with-receiver-plugin.md b/pages/docs/reference_zh/sam-with-receiver-plugin.md index a111312f47b..a85fa596ad3 100644 --- a/pages/docs/reference_zh/sam-with-receiver-plugin.md +++ b/pages/docs/reference_zh/sam-with-receiver-plugin.md @@ -38,15 +38,34 @@ fun test(context: TaskContext) { ## Gradle -使用方法与 [all-open](all-open-plugin.html)插件 和 [no-arg](no-arg-plugin.html)插件相同, +使用方法与 [all-open](all-open-plugin.html) 插件和 [no-arg](no-arg-plugin.html) 插件相同, 区别是 sam-with-receiver 没有任何预定义, 因此你需要自己指定需要特别处理的注解. +
+
+ +```kotlin +plugins { + kotlin("plugin.sam.with.receiver") version "{{ site.data.releases.latest.version }}" +} +``` + +
+
+ +
+
+ ```groovy plugins { - id("org.jetbrains.kotlin.plugin.sam.with.receiver") version "{{ site.data.releases.latest.version }}" + id "org.jetbrains.kotlin.plugin.sam.with.receiver" version "{{ site.data.releases.latest.version }}" } ``` +
+
+ + 然后指定需要特别处理的 SAM-with-receiver 注解: ```groovy diff --git a/pages/docs/reference_zh/whatsnew-eap.md b/pages/docs/reference_zh/whatsnew-eap.md index 1d06a669b02..9f031530da6 100644 --- a/pages/docs/reference_zh/whatsnew-eap.md +++ b/pages/docs/reference_zh/whatsnew-eap.md @@ -2,10 +2,10 @@ type: doc layout: reference category: -title: "Kotlin 2.0.0-Beta4 版中的新功能" +title: "Kotlin 2.0.0-Beta5 版中的新功能" --- -# Kotlin 2.0.0-Beta4 版中的新功能 +# Kotlin 2.0.0-Beta5 版中的新功能 最终更新: {{ site.data.releases.latestDocDate }}