Rename Random.Default serialization surrogate object (KT-25571)

This commit is contained in:
Ilya Gorbunov
2020-12-31 04:21:40 +03:00
parent 00506a75d3
commit 79e426270c
2 changed files with 34 additions and 19 deletions
+2 -2
View File
@@ -270,13 +270,13 @@ public abstract class Random {
companion object Default : Random(), Serializable {
private val defaultRandom: Random = defaultPlatformRandom()
private object Dummy : Serializable {
private object Serialized : Serializable {
private const val serialVersionUID = 0L
private fun readResolve(): Any = Random
}
private fun writeReplace(): Any = Dummy
private fun writeReplace(): Any = Serialized
override fun nextBits(bitCount: Int): Int = defaultRandom.nextBits(bitCount)
override fun nextInt(): Int = defaultRandom.nextInt()