1 /*
2  * Copyright (c) 2002, 2021, 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.jdb.unwatch.unwatch002;
25 
26 import nsk.share.*;
27 import nsk.share.jpda.*;
28 import nsk.share.jdb.*;
29 
30 import java.io.*;
31 
32 /* This is debuggee aplication */
33 public class unwatch002a {
34     /* TEST DEPENDANT VARIABLES AND CONSTANTS */
35     static final String PACKAGE_NAME = "nsk.jdb.unwatch.unwatch002";
36 
main(String args[])37     public static void main(String args[]) {
38        unwatch002a _unwatch002a = new unwatch002a();
39        System.exit(unwatch002.JCK_STATUS_BASE + _unwatch002a.runIt(args, System.out));
40     }
41 
breakHere()42     static void breakHere () {}
43 
runIt(String args[], PrintStream out)44     public int runIt(String args[], PrintStream out) {
45         JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
46         Log log = new Log(out, argumentHandler);
47 
48         breakHere();
49         updateFields(false);
50         fields.updateFields(false);
51 
52         breakHere();
53         updateFields(false);
54         fields.updateFields(false);
55 
56         log.display("Debuggee PASSED");
57         return unwatch002.PASSED;
58     }
59 
60     static    boolean fS0, fS1[], fS2[][];
61     static    Boolean FS0, FS1[], FS2[][];
62 
63     interface Inter {}
64     Inter     I0, I1[], I2[][];
65 
66     // assign new values to fields
updateFields(boolean flag)67     void updateFields(boolean flag) {
68 
69         fS0 = flag ? fS0 : false;
70         fS1 = flag ? fS1 : new boolean[] {fS0};
71         fS2 = flag ? fS2 : new boolean[][] {fS1};
72 
73         FS0 = flag ? FS0 : Boolean.valueOf(false);
74         FS1 = flag ? FS1 : new Boolean[] {FS0};
75         FS2 = flag ? FS2 : new Boolean[][] {FS1};
76 
77         I0  = flag ? I0  : new CheckedFields();
78         I1  = flag ? I1  : new CheckedFields[]   {new CheckedFields()};
79         I2  = flag ? I2  : new CheckedFields[][] {new CheckedFields[] {new CheckedFields()}};
80     }
81 
82     class CheckedFields implements Inter {
83 
84         private   byte    fP0, fP1[], fP2[][];
85         public    char    fU0, fU1[], fU2[][];
86         protected double  fR0, fR1[], fR2[][];
87         transient float   fT0, fT1[], fT2[][];
88         volatile  long    fV0, fV1[], fV2[][];
89 
90         private   Byte      FP0, FP1[], FP2[][];
91         public    Character FU0, FU1[], FU2[][];
92         protected Double    FR0, FR1[], FR2[][];
93         transient Float     FT0, FT1[], FT2[][];
94         volatile  Long      FV0, FV1[], FV2[][];
95 
96         // assign new values to fields
updateFields(boolean flag)97         void updateFields(boolean flag) {
98 
99             fP0 = flag ? fP0 : Byte.MIN_VALUE ;
100             fU0 = flag ? fU0 : Character.MIN_VALUE;
101             fR0 = flag ? fR0 : Double.MIN_VALUE;
102             fT0 = flag ? fT0 : Float.MIN_VALUE;
103             fV0 = flag ? fV0 : Integer.MIN_VALUE;
104 
105             FP0 = flag ? FP0 : Byte.valueOf(Byte.MIN_VALUE) ;
106             FU0 = flag ? FU0 : Character.valueOf(Character.MIN_VALUE);
107             FR0 = flag ? FR0 : Double.valueOf(Double.MIN_VALUE);
108             FT0 = flag ? FT0 : Float.valueOf(Float.MIN_VALUE);
109             FV0 = flag ? FV0 : Long.valueOf(Long.MIN_VALUE);
110 
111             fP1 = flag ? fP1 : new byte[] {fP0};
112             fP2 = flag ? fP2 : new byte[][] {fP1};
113             fU1 = flag ? fU1 : new char[] {fU0};
114             fU2 = flag ? fU2 : new char[][] {fU1};
115             fR1 = flag ? fR1 : new double[] {fR0};
116             fR2 = flag ? fR2 : new double[][] {fR1};
117             fT1 = flag ? fT1 : new float[] {fT0};
118             fT2 = flag ? fT2 : new float[][] {fT1};
119             fV1 = flag ? fV1 : new long[] {fV0};
120             fV2 = flag ? fV2 : new long[][] {fV1};
121 
122             FP1 = flag ? FP1 : new Byte[] {FP0};
123             FP2 = flag ? FP2 : new Byte[][] {FP1};
124             FU1 = flag ? FU1 : new Character[] {FU0};
125             FU2 = flag ? FU2 : new Character[][] {FU1};
126             FR1 = flag ? FR1 : new Double[] {FR0};
127             FR2 = flag ? FR2 : new Double[][] {FR1};
128             FT1 = flag ? FT1 : new Float[] {FT0};
129             FT2 = flag ? FT2 : new Float[][] {FT1};
130             FV1 = flag ? FV1 : new Long[] {FV0};
131             FV2 = flag ? FV2 : new Long[][] {FV1};
132         }
133     }
134 
135     CheckedFields fields;
136 
unwatch002a()137     public unwatch002a() {
138         fields = new CheckedFields();
139     }
140 }
141