langtools/test/tools/javap/stackmap/StackmapTest.java
changeset 36778 e04318f39f92
parent 36526 3b41f1c69604
equal deleted inserted replaced
36777:28d33fb9097f 36778:e04318f39f92
    25  * @test
    25  * @test
    26  * @bug 6271292
    26  * @bug 6271292
    27  * @summary Verify that javap prints StackMapTable attribute contents
    27  * @summary Verify that javap prints StackMapTable attribute contents
    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.JavacTask toolbox.JavapTask
    34  * @run main StackmapTest
    33  * @run main StackmapTest
    35  */
    34  */
    36 
    35 
    37 import java.util.ArrayList;
    36 import java.util.ArrayList;
    38 import java.util.List;
    37 import java.util.List;
       
    38 
       
    39 import toolbox.JavacTask;
       
    40 import toolbox.JavapTask;
       
    41 import toolbox.Task;
       
    42 import toolbox.ToolBox;
    39 
    43 
    40 // Original test: test/tools/javap/stackmap/T6271292.sh
    44 // Original test: test/tools/javap/stackmap/T6271292.sh
    41 public class StackmapTest {
    45 public class StackmapTest {
    42 
    46 
    43     private static final String TestSrc =
    47     private static final String TestSrc =
    78         "          locals = [ this, int ]\n";
    82         "          locals = [ this, int ]\n";
    79 
    83 
    80     public static void main(String[] args) throws Exception {
    84     public static void main(String[] args) throws Exception {
    81         ToolBox tb = new ToolBox();
    85         ToolBox tb = new ToolBox();
    82 
    86 
    83         tb.new JavacTask()
    87         new JavacTask(tb)
    84                 .sources(TestSrc)
    88                 .sources(TestSrc)
    85                 .run();
    89                 .run();
    86 
    90 
    87         List<String> out = tb.new JavapTask()
    91         List<String> out = new JavapTask(tb)
    88                 .options("-v")
    92                 .options("-v")
    89                 .classes("Test.class")
    93                 .classes("Test.class")
    90                 .run()
    94                 .run()
    91                 .getOutputLines(ToolBox.OutputKind.DIRECT);
    95                 .getOutputLines(Task.OutputKind.DIRECT);
    92 
    96 
    93         List<String> grepResult = new ArrayList<>();
    97         List<String> grepResult = new ArrayList<>();
    94         grepResult.addAll(tb.grep("frame_type",   out));
    98         grepResult.addAll(tb.grep("frame_type",   out));
    95         grepResult.addAll(tb.grep("offset_delta", out));
    99         grepResult.addAll(tb.grep("offset_delta", out));
    96         grepResult.addAll(tb.grep("stack = ",     out));
   100         grepResult.addAll(tb.grep("stack = ",     out));