Community
Participate
Working Groups
/* The following code does not build inside Eclipse even when tools.jar is added to the project's libraries and the new JDK 1.5 is used to build it, yet it builds and executes cleanly using javac. */ import com.sun.tools.javac.util.List; public class ListMaker { public static void main(String[] args) { String[] hairball={"one","two","three"}; List<String> filenames = List.make(hairball); } }
What error do you get ? Don't you mean to use java.util.List ? Did you toggle compiler compliance to 1.5 ?
Pls reopen once questions are answered
Error msg: the method make(String[]) is ambiguous for the type List. No, I do mean to use com.sun.tools.javac.util.List (and this code builds under javac). Yes, I have set compiler compliance to 1.5 and all my other generic code compiles with no problems.
How did you setup your classpath exactly ?
I went to the Java Build Path section of the project's properties and added $JAVA_HOME/lib/tools.jar to the list of libraries (as an external jar).
Reproduced
Verified its fixed with latest. Could not reproduce with a testcase that did not need tools.jar
Verified using N20050606-0010 + JDT/Core HEAD
Verified for 3.1 RC2 using build I20050610-0010 Caveat: tools.jar changed between versions 1.5.0_03 and 1.5.0_04. Use the former to test.
close