-
Bug
-
Resolution: Cannot Reproduce
-
P2
-
6
-
generic
-
generic
javax.tools.JavaFileManager.getJavaFileForOutput(ANNOTATION_PROCESSOR_PATH, "file", HTML ) doesn't throw expected exception UnsupportedOperationException.
As far as I understand only SOURCE and CLASS kinds are suitable for use in getJavaFileFor{Input/Output}
If I'm wrong - the spec should be clarified.
see a test
-----------
import javax.tools.*;
import java.io.*;
import java.util.Collections;
public class test11 {
public static void main(String[] argv){
JavaCompilerTool compiler = ToolProvider.getSystemJavaCompilerTool();
StandardJavaFileManager mgr = compiler.getStandardFileManager( new DiagnosticCollector<JavaFileObject>() );
System.out.println( new File( new File(".").toURI() ).getAbsolutePath() );
JavaFileManager.Location loc = StandardLocation.ANNOTATION_PROCESSOR_PATH;
mgr.setLocation(loc, Collections.singleton(new File( new File(".").toURI())));
try {
JavaFileObject f = mgr.getJavaFileForOutput( loc, "file", JavaFileObject.Kind.HTML, null );
System.out.println( "result " + f.toUri() );
System.out.println( "getJavaFileForOutput should throw UnsupportedOperationException - if the specified kind (HTML) is not supported" );
} catch( Exception x ){
x.printStackTrace(System.out);
}
}
}
-----------
result:
-----------
Z:\tests>z:/lnks/jdk6/bin/java.exe -cp . test11
Z:\tests\.
result file:/Z:/tests/./file.html
getJavaFileForOutput should throw UnsupportedOperationException - if the specified kind (HTML) is not supported
-----------
tests failed:
api/javax_tools/FileManager/index.html#All[getJavaFileForInput0003]
api/javax_tools/FileManager/index.html#All[getJavaFileForOutput0003]
As far as I understand only SOURCE and CLASS kinds are suitable for use in getJavaFileFor{Input/Output}
If I'm wrong - the spec should be clarified.
see a test
-----------
import javax.tools.*;
import java.io.*;
import java.util.Collections;
public class test11 {
public static void main(String[] argv){
JavaCompilerTool compiler = ToolProvider.getSystemJavaCompilerTool();
StandardJavaFileManager mgr = compiler.getStandardFileManager( new DiagnosticCollector<JavaFileObject>() );
System.out.println( new File( new File(".").toURI() ).getAbsolutePath() );
JavaFileManager.Location loc = StandardLocation.ANNOTATION_PROCESSOR_PATH;
mgr.setLocation(loc, Collections.singleton(new File( new File(".").toURI())));
try {
JavaFileObject f = mgr.getJavaFileForOutput( loc, "file", JavaFileObject.Kind.HTML, null );
System.out.println( "result " + f.toUri() );
System.out.println( "getJavaFileForOutput should throw UnsupportedOperationException - if the specified kind (HTML) is not supported" );
} catch( Exception x ){
x.printStackTrace(System.out);
}
}
}
-----------
result:
-----------
Z:\tests>z:/lnks/jdk6/bin/java.exe -cp . test11
Z:\tests\.
result file:/Z:/tests/./file.html
getJavaFileForOutput should throw UnsupportedOperationException - if the specified kind (HTML) is not supported
-----------
tests failed:
api/javax_tools/FileManager/index.html#All[getJavaFileForInput0003]
api/javax_tools/FileManager/index.html#All[getJavaFileForOutput0003]