< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/interfaces/interfaces001.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  */

150             log1("new check: #" + i);
151 
152             //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part
153 
154             ReferenceType classRefType = null;
155             ReferenceType reftype      = null;
156             List          l            = null;
157             Method        m            = null;
158             String        name         = null;
159 
160             int i2;
161 
162             for (i2 = 0; ; i2++) {
163 
164                 int expresult = 0;
165 
166                 log2("new check: #" + i2);
167 
168                 switch (i2) {
169 
170                 case 0:         // Class0ForCheck - 0 interfaces
171 
172                         List list0 = vm.classesByName(mName + ".Class0ForCheck");
173 
174                         classRefType  = (ReferenceType) list0.get(0);
175 
176                         List iface0list =
177                              ((ClassType) classRefType).interfaces();
178 
179                         if (iface0list.size() != 0) {
180                             log3("ERROR : iface0list.size() != 0 in case: Class0ForCheck");
181                             expresult = 1;
182                             break;
183                         }
184 
185                         break;
186 
187                 case 1:         // Class1forCheck - 1 interface
188 
189                         List list1 = vm.classesByName(mName + ".Class1ForCheck");
190 
191                         classRefType  = (ReferenceType) list1.get(0);
192 
193                         List iface1list =
194                              ((ClassType) classRefType).interfaces();
195 
196                         if (iface1list.size() != 1) {
197                             log3("ERROR : iface1list.size() != 1 in case: Class1forCheck");
198                             expresult = 1;
199                             break;
200                         }
201 
202                         reftype = (ReferenceType) iface1list.get(0);
203                         name = reftype.name();
204                         if (!name.equals(mName + ".Iface1")) {
205                             log3("ERROR : !name.equals(mName + '.Iface1') in Class1forCheck");
206                             expresult = 1;
207                             break;
208                         }
209 
210                         break;
211 
212                 case 2:         // Class2ForCheck - 2 interfaces
213 
214                         List list2 = vm.classesByName(mName + ".Class2ForCheck");
215 
216                         classRefType  = (ReferenceType) list2.get(0);
217 
218                         List iface2list =
219                              ((ClassType) classRefType).interfaces();
220 
221                         if (iface2list.size() != 2) {
222                             log3("ERROR : iface1list.size() != 2 in case: Class2forCheck");
223                             expresult = 1;
224                             break;
225                         }
226 
227                         reftype = (ReferenceType) iface2list.get(0);
228                         name = reftype.name();
229                         if (!name.equals(mName + ".Iface2")) {
230                             if (!name.equals(mName + ".Iface3")) {
231                                 log3("ERROR : name1: !name.equals('.Iface1' or '.Iface3') in Class2forCheck");
232                                 expresult = 1;
233                                 break;
234                             }
235                         }
236                         reftype = (ReferenceType) iface2list.get(1);
237                         name = reftype.name();
238                         if (!name.equals(mName + ".Iface2")) {
239                             if (!name.equals(mName + ".Iface3")) {
240                                 log3("ERROR :name2: !name.equals('.Iface1' or '.Iface3') in Class2forCheck");
241                                 expresult = 1;
242                                 break;

  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  */

150             log1("new check: #" + i);
151 
152             //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part
153 
154             ReferenceType classRefType = null;
155             ReferenceType reftype      = null;
156             List          l            = null;
157             Method        m            = null;
158             String        name         = null;
159 
160             int i2;
161 
162             for (i2 = 0; ; i2++) {
163 
164                 int expresult = 0;
165 
166                 log2("new check: #" + i2);
167 
168                 switch (i2) {
169 
170                 case 0:         // Class0ForCheck - 1 interface (injected java.lang.IdentityObject)
171 
172                         List list0 = vm.classesByName(mName + ".Class0ForCheck");
173 
174                         classRefType  = (ReferenceType) list0.get(0);
175 
176                         List iface0list =
177                              ((ClassType) classRefType).interfaces();
178 
179                         if (iface0list.size() != 1) {
180                             log3("ERROR : iface0list.size() != 1 in case: Class0ForCheck");
181                             expresult = 1;
182                             break;
183                         }
184 
185                         break;
186 
187                 case 1:         // Class1forCheck - 2 interfaces (includes injected java.lang.IdentityObject)
188 
189                         List list1 = vm.classesByName(mName + ".Class1ForCheck");
190 
191                         classRefType  = (ReferenceType) list1.get(0);
192 
193                         List iface1list =
194                              ((ClassType) classRefType).interfaces();
195 
196                         if (iface1list.size() != 2) {
197                             log3("ERROR : iface1list.size() != 2 in case: Class1forCheck");
198                             expresult = 1;
199                             break;
200                         }
201 
202                         reftype = (ReferenceType) iface1list.get(0);
203                         name = reftype.name();
204                         if (!name.equals(mName + ".Iface1")) {
205                             log3("ERROR : !name.equals(mName + '.Iface1') in Class1forCheck");
206                             expresult = 1;
207                             break;
208                         }
209 
210                         break;
211 
212                 case 2:         // Class2ForCheck - 3 interfaces (includes injected java.lang.IdentityObject)
213 
214                         List list2 = vm.classesByName(mName + ".Class2ForCheck");
215 
216                         classRefType  = (ReferenceType) list2.get(0);
217 
218                         List iface2list =
219                              ((ClassType) classRefType).interfaces();
220 
221                         if (iface2list.size() != 3) {
222                             log3("ERROR : iface1list.size() != 3 in case: Class2forCheck");
223                             expresult = 1;
224                             break;
225                         }
226 
227                         reftype = (ReferenceType) iface2list.get(0);
228                         name = reftype.name();
229                         if (!name.equals(mName + ".Iface2")) {
230                             if (!name.equals(mName + ".Iface3")) {
231                                 log3("ERROR : name1: !name.equals('.Iface1' or '.Iface3') in Class2forCheck");
232                                 expresult = 1;
233                                 break;
234                             }
235                         }
236                         reftype = (ReferenceType) iface2list.get(1);
237                         name = reftype.name();
238                         if (!name.equals(mName + ".Iface2")) {
239                             if (!name.equals(mName + ".Iface3")) {
240                                 log3("ERROR :name2: !name.equals('.Iface1' or '.Iface3') in Class2forCheck");
241                                 expresult = 1;
242                                 break;
< prev index next >