< prev index next >

src/java.base/share/classes/java/lang/module/Resolver.java

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

@@ -96,11 +96,11 @@
             }
 
             if (TRACE) {
                 trace("Root module %s located", root);
                 if (mref.location().isPresent())
-                    trace("  (%s)", mref.location().get());
+                    trace("  (%s)", mref.location().getWhenPresent());
             }
 
             assert mref.descriptor().name().equals(root);
             nameToReference.put(root, mref);
             q.push(mref.descriptor());

@@ -155,11 +155,11 @@
 
                     if (TRACE) {
                         trace("Module %s located, required by %s",
                                 dn, descriptor.name());
                         if (mref.location().isPresent())
-                            trace("  (%s)", mref.location().get());
+                            trace("  (%s)", mref.location().getWhenPresent());
                     }
                 }
 
             }
 

@@ -230,11 +230,11 @@
 
                                     String pn = provider.name();
                                     if (!nameToReference.containsKey(pn)) {
 
                                         if (TRACE && mref.location().isPresent())
-                                            trace("  (%s)", mref.location().get());
+                                            trace("  (%s)", mref.location().getWhenPresent());
 
                                         nameToReference.put(pn, mref);
                                         q.push(provider);
                                     }
                                 }

@@ -432,11 +432,11 @@
 
             // get map of module names to hash
             Optional<Hasher.DependencyHashes> ohashes = descriptor.hashes();
             if (!ohashes.isPresent())
                 continue;
-            Hasher.DependencyHashes hashes = ohashes.get();
+            Hasher.DependencyHashes hashes = ohashes.getWhenPresent();
 
             // check dependences
             for (ModuleDescriptor.Requires d : descriptor.requires()) {
                 String dn = d.name();
                 String recordedHash = hashes.hashFor(dn);
< prev index next >