1 /*
2 * Copyright (c) 2001, 2026, 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 */
23
24 package nsk.jdi.ModificationWatchpointEvent.valueToBe;
25
26 import nsk.share.*;
27 import nsk.share.jpda.*;
28 import nsk.share.jdi.*;
29
30
31 // This class is the debugged application in the test
32
33 class valuetobe001a {
34
35 static final int PASSED = 0;
36 static final int FAILED = 2;
37 static final int JCK_STATUS_BASE = 95;
38
39 static final String COMMAND_READY = "ready";
40 static final String COMMAND_QUIT = "quit";
41 static final String COMMAND_GO = "go";
42 static final String COMMAND_DONE = "done";
43
44
45 public static void main(String args[]) {
46 System.exit(JCK_STATUS_BASE + run(args));
47 }
48
49 static int run( String args[]) {
50 ArgumentHandler argHandler = new ArgumentHandler(args);
51 IOPipe pipe = argHandler.createDebugeeIOPipe();
52
53 // create instance of checked class
54 valuetobe001aCheckedClass foo = new valuetobe001aCheckedClass();
55 // initialize fields values
56 foo.init();
57
58 // notify debugger that debuggee started
59 pipe.println(COMMAND_READY);
60
61 // wait for command GO from debugger
62 String command = pipe.readln();
63 if (command.equals(COMMAND_QUIT)) {
64 return PASSED;
65 }
66 if (!command.equals(COMMAND_GO)) {
67 System.err.println("TEST BUG: unknown command: " + command);
68 return FAILED;
69 }
70
71 // perform actions
72 foo.run();
73
74 // notify debugger that the command done
75 pipe.println(COMMAND_DONE);
76
77 // wait for command QUIT from debugger and exit
78 command = pipe.readln();
79 if (!command.equals(COMMAND_QUIT)) {
80 System.err.println("TEST BUG: unknown command: " + command);
81 return FAILED;
82 }
83 return PASSED;
84 }
85 }
86
87 // class for checking
88 class valuetobe001aCheckedClass {
89
90 boolean z0, z1[], z2[][];
91 byte b0, b1[], b2[][];
92 char c0, c1[], c2[][];
93 double d0, d1[], d2[][];
94 float f0, f1[], f2[][];
95 int i0, i1[], i2[][];
96 long l0, l1[], l2[][];
97 short s0, s1[], s2[][];
98
99 static long lS0, lS1[], lS2[][];
100 private long lP0, lP1[], lP2[][];
101 public long lU0, lU1[], lU2[][];
102 protected long lR0, lR1[], lR2[][];
103 transient long lT0, lT1[], lT2[][];
104 volatile long lV0, lV1[], lV2[][];
105
106 Boolean Z0, Z1[], Z2[][];
107 Byte B0, B1[], B2[][];
108 Character C0, C1[], C2[][];
109 Double D0, D1[], D2[][];
110 Float F0, F1[], F2[][];
111 Integer I0, I1[], I2[][];
112 Long L0, L1[], L2[][];
113 String W0, W1[], W2[][];
114 Short S0, S1[], S2[][];
115 Object O0, O1[], O2[][];
116
117 static Long LS0, LS1[], LS2[][];
118 private Long LP0, LP1[], LP2[][];
119 public Long LU0, LU1[], LU2[][];
120 protected Long LR0, LR1[], LR2[][];
121 transient Long LT0, LT1[], LT2[][];
122 volatile Long LV0, LV1[], LV2[][];
123
124 interface Inter {}
125 class Class implements Inter {}
126 Class X0, X1[], X2[][];
127 Inter E0, E1[], E2[][];
128 static Inter ES0, ES1[], ES2[][];
129 private Inter EP0, EP1[], EP2[][];
130 public Inter EU0, EU1[], EU2[][];
131 protected Inter ER0, ER1[], ER2[][];
132 transient Inter ET0, ET1[], ET2[][];
133 volatile Inter EV0, EV1[], EV2[][];
134
135 // initializa fields values
136 void init() {
137 z0 = false;
138 b0 = java.lang.Byte.MIN_VALUE;
139 c0 = java.lang.Character.MIN_VALUE;
140 d0 = java.lang.Double.MIN_VALUE;
141 f0 = java.lang.Float.MIN_VALUE;
142 i0 = java.lang.Integer.MIN_VALUE;
143 l0 = java.lang.Long.MIN_VALUE;
144 s0 = java.lang.Short.MIN_VALUE;
145
146 initFields();
147 }
148
149 // change fields values
150 void run() {
151 z0 = true;
152 b0 = java.lang.Byte.MAX_VALUE;
153 c0 = java.lang.Character.MAX_VALUE;
154 d0 = java.lang.Double.MAX_VALUE;
155 f0 = java.lang.Float.MAX_VALUE;
156 i0 = java.lang.Integer.MAX_VALUE;
157 l0 = java.lang.Long.MAX_VALUE;
158 s0 = java.lang.Short.MAX_VALUE;
159
160 initFields();
161 }
162
163 // calculate new fields values
164 void initFields() {
165
166 z1 = new boolean[] {z0};
167 z2 = new boolean[][] {z1};
168 b1 = new byte[] {b0};
169 b2 = new byte[][] {b1};
170 c1 = new char[] {c0};
171 c2 = new char[][] {c1};
172 d1 = new double[] {d0};
173 d2 = new double[][] {d1};
174 f1 = new float[] {f0};
175 f2 = new float[][] {f1};
176 i1 = new int[] {i0};
177 i2 = new int[][] {i1};
178 l1 = new long[] {l0};
179 l2 = new long[][] {l1};
180 s1 = new short[] {s0};
181 s2 = new short[][] {s1};
182
183 lS0 = l0;
184 lP0 = l0;
185 lU0 = l0;
186 lR0 = l0;
187 lT0 = l0;
188 lV0 = l0;
189
190 lS1 = new long[] {lS0};
191 lS2 = new long[][] {lS1};
192 lP1 = new long[] {lP0};
193 lP2 = new long[][] {lP1};
194 lU1 = new long[] {lU0};
195 lU2 = new long[][] {lU1};
196 lR1 = new long[] {lR0};
197 lR2 = new long[][] {lR1};
198 lT1 = new long[] {lT0};
199 lT2 = new long[][] {lT1};
200 lV1 = new long[] {lV0};
201 lV2 = new long[][] {lV1};
202
203 X0 = new Class();
204 X1 = new Class[] {X0};
205 X2 = new Class[][] {X1};
206 Z0 = new Boolean(z0);
207 Z1 = new Boolean[] {Z0};
208 Z2 = new Boolean[][] {Z1};
209 B0 = new Byte(b0);
210 B1 = new Byte[] {B0};
211 B2 = new Byte[][] {B1};
212 C0 = new Character(c0);
213 C1 = new Character[] {C0};
214 C2 = new Character[][]{C1};
215 D0 = Double.valueOf(d0);
216 D1 = new Double[] {D0};
217 D2 = new Double[][] {D1};
218 F0 = Float.valueOf(f0);
219 F1 = new Float[] {F0};
220 F2 = new Float[][] {F1};
221 I0 = Integer.valueOf(i0);
222 I1 = new Integer[] {I0};
223 I2 = new Integer[][] {I1};
224 L0 = Long.valueOf(l0);
225 L1 = new Long[] {L0};
226 L2 = new Long[][] {L1};
227 S0 = Short.valueOf(s0);
228 S1 = new Short[] {S0};
229 S2 = new Short[][] {S1};
230 W0 = new String();
231 W1 = new String[] {W0};
232 W2 = new String[][] {W1};
233 O0 = new Object();
234 O1 = new Object[] {O0};
235 O2 = new Object[][] {O1};
236
237 LS0 = Long.valueOf(l0);
238 LS1 = new Long[] {LS0};
239 LS2 = new Long[][] {LS1};
240 LP0 = Long.valueOf(l0);
241 LP1 = new Long[] {LP0};
242 LP2 = new Long[][] {LP1};
243 LU0 = Long.valueOf(l0);
244 LU1 = new Long[] {LU0};
245 LU2 = new Long[][] {LU1};
246 LR0 = Long.valueOf(l0);
247 LR1 = new Long[] {LR0};
248 LR2 = new Long[][] {LR1};
249 LT0 = Long.valueOf(l0);
250 LT1 = new Long[] {LT0};
251 LT2 = new Long[][] {LT1};
252 LV0 = Long.valueOf(l0);
253 LV1 = new Long[] {LV0};
254 LV2 = new Long[][] {LV1};
255
256 E0 = new Class();
257 E1 = new Inter[] {E0};
258 E2 = new Inter[][] {E1};
259 ES0 = new Class();
260 ES1 = new Inter[] {ES0};
261 ES2 = new Inter[][] {ES1};
262 EP0 = new Class();
263 EP1 = new Inter[] {EP0};
264 EP2 = new Inter[][] {EP1};
265 EU0 = new Class();
266 EU1 = new Inter[] {EU0};
267 EU2 = new Inter[][] {EU1};
268 ER0 = new Class();
269 ER1 = new Inter[] {ER0};
270 ER2 = new Inter[][] {ER1};
271 ET0 = new Class();
272 ET1 = new Inter[] {ET0};
273 ET2 = new Inter[][] {ET1};
274 EV0 = new Class();
275 EV1 = new Inter[] {EV0};
276 EV2 = new Inter[][] {EV1};
277 }
278
279 }