< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/jdi/InterfaceType/subinterfaces/subinterfaces001.java

Print this page

  1 /*
  2  * Copyright (c) 2001, 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  */

160 
161             int i2;
162 
163             for (i2 = 0; ; i2++) {
164 
165                 int expresult = 0;
166 
167                 log2("new check: #" + i2);
168 
169                 switch (i2) {
170 
171                 case 0:         // Iface3 - 0 subinterfaces
172 
173                         List list0 = vm.classesByName(mName + ".Class3ForCheck");
174 
175                         classRefType  = (ReferenceType) list0.get(0);
176 
177                         List iface0list =
178                              ((ClassType) classRefType).interfaces();
179 
180                         if (iface0list.size() != 1) {
181                             log3("ERROR : iface0list.size() != 1  in case: Iface3");
182                             expresult = 1;
183                             break;
184                         }
185 
186                         ifaceType  = (InterfaceType) iface0list.get(0);
187                         if (ifaceType.subinterfaces().size() != 0) {
188                             log3("ERROR : ifaceType.subinterfaces().size() != 0  in case: Iface3");
189                             expresult = 1;
190                             break;
191                         }
192 
193                         break;
194 
195                 case 1:         // Iface2 - 1 subinterfaces
196 
197                         List list1 = vm.classesByName(mName + ".Class2ForCheck");
198 
199                         classRefType  = (ReferenceType) list1.get(0);
200 
201                         List iface1list =
202                              ((ClassType) classRefType).interfaces();
203 
204                         if (iface1list.size() != 1) {
205                             log3("ERROR : iface1list.size() != 1  in case: Iface2");
206                             expresult = 1;
207                             break;
208                         }
209 
210                         ifaceType  = (InterfaceType) iface1list.get(0);
211                         l = ifaceType.subinterfaces();
212                         if (l.size() != 1) {
213                             log3("ERROR : ifaceType.subinterfaces().size() != 1  in case: Iface2");
214                             expresult = 1;
215                             break;
216                         }
217 
218                         itype = (InterfaceType) l.get(0);
219                         name = itype.name();
220                         if (!name.equals(mName + ".Iface3")) {
221                             log3("ERROR : !name.equals(mName + '.Iface3') in case: Iface2");
222                             expresult = 1;
223                             break;
224                         }
225 
226                         break;
227 
228                 case 2:         // Iface1 - 2 subinterfaces
229 
230                         List list3 = vm.classesByName(mName + ".Class1ForCheck");
231 
232                         classRefType  = (ReferenceType) list3.get(0);
233 
234                         List iface3list =
235                              ((ClassType) classRefType).interfaces();
236 
237                         if (iface3list.size() != 1) {
238                             log3("ERROR : iface3list.size() != 1  in case: Iface1");
239                             expresult = 1;
240                             break;
241                         }
242 
243                         ifaceType  = (InterfaceType) iface3list.get(0);
244                         l = ifaceType.subinterfaces();
245                         if (l.size() != 2) {
246                             log3("ERROR : ifaceType.subinterfaces().size() != 1  in case: Iface1");
247                             expresult = 1;
248                             break;
249                         }
250 
251                         itype = (InterfaceType) l.get(0);
252                         name = itype.name();
253                         if (!name.equals(mName + ".Iface2")) {
254                             if (!name.equals(mName + ".Iface4")) {
255                                 log3("ERROR : !name.equals('.Iface2' or '.Iface4') in case: Iface1");
256                                 expresult = 1;
257                                 break;
258                             }

  1 /*
  2  * Copyright (c) 2001, 2020, 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  */

160 
161             int i2;
162 
163             for (i2 = 0; ; i2++) {
164 
165                 int expresult = 0;
166 
167                 log2("new check: #" + i2);
168 
169                 switch (i2) {
170 
171                 case 0:         // Iface3 - 0 subinterfaces
172 
173                         List list0 = vm.classesByName(mName + ".Class3ForCheck");
174 
175                         classRefType  = (ReferenceType) list0.get(0);
176 
177                         List iface0list =
178                              ((ClassType) classRefType).interfaces();
179 
180                         if (iface0list.size() != 2) { // includes injected java.lang.IdentityObject
181                             log3("ERROR : iface0list.size() != 2  in case: Iface3");
182                             expresult = 1;
183                             break;
184                         }
185 
186                         ifaceType  = (InterfaceType) iface0list.get(0);
187                         if (ifaceType.subinterfaces().size() != 0) {
188                             log3("ERROR : ifaceType.subinterfaces().size() != 0  in case: Iface3");
189                             expresult = 1;
190                             break;
191                         }
192 
193                         break;
194 
195                 case 1:         // Iface2 - 1 subinterfaces
196 
197                         List list1 = vm.classesByName(mName + ".Class2ForCheck");
198 
199                         classRefType  = (ReferenceType) list1.get(0);
200 
201                         List iface1list =
202                              ((ClassType) classRefType).interfaces();
203 
204                         if (iface1list.size() != 2) { // includes injected java.lang.IdentityObject
205                             log3("ERROR : iface1list.size() != 2  in case: Iface2");
206                             expresult = 1;
207                             break;
208                         }
209 
210                         ifaceType  = (InterfaceType) iface1list.get(0);
211                         l = ifaceType.subinterfaces();
212                         if (l.size() != 1) {
213                             log3("ERROR : ifaceType.subinterfaces().size() != 1  in case: Iface2");
214                             expresult = 1;
215                             break;
216                         }
217 
218                         itype = (InterfaceType) l.get(0);
219                         name = itype.name();
220                         if (!name.equals(mName + ".Iface3")) {
221                             log3("ERROR : !name.equals(mName + '.Iface3') in case: Iface2");
222                             expresult = 1;
223                             break;
224                         }
225 
226                         break;
227 
228                 case 2:         // Iface1 - 2 subinterfaces
229 
230                         List list3 = vm.classesByName(mName + ".Class1ForCheck");
231 
232                         classRefType  = (ReferenceType) list3.get(0);
233 
234                         List iface3list =
235                              ((ClassType) classRefType).interfaces();
236 
237                         if (iface3list.size() != 2) { // includes injected java.lang.IdentityObject
238                             log3("ERROR : iface3list.size() != 2  in case: Iface1");
239                             expresult = 1;
240                             break;
241                         }
242 
243                         ifaceType  = (InterfaceType) iface3list.get(0);
244                         l = ifaceType.subinterfaces();
245                         if (l.size() != 2) {
246                             log3("ERROR : ifaceType.subinterfaces().size() != 1  in case: Iface1");
247                             expresult = 1;
248                             break;
249                         }
250 
251                         itype = (InterfaceType) l.get(0);
252                         name = itype.name();
253                         if (!name.equals(mName + ".Iface2")) {
254                             if (!name.equals(mName + ".Iface4")) {
255                                 log3("ERROR : !name.equals('.Iface2' or '.Iface4') in case: Iface1");
256                                 expresult = 1;
257                                 break;
258                             }
< prev index next >