RFR: 8221473: Configuration::reads can use Set.copyOf
Remi Forax
forax at univ-mlv.fr
Tue Mar 26 13:53:35 UTC 2019
Looks good to me.
Rémi
----- Mail original -----
> De: "Claes Redestad" <claes.redestad at oracle.com>
> À: "core-libs-dev" <core-libs-dev at openjdk.java.net>
> Envoyé: Mardi 26 Mars 2019 14:44:06
> Objet: Re: RFR: 8221473: Configuration::reads can use Set.copyOf
> On 2019-03-26 14:33, Claes Redestad wrote:
>> Hi,
>>
>> replacing a lingering use of Collections.unmodifiableSet with Set.copyOf
>> in java.lang.module.Configuration is a small startup optimization.
>>
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8221473
>
> Or with this less verbose comment (suggested offline by Alan):
>
> diff -r 5ee30b6991a7
> src/java.base/share/classes/java/lang/module/Configuration.java
> --- a/src/java.base/share/classes/java/lang/module/Configuration.java
> Mon Dec 03 16:25:27 2018 +0100
> +++ b/src/java.base/share/classes/java/lang/module/Configuration.java
> Tue Mar 26 14:50:55 2019 +0100
> @@ -575,7 +575,8 @@
> }
>
> Set<ResolvedModule> reads(ResolvedModule m) {
> - return Collections.unmodifiableSet(graph.get(m));
> + // The sets stored in the graph are already immutable sets
> + return Set.copyOf(graph.get(m));
> }
>
> /**
More information about the core-libs-dev
mailing list