> From: "Glavo" <zjx001...@gmail.com>
> To: "core-libs-dev" <core-libs-dev@openjdk.org>
> Sent: Thursday, January 30, 2025 4:22:00 PM
> Subject: All classes in jdk.internal.random are not serializable

> Hi,
> My friend was migrating from Random to RandomGenerator, but he ran into a
> roadblock:
> Random is serializable, but those new implementations of RandomGenerator are 
> not
> serializable.

> Was this an oversight or an evaluated decision?
> Is it possible to make them serializable?

For me, this is not an overlook and given that the interface RandomGenerator is 
open (anybody can implement it), 
this does not seem possible. 

If you read the doc of Random.from(), this is clear that a RandomGenerator is 
not serializable by design 
[ 
https://docs.oracle.com/en/java/javase/23/docs/api/java.base/java/util/Random.html#from(java.util.random.RandomGenerator)
 | 
https://docs.oracle.com/en/java/javase/23/docs/api/java.base/java/util/Random.html#from(java.util.random.RandomGenerator)
 ] 

> Glavo

regards, 
Rémi 

Reply via email to