JDK 8 RFR 8016252: More defensive HashSet.readObject
Brian Burkhalter
brian.burkhalter at oracle.com
Mon Oct 7 20:35:17 UTC 2013
On Oct 7, 2013, at 1:31 PM, Alan Bateman wrote:
> I'm not so sure about capacity, a simple check if it is negative should be sufficient.
The idea was to try to use the value if it appears reasonable, which is assured by the clamping.
> For size then I don't think the Math.max has any real effect because the loop don't do anything if size is negative You could just throw IllegalObjectException if it is negative (as per the first patch) if you really wanted to.
It has an effect as size is used on clamping the capacity value.
Brian
More information about the core-libs-dev
mailing list