1 /* 2 * Copyright (c) 2015, 2019, 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 // -- This file was mechanically generated: Do not edit! -- // 25 26 /* 27 * @test 28 * @bug 8156486 8207257 29 * @run testng/othervm -XX:+EnableValhalla VarHandleTestMethodTypeShort 30 * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false 31 * -XX:+EnableValhalla VarHandleTestMethodTypeShort 32 */ 33 34 import org.testng.annotations.BeforeClass; 35 import org.testng.annotations.DataProvider; 36 import org.testng.annotations.Test; 37 38 import java.lang.invoke.MethodHandles; 39 import java.lang.invoke.VarHandle; 40 import java.util.ArrayList; 41 import java.util.Arrays; 42 import java.util.List; 43 44 import static org.testng.Assert.*; 45 46 import static java.lang.invoke.MethodType.*; 47 48 public class VarHandleTestMethodTypeShort extends VarHandleBaseTest { 49 static final short static_final_v = (short)0x0123; 50 51 static short static_v = (short)0x0123; 52 53 final short final_v = (short)0x0123; 54 55 short v = (short)0x0123; 56 57 VarHandle vhFinalField; 58 59 VarHandle vhField; 60 61 VarHandle vhStaticField; 62 63 VarHandle vhStaticFinalField; 64 65 VarHandle vhArray; 66 67 @BeforeClass 68 public void setup() throws Exception { 69 vhFinalField = MethodHandles.lookup().findVarHandle( 70 VarHandleTestMethodTypeShort.class, "final_v", short.class); 71 72 vhField = MethodHandles.lookup().findVarHandle( 73 VarHandleTestMethodTypeShort.class, "v", short.class); 74 75 vhStaticFinalField = MethodHandles.lookup().findStaticVarHandle( 76 VarHandleTestMethodTypeShort.class, "static_final_v", short.class); 77 78 vhStaticField = MethodHandles.lookup().findStaticVarHandle( 79 VarHandleTestMethodTypeShort.class, "static_v", short.class); 80 81 vhArray = MethodHandles.arrayElementVarHandle(short[].class); 82 } 83 84 @DataProvider 85 public Object[][] accessTestCaseProvider() throws Exception { 86 List<AccessTestCase<?>> cases = new ArrayList<>(); 87 88 cases.add(new VarHandleAccessTestCase("Instance field", 89 vhField, vh -> testInstanceFieldWrongMethodType(this, vh), 90 false)); 91 92 cases.add(new VarHandleAccessTestCase("Static field", 93 vhStaticField, VarHandleTestMethodTypeShort::testStaticFieldWrongMethodType, 94 false)); 95 96 cases.add(new VarHandleAccessTestCase("Array", 97 vhArray, VarHandleTestMethodTypeShort::testArrayWrongMethodType, 98 false)); 99 100 for (VarHandleToMethodHandle f : VarHandleToMethodHandle.values()) { 101 cases.add(new MethodHandleAccessTestCase("Instance field", 102 vhField, f, hs -> testInstanceFieldWrongMethodType(this, hs), 103 false)); 104 105 cases.add(new MethodHandleAccessTestCase("Static field", 106 vhStaticField, f, VarHandleTestMethodTypeShort::testStaticFieldWrongMethodType, 107 false)); 108 109 cases.add(new MethodHandleAccessTestCase("Array", 110 vhArray, f, VarHandleTestMethodTypeShort::testArrayWrongMethodType, 111 false)); 112 } 113 // Work around issue with jtreg summary reporting which truncates 114 // the String result of Object.toString to 30 characters, hence 115 // the first dummy argument 116 return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new); 117 } 118 119 @Test(dataProvider = "accessTestCaseProvider") 120 public <T> void testAccess(String desc, AccessTestCase<T> atc) throws Throwable { 121 T t = atc.get(); 122 int iters = atc.requiresLoop() ? ITERS : 1; 123 for (int c = 0; c < iters; c++) { 124 atc.testAccess(t); 125 } 126 } 127 128 129 static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeShort recv, VarHandle vh) throws Throwable { 130 // Get 131 // Incorrect argument types 132 checkNPE(() -> { // null receiver 133 short x = (short) vh.get(null); 134 }); 135 checkCCE(() -> { // receiver reference class 136 short x = (short) vh.get(Void.class); 137 }); 138 checkWMTE(() -> { // receiver primitive class 139 short x = (short) vh.get(0); 140 }); 141 // Incorrect return type 142 checkWMTE(() -> { // reference class 143 Void x = (Void) vh.get(recv); 144 }); 145 checkWMTE(() -> { // primitive class 146 boolean x = (boolean) vh.get(recv); 147 }); 148 // Incorrect arity 149 checkWMTE(() -> { // 0 150 short x = (short) vh.get(); 151 }); 152 checkWMTE(() -> { // > 153 short x = (short) vh.get(recv, Void.class); 154 }); 155 156 157 // Set 158 // Incorrect argument types 159 checkNPE(() -> { // null receiver 160 vh.set(null, (short)0x0123); 161 }); 162 checkCCE(() -> { // receiver reference class 163 vh.set(Void.class, (short)0x0123); 164 }); 165 checkWMTE(() -> { // value reference class 166 vh.set(recv, Void.class); 167 }); 168 checkWMTE(() -> { // receiver primitive class 169 vh.set(0, (short)0x0123); 170 }); 171 // Incorrect arity 172 checkWMTE(() -> { // 0 173 vh.set(); 174 }); 175 checkWMTE(() -> { // > 176 vh.set(recv, (short)0x0123, Void.class); 177 }); 178 179 180 // GetVolatile 181 // Incorrect argument types 182 checkNPE(() -> { // null receiver 183 short x = (short) vh.getVolatile(null); 184 }); 185 checkCCE(() -> { // receiver reference class 186 short x = (short) vh.getVolatile(Void.class); 187 }); 188 checkWMTE(() -> { // receiver primitive class 189 short x = (short) vh.getVolatile(0); 190 }); 191 // Incorrect return type 192 checkWMTE(() -> { // reference class 193 Void x = (Void) vh.getVolatile(recv); 194 }); 195 checkWMTE(() -> { // primitive class 196 boolean x = (boolean) vh.getVolatile(recv); 197 }); 198 // Incorrect arity 199 checkWMTE(() -> { // 0 200 short x = (short) vh.getVolatile(); 201 }); 202 checkWMTE(() -> { // > 203 short x = (short) vh.getVolatile(recv, Void.class); 204 }); 205 206 207 // SetVolatile 208 // Incorrect argument types 209 checkNPE(() -> { // null receiver 210 vh.setVolatile(null, (short)0x0123); 211 }); 212 checkCCE(() -> { // receiver reference class 213 vh.setVolatile(Void.class, (short)0x0123); 214 }); 215 checkWMTE(() -> { // value reference class 216 vh.setVolatile(recv, Void.class); 217 }); 218 checkWMTE(() -> { // receiver primitive class 219 vh.setVolatile(0, (short)0x0123); 220 }); 221 // Incorrect arity 222 checkWMTE(() -> { // 0 223 vh.setVolatile(); 224 }); 225 checkWMTE(() -> { // > 226 vh.setVolatile(recv, (short)0x0123, Void.class); 227 }); 228 229 230 // GetOpaque 231 // Incorrect argument types 232 checkNPE(() -> { // null receiver 233 short x = (short) vh.getOpaque(null); 234 }); 235 checkCCE(() -> { // receiver reference class 236 short x = (short) vh.getOpaque(Void.class); 237 }); 238 checkWMTE(() -> { // receiver primitive class 239 short x = (short) vh.getOpaque(0); 240 }); 241 // Incorrect return type 242 checkWMTE(() -> { // reference class 243 Void x = (Void) vh.getOpaque(recv); 244 }); 245 checkWMTE(() -> { // primitive class 246 boolean x = (boolean) vh.getOpaque(recv); 247 }); 248 // Incorrect arity 249 checkWMTE(() -> { // 0 250 short x = (short) vh.getOpaque(); 251 }); 252 checkWMTE(() -> { // > 253 short x = (short) vh.getOpaque(recv, Void.class); 254 }); 255 256 257 // SetOpaque 258 // Incorrect argument types 259 checkNPE(() -> { // null receiver 260 vh.setOpaque(null, (short)0x0123); 261 }); 262 checkCCE(() -> { // receiver reference class 263 vh.setOpaque(Void.class, (short)0x0123); 264 }); 265 checkWMTE(() -> { // value reference class 266 vh.setOpaque(recv, Void.class); 267 }); 268 checkWMTE(() -> { // receiver primitive class 269 vh.setOpaque(0, (short)0x0123); 270 }); 271 // Incorrect arity 272 checkWMTE(() -> { // 0 273 vh.setOpaque(); 274 }); 275 checkWMTE(() -> { // > 276 vh.setOpaque(recv, (short)0x0123, Void.class); 277 }); 278 279 280 // GetAcquire 281 // Incorrect argument types 282 checkNPE(() -> { // null receiver 283 short x = (short) vh.getAcquire(null); 284 }); 285 checkCCE(() -> { // receiver reference class 286 short x = (short) vh.getAcquire(Void.class); 287 }); 288 checkWMTE(() -> { // receiver primitive class 289 short x = (short) vh.getAcquire(0); 290 }); 291 // Incorrect return type 292 checkWMTE(() -> { // reference class 293 Void x = (Void) vh.getAcquire(recv); 294 }); 295 checkWMTE(() -> { // primitive class 296 boolean x = (boolean) vh.getAcquire(recv); 297 }); 298 // Incorrect arity 299 checkWMTE(() -> { // 0 300 short x = (short) vh.getAcquire(); 301 }); 302 checkWMTE(() -> { // > 303 short x = (short) vh.getAcquire(recv, Void.class); 304 }); 305 306 307 // SetRelease 308 // Incorrect argument types 309 checkNPE(() -> { // null receiver 310 vh.setRelease(null, (short)0x0123); 311 }); 312 checkCCE(() -> { // receiver reference class 313 vh.setRelease(Void.class, (short)0x0123); 314 }); 315 checkWMTE(() -> { // value reference class 316 vh.setRelease(recv, Void.class); 317 }); 318 checkWMTE(() -> { // receiver primitive class 319 vh.setRelease(0, (short)0x0123); 320 }); 321 // Incorrect arity 322 checkWMTE(() -> { // 0 323 vh.setRelease(); 324 }); 325 checkWMTE(() -> { // > 326 vh.setRelease(recv, (short)0x0123, Void.class); 327 }); 328 329 330 // CompareAndSet 331 // Incorrect argument types 332 checkNPE(() -> { // null receiver 333 boolean r = vh.compareAndSet(null, (short)0x0123, (short)0x0123); 334 }); 335 checkCCE(() -> { // receiver reference class 336 boolean r = vh.compareAndSet(Void.class, (short)0x0123, (short)0x0123); 337 }); 338 checkWMTE(() -> { // expected reference class 339 boolean r = vh.compareAndSet(recv, Void.class, (short)0x0123); 340 }); 341 checkWMTE(() -> { // actual reference class 342 boolean r = vh.compareAndSet(recv, (short)0x0123, Void.class); 343 }); 344 checkWMTE(() -> { // receiver primitive class 345 boolean r = vh.compareAndSet(0, (short)0x0123, (short)0x0123); 346 }); 347 // Incorrect arity 348 checkWMTE(() -> { // 0 349 boolean r = vh.compareAndSet(); 350 }); 351 checkWMTE(() -> { // > 352 boolean r = vh.compareAndSet(recv, (short)0x0123, (short)0x0123, Void.class); 353 }); 354 355 356 // WeakCompareAndSet 357 // Incorrect argument types 358 checkNPE(() -> { // null receiver 359 boolean r = vh.weakCompareAndSetPlain(null, (short)0x0123, (short)0x0123); 360 }); 361 checkCCE(() -> { // receiver reference class 362 boolean r = vh.weakCompareAndSetPlain(Void.class, (short)0x0123, (short)0x0123); 363 }); 364 checkWMTE(() -> { // expected reference class 365 boolean r = vh.weakCompareAndSetPlain(recv, Void.class, (short)0x0123); 366 }); 367 checkWMTE(() -> { // actual reference class 368 boolean r = vh.weakCompareAndSetPlain(recv, (short)0x0123, Void.class); 369 }); 370 checkWMTE(() -> { // receiver primitive class 371 boolean r = vh.weakCompareAndSetPlain(0, (short)0x0123, (short)0x0123); 372 }); 373 // Incorrect arity 374 checkWMTE(() -> { // 0 375 boolean r = vh.weakCompareAndSetPlain(); 376 }); 377 checkWMTE(() -> { // > 378 boolean r = vh.weakCompareAndSetPlain(recv, (short)0x0123, (short)0x0123, Void.class); 379 }); 380 381 382 // WeakCompareAndSetVolatile 383 // Incorrect argument types 384 checkNPE(() -> { // null receiver 385 boolean r = vh.weakCompareAndSet(null, (short)0x0123, (short)0x0123); 386 }); 387 checkCCE(() -> { // receiver reference class 388 boolean r = vh.weakCompareAndSet(Void.class, (short)0x0123, (short)0x0123); 389 }); 390 checkWMTE(() -> { // expected reference class 391 boolean r = vh.weakCompareAndSet(recv, Void.class, (short)0x0123); 392 }); 393 checkWMTE(() -> { // actual reference class 394 boolean r = vh.weakCompareAndSet(recv, (short)0x0123, Void.class); 395 }); 396 checkWMTE(() -> { // receiver primitive class 397 boolean r = vh.weakCompareAndSet(0, (short)0x0123, (short)0x0123); 398 }); 399 // Incorrect arity 400 checkWMTE(() -> { // 0 401 boolean r = vh.weakCompareAndSet(); 402 }); 403 checkWMTE(() -> { // > 404 boolean r = vh.weakCompareAndSet(recv, (short)0x0123, (short)0x0123, Void.class); 405 }); 406 407 408 // WeakCompareAndSetAcquire 409 // Incorrect argument types 410 checkNPE(() -> { // null receiver 411 boolean r = vh.weakCompareAndSetAcquire(null, (short)0x0123, (short)0x0123); 412 }); 413 checkCCE(() -> { // receiver reference class 414 boolean r = vh.weakCompareAndSetAcquire(Void.class, (short)0x0123, (short)0x0123); 415 }); 416 checkWMTE(() -> { // expected reference class 417 boolean r = vh.weakCompareAndSetAcquire(recv, Void.class, (short)0x0123); 418 }); 419 checkWMTE(() -> { // actual reference class 420 boolean r = vh.weakCompareAndSetAcquire(recv, (short)0x0123, Void.class); 421 }); 422 checkWMTE(() -> { // receiver primitive class 423 boolean r = vh.weakCompareAndSetAcquire(0, (short)0x0123, (short)0x0123); 424 }); 425 // Incorrect arity 426 checkWMTE(() -> { // 0 427 boolean r = vh.weakCompareAndSetAcquire(); 428 }); 429 checkWMTE(() -> { // > 430 boolean r = vh.weakCompareAndSetAcquire(recv, (short)0x0123, (short)0x0123, Void.class); 431 }); 432 433 434 // WeakCompareAndSetRelease 435 // Incorrect argument types 436 checkNPE(() -> { // null receiver 437 boolean r = vh.weakCompareAndSetRelease(null, (short)0x0123, (short)0x0123); 438 }); 439 checkCCE(() -> { // receiver reference class 440 boolean r = vh.weakCompareAndSetRelease(Void.class, (short)0x0123, (short)0x0123); 441 }); 442 checkWMTE(() -> { // expected reference class 443 boolean r = vh.weakCompareAndSetRelease(recv, Void.class, (short)0x0123); 444 }); 445 checkWMTE(() -> { // actual reference class 446 boolean r = vh.weakCompareAndSetRelease(recv, (short)0x0123, Void.class); 447 }); 448 checkWMTE(() -> { // receiver primitive class 449 boolean r = vh.weakCompareAndSetRelease(0, (short)0x0123, (short)0x0123); 450 }); 451 // Incorrect arity 452 checkWMTE(() -> { // 0 453 boolean r = vh.weakCompareAndSetRelease(); 454 }); 455 checkWMTE(() -> { // > 456 boolean r = vh.weakCompareAndSetRelease(recv, (short)0x0123, (short)0x0123, Void.class); 457 }); 458 459 460 // CompareAndExchange 461 // Incorrect argument types 462 checkNPE(() -> { // null receiver 463 short x = (short) vh.compareAndExchange(null, (short)0x0123, (short)0x0123); 464 }); 465 checkCCE(() -> { // receiver reference class 466 short x = (short) vh.compareAndExchange(Void.class, (short)0x0123, (short)0x0123); 467 }); 468 checkWMTE(() -> { // expected reference class 469 short x = (short) vh.compareAndExchange(recv, Void.class, (short)0x0123); 470 }); 471 checkWMTE(() -> { // actual reference class 472 short x = (short) vh.compareAndExchange(recv, (short)0x0123, Void.class); 473 }); 474 checkWMTE(() -> { // reciever primitive class 475 short x = (short) vh.compareAndExchange(0, (short)0x0123, (short)0x0123); 476 }); 477 // Incorrect return type 478 checkWMTE(() -> { // reference class 479 Void r = (Void) vh.compareAndExchange(recv, (short)0x0123, (short)0x0123); 480 }); 481 checkWMTE(() -> { // primitive class 482 boolean x = (boolean) vh.compareAndExchange(recv, (short)0x0123, (short)0x0123); 483 }); 484 // Incorrect arity 485 checkWMTE(() -> { // 0 486 short x = (short) vh.compareAndExchange(); 487 }); 488 checkWMTE(() -> { // > 489 short x = (short) vh.compareAndExchange(recv, (short)0x0123, (short)0x0123, Void.class); 490 }); 491 492 493 // CompareAndExchangeAcquire 494 // Incorrect argument types 495 checkNPE(() -> { // null receiver 496 short x = (short) vh.compareAndExchangeAcquire(null, (short)0x0123, (short)0x0123); 497 }); 498 checkCCE(() -> { // receiver reference class 499 short x = (short) vh.compareAndExchangeAcquire(Void.class, (short)0x0123, (short)0x0123); 500 }); 501 checkWMTE(() -> { // expected reference class 502 short x = (short) vh.compareAndExchangeAcquire(recv, Void.class, (short)0x0123); 503 }); 504 checkWMTE(() -> { // actual reference class 505 short x = (short) vh.compareAndExchangeAcquire(recv, (short)0x0123, Void.class); 506 }); 507 checkWMTE(() -> { // reciever primitive class 508 short x = (short) vh.compareAndExchangeAcquire(0, (short)0x0123, (short)0x0123); 509 }); 510 // Incorrect return type 511 checkWMTE(() -> { // reference class 512 Void r = (Void) vh.compareAndExchangeAcquire(recv, (short)0x0123, (short)0x0123); 513 }); 514 checkWMTE(() -> { // primitive class 515 boolean x = (boolean) vh.compareAndExchangeAcquire(recv, (short)0x0123, (short)0x0123); 516 }); 517 // Incorrect arity 518 checkWMTE(() -> { // 0 519 short x = (short) vh.compareAndExchangeAcquire(); 520 }); 521 checkWMTE(() -> { // > 522 short x = (short) vh.compareAndExchangeAcquire(recv, (short)0x0123, (short)0x0123, Void.class); 523 }); 524 525 526 // CompareAndExchangeRelease 527 // Incorrect argument types 528 checkNPE(() -> { // null receiver 529 short x = (short) vh.compareAndExchangeRelease(null, (short)0x0123, (short)0x0123); 530 }); 531 checkCCE(() -> { // receiver reference class 532 short x = (short) vh.compareAndExchangeRelease(Void.class, (short)0x0123, (short)0x0123); 533 }); 534 checkWMTE(() -> { // expected reference class 535 short x = (short) vh.compareAndExchangeRelease(recv, Void.class, (short)0x0123); 536 }); 537 checkWMTE(() -> { // actual reference class 538 short x = (short) vh.compareAndExchangeRelease(recv, (short)0x0123, Void.class); 539 }); 540 checkWMTE(() -> { // reciever primitive class 541 short x = (short) vh.compareAndExchangeRelease(0, (short)0x0123, (short)0x0123); 542 }); 543 // Incorrect return type 544 checkWMTE(() -> { // reference class 545 Void r = (Void) vh.compareAndExchangeRelease(recv, (short)0x0123, (short)0x0123); 546 }); 547 checkWMTE(() -> { // primitive class 548 boolean x = (boolean) vh.compareAndExchangeRelease(recv, (short)0x0123, (short)0x0123); 549 }); 550 // Incorrect arity 551 checkWMTE(() -> { // 0 552 short x = (short) vh.compareAndExchangeRelease(); 553 }); 554 checkWMTE(() -> { // > 555 short x = (short) vh.compareAndExchangeRelease(recv, (short)0x0123, (short)0x0123, Void.class); 556 }); 557 558 559 // GetAndSet 560 // Incorrect argument types 561 checkNPE(() -> { // null receiver 562 short x = (short) vh.getAndSet(null, (short)0x0123); 563 }); 564 checkCCE(() -> { // receiver reference class 565 short x = (short) vh.getAndSet(Void.class, (short)0x0123); 566 }); 567 checkWMTE(() -> { // value reference class 568 short x = (short) vh.getAndSet(recv, Void.class); 569 }); 570 checkWMTE(() -> { // reciever primitive class 571 short x = (short) vh.getAndSet(0, (short)0x0123); 572 }); 573 // Incorrect return type 574 checkWMTE(() -> { // reference class 575 Void r = (Void) vh.getAndSet(recv, (short)0x0123); 576 }); 577 checkWMTE(() -> { // primitive class 578 boolean x = (boolean) vh.getAndSet(recv, (short)0x0123); 579 }); 580 // Incorrect arity 581 checkWMTE(() -> { // 0 582 short x = (short) vh.getAndSet(); 583 }); 584 checkWMTE(() -> { // > 585 short x = (short) vh.getAndSet(recv, (short)0x0123, Void.class); 586 }); 587 588 // GetAndSetAcquire 589 // Incorrect argument types 590 checkNPE(() -> { // null receiver 591 short x = (short) vh.getAndSetAcquire(null, (short)0x0123); 592 }); 593 checkCCE(() -> { // receiver reference class 594 short x = (short) vh.getAndSetAcquire(Void.class, (short)0x0123); 595 }); 596 checkWMTE(() -> { // value reference class 597 short x = (short) vh.getAndSetAcquire(recv, Void.class); 598 }); 599 checkWMTE(() -> { // reciever primitive class 600 short x = (short) vh.getAndSetAcquire(0, (short)0x0123); 601 }); 602 // Incorrect return type 603 checkWMTE(() -> { // reference class 604 Void r = (Void) vh.getAndSetAcquire(recv, (short)0x0123); 605 }); 606 checkWMTE(() -> { // primitive class 607 boolean x = (boolean) vh.getAndSetAcquire(recv, (short)0x0123); 608 }); 609 // Incorrect arity 610 checkWMTE(() -> { // 0 611 short x = (short) vh.getAndSetAcquire(); 612 }); 613 checkWMTE(() -> { // > 614 short x = (short) vh.getAndSetAcquire(recv, (short)0x0123, Void.class); 615 }); 616 617 // GetAndSetRelease 618 // Incorrect argument types 619 checkNPE(() -> { // null receiver 620 short x = (short) vh.getAndSetRelease(null, (short)0x0123); 621 }); 622 checkCCE(() -> { // receiver reference class 623 short x = (short) vh.getAndSetRelease(Void.class, (short)0x0123); 624 }); 625 checkWMTE(() -> { // value reference class 626 short x = (short) vh.getAndSetRelease(recv, Void.class); 627 }); 628 checkWMTE(() -> { // reciever primitive class 629 short x = (short) vh.getAndSetRelease(0, (short)0x0123); 630 }); 631 // Incorrect return type 632 checkWMTE(() -> { // reference class 633 Void r = (Void) vh.getAndSetRelease(recv, (short)0x0123); 634 }); 635 checkWMTE(() -> { // primitive class 636 boolean x = (boolean) vh.getAndSetRelease(recv, (short)0x0123); 637 }); 638 // Incorrect arity 639 checkWMTE(() -> { // 0 640 short x = (short) vh.getAndSetRelease(); 641 }); 642 checkWMTE(() -> { // > 643 short x = (short) vh.getAndSetRelease(recv, (short)0x0123, Void.class); 644 }); 645 646 // GetAndAdd 647 // Incorrect argument types 648 checkNPE(() -> { // null receiver 649 short x = (short) vh.getAndAdd(null, (short)0x0123); 650 }); 651 checkCCE(() -> { // receiver reference class 652 short x = (short) vh.getAndAdd(Void.class, (short)0x0123); 653 }); 654 checkWMTE(() -> { // value reference class 655 short x = (short) vh.getAndAdd(recv, Void.class); 656 }); 657 checkWMTE(() -> { // reciever primitive class 658 short x = (short) vh.getAndAdd(0, (short)0x0123); 659 }); 660 // Incorrect return type 661 checkWMTE(() -> { // reference class 662 Void r = (Void) vh.getAndAdd(recv, (short)0x0123); 663 }); 664 checkWMTE(() -> { // primitive class 665 boolean x = (boolean) vh.getAndAdd(recv, (short)0x0123); 666 }); 667 // Incorrect arity 668 checkWMTE(() -> { // 0 669 short x = (short) vh.getAndAdd(); 670 }); 671 checkWMTE(() -> { // > 672 short x = (short) vh.getAndAdd(recv, (short)0x0123, Void.class); 673 }); 674 675 // GetAndAddAcquire 676 // Incorrect argument types 677 checkNPE(() -> { // null receiver 678 short x = (short) vh.getAndAddAcquire(null, (short)0x0123); 679 }); 680 checkCCE(() -> { // receiver reference class 681 short x = (short) vh.getAndAddAcquire(Void.class, (short)0x0123); 682 }); 683 checkWMTE(() -> { // value reference class 684 short x = (short) vh.getAndAddAcquire(recv, Void.class); 685 }); 686 checkWMTE(() -> { // reciever primitive class 687 short x = (short) vh.getAndAddAcquire(0, (short)0x0123); 688 }); 689 // Incorrect return type 690 checkWMTE(() -> { // reference class 691 Void r = (Void) vh.getAndAddAcquire(recv, (short)0x0123); 692 }); 693 checkWMTE(() -> { // primitive class 694 boolean x = (boolean) vh.getAndAddAcquire(recv, (short)0x0123); 695 }); 696 // Incorrect arity 697 checkWMTE(() -> { // 0 698 short x = (short) vh.getAndAddAcquire(); 699 }); 700 checkWMTE(() -> { // > 701 short x = (short) vh.getAndAddAcquire(recv, (short)0x0123, Void.class); 702 }); 703 704 // GetAndAddRelease 705 // Incorrect argument types 706 checkNPE(() -> { // null receiver 707 short x = (short) vh.getAndAddRelease(null, (short)0x0123); 708 }); 709 checkCCE(() -> { // receiver reference class 710 short x = (short) vh.getAndAddRelease(Void.class, (short)0x0123); 711 }); 712 checkWMTE(() -> { // value reference class 713 short x = (short) vh.getAndAddRelease(recv, Void.class); 714 }); 715 checkWMTE(() -> { // reciever primitive class 716 short x = (short) vh.getAndAddRelease(0, (short)0x0123); 717 }); 718 // Incorrect return type 719 checkWMTE(() -> { // reference class 720 Void r = (Void) vh.getAndAddRelease(recv, (short)0x0123); 721 }); 722 checkWMTE(() -> { // primitive class 723 boolean x = (boolean) vh.getAndAddRelease(recv, (short)0x0123); 724 }); 725 // Incorrect arity 726 checkWMTE(() -> { // 0 727 short x = (short) vh.getAndAddRelease(); 728 }); 729 checkWMTE(() -> { // > 730 short x = (short) vh.getAndAddRelease(recv, (short)0x0123, Void.class); 731 }); 732 733 // GetAndBitwiseOr 734 // Incorrect argument types 735 checkNPE(() -> { // null receiver 736 short x = (short) vh.getAndBitwiseOr(null, (short)0x0123); 737 }); 738 checkCCE(() -> { // receiver reference class 739 short x = (short) vh.getAndBitwiseOr(Void.class, (short)0x0123); 740 }); 741 checkWMTE(() -> { // value reference class 742 short x = (short) vh.getAndBitwiseOr(recv, Void.class); 743 }); 744 checkWMTE(() -> { // reciever primitive class 745 short x = (short) vh.getAndBitwiseOr(0, (short)0x0123); 746 }); 747 // Incorrect return type 748 checkWMTE(() -> { // reference class 749 Void r = (Void) vh.getAndBitwiseOr(recv, (short)0x0123); 750 }); 751 checkWMTE(() -> { // primitive class 752 boolean x = (boolean) vh.getAndBitwiseOr(recv, (short)0x0123); 753 }); 754 // Incorrect arity 755 checkWMTE(() -> { // 0 756 short x = (short) vh.getAndBitwiseOr(); 757 }); 758 checkWMTE(() -> { // > 759 short x = (short) vh.getAndBitwiseOr(recv, (short)0x0123, Void.class); 760 }); 761 762 763 // GetAndBitwiseOrAcquire 764 // Incorrect argument types 765 checkNPE(() -> { // null receiver 766 short x = (short) vh.getAndBitwiseOrAcquire(null, (short)0x0123); 767 }); 768 checkCCE(() -> { // receiver reference class 769 short x = (short) vh.getAndBitwiseOrAcquire(Void.class, (short)0x0123); 770 }); 771 checkWMTE(() -> { // value reference class 772 short x = (short) vh.getAndBitwiseOrAcquire(recv, Void.class); 773 }); 774 checkWMTE(() -> { // reciever primitive class 775 short x = (short) vh.getAndBitwiseOrAcquire(0, (short)0x0123); 776 }); 777 // Incorrect return type 778 checkWMTE(() -> { // reference class 779 Void r = (Void) vh.getAndBitwiseOrAcquire(recv, (short)0x0123); 780 }); 781 checkWMTE(() -> { // primitive class 782 boolean x = (boolean) vh.getAndBitwiseOrAcquire(recv, (short)0x0123); 783 }); 784 // Incorrect arity 785 checkWMTE(() -> { // 0 786 short x = (short) vh.getAndBitwiseOrAcquire(); 787 }); 788 checkWMTE(() -> { // > 789 short x = (short) vh.getAndBitwiseOrAcquire(recv, (short)0x0123, Void.class); 790 }); 791 792 793 // GetAndBitwiseOrRelease 794 // Incorrect argument types 795 checkNPE(() -> { // null receiver 796 short x = (short) vh.getAndBitwiseOrRelease(null, (short)0x0123); 797 }); 798 checkCCE(() -> { // receiver reference class 799 short x = (short) vh.getAndBitwiseOr(Void.class, (short)0x0123); 800 }); 801 checkWMTE(() -> { // value reference class 802 short x = (short) vh.getAndBitwiseOr(recv, Void.class); 803 }); 804 checkWMTE(() -> { // reciever primitive class 805 short x = (short) vh.getAndBitwiseOr(0, (short)0x0123); 806 }); 807 // Incorrect return type 808 checkWMTE(() -> { // reference class 809 Void r = (Void) vh.getAndBitwiseOr(recv, (short)0x0123); 810 }); 811 checkWMTE(() -> { // primitive class 812 boolean x = (boolean) vh.getAndBitwiseOr(recv, (short)0x0123); 813 }); 814 // Incorrect arity 815 checkWMTE(() -> { // 0 816 short x = (short) vh.getAndBitwiseOr(); 817 }); 818 checkWMTE(() -> { // > 819 short x = (short) vh.getAndBitwiseOr(recv, (short)0x0123, Void.class); 820 }); 821 822 823 // GetAndBitwiseAnd 824 // Incorrect argument types 825 checkNPE(() -> { // null receiver 826 short x = (short) vh.getAndBitwiseAnd(null, (short)0x0123); 827 }); 828 checkCCE(() -> { // receiver reference class 829 short x = (short) vh.getAndBitwiseAnd(Void.class, (short)0x0123); 830 }); 831 checkWMTE(() -> { // value reference class 832 short x = (short) vh.getAndBitwiseAnd(recv, Void.class); 833 }); 834 checkWMTE(() -> { // reciever primitive class 835 short x = (short) vh.getAndBitwiseAnd(0, (short)0x0123); 836 }); 837 // Incorrect return type 838 checkWMTE(() -> { // reference class 839 Void r = (Void) vh.getAndBitwiseAnd(recv, (short)0x0123); 840 }); 841 checkWMTE(() -> { // primitive class 842 boolean x = (boolean) vh.getAndBitwiseAnd(recv, (short)0x0123); 843 }); 844 // Incorrect arity 845 checkWMTE(() -> { // 0 846 short x = (short) vh.getAndBitwiseAnd(); 847 }); 848 checkWMTE(() -> { // > 849 short x = (short) vh.getAndBitwiseAnd(recv, (short)0x0123, Void.class); 850 }); 851 852 853 // GetAndBitwiseAndAcquire 854 // Incorrect argument types 855 checkNPE(() -> { // null receiver 856 short x = (short) vh.getAndBitwiseAndAcquire(null, (short)0x0123); 857 }); 858 checkCCE(() -> { // receiver reference class 859 short x = (short) vh.getAndBitwiseAndAcquire(Void.class, (short)0x0123); 860 }); 861 checkWMTE(() -> { // value reference class 862 short x = (short) vh.getAndBitwiseAndAcquire(recv, Void.class); 863 }); 864 checkWMTE(() -> { // reciever primitive class 865 short x = (short) vh.getAndBitwiseAndAcquire(0, (short)0x0123); 866 }); 867 // Incorrect return type 868 checkWMTE(() -> { // reference class 869 Void r = (Void) vh.getAndBitwiseAndAcquire(recv, (short)0x0123); 870 }); 871 checkWMTE(() -> { // primitive class 872 boolean x = (boolean) vh.getAndBitwiseAndAcquire(recv, (short)0x0123); 873 }); 874 // Incorrect arity 875 checkWMTE(() -> { // 0 876 short x = (short) vh.getAndBitwiseAndAcquire(); 877 }); 878 checkWMTE(() -> { // > 879 short x = (short) vh.getAndBitwiseAndAcquire(recv, (short)0x0123, Void.class); 880 }); 881 882 883 // GetAndBitwiseAndRelease 884 // Incorrect argument types 885 checkNPE(() -> { // null receiver 886 short x = (short) vh.getAndBitwiseAndRelease(null, (short)0x0123); 887 }); 888 checkCCE(() -> { // receiver reference class 889 short x = (short) vh.getAndBitwiseAnd(Void.class, (short)0x0123); 890 }); 891 checkWMTE(() -> { // value reference class 892 short x = (short) vh.getAndBitwiseAnd(recv, Void.class); 893 }); 894 checkWMTE(() -> { // reciever primitive class 895 short x = (short) vh.getAndBitwiseAnd(0, (short)0x0123); 896 }); 897 // Incorrect return type 898 checkWMTE(() -> { // reference class 899 Void r = (Void) vh.getAndBitwiseAnd(recv, (short)0x0123); 900 }); 901 checkWMTE(() -> { // primitive class 902 boolean x = (boolean) vh.getAndBitwiseAnd(recv, (short)0x0123); 903 }); 904 // Incorrect arity 905 checkWMTE(() -> { // 0 906 short x = (short) vh.getAndBitwiseAnd(); 907 }); 908 checkWMTE(() -> { // > 909 short x = (short) vh.getAndBitwiseAnd(recv, (short)0x0123, Void.class); 910 }); 911 912 913 // GetAndBitwiseXor 914 // Incorrect argument types 915 checkNPE(() -> { // null receiver 916 short x = (short) vh.getAndBitwiseXor(null, (short)0x0123); 917 }); 918 checkCCE(() -> { // receiver reference class 919 short x = (short) vh.getAndBitwiseXor(Void.class, (short)0x0123); 920 }); 921 checkWMTE(() -> { // value reference class 922 short x = (short) vh.getAndBitwiseXor(recv, Void.class); 923 }); 924 checkWMTE(() -> { // reciever primitive class 925 short x = (short) vh.getAndBitwiseXor(0, (short)0x0123); 926 }); 927 // Incorrect return type 928 checkWMTE(() -> { // reference class 929 Void r = (Void) vh.getAndBitwiseXor(recv, (short)0x0123); 930 }); 931 checkWMTE(() -> { // primitive class 932 boolean x = (boolean) vh.getAndBitwiseXor(recv, (short)0x0123); 933 }); 934 // Incorrect arity 935 checkWMTE(() -> { // 0 936 short x = (short) vh.getAndBitwiseXor(); 937 }); 938 checkWMTE(() -> { // > 939 short x = (short) vh.getAndBitwiseXor(recv, (short)0x0123, Void.class); 940 }); 941 942 943 // GetAndBitwiseXorAcquire 944 // Incorrect argument types 945 checkNPE(() -> { // null receiver 946 short x = (short) vh.getAndBitwiseXorAcquire(null, (short)0x0123); 947 }); 948 checkCCE(() -> { // receiver reference class 949 short x = (short) vh.getAndBitwiseXorAcquire(Void.class, (short)0x0123); 950 }); 951 checkWMTE(() -> { // value reference class 952 short x = (short) vh.getAndBitwiseXorAcquire(recv, Void.class); 953 }); 954 checkWMTE(() -> { // reciever primitive class 955 short x = (short) vh.getAndBitwiseXorAcquire(0, (short)0x0123); 956 }); 957 // Incorrect return type 958 checkWMTE(() -> { // reference class 959 Void r = (Void) vh.getAndBitwiseXorAcquire(recv, (short)0x0123); 960 }); 961 checkWMTE(() -> { // primitive class 962 boolean x = (boolean) vh.getAndBitwiseXorAcquire(recv, (short)0x0123); 963 }); 964 // Incorrect arity 965 checkWMTE(() -> { // 0 966 short x = (short) vh.getAndBitwiseXorAcquire(); 967 }); 968 checkWMTE(() -> { // > 969 short x = (short) vh.getAndBitwiseXorAcquire(recv, (short)0x0123, Void.class); 970 }); 971 972 973 // GetAndBitwiseXorRelease 974 // Incorrect argument types 975 checkNPE(() -> { // null receiver 976 short x = (short) vh.getAndBitwiseXorRelease(null, (short)0x0123); 977 }); 978 checkCCE(() -> { // receiver reference class 979 short x = (short) vh.getAndBitwiseXor(Void.class, (short)0x0123); 980 }); 981 checkWMTE(() -> { // value reference class 982 short x = (short) vh.getAndBitwiseXor(recv, Void.class); 983 }); 984 checkWMTE(() -> { // reciever primitive class 985 short x = (short) vh.getAndBitwiseXor(0, (short)0x0123); 986 }); 987 // Incorrect return type 988 checkWMTE(() -> { // reference class 989 Void r = (Void) vh.getAndBitwiseXor(recv, (short)0x0123); 990 }); 991 checkWMTE(() -> { // primitive class 992 boolean x = (boolean) vh.getAndBitwiseXor(recv, (short)0x0123); 993 }); 994 // Incorrect arity 995 checkWMTE(() -> { // 0 996 short x = (short) vh.getAndBitwiseXor(); 997 }); 998 checkWMTE(() -> { // > 999 short x = (short) vh.getAndBitwiseXor(recv, (short)0x0123, Void.class); 1000 }); 1001 } 1002 1003 static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeShort recv, Handles hs) throws Throwable { 1004 for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) { 1005 // Incorrect argument types 1006 checkNPE(() -> { // null receiver 1007 short x = (short) hs.get(am, methodType(short.class, VarHandleTestMethodTypeShort.class)). 1008 invokeExact((VarHandleTestMethodTypeShort) null); 1009 }); 1010 hs.checkWMTEOrCCE(() -> { // receiver reference class 1011 short x = (short) hs.get(am, methodType(short.class, Class.class)). 1012 invokeExact(Void.class); 1013 }); 1014 checkWMTE(() -> { // receiver primitive class 1015 short x = (short) hs.get(am, methodType(short.class, int.class)). 1016 invokeExact(0); 1017 }); 1018 // Incorrect return type 1019 checkWMTE(() -> { // reference class 1020 Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeShort.class)). 1021 invokeExact(recv); 1022 }); 1023 checkWMTE(() -> { // primitive class 1024 boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeShort.class)). 1025 invokeExact(recv); 1026 }); 1027 // Incorrect arity 1028 checkWMTE(() -> { // 0 1029 short x = (short) hs.get(am, methodType(short.class)). 1030 invokeExact(); 1031 }); 1032 checkWMTE(() -> { // > 1033 short x = (short) hs.get(am, methodType(short.class, VarHandleTestMethodTypeShort.class, Class.class)). 1034 invokeExact(recv, Void.class); 1035 }); 1036 } 1037 1038 for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { 1039 // Incorrect argument types 1040 checkNPE(() -> { // null receiver 1041 hs.get(am, methodType(void.class, VarHandleTestMethodTypeShort.class, short.class)). 1042 invokeExact((VarHandleTestMethodTypeShort) null, (short)0x0123); 1043 }); 1044 hs.checkWMTEOrCCE(() -> { // receiver reference class 1045 hs.get(am, methodType(void.class, Class.class, short.class)). 1046 invokeExact(Void.class, (short)0x0123); 1047 }); 1048 checkWMTE(() -> { // value reference class 1049 hs.get(am, methodType(void.class, VarHandleTestMethodTypeShort.class, Class.class)). 1050 invokeExact(recv, Void.class); 1051 }); 1052 checkWMTE(() -> { // receiver primitive class 1053 hs.get(am, methodType(void.class, int.class, short.class)). 1054 invokeExact(0, (short)0x0123); 1055 }); 1056 // Incorrect arity 1057 checkWMTE(() -> { // 0 1058 hs.get(am, methodType(void.class)). 1059 invokeExact(); 1060 }); 1061 checkWMTE(() -> { // > 1062 hs.get(am, methodType(void.class, VarHandleTestMethodTypeShort.class, short.class, Class.class)). 1063 invokeExact(recv, (short)0x0123, Void.class); 1064 }); 1065 } 1066 1067 for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) { 1068 // Incorrect argument types 1069 checkNPE(() -> { // null receiver 1070 boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeShort.class, short.class, short.class)). 1071 invokeExact((VarHandleTestMethodTypeShort) null, (short)0x0123, (short)0x0123); 1072 }); 1073 hs.checkWMTEOrCCE(() -> { // receiver reference class 1074 boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, short.class, short.class)). 1075 invokeExact(Void.class, (short)0x0123, (short)0x0123); 1076 }); 1077 checkWMTE(() -> { // expected reference class 1078 boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeShort.class, Class.class, short.class)). 1079 invokeExact(recv, Void.class, (short)0x0123); 1080 }); 1081 checkWMTE(() -> { // actual reference class 1082 boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeShort.class, short.class, Class.class)). 1083 invokeExact(recv, (short)0x0123, Void.class); 1084 }); 1085 checkWMTE(() -> { // receiver primitive class 1086 boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class , short.class, short.class)). 1087 invokeExact(0, (short)0x0123, (short)0x0123); 1088 }); 1089 // Incorrect arity 1090 checkWMTE(() -> { // 0 1091 boolean r = (boolean) hs.get(am, methodType(boolean.class)). 1092 invokeExact(); 1093 }); 1094 checkWMTE(() -> { // > 1095 boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeShort.class, short.class, short.class, Class.class)). 1096 invokeExact(recv, (short)0x0123, (short)0x0123, Void.class); 1097 }); 1098 } 1099 1100 for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) { 1101 checkNPE(() -> { // null receiver 1102 short x = (short) hs.get(am, methodType(short.class, VarHandleTestMethodTypeShort.class, short.class, short.class)). 1103 invokeExact((VarHandleTestMethodTypeShort) null, (short)0x0123, (short)0x0123); 1104 }); 1105 hs.checkWMTEOrCCE(() -> { // receiver reference class 1106 short x = (short) hs.get(am, methodType(short.class, Class.class, short.class, short.class)). 1107 invokeExact(Void.class, (short)0x0123, (short)0x0123); 1108 }); 1109 checkWMTE(() -> { // expected reference class 1110 short x = (short) hs.get(am, methodType(short.class, VarHandleTestMethodTypeShort.class, Class.class, short.class)). 1111 invokeExact(recv, Void.class, (short)0x0123); 1112 }); 1113 checkWMTE(() -> { // actual reference class 1114 short x = (short) hs.get(am, methodType(short.class, VarHandleTestMethodTypeShort.class, short.class, Class.class)). 1115 invokeExact(recv, (short)0x0123, Void.class); 1116 }); 1117 checkWMTE(() -> { // reciever primitive class 1118 short x = (short) hs.get(am, methodType(short.class, int.class , short.class, short.class)). 1119 invokeExact(0, (short)0x0123, (short)0x0123); 1120 }); 1121 // Incorrect return type 1122 checkWMTE(() -> { // reference class 1123 Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeShort.class , short.class, short.class)). 1124 invokeExact(recv, (short)0x0123, (short)0x0123); 1125 }); 1126 checkWMTE(() -> { // primitive class 1127 boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeShort.class , short.class, short.class)). 1128 invokeExact(recv, (short)0x0123, (short)0x0123); 1129 }); 1130 // Incorrect arity 1131 checkWMTE(() -> { // 0 1132 short x = (short) hs.get(am, methodType(short.class)). 1133 invokeExact(); 1134 }); 1135 checkWMTE(() -> { // > 1136 short x = (short) hs.get(am, methodType(short.class, VarHandleTestMethodTypeShort.class, short.class, short.class, Class.class)). 1137 invokeExact(recv, (short)0x0123, (short)0x0123, Void.class); 1138 }); 1139 } 1140 1141 for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) { 1142 checkNPE(() -> { // null receiver 1143 short x = (short) hs.get(am, methodType(short.class, VarHandleTestMethodTypeShort.class, short.class)). 1144 invokeExact((VarHandleTestMethodTypeShort) null, (short)0x0123); 1145 }); 1146 hs.checkWMTEOrCCE(() -> { // receiver reference class 1147 short x = (short) hs.get(am, methodType(short.class, Class.class, short.class)). 1148 invokeExact(Void.class, (short)0x0123); 1149 }); 1150 checkWMTE(() -> { // value reference class 1151 short x = (short) hs.get(am, methodType(short.class, VarHandleTestMethodTypeShort.class, Class.class)). 1152 invokeExact(recv, Void.class); 1153 }); 1154 checkWMTE(() -> { // reciever primitive class 1155 short x = (short) hs.get(am, methodType(short.class, int.class, short.class)). 1156 invokeExact(0, (short)0x0123); 1157 }); 1158 // Incorrect return type 1159 checkWMTE(() -> { // reference class 1160 Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeShort.class, short.class)). 1161 invokeExact(recv, (short)0x0123); 1162 }); 1163 checkWMTE(() -> { // primitive class 1164 boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeShort.class, short.class)). 1165 invokeExact(recv, (short)0x0123); 1166 }); 1167 // Incorrect arity 1168 checkWMTE(() -> { // 0 1169 short x = (short) hs.get(am, methodType(short.class)). 1170 invokeExact(); 1171 }); 1172 checkWMTE(() -> { // > 1173 short x = (short) hs.get(am, methodType(short.class, VarHandleTestMethodTypeShort.class, short.class)). 1174 invokeExact(recv, (short)0x0123, Void.class); 1175 }); 1176 } 1177 1178 for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) { 1179 checkNPE(() -> { // null receiver 1180 short x = (short) hs.get(am, methodType(short.class, VarHandleTestMethodTypeShort.class, short.class)). 1181 invokeExact((VarHandleTestMethodTypeShort) null, (short)0x0123); 1182 }); 1183 hs.checkWMTEOrCCE(() -> { // receiver reference class 1184 short x = (short) hs.get(am, methodType(short.class, Class.class, short.class)). 1185 invokeExact(Void.class, (short)0x0123); 1186 }); 1187 checkWMTE(() -> { // value reference class 1188 short x = (short) hs.get(am, methodType(short.class, VarHandleTestMethodTypeShort.class, Class.class)). 1189 invokeExact(recv, Void.class); 1190 }); 1191 checkWMTE(() -> { // reciever primitive class 1192 short x = (short) hs.get(am, methodType(short.class, int.class, short.class)). 1193 invokeExact(0, (short)0x0123); 1194 }); 1195 // Incorrect return type 1196 checkWMTE(() -> { // reference class 1197 Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeShort.class, short.class)). 1198 invokeExact(recv, (short)0x0123); 1199 }); 1200 checkWMTE(() -> { // primitive class 1201 boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeShort.class, short.class)). 1202 invokeExact(recv, (short)0x0123); 1203 }); 1204 // Incorrect arity 1205 checkWMTE(() -> { // 0 1206 short x = (short) hs.get(am, methodType(short.class)). 1207 invokeExact(); 1208 }); 1209 checkWMTE(() -> { // > 1210 short x = (short) hs.get(am, methodType(short.class, VarHandleTestMethodTypeShort.class, short.class)). 1211 invokeExact(recv, (short)0x0123, Void.class); 1212 }); 1213 } 1214 1215 for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { 1216 checkNPE(() -> { // null receiver 1217 short x = (short) hs.get(am, methodType(short.class, VarHandleTestMethodTypeShort.class, short.class)). 1218 invokeExact((VarHandleTestMethodTypeShort) null, (short)0x0123); 1219 }); 1220 hs.checkWMTEOrCCE(() -> { // receiver reference class 1221 short x = (short) hs.get(am, methodType(short.class, Class.class, short.class)). 1222 invokeExact(Void.class, (short)0x0123); 1223 }); 1224 checkWMTE(() -> { // value reference class 1225 short x = (short) hs.get(am, methodType(short.class, VarHandleTestMethodTypeShort.class, Class.class)). 1226 invokeExact(recv, Void.class); 1227 }); 1228 checkWMTE(() -> { // reciever primitive class 1229 short x = (short) hs.get(am, methodType(short.class, int.class, short.class)). 1230 invokeExact(0, (short)0x0123); 1231 }); 1232 // Incorrect return type 1233 checkWMTE(() -> { // reference class 1234 Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeShort.class, short.class)). 1235 invokeExact(recv, (short)0x0123); 1236 }); 1237 checkWMTE(() -> { // primitive class 1238 boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeShort.class, short.class)). 1239 invokeExact(recv, (short)0x0123); 1240 }); 1241 // Incorrect arity 1242 checkWMTE(() -> { // 0 1243 short x = (short) hs.get(am, methodType(short.class)). 1244 invokeExact(); 1245 }); 1246 checkWMTE(() -> { // > 1247 short x = (short) hs.get(am, methodType(short.class, VarHandleTestMethodTypeShort.class, short.class)). 1248 invokeExact(recv, (short)0x0123, Void.class); 1249 }); 1250 } 1251 } 1252 1253 1254 static void testStaticFieldWrongMethodType(VarHandle vh) throws Throwable { 1255 // Get 1256 // Incorrect return type 1257 checkWMTE(() -> { // reference class 1258 Void x = (Void) vh.get(); 1259 }); 1260 checkWMTE(() -> { // primitive class 1261 boolean x = (boolean) vh.get(); 1262 }); 1263 // Incorrect arity 1264 checkWMTE(() -> { // > 1265 short x = (short) vh.get(Void.class); 1266 }); 1267 1268 1269 // Set 1270 // Incorrect argument types 1271 checkWMTE(() -> { // value reference class 1272 vh.set(Void.class); 1273 }); 1274 // Incorrect arity 1275 checkWMTE(() -> { // 0 1276 vh.set(); 1277 }); 1278 checkWMTE(() -> { // > 1279 vh.set((short)0x0123, Void.class); 1280 }); 1281 1282 1283 // GetVolatile 1284 // Incorrect return type 1285 checkWMTE(() -> { // reference class 1286 Void x = (Void) vh.getVolatile(); 1287 }); 1288 checkWMTE(() -> { // primitive class 1289 boolean x = (boolean) vh.getVolatile(); 1290 }); 1291 checkWMTE(() -> { // > 1292 short x = (short) vh.getVolatile(Void.class); 1293 }); 1294 1295 1296 // SetVolatile 1297 // Incorrect argument types 1298 checkWMTE(() -> { // value reference class 1299 vh.setVolatile(Void.class); 1300 }); 1301 // Incorrect arity 1302 checkWMTE(() -> { // 0 1303 vh.setVolatile(); 1304 }); 1305 checkWMTE(() -> { // > 1306 vh.setVolatile((short)0x0123, Void.class); 1307 }); 1308 1309 1310 // GetOpaque 1311 // Incorrect return type 1312 checkWMTE(() -> { // reference class 1313 Void x = (Void) vh.getOpaque(); 1314 }); 1315 checkWMTE(() -> { // primitive class 1316 boolean x = (boolean) vh.getOpaque(); 1317 }); 1318 checkWMTE(() -> { // > 1319 short x = (short) vh.getOpaque(Void.class); 1320 }); 1321 1322 1323 // SetOpaque 1324 // Incorrect argument types 1325 checkWMTE(() -> { // value reference class 1326 vh.setOpaque(Void.class); 1327 }); 1328 // Incorrect arity 1329 checkWMTE(() -> { // 0 1330 vh.setOpaque(); 1331 }); 1332 checkWMTE(() -> { // > 1333 vh.setOpaque((short)0x0123, Void.class); 1334 }); 1335 1336 1337 // GetAcquire 1338 // Incorrect return type 1339 checkWMTE(() -> { // reference class 1340 Void x = (Void) vh.getAcquire(); 1341 }); 1342 checkWMTE(() -> { // primitive class 1343 boolean x = (boolean) vh.getAcquire(); 1344 }); 1345 checkWMTE(() -> { // > 1346 short x = (short) vh.getAcquire(Void.class); 1347 }); 1348 1349 1350 // SetRelease 1351 // Incorrect argument types 1352 checkWMTE(() -> { // value reference class 1353 vh.setRelease(Void.class); 1354 }); 1355 // Incorrect arity 1356 checkWMTE(() -> { // 0 1357 vh.setRelease(); 1358 }); 1359 checkWMTE(() -> { // > 1360 vh.setRelease((short)0x0123, Void.class); 1361 }); 1362 1363 1364 // CompareAndSet 1365 // Incorrect argument types 1366 checkWMTE(() -> { // expected reference class 1367 boolean r = vh.compareAndSet(Void.class, (short)0x0123); 1368 }); 1369 checkWMTE(() -> { // actual reference class 1370 boolean r = vh.compareAndSet((short)0x0123, Void.class); 1371 }); 1372 // Incorrect arity 1373 checkWMTE(() -> { // 0 1374 boolean r = vh.compareAndSet(); 1375 }); 1376 checkWMTE(() -> { // > 1377 boolean r = vh.compareAndSet((short)0x0123, (short)0x0123, Void.class); 1378 }); 1379 1380 1381 // WeakCompareAndSet 1382 // Incorrect argument types 1383 checkWMTE(() -> { // expected reference class 1384 boolean r = vh.weakCompareAndSetPlain(Void.class, (short)0x0123); 1385 }); 1386 checkWMTE(() -> { // actual reference class 1387 boolean r = vh.weakCompareAndSetPlain((short)0x0123, Void.class); 1388 }); 1389 // Incorrect arity 1390 checkWMTE(() -> { // 0 1391 boolean r = vh.weakCompareAndSetPlain(); 1392 }); 1393 checkWMTE(() -> { // > 1394 boolean r = vh.weakCompareAndSetPlain((short)0x0123, (short)0x0123, Void.class); 1395 }); 1396 1397 1398 // WeakCompareAndSetVolatile 1399 // Incorrect argument types 1400 checkWMTE(() -> { // expected reference class 1401 boolean r = vh.weakCompareAndSet(Void.class, (short)0x0123); 1402 }); 1403 checkWMTE(() -> { // actual reference class 1404 boolean r = vh.weakCompareAndSet((short)0x0123, Void.class); 1405 }); 1406 // Incorrect arity 1407 checkWMTE(() -> { // 0 1408 boolean r = vh.weakCompareAndSet(); 1409 }); 1410 checkWMTE(() -> { // > 1411 boolean r = vh.weakCompareAndSet((short)0x0123, (short)0x0123, Void.class); 1412 }); 1413 1414 1415 // WeakCompareAndSetAcquire 1416 // Incorrect argument types 1417 checkWMTE(() -> { // expected reference class 1418 boolean r = vh.weakCompareAndSetAcquire(Void.class, (short)0x0123); 1419 }); 1420 checkWMTE(() -> { // actual reference class 1421 boolean r = vh.weakCompareAndSetAcquire((short)0x0123, Void.class); 1422 }); 1423 // Incorrect arity 1424 checkWMTE(() -> { // 0 1425 boolean r = vh.weakCompareAndSetAcquire(); 1426 }); 1427 checkWMTE(() -> { // > 1428 boolean r = vh.weakCompareAndSetAcquire((short)0x0123, (short)0x0123, Void.class); 1429 }); 1430 1431 1432 // WeakCompareAndSetRelease 1433 // Incorrect argument types 1434 checkWMTE(() -> { // expected reference class 1435 boolean r = vh.weakCompareAndSetRelease(Void.class, (short)0x0123); 1436 }); 1437 checkWMTE(() -> { // actual reference class 1438 boolean r = vh.weakCompareAndSetRelease((short)0x0123, Void.class); 1439 }); 1440 // Incorrect arity 1441 checkWMTE(() -> { // 0 1442 boolean r = vh.weakCompareAndSetRelease(); 1443 }); 1444 checkWMTE(() -> { // > 1445 boolean r = vh.weakCompareAndSetRelease((short)0x0123, (short)0x0123, Void.class); 1446 }); 1447 1448 1449 // CompareAndExchange 1450 // Incorrect argument types 1451 checkWMTE(() -> { // expected reference class 1452 short x = (short) vh.compareAndExchange(Void.class, (short)0x0123); 1453 }); 1454 checkWMTE(() -> { // actual reference class 1455 short x = (short) vh.compareAndExchange((short)0x0123, Void.class); 1456 }); 1457 // Incorrect return type 1458 checkWMTE(() -> { // reference class 1459 Void r = (Void) vh.compareAndExchange((short)0x0123, (short)0x0123); 1460 }); 1461 checkWMTE(() -> { // primitive class 1462 boolean x = (boolean) vh.compareAndExchange((short)0x0123, (short)0x0123); 1463 }); 1464 // Incorrect arity 1465 checkWMTE(() -> { // 0 1466 short x = (short) vh.compareAndExchange(); 1467 }); 1468 checkWMTE(() -> { // > 1469 short x = (short) vh.compareAndExchange((short)0x0123, (short)0x0123, Void.class); 1470 }); 1471 1472 1473 // CompareAndExchangeAcquire 1474 // Incorrect argument types 1475 checkWMTE(() -> { // expected reference class 1476 short x = (short) vh.compareAndExchangeAcquire(Void.class, (short)0x0123); 1477 }); 1478 checkWMTE(() -> { // actual reference class 1479 short x = (short) vh.compareAndExchangeAcquire((short)0x0123, Void.class); 1480 }); 1481 // Incorrect return type 1482 checkWMTE(() -> { // reference class 1483 Void r = (Void) vh.compareAndExchangeAcquire((short)0x0123, (short)0x0123); 1484 }); 1485 checkWMTE(() -> { // primitive class 1486 boolean x = (boolean) vh.compareAndExchangeAcquire((short)0x0123, (short)0x0123); 1487 }); 1488 // Incorrect arity 1489 checkWMTE(() -> { // 0 1490 short x = (short) vh.compareAndExchangeAcquire(); 1491 }); 1492 checkWMTE(() -> { // > 1493 short x = (short) vh.compareAndExchangeAcquire((short)0x0123, (short)0x0123, Void.class); 1494 }); 1495 1496 1497 // CompareAndExchangeRelease 1498 // Incorrect argument types 1499 checkWMTE(() -> { // expected reference class 1500 short x = (short) vh.compareAndExchangeRelease(Void.class, (short)0x0123); 1501 }); 1502 checkWMTE(() -> { // actual reference class 1503 short x = (short) vh.compareAndExchangeRelease((short)0x0123, Void.class); 1504 }); 1505 // Incorrect return type 1506 checkWMTE(() -> { // reference class 1507 Void r = (Void) vh.compareAndExchangeRelease((short)0x0123, (short)0x0123); 1508 }); 1509 checkWMTE(() -> { // primitive class 1510 boolean x = (boolean) vh.compareAndExchangeRelease((short)0x0123, (short)0x0123); 1511 }); 1512 // Incorrect arity 1513 checkWMTE(() -> { // 0 1514 short x = (short) vh.compareAndExchangeRelease(); 1515 }); 1516 checkWMTE(() -> { // > 1517 short x = (short) vh.compareAndExchangeRelease((short)0x0123, (short)0x0123, Void.class); 1518 }); 1519 1520 1521 // GetAndSet 1522 // Incorrect argument types 1523 checkWMTE(() -> { // value reference class 1524 short x = (short) vh.getAndSet(Void.class); 1525 }); 1526 // Incorrect return type 1527 checkWMTE(() -> { // reference class 1528 Void r = (Void) vh.getAndSet((short)0x0123); 1529 }); 1530 checkWMTE(() -> { // primitive class 1531 boolean x = (boolean) vh.getAndSet((short)0x0123); 1532 }); 1533 // Incorrect arity 1534 checkWMTE(() -> { // 0 1535 short x = (short) vh.getAndSet(); 1536 }); 1537 checkWMTE(() -> { // > 1538 short x = (short) vh.getAndSet((short)0x0123, Void.class); 1539 }); 1540 1541 1542 // GetAndSetAcquire 1543 // Incorrect argument types 1544 checkWMTE(() -> { // value reference class 1545 short x = (short) vh.getAndSetAcquire(Void.class); 1546 }); 1547 // Incorrect return type 1548 checkWMTE(() -> { // reference class 1549 Void r = (Void) vh.getAndSetAcquire((short)0x0123); 1550 }); 1551 checkWMTE(() -> { // primitive class 1552 boolean x = (boolean) vh.getAndSetAcquire((short)0x0123); 1553 }); 1554 // Incorrect arity 1555 checkWMTE(() -> { // 0 1556 short x = (short) vh.getAndSetAcquire(); 1557 }); 1558 checkWMTE(() -> { // > 1559 short x = (short) vh.getAndSetAcquire((short)0x0123, Void.class); 1560 }); 1561 1562 1563 // GetAndSetRelease 1564 // Incorrect argument types 1565 checkWMTE(() -> { // value reference class 1566 short x = (short) vh.getAndSetRelease(Void.class); 1567 }); 1568 // Incorrect return type 1569 checkWMTE(() -> { // reference class 1570 Void r = (Void) vh.getAndSetRelease((short)0x0123); 1571 }); 1572 checkWMTE(() -> { // primitive class 1573 boolean x = (boolean) vh.getAndSetRelease((short)0x0123); 1574 }); 1575 // Incorrect arity 1576 checkWMTE(() -> { // 0 1577 short x = (short) vh.getAndSetRelease(); 1578 }); 1579 checkWMTE(() -> { // > 1580 short x = (short) vh.getAndSetRelease((short)0x0123, Void.class); 1581 }); 1582 1583 // GetAndAdd 1584 // Incorrect argument types 1585 checkWMTE(() -> { // value reference class 1586 short x = (short) vh.getAndAdd(Void.class); 1587 }); 1588 // Incorrect return type 1589 checkWMTE(() -> { // reference class 1590 Void r = (Void) vh.getAndAdd((short)0x0123); 1591 }); 1592 checkWMTE(() -> { // primitive class 1593 boolean x = (boolean) vh.getAndAdd((short)0x0123); 1594 }); 1595 // Incorrect arity 1596 checkWMTE(() -> { // 0 1597 short x = (short) vh.getAndAdd(); 1598 }); 1599 checkWMTE(() -> { // > 1600 short x = (short) vh.getAndAdd((short)0x0123, Void.class); 1601 }); 1602 1603 1604 // GetAndAddAcquire 1605 // Incorrect argument types 1606 checkWMTE(() -> { // value reference class 1607 short x = (short) vh.getAndAddAcquire(Void.class); 1608 }); 1609 // Incorrect return type 1610 checkWMTE(() -> { // reference class 1611 Void r = (Void) vh.getAndAddAcquire((short)0x0123); 1612 }); 1613 checkWMTE(() -> { // primitive class 1614 boolean x = (boolean) vh.getAndAddAcquire((short)0x0123); 1615 }); 1616 // Incorrect arity 1617 checkWMTE(() -> { // 0 1618 short x = (short) vh.getAndAddAcquire(); 1619 }); 1620 checkWMTE(() -> { // > 1621 short x = (short) vh.getAndAddAcquire((short)0x0123, Void.class); 1622 }); 1623 1624 1625 // GetAndAddRelease 1626 // Incorrect argument types 1627 checkWMTE(() -> { // value reference class 1628 short x = (short) vh.getAndAddRelease(Void.class); 1629 }); 1630 // Incorrect return type 1631 checkWMTE(() -> { // reference class 1632 Void r = (Void) vh.getAndAddRelease((short)0x0123); 1633 }); 1634 checkWMTE(() -> { // primitive class 1635 boolean x = (boolean) vh.getAndAddRelease((short)0x0123); 1636 }); 1637 // Incorrect arity 1638 checkWMTE(() -> { // 0 1639 short x = (short) vh.getAndAddRelease(); 1640 }); 1641 checkWMTE(() -> { // > 1642 short x = (short) vh.getAndAddRelease((short)0x0123, Void.class); 1643 }); 1644 1645 // GetAndBitwiseOr 1646 // Incorrect argument types 1647 checkWMTE(() -> { // value reference class 1648 short x = (short) vh.getAndBitwiseOr(Void.class); 1649 }); 1650 // Incorrect return type 1651 checkWMTE(() -> { // reference class 1652 Void r = (Void) vh.getAndBitwiseOr((short)0x0123); 1653 }); 1654 checkWMTE(() -> { // primitive class 1655 boolean x = (boolean) vh.getAndBitwiseOr((short)0x0123); 1656 }); 1657 // Incorrect arity 1658 checkWMTE(() -> { // 0 1659 short x = (short) vh.getAndBitwiseOr(); 1660 }); 1661 checkWMTE(() -> { // > 1662 short x = (short) vh.getAndBitwiseOr((short)0x0123, Void.class); 1663 }); 1664 1665 1666 // GetAndBitwiseOrAcquire 1667 // Incorrect argument types 1668 checkWMTE(() -> { // value reference class 1669 short x = (short) vh.getAndBitwiseOrAcquire(Void.class); 1670 }); 1671 // Incorrect return type 1672 checkWMTE(() -> { // reference class 1673 Void r = (Void) vh.getAndBitwiseOrAcquire((short)0x0123); 1674 }); 1675 checkWMTE(() -> { // primitive class 1676 boolean x = (boolean) vh.getAndBitwiseOrAcquire((short)0x0123); 1677 }); 1678 // Incorrect arity 1679 checkWMTE(() -> { // 0 1680 short x = (short) vh.getAndBitwiseOrAcquire(); 1681 }); 1682 checkWMTE(() -> { // > 1683 short x = (short) vh.getAndBitwiseOrAcquire((short)0x0123, Void.class); 1684 }); 1685 1686 1687 // GetAndBitwiseOrReleaseRelease 1688 // Incorrect argument types 1689 checkWMTE(() -> { // value reference class 1690 short x = (short) vh.getAndBitwiseOrRelease(Void.class); 1691 }); 1692 // Incorrect return type 1693 checkWMTE(() -> { // reference class 1694 Void r = (Void) vh.getAndBitwiseOrRelease((short)0x0123); 1695 }); 1696 checkWMTE(() -> { // primitive class 1697 boolean x = (boolean) vh.getAndBitwiseOrRelease((short)0x0123); 1698 }); 1699 // Incorrect arity 1700 checkWMTE(() -> { // 0 1701 short x = (short) vh.getAndBitwiseOrRelease(); 1702 }); 1703 checkWMTE(() -> { // > 1704 short x = (short) vh.getAndBitwiseOrRelease((short)0x0123, Void.class); 1705 }); 1706 1707 1708 // GetAndBitwiseAnd 1709 // Incorrect argument types 1710 checkWMTE(() -> { // value reference class 1711 short x = (short) vh.getAndBitwiseAnd(Void.class); 1712 }); 1713 // Incorrect return type 1714 checkWMTE(() -> { // reference class 1715 Void r = (Void) vh.getAndBitwiseAnd((short)0x0123); 1716 }); 1717 checkWMTE(() -> { // primitive class 1718 boolean x = (boolean) vh.getAndBitwiseAnd((short)0x0123); 1719 }); 1720 // Incorrect arity 1721 checkWMTE(() -> { // 0 1722 short x = (short) vh.getAndBitwiseAnd(); 1723 }); 1724 checkWMTE(() -> { // > 1725 short x = (short) vh.getAndBitwiseAnd((short)0x0123, Void.class); 1726 }); 1727 1728 1729 // GetAndBitwiseAndAcquire 1730 // Incorrect argument types 1731 checkWMTE(() -> { // value reference class 1732 short x = (short) vh.getAndBitwiseAndAcquire(Void.class); 1733 }); 1734 // Incorrect return type 1735 checkWMTE(() -> { // reference class 1736 Void r = (Void) vh.getAndBitwiseAndAcquire((short)0x0123); 1737 }); 1738 checkWMTE(() -> { // primitive class 1739 boolean x = (boolean) vh.getAndBitwiseAndAcquire((short)0x0123); 1740 }); 1741 // Incorrect arity 1742 checkWMTE(() -> { // 0 1743 short x = (short) vh.getAndBitwiseAndAcquire(); 1744 }); 1745 checkWMTE(() -> { // > 1746 short x = (short) vh.getAndBitwiseAndAcquire((short)0x0123, Void.class); 1747 }); 1748 1749 1750 // GetAndBitwiseAndReleaseRelease 1751 // Incorrect argument types 1752 checkWMTE(() -> { // value reference class 1753 short x = (short) vh.getAndBitwiseAndRelease(Void.class); 1754 }); 1755 // Incorrect return type 1756 checkWMTE(() -> { // reference class 1757 Void r = (Void) vh.getAndBitwiseAndRelease((short)0x0123); 1758 }); 1759 checkWMTE(() -> { // primitive class 1760 boolean x = (boolean) vh.getAndBitwiseAndRelease((short)0x0123); 1761 }); 1762 // Incorrect arity 1763 checkWMTE(() -> { // 0 1764 short x = (short) vh.getAndBitwiseAndRelease(); 1765 }); 1766 checkWMTE(() -> { // > 1767 short x = (short) vh.getAndBitwiseAndRelease((short)0x0123, Void.class); 1768 }); 1769 1770 1771 // GetAndBitwiseXor 1772 // Incorrect argument types 1773 checkWMTE(() -> { // value reference class 1774 short x = (short) vh.getAndBitwiseXor(Void.class); 1775 }); 1776 // Incorrect return type 1777 checkWMTE(() -> { // reference class 1778 Void r = (Void) vh.getAndBitwiseXor((short)0x0123); 1779 }); 1780 checkWMTE(() -> { // primitive class 1781 boolean x = (boolean) vh.getAndBitwiseXor((short)0x0123); 1782 }); 1783 // Incorrect arity 1784 checkWMTE(() -> { // 0 1785 short x = (short) vh.getAndBitwiseXor(); 1786 }); 1787 checkWMTE(() -> { // > 1788 short x = (short) vh.getAndBitwiseXor((short)0x0123, Void.class); 1789 }); 1790 1791 1792 // GetAndBitwiseXorAcquire 1793 // Incorrect argument types 1794 checkWMTE(() -> { // value reference class 1795 short x = (short) vh.getAndBitwiseXorAcquire(Void.class); 1796 }); 1797 // Incorrect return type 1798 checkWMTE(() -> { // reference class 1799 Void r = (Void) vh.getAndBitwiseXorAcquire((short)0x0123); 1800 }); 1801 checkWMTE(() -> { // primitive class 1802 boolean x = (boolean) vh.getAndBitwiseXorAcquire((short)0x0123); 1803 }); 1804 // Incorrect arity 1805 checkWMTE(() -> { // 0 1806 short x = (short) vh.getAndBitwiseXorAcquire(); 1807 }); 1808 checkWMTE(() -> { // > 1809 short x = (short) vh.getAndBitwiseXorAcquire((short)0x0123, Void.class); 1810 }); 1811 1812 1813 // GetAndBitwiseXorReleaseRelease 1814 // Incorrect argument types 1815 checkWMTE(() -> { // value reference class 1816 short x = (short) vh.getAndBitwiseXorRelease(Void.class); 1817 }); 1818 // Incorrect return type 1819 checkWMTE(() -> { // reference class 1820 Void r = (Void) vh.getAndBitwiseXorRelease((short)0x0123); 1821 }); 1822 checkWMTE(() -> { // primitive class 1823 boolean x = (boolean) vh.getAndBitwiseXorRelease((short)0x0123); 1824 }); 1825 // Incorrect arity 1826 checkWMTE(() -> { // 0 1827 short x = (short) vh.getAndBitwiseXorRelease(); 1828 }); 1829 checkWMTE(() -> { // > 1830 short x = (short) vh.getAndBitwiseXorRelease((short)0x0123, Void.class); 1831 }); 1832 } 1833 1834 static void testStaticFieldWrongMethodType(Handles hs) throws Throwable { 1835 int i = 0; 1836 1837 for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) { 1838 // Incorrect return type 1839 checkWMTE(() -> { // reference class 1840 Void x = (Void) hs.get(am, methodType(Void.class)). 1841 invokeExact(); 1842 }); 1843 checkWMTE(() -> { // primitive class 1844 boolean x = (boolean) hs.get(am, methodType(boolean.class)). 1845 invokeExact(); 1846 }); 1847 // Incorrect arity 1848 checkWMTE(() -> { // > 1849 short x = (short) hs.get(am, methodType(Class.class)). 1850 invokeExact(Void.class); 1851 }); 1852 } 1853 1854 for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { 1855 checkWMTE(() -> { // value reference class 1856 hs.get(am, methodType(void.class, Class.class)). 1857 invokeExact(Void.class); 1858 }); 1859 // Incorrect arity 1860 checkWMTE(() -> { // 0 1861 hs.get(am, methodType(void.class)). 1862 invokeExact(); 1863 }); 1864 checkWMTE(() -> { // > 1865 hs.get(am, methodType(void.class, short.class, Class.class)). 1866 invokeExact((short)0x0123, Void.class); 1867 }); 1868 } 1869 for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) { 1870 // Incorrect argument types 1871 checkWMTE(() -> { // expected reference class 1872 boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, short.class)). 1873 invokeExact(Void.class, (short)0x0123); 1874 }); 1875 checkWMTE(() -> { // actual reference class 1876 boolean r = (boolean) hs.get(am, methodType(boolean.class, short.class, Class.class)). 1877 invokeExact((short)0x0123, Void.class); 1878 }); 1879 // Incorrect arity 1880 checkWMTE(() -> { // 0 1881 boolean r = (boolean) hs.get(am, methodType(boolean.class)). 1882 invokeExact(); 1883 }); 1884 checkWMTE(() -> { // > 1885 boolean r = (boolean) hs.get(am, methodType(boolean.class, short.class, short.class, Class.class)). 1886 invokeExact((short)0x0123, (short)0x0123, Void.class); 1887 }); 1888 } 1889 1890 for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) { 1891 // Incorrect argument types 1892 checkWMTE(() -> { // expected reference class 1893 short x = (short) hs.get(am, methodType(short.class, Class.class, short.class)). 1894 invokeExact(Void.class, (short)0x0123); 1895 }); 1896 checkWMTE(() -> { // actual reference class 1897 short x = (short) hs.get(am, methodType(short.class, short.class, Class.class)). 1898 invokeExact((short)0x0123, Void.class); 1899 }); 1900 // Incorrect return type 1901 checkWMTE(() -> { // reference class 1902 Void r = (Void) hs.get(am, methodType(Void.class, short.class, short.class)). 1903 invokeExact((short)0x0123, (short)0x0123); 1904 }); 1905 checkWMTE(() -> { // primitive class 1906 boolean x = (boolean) hs.get(am, methodType(boolean.class, short.class, short.class)). 1907 invokeExact((short)0x0123, (short)0x0123); 1908 }); 1909 // Incorrect arity 1910 checkWMTE(() -> { // 0 1911 short x = (short) hs.get(am, methodType(short.class)). 1912 invokeExact(); 1913 }); 1914 checkWMTE(() -> { // > 1915 short x = (short) hs.get(am, methodType(short.class, short.class, short.class, Class.class)). 1916 invokeExact((short)0x0123, (short)0x0123, Void.class); 1917 }); 1918 } 1919 1920 for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) { 1921 // Incorrect argument types 1922 checkWMTE(() -> { // value reference class 1923 short x = (short) hs.get(am, methodType(short.class, Class.class)). 1924 invokeExact(Void.class); 1925 }); 1926 // Incorrect return type 1927 checkWMTE(() -> { // reference class 1928 Void r = (Void) hs.get(am, methodType(Void.class, short.class)). 1929 invokeExact((short)0x0123); 1930 }); 1931 checkWMTE(() -> { // primitive class 1932 boolean x = (boolean) hs.get(am, methodType(boolean.class, short.class)). 1933 invokeExact((short)0x0123); 1934 }); 1935 // Incorrect arity 1936 checkWMTE(() -> { // 0 1937 short x = (short) hs.get(am, methodType(short.class)). 1938 invokeExact(); 1939 }); 1940 checkWMTE(() -> { // > 1941 short x = (short) hs.get(am, methodType(short.class, short.class, Class.class)). 1942 invokeExact((short)0x0123, Void.class); 1943 }); 1944 } 1945 1946 for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) { 1947 // Incorrect argument types 1948 checkWMTE(() -> { // value reference class 1949 short x = (short) hs.get(am, methodType(short.class, Class.class)). 1950 invokeExact(Void.class); 1951 }); 1952 // Incorrect return type 1953 checkWMTE(() -> { // reference class 1954 Void r = (Void) hs.get(am, methodType(Void.class, short.class)). 1955 invokeExact((short)0x0123); 1956 }); 1957 checkWMTE(() -> { // primitive class 1958 boolean x = (boolean) hs.get(am, methodType(boolean.class, short.class)). 1959 invokeExact((short)0x0123); 1960 }); 1961 // Incorrect arity 1962 checkWMTE(() -> { // 0 1963 short x = (short) hs.get(am, methodType(short.class)). 1964 invokeExact(); 1965 }); 1966 checkWMTE(() -> { // > 1967 short x = (short) hs.get(am, methodType(short.class, short.class, Class.class)). 1968 invokeExact((short)0x0123, Void.class); 1969 }); 1970 } 1971 1972 for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { 1973 // Incorrect argument types 1974 checkWMTE(() -> { // value reference class 1975 short x = (short) hs.get(am, methodType(short.class, Class.class)). 1976 invokeExact(Void.class); 1977 }); 1978 // Incorrect return type 1979 checkWMTE(() -> { // reference class 1980 Void r = (Void) hs.get(am, methodType(Void.class, short.class)). 1981 invokeExact((short)0x0123); 1982 }); 1983 checkWMTE(() -> { // primitive class 1984 boolean x = (boolean) hs.get(am, methodType(boolean.class, short.class)). 1985 invokeExact((short)0x0123); 1986 }); 1987 // Incorrect arity 1988 checkWMTE(() -> { // 0 1989 short x = (short) hs.get(am, methodType(short.class)). 1990 invokeExact(); 1991 }); 1992 checkWMTE(() -> { // > 1993 short x = (short) hs.get(am, methodType(short.class, short.class, Class.class)). 1994 invokeExact((short)0x0123, Void.class); 1995 }); 1996 } 1997 } 1998 1999 2000 static void testArrayWrongMethodType(VarHandle vh) throws Throwable { 2001 short[] array = new short[10]; 2002 Arrays.fill(array, (short)0x0123); 2003 2004 // Get 2005 // Incorrect argument types 2006 checkNPE(() -> { // null array 2007 short x = (short) vh.get(null, 0); 2008 }); 2009 checkCCE(() -> { // array reference class 2010 short x = (short) vh.get(Void.class, 0); 2011 }); 2012 checkWMTE(() -> { // array primitive class 2013 short x = (short) vh.get(0, 0); 2014 }); 2015 checkWMTE(() -> { // index reference class 2016 short x = (short) vh.get(array, Void.class); 2017 }); 2018 // Incorrect return type 2019 checkWMTE(() -> { // reference class 2020 Void x = (Void) vh.get(array, 0); 2021 }); 2022 checkWMTE(() -> { // primitive class 2023 boolean x = (boolean) vh.get(array, 0); 2024 }); 2025 // Incorrect arity 2026 checkWMTE(() -> { // 0 2027 short x = (short) vh.get(); 2028 }); 2029 checkWMTE(() -> { // > 2030 short x = (short) vh.get(array, 0, Void.class); 2031 }); 2032 2033 2034 // Set 2035 // Incorrect argument types 2036 checkNPE(() -> { // null array 2037 vh.set(null, 0, (short)0x0123); 2038 }); 2039 checkCCE(() -> { // array reference class 2040 vh.set(Void.class, 0, (short)0x0123); 2041 }); 2042 checkWMTE(() -> { // value reference class 2043 vh.set(array, 0, Void.class); 2044 }); 2045 checkWMTE(() -> { // receiver primitive class 2046 vh.set(0, 0, (short)0x0123); 2047 }); 2048 checkWMTE(() -> { // index reference class 2049 vh.set(array, Void.class, (short)0x0123); 2050 }); 2051 // Incorrect arity 2052 checkWMTE(() -> { // 0 2053 vh.set(); 2054 }); 2055 checkWMTE(() -> { // > 2056 vh.set(array, 0, (short)0x0123, Void.class); 2057 }); 2058 2059 2060 // GetVolatile 2061 // Incorrect argument types 2062 checkNPE(() -> { // null array 2063 short x = (short) vh.getVolatile(null, 0); 2064 }); 2065 checkCCE(() -> { // array reference class 2066 short x = (short) vh.getVolatile(Void.class, 0); 2067 }); 2068 checkWMTE(() -> { // array primitive class 2069 short x = (short) vh.getVolatile(0, 0); 2070 }); 2071 checkWMTE(() -> { // index reference class 2072 short x = (short) vh.getVolatile(array, Void.class); 2073 }); 2074 // Incorrect return type 2075 checkWMTE(() -> { // reference class 2076 Void x = (Void) vh.getVolatile(array, 0); 2077 }); 2078 checkWMTE(() -> { // primitive class 2079 boolean x = (boolean) vh.getVolatile(array, 0); 2080 }); 2081 // Incorrect arity 2082 checkWMTE(() -> { // 0 2083 short x = (short) vh.getVolatile(); 2084 }); 2085 checkWMTE(() -> { // > 2086 short x = (short) vh.getVolatile(array, 0, Void.class); 2087 }); 2088 2089 2090 // SetVolatile 2091 // Incorrect argument types 2092 checkNPE(() -> { // null array 2093 vh.setVolatile(null, 0, (short)0x0123); 2094 }); 2095 checkCCE(() -> { // array reference class 2096 vh.setVolatile(Void.class, 0, (short)0x0123); 2097 }); 2098 checkWMTE(() -> { // value reference class 2099 vh.setVolatile(array, 0, Void.class); 2100 }); 2101 checkWMTE(() -> { // receiver primitive class 2102 vh.setVolatile(0, 0, (short)0x0123); 2103 }); 2104 checkWMTE(() -> { // index reference class 2105 vh.setVolatile(array, Void.class, (short)0x0123); 2106 }); 2107 // Incorrect arity 2108 checkWMTE(() -> { // 0 2109 vh.setVolatile(); 2110 }); 2111 checkWMTE(() -> { // > 2112 vh.setVolatile(array, 0, (short)0x0123, Void.class); 2113 }); 2114 2115 2116 // GetOpaque 2117 // Incorrect argument types 2118 checkNPE(() -> { // null array 2119 short x = (short) vh.getOpaque(null, 0); 2120 }); 2121 checkCCE(() -> { // array reference class 2122 short x = (short) vh.getOpaque(Void.class, 0); 2123 }); 2124 checkWMTE(() -> { // array primitive class 2125 short x = (short) vh.getOpaque(0, 0); 2126 }); 2127 checkWMTE(() -> { // index reference class 2128 short x = (short) vh.getOpaque(array, Void.class); 2129 }); 2130 // Incorrect return type 2131 checkWMTE(() -> { // reference class 2132 Void x = (Void) vh.getOpaque(array, 0); 2133 }); 2134 checkWMTE(() -> { // primitive class 2135 boolean x = (boolean) vh.getOpaque(array, 0); 2136 }); 2137 // Incorrect arity 2138 checkWMTE(() -> { // 0 2139 short x = (short) vh.getOpaque(); 2140 }); 2141 checkWMTE(() -> { // > 2142 short x = (short) vh.getOpaque(array, 0, Void.class); 2143 }); 2144 2145 2146 // SetOpaque 2147 // Incorrect argument types 2148 checkNPE(() -> { // null array 2149 vh.setOpaque(null, 0, (short)0x0123); 2150 }); 2151 checkCCE(() -> { // array reference class 2152 vh.setOpaque(Void.class, 0, (short)0x0123); 2153 }); 2154 checkWMTE(() -> { // value reference class 2155 vh.setOpaque(array, 0, Void.class); 2156 }); 2157 checkWMTE(() -> { // receiver primitive class 2158 vh.setOpaque(0, 0, (short)0x0123); 2159 }); 2160 checkWMTE(() -> { // index reference class 2161 vh.setOpaque(array, Void.class, (short)0x0123); 2162 }); 2163 // Incorrect arity 2164 checkWMTE(() -> { // 0 2165 vh.setOpaque(); 2166 }); 2167 checkWMTE(() -> { // > 2168 vh.setOpaque(array, 0, (short)0x0123, Void.class); 2169 }); 2170 2171 2172 // GetAcquire 2173 // Incorrect argument types 2174 checkNPE(() -> { // null array 2175 short x = (short) vh.getAcquire(null, 0); 2176 }); 2177 checkCCE(() -> { // array reference class 2178 short x = (short) vh.getAcquire(Void.class, 0); 2179 }); 2180 checkWMTE(() -> { // array primitive class 2181 short x = (short) vh.getAcquire(0, 0); 2182 }); 2183 checkWMTE(() -> { // index reference class 2184 short x = (short) vh.getAcquire(array, Void.class); 2185 }); 2186 // Incorrect return type 2187 checkWMTE(() -> { // reference class 2188 Void x = (Void) vh.getAcquire(array, 0); 2189 }); 2190 checkWMTE(() -> { // primitive class 2191 boolean x = (boolean) vh.getAcquire(array, 0); 2192 }); 2193 // Incorrect arity 2194 checkWMTE(() -> { // 0 2195 short x = (short) vh.getAcquire(); 2196 }); 2197 checkWMTE(() -> { // > 2198 short x = (short) vh.getAcquire(array, 0, Void.class); 2199 }); 2200 2201 2202 // SetRelease 2203 // Incorrect argument types 2204 checkNPE(() -> { // null array 2205 vh.setRelease(null, 0, (short)0x0123); 2206 }); 2207 checkCCE(() -> { // array reference class 2208 vh.setRelease(Void.class, 0, (short)0x0123); 2209 }); 2210 checkWMTE(() -> { // value reference class 2211 vh.setRelease(array, 0, Void.class); 2212 }); 2213 checkWMTE(() -> { // receiver primitive class 2214 vh.setRelease(0, 0, (short)0x0123); 2215 }); 2216 checkWMTE(() -> { // index reference class 2217 vh.setRelease(array, Void.class, (short)0x0123); 2218 }); 2219 // Incorrect arity 2220 checkWMTE(() -> { // 0 2221 vh.setRelease(); 2222 }); 2223 checkWMTE(() -> { // > 2224 vh.setRelease(array, 0, (short)0x0123, Void.class); 2225 }); 2226 2227 2228 // CompareAndSet 2229 // Incorrect argument types 2230 checkNPE(() -> { // null receiver 2231 boolean r = vh.compareAndSet(null, 0, (short)0x0123, (short)0x0123); 2232 }); 2233 checkCCE(() -> { // receiver reference class 2234 boolean r = vh.compareAndSet(Void.class, 0, (short)0x0123, (short)0x0123); 2235 }); 2236 checkWMTE(() -> { // expected reference class 2237 boolean r = vh.compareAndSet(array, 0, Void.class, (short)0x0123); 2238 }); 2239 checkWMTE(() -> { // actual reference class 2240 boolean r = vh.compareAndSet(array, 0, (short)0x0123, Void.class); 2241 }); 2242 checkWMTE(() -> { // receiver primitive class 2243 boolean r = vh.compareAndSet(0, 0, (short)0x0123, (short)0x0123); 2244 }); 2245 checkWMTE(() -> { // index reference class 2246 boolean r = vh.compareAndSet(array, Void.class, (short)0x0123, (short)0x0123); 2247 }); 2248 // Incorrect arity 2249 checkWMTE(() -> { // 0 2250 boolean r = vh.compareAndSet(); 2251 }); 2252 checkWMTE(() -> { // > 2253 boolean r = vh.compareAndSet(array, 0, (short)0x0123, (short)0x0123, Void.class); 2254 }); 2255 2256 2257 // WeakCompareAndSet 2258 // Incorrect argument types 2259 checkNPE(() -> { // null receiver 2260 boolean r = vh.weakCompareAndSetPlain(null, 0, (short)0x0123, (short)0x0123); 2261 }); 2262 checkCCE(() -> { // receiver reference class 2263 boolean r = vh.weakCompareAndSetPlain(Void.class, 0, (short)0x0123, (short)0x0123); 2264 }); 2265 checkWMTE(() -> { // expected reference class 2266 boolean r = vh.weakCompareAndSetPlain(array, 0, Void.class, (short)0x0123); 2267 }); 2268 checkWMTE(() -> { // actual reference class 2269 boolean r = vh.weakCompareAndSetPlain(array, 0, (short)0x0123, Void.class); 2270 }); 2271 checkWMTE(() -> { // receiver primitive class 2272 boolean r = vh.weakCompareAndSetPlain(0, 0, (short)0x0123, (short)0x0123); 2273 }); 2274 checkWMTE(() -> { // index reference class 2275 boolean r = vh.weakCompareAndSetPlain(array, Void.class, (short)0x0123, (short)0x0123); 2276 }); 2277 // Incorrect arity 2278 checkWMTE(() -> { // 0 2279 boolean r = vh.weakCompareAndSetPlain(); 2280 }); 2281 checkWMTE(() -> { // > 2282 boolean r = vh.weakCompareAndSetPlain(array, 0, (short)0x0123, (short)0x0123, Void.class); 2283 }); 2284 2285 2286 // WeakCompareAndSetVolatile 2287 // Incorrect argument types 2288 checkNPE(() -> { // null receiver 2289 boolean r = vh.weakCompareAndSet(null, 0, (short)0x0123, (short)0x0123); 2290 }); 2291 checkCCE(() -> { // receiver reference class 2292 boolean r = vh.weakCompareAndSet(Void.class, 0, (short)0x0123, (short)0x0123); 2293 }); 2294 checkWMTE(() -> { // expected reference class 2295 boolean r = vh.weakCompareAndSet(array, 0, Void.class, (short)0x0123); 2296 }); 2297 checkWMTE(() -> { // actual reference class 2298 boolean r = vh.weakCompareAndSet(array, 0, (short)0x0123, Void.class); 2299 }); 2300 checkWMTE(() -> { // receiver primitive class 2301 boolean r = vh.weakCompareAndSet(0, 0, (short)0x0123, (short)0x0123); 2302 }); 2303 checkWMTE(() -> { // index reference class 2304 boolean r = vh.weakCompareAndSet(array, Void.class, (short)0x0123, (short)0x0123); 2305 }); 2306 // Incorrect arity 2307 checkWMTE(() -> { // 0 2308 boolean r = vh.weakCompareAndSet(); 2309 }); 2310 checkWMTE(() -> { // > 2311 boolean r = vh.weakCompareAndSet(array, 0, (short)0x0123, (short)0x0123, Void.class); 2312 }); 2313 2314 2315 // WeakCompareAndSetAcquire 2316 // Incorrect argument types 2317 checkNPE(() -> { // null receiver 2318 boolean r = vh.weakCompareAndSetAcquire(null, 0, (short)0x0123, (short)0x0123); 2319 }); 2320 checkCCE(() -> { // receiver reference class 2321 boolean r = vh.weakCompareAndSetAcquire(Void.class, 0, (short)0x0123, (short)0x0123); 2322 }); 2323 checkWMTE(() -> { // expected reference class 2324 boolean r = vh.weakCompareAndSetAcquire(array, 0, Void.class, (short)0x0123); 2325 }); 2326 checkWMTE(() -> { // actual reference class 2327 boolean r = vh.weakCompareAndSetAcquire(array, 0, (short)0x0123, Void.class); 2328 }); 2329 checkWMTE(() -> { // receiver primitive class 2330 boolean r = vh.weakCompareAndSetAcquire(0, 0, (short)0x0123, (short)0x0123); 2331 }); 2332 checkWMTE(() -> { // index reference class 2333 boolean r = vh.weakCompareAndSetAcquire(array, Void.class, (short)0x0123, (short)0x0123); 2334 }); 2335 // Incorrect arity 2336 checkWMTE(() -> { // 0 2337 boolean r = vh.weakCompareAndSetAcquire(); 2338 }); 2339 checkWMTE(() -> { // > 2340 boolean r = vh.weakCompareAndSetAcquire(array, 0, (short)0x0123, (short)0x0123, Void.class); 2341 }); 2342 2343 2344 // WeakCompareAndSetRelease 2345 // Incorrect argument types 2346 checkNPE(() -> { // null receiver 2347 boolean r = vh.weakCompareAndSetRelease(null, 0, (short)0x0123, (short)0x0123); 2348 }); 2349 checkCCE(() -> { // receiver reference class 2350 boolean r = vh.weakCompareAndSetRelease(Void.class, 0, (short)0x0123, (short)0x0123); 2351 }); 2352 checkWMTE(() -> { // expected reference class 2353 boolean r = vh.weakCompareAndSetRelease(array, 0, Void.class, (short)0x0123); 2354 }); 2355 checkWMTE(() -> { // actual reference class 2356 boolean r = vh.weakCompareAndSetRelease(array, 0, (short)0x0123, Void.class); 2357 }); 2358 checkWMTE(() -> { // receiver primitive class 2359 boolean r = vh.weakCompareAndSetRelease(0, 0, (short)0x0123, (short)0x0123); 2360 }); 2361 checkWMTE(() -> { // index reference class 2362 boolean r = vh.weakCompareAndSetRelease(array, Void.class, (short)0x0123, (short)0x0123); 2363 }); 2364 // Incorrect arity 2365 checkWMTE(() -> { // 0 2366 boolean r = vh.weakCompareAndSetRelease(); 2367 }); 2368 checkWMTE(() -> { // > 2369 boolean r = vh.weakCompareAndSetRelease(array, 0, (short)0x0123, (short)0x0123, Void.class); 2370 }); 2371 2372 2373 // CompareAndExchange 2374 // Incorrect argument types 2375 checkNPE(() -> { // null receiver 2376 short x = (short) vh.compareAndExchange(null, 0, (short)0x0123, (short)0x0123); 2377 }); 2378 checkCCE(() -> { // array reference class 2379 short x = (short) vh.compareAndExchange(Void.class, 0, (short)0x0123, (short)0x0123); 2380 }); 2381 checkWMTE(() -> { // expected reference class 2382 short x = (short) vh.compareAndExchange(array, 0, Void.class, (short)0x0123); 2383 }); 2384 checkWMTE(() -> { // actual reference class 2385 short x = (short) vh.compareAndExchange(array, 0, (short)0x0123, Void.class); 2386 }); 2387 checkWMTE(() -> { // array primitive class 2388 short x = (short) vh.compareAndExchange(0, 0, (short)0x0123, (short)0x0123); 2389 }); 2390 checkWMTE(() -> { // index reference class 2391 short x = (short) vh.compareAndExchange(array, Void.class, (short)0x0123, (short)0x0123); 2392 }); 2393 // Incorrect return type 2394 checkWMTE(() -> { // reference class 2395 Void r = (Void) vh.compareAndExchange(array, 0, (short)0x0123, (short)0x0123); 2396 }); 2397 checkWMTE(() -> { // primitive class 2398 boolean x = (boolean) vh.compareAndExchange(array, 0, (short)0x0123, (short)0x0123); 2399 }); 2400 // Incorrect arity 2401 checkWMTE(() -> { // 0 2402 short x = (short) vh.compareAndExchange(); 2403 }); 2404 checkWMTE(() -> { // > 2405 short x = (short) vh.compareAndExchange(array, 0, (short)0x0123, (short)0x0123, Void.class); 2406 }); 2407 2408 2409 // CompareAndExchangeAcquire 2410 // Incorrect argument types 2411 checkNPE(() -> { // null receiver 2412 short x = (short) vh.compareAndExchangeAcquire(null, 0, (short)0x0123, (short)0x0123); 2413 }); 2414 checkCCE(() -> { // array reference class 2415 short x = (short) vh.compareAndExchangeAcquire(Void.class, 0, (short)0x0123, (short)0x0123); 2416 }); 2417 checkWMTE(() -> { // expected reference class 2418 short x = (short) vh.compareAndExchangeAcquire(array, 0, Void.class, (short)0x0123); 2419 }); 2420 checkWMTE(() -> { // actual reference class 2421 short x = (short) vh.compareAndExchangeAcquire(array, 0, (short)0x0123, Void.class); 2422 }); 2423 checkWMTE(() -> { // array primitive class 2424 short x = (short) vh.compareAndExchangeAcquire(0, 0, (short)0x0123, (short)0x0123); 2425 }); 2426 checkWMTE(() -> { // index reference class 2427 short x = (short) vh.compareAndExchangeAcquire(array, Void.class, (short)0x0123, (short)0x0123); 2428 }); 2429 // Incorrect return type 2430 checkWMTE(() -> { // reference class 2431 Void r = (Void) vh.compareAndExchangeAcquire(array, 0, (short)0x0123, (short)0x0123); 2432 }); 2433 checkWMTE(() -> { // primitive class 2434 boolean x = (boolean) vh.compareAndExchangeAcquire(array, 0, (short)0x0123, (short)0x0123); 2435 }); 2436 // Incorrect arity 2437 checkWMTE(() -> { // 0 2438 short x = (short) vh.compareAndExchangeAcquire(); 2439 }); 2440 checkWMTE(() -> { // > 2441 short x = (short) vh.compareAndExchangeAcquire(array, 0, (short)0x0123, (short)0x0123, Void.class); 2442 }); 2443 2444 2445 // CompareAndExchangeRelease 2446 // Incorrect argument types 2447 checkNPE(() -> { // null receiver 2448 short x = (short) vh.compareAndExchangeRelease(null, 0, (short)0x0123, (short)0x0123); 2449 }); 2450 checkCCE(() -> { // array reference class 2451 short x = (short) vh.compareAndExchangeRelease(Void.class, 0, (short)0x0123, (short)0x0123); 2452 }); 2453 checkWMTE(() -> { // expected reference class 2454 short x = (short) vh.compareAndExchangeRelease(array, 0, Void.class, (short)0x0123); 2455 }); 2456 checkWMTE(() -> { // actual reference class 2457 short x = (short) vh.compareAndExchangeRelease(array, 0, (short)0x0123, Void.class); 2458 }); 2459 checkWMTE(() -> { // array primitive class 2460 short x = (short) vh.compareAndExchangeRelease(0, 0, (short)0x0123, (short)0x0123); 2461 }); 2462 checkWMTE(() -> { // index reference class 2463 short x = (short) vh.compareAndExchangeRelease(array, Void.class, (short)0x0123, (short)0x0123); 2464 }); 2465 // Incorrect return type 2466 checkWMTE(() -> { // reference class 2467 Void r = (Void) vh.compareAndExchangeRelease(array, 0, (short)0x0123, (short)0x0123); 2468 }); 2469 checkWMTE(() -> { // primitive class 2470 boolean x = (boolean) vh.compareAndExchangeRelease(array, 0, (short)0x0123, (short)0x0123); 2471 }); 2472 // Incorrect arity 2473 checkWMTE(() -> { // 0 2474 short x = (short) vh.compareAndExchangeRelease(); 2475 }); 2476 checkWMTE(() -> { // > 2477 short x = (short) vh.compareAndExchangeRelease(array, 0, (short)0x0123, (short)0x0123, Void.class); 2478 }); 2479 2480 2481 // GetAndSet 2482 // Incorrect argument types 2483 checkNPE(() -> { // null array 2484 short x = (short) vh.getAndSet(null, 0, (short)0x0123); 2485 }); 2486 checkCCE(() -> { // array reference class 2487 short x = (short) vh.getAndSet(Void.class, 0, (short)0x0123); 2488 }); 2489 checkWMTE(() -> { // value reference class 2490 short x = (short) vh.getAndSet(array, 0, Void.class); 2491 }); 2492 checkWMTE(() -> { // reciarrayever primitive class 2493 short x = (short) vh.getAndSet(0, 0, (short)0x0123); 2494 }); 2495 checkWMTE(() -> { // index reference class 2496 short x = (short) vh.getAndSet(array, Void.class, (short)0x0123); 2497 }); 2498 // Incorrect return type 2499 checkWMTE(() -> { // reference class 2500 Void r = (Void) vh.getAndSet(array, 0, (short)0x0123); 2501 }); 2502 checkWMTE(() -> { // primitive class 2503 boolean x = (boolean) vh.getAndSet(array, 0, (short)0x0123); 2504 }); 2505 // Incorrect arity 2506 checkWMTE(() -> { // 0 2507 short x = (short) vh.getAndSet(); 2508 }); 2509 checkWMTE(() -> { // > 2510 short x = (short) vh.getAndSet(array, 0, (short)0x0123, Void.class); 2511 }); 2512 2513 2514 // GetAndSetAcquire 2515 // Incorrect argument types 2516 checkNPE(() -> { // null array 2517 short x = (short) vh.getAndSetAcquire(null, 0, (short)0x0123); 2518 }); 2519 checkCCE(() -> { // array reference class 2520 short x = (short) vh.getAndSetAcquire(Void.class, 0, (short)0x0123); 2521 }); 2522 checkWMTE(() -> { // value reference class 2523 short x = (short) vh.getAndSetAcquire(array, 0, Void.class); 2524 }); 2525 checkWMTE(() -> { // reciarrayever primitive class 2526 short x = (short) vh.getAndSetAcquire(0, 0, (short)0x0123); 2527 }); 2528 checkWMTE(() -> { // index reference class 2529 short x = (short) vh.getAndSetAcquire(array, Void.class, (short)0x0123); 2530 }); 2531 // Incorrect return type 2532 checkWMTE(() -> { // reference class 2533 Void r = (Void) vh.getAndSetAcquire(array, 0, (short)0x0123); 2534 }); 2535 checkWMTE(() -> { // primitive class 2536 boolean x = (boolean) vh.getAndSetAcquire(array, 0, (short)0x0123); 2537 }); 2538 // Incorrect arity 2539 checkWMTE(() -> { // 0 2540 short x = (short) vh.getAndSetAcquire(); 2541 }); 2542 checkWMTE(() -> { // > 2543 short x = (short) vh.getAndSetAcquire(array, 0, (short)0x0123, Void.class); 2544 }); 2545 2546 2547 // GetAndSetRelease 2548 // Incorrect argument types 2549 checkNPE(() -> { // null array 2550 short x = (short) vh.getAndSetRelease(null, 0, (short)0x0123); 2551 }); 2552 checkCCE(() -> { // array reference class 2553 short x = (short) vh.getAndSetRelease(Void.class, 0, (short)0x0123); 2554 }); 2555 checkWMTE(() -> { // value reference class 2556 short x = (short) vh.getAndSetRelease(array, 0, Void.class); 2557 }); 2558 checkWMTE(() -> { // reciarrayever primitive class 2559 short x = (short) vh.getAndSetRelease(0, 0, (short)0x0123); 2560 }); 2561 checkWMTE(() -> { // index reference class 2562 short x = (short) vh.getAndSetRelease(array, Void.class, (short)0x0123); 2563 }); 2564 // Incorrect return type 2565 checkWMTE(() -> { // reference class 2566 Void r = (Void) vh.getAndSetRelease(array, 0, (short)0x0123); 2567 }); 2568 checkWMTE(() -> { // primitive class 2569 boolean x = (boolean) vh.getAndSetRelease(array, 0, (short)0x0123); 2570 }); 2571 // Incorrect arity 2572 checkWMTE(() -> { // 0 2573 short x = (short) vh.getAndSetRelease(); 2574 }); 2575 checkWMTE(() -> { // > 2576 short x = (short) vh.getAndSetRelease(array, 0, (short)0x0123, Void.class); 2577 }); 2578 2579 // GetAndAdd 2580 // Incorrect argument types 2581 checkNPE(() -> { // null array 2582 short x = (short) vh.getAndAdd(null, 0, (short)0x0123); 2583 }); 2584 checkCCE(() -> { // array reference class 2585 short x = (short) vh.getAndAdd(Void.class, 0, (short)0x0123); 2586 }); 2587 checkWMTE(() -> { // value reference class 2588 short x = (short) vh.getAndAdd(array, 0, Void.class); 2589 }); 2590 checkWMTE(() -> { // array primitive class 2591 short x = (short) vh.getAndAdd(0, 0, (short)0x0123); 2592 }); 2593 checkWMTE(() -> { // index reference class 2594 short x = (short) vh.getAndAdd(array, Void.class, (short)0x0123); 2595 }); 2596 // Incorrect return type 2597 checkWMTE(() -> { // reference class 2598 Void r = (Void) vh.getAndAdd(array, 0, (short)0x0123); 2599 }); 2600 checkWMTE(() -> { // primitive class 2601 boolean x = (boolean) vh.getAndAdd(array, 0, (short)0x0123); 2602 }); 2603 // Incorrect arity 2604 checkWMTE(() -> { // 0 2605 short x = (short) vh.getAndAdd(); 2606 }); 2607 checkWMTE(() -> { // > 2608 short x = (short) vh.getAndAdd(array, 0, (short)0x0123, Void.class); 2609 }); 2610 2611 2612 // GetAndAddAcquire 2613 // Incorrect argument types 2614 checkNPE(() -> { // null array 2615 short x = (short) vh.getAndAddAcquire(null, 0, (short)0x0123); 2616 }); 2617 checkCCE(() -> { // array reference class 2618 short x = (short) vh.getAndAddAcquire(Void.class, 0, (short)0x0123); 2619 }); 2620 checkWMTE(() -> { // value reference class 2621 short x = (short) vh.getAndAddAcquire(array, 0, Void.class); 2622 }); 2623 checkWMTE(() -> { // array primitive class 2624 short x = (short) vh.getAndAddAcquire(0, 0, (short)0x0123); 2625 }); 2626 checkWMTE(() -> { // index reference class 2627 short x = (short) vh.getAndAddAcquire(array, Void.class, (short)0x0123); 2628 }); 2629 // Incorrect return type 2630 checkWMTE(() -> { // reference class 2631 Void r = (Void) vh.getAndAddAcquire(array, 0, (short)0x0123); 2632 }); 2633 checkWMTE(() -> { // primitive class 2634 boolean x = (boolean) vh.getAndAddAcquire(array, 0, (short)0x0123); 2635 }); 2636 // Incorrect arity 2637 checkWMTE(() -> { // 0 2638 short x = (short) vh.getAndAddAcquire(); 2639 }); 2640 checkWMTE(() -> { // > 2641 short x = (short) vh.getAndAddAcquire(array, 0, (short)0x0123, Void.class); 2642 }); 2643 2644 2645 // GetAndAddRelease 2646 // Incorrect argument types 2647 checkNPE(() -> { // null array 2648 short x = (short) vh.getAndAddRelease(null, 0, (short)0x0123); 2649 }); 2650 checkCCE(() -> { // array reference class 2651 short x = (short) vh.getAndAddRelease(Void.class, 0, (short)0x0123); 2652 }); 2653 checkWMTE(() -> { // value reference class 2654 short x = (short) vh.getAndAddRelease(array, 0, Void.class); 2655 }); 2656 checkWMTE(() -> { // array primitive class 2657 short x = (short) vh.getAndAddRelease(0, 0, (short)0x0123); 2658 }); 2659 checkWMTE(() -> { // index reference class 2660 short x = (short) vh.getAndAddRelease(array, Void.class, (short)0x0123); 2661 }); 2662 // Incorrect return type 2663 checkWMTE(() -> { // reference class 2664 Void r = (Void) vh.getAndAddRelease(array, 0, (short)0x0123); 2665 }); 2666 checkWMTE(() -> { // primitive class 2667 boolean x = (boolean) vh.getAndAddRelease(array, 0, (short)0x0123); 2668 }); 2669 // Incorrect arity 2670 checkWMTE(() -> { // 0 2671 short x = (short) vh.getAndAddRelease(); 2672 }); 2673 checkWMTE(() -> { // > 2674 short x = (short) vh.getAndAddRelease(array, 0, (short)0x0123, Void.class); 2675 }); 2676 2677 // GetAndBitwiseOr 2678 // Incorrect argument types 2679 checkNPE(() -> { // null array 2680 short x = (short) vh.getAndBitwiseOr(null, 0, (short)0x0123); 2681 }); 2682 checkCCE(() -> { // array reference class 2683 short x = (short) vh.getAndBitwiseOr(Void.class, 0, (short)0x0123); 2684 }); 2685 checkWMTE(() -> { // value reference class 2686 short x = (short) vh.getAndBitwiseOr(array, 0, Void.class); 2687 }); 2688 checkWMTE(() -> { // array primitive class 2689 short x = (short) vh.getAndBitwiseOr(0, 0, (short)0x0123); 2690 }); 2691 checkWMTE(() -> { // index reference class 2692 short x = (short) vh.getAndBitwiseOr(array, Void.class, (short)0x0123); 2693 }); 2694 // Incorrect return type 2695 checkWMTE(() -> { // reference class 2696 Void r = (Void) vh.getAndBitwiseOr(array, 0, (short)0x0123); 2697 }); 2698 checkWMTE(() -> { // primitive class 2699 boolean x = (boolean) vh.getAndBitwiseOr(array, 0, (short)0x0123); 2700 }); 2701 // Incorrect arity 2702 checkWMTE(() -> { // 0 2703 short x = (short) vh.getAndBitwiseOr(); 2704 }); 2705 checkWMTE(() -> { // > 2706 short x = (short) vh.getAndBitwiseOr(array, 0, (short)0x0123, Void.class); 2707 }); 2708 2709 2710 // GetAndBitwiseOrAcquire 2711 // Incorrect argument types 2712 checkNPE(() -> { // null array 2713 short x = (short) vh.getAndBitwiseOrAcquire(null, 0, (short)0x0123); 2714 }); 2715 checkCCE(() -> { // array reference class 2716 short x = (short) vh.getAndBitwiseOrAcquire(Void.class, 0, (short)0x0123); 2717 }); 2718 checkWMTE(() -> { // value reference class 2719 short x = (short) vh.getAndBitwiseOrAcquire(array, 0, Void.class); 2720 }); 2721 checkWMTE(() -> { // array primitive class 2722 short x = (short) vh.getAndBitwiseOrAcquire(0, 0, (short)0x0123); 2723 }); 2724 checkWMTE(() -> { // index reference class 2725 short x = (short) vh.getAndBitwiseOrAcquire(array, Void.class, (short)0x0123); 2726 }); 2727 // Incorrect return type 2728 checkWMTE(() -> { // reference class 2729 Void r = (Void) vh.getAndBitwiseOrAcquire(array, 0, (short)0x0123); 2730 }); 2731 checkWMTE(() -> { // primitive class 2732 boolean x = (boolean) vh.getAndBitwiseOrAcquire(array, 0, (short)0x0123); 2733 }); 2734 // Incorrect arity 2735 checkWMTE(() -> { // 0 2736 short x = (short) vh.getAndBitwiseOrAcquire(); 2737 }); 2738 checkWMTE(() -> { // > 2739 short x = (short) vh.getAndBitwiseOrAcquire(array, 0, (short)0x0123, Void.class); 2740 }); 2741 2742 2743 // GetAndBitwiseOrRelease 2744 // Incorrect argument types 2745 checkNPE(() -> { // null array 2746 short x = (short) vh.getAndBitwiseOrRelease(null, 0, (short)0x0123); 2747 }); 2748 checkCCE(() -> { // array reference class 2749 short x = (short) vh.getAndBitwiseOrRelease(Void.class, 0, (short)0x0123); 2750 }); 2751 checkWMTE(() -> { // value reference class 2752 short x = (short) vh.getAndBitwiseOrRelease(array, 0, Void.class); 2753 }); 2754 checkWMTE(() -> { // array primitive class 2755 short x = (short) vh.getAndBitwiseOrRelease(0, 0, (short)0x0123); 2756 }); 2757 checkWMTE(() -> { // index reference class 2758 short x = (short) vh.getAndBitwiseOrRelease(array, Void.class, (short)0x0123); 2759 }); 2760 // Incorrect return type 2761 checkWMTE(() -> { // reference class 2762 Void r = (Void) vh.getAndBitwiseOrRelease(array, 0, (short)0x0123); 2763 }); 2764 checkWMTE(() -> { // primitive class 2765 boolean x = (boolean) vh.getAndBitwiseOrRelease(array, 0, (short)0x0123); 2766 }); 2767 // Incorrect arity 2768 checkWMTE(() -> { // 0 2769 short x = (short) vh.getAndBitwiseOrRelease(); 2770 }); 2771 checkWMTE(() -> { // > 2772 short x = (short) vh.getAndBitwiseOrRelease(array, 0, (short)0x0123, Void.class); 2773 }); 2774 2775 2776 // GetAndBitwiseAnd 2777 // Incorrect argument types 2778 checkNPE(() -> { // null array 2779 short x = (short) vh.getAndBitwiseAnd(null, 0, (short)0x0123); 2780 }); 2781 checkCCE(() -> { // array reference class 2782 short x = (short) vh.getAndBitwiseAnd(Void.class, 0, (short)0x0123); 2783 }); 2784 checkWMTE(() -> { // value reference class 2785 short x = (short) vh.getAndBitwiseAnd(array, 0, Void.class); 2786 }); 2787 checkWMTE(() -> { // array primitive class 2788 short x = (short) vh.getAndBitwiseAnd(0, 0, (short)0x0123); 2789 }); 2790 checkWMTE(() -> { // index reference class 2791 short x = (short) vh.getAndBitwiseAnd(array, Void.class, (short)0x0123); 2792 }); 2793 // Incorrect return type 2794 checkWMTE(() -> { // reference class 2795 Void r = (Void) vh.getAndBitwiseAnd(array, 0, (short)0x0123); 2796 }); 2797 checkWMTE(() -> { // primitive class 2798 boolean x = (boolean) vh.getAndBitwiseAnd(array, 0, (short)0x0123); 2799 }); 2800 // Incorrect arity 2801 checkWMTE(() -> { // 0 2802 short x = (short) vh.getAndBitwiseAnd(); 2803 }); 2804 checkWMTE(() -> { // > 2805 short x = (short) vh.getAndBitwiseAnd(array, 0, (short)0x0123, Void.class); 2806 }); 2807 2808 2809 // GetAndBitwiseAndAcquire 2810 // Incorrect argument types 2811 checkNPE(() -> { // null array 2812 short x = (short) vh.getAndBitwiseAndAcquire(null, 0, (short)0x0123); 2813 }); 2814 checkCCE(() -> { // array reference class 2815 short x = (short) vh.getAndBitwiseAndAcquire(Void.class, 0, (short)0x0123); 2816 }); 2817 checkWMTE(() -> { // value reference class 2818 short x = (short) vh.getAndBitwiseAndAcquire(array, 0, Void.class); 2819 }); 2820 checkWMTE(() -> { // array primitive class 2821 short x = (short) vh.getAndBitwiseAndAcquire(0, 0, (short)0x0123); 2822 }); 2823 checkWMTE(() -> { // index reference class 2824 short x = (short) vh.getAndBitwiseAndAcquire(array, Void.class, (short)0x0123); 2825 }); 2826 // Incorrect return type 2827 checkWMTE(() -> { // reference class 2828 Void r = (Void) vh.getAndBitwiseAndAcquire(array, 0, (short)0x0123); 2829 }); 2830 checkWMTE(() -> { // primitive class 2831 boolean x = (boolean) vh.getAndBitwiseAndAcquire(array, 0, (short)0x0123); 2832 }); 2833 // Incorrect arity 2834 checkWMTE(() -> { // 0 2835 short x = (short) vh.getAndBitwiseAndAcquire(); 2836 }); 2837 checkWMTE(() -> { // > 2838 short x = (short) vh.getAndBitwiseAndAcquire(array, 0, (short)0x0123, Void.class); 2839 }); 2840 2841 2842 // GetAndBitwiseAndRelease 2843 // Incorrect argument types 2844 checkNPE(() -> { // null array 2845 short x = (short) vh.getAndBitwiseAndRelease(null, 0, (short)0x0123); 2846 }); 2847 checkCCE(() -> { // array reference class 2848 short x = (short) vh.getAndBitwiseAndRelease(Void.class, 0, (short)0x0123); 2849 }); 2850 checkWMTE(() -> { // value reference class 2851 short x = (short) vh.getAndBitwiseAndRelease(array, 0, Void.class); 2852 }); 2853 checkWMTE(() -> { // array primitive class 2854 short x = (short) vh.getAndBitwiseAndRelease(0, 0, (short)0x0123); 2855 }); 2856 checkWMTE(() -> { // index reference class 2857 short x = (short) vh.getAndBitwiseAndRelease(array, Void.class, (short)0x0123); 2858 }); 2859 // Incorrect return type 2860 checkWMTE(() -> { // reference class 2861 Void r = (Void) vh.getAndBitwiseAndRelease(array, 0, (short)0x0123); 2862 }); 2863 checkWMTE(() -> { // primitive class 2864 boolean x = (boolean) vh.getAndBitwiseAndRelease(array, 0, (short)0x0123); 2865 }); 2866 // Incorrect arity 2867 checkWMTE(() -> { // 0 2868 short x = (short) vh.getAndBitwiseAndRelease(); 2869 }); 2870 checkWMTE(() -> { // > 2871 short x = (short) vh.getAndBitwiseAndRelease(array, 0, (short)0x0123, Void.class); 2872 }); 2873 2874 2875 // GetAndBitwiseXor 2876 // Incorrect argument types 2877 checkNPE(() -> { // null array 2878 short x = (short) vh.getAndBitwiseXor(null, 0, (short)0x0123); 2879 }); 2880 checkCCE(() -> { // array reference class 2881 short x = (short) vh.getAndBitwiseXor(Void.class, 0, (short)0x0123); 2882 }); 2883 checkWMTE(() -> { // value reference class 2884 short x = (short) vh.getAndBitwiseXor(array, 0, Void.class); 2885 }); 2886 checkWMTE(() -> { // array primitive class 2887 short x = (short) vh.getAndBitwiseXor(0, 0, (short)0x0123); 2888 }); 2889 checkWMTE(() -> { // index reference class 2890 short x = (short) vh.getAndBitwiseXor(array, Void.class, (short)0x0123); 2891 }); 2892 // Incorrect return type 2893 checkWMTE(() -> { // reference class 2894 Void r = (Void) vh.getAndBitwiseXor(array, 0, (short)0x0123); 2895 }); 2896 checkWMTE(() -> { // primitive class 2897 boolean x = (boolean) vh.getAndBitwiseXor(array, 0, (short)0x0123); 2898 }); 2899 // Incorrect arity 2900 checkWMTE(() -> { // 0 2901 short x = (short) vh.getAndBitwiseXor(); 2902 }); 2903 checkWMTE(() -> { // > 2904 short x = (short) vh.getAndBitwiseXor(array, 0, (short)0x0123, Void.class); 2905 }); 2906 2907 2908 // GetAndBitwiseXorAcquire 2909 // Incorrect argument types 2910 checkNPE(() -> { // null array 2911 short x = (short) vh.getAndBitwiseXorAcquire(null, 0, (short)0x0123); 2912 }); 2913 checkCCE(() -> { // array reference class 2914 short x = (short) vh.getAndBitwiseXorAcquire(Void.class, 0, (short)0x0123); 2915 }); 2916 checkWMTE(() -> { // value reference class 2917 short x = (short) vh.getAndBitwiseXorAcquire(array, 0, Void.class); 2918 }); 2919 checkWMTE(() -> { // array primitive class 2920 short x = (short) vh.getAndBitwiseXorAcquire(0, 0, (short)0x0123); 2921 }); 2922 checkWMTE(() -> { // index reference class 2923 short x = (short) vh.getAndBitwiseXorAcquire(array, Void.class, (short)0x0123); 2924 }); 2925 // Incorrect return type 2926 checkWMTE(() -> { // reference class 2927 Void r = (Void) vh.getAndBitwiseXorAcquire(array, 0, (short)0x0123); 2928 }); 2929 checkWMTE(() -> { // primitive class 2930 boolean x = (boolean) vh.getAndBitwiseXorAcquire(array, 0, (short)0x0123); 2931 }); 2932 // Incorrect arity 2933 checkWMTE(() -> { // 0 2934 short x = (short) vh.getAndBitwiseXorAcquire(); 2935 }); 2936 checkWMTE(() -> { // > 2937 short x = (short) vh.getAndBitwiseXorAcquire(array, 0, (short)0x0123, Void.class); 2938 }); 2939 2940 2941 // GetAndBitwiseXorRelease 2942 // Incorrect argument types 2943 checkNPE(() -> { // null array 2944 short x = (short) vh.getAndBitwiseXorRelease(null, 0, (short)0x0123); 2945 }); 2946 checkCCE(() -> { // array reference class 2947 short x = (short) vh.getAndBitwiseXorRelease(Void.class, 0, (short)0x0123); 2948 }); 2949 checkWMTE(() -> { // value reference class 2950 short x = (short) vh.getAndBitwiseXorRelease(array, 0, Void.class); 2951 }); 2952 checkWMTE(() -> { // array primitive class 2953 short x = (short) vh.getAndBitwiseXorRelease(0, 0, (short)0x0123); 2954 }); 2955 checkWMTE(() -> { // index reference class 2956 short x = (short) vh.getAndBitwiseXorRelease(array, Void.class, (short)0x0123); 2957 }); 2958 // Incorrect return type 2959 checkWMTE(() -> { // reference class 2960 Void r = (Void) vh.getAndBitwiseXorRelease(array, 0, (short)0x0123); 2961 }); 2962 checkWMTE(() -> { // primitive class 2963 boolean x = (boolean) vh.getAndBitwiseXorRelease(array, 0, (short)0x0123); 2964 }); 2965 // Incorrect arity 2966 checkWMTE(() -> { // 0 2967 short x = (short) vh.getAndBitwiseXorRelease(); 2968 }); 2969 checkWMTE(() -> { // > 2970 short x = (short) vh.getAndBitwiseXorRelease(array, 0, (short)0x0123, Void.class); 2971 }); 2972 } 2973 2974 static void testArrayWrongMethodType(Handles hs) throws Throwable { 2975 short[] array = new short[10]; 2976 Arrays.fill(array, (short)0x0123); 2977 2978 for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) { 2979 // Incorrect argument types 2980 checkNPE(() -> { // null array 2981 short x = (short) hs.get(am, methodType(short.class, short[].class, int.class)). 2982 invokeExact((short[]) null, 0); 2983 }); 2984 hs.checkWMTEOrCCE(() -> { // array reference class 2985 short x = (short) hs.get(am, methodType(short.class, Class.class, int.class)). 2986 invokeExact(Void.class, 0); 2987 }); 2988 checkWMTE(() -> { // array primitive class 2989 short x = (short) hs.get(am, methodType(short.class, int.class, int.class)). 2990 invokeExact(0, 0); 2991 }); 2992 checkWMTE(() -> { // index reference class 2993 short x = (short) hs.get(am, methodType(short.class, short[].class, Class.class)). 2994 invokeExact(array, Void.class); 2995 }); 2996 // Incorrect return type 2997 checkWMTE(() -> { // reference class 2998 Void x = (Void) hs.get(am, methodType(Void.class, short[].class, int.class)). 2999 invokeExact(array, 0); 3000 }); 3001 checkWMTE(() -> { // primitive class 3002 boolean x = (boolean) hs.get(am, methodType(boolean.class, short[].class, int.class)). 3003 invokeExact(array, 0); 3004 }); 3005 // Incorrect arity 3006 checkWMTE(() -> { // 0 3007 short x = (short) hs.get(am, methodType(short.class)). 3008 invokeExact(); 3009 }); 3010 checkWMTE(() -> { // > 3011 short x = (short) hs.get(am, methodType(short.class, short[].class, int.class, Class.class)). 3012 invokeExact(array, 0, Void.class); 3013 }); 3014 } 3015 3016 for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { 3017 // Incorrect argument types 3018 checkNPE(() -> { // null array 3019 hs.get(am, methodType(void.class, short[].class, int.class, short.class)). 3020 invokeExact((short[]) null, 0, (short)0x0123); 3021 }); 3022 hs.checkWMTEOrCCE(() -> { // array reference class 3023 hs.get(am, methodType(void.class, Class.class, int.class, short.class)). 3024 invokeExact(Void.class, 0, (short)0x0123); 3025 }); 3026 checkWMTE(() -> { // value reference class 3027 hs.get(am, methodType(void.class, short[].class, int.class, Class.class)). 3028 invokeExact(array, 0, Void.class); 3029 }); 3030 checkWMTE(() -> { // receiver primitive class 3031 hs.get(am, methodType(void.class, int.class, int.class, short.class)). 3032 invokeExact(0, 0, (short)0x0123); 3033 }); 3034 checkWMTE(() -> { // index reference class 3035 hs.get(am, methodType(void.class, short[].class, Class.class, short.class)). 3036 invokeExact(array, Void.class, (short)0x0123); 3037 }); 3038 // Incorrect arity 3039 checkWMTE(() -> { // 0 3040 hs.get(am, methodType(void.class)). 3041 invokeExact(); 3042 }); 3043 checkWMTE(() -> { // > 3044 hs.get(am, methodType(void.class, short[].class, int.class, Class.class)). 3045 invokeExact(array, 0, (short)0x0123, Void.class); 3046 }); 3047 } 3048 for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) { 3049 // Incorrect argument types 3050 checkNPE(() -> { // null receiver 3051 boolean r = (boolean) hs.get(am, methodType(boolean.class, short[].class, int.class, short.class, short.class)). 3052 invokeExact((short[]) null, 0, (short)0x0123, (short)0x0123); 3053 }); 3054 hs.checkWMTEOrCCE(() -> { // receiver reference class 3055 boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, int.class, short.class, short.class)). 3056 invokeExact(Void.class, 0, (short)0x0123, (short)0x0123); 3057 }); 3058 checkWMTE(() -> { // expected reference class 3059 boolean r = (boolean) hs.get(am, methodType(boolean.class, short[].class, int.class, Class.class, short.class)). 3060 invokeExact(array, 0, Void.class, (short)0x0123); 3061 }); 3062 checkWMTE(() -> { // actual reference class 3063 boolean r = (boolean) hs.get(am, methodType(boolean.class, short[].class, int.class, short.class, Class.class)). 3064 invokeExact(array, 0, (short)0x0123, Void.class); 3065 }); 3066 checkWMTE(() -> { // receiver primitive class 3067 boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class, int.class, short.class, short.class)). 3068 invokeExact(0, 0, (short)0x0123, (short)0x0123); 3069 }); 3070 checkWMTE(() -> { // index reference class 3071 boolean r = (boolean) hs.get(am, methodType(boolean.class, short[].class, Class.class, short.class, short.class)). 3072 invokeExact(array, Void.class, (short)0x0123, (short)0x0123); 3073 }); 3074 // Incorrect arity 3075 checkWMTE(() -> { // 0 3076 boolean r = (boolean) hs.get(am, methodType(boolean.class)). 3077 invokeExact(); 3078 }); 3079 checkWMTE(() -> { // > 3080 boolean r = (boolean) hs.get(am, methodType(boolean.class, short[].class, int.class, short.class, short.class, Class.class)). 3081 invokeExact(array, 0, (short)0x0123, (short)0x0123, Void.class); 3082 }); 3083 } 3084 3085 for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) { 3086 // Incorrect argument types 3087 checkNPE(() -> { // null receiver 3088 short x = (short) hs.get(am, methodType(short.class, short[].class, int.class, short.class, short.class)). 3089 invokeExact((short[]) null, 0, (short)0x0123, (short)0x0123); 3090 }); 3091 hs.checkWMTEOrCCE(() -> { // array reference class 3092 short x = (short) hs.get(am, methodType(short.class, Class.class, int.class, short.class, short.class)). 3093 invokeExact(Void.class, 0, (short)0x0123, (short)0x0123); 3094 }); 3095 checkWMTE(() -> { // expected reference class 3096 short x = (short) hs.get(am, methodType(short.class, short[].class, int.class, Class.class, short.class)). 3097 invokeExact(array, 0, Void.class, (short)0x0123); 3098 }); 3099 checkWMTE(() -> { // actual reference class 3100 short x = (short) hs.get(am, methodType(short.class, short[].class, int.class, short.class, Class.class)). 3101 invokeExact(array, 0, (short)0x0123, Void.class); 3102 }); 3103 checkWMTE(() -> { // array primitive class 3104 short x = (short) hs.get(am, methodType(short.class, int.class, int.class, short.class, short.class)). 3105 invokeExact(0, 0, (short)0x0123, (short)0x0123); 3106 }); 3107 checkWMTE(() -> { // index reference class 3108 short x = (short) hs.get(am, methodType(short.class, short[].class, Class.class, short.class, short.class)). 3109 invokeExact(array, Void.class, (short)0x0123, (short)0x0123); 3110 }); 3111 // Incorrect return type 3112 checkWMTE(() -> { // reference class 3113 Void r = (Void) hs.get(am, methodType(Void.class, short[].class, int.class, short.class, short.class)). 3114 invokeExact(array, 0, (short)0x0123, (short)0x0123); 3115 }); 3116 checkWMTE(() -> { // primitive class 3117 boolean x = (boolean) hs.get(am, methodType(boolean.class, short[].class, int.class, short.class, short.class)). 3118 invokeExact(array, 0, (short)0x0123, (short)0x0123); 3119 }); 3120 // Incorrect arity 3121 checkWMTE(() -> { // 0 3122 short x = (short) hs.get(am, methodType(short.class)). 3123 invokeExact(); 3124 }); 3125 checkWMTE(() -> { // > 3126 short x = (short) hs.get(am, methodType(short.class, short[].class, int.class, short.class, short.class, Class.class)). 3127 invokeExact(array, 0, (short)0x0123, (short)0x0123, Void.class); 3128 }); 3129 } 3130 3131 for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) { 3132 // Incorrect argument types 3133 checkNPE(() -> { // null array 3134 short x = (short) hs.get(am, methodType(short.class, short[].class, int.class, short.class)). 3135 invokeExact((short[]) null, 0, (short)0x0123); 3136 }); 3137 hs.checkWMTEOrCCE(() -> { // array reference class 3138 short x = (short) hs.get(am, methodType(short.class, Class.class, int.class, short.class)). 3139 invokeExact(Void.class, 0, (short)0x0123); 3140 }); 3141 checkWMTE(() -> { // value reference class 3142 short x = (short) hs.get(am, methodType(short.class, short[].class, int.class, Class.class)). 3143 invokeExact(array, 0, Void.class); 3144 }); 3145 checkWMTE(() -> { // array primitive class 3146 short x = (short) hs.get(am, methodType(short.class, int.class, int.class, short.class)). 3147 invokeExact(0, 0, (short)0x0123); 3148 }); 3149 checkWMTE(() -> { // index reference class 3150 short x = (short) hs.get(am, methodType(short.class, short[].class, Class.class, short.class)). 3151 invokeExact(array, Void.class, (short)0x0123); 3152 }); 3153 // Incorrect return type 3154 checkWMTE(() -> { // reference class 3155 Void r = (Void) hs.get(am, methodType(Void.class, short[].class, int.class, short.class)). 3156 invokeExact(array, 0, (short)0x0123); 3157 }); 3158 checkWMTE(() -> { // primitive class 3159 boolean x = (boolean) hs.get(am, methodType(boolean.class, short[].class, int.class, short.class)). 3160 invokeExact(array, 0, (short)0x0123); 3161 }); 3162 // Incorrect arity 3163 checkWMTE(() -> { // 0 3164 short x = (short) hs.get(am, methodType(short.class)). 3165 invokeExact(); 3166 }); 3167 checkWMTE(() -> { // > 3168 short x = (short) hs.get(am, methodType(short.class, short[].class, int.class, short.class, Class.class)). 3169 invokeExact(array, 0, (short)0x0123, Void.class); 3170 }); 3171 } 3172 3173 for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) { 3174 // Incorrect argument types 3175 checkNPE(() -> { // null array 3176 short x = (short) hs.get(am, methodType(short.class, short[].class, int.class, short.class)). 3177 invokeExact((short[]) null, 0, (short)0x0123); 3178 }); 3179 hs.checkWMTEOrCCE(() -> { // array reference class 3180 short x = (short) hs.get(am, methodType(short.class, Class.class, int.class, short.class)). 3181 invokeExact(Void.class, 0, (short)0x0123); 3182 }); 3183 checkWMTE(() -> { // value reference class 3184 short x = (short) hs.get(am, methodType(short.class, short[].class, int.class, Class.class)). 3185 invokeExact(array, 0, Void.class); 3186 }); 3187 checkWMTE(() -> { // array primitive class 3188 short x = (short) hs.get(am, methodType(short.class, int.class, int.class, short.class)). 3189 invokeExact(0, 0, (short)0x0123); 3190 }); 3191 checkWMTE(() -> { // index reference class 3192 short x = (short) hs.get(am, methodType(short.class, short[].class, Class.class, short.class)). 3193 invokeExact(array, Void.class, (short)0x0123); 3194 }); 3195 // Incorrect return type 3196 checkWMTE(() -> { // reference class 3197 Void r = (Void) hs.get(am, methodType(Void.class, short[].class, int.class, short.class)). 3198 invokeExact(array, 0, (short)0x0123); 3199 }); 3200 checkWMTE(() -> { // primitive class 3201 boolean x = (boolean) hs.get(am, methodType(boolean.class, short[].class, int.class, short.class)). 3202 invokeExact(array, 0, (short)0x0123); 3203 }); 3204 // Incorrect arity 3205 checkWMTE(() -> { // 0 3206 short x = (short) hs.get(am, methodType(short.class)). 3207 invokeExact(); 3208 }); 3209 checkWMTE(() -> { // > 3210 short x = (short) hs.get(am, methodType(short.class, short[].class, int.class, short.class, Class.class)). 3211 invokeExact(array, 0, (short)0x0123, Void.class); 3212 }); 3213 } 3214 3215 for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { 3216 // Incorrect argument types 3217 checkNPE(() -> { // null array 3218 short x = (short) hs.get(am, methodType(short.class, short[].class, int.class, short.class)). 3219 invokeExact((short[]) null, 0, (short)0x0123); 3220 }); 3221 hs.checkWMTEOrCCE(() -> { // array reference class 3222 short x = (short) hs.get(am, methodType(short.class, Class.class, int.class, short.class)). 3223 invokeExact(Void.class, 0, (short)0x0123); 3224 }); 3225 checkWMTE(() -> { // value reference class 3226 short x = (short) hs.get(am, methodType(short.class, short[].class, int.class, Class.class)). 3227 invokeExact(array, 0, Void.class); 3228 }); 3229 checkWMTE(() -> { // array primitive class 3230 short x = (short) hs.get(am, methodType(short.class, int.class, int.class, short.class)). 3231 invokeExact(0, 0, (short)0x0123); 3232 }); 3233 checkWMTE(() -> { // index reference class 3234 short x = (short) hs.get(am, methodType(short.class, short[].class, Class.class, short.class)). 3235 invokeExact(array, Void.class, (short)0x0123); 3236 }); 3237 // Incorrect return type 3238 checkWMTE(() -> { // reference class 3239 Void r = (Void) hs.get(am, methodType(Void.class, short[].class, int.class, short.class)). 3240 invokeExact(array, 0, (short)0x0123); 3241 }); 3242 checkWMTE(() -> { // primitive class 3243 boolean x = (boolean) hs.get(am, methodType(boolean.class, short[].class, int.class, short.class)). 3244 invokeExact(array, 0, (short)0x0123); 3245 }); 3246 // Incorrect arity 3247 checkWMTE(() -> { // 0 3248 short x = (short) hs.get(am, methodType(short.class)). 3249 invokeExact(); 3250 }); 3251 checkWMTE(() -> { // > 3252 short x = (short) hs.get(am, methodType(short.class, short[].class, int.class, short.class, Class.class)). 3253 invokeExact(array, 0, (short)0x0123, Void.class); 3254 }); 3255 } 3256 } 3257 }