1 /*
2  * Copyright (c) 2002, 2018, 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.watch.watch002;
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 watch002a {
34     /* TEST DEPENDANT VARIABLES AND CONSTANTS */
35     static final String PACKAGE_NAME = "nsk.jdb.watch.watch002";
36 
main(String args[])37     public static void main(String args[]) {
38        watch002a _watch002a = new watch002a();
39        System.exit(watch002.JCK_STATUS_BASE + _watch002a.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         log.display("Debuggee PASSED");
53         return watch002.PASSED;
54     }
55 
56     static    boolean fS0, fS1[], fS2[][];
57     static    Boolean FS0, FS1[], FS2[][];
58 
59     interface Inter {}
60     Inter     I0, I1[], I2[][];
61 
62     // assign new values to fields
updateFields(boolean flag)63     void updateFields(boolean flag) {
64 
65         fS0 = flag ? fS0 : false;
66         fS1 = flag ? fS1 : new boolean[] {fS0};
67         fS2 = flag ? fS2 : new boolean[][] {fS1};
68 
69         FS0 = flag ? FS0 : new Boolean(false);
70         FS1 = flag ? FS1 : new Boolean[] {FS0};
71         FS2 = flag ? FS2 : new Boolean[][] {FS1};
72 
73         I0  = flag ? I0  : new CheckedFields();
74         I1  = flag ? I1  : new CheckedFields[]   {new CheckedFields()};
75         I2  = flag ? I2  : new CheckedFields[][] {new CheckedFields[] {new CheckedFields()}};
76     }
77 
78     class CheckedFields implements Inter {
79 
80         private   byte    fP0, fP1[], fP2[][];
81         public    char    fU0, fU1[], fU2[][];
82         protected double  fR0, fR1[], fR2[][];
83         transient float   fT0, fT1[], fT2[][];
84         volatile  long    fV0, fV1[], fV2[][];
85 
86         private   Byte      FP0, FP1[], FP2[][];
87         public    Character FU0, FU1[], FU2[][];
88         protected Double    FR0, FR1[], FR2[][];
89         transient Float     FT0, FT1[], FT2[][];
90         volatile  Long      FV0, FV1[], FV2[][];
91 
92         // assign new values to fields
updateFields(boolean flag)93         void updateFields(boolean flag) {
94 
95             fP0 = flag ? fP0 : Byte.MIN_VALUE ;
96             fU0 = flag ? fU0 : Character.MIN_VALUE;
97             fR0 = flag ? fR0 : Double.MIN_VALUE;
98             fT0 = flag ? fT0 : Float.MIN_VALUE;
99             fV0 = flag ? fV0 : Integer.MIN_VALUE;
100 
101             FP0 = flag ? FP0 : new Byte(Byte.MIN_VALUE) ;
102             FU0 = flag ? FU0 : new Character(Character.MIN_VALUE);
103             FR0 = flag ? FR0 : new Double(Double.MIN_VALUE);
104             FT0 = flag ? FT0 : new Float(Float.MIN_VALUE);
105             FV0 = flag ? FV0 : new Long(Long.MIN_VALUE);
106 
107             fP1 = flag ? fP1 : new byte[] {fP0};
108             fP2 = flag ? fP2 : new byte[][] {fP1};
109             fU1 = flag ? fU1 : new char[] {fU0};
110             fU2 = flag ? fU2 : new char[][] {fU1};
111             fR1 = flag ? fR1 : new double[] {fR0};
112             fR2 = flag ? fR2 : new double[][] {fR1};
113             fT1 = flag ? fT1 : new float[] {fT0};
114             fT2 = flag ? fT2 : new float[][] {fT1};
115             fV1 = flag ? fV1 : new long[] {fV0};
116             fV2 = flag ? fV2 : new long[][] {fV1};
117 
118             FP1 = flag ? FP1 : new Byte[] {FP0};
119             FP2 = flag ? FP2 : new Byte[][] {FP1};
120             FU1 = flag ? FU1 : new Character[] {FU0};
121             FU2 = flag ? FU2 : new Character[][] {FU1};
122             FR1 = flag ? FR1 : new Double[] {FR0};
123             FR2 = flag ? FR2 : new Double[][] {FR1};
124             FT1 = flag ? FT1 : new Float[] {FT0};
125             FT2 = flag ? FT2 : new Float[][] {FT1};
126             FV1 = flag ? FV1 : new Long[] {FV0};
127             FV2 = flag ? FV2 : new Long[][] {FV1};
128         }
129     }
130 
131     CheckedFields fields;
132 
watch002a()133     public watch002a() {
134         fields = new CheckedFields();
135     }
136 }
137