equal
deleted
inserted
replaced
25 * @test |
25 * @test |
26 * @bug 8025505 |
26 * @bug 8025505 |
27 * @summary Constant folding deficiency |
27 * @summary Constant folding deficiency |
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 * jdk.jdeps/com.sun.tools.javap |
33 * @build ToolBox |
32 * @build toolbox.ToolBox toolbox.JavapTask |
34 * @run main ConstFoldTest |
33 * @run main ConstFoldTest |
35 */ |
34 */ |
36 |
35 |
37 import java.net.URL; |
36 import java.net.URL; |
38 import java.nio.file.Path; |
37 import java.nio.file.Path; |
39 import java.nio.file.Paths; |
38 import java.nio.file.Paths; |
40 import java.util.List; |
39 import java.util.List; |
|
40 |
|
41 import toolbox.JavapTask; |
|
42 import toolbox.Task; |
|
43 import toolbox.ToolBox; |
41 |
44 |
42 public class ConstFoldTest { |
45 public class ConstFoldTest { |
43 public static void main(String... args) throws Exception { |
46 public static void main(String... args) throws Exception { |
44 new ConstFoldTest().run(); |
47 new ConstFoldTest().run(); |
45 } |
48 } |
80 void run() throws Exception { |
83 void run() throws Exception { |
81 ToolBox tb = new ToolBox(); |
84 ToolBox tb = new ToolBox(); |
82 |
85 |
83 URL url = ConstFoldTest.class.getResource("ConstFoldTest$CFTest.class"); |
86 URL url = ConstFoldTest.class.getResource("ConstFoldTest$CFTest.class"); |
84 Path file = Paths.get(url.toURI()); |
87 Path file = Paths.get(url.toURI()); |
85 List<String> result = tb.new JavapTask() |
88 List<String> result = new JavapTask(tb) |
86 .options("-c") |
89 .options("-c") |
87 .classes(file.toString()) |
90 .classes(file.toString()) |
88 .run() |
91 .run() |
89 .write(ToolBox.OutputKind.DIRECT) |
92 .write(Task.OutputKind.DIRECT) |
90 .getOutputLines(ToolBox.OutputKind.DIRECT); |
93 .getOutputLines(Task.OutputKind.DIRECT); |
91 |
94 |
92 List<String> bad_codes = tb.grep(regex, result); |
95 List<String> bad_codes = tb.grep(regex, result); |
93 if (!bad_codes.isEmpty()) { |
96 if (!bad_codes.isEmpty()) { |
94 for (String code : bad_codes) |
97 for (String code : bad_codes) |
95 System.out.println("Bad OpCode Found: " + code); |
98 System.out.println("Bad OpCode Found: " + code); |