< prev index next >

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

Print this page




 158             mres = impl.moduleResolution();
 159         }
 160 
 161         return new ModuleReferenceImpl(descriptor,
 162                                        location,
 163                                        () -> new PatchedModuleReader(paths, mref),
 164                                        this,
 165                                        recordedHashes,
 166                                        null,
 167                                        mres);
 168 
 169     }
 170 
 171     /**
 172      * Returns true is this module patcher has no patches.
 173      */
 174     public boolean isEmpty() {
 175         return map.isEmpty();
 176     }
 177 






 178 
 179     /**
 180      * A ModuleReader that reads resources from a patched module.
 181      *
 182      * This class is public so as to expose the findResource method to the
 183      * built-in class loaders and avoid locating the resource twice during
 184      * class loading (once to locate the resource, the second to gets the
 185      * URL for the CodeSource).
 186      */
 187     public static class PatchedModuleReader implements ModuleReader {
 188         private final List<ResourceFinder> finders;
 189         private final ModuleReference mref;
 190         private final URL delegateCodeSourceURL;
 191         private volatile ModuleReader delegate;
 192 
 193         /**
 194          * Creates the ModuleReader to reads resources a patched module.
 195          */
 196         PatchedModuleReader(List<Path> patches, ModuleReference mref) {
 197             List<ResourceFinder> finders = new ArrayList<>();




 158             mres = impl.moduleResolution();
 159         }
 160 
 161         return new ModuleReferenceImpl(descriptor,
 162                                        location,
 163                                        () -> new PatchedModuleReader(paths, mref),
 164                                        this,
 165                                        recordedHashes,
 166                                        null,
 167                                        mres);
 168 
 169     }
 170 
 171     /**
 172      * Returns true is this module patcher has no patches.
 173      */
 174     public boolean isEmpty() {
 175         return map.isEmpty();
 176     }
 177 
 178     /*
 179      * Returns the names of the patched modules.
 180      */
 181     Set<String> patchedModules() {
 182         return map.keySet();
 183     }
 184 
 185     /**
 186      * A ModuleReader that reads resources from a patched module.
 187      *
 188      * This class is public so as to expose the findResource method to the
 189      * built-in class loaders and avoid locating the resource twice during
 190      * class loading (once to locate the resource, the second to gets the
 191      * URL for the CodeSource).
 192      */
 193     public static class PatchedModuleReader implements ModuleReader {
 194         private final List<ResourceFinder> finders;
 195         private final ModuleReference mref;
 196         private final URL delegateCodeSourceURL;
 197         private volatile ModuleReader delegate;
 198 
 199         /**
 200          * Creates the ModuleReader to reads resources a patched module.
 201          */
 202         PatchedModuleReader(List<Path> patches, ModuleReference mref) {
 203             List<ResourceFinder> finders = new ArrayList<>();


< prev index next >