Thu, 21 Feb 2013 15:27:05 +0000
8008444: Inherited generic functional descriptors are merged incorrectly
Summary: Missing call to Types.createMethodWithThrownTypes
Reviewed-by: jjg
1 /*
2 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
24 /*
25 * @test
26 * @bug 6604599
27 * @summary ToolProvider should be less compiler-specific
28 */
30 import java.io.*;
32 // verify that running accessing ToolProvider by itself does not
33 // trigger loading com.sun.tools.javac.*
34 public class ToolProviderTest1 {
35 public static void main(String... args) throws Exception {
36 if (args.length > 0) {
37 System.err.println(Class.forName(args[0], true, null));
38 return;
39 }
41 new ToolProviderTest1().run();
42 }
44 void run() throws Exception {
45 File javaHome = new File(System.getProperty("java.home"));
46 if (javaHome.getName().equals("jre"))
47 javaHome = javaHome.getParentFile();
48 File javaExe = new File(new File(javaHome, "bin"), "java");
49 String classpath = System.getProperty("java.class.path");
51 String[] cmd = {
52 javaExe.getPath(),
53 "-verbose:class",
54 "-classpath", classpath,
55 ToolProviderTest1.class.getName(),
56 "javax.tools.ToolProvider"
57 };
59 ProcessBuilder pb = new ProcessBuilder(cmd).redirectErrorStream(true);
60 Process p = pb.start();
61 BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
62 String line;
63 while ((line = r.readLine()) != null) {
64 System.err.println(line);
65 if (line.contains("com.sun.tools.javac."))
66 error(">>> " + line);
67 }
68 int rc = p.waitFor();
69 if (rc != 0)
70 error("Unexpected exit code: " + rc);
72 if (errors > 0)
73 throw new Exception(errors + " errors occurred");
74 }
76 void error(String msg) {
77 System.err.println(msg);
78 errors++;
79 }
81 int errors;
82 }