equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
25 * @test |
25 * @test |
26 * @bug 6604599 |
26 * @bug 6604599 |
27 * @summary ToolProvider should be less compiler-specific |
27 * @summary ToolProvider should be less compiler-specific |
28 * @library /tools/lib |
28 * @library /tools/lib |
29 * @modules jdk.compiler/com.sun.tools.javac.api |
29 * @modules jdk.compiler/com.sun.tools.javac.api |
30 * jdk.compiler/com.sun.tools.javac.file |
|
31 * jdk.compiler/com.sun.tools.javac.main |
30 * jdk.compiler/com.sun.tools.javac.main |
32 * jdk.jdeps/com.sun.tools.javap |
31 * @build toolbox.ToolBox toolbox.JavaTask |
33 * @build ToolBox |
|
34 * @run main ToolProviderTest1 |
32 * @run main ToolProviderTest1 |
35 */ |
33 */ |
36 |
34 |
37 import java.util.List; |
35 import java.util.List; |
|
36 |
|
37 import toolbox.JavaTask; |
|
38 import toolbox.Task; |
|
39 import toolbox.ToolBox; |
38 |
40 |
39 // verify that running accessing ToolProvider by itself does not |
41 // verify that running accessing ToolProvider by itself does not |
40 // trigger loading com.sun.tools.javac.* |
42 // trigger loading com.sun.tools.javac.* |
41 public class ToolProviderTest1 { |
43 public class ToolProviderTest1 { |
42 public static void main(String... args) throws Exception { |
44 public static void main(String... args) throws Exception { |
50 |
52 |
51 void run() throws Exception { |
53 void run() throws Exception { |
52 ToolBox tb = new ToolBox(); |
54 ToolBox tb = new ToolBox(); |
53 String classpath = System.getProperty("java.class.path"); |
55 String classpath = System.getProperty("java.class.path"); |
54 |
56 |
55 List<String> lines = tb.new JavaTask() |
57 List<String> lines = new JavaTask(tb) |
56 .vmOptions("-verbose:class") |
58 .vmOptions("-verbose:class") |
57 .classpath(classpath) |
59 .classpath(classpath) |
58 .className(getClass().getName()) |
60 .className(getClass().getName()) |
59 .classArgs("javax.tools.ToolProvider") |
61 .classArgs("javax.tools.ToolProvider") |
60 .run() |
62 .run() |
61 .getOutputLines(ToolBox.OutputKind.STDOUT); |
63 .getOutputLines(Task.OutputKind.STDOUT); |
62 |
64 |
63 for (String line : lines) { |
65 for (String line : lines) { |
64 System.err.println(line); |
66 System.err.println(line); |
65 if (line.contains("com.sun.tools.javac.")) |
67 if (line.contains("com.sun.tools.javac.")) |
66 error(">>> " + line); |
68 error(">>> " + line); |