RFR [9] 8071472: Add field access to support setting final fields in readObject

Peter Levart peter.levart at gmail.com
Fri Mar 13 18:07:48 UTC 2015



On 03/13/2015 05:10 PM, Chris Hegarty wrote:
>> So if this doesn't have much sense and brings confusion, it can go away.
>
> If we have consensus then I can remove this, artificial, restriction. 
> Objections? 

Hi Chris,

I think the part that checks that a final field is not set more than 
once is still useful (to catch conflicts betwen defaultReadObject() and 
explicitly setting the field). And if we keep that, there's no overhead 
in keeping the FieldAccessContext.checkAllFinalsSet() method and just 
propagating it to FieldAccess (FieldUpdater) API and removing it's call 
from ObjectInputStream code. So we don't impose this on the user, but 
give him an option.

Regards, Peter




More information about the core-libs-dev mailing list