< prev index next >

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

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

@@ -59,15 +59,15 @@
         cw.visitAttribute(new ModuleAttribute(descriptor));
         cw.visitAttribute(new ConcealedPackagesAttribute(descriptor.conceals()));
 
         Optional<Version> oversion = descriptor.version();
         if (oversion.isPresent())
-            cw.visitAttribute(new VersionAttribute(oversion.get()));
+            cw.visitAttribute(new VersionAttribute(oversion.getWhenPresent()));
 
         Optional<String> omain = descriptor.mainClass();
         if (omain.isPresent())
-            cw.visitAttribute(new MainClassAttribute(omain.get()));
+            cw.visitAttribute(new MainClassAttribute(omain.getWhenPresent()));
 
         // write the TargetPlatform attribute if have any of OS name/arch/version
         String osName = descriptor.osName().orElse(null);
         String osArch = descriptor.osArch().orElse(null);
         String osVersion = descriptor.osVersion().orElse(null);
< prev index next >