JDK 8 code review request for 6226715: (ann) java.lang.annotation.AnnotationTypeMismatchException could not be serialized
forax at univ-mlv.fr
Thu Jun 16 11:18:00 PDT 2011
On 06/16/2011 05:17 PM, Joe Darcy wrote:
> Rémi Forax wrote:
>> Le 16/06/2011 02:35, Joe Darcy a écrit :
>>> Please review my JDK 8 fix for
>>> 6226715: (ann)
>>> java.lang.annotation.AnnotationTypeMismatchException could not be
>>> This fix includes the unusual step of marking a non-transient field
>>> transient in a serialiable class, but the class can't meaningfully
>>> be serialized today anyway so this change should have no adverse
>>> effect in practice.
>>> For good code hygiene, the new readObject method explicitly sets the
>>> now transient field in question.
>> Not sure it's good to drop 'final' just for code hygiene.
>> A code that relies on the fact that this exception is non-mutable can
>> now fail.
> There is no setter for the field other than through the constructor
> (and now readObject).
Because the field is not final a thread can see this field null even if
the exception was created
with a value.
> I don't really want to dip into sun.misc.Unsafe to set a final
> transient field in the readObject method.
why do you want to set the field to null knowing that null is the
default value ?
More information about the core-libs-dev