RFR: 8209003: Consolidate use of empty collections in java.lang.module

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

RFR: 8209003: Consolidate use of empty collections in java.lang.module

Claes Redestad
Hi,

feel free to review this cleanup to consolidate some uses of
Collections.empty/unmodifiableXx.. to Set/Map/List.of()/copyOf(), as
appropriate. This aligns better with code already generated by jlink, so
avoids observing a mix of many implementation classes in some places..

Webrev: http://cr.openjdk.java.net/~redestad/8209003/jdk.00/

Bug: https://bugs.openjdk.java.net/browse/JDK-8209003

Due the specified need to throw IAE rather than NPE in certain cases,
code in some performance-insensitive API methods in
ModuleDescriptor.Builder now does an extra copy up front
(List/Set/Map.copyOf will throw NPE on any null element or key). I'd
rather keep the code simple than add extra handling to squeeze out the
last bit of performance here (maybe I'm getting old...)

Thanks!

/Claes

Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8209003: Consolidate use of empty collections in java.lang.module

Alan Bateman
On 07/08/2018 17:16, Claes Redestad wrote:

> Hi,
>
> feel free to review this cleanup to consolidate some uses of
> Collections.empty/unmodifiableXx.. to Set/Map/List.of()/copyOf(), as
> appropriate. This aligns better with code already generated by jlink,
> so avoids observing a mix of many implementation classes in some places..
>
> Webrev: http://cr.openjdk.java.net/~redestad/8209003/jdk.00/
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8209003
>
> Due the specified need to throw IAE rather than NPE in certain cases,
> code in some performance-insensitive API methods in
> ModuleDescriptor.Builder now does an extra copy up front
> (List/Set/Map.copyOf will throw NPE on any null element or key). I'd
> rather keep the code simple than add extra handling to squeeze out the
> last bit of performance here (maybe I'm getting old...)
This looks okay, I don't see anywhere where the behavior changes.

-Alan
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8209003: Consolidate use of empty collections in java.lang.module

Mandy Chung
In reply to this post by Claes Redestad
This cleanup looks fine.

Mandy

On 8/7/18 9:16 AM, Claes Redestad wrote:

> Hi,
>
> feel free to review this cleanup to consolidate some uses of
> Collections.empty/unmodifiableXx.. to Set/Map/List.of()/copyOf(), as
> appropriate. This aligns better with code already generated by jlink, so
> avoids observing a mix of many implementation classes in some places..
>
> Webrev: http://cr.openjdk.java.net/~redestad/8209003/jdk.00/
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8209003
>
> Due the specified need to throw IAE rather than NPE in certain cases,
> code in some performance-insensitive API methods in
> ModuleDescriptor.Builder now does an extra copy up front
> (List/Set/Map.copyOf will throw NPE on any null element or key). I'd
> rather keep the code simple than add extra handling to squeeze out the
> last bit of performance here (maybe I'm getting old...)
>
> Thanks!
>
> /Claes
>
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8209003: Consolidate use of empty collections in java.lang.module

Claes Redestad
Alan, Mandy,

thanks for reviewing. Pushed.

/Claes


On 2018-08-07 21:05, mandy chung wrote:
> This cleanup looks fine.
>
> Mandy