RFR 8068887 : java.lang.Throwable could use Collections.emptyList for suppressedException

Peter Levart peter.levart at gmail.com
Mon Oct 12 16:22:49 UTC 2015



On 10/12/2015 05:56 PM, Alan Bateman wrote:
>
>
> On 12/10/2015 16:09, Vyom Tewari wrote:
>> Hi All,
>>
>> Please review my changes for below bug.
>>
>> Bug:            JDK-8068887 : java.lang.Throwable could use 
>> Collections.emptyList for suppressedException
>> Webrev: http://cr.openjdk.java.net/~vtewari/8068887/webrev.00/webrev/
>>
>> This change ensure that  fewer classes are loaded in a simple(hello 
>> world) program, and thus a very very small start-up footprint 
>> improvement.
>>
> This looks okay (just missing the a space in =Collections) but I'm 
> curious if it does actual reduce the number of classes loaded at 
> startup. I would think ArrayList and unmodifiable list would be popular.
>
> (Your patch makes me wonder if Collections.unmodifiableXXX should 
> return emptyXXX when the collection is empty).

Can not. unmodifiableXXX is defined to be a view over possibly 
modifiable collection. If underlying collection changes, the view changes.

Peter

>
> -Alan
>




More information about the core-libs-dev mailing list