@Override public Iterable<Set<Location>> listLocationsForModules(Location location) { validateModuleLocation(location, ""); //$NON-NLS-1$ return this.locationHandler.listLocationsForModules(location); }
@Override public Location getLocationForModule(Location location, JavaFileObject fo) { validateModuleLocation(location, ""); //$NON-NLS-1$ Path path = null; if (fo instanceof ArchiveFileObject) { path = ((ArchiveFileObject) fo).file.toPath(); return this.locationHandler.getLocation(location, path); } else if (fo instanceof EclipseFileObject) { path = ((EclipseFileObject) fo).f.toPath(); try { path = path.toRealPath(); } catch (IOException e) { e.printStackTrace(); } LocationContainer container = this.locationHandler.getLocation(location); while (path != null) { Location loc = container.get(path); if (loc != null) return loc; path = path.getParent(); } } return null; }
@Override public void setLocationForModule(Location location, String moduleName, Collection<? extends Path> paths) throws IOException { validateModuleLocation(location, moduleName); this.locationHandler.setLocation(location, moduleName, paths); if (location == StandardLocation.MODULE_SOURCE_PATH) { LocationWrapper wrapper = this.locationHandler.getLocation(StandardLocation.CLASS_OUTPUT, moduleName); if (wrapper == null) { wrapper = this.locationHandler.getLocation(StandardLocation.CLASS_OUTPUT, ""); //$NON-NLS-1$ if (wrapper != null) { Iterator<? extends Path> iterator = wrapper.paths.iterator(); if (iterator.hasNext()) { // Per module output location is always a singleton list Path path = iterator.next().resolve(moduleName); this.locationHandler.setLocation(StandardLocation.CLASS_OUTPUT, moduleName, Collections.singletonList(path)); } } } } } }
@Override public Location getLocationForModule(Location location, String moduleName) throws IOException { validateModuleLocation(location, moduleName); Location result = this.locationHandler.getLocation(location, moduleName); if (result == null && location == StandardLocation.CLASS_OUTPUT) { LocationWrapper wrapper = this.locationHandler.getLocation(StandardLocation.MODULE_SOURCE_PATH, moduleName); deriveOutputLocationForModules(moduleName, wrapper.paths); result = getLocationForModule(location, moduleName); } else if (result == null && location == StandardLocation.SOURCE_OUTPUT) { LocationWrapper wrapper = this.locationHandler.getLocation(StandardLocation.MODULE_SOURCE_PATH, moduleName); deriveSourceOutputLocationForModules(moduleName, wrapper.paths); result = getLocationForModule(location, moduleName); } return result; }