Skip to content

Commit

Permalink
Fix equals implementation in KGP shims.
Browse files Browse the repository at this point in the history
  • Loading branch information
FilipDolnik committed May 21, 2024
1 parent a2aa9ab commit 45a35b9
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@ class ActualKonanTargetShim(
override fun toString(): String =
konanTarget.toString()

override fun equals(other: Any?): Boolean =
konanTarget == other
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is ActualKonanTargetShim) return false

if (konanTarget != other.konanTarget) return false

return true
}

override fun hashCode(): Int =
konanTarget.hashCode()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,14 @@ class ActualKotlinNativeCompilationShim(
override fun toString(): String =
kotlinNativeCompilation.toString()

override fun equals(other: Any?): Boolean =
kotlinNativeCompilation == other
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is ActualKotlinNativeCompilationShim) return false

if (kotlinNativeCompilation != other.kotlinNativeCompilation) return false

return true
}

override fun hashCode(): Int =
kotlinNativeCompilation.hashCode()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,14 @@ class ActualKotlinNativeTargetShim(
override fun toString(): String =
kotlinNativeTarget.toString()

override fun equals(other: Any?): Boolean =
kotlinNativeTarget == other
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is ActualKotlinNativeTargetShim) return false

if (kotlinNativeTarget != other.kotlinNativeTarget) return false

return true
}

override fun hashCode(): Int =
kotlinNativeTarget.hashCode()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,14 @@ class ActualKotlinSourceSetShim(
override fun toString(): String =
kotlinSourceSet.toString()

override fun equals(other: Any?): Boolean =
kotlinSourceSet == other
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is ActualKotlinSourceSetShim) return false

if (kotlinSourceSet != other.kotlinSourceSet) return false

return true
}

override fun hashCode(): Int =
kotlinSourceSet.hashCode()
Expand Down

0 comments on commit 45a35b9

Please sign in to comment.