Skip to content

Commit

Permalink
#192 fix: fix code to bypass compilation errors caused by a bug in th…
Browse files Browse the repository at this point in the history
…e Kotlin 2.0.0 compiler

- This bug is not occurring in versions of Kotlin before or after 2.0.0
  • Loading branch information
mbkim95 committed Aug 27, 2024
1 parent 59077c1 commit 33381f2
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ abstract class SingleResultReceiver<T : Any> private constructor() :
override fun parseError(url: Uri): Pair<String?, String?> = parseError(url)
override fun isError(url: Uri): Boolean = isError(url)
}.apply {
this.emitter = emitter
setEmitter(emitter)
}
}
}
Expand All @@ -44,7 +44,12 @@ abstract class SingleResultReceiver<T : Any> private constructor() :
abstract class BaseResultReceiver<T : Any, E> protected constructor() :
ResultReceiver(Handler(Looper.getMainLooper())) {
var emitter: E? = null
protected set
private set

// There was a bug in kotlin 2.0.0 where you couldn't assign a value to a protected set variable, so I added the setter function
protected fun setEmitter(emitter: E) {
this.emitter = emitter
}

abstract fun parseResponse(url: Uri): T?

Expand Down

0 comments on commit 33381f2

Please sign in to comment.