8193256: Configuration and ModuleLayer findModule cleanup
Reviewed-by: redestad, alanb
Contributed-by: andrej.golovnin@gmail.com
--- a/src/java.base/share/classes/java/lang/ModuleLayer.java Fri Dec 08 11:50:39 2017 +0000
+++ b/src/java.base/share/classes/java/lang/ModuleLayer.java Fri Dec 08 14:28:51 2017 +0000
@@ -845,9 +845,8 @@
return layers()
.skip(1) // skip this layer
- .map(l -> l.nameToModule)
- .filter(map -> map.containsKey(name))
- .map(map -> map.get(name))
+ .map(l -> l.nameToModule.get(name))
+ .filter(Objects::nonNull)
.findAny();
}
--- a/src/java.base/share/classes/java/lang/module/Configuration.java Fri Dec 08 11:50:39 2017 +0000
+++ b/src/java.base/share/classes/java/lang/module/Configuration.java Fri Dec 08 14:28:51 2017 +0000
@@ -543,9 +543,8 @@
if (!parents.isEmpty()) {
return configurations()
.skip(1) // skip this configuration
- .map(cf -> cf.nameToModule)
- .filter(map -> map.containsKey(name))
- .map(map -> map.get(name))
+ .map(cf -> cf.nameToModule.get(name))
+ .filter(Objects::nonNull)
.findFirst();
}