< prev index next >

src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java

Print this page
rev 14279 : [mq]: 8140281-deprecation-optional.get

*** 102,112 **** // possible and also that resources in the base module can be located // for error messages that may happen from here on. Optional<ModuleReference> obase = systemModulePath.find(JAVA_BASE); if (!obase.isPresent()) throw new InternalError(JAVA_BASE + " not found"); ! ModuleReference base = obase.get(); BootLoader.loadModule(base); Modules.defineModule(null, base.descriptor(), base.location().orElse(null)); // -upgrademodulepath option specified to launcher --- 102,112 ---- // possible and also that resources in the base module can be located // for error messages that may happen from here on. Optional<ModuleReference> obase = systemModulePath.find(JAVA_BASE); if (!obase.isPresent()) throw new InternalError(JAVA_BASE + " not found"); ! ModuleReference base = obase.getWhenPresent(); BootLoader.loadModule(base); Modules.defineModule(null, base.descriptor(), base.location().orElse(null)); // -upgrademodulepath option specified to launcher
*** 304,314 **** // add the other modules for (String mod : otherMods) { Optional<ModuleReference> omref = finder.find(mod); if (omref.isPresent()) { ! ModuleReference mref = omref.get(); map.putIfAbsent(mod, mref); mrefs.add(mref); } else { // no need to fail } --- 304,314 ---- // add the other modules for (String mod : otherMods) { Optional<ModuleReference> omref = finder.find(mod); if (omref.isPresent()) { ! ModuleReference mref = omref.getWhenPresent(); map.putIfAbsent(mod, mref); mrefs.add(mref); } else { // no need to fail }
*** 360,370 **** // the key is $MODULE String mn = e.getKey(); Optional<Module> om = bootLayer.findModule(mn); if (!om.isPresent()) fail("Unknown module: " + mn); ! Module m = om.get(); // the value is the set of other modules (by name) for (String name : e.getValue()) { Module other; --- 360,370 ---- // the key is $MODULE String mn = e.getKey(); Optional<Module> om = bootLayer.findModule(mn); if (!om.isPresent()) fail("Unknown module: " + mn); ! Module m = om.getWhenPresent(); // the value is the set of other modules (by name) for (String name : e.getValue()) { Module other;
*** 372,382 **** other = null; // loose } else { om = bootLayer.findModule(name); if (!om.isPresent()) fail("Unknown module: " + name); ! other = om.get(); } Modules.addReads(m, other); } } --- 372,382 ---- other = null; // loose } else { om = bootLayer.findModule(name); if (!om.isPresent()) fail("Unknown module: " + name); ! other = om.getWhenPresent(); } Modules.addReads(m, other); } }
*** 406,427 **** // The exporting module is in the boot layer Module m; Optional<Module> om = bootLayer.findModule(mn); if (!om.isPresent()) fail("Unknown module: " + mn); ! m = om.get(); // the value is the set of modules to export to (by name) for (String name : e.getValue()) { boolean allUnnamed = false; Module other = null; if (ALL_UNNAMED.equals(name)) { allUnnamed = true; } else { om = bootLayer.findModule(name); if (om.isPresent()) { ! other = om.get(); } else { fail("Unknown module: " + name); } } --- 406,427 ---- // The exporting module is in the boot layer Module m; Optional<Module> om = bootLayer.findModule(mn); if (!om.isPresent()) fail("Unknown module: " + mn); ! m = om.getWhenPresent(); // the value is the set of modules to export to (by name) for (String name : e.getValue()) { boolean allUnnamed = false; Module other = null; if (ALL_UNNAMED.equals(name)) { allUnnamed = true; } else { om = bootLayer.findModule(name); if (om.isPresent()) { ! other = om.getWhenPresent(); } else { fail("Unknown module: " + name); } }
< prev index next >