changeset 55542:33f0b34c9dd7

8221473: Configuration::reads can use Set.copyOf Reviewed-by: alanb, forax
author redestad
date Tue, 26 Mar 2019 15:20:23 +0100
parents a2897fb258f1
children 6640fd9196d9
files src/java.base/share/classes/java/lang/module/Configuration.java
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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));
     }
 
     /**