Skip to content

Commit 024c38a

Browse files
authored
minor fix for typo, indent, link, and sample code, etc (#4993)
* minor fix for typo, indent, link, and sample code, etc * fix for review comment * fix for review comment
1 parent 60cbb1b commit 024c38a

17 files changed

+135
-141
lines changed

docs/topics/annotations.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Additional attributes of the annotation can be specified by annotating the annot
2121

2222
```kotlin
2323
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION,
24-
AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.VALUE_PARAMETER,
24+
AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.VALUE_PARAMETER,
2525
AnnotationTarget.EXPRESSION)
2626
@Retention(AnnotationRetention.SOURCE)
2727
@MustBeDocumented
@@ -105,7 +105,7 @@ annotation class Ann(val arg1: KClass<*>, val arg2: KClass<out Any>)
105105
## Instantiation
106106

107107
In Java, an annotation type is a form of an interface, so you can implement it and use an instance.
108-
As an alternative to this mechanism, Kotlin lets you call a constructor of an annotation class in arbitrary code
108+
As an alternative to this mechanism, Kotlin lets you call a constructor of an annotation class in arbitrary code
109109
and similarly use the resulting instance.
110110

111111
```kotlin
@@ -181,7 +181,7 @@ The full list of supported use-site targets is:
181181
```kotlin
182182
fun @receiver:Fancy String.myExtension() { ... }
183183
```
184-
184+
185185
* `param` (constructor parameter)
186186
* `setparam` (property setter parameter)
187187
* `delegate` (the field storing the delegate instance for a delegated property)
@@ -399,7 +399,7 @@ public @interface AnnWithArrayValue {
399399
@AnnWithArrayValue("abc", "foo", "bar") class C
400400
```
401401

402-
For other arguments that have an array type, you need to use the array literal syntax or
402+
For other arguments that have an array type, you need to use the array literal syntax or
403403
`arrayOf(...)`:
404404

405405
``` java
@@ -410,7 +410,7 @@ public @interface AnnWithArrayMethod {
410410
```
411411

412412
```kotlin
413-
@AnnWithArrayMethod(names = ["abc", "foo", "bar"])
413+
@AnnWithArrayMethod(names = ["abc", "foo", "bar"])
414414
class C
415415
```
416416

@@ -474,4 +474,4 @@ annotation class Tags(val value: Array<Tag>)
474474
To extract Kotlin or Java repeatable annotations via reflection, use the [`KAnnotatedElement.findAnnotations()`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.reflect.full/find-annotations.html)
475475
function.
476476

477-
Learn more about Kotlin repeatable annotations in [this KEEP](https://github.com/Kotlin/KEEP/blob/master/proposals/repeatable-annotations.md).
477+
Learn more about Kotlin repeatable annotations in [this KEEP](https://github.com/Kotlin/KEEP/blob/master/proposals/repeatable-annotations.md).

docs/topics/build-tools-api.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,20 @@ import org.jetbrains.kotlin.buildtools.api.ExperimentalBuildToolsApi
4949
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
5050

5151
plugins {
52-
kotlin("jvm") version "2.2.0"
52+
kotlin("jvm") version "2.2.0"
5353
}
5454

5555
group = "org.jetbrains.example"
5656
version = "1.0-SNAPSHOT"
5757

5858
repositories {
59-
mavenCentral()
59+
mavenCentral()
6060
}
6161

6262
kotlin {
63-
jvmToolchain(8)
64-
@OptIn(ExperimentalBuildToolsApi::class, ExperimentalKotlinGradlePluginApi::class)
65-
compilerVersion.set("2.1.21") // <-- different version than 2.2.0
63+
jvmToolchain(8)
64+
@OptIn(ExperimentalBuildToolsApi::class, ExperimentalKotlinGradlePluginApi::class)
65+
compilerVersion.set("2.1.21") // <-- different version than 2.2.0
6666
}
6767
```
6868

@@ -105,4 +105,4 @@ From Kotlin 2.2.0, the BTA is enabled by default in the [`kotlin-maven-plugin`](
105105
Although the BTA doesn't give direct benefits for Maven users yet, it provides a solid foundation for developing features like:
106106

107107
* [Kotlin daemon support](https://youtrack.jetbrains.com/issue/KT-77587)
108-
* [Incremental compilation stabilization](https://youtrack.jetbrains.com/issue/KT-77086)
108+
* [Incremental compilation stabilization](https://youtrack.jetbrains.com/issue/KT-77086)

docs/topics/coding-conventions.md

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,9 @@ in method names are also allowed in test code.
172172

173173
```kotlin
174174
class MyTestCase {
175-
@Test fun `ensure everything works`() { /*...*/ }
176-
177-
@Test fun ensureEverythingWorks_onAndroid() { /*...*/ }
175+
@Test fun `ensure everything works`() { /*...*/ }
176+
177+
@Test fun ensureEverythingWorks_onAndroid() { /*...*/ }
178178
}
179179
```
180180

@@ -214,7 +214,7 @@ class C {
214214
private val _elementList = mutableListOf<Element>()
215215

216216
val elementList: List<Element>
217-
get() = _elementList
217+
get() = _elementList
218218
}
219219
```
220220

@@ -302,9 +302,9 @@ abstract class Foo<out T : Any> : IFoo {
302302

303303
class FooImpl : Foo() {
304304
constructor(x: String) : this(x) { /*...*/ }
305-
305+
306306
val x = object : IFoo { /*...*/ }
307-
}
307+
}
308308
```
309309

310310
### Class headers
@@ -606,10 +606,10 @@ If the parameter list is too long to fit on a line, put the arrow on a separate
606606

607607
```kotlin
608608
foo {
609-
context: Context,
610-
environment: Env
611-
->
612-
context.configureEnv(environment)
609+
context: Context,
610+
environment: Env
611+
->
612+
context.configureEnv(environment)
613613
}
614614
```
615615

@@ -876,15 +876,15 @@ to treat the dollar sign chars `$` as string literals:
876876

877877
```kotlin
878878
val KClass<*>.jsonSchema : String
879-
get() = $$"""
880-
{
881-
"$schema": "https://json-schema.org/draft/2020-12/schema",
882-
"$id": "https://example.com/product.schema.json",
883-
"$dynamicAnchor": "meta",
884-
"title": "$${simpleName ?: qualifiedName ?: "unknown"}",
885-
"type": "object"
886-
}
887-
"""
879+
get() = $$"""
880+
{
881+
"$schema": "https://json-schema.org/draft/2020-12/schema",
882+
"$id": "https://example.com/product.schema.json",
883+
"$dynamicAnchor": "meta",
884+
"title": "$${simpleName ?: qualifiedName ?: "unknown"}",
885+
"type": "object"
886+
}
887+
"""
888888
```
889889

890890
## Idiomatic use of language features
@@ -986,7 +986,7 @@ else
986986
when(x) {
987987
0 -> return "zero"
988988
else -> return "nonzero"
989-
}
989+
}
990990
```
991991

992992
### if versus when
@@ -1060,25 +1060,25 @@ indentation, or `trimMargin` when internal indentation is required:
10601060
```kotlin
10611061
fun main() {
10621062
//sampleStart
1063-
println("""
1064-
Not
1065-
trimmed
1066-
text
1067-
"""
1068-
)
1069-
1070-
println("""
1071-
Trimmed
1072-
text
1073-
""".trimIndent()
1074-
)
1075-
1076-
println()
1077-
1078-
val a = """Trimmed to margin text:
1079-
|if(a > 1) {
1080-
| return a
1081-
|}""".trimMargin()
1063+
println("""
1064+
Not
1065+
trimmed
1066+
text
1067+
"""
1068+
)
1069+
1070+
println("""
1071+
Trimmed
1072+
text
1073+
""".trimIndent()
1074+
)
1075+
1076+
println()
1077+
1078+
val a = """Trimmed to margin text:
1079+
|if(a > 1) {
1080+
| return a
1081+
|}""".trimMargin()
10821082

10831083
println(a)
10841084
//sampleEnd

docs/topics/compatibility-guides/compatibility-guide-22.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,9 +565,9 @@ perspective (for example, from Java) is out of the scope of this document.
565565
>
566566
> **Short summary**: The experimental `kotlinArtifacts` API is deprecated. Use the current DSL available in the Kotlin Gradle
567567
> plugin to [build final native binaries](https://www.jetbrains.com/help/kotlin-multiplatform-dev/multiplatform-build-native-binaries.html).
568-
> If it's not sufficient for migration, leave a comment in [this YT issue](https://youtrack.jetbrains.com/issue/KT-74953).
568+
> If it's not sufficient for migration, leave a comment in [this YouTrack issue](https://youtrack.jetbrains.com/issue/KT-74953).
569569
>
570570
> **Deprecation cycle**:
571571
>
572572
> - 2.2.0: report a warning when the `kotlinArtifacts` API is used
573-
> - 2.3.0: raise this warning to an error
573+
> - 2.3.0: raise this warning to an error

docs/topics/coroutines-overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ The `suspend` keyword marks functions that can perform long-running operations a
3333

3434
To launch new coroutines, use coroutine builders like [`.launch()`](https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/launch.html) and [`.async()`](https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/async.html).
3535
These builders are extension functions on [`CoroutineScope`](https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/),
36-
which defines the coroutines lifecycle and provides the coroutine context.
36+
which defines the coroutine's lifecycle and provides the coroutine context.
3737

3838
You can learn more about these builders in [Coroutine basics](coroutines-basics.md) and [Composing suspend functions](coroutines-and-channels.md).
3939

docs/topics/data-analysis/data-analysis-work-with-api.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,27 +64,25 @@ This ensures you gather data across multiple pages:
6464

6565
```kotlin
6666
fun load(path: String, maxPages: Int): AnyFrame {
67-
6867
// Initializes a mutable list to store rows of data.
6968
val rows = mutableListOf<AnyRow>()
70-
69+
7170
// Sets the initial page path for data loading.
7271
var pagePath = path
7372
do {
74-
7573
// Loads data from the current page path.
7674
val row = load(pagePath)
7775
// Adds the loaded data as a row to the list.
7876
rows.add(row)
79-
77+
8078
// Retrieves the token for the next page, if available.
8179
val next = row.getValueOrNull<String>("nextPageToken")
8280
// Updates the page path for the next iteration, including the new token.
8381
pagePath = path + "&pageToken=" + next
84-
82+
8583
// Continues loading pages until there's no next page.
8684
} while (next != null && rows.size < maxPages)
87-
85+
8886
// Concatenates and returns all loaded rows as a DataFrame.
8987
return rows.concat()
9088
}

docs/topics/gradle/gradle-binary-compatibility-validation.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ kotlin {
3636
</tab>
3737
<tab title="Groovy" group-key="groovy">
3838

39-
```kotlin
39+
```groovy
4040
kotlin {
4141
abiValidation {
4242
enabled = true
@@ -56,7 +56,7 @@ If your project has multiple modules where you want to check for binary compatib
5656
To check for potentially binary incompatible issues after making changes to your code, run the `checkLegacyAbi` Gradle task
5757
in IntelliJ IDEA or use the following command in your project directory:
5858

59-
```kotlin
59+
```bash
6060
./gradlew checkLegacyAbi
6161
```
6262

@@ -68,7 +68,7 @@ make changes to your code to preserve binary compatibility.
6868
To update the reference ABI dump that Gradle uses to check your latest changes, run the `updateLegacyAbi` task in IntelliJ
6969
IDEA or use the following command in your project directory:
7070

71-
```kotlin
71+
```bash
7272
./gradlew updateLegacyAbi
7373
```
7474

@@ -121,7 +121,7 @@ kotlin {
121121
</tab>
122122
<tab title="Groovy" group-key="groovy">
123123

124-
```kotlin
124+
```groovy
125125
kotlin {
126126
abiValidation {
127127
filters {
@@ -177,7 +177,7 @@ kotlin {
177177
</tab>
178178
<tab title="Groovy" group-key="groovy">
179179

180-
```kotlin
180+
```groovy
181181
kotlin {
182182
abiValidation {
183183
klib {
@@ -191,4 +191,4 @@ kotlin {
191191
</tabs>
192192

193193
If a target is unsupported and inference is disabled, the `checkLegacyAbi` task fails because it can't generate a complete
194-
ABI dump. This behavior may be useful if you'd prefer the task to fail rather than risk missing a binary-incompatible change.
194+
ABI dump. This behavior may be useful if you'd prefer the task to fail rather than risk missing a binary-incompatible change.

docs/topics/gradle/gradle-compiler-options.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ configuration of compiler options. It is available for [Kotlin Multiplatform](ht
2121
With the Gradle DSL, you can configure compiler options within the build script at three levels:
2222
* **[Extension level](#extension-level)**, in the `kotlin {}` block for all targets and shared source sets.
2323
* **[Target level](#target-level)**, in the block for a specific target.
24-
* **[Compilation unit level](#compilation-unit-level),** usually in a specific compilation task.
24+
* **[Compilation unit level](#compilation-unit-level)**, usually in a specific compilation task.
2525

2626
![Kotlin compiler options levels](compiler-options-levels.svg){width=700}
2727

@@ -57,7 +57,7 @@ kotlin {
5757
compilerOptions {
5858
optIn.add("kotlin.RequiresOptIn")
5959
}
60-
}
60+
}
6161
```
6262

6363
### Target level
@@ -67,7 +67,7 @@ in the `compilerOptions {}` block inside the `target {}` block:
6767

6868
```kotlin
6969
kotlin {
70-
target {
70+
target {
7171
compilerOptions {
7272
optIn.add("kotlin.RequiresOptIn")
7373
}
@@ -83,7 +83,7 @@ specific target. For example, `jvm { compilerOptions {}}`. For more information,
8383
You can configure compiler options for a specific compilation unit or task in a `compilerOptions {}`
8484
block inside the task configuration:
8585

86-
```Kotlin
86+
```kotlin
8787
tasks.named<KotlinJvmCompile>("compileKotlin"){
8888
compilerOptions {
8989
optIn.add("kotlin.RequiresOptIn")
@@ -93,7 +93,7 @@ tasks.named<KotlinJvmCompile>("compileKotlin"){
9393

9494
You can also access and configure compiler options at a compilation unit level via `KotlinCompilation`:
9595

96-
```Kotlin
96+
```kotlin
9797
kotlin {
9898
target {
9999
val main by compilations.getting {
@@ -293,8 +293,8 @@ Update it to:
293293

294294
```kotlin
295295
plugins {
296-
id("com.android.application")
297-
kotlin("android")
296+
id("com.android.application")
297+
kotlin("android")
298298
}
299299

300300
kotlin {

docs/topics/js/js-project-setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ You can enable all the supported ES2015 features at once by adding the `es2015`
100100

101101
```kotlin
102102
tasks.withType<KotlinJsCompile>().configureEach {
103-
kotlinOptions {
103+
compilerOptions {
104104
target = "es2015"
105105
}
106106
}

docs/topics/jvm/java-to-kotlin-interop.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ The Kotlin visibility modifiers map to Java in the following way:
363363
if accessed from within a class.
364364
* `protected` remains `protected`. (Note that Java allows accessing protected members from other classes in the same package
365365
and Kotlin doesn't, so Java classes will have broader access to the code.)
366-
* `internal` declarations become `public` in Java. Members of `internal` classes go through name mangling, to make.
366+
* `internal` declarations become `public` in Java. Members of `internal` classes go through name mangling, to make
367367
it harder to accidentally use them from Java and to allow overloading for members with the same signature that don't see
368368
each other according to Kotlin rules.
369369
* `public` remains `public`.

0 commit comments

Comments
 (0)