Skip to content

Commit

Permalink
Merge branch 'master' into 1-9-20-beta-eap-details
Browse files Browse the repository at this point in the history
  • Loading branch information
koshachy authored Sep 11, 2023
2 parents cdb1151 + 7096015 commit 80ab46d
Show file tree
Hide file tree
Showing 16 changed files with 71 additions and 23 deletions.
2 changes: 1 addition & 1 deletion docs/topics/generics.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ In other words, the wildcard with an _extends_\-bound (_upper_ bound) makes the
The key to understanding why this works is rather simple: if you can only _take_ items from a collection,
then using a collection of `String`s and reading `Object`s from it is fine. Conversely, if you can only _put_ items
into the collection, it's okay to take a collection of `Object`s and put `String`s into it: in Java there is
`List<? super String>`, a _supertype_ of `List<Object>`.
`List<? super String>`, which accepts `String`s or any of its supertypes.

The latter is called _contravariance_, and you can only call methods that take `String` as an argument on `List<? super String>`
(for example, you can call `add(String)` or `set(int, String)`). If you call something that returns `T` in `List<T>`,
Expand Down
2 changes: 1 addition & 1 deletion docs/topics/gradle/gradle-compiler-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ Here is a complete list of options for Gradle tasks:
| Name | Description | Possible values | Default value |
|---------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------|-----------------------------|
| `javaParameters` | Generate metadata for Java 1.8 reflection on method parameters | | false |
| `jvmTarget` | Target version of the generated JVM bytecode | "1.8", "9", "10", ..., "19". Also, see [Types for compiler options](#types-for-compiler-options) | "%defaultJvmTargetVersion%" |
| `jvmTarget` | Target version of the generated JVM bytecode | "1.8", "9", "10", ..., "20". Also, see [Types for compiler options](#types-for-compiler-options) | "%defaultJvmTargetVersion%" |
| `noJdk` | Don't automatically include the Java runtime into the classpath | | false |
| `jvmTargetValidationMode` | <list><li>Validation of the [JVM target compatibility](gradle-configure-project.md#check-for-jvm-target-compatibility-of-related-compile-tasks) between Kotlin and Java</li><li>A property for tasks of the `KotlinCompile` type.</li></list> | `WARNING`, `ERROR`, `INFO` | `ERROR` |

Expand Down
2 changes: 1 addition & 1 deletion docs/topics/gradle/gradle.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Gradle is a build system that helps to automate and manage your building process. It downloads required dependencies,
packages your code, and prepares it for compilation. Learn about Gradle basics and specifics
on the [Gradle website](https://docs.gradle.org/current/userguide/getting_started.html).
on the [Gradle website](https://docs.gradle.org/current/userguide/userguide.html).

You can set up your own project with [these instructions](gradle-configure-project.md) for different platforms
or pass a small [step-by-step tutorial](get-started-with-jvm-gradle-project.md) that will show you how to create a simple backend
Expand Down
2 changes: 1 addition & 1 deletion docs/topics/js/js-ir-compiler.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ kotlin {
* `LEGACY` uses the old compiler backend.
* `BOTH` compiles your project with the new IR compiler as well as the default compiler backend. Use this mode for [authoring libraries compatible with both backends](#authoring-libraries-for-the-ir-compiler-with-backwards-compatibility).

> The old compiler backend has been deprecated since Kotlin 1.8.0. Starting with Kotlin 1.9.0, using compiler types `LEGACY` of `BOTH` leads to an error.
> The old compiler backend has been deprecated since Kotlin 1.8.0. Starting with Kotlin 1.9.0, using compiler types `LEGACY` or `BOTH` leads to an error.
>
{type="warning"}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ This is a curated list of cross-platform mobile projects created with Kotlin Mul
</td>
</tr>
<tr>
<td><strong><a href="https://github.com/JetBrains/compose-jb/tree/master/examples/todoapp">todoapp</a></strong></td>
<td><strong><a href="https://github.com/IlyaGulya/TodoAppDecomposeMviKotlin">TodoAppDecomposeMviKotlin</a></strong></td>
<td>Models, Networking, Presentation, Navigation and UI </td>
<td>SQLDelight, Decompose, MVIKotlin, Reaktive</td>
<td>Jetpack Compose, SwiftUI</td>
Expand Down Expand Up @@ -177,7 +177,7 @@ This is a curated list of cross-platform mobile projects created with Kotlin Mul
<td>-</td>
<td>
<list>
<li> Uses <a href="https://realm.io/">Realm</a> for data persistence </li>
<li> Uses <a href="https://www.mongodb.com/docs/realm/sdk/kotlin/">Realm</a> for data persistence </li>
</list>
</td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ Read [Multiplatform documentation on adding dependencies](multiplatform-add-depe
Along with `*Main` source sets, there are three matching test source sets:

* `commonTest`
* `androidTest`
* `androidUnitTest`
* `iosTest`

Use them to store unit tests for common and platform-specific source sets accordingly.
Expand All @@ -178,7 +178,7 @@ kotlin {
implementation(kotlin("test"))
}
}
val androidTest by getting
val androidUnitTest by getting
val iosTest by getting
}

Expand All @@ -198,7 +198,7 @@ kotlin {
implementation kotlin('test')
}
}
androidTest {
androidUnitTest {
}
iosTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ just share it in the common source set.

Some dependencies for source sets are set by default. You don't need to specify any `dependsOn` relations manually:
* For all platform-specific source sets that depend on the common source set, such as `jvmMain`, `macosX64Main`, and others.
* Between the `main` and `test` source sets of a particular target, such as `androidMain` and `androidTest`.
* Between the `main` and `test` source sets of a particular target, such as `androidMain` and `androidUnitTest`.

If you need to access platform-specific APIs from the shared code, use the Kotlin mechanism of [expected and actual
declarations](multiplatform-connect-to-apis.md).
Expand Down
4 changes: 3 additions & 1 deletion docs/topics/native/native-immutability.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"}

Kotlin/Native implements strict mutability checks, ensuring
the important invariant that the object is either immutable or
Expand Down
2 changes: 1 addition & 1 deletion docs/topics/native/native-ios-integration.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[//]: # (title: iOS integration)

> This page describes the new memory manager enabled by default since Kotlin 1.7.20. See our [migration guide](native-migration-guide.md)
> to move your projects from the legacy memory manager.
> to move your projects from the legacy memory manager that will be removed in Kotlin 1.9.20.
>
{type="note"}

Expand Down
4 changes: 2 additions & 2 deletions docs/topics/native/native-memory-manager.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[//]: # (title: Kotlin/Native memory management)

> This page describes features of the new memory manager enabled by default since Kotlin 1.7.20.
> See our [migration guide](native-migration-guide.md) to move your projects from the legacy memory manager.
> This page describes features of the new memory manager enabled by default since Kotlin 1.7.20. See our [migration guide](native-migration-guide.md)
> to move your projects from the legacy memory that will be removed in Kotlin 1.9.20.
>
{type="note"}

Expand Down
46 changes: 43 additions & 3 deletions docs/topics/no-arg-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,46 @@

The *no-arg* compiler plugin generates an additional zero-argument constructor for classes with a specific annotation.

The generated constructor is synthetic so it can't be directly called from Java or Kotlin, but it can be called using reflection.
The generated constructor is synthetic, so it can't be directly called from Java or Kotlin, but it can be called using reflection.

This allows the Java Persistence API (JPA) to instantiate a class although it doesn't have the zero-parameter constructor
from Kotlin or Java point of view (see the description of `kotlin-jpa` plugin [below](#jpa-support)).

## In your Kotlin file

Add new annotations to mark the code that needs a zero-argument constructor:

```kotlin
package com.my

annotation class Annotation
```

## Gradle

Add the plugin using Gradle's plugins DSL:

<tabs group="build-script">
<tab title="Kotlin" group-key="kotlin">

```kotlin
plugins {
kotlin("plugin.noarg") version "%kotlinVersion%"
}
```

</tab>
<tab title="Groovy" group-key="groovy">

```groovy
plugins {
id "org.jetbrains.kotlin.plugin.noarg" version "%kotlinVersion%"
id "org.jetbrains.kotlin.plugin.noarg" version "%kotlinVersion%"
}
```

</tab>
</tabs>

Then specify the list of no-arg annotations that must lead to generating a no-arg constructor for the annotated classes:

```groovy
Expand Down Expand Up @@ -74,12 +99,27 @@ and [`@MappedSuperclass`](https://docs.oracle.com/javaee/7/api/javax/persistence

Add the plugin using the Gradle plugins DSL:

<tabs group="build-script">
<tab title="Kotlin" group-key="kotlin">

```kotlin
plugins {
kotlin("plugin.jpa") version "%kotlinVersion%"
}
```

</tab>
<tab title="Groovy" group-key="groovy">

```groovy
plugins {
id "org.jetbrains.kotlin.plugin.jpa" version "%kotlinVersion%"
id "org.jetbrains.kotlin.plugin.jpa" version "%kotlinVersion%"
}
```

</tab>
</tabs>

In Maven, enable the `jpa` plugin:

```xml
Expand Down
4 changes: 2 additions & 2 deletions docs/topics/numbers.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ For integer numbers, there are four types with different sizes and, hence, value
| `Long` | 64 |-9,223,372,036,854,775,808 (-2<sup>63</sup>)|9,223,372,036,854,775,807 (2<sup>63</sup> - 1)|

When you initialize a variable with no explicit type specification, the compiler automatically infers the type with the
smallest range enough to represent the value. If it is not exceeding the range of `Int`, the type is `Int`. If it exceeds,
the type is `Long`. To specify the `Long` value explicitly, append the suffix `L` to the value.
smallest range enough to represent the value starting from `Int`. If it is not exceeding the range of `Int`, the type is `Int`.
If it exceeds, the type is `Long`. To specify the `Long` value explicitly, append the suffix `L` to the value.
Explicit type specification triggers the compiler to check the value not to exceed the range of the specified type.

```kotlin
Expand Down
2 changes: 1 addition & 1 deletion docs/topics/run-code-snippets.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 80ab46d

Please sign in to comment.