270 while (moduleLocationIterator.hasNext()) {
271 Set<Location> locns = (moduleLocationIterator.next());
272 namesInSet.clear();
273 for (Location l: locns) {
274 try {
275 Name n = names.fromString(fileManager.inferModuleName(l));
276 if (namesInSet.put(n, l) == null) {
277 ModuleSymbol msym = syms.enterModule(n);
278 if (msym.sourceLocation != null || msym.classLocation != null) {
279 // module has already been found, so ignore this instance
280 continue;
281 }
282 if (moduleLocationIterator.outer == StandardLocation.MODULE_SOURCE_PATH) {
283 msym.sourceLocation = l;
284 if (fileManager.hasLocation(StandardLocation.CLASS_OUTPUT)) {
285 msym.classLocation = fileManager.getLocationForModule(StandardLocation.CLASS_OUTPUT, msym.name.toString());
286 }
287 } else {
288 msym.classLocation = l;
289 }
290 if (moduleLocationIterator.outer == StandardLocation.SYSTEM_MODULES ||
291 moduleLocationIterator.outer == StandardLocation.UPGRADE_MODULE_PATH) {
292 msym.flags_field |= Flags.SYSTEM_MODULE;
293 }
294 if (toFind == msym || toFind == null) {
295 // Note: cannot return msym directly, because we must finish
296 // processing this set first
297 results.add(msym);
298 }
299 } else {
300 log.error(Errors.DuplicateModuleOnPath(
301 getDescription(moduleLocationIterator.outer), n));
302 }
303 } catch (IOException e) {
304 // skip location for now? log error?
305 }
306 }
307 if (toFind != null && results.nonEmpty())
308 return results.toList();
309 }
|
270 while (moduleLocationIterator.hasNext()) {
271 Set<Location> locns = (moduleLocationIterator.next());
272 namesInSet.clear();
273 for (Location l: locns) {
274 try {
275 Name n = names.fromString(fileManager.inferModuleName(l));
276 if (namesInSet.put(n, l) == null) {
277 ModuleSymbol msym = syms.enterModule(n);
278 if (msym.sourceLocation != null || msym.classLocation != null) {
279 // module has already been found, so ignore this instance
280 continue;
281 }
282 if (moduleLocationIterator.outer == StandardLocation.MODULE_SOURCE_PATH) {
283 msym.sourceLocation = l;
284 if (fileManager.hasLocation(StandardLocation.CLASS_OUTPUT)) {
285 msym.classLocation = fileManager.getLocationForModule(StandardLocation.CLASS_OUTPUT, msym.name.toString());
286 }
287 } else {
288 msym.classLocation = l;
289 }
290 if (fileManager.hasLocation(StandardLocation.PATCH_MODULE_PATH)) {
291 msym.patchLocation = fileManager.getLocationForModule(StandardLocation.PATCH_MODULE_PATH, msym.name.toString());
292 }
293 if (moduleLocationIterator.outer == StandardLocation.SYSTEM_MODULES ||
294 moduleLocationIterator.outer == StandardLocation.UPGRADE_MODULE_PATH) {
295 msym.flags_field |= Flags.SYSTEM_MODULE;
296 }
297 if (toFind == msym || toFind == null) {
298 // Note: cannot return msym directly, because we must finish
299 // processing this set first
300 results.add(msym);
301 }
302 } else {
303 log.error(Errors.DuplicateModuleOnPath(
304 getDescription(moduleLocationIterator.outer), n));
305 }
306 } catch (IOException e) {
307 // skip location for now? log error?
308 }
309 }
310 if (toFind != null && results.nonEmpty())
311 return results.toList();
312 }
|