JDK-6429194 : javax.tools.StandardJavaFileManager.setLocation(CLASS_PATH) has no effect?
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: generic
  • CPU: generic
  • Submitted: 2006-05-23
  • Updated: 2011-01-19
  • Resolved: 2006-05-26
Related Reports
Relates :  
Description
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
----------------

Comments
EVALUATION After b85 this is no longer reproducible. Fixed when addressing 6411073.
26-05-2006