Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
# Conflicts:
#	data/testimonials.yml
#	docs/topics/gradle/gradle-compiler-options.md
#	docs/topics/home.xml
#	docs/topics/kotlin-evolution.md
#	docs/topics/typecasts.md
#	docs/v.list
  • Loading branch information
hltj committed Aug 27, 2023
2 parents 0cf77fb + f130f58 commit 0bf2e0f
Show file tree
Hide file tree
Showing 14 changed files with 163 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .teamcity/BuildParams.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
10 changes: 5 additions & 5 deletions data/events.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions data/releases.yml
Original file line number Diff line number Diff line change
@@ -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

2 changes: 1 addition & 1 deletion data/testimonials.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
Binary file modified docs/images/data-science/kotlin-notebook.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/kr.tree
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@
<toc-element href="https://play.kotlinlang.org/byExample/overview" toc-title="Kotlin by example"/>
<toc-element id="koans.md"/>
<toc-element href="https://hyperskill.org/tracks?category=4&amp;utm_source=jbkotlin_hs&amp;utm_medium=referral&amp;utm_campaign=kotlinlang-docs&amp;utm_content=button_1&amp;utm_term=22.03.23" toc-title="Kotlin Core track"/>
<toc-element id="kotlin-hands-on.md" toc-title="Kotlin hands-on"/>
<toc-element id="kotlin-tips.md"/>
<toc-element id="books.md"/>
<toc-element id="advent-of-code.md" toc-title="Advent of Code puzzles"/>
Expand Down
18 changes: 9 additions & 9 deletions docs/topics/gradle/gradle-compiler-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -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%)
}
}
```
Expand All @@ -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%
}
}
```
Expand Down Expand Up @@ -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

Expand All @@ -254,7 +254,7 @@ tasks
compilerOptions
.languageVersion
.set(
org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9
org.jetbrains.kotlin.gradle.dsl.KotlinVersion.%gradleLanguageVersion%
)
}
```
Expand All @@ -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%
}
```

Expand Down Expand Up @@ -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)` |
Expand Down
2 changes: 1 addition & 1 deletion docs/topics/home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<a href="koans.md" description="Programming exercises to get you familiar with Kotlin">心印</a>
<a href="https://hyperskill.org/tracks?category=4&amp;utm_source=jbkotlin_hs&amp;utm_medium=referral&amp;utm_campaign=kotlinlang-docs&amp;utm_content=button_1&amp;utm_term=22.03.23" description="Kotlin Core track by JetBrains Academy">JetBrains 学院</a>
<a href="advent-of-code.md" description="Code puzzles in idiomatic Kotlin">Advent of Code</a>
<a href="https://play.kotlinlang.org/hands-on/overview" description="Complete long-form tutorials to fully grasp a technology">动手实践教程</a>
<a href="kotlin-hands-on.md" description="Complete long-form tutorials to fully grasp a technology">动手实践教程</a>
<a href="edu-tools-learner.md"
description="An IDE plugin for learning and teaching programming languages">IntelliJ IDEA 中的
JetBrains 学院</a>
Expand Down
2 changes: 1 addition & 1 deletion docs/topics/kotlin-evolution.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/)提供的一组准则。

Expand Down
76 changes: 76 additions & 0 deletions docs/topics/kotlin-hands-on.md
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion docs/topics/learning-materials-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
11 changes: 11 additions & 0 deletions docs/topics/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ You can also use [preview versions of Kotlin](eap.md#build-details).
<th>版本信息</th>
<th>版本重点</th>
</tr>
<tr>
<td><strong>1.9.10</strong>
<p>Released: <strong>August 23, 2023</strong></p>
<p><a href="https://github.com/JetBrains/kotlin/releases/tag/v1.9.10" target="_blank">Release on GitHub</a></p>
</td>
<td>
<p>A bug fix release for Kotlin 1.9.0.</p>
<p>Learn more about Kotlin 1.9.0 in <a href="whatsnew19.md" target="_blank">What's new in Kotlin 1.9.0</a>.</p>
<note>For Android Studio Giraffe and Hedgehog, the Kotlin plugin 1.9.10 will be delivered with upcoming Android Studios updates.</note>
</td>
</tr>
<tr>
<td><strong>1.9.0</strong>
<p>Released: <strong>July 6, 2023</strong></p>
Expand Down
59 changes: 47 additions & 12 deletions docs/topics/typecasts.md
Original file line number Diff line number Diff line change
@@ -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<T>`, `Map<K,V>`, see [Generics type checks and casts](generics.md#generics-type-checks-and-casts).
>
{type="tip"}

## is 与 !is 操作符

使用 `is` 操作符或其否定形式 `!is` 在运行时检测对象是否符合给定类型:
Expand Down Expand Up @@ -60,13 +67,46 @@ when (x) {
}
```

请注意,当编译器能保证变量在检测和使用之间不可改变时,智能转换才有效。
更具体地,智能转换适用于以下情形:

* `val` 局部变量——总是可以,[局部委托属性除外](delegated-properties.md)
* `val` 属性——如果属性是 private 或 internal,或者该检测在声明属性的同一[模块](visibility-modifiers.md#模块)中执行。智能转换不能用于 open 的属性或者具有自定义 getter 的属性。
* `var` 局部变量——如果变量在检测和使用之间没有修改、没有在会修改它的 lambda 中捕获、并且不是局部委托属性。
* `var` 属性——决不可能(因为该变量可以随时被其他代码修改)。
> 请注意,当编译器能保证变量在检测及其使用之间不可改变时,智能转换才有效。
>
{type="warning"}

智能转换适用于以下情形:

<table header-style="none">
<tr>
<td>
<code>val</code> 局部变量
</td>
<td>
总是可以,<a href="delegated-properties.md">局部委托属性</a>除外。
</td>
</tr>
<tr>
<td>
<code>val</code> 属性
</td>
<td>
如果属性是 <code>private</code>、 <code>internal</code>,或者该检测在声明属性的同一<a href="visibility-modifiers.md#模块">模块</a>中执行。 智能转换不能用于 <code>open</code> 的属性或者具有自定义 getter 的属性。
</td>
</tr>
<tr>
<td>
<code>var</code> 局部变量
</td>
<td>
如果变量在检测及其使用之间未修改、没有在会修改它的 lambda 中捕获、并且不是局部委托属性。
</td>
</tr>
<tr>
<td>
<code>var</code> 属性
</td>
<td>
决不可能,因为该变量可以随时被其他代码修改。
</td>
</tr>
</table>

## “不安全的”转换操作符

Expand Down Expand Up @@ -94,8 +134,3 @@ val x: String? = y as? String
```

请注意,尽管事实上 `as?` 的右边是一个非空类型的 `String`,但是其转换的结果是可空的。

## 泛型类型检测与类型转换

请参见[泛型文档页](generics.md#泛型类型检测与类型转换)中相应部分<!--
-->了解可以使用泛型进行类型检测与类型转换的信息。
10 changes: 7 additions & 3 deletions docs/v.list
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

<vars>

<var name="kotlinVersion" value="1.9.0" type="string"/>
<var name="kotlinVersion" value="1.9.10" type="string"/>

<var name="kotlinEapVersion" value="1.9.0-RC" type="string"/>

<var name="kotlinLatestUrl" value="https://github.com/JetBrains/kotlin/releases/tag/v1.9.0" type="string"/>
<var name="kotlinLatestUrl" value="https://github.com/JetBrains/kotlin/releases/tag/v1.9.10" type="string"/>

<var name="kotlinReleaseDate" value="2023-07-06" type="string"/>
<var name="kotlinReleaseDate" value="2023-08-23" type="string"/>

<var name="kotlinEapReleaseDate" value="2023-06-20" type="string"/>

Expand All @@ -28,6 +28,10 @@

<var name="gradleVersion" value="7.6" type="string"/>

<var name="gradleLanguageVersion" value="KOTLIN_2_0" type="string"/>

<var name="gradleApiVersion" value="KOTLIN_2_0" type="string"/>

<var name="serializationVersion" value="1.5.1" type="string"/>

<var name="defaultJvmTargetVersion" value="1.8" type="string"/>
Expand Down

0 comments on commit 0bf2e0f

Please sign in to comment.