Mon, 17 Oct 2011 12:54:33 +0100
7097436: Project Coin: duplicate varargs warnings on method annotated with @SafeVarargs
Summary: Duplicate aliasing check during subtyping leads to spurious varargs diagnostic
Reviewed-by: jjg
1 /**
2 * @test
3 * @bug 6589361
4 * @summary 6589361:Failing building ct.sym file as part of the control build
5 */
7 import com.sun.tools.javac.file.JavacFileManager;
8 import com.sun.tools.javac.util.Context;
9 import java.io.File;
10 import javax.tools.FileObject;
11 import javax.tools.JavaFileObject;
12 import javax.tools.JavaFileObject.Kind;
13 import javax.tools.StandardLocation;
14 import java.util.Set;
15 import java.util.HashSet;
17 public class T6589361 {
18 public static void main(String [] args) throws Exception {
19 JavacFileManager fm = null;
20 try {
21 fm = new JavacFileManager(new Context(), false, null);
22 Set<JavaFileObject.Kind> set = new HashSet<JavaFileObject.Kind>();
23 set.add(JavaFileObject.Kind.CLASS);
24 Iterable<JavaFileObject> files = fm.list(StandardLocation.PLATFORM_CLASS_PATH, "java.lang", set, false);
25 for (JavaFileObject file : files) {
26 // Note: Zip/Jar entry names use '/', not File.separator, but just to be sure,
27 // we normalize the filename as well.
28 if (file.getName().replace(File.separatorChar, '/').contains("java/lang/Object.class")) {
29 String str = fm.inferBinaryName(StandardLocation.CLASS_PATH, file);
30 if (!str.equals("java.lang.Object")) {
31 throw new AssertionError("Error in JavacFileManager.inferBinaryName method!");
32 }
33 else {
34 return;
35 }
36 }
37 }
38 }
39 finally {
40 if (fm != null) {
41 fm.close();
42 }
43 }
44 throw new AssertionError("Could not find java/lang/Object.class while compiling");
45 }
47 }