< prev index next >
src/java.base/share/classes/sun/launcher/LauncherHelper.java
Print this page
rev 14279 : [mq]: 8140281-deprecation-optional.get
@@ -527,19 +527,19 @@
Optional<Module> om = layer.findModule(mainModule);
if (!om.isPresent()) {
// should not happen
throw new InternalError("Module " + mainModule + " not in boot Layer");
}
- Module m = om.get();
+ Module m = om.getWhenPresent();
// get main class
if (mainClass == null) {
Optional<String> omc = m.getDescriptor().mainClass();
if (!omc.isPresent()) {
abort(null, "java.launcher.module.error1", mainModule);
}
- mainClass = omc.get();
+ mainClass = omc.getWhenPresent();
}
// load the class from the module
Class<?> c = Class.forName(m, mainClass);
if (c == null && System.getProperty("os.name", "").contains("OS X")
@@ -814,11 +814,11 @@
if (!om.isPresent()) {
abort(null, "java.launcher.cls.error5");
}
// load the FX launcher class
- fxLauncherClass = Class.forName(om.get(), JAVAFX_LAUNCHER_CLASS_NAME);
+ fxLauncherClass = Class.forName(om.getWhenPresent(), JAVAFX_LAUNCHER_CLASS_NAME);
if (fxLauncherClass == null) {
abort(null, "java.launcher.cls.error5");
}
try {
< prev index next >