Skip to content

Commit 1a2e258

Browse files
Merge branch 'master' into kug-inclusion-kotlin-devs-brasil
2 parents 0436819 + fadf671 commit 1a2e258

File tree

2 files changed

+45
-38
lines changed

2 files changed

+45
-38
lines changed

docs/topics/basic-types.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,19 @@ While certain types have an optimized internal representation as primitive value
55
they appear and behave like regular classes to you.
66

77
This section describes the basic types used in Kotlin:
8+
89
* [Numbers](numbers.md) and their [unsigned counterparts](unsigned-integer-types.md)
910
* [Booleans](booleans.md)
1011
* [Characters](characters.md)
1112
* [Strings](strings.md)
1213
* [Arrays](arrays.md)
1314

1415
> [Learn how to perform type checks and casts in Kotlin](typecasts.md).
15-
>
16-
{type="tip"}
16+
>
17+
{type="tip"}
18+
19+
To learn about other Kotlin types, such as `Nothing`, `Any`, and `Unit`, look through the Kotlin API reference:
20+
21+
* [`Any`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/)
22+
* [`Nothing`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-nothing.html)
23+
* [`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/)

docs/topics/whatsnew20.md

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,23 @@ All you need to do is to [change the Kotlin version](configure-build-for-eap.md)
2828

2929
## Kotlin K2 compiler
3030

31-
The road to the K2 compiler has been a long one, but now the JetBrains team is ready to announce its stabilization. In
32-
Kotlin 2.0.0, the new Kotlin K2 compiler is used by default and it is [Stable](components-stability.md) for all target
31+
The road to the K2 compiler has been a long one, but now the JetBrains team is finally ready to announce its stabilization.
32+
In Kotlin 2.0.0, the new Kotlin K2 compiler is used by default and it is [Stable](components-stability.md) for all target
3333
platforms: JVM, Native, Wasm, and JS. The new compiler brings major performance improvements, speeds up new language
3434
feature development, unifies all platforms that Kotlin supports, and provides a better architecture for multiplatform
3535
projects.
3636

3737
The JetBrains team has ensured the quality of the new compiler by successfully compiling 10 million lines of code from
38-
selected user and internal projects. 18,000 developers and 80,000 projects were involved in the stabilization
39-
process, trying the new K2 compiler in their projects and reporting any problems they found.
38+
selected user and internal projects. 18,000 developers were involved in the stabilization process, testing the new K2
39+
compiler across a total of 80,000 projects and reporting any problems they found.
4040

4141
To help make the migration process to the new compiler as smooth as possible, we've created a [K2 compiler migration guide](k2-compiler-migration-guide.md).
4242
This guide explains the many benefits of the compiler, highlights any changes you might encounter, and describes how to
4343
roll back to the previous version if necessary.
4444

45-
We explored the performance of the K2 compiler in different projects in a [blog post](https://blog.jetbrains.com/kotlin/2024/04/k2-compiler-performance-benchmarks-and-how-to-measure-them-on-your-projects/).
46-
Check it out if you'd like to see real data on how the K2 compiler performs and find instructions on how to collect
47-
performance benchmarks from your own projects.
45+
In a [blog post](https://blog.jetbrains.com/kotlin/2024/04/k2-compiler-performance-benchmarks-and-how-to-measure-them-on-your-projects/),
46+
we explored the performance of the K2 compiler in different projects. Check it out if you'd like to see real data on how
47+
the K2 compiler performs and find instructions on how to collect performance benchmarks from your own projects.
4848

4949
### Current K2 compiler limitations
5050

@@ -630,10 +630,10 @@ Kotlin Playground supports the 2.0.0 release. [Check it out!](https://pl.kotl.in
630630
### Support in IDEs
631631

632632
By default, IntelliJ IDEA and Android Studio still use the previous compiler for code analysis, code completion,
633-
highlighting, and other IDE-related features. To get the full Kotlin 2.0 experience in your IDE, enable the K2 Kotlin mode.
633+
highlighting, and other IDE-related features. To get the full Kotlin 2.0 experience in your IDE, enable K2 Kotlin mode.
634634

635635
In your IDE, go to **Settings** | **Languages & Frameworks** | **Kotlin** and select the **Enable the K2-based Kotlin
636-
plugin** option. The IDE will analyze your code with its K2 Kotlin mode.
636+
plugin** option. The IDE will analyze your code using its K2 Kotlin mode.
637637

638638
> The K2 Kotlin mode is in Alpha and is available starting from 2024.1. The performance and stability of code
639639
> highlighting and code completion have been significantly improved, but not all IDE features are supported yet.
@@ -644,7 +644,7 @@ After enabling K2 mode, you may notice differences in IDE analysis due to change
644644
new K2 compiler differs from the previous one in our [migration guide](k2-compiler-migration-guide.md).
645645

646646
* Learn more about the K2 Kotlin mode in [our blog](https://blog.jetbrains.com/idea/2024/03/k2-kotlin-mode-alpha-in-intellij-idea/).
647-
* We are actively collecting feedback about K2 Kotlin mode. Please share your thoughts in our [public Slack channel](https://kotlinlang.slack.com/archives/C0B8H786P).
647+
* We are actively collecting feedback about K2 Kotlin mode, so please share your thoughts in our [public Slack channel](https://kotlinlang.slack.com/archives/C0B8H786P).
648648

649649
### Leave your feedback on the new K2 compiler
650650

@@ -759,7 +759,7 @@ debugging information, including all compiler arguments.
759759

760760
### Explicitly added standard library and platform dependencies to Kotlin/Native
761761

762-
The Kotlin/Native compiler used to resolve standard library and platform dependencies implicitly, which caused
762+
Previously, the Kotlin/Native compiler resolved standard library and platform dependencies implicitly, which caused
763763
inconsistencies in the way the Kotlin Gradle plugin worked across Kotlin targets.
764764

765765
Now, each Kotlin/Native Gradle compilation explicitly includes standard library and platform dependencies in its
@@ -788,14 +788,14 @@ Kotlin 2.0.0 improves performance and interoperability with JavaScript:
788788
* [Support for unsigned primitive types in functions with `@JsExport`](#support-for-unsigned-primitive-types-in-functions-with-jsexport)
789789
* [Generation of TypeScript declaration files in Kotlin/Wasm](#generation-of-typescript-declaration-files-in-kotlin-wasm)
790790
* [Support for catching JavaScript exceptions](#support-for-catching-javascript-exceptions)
791-
* [New exception handling proposal is now supported under the option](#new-exception-handling-proposal-is-now-supported-under-the-option)
792-
* [`withWasm()` function is split into JS and WASI variants](#withwasm-function-is-split-into-js-and-wasi-variants)
791+
* [New exception handling proposal is now supported as an option](#new-exception-handling-proposal-is-now-supported-as-an-option)
792+
* [The `withWasm()` function is split into JS and WASI variants](#the-withwasm-function-is-split-into-js-and-wasi-variants)
793793

794794
### Optimized production builds by default using Binaryen
795795

796796
The Kotlin/Wasm toolchain now applies the [Binaryen](https://github.com/WebAssembly/binaryen) tool during production
797797
compilation to all projects, as opposed to the previous manual setup approach. By our estimations, it should
798-
improve runtime performance and the binaries size for your project.
798+
improve runtime performance and reduce the binary size for your project.
799799

800800
> This change only affects production compilation. The development compilation process stays the same.
801801
>
@@ -875,22 +875,22 @@ from the JavaScript side of the program.
875875
In Kotlin 2.0.0, we have implemented support for catching JavaScript exceptions within Kotlin/Wasm. This implementation
876876
allows you to use `try-catch` blocks, with specific types like `Throwable` or `JsException`, to handle these errors properly.
877877

878-
Additionally, `finally` blocks, which help execute code regardless of exceptions, also work correctly. While we are
879-
introducing support for catching JavaScript exceptions, no additional information is provided when a JavaScript exception
880-
occurs, like a call stack. However, [we are working on these implementations](https://youtrack.jetbrains.com/issue/KT-68185/WasmJs-Attach-js-exception-object-to-JsException).
878+
Additionally, `finally` blocks, which help execute code regardless of exceptions, also work correctly. While we're
879+
introducing support for catching JavaScript exceptions, no additional information is provided when a JavaScript exception,
880+
like a call stack, occurs. However, [we are working on these implementations](https://youtrack.jetbrains.com/issue/KT-68185/WasmJs-Attach-js-exception-object-to-JsException).
881881

882-
### New exception handling proposal is now supported under the option
882+
### New exception handling proposal is now supported as an option
883883

884884
In this release, we introduce support for the new version of WebAssembly's [exception handling proposal](https://github.com/WebAssembly/exception-handling/blob/main/proposals/exception-handling/Exceptions.md)
885885
within Kotlin/Wasm.
886886

887887
This update ensures the new proposal aligns with Kotlin requirements, enabling the use of Kotlin/Wasm on virtual
888888
machines that only support the latest version of the proposal.
889889

890-
Activate the new exception handling proposal by using the `-Xwasm-use-new-exception-proposal` compiler option. It is
890+
Activate the new exception handling proposal by using the `-Xwasm-use-new-exception-proposal` compiler option, which is
891891
turned off by default.
892892

893-
### withWasm() function is split into JS and WASI variants
893+
### The withWasm() function is split into JS and WASI variants
894894

895895
The `withWasm()` function, which used to provide Wasm targets for hierarchy templates, is deprecated in favor of
896896
specialized `withWasmJs()` and `withWasmWasi()` functions.
@@ -980,7 +980,7 @@ kotlin {
980980
### Per-file compilation for Kotlin/JS projects
981981

982982
Kotlin 2.0.0 introduces a new granularity option for the Kotlin/JS project output. You can now set up a per-file
983-
compilation that generates one JavaScript file per each Kotlin file. It helps to significantly optimize the size of the
983+
compilation that generates one JavaScript file for each Kotlin file. It helps to significantly optimize the size of the
984984
final bundle and improve the loading time of the program.
985985

986986
Previously, there were only two output options. The Kotlin/JS compiler could generate a single `.js` file for the whole
@@ -1054,7 +1054,7 @@ const allMyFriendNames = me.friends
10541054

10551055
### Support for createInstance()
10561056

1057-
Since Kotlin 2.0.0, you can use the [`createInstance()`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.reflect.full/create-instance.html)
1057+
Starting with Kotlin 2.0.0, you can use the [`createInstance()`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.reflect.full/create-instance.html)
10581058
function from the Kotlin/JS target. Previously, it was only available on the JVM.
10591059

10601060
This function from the [KClass](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.reflect/-k-class/) interface creates
@@ -1183,16 +1183,16 @@ Previously, the `webpack` and `distributeResources` compilation tasks both targe
11831183
the `distribution` task declared the `dist` as its output directory as well. This resulted in overlapping outputs and
11841184
produced a compilation warning.
11851185

1186-
So, starting with Kotlin 2.0.0, we implement the following changes:
1186+
So, starting with Kotlin 2.0.0, we've implemented the following changes:
11871187

11881188
* The `webpack` task now targets a separate folder.
1189-
* The `distributeResources` task is removed completely.
1189+
* The `distributeResources` task has been completely removed.
11901190
* The `distribution` task now has the `Copy` type and targets the `dist` folder.
11911191

11921192
### Discontinuing legacy Kotlin/JS JAR artifacts
11931193

11941194
Starting with Kotlin 2.0.0, the Kotlin distribution no longer contains legacy Kotlin/JS artifacts with the `.jar`
1195-
extension. Legacy artifacts were used in the unsupported old Kotlin/JS compiler and unnecessary for the IR compiler that
1195+
extension. Legacy artifacts were used in the unsupported old Kotlin/JS compiler and unnecessary for the IR compiler, which
11961196
uses the `klib` format.
11971197

11981198
## Gradle improvements
@@ -1213,7 +1213,7 @@ This version brings the following changes:
12131213
* [Kotlin/Native compiler downloaded when needed](#kotlin-native-compiler-downloaded-when-needed)
12141214
* [Deprecating old ways of defining compiler options](#deprecated-old-ways-of-defining-compiler-options)
12151215
* [Bumped minimum AGP supported version](#bumped-minimum-supported-agp-version)
1216-
* [New Gradle property to try latest language version](#new-gradle-property-to-try-latest-language-version)
1216+
* [New Gradle property for trying the latest language version](#new-gradle-property-for-trying-the-latest-language-version)
12171217
* [New JSON output format for build reports](#new-json-output-format-for-build-reports)
12181218
* [kapt configurations inherit annotation processors from superconfigurations](#kapt-configurations-inherit-annotation-processors-from-superconfigurations)
12191219
* [Kotlin Gradle plugin no longer uses deprecated Gradle conventions](#kotlin-gradle-plugin-no-longer-uses-deprecated-gradle-conventions)
@@ -1487,11 +1487,11 @@ the following Gradle property to your `gradle.properties` file:
14871487
kotlin.native.toolchain.enabled=false
14881488
```
14891489

1490-
Starting with the version 1.9.20-Beta, the Kotlin/Native distribution is published to [Maven Central](https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-native-prebuilt/)
1491-
along with CDN.
1490+
Starting with Kotlin 1.9.20-Beta, the Kotlin/Native distribution is published to [Maven Central](https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-native-prebuilt/)
1491+
along with the CDN.
14921492

1493-
This allowed us to change how Kotlin looks for and downloads the necessary artifacts. Instead of the CDN, it now uses by
1494-
default Maven repositories that you specified in the `repositories {}` block of your project.
1493+
This allowed us to change how Kotlin looks for and downloads the necessary artifacts. Instead of the CDN, by default,
1494+
it now uses the Maven repositories that you specified in the `repositories {}` block of your project.
14951495

14961496
You can temporarily switch this behavior back by setting the following Gradle property in your `gradle.properties` file:
14971497

@@ -1549,7 +1549,7 @@ For more information on how to specify compiler options in the Kotlin Gradle plu
15491549

15501550
Starting with Kotlin 2.0.0, the minimum supported Android Gradle plugin version is 7.1.3.
15511551

1552-
### New Gradle property to try latest language version
1552+
### New Gradle property for trying the latest language version
15531553

15541554
Prior to Kotlin 2.0.0, we had the following Gradle property to try out the new K2 compiler: `kotlin.experimental.tryK2`.
15551555
Now that the K2 compiler is enabled by default in Kotlin 2.0.0, we decided to evolve this property into a new form that
@@ -1656,11 +1656,11 @@ dependencies {
16561656
}
16571657
```
16581658

1659-
In this example, the `commonAnnotationProcessors` Gradle configuration is your "common" configuration for annotation
1659+
In this example, the `commonAnnotationProcessors` Gradle configuration is your common configuration for annotation
16601660
processing that you want to be used for all your projects. You use the [`extendsFrom()`](https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.Configuration.html#org.gradle.api.artifacts.Configuration:extendsFrom)
1661-
method to add "commonAnnotationProcessors" as a superconfiguration. kapt sees that the `commonAnnotationProcessors`
1662-
Gradle configuration has a dependency on the Dagger annotation processor and successfully includes it in its
1663-
configuration for annotation processing.
1661+
method to add "commonAnnotationProcessors" as a superconfiguration. kapt sees that the `commonAnnotationProcessors`
1662+
Gradle configuration has a dependency on the Dagger annotation processor. Therefore, kapt includes the Dagger annotation
1663+
processor in its configuration for annotation processing.
16641664

16651665
Thanks to Christoph Loy for the [implementation](https://github.com/JetBrains/kotlin/pull/5198)!
16661666

@@ -1690,7 +1690,7 @@ and also stabilized to replace the synthetic `values()` function. For more infor
16901690
see [What's new in Kotlin 1.8.20](whatsnew1820.md#a-modern-and-performant-replacement-of-the-enum-class-values-function).
16911691

16921692
> The `enumValues<T>()` function is still supported, but we recommend that you use the `enumEntries<T>()` function
1693-
> instead because it has less performance impact. Every time you call `enumValues<T>()`, a new array is created, whereas
1693+
> instead because it has less of a performance impact. Every time you call `enumValues<T>()`, a new array is created, whereas
16941694
> whenever you call `enumEntries<T>()`, the same list is returned each time, which is far more efficient.
16951695
>
16961696
{type="tip"}

0 commit comments

Comments
 (0)