< prev index next >

src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java

Print this page

        

@@ -62,11 +62,10 @@
 
 import jdk.internal.access.SharedSecrets;
 import jdk.internal.misc.VM;
 import jdk.internal.module.ModulePatcher.PatchedModuleReader;
 import jdk.internal.module.Resources;
-import jdk.internal.vm.annotation.Stable;
 
 
 /**
  * The platform or application class loader. Resources loaded from modules
  * defined to the boot class loader are also loaded via an instance of this

@@ -116,48 +115,28 @@
      * URL to avoid needing to create this URL when defining classes.
      */
     private static class LoadedModule {
         private final BuiltinClassLoader loader;
         private final ModuleReference mref;
-        private final URI uri;                      // may be null
-        private @Stable URL codeSourceURL;          // may be null
+        private final URL codeSourceURL;          // may be null
 
         LoadedModule(BuiltinClassLoader loader, ModuleReference mref) {
             URL url = null;
-            this.uri = mref.location().orElse(null);
-
-            // for non-jrt schemes we need to resolve the codeSourceURL
-            // eagerly during bootstrap since the handler might be
-            // overridden
-            if (uri != null && !"jrt".equals(uri.getScheme())) {
-                url = createURL(uri);
+            if (mref.location().isPresent()) {
+                try {
+                    url = mref.location().get().toURL();
+                } catch (MalformedURLException | IllegalArgumentException e) { }
             }
             this.loader = loader;
             this.mref = mref;
             this.codeSourceURL = url;
         }
 
         BuiltinClassLoader loader() { return loader; }
         ModuleReference mref() { return mref; }
         String name() { return mref.descriptor().name(); }
-
-        URL codeSourceURL() {
-            URL url = codeSourceURL;
-            if (url == null && uri != null) {
-                codeSourceURL = url = createURL(uri);
-            }
-            return url;
-        }
-
-        private URL createURL(URI uri) {
-            URL url = null;
-            try {
-                url = uri.toURL();
-            } catch (MalformedURLException | IllegalArgumentException e) {
-            }
-            return url;
-        }
+        URL codeSourceURL() { return codeSourceURL; }
     }
 
 
     // maps package name to loaded module for modules in the boot layer
     private static final Map<String, LoadedModule> packageToModule
< prev index next >