8221473: Configuration::reads can use Set.copyOf
authorredestad
Tue, 26 Mar 2019 15:20:23 +0100
changeset 54285 33f0b34c9dd7
parent 54284 a2897fb258f1
child 54286 6640fd9196d9
8221473: Configuration::reads can use Set.copyOf Reviewed-by: alanb, forax
src/java.base/share/classes/java/lang/module/Configuration.java
--- a/src/java.base/share/classes/java/lang/module/Configuration.java	Wed Mar 20 16:43:49 2019 -0400
+++ b/src/java.base/share/classes/java/lang/module/Configuration.java	Tue Mar 26 15:20:23 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));
     }
 
     /**