Fix serialVersionUID for EmptyMap and EmptySet
Otherwise removal of redundant special stubs leads to InvalidClassException during deserialization
This commit is contained in:
@@ -7,6 +7,8 @@ import java.io.Serializable
|
||||
import java.util.*
|
||||
|
||||
private object EmptyMap : Map<Any?, Nothing>, Serializable {
|
||||
private const val serialVersionUID: Long = 8246714829545688274
|
||||
|
||||
override fun equals(other: Any?): Boolean = other is Map<*,*> && other.isEmpty()
|
||||
override fun hashCode(): Int = 0
|
||||
override fun toString(): String = "{}"
|
||||
|
||||
@@ -8,6 +8,8 @@ import java.util.*
|
||||
|
||||
|
||||
internal object EmptySet : Set<Nothing>, Serializable {
|
||||
private const val serialVersionUID: Long = 3406603774387020532
|
||||
|
||||
override fun equals(other: Any?): Boolean = other is Set<*> && other.isEmpty()
|
||||
override fun hashCode(): Int = 0
|
||||
override fun toString(): String = "[]"
|
||||
@@ -80,4 +82,4 @@ internal fun <T> Set<T>.optimizeReadOnlySet() = when (size) {
|
||||
0 -> emptySet()
|
||||
1 -> setOf(iterator().next())
|
||||
else -> this
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user