1 /*
2 * Copyright (c) 2013, 2016, 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 */
49 " public static void main(String[] args) {\n" +
50 " new SuperClass((args[0].equals(\"0\")) ? 0 : 1)\n" +
51 " .test();\n" +
52 " }\n" +
53 " Test(boolean b) {\n" +
54 " super(b ? 1 : 2);\n" +
55 " }\n" +
56 "}\n" +
57 "class SuperClass {\n" +
58 " double d;\n" +
59 " SuperClass(double dd) { d = dd; }\n" +
60 " double test() {\n" +
61 " if (d == 0)\n" +
62 " return d;\n" +
63 " else\n" +
64 " return d > 0 ? d++ : d--;\n" +
65 " }\n" +
66 "}\n";
67
68 private static final String goldenOut =
69 " frame_type = 255 /* full_frame */\n" +
70 " frame_type = 255 /* full_frame */\n" +
71 " frame_type = 73 /* same_locals_1_stack_item */\n" +
72 " frame_type = 255 /* full_frame */\n" +
73 " offset_delta = 19\n" +
74 " offset_delta = 0\n" +
75 " offset_delta = 2\n" +
76 " stack = [ uninitialized 0, uninitialized 0 ]\n" +
77 " stack = [ uninitialized 0, uninitialized 0, double ]\n" +
78 " stack = [ this ]\n" +
79 " stack = [ this, double ]\n" +
80 " locals = [ class \"[Ljava/lang/String;\" ]\n" +
81 " locals = [ class \"[Ljava/lang/String;\" ]\n" +
82 " locals = [ this, int ]\n";
83
84 public static void main(String[] args) throws Exception {
85 ToolBox tb = new ToolBox();
86
87 new JavacTask(tb)
88 .sources(TestSrc)
89 .run();
90
91 List<String> out = new JavapTask(tb)
92 .options("-v")
|
1 /*
2 * Copyright (c) 2013, 2025, 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 */
49 " public static void main(String[] args) {\n" +
50 " new SuperClass((args[0].equals(\"0\")) ? 0 : 1)\n" +
51 " .test();\n" +
52 " }\n" +
53 " Test(boolean b) {\n" +
54 " super(b ? 1 : 2);\n" +
55 " }\n" +
56 "}\n" +
57 "class SuperClass {\n" +
58 " double d;\n" +
59 " SuperClass(double dd) { d = dd; }\n" +
60 " double test() {\n" +
61 " if (d == 0)\n" +
62 " return d;\n" +
63 " else\n" +
64 " return d > 0 ? d++ : d--;\n" +
65 " }\n" +
66 "}\n";
67
68 private static final String goldenOut =
69 " frame_type = 255 /* full_entry */\n" +
70 " frame_type = 255 /* full_entry */\n" +
71 " frame_type = 73 /* same_locals_1_stack_item */\n" +
72 " frame_type = 255 /* full_entry */\n" +
73 " offset_delta = 19\n" +
74 " offset_delta = 0\n" +
75 " offset_delta = 2\n" +
76 " stack = [ uninitialized 0, uninitialized 0 ]\n" +
77 " stack = [ uninitialized 0, uninitialized 0, double ]\n" +
78 " stack = [ this ]\n" +
79 " stack = [ this, double ]\n" +
80 " locals = [ class \"[Ljava/lang/String;\" ]\n" +
81 " locals = [ class \"[Ljava/lang/String;\" ]\n" +
82 " locals = [ this, int ]\n";
83
84 public static void main(String[] args) throws Exception {
85 ToolBox tb = new ToolBox();
86
87 new JavacTask(tb)
88 .sources(TestSrc)
89 .run();
90
91 List<String> out = new JavapTask(tb)
92 .options("-v")
|