Skip to content

Conversation

dziemborowicz
Copy link
Contributor

Most CoroutineScopes contain a Job, and should contain a Job to work with structured concurrency. However, some CoroutineScopes do not have a Job (GlobalScope is an example).

This change adds support for CoroutineScopes with no Job to Turbine's testIn function, which previously would throw IllegalStateException if called with such a CoroutineScope.

A CoroutineScope with no Job never completes, so a call to invokeOnCompletion is not needed in that case.


  • CHANGELOG.md's "Unreleased" section has been updated, if applicable.

Most `CoroutineScope`s contain a `Job`, and should contain a `Job` to work with structured concurrency. However, some `CoroutineScope`s do not have a `Job` (`GlobalScope` is an example).

This change adds support for `CoroutineScope`s with no `Job` to Turbine's `testIn` function, which previously would throw `IllegalStateException` if called with such a `CoroutineScope`.

A `CoroutineScope` with no `Job` never completes, so a call to `invokeOnCompletion` is not needed in that case.
@JakeWharton JakeWharton merged commit 84c7608 into cashapp:trunk May 15, 2025
1 check passed
@JakeWharton
Copy link
Collaborator

Thanks! A bit weird, but I don't see a reason we need to take a stand on this.

@dziemborowicz
Copy link
Contributor Author

Thanks for the quick merge. :)

@JakeWharton
Copy link
Collaborator

This is now released in 1.2.1, FYI

@dziemborowicz
Copy link
Contributor Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants