Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6428753

JSR 199: javax.tools.JavaFileManager.getJavaFileForOutput doesn't throw expected exception

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Cannot Reproduce
    • Affects Version/s: 6
    • Fix Version/s: 6
    • Component/s: tools
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      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]

        Attachments

          Activity

            People

            • Assignee:
              ahe Peter Ahe
              Reporter:
              itseytin Igor Tseytin (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: