JDK-6355177 : JSR 199: JavaCompilerTool.setClassPath(List) will throw IllegalArgumentException when List is empty
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: generic
  • CPU: generic
  • Submitted: 2005-11-24
  • Updated: 2010-04-02
  • Resolved: 2006-03-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6Resolved
Related Reports
Duplicate :  
Relates :  
Description
JavaCompilerTool.setClassPath(List) will throw IllegalArgumentException when List is empty
Please see the testcase ..

Tried in Solaris SunOS 5.10 Generic sun4u sparc SUNW,Ultra-60
<java-version>
bash-3.00$ java -version
java version "1.6.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-beta-b59a)
Java HotSpot(TM) Client VM (build 1.6.0-beta-b59a, mixed mode)
</java-version>

<testcase>
import java.io.File;
import java.util.ArrayList;
import javax.tools.JavaCompilerTool;
import javax.tools.JavaFileManager;
import javax.tools.ToolProvider;

public class Test11 {
    public static void main(String[] args) {
        JavaCompilerTool javac = ToolProvider.defaultJavaCompiler();
        JavaFileManager jfm = javac.getStandardFileManager();
        javac.setClassPath(new ArrayList<File>());
    }
}
</testcase>
In the above testcase the list size is zero.
Output of the code when compiled and run...

<output>
bash-3.00$ java Test11
Exception in thread "main" java.lang.IllegalArgumentException: -classpath
        at com.sun.tools.javac.api.Tool.setOption1(Tool.java:188)
        at com.sun.tools.javac.api.Tool.setOption(Tool.java:200)
        at com.sun.tools.javac.api.Tool.setClassPath(Tool.java:155)
        at Test11.main(Test11.java:11)
</output>
This behaviour is not mentioned in the API docs
CompilerAPI should ignore setting of classpath if the list is empty, rather throwing IllegalArgumentException.
Similar issue for setSourcePath.

Comments
EVALUATION These methods disappeared in 6327885.
17-03-2006

EVALUATION The specification should be finalized before shipping Mustang.
06-12-2005