javax.tools.JavaFileManager.getClassLoader always fails
test:
------------------------------
import javax.tools.*;
import java.io.File;
import java.util.Collections;
public class test3 {
static public void main(String[] args){
File dir = new File( new File(".").toURI() );
StandardJavaFileManager sfm =
ToolProvider.getSystemJavaCompilerTool().
getStandardFileManager( new DiagnosticCollector<JavaFileObject>() );
JavaFileManager.Location location = StandardJavaFileManager.StandardLocation.SOURCE_PATH;
sfm.setLocation( location, Collections.singleton(dir) );
try {
sfm.getClassLoader(location);
System.out.println("OK");
} catch( Exception x ){
x.printStackTrace( System.out );
}
}
}
------------------------------
result:
------------------------------
java.lang.UnsupportedOperationException
at com.sun.tools.javac.util.ListBuffer.add(ListBuffer.java:205)
at com.sun.tools.javac.util.DefaultFileManager.getClassLoader(DefaultFileManager.java:664)
at test3.main(test3.java:18)
tests failed
> api/javax_tools/FileManager/index.html#All[getClassLoader0001]
> api/javax_tools/FileManager/index.html#All[getClassLoader0002]
> api/javax_tools/FileManager/index.html#All[getClassLoader0003]
> api/javax_tools/FileManager/index.html#All[getClassLoader0004]
> api/javax_tools/FileManager/index.html#All[getClassLoader0005]