@Override
public void setLocationFromPaths(Location location, Collection<? extends Path> paths) throws IOException {
setLocation(location, getFiles(paths));
if (location == StandardLocation.MODULE_PATH) {
Map<String, String> options = new HashMap<>();
options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_9);
options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_9);
options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_9);
CompilerOptions compilerOptions = new CompilerOptions(options);
ProblemReporter problemReporter =
new ProblemReporter(
DefaultErrorHandlingPolicies.proceedWithAllProblems(),
compilerOptions,
new DefaultProblemFactory());
for (Path path : paths) {
List<Classpath> mp = ModuleFinder.findModules(path.toFile(), null,
new Parser(problemReporter, true), null, true, this.releaseVersion);
for (Classpath cp : mp) {
Collection<String> moduleNames = cp.getModuleNames(null);
for (String string : moduleNames) {
Path p = Paths.get(cp.getPath());
setLocationForModule(StandardLocation.MODULE_PATH, string, Collections.singletonList(p));
}
}
}
}
}