Skip to content

Commit fad9458

Browse files
qwwdfsadpablobaxter
authored andcommitted
Do not initialize CoroutineExceptionHandler in Job <clinit> (Kotlin#2513)
* It slightly cuts down startup time * It simplifies the code in general * It do not serve its purpose, coroutines are already protected from StackOverflowError with nested event-loops where applicable
1 parent bf30f68 commit fad9458

File tree

1 file changed

+1
-10
lines changed
  • kotlinx-coroutines-core/common/src

1 file changed

+1
-10
lines changed

kotlinx-coroutines-core/common/src/Job.kt

+1-10
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,7 @@ public interface Job : CoroutineContext.Element {
113113
/**
114114
* Key for [Job] instance in the coroutine context.
115115
*/
116-
public companion object Key : CoroutineContext.Key<Job> {
117-
init {
118-
/*
119-
* Here we make sure that CoroutineExceptionHandler is always initialized in advance, so
120-
* that if a coroutine fails due to StackOverflowError we don't fail to report this error
121-
* trying to initialize CoroutineExceptionHandler
122-
*/
123-
CoroutineExceptionHandler
124-
}
125-
}
116+
public companion object Key : CoroutineContext.Key<Job>
126117

127118
// ------------ state query ------------
128119

0 commit comments

Comments
 (0)