Skip to content

Commit 27a100e

Browse files
committed
~: style fixes
1 parent 25a886e commit 27a100e

File tree

4 files changed

+4
-7
lines changed

4 files changed

+4
-7
lines changed

core/kotlinx-coroutines-core/src/internal/Exceptions.kt

-3
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ internal actual fun <E : Throwable> unwrap(exception: E): E {
8686
private fun <E : Throwable> recoveryDisabled(exception: E) =
8787
!RECOVER_STACKTRACE || !DEBUG || exception is CancellationException || exception is NonRecoverableThrowable
8888

89-
90-
9189
private fun createStackTrace(continuation: CoroutineStackFrame): ArrayList<StackTraceElement> {
9290
val stack = ArrayList<StackTraceElement>()
9391
continuation.getStackTraceElement()?.let { stack.add(sanitize(it)) }
@@ -104,7 +102,6 @@ internal fun sanitize(element: StackTraceElement): StackTraceElement {
104102
if (!element.className.contains('/')) {
105103
return element
106104
}
107-
108105
// STE generated with debug metadata contains '/' as separators in FQN, while Java contains dots
109106
return StackTraceElement(element.className.replace('/', '.'), element.methodName, element.fileName, element.lineNumber)
110107
}

core/kotlinx-coroutines-core/src/internal/ExceptionsConstuctor.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import java.util.concurrent.locks.*
99
import kotlin.concurrent.*
1010

1111
private val cacheLock = ReentrantReadWriteLock()
12-
private val exceptionConstructors: WeakHashMap<Class<*>, (Throwable) -> Throwable?> = WeakHashMap()
12+
// Replace it with ClassValue when Java 6 support is over
13+
private val exceptionConstructors: WeakHashMap<Class<out Throwable>, (Throwable) -> Throwable?> = WeakHashMap()
1314

1415
@Suppress("UNCHECKED_CAST")
1516
internal fun <E : Throwable> tryCopyException(exception: E): E? {
@@ -24,7 +25,6 @@ internal fun <E : Throwable> tryCopyException(exception: E): E? {
2425
* Exceptions are shared among coroutines, so we should copy exception before recovering current stacktrace.
2526
*/
2627
var ctor: ((Throwable) -> Throwable?)? = null
27-
2828
val constructors = exception.javaClass.constructors.sortedByDescending { it.parameterTypes.size }
2929
for (constructor in constructors) {
3030
val parameters = constructor.parameterTypes

core/kotlinx-coroutines-core/test/exceptions/StackTraceRecoveryTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class StackTraceRecoveryTest : TestBase() {
9797
"Caused by: java.lang.IllegalArgumentException\n" +
9898
"\tat kotlinx.coroutines.exceptions.StackTraceRecoveryTest\$testReceiveFromChannel\$1\$job\$1.invokeSuspend(StackTraceRecoveryTest.kt:93)\n" +
9999
"\tat kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:32)\n" +
100-
"\tat kotlinx.coroutines.DispatchedTask\$DefaultImpls.run(Dispatched.kt:152)"
100+
"\tat kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:152)"
101101
)
102102
)
103103
expect(3)

integration/kotlinx-coroutines-play-services/test/TaskTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class TaskTest : TestBase() {
7979
runTest { task.await() }
8080
} catch (e: RuntimeExecutionException) {
8181
Assert.assertFalse(task.isSuccessful)
82-
Assert.assertTrue(e.cause is OutOfMemoryError)
82+
Assert.assertTrue(e.cause ?.cause is OutOfMemoryError)
8383
}
8484
}
8585

0 commit comments

Comments
 (0)