JDK 8 RFR 8016252: More defensive HashSet.readObject

Alan Bateman Alan.Bateman at oracle.com
Fri Oct 4 05:14:51 UTC 2013


On 03/10/2013 16:17, Brian Burkhalter wrote:
> Please review and comment at your convenience.
>
> Issue:	https://bugs.openjdk.java.net/browse/JDK-8016252
> Webrev:	http://cr.openjdk.java.net/~bpb/8016252/
>
> Summary
> * Improve validation checks in HashSet.readObject().
>
> Would this change imply updating the serialVersionUID?
>
I assume that capacity and loadFactor will be checked when attempting to 
create the HashMap so I don't think we strictly need the additional checks.

As regards size > capacity, then won't that break things if the 
loadFactor is high? The size < 0 case seems to be harmless, we'll just 
end up with an empty Set.

You SVUID shouldn't be updated (the serial form hasn't changed).

-Alan.











More information about the core-libs-dev mailing list