Skip to content

Commit 84485dd

Browse files
committed
Documentation fixes
1 parent a3c2a90 commit 84485dd

File tree

9 files changed

+24
-22
lines changed

9 files changed

+24
-22
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ GlobalScope.launch {
3131
* [core](core/README.md) — Kotlin/JVM implementation of common coroutines with additional features:
3232
* `Dispatchers.IO` dispatcher for blocking coroutines;
3333
* `Executor.asCoroutineDispatcher()` extension, custom thread pools, and more.
34-
* [core-test](core/README.md) — test utilities for coroutines, currently with one feature:
34+
* [test](core/README.md) — test utilities for coroutines, currently with one feature:
3535
* `MainDispatcherInjector.inject()` to override `Dispatchers.Main` in tests.
3636
* [js](js/README.md) — Kotlin/JS implementation of common coroutines with `Promise` support.
3737
* [native](native/README.md) — Kotlin/Native implementation of common coroutines with `runBlocking` single-threaded event loop.

RELEASE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ To release new `<version>` of `kotlinx-coroutines`:
1212
`git merge origin/master`
1313

1414
4. Search & replace `<old-version>` with `<version>` across the project files. Should replace in:
15-
* [`README.md`](README.md) (native, core, core-test modules)
15+
* [`README.md`](README.md) (native, core, test modules)
1616
* [`coroutines-guide.md`](docs/coroutines-guide.md)
1717
* [`gradle.properties`](gradle.properties)
1818
* [`ui/kotlinx-coroutines-android/example-app/gradle.properties`](ui/kotlinx-coroutines-android/example-app/gradle.properties)

common/kotlinx-coroutines-core-common/src/internal/MainDispatcherFactory.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ public interface MainDispatcherFactory {
1212
val loadPriority: Int // higher priority wins
1313

1414
/**
15-
* Creates main dispatcher. [allFactories] parameter contains all factories found by service loader.
15+
* Creates the main dispatcher. [allFactories] parameter contains all factories found by service loader.
1616
* This method is not guaranteed to be idempotent.
1717
*/
1818
fun createDispatcher(allFactories: List<MainDispatcherFactory>): MainCoroutineDispatcher
1919

2020
/**
21-
* Hint used along with error message when factory failed to create a dispatcher.
21+
* Hint used along with error message when the factory failed to create a dispatcher.
2222
*/
2323
fun hintOnError(): String? = null
2424
}

core/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ Module name below corresponds to the artifact name in Maven/Gradle.
66
## Modules
77

88
* [kotlinx-coroutines-core](kotlinx-coroutines-core/README.md) &mdash; core coroutine builders and synchronization primitives.
9-
* [kotlinx-coroutines-core-test](kotlinx-coroutines-core-test/README.md) &mdash; coroutines test utilities such as Main dispatcher injection.
9+
* [kotlinx-coroutines-test](kotlinx-coroutines-test/README.md) &mdash; coroutines test utilities such as Main dispatcher injection.
1010

core/kotlinx-coroutines-test/README.md

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Module kotlinx-coroutines-test
22

3-
Test utilities for `kotlinx.coroutines`. Provides `Dispatchers.setMain` to override `Main` dispatcher.
3+
Test utilities for `kotlinx.coroutines`. Provides `Dispatchers.setMain` to override the `Main` dispatcher.
44

55
## Using in your project
66

@@ -13,10 +13,10 @@ dependencies {
1313

1414
**Do not** depend on this project in your main sources, all utilities are intended and designed to be used only from tests.
1515

16-
Once you have it in runtime, [`ServiceLoader`](https://docs.oracle.com/javase/8/docs/api/java/util/ServiceLoader.html) mechanism will
17-
overwrite [Dispatchers.Main] with testable implementation.
16+
Once you have this dependency in the runtime, [`ServiceLoader`](https://docs.oracle.com/javase/8/docs/api/java/util/ServiceLoader.html) mechanism will
17+
overwrite [Dispatchers.Main] with a testable implementation.
1818

19-
You can override this implementation using [setMain][Dispatchers.setMain] method with any [CoroutineDispatcher] implementation, e.g.:
19+
You can override the `Main` implementation using [setMain][setMain] method with any [CoroutineDispatcher] implementation, e.g.:
2020

2121
```kotlin
2222

@@ -31,13 +31,13 @@ class SomeTest {
3131

3232
@After
3333
fun tearDown() {
34-
Dispatchers.resetMain() // reset main dispatcher to original Main dispatcher
34+
Dispatchers.resetMain() // reset main dispatcher to the original Main dispatcher
3535
mainThreadSurrogate.close()
3636
}
3737

3838
@Test
3939
fun testSomeUI() = runBlocking {
40-
launch(Dispatchers.Main) { // Will be launched in mainThreadSurrogate dispatcher
40+
launch(Dispatchers.Main) { // Will be launched in the mainThreadSurrogate dispatcher
4141
...
4242
}
4343
}
@@ -48,4 +48,7 @@ class SomeTest {
4848
<!--- INDEX kotlinx.coroutines -->
4949
[Dispatchers.Main]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-dispatchers/-main.html
5050
[CoroutineDispatcher]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html
51+
<!--- MODULE kotlinx-coroutines-test -->
52+
<!--- INDEX kotlinx.coroutines.test -->
53+
[setMain]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-test/kotlinx.coroutines.test/kotlinx.coroutines.-dispatchers/set-main.html
5154
<!--- END -->

core/kotlinx-coroutines-test/resources/META-INF/proguard/coroutines.pro

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# ServiceLoader support
2-
-keepnames class kotlinx.coroutines.test.internal.InjectableDispatcherFactory {}
2+
-keepnames class kotlinx.coroutines.test.internal.TestMainDispatcherFactory {}
33

44
# Most of volatile fields are updated with AFU and should not be mangled
55
-keepclassmembernames class kotlinx.** {

core/kotlinx-coroutines-test/src/TestDispatchers.kt

+4-5
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ import kotlinx.coroutines.*
1010
import kotlinx.coroutines.test.internal.*
1111

1212
/**
13-
* Sets given dispatcher as an underlying dispatcher of [Dispatchers.Main].
14-
* All consecutive usages of [Dispatchers.Main] will use given [dispatcher] under the hood, though it's not guaranteed
15-
* that [Dispatchers.Main] will be equal to given [dispatcher].
13+
* Sets the given [dispatcher] as an underlying dispatcher of [Dispatchers.Main].
14+
* All consecutive usages of [Dispatchers.Main] will use given [dispatcher] under the hood.
1615
*
1716
* It is unsafe to call this method if alive coroutines launched in [Dispatchers.Main] exist.
1817
*/
@@ -24,9 +23,9 @@ public fun Dispatchers.setMain(dispatcher: CoroutineDispatcher = Dispatchers.Unc
2423
}
2524

2625
/**
27-
* Resets state of [Dispatchers.Main] to the original main dispatcher.
26+
* Resets state of the [Dispatchers.Main] to the original main dispatcher.
2827
* For example, in Android Main thread dispatcher will be set as [Dispatchers.Main].
29-
* Used to cleanup all possible dependencies, should be used in tear down (`@After`) methods.
28+
* Used to clean up all possible dependencies, should be used in tear down (`@After`) methods.
3029
*
3130
* It is unsafe to call this method if alive coroutines launched in [Dispatchers.Main] exist.
3231
*/

core/kotlinx-coroutines-test/src/internal/MainTestDispatcher.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import kotlinx.coroutines.internal.*
99
import kotlin.coroutines.*
1010

1111
/**
12-
* Testable main dispatcher used by kotlinx-coroutines-test.
12+
* The testable main dispatcher used by kotlinx-coroutines-test.
1313
* It is a [MainCoroutineDispatcher] which delegates all actions to a settable delegate.
1414
*/
1515
internal class TestMainDispatcher(private val mainFactory: MainDispatcherFactory) : MainCoroutineDispatcher(), Delay {
@@ -80,8 +80,8 @@ internal class TestMainDispatcherFactory : MainDispatcherFactory {
8080
}
8181

8282
/**
83-
* [Int.MAX_VALUE] -- test dispatcher always wins no matter what factories are present in classpath.
84-
* By default all actions are delegated to the second-priority dispatcher, so it won't be the issue.
83+
* [Int.MAX_VALUE] -- test dispatcher always wins no matter what factories are present in the classpath.
84+
* By default all actions are delegated to the second-priority dispatcher, so that it won't be the issue.
8585
*/
8686
override val loadPriority: Int
8787
get() = Int.MAX_VALUE

knit/resources/knit.properties

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
site.root=https://kotlin.github.io/kotlinx.coroutines
66

7-
module.roots=common js core core-test integration native reactive ui
7+
module.roots=common js core test integration native reactive ui
88
module.marker=build.gradle
9-
module.docs=build/dokka
9+
module.docs=build/dokka

0 commit comments

Comments
 (0)