kotlinx.coroutines ライブラリに依存しているコードで kotlin.coroutine.coroutineContext プロパティが使用されていることを報告します。

kotlin.coroutine.coroutineContextkotlinx.coroutines.CoroutineScope.coroutineContext の両方が コード内に存在する場合、混乱や潜在的なバグが発生する可能性があります。

kotlinx.coroutines ライブラリは明示的な競合がない場合でも、currentCoroutineContext() 関数を使用すべきより明確な代替手段として提供します。

詳細については、kotlin.coroutine.coroutineContextkotlinx.coroutines.currentCoroutineContext のドキュメントを参照してください。

例:


  suspend fun getCurrentJob(): Job? {
    return coroutineContext[Job]
  }

クイックフィックス適用後:


  suspend fun getCurrentJob(): Job? {
    return currentCoroutineContext()[Job]
  }