1 /* 2 * Copyright (c) 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 25 // Test that a VerifyError exception is thrown when trying to pass a value 26 // type array when the formal parameter is an array of an interface type. 27 // 28 // // Java program emulating the jcod contents. 29 // interface II { } 30 // 31 // public value final class NoArrayCovIntf { 32 // final int x; 33 // final int y; 34 // 35 // private NoArrayCovIntf() { 36 // x = 0; 37 // y = 0; 38 // } 39 // 40 // public int getX() { return x; } 41 // public int getY() { return y; } 42 // 43 // public String toString() { 44 // return "NoArrayCovIntf: x=" + getX() + " y=" + getY(); 45 // } 46 // 47 // public void iiArray(ii[] oArr) { 48 // System.out.println("In iiArray"); 49 // } 50 // 51 // public static NoArrayCovIntf createNoArrayCovIntf(int x, int y) { 52 // NoArrayCovIntf p = NoArrayCovIntf.default; 53 // p = __WithField(p.x, x); 54 // p = __WithField(p.y, y); 55 // return p; 56 // } 57 // 58 // public static void main(String[] args) { 59 // NoArrayCovIntf a = createNoArrayCovIntf(3, 4); 60 // NoArrayCovIntf b = createNoArrayCovIntf(2, 4); 61 // NoArrayCovIntf pa[] = new NoArrayCovIntf[2]; 62 // pa[0] = a; 63 // pa[1] = b; 64 // a.iiArray(pa); // Should throw VerifyError. 65 // } 66 // } 67 68 69 class II { 70 0xCAFEBABE; 71 0; // minor version 72 57; // version 73 [7] { // Constant Pool 74 ; // first element is empty 75 class #5; // #1 at 0x0A 76 class #6; // #2 at 0x0D 77 Utf8 "SourceFile"; // #3 at 0x10 78 Utf8 "II.java"; // #4 at 0x1D 79 Utf8 "II"; // #5 at 0x33 80 Utf8 "java/lang/Object"; // #6 at 0x37 81 } // Constant Pool 82 83 0x0600; // access [ ACC_INTERFACE ] 84 #1;// this_cpx 85 #2;// super_cpx 86 87 [0] { // Interfaces 88 } // Interfaces 89 90 [0] { // fields 91 } // fields 92 93 [0] { // methods 94 } // methods 95 96 [1] { // Attributes 97 Attr(#3, 2) { // SourceFile at 0x58 98 #4; 99 } // end SourceFile 100 } // Attributes 101 } // end class II 102 103 104 class NoArrayCovIntf { 105 0xCAFEBABE; 106 0; // minor version 107 57; // version 108 [99] { // Constant Pool 109 ; // first element is empty 110 String #58; // #1 at 0x0A 111 Method #66 #19; // #2 at 0x0D 112 InvokeDynamic 3s #63; // #3 at 0x12 113 class #38; // #4 at 0x17 114 class #39; // #5 at 0x1A 115 Method #24 #50; // #6 at 0x1D 116 Method #4 #85; // #7 at 0x22 117 InvokeDynamic 1s #36; // #8 at 0x27 118 Method #4 #73; // #9 at 0x2C 119 Field #65 #89; // #10 at 0x31 120 InvokeDynamic 2s #30; // #11 at 0x36 121 Method #4 #57; // #12 at 0x3B 122 Field #4 #34; // #13 at 0x40 123 Field #4 #56; // #14 at 0x45 124 InvokeDynamic 0s #93; // #15 at 0x4A 125 Method #4 #32; // #16 at 0x4F 126 Utf8 "java/io/PrintStream"; // #17 at 0x54 127 Utf8 "NoArrayCovIntf.jasm"; // #18 at 0x6A 128 NameAndType #88 #62; // #19 at 0x80 129 Utf8 "([LII;)V"; // #20 at 0x85 130 Utf8 "java/lang/invoke/ValueBootstrapMethods"; // #21 at 0x8F 131 Utf8 "java/lang/invoke/MethodHandles$Lookup"; // #22 at 0xB8 132 MethodHandle 6b #43; // #23 at 0xE0 133 class #17; // #24 at 0xE4 134 Utf8 "SourceFile"; // #25 at 0xE7 135 Utf8 "iiArray"; // #26 at 0xF4 136 class #21; // #27 at 0xFF 137 Utf8 "Lookup"; // #28 at 0x0102 138 class #22; // #29 at 0x010B 139 NameAndType #60 #40; // #30 at 0x010E 140 Utf8 "hashCode"; // #31 at 0x0113 141 NameAndType #77 #75; // #32 at 0x011E 142 Utf8 "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;"; // #33 at 0x0123 143 NameAndType #95 #35; // #34 at 0x01BE 144 Utf8 "I"; // #35 at 0x01C3 145 NameAndType #31 #68; // #36 at 0x01C7 146 Utf8 "Code"; // #37 at 0x01CC 147 Utf8 "NoArrayCovIntf"; // #38 at 0x01D3 148 Utf8 "QNoArrayCovIntf;"; // #39 at 0x01E4 149 Utf8 "(Ljava/lang/Object;Ljava/lang/Object;)Z"; // #40 at 0x01F7 150 NameAndType #91 #33; // #41 at 0x0221 151 Utf8 "createNoArrayCovIntf"; // #42 at 0x0226 152 Method #96 #41; // #43 at 0x023D 153 Utf8 "([Ljava/lang/String;)V"; // #44 at 0x0242 154 Utf8 "out"; // #45 at 0x025B 155 Utf8 "$makeValue$"; // #46 at 0x0261 156 Utf8 "BootstrapMethods"; // #47 at 0x026F 157 String #67; // #48 at 0x0282 158 Utf8 "toString"; // #49 at 0x0285 159 NameAndType #53 #69; // #50 at 0x0290 160 Utf8 "java/lang/invoke/MethodHandles"; // #51 at 0x0295 161 Utf8 "(Ljava/lang/Object;)Z"; // #52 at 0x02B6 162 Utf8 "println"; // #53 at 0x02CE 163 Utf8 "java/lang/Object"; // #54 at 0x02D8 164 Utf8 "java/lang/System"; // #55 at 0x02EB 165 NameAndType #92 #35; // #56 at 0x02FE 166 NameAndType #26 #20; // #57 at 0x0303 167 Utf8 "In iiArray"; // #58 at 0x0308 168 class #51; // #59 at 0x0316 169 Utf8 "equals"; // #60 at 0x0319 170 NameAndType #72 #79; // #61 at 0x0322 171 Utf8 "()V"; // #62 at 0x0327 172 NameAndType #97 #64; // #63 at 0x032D 173 Utf8 "(Ljava/lang/Object;)J"; // #64 at 0x0332 174 class #55; // #65 at 0x034A 175 class #54; // #66 at 0x034D 176 Utf8 "NoArrayCovIntf: x= y="; // #67 at 0x0350 177 Utf8 "(Ljava/lang/Object;)I"; // #68 at 0x036A 178 Utf8 "(Ljava/lang/String;)V"; // #69 at 0x0382 179 Utf8 "main"; // #70 at 0x039A 180 Method #27 #61; // #71 at 0x03A1 181 Utf8 "makeBootstrapMethod"; // #72 at 0x03A6 182 NameAndType #42 #78; // #73 at 0x03BC 183 Utf8 "()J"; // #74 at 0x03C1 184 Utf8 "()I"; // #75 at 0x03C7 185 Utf8 "getY"; // #76 at 0x03CD 186 Utf8 "getX"; // #77 at 0x03D4 187 Utf8 "(II)QNoArrayCovIntf;"; // #78 at 0x03DB 188 Utf8 "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;"; // #79 at 0x03F2 189 Utf8 "InnerClasses"; // #80 at 0x0468 190 Utf8 "()QNoArrayCovIntf;"; // #81 at 0x0477 191 MethodHandle 6b #71; // #82 at 0x048C 192 MethodHandle 6b #71; // #83 at 0x0490 193 MethodHandle 6b #71; // #84 at 0x0494 194 NameAndType #76 #75; // #85 at 0x0498 195 Utf8 "Ljava/io/PrintStream;"; // #86 at 0x049D 196 Utf8 "java/lang/invoke/StringConcatFactory"; // #87 at 0x04B5 197 Utf8 "<init>"; // #88 at 0x04DC 198 NameAndType #45 #86; // #89 at 0x04E5 199 Utf8 "()Ljava/lang/String;"; // #90 at 0x04EA 200 Utf8 "makeConcatWithConstants"; // #91 at 0x0501 201 Utf8 "y"; // #92 at 0x051B 202 NameAndType #91 #98; // #93 at 0x051F 203 Utf8 "ValueTypes"; // #94 at 0x0524 204 Utf8 "x"; // #95 at 0x0531 205 class #87; // #96 at 0x0535 206 Utf8 "longHashCode"; // #97 at 0x0538 207 Utf8 "(I)Ljava/lang/String;"; // #98 at 0x0547 208 } // Constant Pool 209 210 0x0131; // access [ ACC_PUBLIC ACC_SUPER ACC_FINAL ] 211 #4;// this_cpx 212 #66;// super_cpx 213 214 [0] { // Interfaces 215 } // Interfaces 216 217 [2] { // fields 218 { // Member at 0x056A 219 0x0010; // access 220 #95; // name_cpx 221 #35; // sig_cpx 222 [0] { // Attributes 223 } // Attributes 224 } // Member 225 ; 226 { // Member at 0x0572 227 0x0010; // access 228 #92; // name_cpx 229 #35; // sig_cpx 230 [0] { // Attributes 231 } // Attributes 232 } // Member 233 } // fields 234 235 [11] { // methods 236 { // Member at 0x057C 237 0x0002; // access 238 #88; // name_cpx 239 #62; // sig_cpx 240 [1] { // Attributes 241 Attr(#37, 17) { // Code at 0x0584 242 1; // max_stack 243 1; // max_locals 244 Bytes[5]{ 245 0x2AB70002B1; 246 }; 247 [0] { // Traps 248 } // end Traps 249 [0] { // Attributes 250 } // Attributes 251 } // end Code 252 } // Attributes 253 } // Member 254 ; 255 { // Member at 0x059B 256 0x0001; // access 257 #77; // name_cpx 258 #75; // sig_cpx 259 [1] { // Attributes 260 Attr(#37, 17) { // Code at 0x05A3 261 1; // max_stack 262 1; // max_locals 263 Bytes[5]{ 264 0x2AB4000DAC; 265 }; 266 [0] { // Traps 267 } // end Traps 268 [0] { // Attributes 269 } // Attributes 270 } // end Code 271 } // Attributes 272 } // Member 273 ; 274 { // Member at 0x05BA 275 0x0001; // access 276 #76; // name_cpx 277 #75; // sig_cpx 278 [1] { // Attributes 279 Attr(#37, 17) { // Code at 0x05C2 280 1; // max_stack 281 1; // max_locals 282 Bytes[5]{ 283 0x2AB4000EAC; 284 }; 285 [0] { // Traps 286 } // end Traps 287 [0] { // Attributes 288 } // Attributes 289 } // end Code 290 } // Attributes 291 } // Member 292 ; 293 { // Member at 0x05D9 294 0x0001; // access 295 #49; // name_cpx 296 #90; // sig_cpx 297 [1] { // Attributes 298 Attr(#37, 26) { // Code at 0x05E1 299 2; // max_stack 300 1; // max_locals 301 Bytes[14]{ 302 0x2AB600102AB60007; 303 0xBA000F0000B0; 304 }; 305 [0] { // Traps 306 } // end Traps 307 [0] { // Attributes 308 } // Attributes 309 } // end Code 310 } // Attributes 311 } // Member 312 ; 313 { // Member at 0x0601 314 0x0001; // access 315 #26; // name_cpx 316 #20; // sig_cpx 317 [1] { // Attributes 318 Attr(#37, 21) { // Code at 0x0609 319 2; // max_stack 320 2; // max_locals 321 Bytes[9]{ 322 0xB2000A1201B60006; 323 0xB1; 324 }; 325 [0] { // Traps 326 } // end Traps 327 [0] { // Attributes 328 } // Attributes 329 } // end Code 330 } // Attributes 331 } // Member 332 ; 333 { // Member at 0x0624 334 0x0009; // access 335 #42; // name_cpx 336 #78; // sig_cpx 337 [1] { // Attributes 338 Attr(#37, 32) { // Code at 0x062C 339 2; // max_stack 340 3; // max_locals 341 Bytes[20]{ 342 0xCB00044D1A2C5FCC; 343 0x000D4D1B2C5FCC00; 344 0x0E4D2CB0; 345 }; 346 [0] { // Traps 347 } // end Traps 348 [0] { // Attributes 349 } // Attributes 350 } // end Code 351 } // Attributes 352 } // Member 353 ; 354 { // Member at 0x0652 355 0x0009; // access 356 #70; // name_cpx 357 #44; // sig_cpx 358 [1] { // Attributes 359 Attr(#37, 43) { // Code at 0x065A 360 3; // max_stack 361 4; // max_locals 362 Bytes[31]{ 363 0x0607B800094C0507; 364 0xB800094D05BD0005; 365 0x4E2D032B532D042C; 366 0x532B2DB6000CB1; 367 }; 368 [0] { // Traps 369 } // end Traps 370 [0] { // Attributes 371 } // Attributes 372 } // end Code 373 } // Attributes 374 } // Member 375 ; 376 { // Member at 0x068B 377 0x0011; // access 378 #31; // name_cpx 379 #75; // sig_cpx 380 [1] { // Attributes 381 Attr(#37, 19) { // Code at 0x0693 382 1; // max_stack 383 1; // max_locals 384 Bytes[7]{ 385 0x2ABA00080000AC; 386 }; 387 [0] { // Traps 388 } // end Traps 389 [0] { // Attributes 390 } // Attributes 391 } // end Code 392 } // Attributes 393 } // Member 394 ; 395 { // Member at 0x06AC 396 0x0011; // access 397 #60; // name_cpx 398 #52; // sig_cpx 399 [1] { // Attributes 400 Attr(#37, 20) { // Code at 0x06B4 401 2; // max_stack 402 2; // max_locals 403 Bytes[8]{ 404 0x2A2BBA000B0000AC; 405 }; 406 [0] { // Traps 407 } // end Traps 408 [0] { // Attributes 409 } // Attributes 410 } // end Code 411 } // Attributes 412 } // Member 413 ; 414 { // Member at 0x06CE 415 0x0011; // access 416 #97; // name_cpx 417 #74; // sig_cpx 418 [1] { // Attributes 419 Attr(#37, 19) { // Code at 0x06D6 420 2; // max_stack 421 1; // max_locals 422 Bytes[7]{ 423 0x2ABA00030000AD; 424 }; 425 [0] { // Traps 426 } // end Traps 427 [0] { // Attributes 428 } // Attributes 429 } // end Code 430 } // Attributes 431 } // Member 432 ; 433 { // Member at 0x06EF 434 0x100A; // access 435 #46; // name_cpx 436 #81; // sig_cpx 437 [1] { // Attributes 438 Attr(#37, 32) { // Code at 0x06F7 439 2; // max_stack 440 1; // max_locals 441 Bytes[20]{ 442 0xCB00044B032A5FCC; 443 0x000D4B032A5FCC00; 444 0x0E4B2AB0; 445 }; 446 [0] { // Traps 447 } // end Traps 448 [0] { // Attributes 449 } // Attributes 450 } // end Code 451 } // Attributes 452 } // Member 453 } // methods 454 455 [4] { // Attributes 456 Attr(#25, 2) { // SourceFile at 0x071F 457 #18; 458 } // end SourceFile 459 ; 460 Attr(#80, 10) { // InnerClasses at 0x0727 461 [1] { // InnerClasses 462 #29 #59 #28 25; // at 0x0737 463 } 464 } // end InnerClasses 465 ; 466 Attr(#47, 20) { // BootstrapMethods at 0x0737 467 [4] { // bootstrap_methods 468 { // bootstrap_method 469 #23; // bootstrap_method_ref 470 [1] { // bootstrap_arguments 471 #48; // at 0x0745 472 } // bootstrap_arguments 473 } // bootstrap_method 474 ; 475 { // bootstrap_method 476 #84; // bootstrap_method_ref 477 [0] { // bootstrap_arguments 478 } // bootstrap_arguments 479 } // bootstrap_method 480 ; 481 { // bootstrap_method 482 #83; // bootstrap_method_ref 483 [0] { // bootstrap_arguments 484 } // bootstrap_arguments 485 } // bootstrap_method 486 ; 487 { // bootstrap_method 488 #82; // bootstrap_method_ref 489 [0] { // bootstrap_arguments 490 } // bootstrap_arguments 491 } // bootstrap_method 492 } 493 } // end BootstrapMethods 494 ; 495 Attr(#94, 4) { // ValueTypes at 0x0751 496 0x00010004; 497 } // end ValueTypes 498 } // Attributes 499 } // end class NoArrayCovIntf