161 // from an exploded image
162 return imageReader.getModuleNames();
163 }
164
165 private static ModuleReference toModuleReference(ModuleDescriptor md,
166 HashSupplier hash)
167 {
168 String mn = md.name();
169 URI uri = URI.create("jrt:/" + mn);
170
171 Supplier<ModuleReader> readerSupplier = new Supplier<>() {
172 @Override
173 public ModuleReader get() {
174 return new ImageModuleReader(mn, uri);
175 }
176 };
177
178 ModuleReference mref =
179 new ModuleReference(md, uri, readerSupplier, hash);
180
181 // may need a reference to a patched module if -Xpatch specified
182 mref = ModulePatcher.interposeIfNeeded(mref);
183
184 return mref;
185 }
186
187 private static HashSupplier hashSupplier(int index, String name) {
188 if (isFastPathSupported()) {
189 return new HashSupplier() {
190 @Override
191 public String generate(String algorithm) {
192 return SystemModules.MODULES_TO_HASH[index];
193 }
194 };
195 } else {
196 return Hashes.hashFor(name);
197 }
198 }
199
200 /*
201 * This helper class is only used when SystemModules is patched.
|
161 // from an exploded image
162 return imageReader.getModuleNames();
163 }
164
165 private static ModuleReference toModuleReference(ModuleDescriptor md,
166 HashSupplier hash)
167 {
168 String mn = md.name();
169 URI uri = URI.create("jrt:/" + mn);
170
171 Supplier<ModuleReader> readerSupplier = new Supplier<>() {
172 @Override
173 public ModuleReader get() {
174 return new ImageModuleReader(mn, uri);
175 }
176 };
177
178 ModuleReference mref =
179 new ModuleReference(md, uri, readerSupplier, hash);
180
181 // may need a reference to a patched module if --patch-module specified
182 mref = ModulePatcher.interposeIfNeeded(mref);
183
184 return mref;
185 }
186
187 private static HashSupplier hashSupplier(int index, String name) {
188 if (isFastPathSupported()) {
189 return new HashSupplier() {
190 @Override
191 public String generate(String algorithm) {
192 return SystemModules.MODULES_TO_HASH[index];
193 }
194 };
195 } else {
196 return Hashes.hashFor(name);
197 }
198 }
199
200 /*
201 * This helper class is only used when SystemModules is patched.
|