RFR (S): CR 8005926: (thread) Merge ThreadLocalRandom state into java.lang.Thread
martinrb at google.com
Wed Feb 20 12:16:21 UTC 2013
On Wed, Feb 20, 2013 at 3:16 AM, Chris Hegarty <chris.hegarty at oracle.com>wrote:
> Martin, Alan,
> OK, I finally got back to this.
> I agree that Martins changes should be fine for jdk8, but removing all
> these fields may cause an issue with jdk7. Removing pads, fine. The rnd and
> initialized fields are still applicable in jdk7 ( or 7 will need changes to
> remove their dependency ).
> For example, a serialized TLR from jdk8 with Martins changes, deserialized
> with jdk7 would contain no field values, therefore the defaults would
> apply. Calling setSeed on this object would not throw the expected UOE.
My expectation was that with my changes, the default serialization would
apply, and the serialized form would contain initiatialized=1. rnd would
not be in the serialized form, but would deserialize to 0, which is the
same as currently done.
BTW, we still don't have a good story on cross-JDK serialization testing.
> I think minimally TLR in jdk8 needs to keep initialized, and possibly
> write some reasonable value for rnd.
Whether rnd needs a reasonable value is a reasonable question.
More information about the core-libs-dev