use of javax.tools.StandardLocation in project ceylon-compiler by ceylon.
the class T6400207 method main.
public static void main(String... args) throws Exception {
JavaFileManager fm = ToolProvider.getSystemJavaCompiler().getStandardFileManager(null, null, null);
JavaFileManager.Location bogusLocation = locationFor("bogus");
JavaFileManager.Location knownLocation = CLASS_PATH;
String packageName = "java.lang";
Set<JavaFileObject.Kind> kinds = EnumSet.of(CLASS);
for (StandardLocation location : StandardLocation.values()) {
if (location != locationFor(location.getName()))
throw new AssertionError(location + " != locationFor(" + location.getName() + ")");
}
testList(fm, null, null, null);
testList(fm, bogusLocation, packageName, kinds);
testList(fm, knownLocation, packageName, kinds);
testList(fm, null, packageName, kinds);
testList(fm, knownLocation, null, kinds);
testList(fm, knownLocation, packageName, null);
testList(fm, bogusLocation, null, kinds);
testList(fm, bogusLocation, packageName, null);
System.err.println("Test PASSED.");
}
use of javax.tools.StandardLocation in project ceylon-compiler by ceylon.
the class JavacPathFileManager method setDefaultForLocation.
private void setDefaultForLocation(Location locn) {
Collection<File> files = null;
if (locn instanceof StandardLocation) {
switch((StandardLocation) locn) {
case CLASS_PATH:
files = searchPaths.userClassPath();
break;
case PLATFORM_CLASS_PATH:
files = searchPaths.bootClassPath();
break;
case SOURCE_PATH:
files = searchPaths.sourcePath();
break;
case CLASS_OUTPUT:
{
String arg = options.get(D);
files = (arg == null ? null : Collections.singleton(new File(arg)));
break;
}
case SOURCE_OUTPUT:
{
String arg = options.get(S);
files = (arg == null ? null : Collections.singleton(new File(arg)));
break;
}
}
}
PathsForLocation pl = new PathsForLocation();
if (files != null) {
for (File f : files) pl.add(f.toPath());
}
pathsForLocation.put(locn, pl);
}
Aggregations