RFR [9] 8071474: Better failure atomicity for default read object
Chris Hegarty
chris.hegarty at oracle.com
Thu Mar 19 21:26:57 UTC 2015
The current implementation of defaultReadObject sets non-primitive field
values one at a time, without first checking that all their types are
assignable. If, for example, the assignment of the last non-primitive
value fails, a CCE is thrown, and the previously set fields remain set.
The setting of field values, including primitives, can be deferred until
after they have been "validated", at a minimum that the non-primitive
types are assignable. This is achievable per Class in the hierarchy up
until the first user visible affect, i.e. a readObject(NoData) method.
Either all fields will be set, or contain their default values.
http://cr.openjdk.java.net/~chegar/8071474/webrev.00/webrev/
I think there are further improvements that can be made in this area,
but I would like to move things forward incrementally.
-Chris.
More information about the core-libs-dev
mailing list