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

javax.tools.StandardJavaFileManager.setLocation(CLASS_PATH) has no effect?

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • None
    • 6
    • tools
    • None
    • generic
    • generic

      I think the test below should print an empty files list in both (CLASS_PATH, SOURCE_PATH) cases.

      see a test
      ----------------
      import javax.tools.*;
      import java.io.*;
      import java.util.Collections;
      import java.util.EnumSet;

      public class test12 {
          static StandardJavaFileManager mgr;
          static File dir = new File( new File("noDir").toURI() );

          static void listf( JavaFileManager.Location loc ){
              System.out.println(loc);
              mgr.setLocation(loc, Collections.singleton(dir));

              try {
                  for( JavaFileObject f : mgr.list(loc, "", EnumSet.allOf(JavaFileObject.Kind.class), true) )
                      System.out.println( f.toUri() );
              } catch( Exception x ){
                  x.printStackTrace(System.out);
              }
          }

          public static void main(String[] argv){
              JavaCompilerTool compiler = ToolProvider.getSystemJavaCompilerTool();
              mgr = compiler.getStandardFileManager( new DiagnosticCollector<JavaFileObject>() );
              System.out.println( dir.getAbsolutePath() );

              listf(StandardJavaFileManager.StandardLocation.CLASS_PATH);
              listf(StandardJavaFileManager.StandardLocation.SOURCE_PATH);
          }
      }
      ----------------
      result
      ----------------
      Z:\tests>z:/lnks/jdk6/bin/java.exe -cp . test12
      Z:\tests\noDir
      CLASS_PATH
      file:/Z:/tests/./ListNetworkInterfaces.java
      file:/Z:/tests/./Test1.java
      file:/Z:/tests/./qq
      file:/Z:/tests/./LocalesList.java
      file:/Z:/tests/./test9.java
      file:/Z:/tests/./sp.jar
      file:/Z:/tests/./test7.java
      file:/Z:/tests/./Test.java
      file:/Z:/tests/./test9.class
      file:/Z:/tests/./Test2.java
      file:/Z:/tests/./ListNetworkInterfaces.class
      file:/Z:/tests/./test10.java
      file:/Z:/tests/./Equals.java
      file:/Z:/tests/./HashCode.java
      file:/Z:/tests/./test3.java
      file:/Z:/tests/./test11.java
      file:/Z:/tests/./test4.java
      file:/Z:/tests/./test10.class
      file:/Z:/tests/./test5.java
      file:/Z:/tests/./test6.java
      file:/Z:/tests/./test11.class
      file:/Z:/tests/./test12.java
      file:/Z:/tests/./test12.class
      file:/Z:/tests/./test8.java
      SOURCE_PATH
      ----------------

            Unassigned Unassigned
            itseytin Igor Tseytin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: