RFR(m): 8159404: immutable collections should throw UOE unconditionally

Stuart Marks stuart.marks at oracle.com
Sat Sep 3 00:48:41 UTC 2016

On 9/1/16 8:41 PM, Martin Buchholz wrote:
> Looks good to me!
> Another idea for another day: I would like the immutable collections to be 
> more optimal than they currently are, even if we have to write more code.  It 
> bugs me is that all of these collections have a modCount, despite never being 
> modified!  (Even for mutable lists, I'm not sure the added safety of modCount 
> was worth the price)
> java -jar jol-cli-0.5-full.jar internals java.util.ImmutableCollections\$List1
> ...
> java.util.ImmutableCollections$List1 object internals:
>       0    12        (object header)                N/A
>      12     4    int AbstractList.modCount          N/A
>      16     4 Object List1.e0                       N/A
Yes, good idea. I've filed JDK-8165396 to track this.


More information about the core-libs-dev mailing list