X-VarHandleTestMethodType.java.template revision 14958:bb16dd0ce557
1/* 2 * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24/* 25 * @test 26 * @bug 8156486 27 * @run testng/othervm VarHandleTestMethodType$Type$ 28 * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodType$Type$ 29 */ 30 31import org.testng.annotations.BeforeClass; 32import org.testng.annotations.DataProvider; 33import org.testng.annotations.Test; 34 35import java.lang.invoke.MethodHandles; 36import java.lang.invoke.VarHandle; 37import java.util.ArrayList; 38import java.util.Arrays; 39import java.util.List; 40 41import static org.testng.Assert.*; 42 43import static java.lang.invoke.MethodType.*; 44 45public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest { 46 static final $type$ static_final_v = $value1$; 47 48 static $type$ static_v = $value1$; 49 50 final $type$ final_v = $value1$; 51 52 $type$ v = $value1$; 53 54 VarHandle vhFinalField; 55 56 VarHandle vhField; 57 58 VarHandle vhStaticField; 59 60 VarHandle vhStaticFinalField; 61 62 VarHandle vhArray; 63 64 @BeforeClass 65 public void setup() throws Exception { 66 vhFinalField = MethodHandles.lookup().findVarHandle( 67 VarHandleTestMethodType$Type$.class, "final_v", $type$.class); 68 69 vhField = MethodHandles.lookup().findVarHandle( 70 VarHandleTestMethodType$Type$.class, "v", $type$.class); 71 72 vhStaticFinalField = MethodHandles.lookup().findStaticVarHandle( 73 VarHandleTestMethodType$Type$.class, "static_final_v", $type$.class); 74 75 vhStaticField = MethodHandles.lookup().findStaticVarHandle( 76 VarHandleTestMethodType$Type$.class, "static_v", $type$.class); 77 78 vhArray = MethodHandles.arrayElementVarHandle($type$[].class); 79 } 80 81 @DataProvider 82 public Object[][] accessTestCaseProvider() throws Exception { 83 List<AccessTestCase<?>> cases = new ArrayList<>(); 84 85 cases.add(new VarHandleAccessTestCase("Instance field", 86 vhField, vh -> testInstanceFieldWrongMethodType(this, vh), 87 false)); 88 89 cases.add(new VarHandleAccessTestCase("Static field", 90 vhStaticField, VarHandleTestMethodType$Type$::testStaticFieldWrongMethodType, 91 false)); 92 93 cases.add(new VarHandleAccessTestCase("Array", 94 vhArray, VarHandleTestMethodType$Type$::testArrayWrongMethodType, 95 false)); 96 97 for (VarHandleToMethodHandle f : VarHandleToMethodHandle.values()) { 98 cases.add(new MethodHandleAccessTestCase("Instance field", 99 vhField, f, hs -> testInstanceFieldWrongMethodType(this, hs), 100 false)); 101 102 cases.add(new MethodHandleAccessTestCase("Static field", 103 vhStaticField, f, VarHandleTestMethodType$Type$::testStaticFieldWrongMethodType, 104 false)); 105 106 cases.add(new MethodHandleAccessTestCase("Array", 107 vhArray, f, VarHandleTestMethodType$Type$::testArrayWrongMethodType, 108 false)); 109 } 110 // Work around issue with jtreg summary reporting which truncates 111 // the String result of Object.toString to 30 characters, hence 112 // the first dummy argument 113 return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new); 114 } 115 116 @Test(dataProvider = "accessTestCaseProvider") 117 public <T> void testAccess(String desc, AccessTestCase<T> atc) throws Throwable { 118 T t = atc.get(); 119 int iters = atc.requiresLoop() ? ITERS : 1; 120 for (int c = 0; c < iters; c++) { 121 atc.testAccess(t); 122 } 123 } 124 125 126 static void testInstanceFieldWrongMethodType(VarHandleTestMethodType$Type$ recv, VarHandle vh) throws Throwable { 127 // Get 128 // Incorrect argument types 129 checkNPE(() -> { // null receiver 130 $type$ x = ($type$) vh.get(null); 131 }); 132 checkCCE(() -> { // receiver reference class 133 $type$ x = ($type$) vh.get(Void.class); 134 }); 135 checkWMTE(() -> { // receiver primitive class 136 $type$ x = ($type$) vh.get(0); 137 }); 138 // Incorrect return type 139 check{#if[String]?CCE:WMTE}(() -> { // reference class 140 Void x = (Void) vh.get(recv); 141 }); 142 checkWMTE(() -> { // primitive class 143 $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.get(recv); 144 }); 145 // Incorrect arity 146 checkWMTE(() -> { // 0 147 $type$ x = ($type$) vh.get(); 148 }); 149 checkWMTE(() -> { // > 150 $type$ x = ($type$) vh.get(recv, Void.class); 151 }); 152 153 154 // Set 155 // Incorrect argument types 156 checkNPE(() -> { // null receiver 157 vh.set(null, $value1$); 158 }); 159 checkCCE(() -> { // receiver reference class 160 vh.set(Void.class, $value1$); 161 }); 162 check{#if[String]?CCE:WMTE}(() -> { // value reference class 163 vh.set(recv, Void.class); 164 }); 165 checkWMTE(() -> { // receiver primitive class 166 vh.set(0, $value1$); 167 }); 168 // Incorrect arity 169 checkWMTE(() -> { // 0 170 vh.set(); 171 }); 172 checkWMTE(() -> { // > 173 vh.set(recv, $value1$, Void.class); 174 }); 175 176 177 // GetVolatile 178 // Incorrect argument types 179 checkNPE(() -> { // null receiver 180 $type$ x = ($type$) vh.getVolatile(null); 181 }); 182 checkCCE(() -> { // receiver reference class 183 $type$ x = ($type$) vh.getVolatile(Void.class); 184 }); 185 checkWMTE(() -> { // receiver primitive class 186 $type$ x = ($type$) vh.getVolatile(0); 187 }); 188 // Incorrect return type 189 check{#if[String]?CCE:WMTE}(() -> { // reference class 190 Void x = (Void) vh.getVolatile(recv); 191 }); 192 checkWMTE(() -> { // primitive class 193 $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getVolatile(recv); 194 }); 195 // Incorrect arity 196 checkWMTE(() -> { // 0 197 $type$ x = ($type$) vh.getVolatile(); 198 }); 199 checkWMTE(() -> { // > 200 $type$ x = ($type$) vh.getVolatile(recv, Void.class); 201 }); 202 203 204 // SetVolatile 205 // Incorrect argument types 206 checkNPE(() -> { // null receiver 207 vh.setVolatile(null, $value1$); 208 }); 209 checkCCE(() -> { // receiver reference class 210 vh.setVolatile(Void.class, $value1$); 211 }); 212 check{#if[String]?CCE:WMTE}(() -> { // value reference class 213 vh.setVolatile(recv, Void.class); 214 }); 215 checkWMTE(() -> { // receiver primitive class 216 vh.setVolatile(0, $value1$); 217 }); 218 // Incorrect arity 219 checkWMTE(() -> { // 0 220 vh.setVolatile(); 221 }); 222 checkWMTE(() -> { // > 223 vh.setVolatile(recv, $value1$, Void.class); 224 }); 225 226 227 // GetOpaque 228 // Incorrect argument types 229 checkNPE(() -> { // null receiver 230 $type$ x = ($type$) vh.getOpaque(null); 231 }); 232 checkCCE(() -> { // receiver reference class 233 $type$ x = ($type$) vh.getOpaque(Void.class); 234 }); 235 checkWMTE(() -> { // receiver primitive class 236 $type$ x = ($type$) vh.getOpaque(0); 237 }); 238 // Incorrect return type 239 check{#if[String]?CCE:WMTE}(() -> { // reference class 240 Void x = (Void) vh.getOpaque(recv); 241 }); 242 checkWMTE(() -> { // primitive class 243 $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getOpaque(recv); 244 }); 245 // Incorrect arity 246 checkWMTE(() -> { // 0 247 $type$ x = ($type$) vh.getOpaque(); 248 }); 249 checkWMTE(() -> { // > 250 $type$ x = ($type$) vh.getOpaque(recv, Void.class); 251 }); 252 253 254 // SetOpaque 255 // Incorrect argument types 256 checkNPE(() -> { // null receiver 257 vh.setOpaque(null, $value1$); 258 }); 259 checkCCE(() -> { // receiver reference class 260 vh.setOpaque(Void.class, $value1$); 261 }); 262 check{#if[String]?CCE:WMTE}(() -> { // value reference class 263 vh.setOpaque(recv, Void.class); 264 }); 265 checkWMTE(() -> { // receiver primitive class 266 vh.setOpaque(0, $value1$); 267 }); 268 // Incorrect arity 269 checkWMTE(() -> { // 0 270 vh.setOpaque(); 271 }); 272 checkWMTE(() -> { // > 273 vh.setOpaque(recv, $value1$, Void.class); 274 }); 275 276 277 // GetAcquire 278 // Incorrect argument types 279 checkNPE(() -> { // null receiver 280 $type$ x = ($type$) vh.getAcquire(null); 281 }); 282 checkCCE(() -> { // receiver reference class 283 $type$ x = ($type$) vh.getAcquire(Void.class); 284 }); 285 checkWMTE(() -> { // receiver primitive class 286 $type$ x = ($type$) vh.getAcquire(0); 287 }); 288 // Incorrect return type 289 check{#if[String]?CCE:WMTE}(() -> { // reference class 290 Void x = (Void) vh.getAcquire(recv); 291 }); 292 checkWMTE(() -> { // primitive class 293 $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAcquire(recv); 294 }); 295 // Incorrect arity 296 checkWMTE(() -> { // 0 297 $type$ x = ($type$) vh.getAcquire(); 298 }); 299 checkWMTE(() -> { // > 300 $type$ x = ($type$) vh.getAcquire(recv, Void.class); 301 }); 302 303 304 // SetRelease 305 // Incorrect argument types 306 checkNPE(() -> { // null receiver 307 vh.setRelease(null, $value1$); 308 }); 309 checkCCE(() -> { // receiver reference class 310 vh.setRelease(Void.class, $value1$); 311 }); 312 check{#if[String]?CCE:WMTE}(() -> { // value reference class 313 vh.setRelease(recv, Void.class); 314 }); 315 checkWMTE(() -> { // receiver primitive class 316 vh.setRelease(0, $value1$); 317 }); 318 // Incorrect arity 319 checkWMTE(() -> { // 0 320 vh.setRelease(); 321 }); 322 checkWMTE(() -> { // > 323 vh.setRelease(recv, $value1$, Void.class); 324 }); 325 326 327#if[CAS] 328 // CompareAndSet 329 // Incorrect argument types 330 checkNPE(() -> { // null receiver 331 boolean r = vh.compareAndSet(null, $value1$, $value1$); 332 }); 333 checkCCE(() -> { // receiver reference class 334 boolean r = vh.compareAndSet(Void.class, $value1$, $value1$); 335 }); 336 check{#if[String]?CCE:WMTE}(() -> { // expected reference class 337 boolean r = vh.compareAndSet(recv, Void.class, $value1$); 338 }); 339 check{#if[String]?CCE:WMTE}(() -> { // actual reference class 340 boolean r = vh.compareAndSet(recv, $value1$, Void.class); 341 }); 342 checkWMTE(() -> { // receiver primitive class 343 boolean r = vh.compareAndSet(0, $value1$, $value1$); 344 }); 345 // Incorrect arity 346 checkWMTE(() -> { // 0 347 boolean r = vh.compareAndSet(); 348 }); 349 checkWMTE(() -> { // > 350 boolean r = vh.compareAndSet(recv, $value1$, $value1$, Void.class); 351 }); 352 353 354 // WeakCompareAndSet 355 // Incorrect argument types 356 checkNPE(() -> { // null receiver 357 boolean r = vh.weakCompareAndSet(null, $value1$, $value1$); 358 }); 359 checkCCE(() -> { // receiver reference class 360 boolean r = vh.weakCompareAndSet(Void.class, $value1$, $value1$); 361 }); 362 check{#if[String]?CCE:WMTE}(() -> { // expected reference class 363 boolean r = vh.weakCompareAndSet(recv, Void.class, $value1$); 364 }); 365 check{#if[String]?CCE:WMTE}(() -> { // actual reference class 366 boolean r = vh.weakCompareAndSet(recv, $value1$, Void.class); 367 }); 368 checkWMTE(() -> { // receiver primitive class 369 boolean r = vh.weakCompareAndSet(0, $value1$, $value1$); 370 }); 371 // Incorrect arity 372 checkWMTE(() -> { // 0 373 boolean r = vh.weakCompareAndSet(); 374 }); 375 checkWMTE(() -> { // > 376 boolean r = vh.weakCompareAndSet(recv, $value1$, $value1$, Void.class); 377 }); 378 379 380 // WeakCompareAndSetVolatile 381 // Incorrect argument types 382 checkNPE(() -> { // null receiver 383 boolean r = vh.weakCompareAndSetVolatile(null, $value1$, $value1$); 384 }); 385 checkCCE(() -> { // receiver reference class 386 boolean r = vh.weakCompareAndSetVolatile(Void.class, $value1$, $value1$); 387 }); 388 check{#if[String]?CCE:WMTE}(() -> { // expected reference class 389 boolean r = vh.weakCompareAndSetVolatile(recv, Void.class, $value1$); 390 }); 391 check{#if[String]?CCE:WMTE}(() -> { // actual reference class 392 boolean r = vh.weakCompareAndSetVolatile(recv, $value1$, Void.class); 393 }); 394 checkWMTE(() -> { // receiver primitive class 395 boolean r = vh.weakCompareAndSetVolatile(0, $value1$, $value1$); 396 }); 397 // Incorrect arity 398 checkWMTE(() -> { // 0 399 boolean r = vh.weakCompareAndSetVolatile(); 400 }); 401 checkWMTE(() -> { // > 402 boolean r = vh.weakCompareAndSetVolatile(recv, $value1$, $value1$, Void.class); 403 }); 404 405 406 // WeakCompareAndSetAcquire 407 // Incorrect argument types 408 checkNPE(() -> { // null receiver 409 boolean r = vh.weakCompareAndSetAcquire(null, $value1$, $value1$); 410 }); 411 checkCCE(() -> { // receiver reference class 412 boolean r = vh.weakCompareAndSetAcquire(Void.class, $value1$, $value1$); 413 }); 414 check{#if[String]?CCE:WMTE}(() -> { // expected reference class 415 boolean r = vh.weakCompareAndSetAcquire(recv, Void.class, $value1$); 416 }); 417 check{#if[String]?CCE:WMTE}(() -> { // actual reference class 418 boolean r = vh.weakCompareAndSetAcquire(recv, $value1$, Void.class); 419 }); 420 checkWMTE(() -> { // receiver primitive class 421 boolean r = vh.weakCompareAndSetAcquire(0, $value1$, $value1$); 422 }); 423 // Incorrect arity 424 checkWMTE(() -> { // 0 425 boolean r = vh.weakCompareAndSetAcquire(); 426 }); 427 checkWMTE(() -> { // > 428 boolean r = vh.weakCompareAndSetAcquire(recv, $value1$, $value1$, Void.class); 429 }); 430 431 432 // WeakCompareAndSetRelease 433 // Incorrect argument types 434 checkNPE(() -> { // null receiver 435 boolean r = vh.weakCompareAndSetRelease(null, $value1$, $value1$); 436 }); 437 checkCCE(() -> { // receiver reference class 438 boolean r = vh.weakCompareAndSetRelease(Void.class, $value1$, $value1$); 439 }); 440 check{#if[String]?CCE:WMTE}(() -> { // expected reference class 441 boolean r = vh.weakCompareAndSetRelease(recv, Void.class, $value1$); 442 }); 443 check{#if[String]?CCE:WMTE}(() -> { // actual reference class 444 boolean r = vh.weakCompareAndSetRelease(recv, $value1$, Void.class); 445 }); 446 checkWMTE(() -> { // receiver primitive class 447 boolean r = vh.weakCompareAndSetRelease(0, $value1$, $value1$); 448 }); 449 // Incorrect arity 450 checkWMTE(() -> { // 0 451 boolean r = vh.weakCompareAndSetRelease(); 452 }); 453 checkWMTE(() -> { // > 454 boolean r = vh.weakCompareAndSetRelease(recv, $value1$, $value1$, Void.class); 455 }); 456 457 458 // CompareAndExchange 459 // Incorrect argument types 460 checkNPE(() -> { // null receiver 461 $type$ x = ($type$) vh.compareAndExchange(null, $value1$, $value1$); 462 }); 463 checkCCE(() -> { // receiver reference class 464 $type$ x = ($type$) vh.compareAndExchange(Void.class, $value1$, $value1$); 465 }); 466 check{#if[String]?CCE:WMTE}(() -> { // expected reference class 467 $type$ x = ($type$) vh.compareAndExchange(recv, Void.class, $value1$); 468 }); 469 check{#if[String]?CCE:WMTE}(() -> { // actual reference class 470 $type$ x = ($type$) vh.compareAndExchange(recv, $value1$, Void.class); 471 }); 472 checkWMTE(() -> { // reciever primitive class 473 $type$ x = ($type$) vh.compareAndExchange(0, $value1$, $value1$); 474 }); 475 // Incorrect return type 476 check{#if[String]?CCE:WMTE}(() -> { // reference class 477 Void r = (Void) vh.compareAndExchange(recv, $value1$, $value1$); 478 }); 479 checkWMTE(() -> { // primitive class 480 $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.compareAndExchange(recv, $value1$, $value1$); 481 }); 482 // Incorrect arity 483 checkWMTE(() -> { // 0 484 $type$ x = ($type$) vh.compareAndExchange(); 485 }); 486 checkWMTE(() -> { // > 487 $type$ x = ($type$) vh.compareAndExchange(recv, $value1$, $value1$, Void.class); 488 }); 489 490 491 // CompareAndExchangeAcquire 492 // Incorrect argument types 493 checkNPE(() -> { // null receiver 494 $type$ x = ($type$) vh.compareAndExchangeAcquire(null, $value1$, $value1$); 495 }); 496 checkCCE(() -> { // receiver reference class 497 $type$ x = ($type$) vh.compareAndExchangeAcquire(Void.class, $value1$, $value1$); 498 }); 499 check{#if[String]?CCE:WMTE}(() -> { // expected reference class 500 $type$ x = ($type$) vh.compareAndExchangeAcquire(recv, Void.class, $value1$); 501 }); 502 check{#if[String]?CCE:WMTE}(() -> { // actual reference class 503 $type$ x = ($type$) vh.compareAndExchangeAcquire(recv, $value1$, Void.class); 504 }); 505 checkWMTE(() -> { // reciever primitive class 506 $type$ x = ($type$) vh.compareAndExchangeAcquire(0, $value1$, $value1$); 507 }); 508 // Incorrect return type 509 check{#if[String]?CCE:WMTE}(() -> { // reference class 510 Void r = (Void) vh.compareAndExchangeAcquire(recv, $value1$, $value1$); 511 }); 512 checkWMTE(() -> { // primitive class 513 $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.compareAndExchangeAcquire(recv, $value1$, $value1$); 514 }); 515 // Incorrect arity 516 checkWMTE(() -> { // 0 517 $type$ x = ($type$) vh.compareAndExchangeAcquire(); 518 }); 519 checkWMTE(() -> { // > 520 $type$ x = ($type$) vh.compareAndExchangeAcquire(recv, $value1$, $value1$, Void.class); 521 }); 522 523 524 // CompareAndExchangeRelease 525 // Incorrect argument types 526 checkNPE(() -> { // null receiver 527 $type$ x = ($type$) vh.compareAndExchangeRelease(null, $value1$, $value1$); 528 }); 529 checkCCE(() -> { // receiver reference class 530 $type$ x = ($type$) vh.compareAndExchangeRelease(Void.class, $value1$, $value1$); 531 }); 532 check{#if[String]?CCE:WMTE}(() -> { // expected reference class 533 $type$ x = ($type$) vh.compareAndExchangeRelease(recv, Void.class, $value1$); 534 }); 535 check{#if[String]?CCE:WMTE}(() -> { // actual reference class 536 $type$ x = ($type$) vh.compareAndExchangeRelease(recv, $value1$, Void.class); 537 }); 538 checkWMTE(() -> { // reciever primitive class 539 $type$ x = ($type$) vh.compareAndExchangeRelease(0, $value1$, $value1$); 540 }); 541 // Incorrect return type 542 check{#if[String]?CCE:WMTE}(() -> { // reference class 543 Void r = (Void) vh.compareAndExchangeRelease(recv, $value1$, $value1$); 544 }); 545 checkWMTE(() -> { // primitive class 546 $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.compareAndExchangeRelease(recv, $value1$, $value1$); 547 }); 548 // Incorrect arity 549 checkWMTE(() -> { // 0 550 $type$ x = ($type$) vh.compareAndExchangeRelease(); 551 }); 552 checkWMTE(() -> { // > 553 $type$ x = ($type$) vh.compareAndExchangeRelease(recv, $value1$, $value1$, Void.class); 554 }); 555 556 557 // GetAndSet 558 // Incorrect argument types 559 checkNPE(() -> { // null receiver 560 $type$ x = ($type$) vh.getAndSet(null, $value1$); 561 }); 562 checkCCE(() -> { // receiver reference class 563 $type$ x = ($type$) vh.getAndSet(Void.class, $value1$); 564 }); 565 check{#if[String]?CCE:WMTE}(() -> { // value reference class 566 $type$ x = ($type$) vh.getAndSet(recv, Void.class); 567 }); 568 checkWMTE(() -> { // reciever primitive class 569 $type$ x = ($type$) vh.getAndSet(0, $value1$); 570 }); 571 // Incorrect return type 572 check{#if[String]?CCE:WMTE}(() -> { // reference class 573 Void r = (Void) vh.getAndSet(recv, $value1$); 574 }); 575 checkWMTE(() -> { // primitive class 576 $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndSet(recv, $value1$); 577 }); 578 // Incorrect arity 579 checkWMTE(() -> { // 0 580 $type$ x = ($type$) vh.getAndSet(); 581 }); 582 checkWMTE(() -> { // > 583 $type$ x = ($type$) vh.getAndSet(recv, $value1$, Void.class); 584 }); 585#end[CAS] 586 587#if[AtomicAdd] 588 // GetAndAdd 589 // Incorrect argument types 590 checkNPE(() -> { // null receiver 591 $type$ x = ($type$) vh.getAndAdd(null, $value1$); 592 }); 593 checkCCE(() -> { // receiver reference class 594 $type$ x = ($type$) vh.getAndAdd(Void.class, $value1$); 595 }); 596 check{#if[String]?CCE:WMTE}(() -> { // value reference class 597 $type$ x = ($type$) vh.getAndAdd(recv, Void.class); 598 }); 599 checkWMTE(() -> { // reciever primitive class 600 $type$ x = ($type$) vh.getAndAdd(0, $value1$); 601 }); 602 // Incorrect return type 603 check{#if[String]?CCE:WMTE}(() -> { // reference class 604 Void r = (Void) vh.getAndAdd(recv, $value1$); 605 }); 606 checkWMTE(() -> { // primitive class 607 $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndAdd(recv, $value1$); 608 }); 609 // Incorrect arity 610 checkWMTE(() -> { // 0 611 $type$ x = ($type$) vh.getAndAdd(); 612 }); 613 checkWMTE(() -> { // > 614 $type$ x = ($type$) vh.getAndAdd(recv, $value1$, Void.class); 615 }); 616 617 618 // AddAndGet 619 // Incorrect argument types 620 checkNPE(() -> { // null receiver 621 $type$ x = ($type$) vh.addAndGet(null, $value1$); 622 }); 623 checkCCE(() -> { // receiver reference class 624 $type$ x = ($type$) vh.addAndGet(Void.class, $value1$); 625 }); 626 check{#if[String]?CCE:WMTE}(() -> { // value reference class 627 $type$ x = ($type$) vh.addAndGet(recv, Void.class); 628 }); 629 checkWMTE(() -> { // reciever primitive class 630 $type$ x = ($type$) vh.addAndGet(0, $value1$); 631 }); 632 // Incorrect return type 633 check{#if[String]?CCE:WMTE}(() -> { // reference class 634 Void r = (Void) vh.addAndGet(recv, $value1$); 635 }); 636 checkWMTE(() -> { // primitive class 637 $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.addAndGet(recv, $value1$); 638 }); 639 // Incorrect arity 640 checkWMTE(() -> { // 0 641 $type$ x = ($type$) vh.addAndGet(); 642 }); 643 checkWMTE(() -> { // > 644 $type$ x = ($type$) vh.addAndGet(recv, $value1$, Void.class); 645 }); 646#end[AtomicAdd] 647 } 648 649 static void testInstanceFieldWrongMethodType(VarHandleTestMethodType$Type$ recv, Handles hs) throws Throwable { 650 for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) { 651 // Incorrect argument types 652 checkNPE(() -> { // null receiver 653 $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class)). 654 invokeExact((VarHandleTestMethodType$Type$) null); 655 }); 656 hs.checkWMTEOrCCE(() -> { // receiver reference class 657 $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class)). 658 invokeExact(Void.class); 659 }); 660 checkWMTE(() -> { // receiver primitive class 661 $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class)). 662 invokeExact(0); 663 }); 664 // Incorrect return type 665 {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class 666 Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodType$Type$.class)). 667 invokeExact(recv); 668 }); 669 checkWMTE(() -> { // primitive class 670 $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, VarHandleTestMethodType$Type$.class)). 671 invokeExact(recv); 672 }); 673 // Incorrect arity 674 checkWMTE(() -> { // 0 675 $type$ x = ($type$) hs.get(am, methodType($type$.class)). 676 invokeExact(); 677 }); 678 checkWMTE(() -> { // > 679 $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, Class.class)). 680 invokeExact(recv, Void.class); 681 }); 682 } 683 684 for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { 685 // Incorrect argument types 686 checkNPE(() -> { // null receiver 687 hs.get(am, methodType(void.class, VarHandleTestMethodType$Type$.class, $type$.class)). 688 invokeExact((VarHandleTestMethodType$Type$) null, $value1$); 689 }); 690 hs.checkWMTEOrCCE(() -> { // receiver reference class 691 hs.get(am, methodType(void.class, Class.class, $type$.class)). 692 invokeExact(Void.class, $value1$); 693 }); 694 {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class 695 hs.get(am, methodType(void.class, VarHandleTestMethodType$Type$.class, Class.class)). 696 invokeExact(recv, Void.class); 697 }); 698 checkWMTE(() -> { // receiver primitive class 699 hs.get(am, methodType(void.class, int.class, $type$.class)). 700 invokeExact(0, $value1$); 701 }); 702 // Incorrect arity 703 checkWMTE(() -> { // 0 704 hs.get(am, methodType(void.class)). 705 invokeExact(); 706 }); 707 checkWMTE(() -> { // > 708 hs.get(am, methodType(void.class, VarHandleTestMethodType$Type$.class, $type$.class, Class.class)). 709 invokeExact(recv, $value1$, Void.class); 710 }); 711 } 712 713#if[CAS] 714 for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) { 715 // Incorrect argument types 716 checkNPE(() -> { // null receiver 717 boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodType$Type$.class, $type$.class, $type$.class)). 718 invokeExact((VarHandleTestMethodType$Type$) null, $value1$, $value1$); 719 }); 720 hs.checkWMTEOrCCE(() -> { // receiver reference class 721 boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, $type$.class, $type$.class)). 722 invokeExact(Void.class, $value1$, $value1$); 723 }); 724 {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // expected reference class 725 boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodType$Type$.class, Class.class, $type$.class)). 726 invokeExact(recv, Void.class, $value1$); 727 }); 728 {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // actual reference class 729 boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodType$Type$.class, $type$.class, Class.class)). 730 invokeExact(recv, $value1$, Void.class); 731 }); 732 checkWMTE(() -> { // receiver primitive class 733 boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class , $type$.class, $type$.class)). 734 invokeExact(0, $value1$, $value1$); 735 }); 736 // Incorrect arity 737 checkWMTE(() -> { // 0 738 boolean r = (boolean) hs.get(am, methodType(boolean.class)). 739 invokeExact(); 740 }); 741 checkWMTE(() -> { // > 742 boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodType$Type$.class, $type$.class, $type$.class, Class.class)). 743 invokeExact(recv, $value1$, $value1$, Void.class); 744 }); 745 } 746 747 for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) { 748 checkNPE(() -> { // null receiver 749 $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class, $type$.class)). 750 invokeExact((VarHandleTestMethodType$Type$) null, $value1$, $value1$); 751 }); 752 hs.checkWMTEOrCCE(() -> { // receiver reference class 753 $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, $type$.class, $type$.class)). 754 invokeExact(Void.class, $value1$, $value1$); 755 }); 756 {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // expected reference class 757 $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, Class.class, $type$.class)). 758 invokeExact(recv, Void.class, $value1$); 759 }); 760 {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // actual reference class 761 $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class, Class.class)). 762 invokeExact(recv, $value1$, Void.class); 763 }); 764 checkWMTE(() -> { // reciever primitive class 765 $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class , $type$.class, $type$.class)). 766 invokeExact(0, $value1$, $value1$); 767 }); 768 // Incorrect return type 769 {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class 770 Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodType$Type$.class , $type$.class, $type$.class)). 771 invokeExact(recv, $value1$, $value1$); 772 }); 773 checkWMTE(() -> { // primitive class 774 $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, VarHandleTestMethodType$Type$.class , $type$.class, $type$.class)). 775 invokeExact(recv, $value1$, $value1$); 776 }); 777 // Incorrect arity 778 checkWMTE(() -> { // 0 779 $type$ x = ($type$) hs.get(am, methodType($type$.class)). 780 invokeExact(); 781 }); 782 checkWMTE(() -> { // > 783 $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class, $type$.class, Class.class)). 784 invokeExact(recv, $value1$, $value1$, Void.class); 785 }); 786 } 787 788 for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) { 789 checkNPE(() -> { // null receiver 790 $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class)). 791 invokeExact((VarHandleTestMethodType$Type$) null, $value1$); 792 }); 793 hs.checkWMTEOrCCE(() -> { // receiver reference class 794 $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, $type$.class)). 795 invokeExact(Void.class, $value1$); 796 }); 797 {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class 798 $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, Class.class)). 799 invokeExact(recv, Void.class); 800 }); 801 checkWMTE(() -> { // reciever primitive class 802 $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, $type$.class)). 803 invokeExact(0, $value1$); 804 }); 805 // Incorrect return type 806 {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class 807 Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodType$Type$.class, $type$.class)). 808 invokeExact(recv, $value1$); 809 }); 810 checkWMTE(() -> { // primitive class 811 $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, VarHandleTestMethodType$Type$.class, $type$.class)). 812 invokeExact(recv, $value1$); 813 }); 814 // Incorrect arity 815 checkWMTE(() -> { // 0 816 $type$ x = ($type$) hs.get(am, methodType($type$.class)). 817 invokeExact(); 818 }); 819 checkWMTE(() -> { // > 820 $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class)). 821 invokeExact(recv, $value1$, Void.class); 822 }); 823 } 824#end[CAS] 825 826#if[AtomicAdd] 827 for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) { 828 checkNPE(() -> { // null receiver 829 $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class)). 830 invokeExact((VarHandleTestMethodType$Type$) null, $value1$); 831 }); 832 hs.checkWMTEOrCCE(() -> { // receiver reference class 833 $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, $type$.class)). 834 invokeExact(Void.class, $value1$); 835 }); 836 {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class 837 $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, Class.class)). 838 invokeExact(recv, Void.class); 839 }); 840 checkWMTE(() -> { // reciever primitive class 841 $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, $type$.class)). 842 invokeExact(0, $value1$); 843 }); 844 // Incorrect return type 845 {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class 846 Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodType$Type$.class, $type$.class)). 847 invokeExact(recv, $value1$); 848 }); 849 checkWMTE(() -> { // primitive class 850 $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, VarHandleTestMethodType$Type$.class, $type$.class)). 851 invokeExact(recv, $value1$); 852 }); 853 // Incorrect arity 854 checkWMTE(() -> { // 0 855 $type$ x = ($type$) hs.get(am, methodType($type$.class)). 856 invokeExact(); 857 }); 858 checkWMTE(() -> { // > 859 $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class)). 860 invokeExact(recv, $value1$, Void.class); 861 }); 862 } 863#end[AtomicAdd] 864 } 865 866 867 static void testStaticFieldWrongMethodType(VarHandle vh) throws Throwable { 868 // Get 869 // Incorrect return type 870 check{#if[String]?CCE:WMTE}(() -> { // reference class 871 Void x = (Void) vh.get(); 872 }); 873 checkWMTE(() -> { // primitive class 874 $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.get(); 875 }); 876 // Incorrect arity 877 checkWMTE(() -> { // > 878 $type$ x = ($type$) vh.get(Void.class); 879 }); 880 881 882 // Set 883 // Incorrect argument types 884 check{#if[String]?CCE:WMTE}(() -> { // value reference class 885 vh.set(Void.class); 886 }); 887 // Incorrect arity 888 checkWMTE(() -> { // 0 889 vh.set(); 890 }); 891 checkWMTE(() -> { // > 892 vh.set($value1$, Void.class); 893 }); 894 895 896 // GetVolatile 897 // Incorrect return type 898 check{#if[String]?CCE:WMTE}(() -> { // reference class 899 Void x = (Void) vh.getVolatile(); 900 }); 901 checkWMTE(() -> { // primitive class 902 $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getVolatile(); 903 }); 904 checkWMTE(() -> { // > 905 $type$ x = ($type$) vh.getVolatile(Void.class); 906 }); 907 908 909 // SetVolatile 910 // Incorrect argument types 911 check{#if[String]?CCE:WMTE}(() -> { // value reference class 912 vh.setVolatile(Void.class); 913 }); 914 // Incorrect arity 915 checkWMTE(() -> { // 0 916 vh.setVolatile(); 917 }); 918 checkWMTE(() -> { // > 919 vh.setVolatile($value1$, Void.class); 920 }); 921 922 923 // GetOpaque 924 // Incorrect return type 925 check{#if[String]?CCE:WMTE}(() -> { // reference class 926 Void x = (Void) vh.getOpaque(); 927 }); 928 checkWMTE(() -> { // primitive class 929 $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getOpaque(); 930 }); 931 checkWMTE(() -> { // > 932 $type$ x = ($type$) vh.getOpaque(Void.class); 933 }); 934 935 936 // SetOpaque 937 // Incorrect argument types 938 check{#if[String]?CCE:WMTE}(() -> { // value reference class 939 vh.setOpaque(Void.class); 940 }); 941 // Incorrect arity 942 checkWMTE(() -> { // 0 943 vh.setOpaque(); 944 }); 945 checkWMTE(() -> { // > 946 vh.setOpaque($value1$, Void.class); 947 }); 948 949 950 // GetAcquire 951 // Incorrect return type 952 check{#if[String]?CCE:WMTE}(() -> { // reference class 953 Void x = (Void) vh.getAcquire(); 954 }); 955 checkWMTE(() -> { // primitive class 956 $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAcquire(); 957 }); 958 checkWMTE(() -> { // > 959 $type$ x = ($type$) vh.getAcquire(Void.class); 960 }); 961 962 963 // SetRelease 964 // Incorrect argument types 965 check{#if[String]?CCE:WMTE}(() -> { // value reference class 966 vh.setRelease(Void.class); 967 }); 968 // Incorrect arity 969 checkWMTE(() -> { // 0 970 vh.setRelease(); 971 }); 972 checkWMTE(() -> { // > 973 vh.setRelease($value1$, Void.class); 974 }); 975 976 977#if[CAS] 978 // CompareAndSet 979 // Incorrect argument types 980 check{#if[String]?CCE:WMTE}(() -> { // expected reference class 981 boolean r = vh.compareAndSet(Void.class, $value1$); 982 }); 983 check{#if[String]?CCE:WMTE}(() -> { // actual reference class 984 boolean r = vh.compareAndSet($value1$, Void.class); 985 }); 986 // Incorrect arity 987 checkWMTE(() -> { // 0 988 boolean r = vh.compareAndSet(); 989 }); 990 checkWMTE(() -> { // > 991 boolean r = vh.compareAndSet($value1$, $value1$, Void.class); 992 }); 993 994 995 // WeakCompareAndSet 996 // Incorrect argument types 997 check{#if[String]?CCE:WMTE}(() -> { // expected reference class 998 boolean r = vh.weakCompareAndSet(Void.class, $value1$); 999 }); 1000 check{#if[String]?CCE:WMTE}(() -> { // actual reference class 1001 boolean r = vh.weakCompareAndSet($value1$, Void.class); 1002 }); 1003 // Incorrect arity 1004 checkWMTE(() -> { // 0 1005 boolean r = vh.weakCompareAndSet(); 1006 }); 1007 checkWMTE(() -> { // > 1008 boolean r = vh.weakCompareAndSet($value1$, $value1$, Void.class); 1009 }); 1010 1011 1012 // WeakCompareAndSetVolatile 1013 // Incorrect argument types 1014 check{#if[String]?CCE:WMTE}(() -> { // expected reference class 1015 boolean r = vh.weakCompareAndSetVolatile(Void.class, $value1$); 1016 }); 1017 check{#if[String]?CCE:WMTE}(() -> { // actual reference class 1018 boolean r = vh.weakCompareAndSetVolatile($value1$, Void.class); 1019 }); 1020 // Incorrect arity 1021 checkWMTE(() -> { // 0 1022 boolean r = vh.weakCompareAndSetVolatile(); 1023 }); 1024 checkWMTE(() -> { // > 1025 boolean r = vh.weakCompareAndSetVolatile($value1$, $value1$, Void.class); 1026 }); 1027 1028 1029 // WeakCompareAndSetAcquire 1030 // Incorrect argument types 1031 check{#if[String]?CCE:WMTE}(() -> { // expected reference class 1032 boolean r = vh.weakCompareAndSetAcquire(Void.class, $value1$); 1033 }); 1034 check{#if[String]?CCE:WMTE}(() -> { // actual reference class 1035 boolean r = vh.weakCompareAndSetAcquire($value1$, Void.class); 1036 }); 1037 // Incorrect arity 1038 checkWMTE(() -> { // 0 1039 boolean r = vh.weakCompareAndSetAcquire(); 1040 }); 1041 checkWMTE(() -> { // > 1042 boolean r = vh.weakCompareAndSetAcquire($value1$, $value1$, Void.class); 1043 }); 1044 1045 1046 // WeakCompareAndSetRelease 1047 // Incorrect argument types 1048 check{#if[String]?CCE:WMTE}(() -> { // expected reference class 1049 boolean r = vh.weakCompareAndSetRelease(Void.class, $value1$); 1050 }); 1051 check{#if[String]?CCE:WMTE}(() -> { // actual reference class 1052 boolean r = vh.weakCompareAndSetRelease($value1$, Void.class); 1053 }); 1054 // Incorrect arity 1055 checkWMTE(() -> { // 0 1056 boolean r = vh.weakCompareAndSetRelease(); 1057 }); 1058 checkWMTE(() -> { // > 1059 boolean r = vh.weakCompareAndSetRelease($value1$, $value1$, Void.class); 1060 }); 1061 1062 1063 // CompareAndExchange 1064 // Incorrect argument types 1065 check{#if[String]?CCE:WMTE}(() -> { // expected reference class 1066 $type$ x = ($type$) vh.compareAndExchange(Void.class, $value1$); 1067 }); 1068 check{#if[String]?CCE:WMTE}(() -> { // actual reference class 1069 $type$ x = ($type$) vh.compareAndExchange($value1$, Void.class); 1070 }); 1071 // Incorrect return type 1072 check{#if[String]?CCE:WMTE}(() -> { // reference class 1073 Void r = (Void) vh.compareAndExchange($value1$, $value1$); 1074 }); 1075 checkWMTE(() -> { // primitive class 1076 $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.compareAndExchange($value1$, $value1$); 1077 }); 1078 // Incorrect arity 1079 checkWMTE(() -> { // 0 1080 $type$ x = ($type$) vh.compareAndExchange(); 1081 }); 1082 checkWMTE(() -> { // > 1083 $type$ x = ($type$) vh.compareAndExchange($value1$, $value1$, Void.class); 1084 }); 1085 1086 1087 // CompareAndExchangeAcquire 1088 // Incorrect argument types 1089 check{#if[String]?CCE:WMTE}(() -> { // expected reference class 1090 $type$ x = ($type$) vh.compareAndExchangeAcquire(Void.class, $value1$); 1091 }); 1092 check{#if[String]?CCE:WMTE}(() -> { // actual reference class 1093 $type$ x = ($type$) vh.compareAndExchangeAcquire($value1$, Void.class); 1094 }); 1095 // Incorrect return type 1096 check{#if[String]?CCE:WMTE}(() -> { // reference class 1097 Void r = (Void) vh.compareAndExchangeAcquire($value1$, $value1$); 1098 }); 1099 checkWMTE(() -> { // primitive class 1100 $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.compareAndExchangeAcquire($value1$, $value1$); 1101 }); 1102 // Incorrect arity 1103 checkWMTE(() -> { // 0 1104 $type$ x = ($type$) vh.compareAndExchangeAcquire(); 1105 }); 1106 checkWMTE(() -> { // > 1107 $type$ x = ($type$) vh.compareAndExchangeAcquire($value1$, $value1$, Void.class); 1108 }); 1109 1110 1111 // CompareAndExchangeRelease 1112 // Incorrect argument types 1113 check{#if[String]?CCE:WMTE}(() -> { // expected reference class 1114 $type$ x = ($type$) vh.compareAndExchangeRelease(Void.class, $value1$); 1115 }); 1116 check{#if[String]?CCE:WMTE}(() -> { // actual reference class 1117 $type$ x = ($type$) vh.compareAndExchangeRelease($value1$, Void.class); 1118 }); 1119 // Incorrect return type 1120 check{#if[String]?CCE:WMTE}(() -> { // reference class 1121 Void r = (Void) vh.compareAndExchangeRelease($value1$, $value1$); 1122 }); 1123 checkWMTE(() -> { // primitive class 1124 $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.compareAndExchangeRelease($value1$, $value1$); 1125 }); 1126 // Incorrect arity 1127 checkWMTE(() -> { // 0 1128 $type$ x = ($type$) vh.compareAndExchangeRelease(); 1129 }); 1130 checkWMTE(() -> { // > 1131 $type$ x = ($type$) vh.compareAndExchangeRelease($value1$, $value1$, Void.class); 1132 }); 1133 1134 1135 // GetAndSet 1136 // Incorrect argument types 1137 check{#if[String]?CCE:WMTE}(() -> { // value reference class 1138 $type$ x = ($type$) vh.getAndSet(Void.class); 1139 }); 1140 // Incorrect return type 1141 check{#if[String]?CCE:WMTE}(() -> { // reference class 1142 Void r = (Void) vh.getAndSet($value1$); 1143 }); 1144 checkWMTE(() -> { // primitive class 1145 $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndSet($value1$); 1146 }); 1147 // Incorrect arity 1148 checkWMTE(() -> { // 0 1149 $type$ x = ($type$) vh.getAndSet(); 1150 }); 1151 checkWMTE(() -> { // > 1152 $type$ x = ($type$) vh.getAndSet($value1$, Void.class); 1153 }); 1154#end[CAS] 1155 1156#if[AtomicAdd] 1157 // GetAndAdd 1158 // Incorrect argument types 1159 check{#if[String]?CCE:WMTE}(() -> { // value reference class 1160 $type$ x = ($type$) vh.getAndAdd(Void.class); 1161 }); 1162 // Incorrect return type 1163 check{#if[String]?CCE:WMTE}(() -> { // reference class 1164 Void r = (Void) vh.getAndAdd($value1$); 1165 }); 1166 checkWMTE(() -> { // primitive class 1167 $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndAdd($value1$); 1168 }); 1169 // Incorrect arity 1170 checkWMTE(() -> { // 0 1171 $type$ x = ($type$) vh.getAndAdd(); 1172 }); 1173 checkWMTE(() -> { // > 1174 $type$ x = ($type$) vh.getAndAdd($value1$, Void.class); 1175 }); 1176 1177 1178 // AddAndGet 1179 // Incorrect argument types 1180 check{#if[String]?CCE:WMTE}(() -> { // value reference class 1181 $type$ x = ($type$) vh.addAndGet(Void.class); 1182 }); 1183 // Incorrect return type 1184 check{#if[String]?CCE:WMTE}(() -> { // reference class 1185 Void r = (Void) vh.addAndGet($value1$); 1186 }); 1187 checkWMTE(() -> { // primitive class 1188 $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.addAndGet($value1$); 1189 }); 1190 // Incorrect arity 1191 checkWMTE(() -> { // 0 1192 $type$ x = ($type$) vh.addAndGet(); 1193 }); 1194 checkWMTE(() -> { // > 1195 $type$ x = ($type$) vh.addAndGet($value1$, Void.class); 1196 }); 1197#end[AtomicAdd] 1198 } 1199 1200 static void testStaticFieldWrongMethodType(Handles hs) throws Throwable { 1201 int i = 0; 1202 1203 for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) { 1204 // Incorrect return type 1205 {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class 1206 Void x = (Void) hs.get(am, methodType(Void.class)). 1207 invokeExact(); 1208 }); 1209 checkWMTE(() -> { // primitive class 1210 $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class)). 1211 invokeExact(); 1212 }); 1213 // Incorrect arity 1214 checkWMTE(() -> { // > 1215 $type$ x = ($type$) hs.get(am, methodType(Class.class)). 1216 invokeExact(Void.class); 1217 }); 1218 } 1219 1220 for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { 1221 {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class 1222 hs.get(am, methodType(void.class, Class.class)). 1223 invokeExact(Void.class); 1224 }); 1225 // Incorrect arity 1226 checkWMTE(() -> { // 0 1227 hs.get(am, methodType(void.class)). 1228 invokeExact(); 1229 }); 1230 checkWMTE(() -> { // > 1231 hs.get(am, methodType(void.class, $type$.class, Class.class)). 1232 invokeExact($value1$, Void.class); 1233 }); 1234 } 1235#if[CAS] 1236 for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) { 1237 // Incorrect argument types 1238 {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // expected reference class 1239 boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, $type$.class)). 1240 invokeExact(Void.class, $value1$); 1241 }); 1242 {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // actual reference class 1243 boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$.class, Class.class)). 1244 invokeExact($value1$, Void.class); 1245 }); 1246 // Incorrect arity 1247 checkWMTE(() -> { // 0 1248 boolean r = (boolean) hs.get(am, methodType(boolean.class)). 1249 invokeExact(); 1250 }); 1251 checkWMTE(() -> { // > 1252 boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$.class, $type$.class, Class.class)). 1253 invokeExact($value1$, $value1$, Void.class); 1254 }); 1255 } 1256 1257 for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) { 1258 // Incorrect argument types 1259 {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // expected reference class 1260 $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, $type$.class)). 1261 invokeExact(Void.class, $value1$); 1262 }); 1263 {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // actual reference class 1264 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$.class, Class.class)). 1265 invokeExact($value1$, Void.class); 1266 }); 1267 // Incorrect return type 1268 {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class 1269 Void r = (Void) hs.get(am, methodType(Void.class, $type$.class, $type$.class)). 1270 invokeExact($value1$, $value1$); 1271 }); 1272 checkWMTE(() -> { // primitive class 1273 $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$.class, $type$.class)). 1274 invokeExact($value1$, $value1$); 1275 }); 1276 // Incorrect arity 1277 checkWMTE(() -> { // 0 1278 $type$ x = ($type$) hs.get(am, methodType($type$.class)). 1279 invokeExact(); 1280 }); 1281 checkWMTE(() -> { // > 1282 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$.class, $type$.class, Class.class)). 1283 invokeExact($value1$, $value1$, Void.class); 1284 }); 1285 } 1286 1287 for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) { 1288 // Incorrect argument types 1289 {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class 1290 $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class)). 1291 invokeExact(Void.class); 1292 }); 1293 // Incorrect return type 1294 {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class 1295 Void r = (Void) hs.get(am, methodType(Void.class, $type$.class)). 1296 invokeExact($value1$); 1297 }); 1298 checkWMTE(() -> { // primitive class 1299 $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$.class)). 1300 invokeExact($value1$); 1301 }); 1302 // Incorrect arity 1303 checkWMTE(() -> { // 0 1304 $type$ x = ($type$) hs.get(am, methodType($type$.class)). 1305 invokeExact(); 1306 }); 1307 checkWMTE(() -> { // > 1308 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$.class, Class.class)). 1309 invokeExact($value1$, Void.class); 1310 }); 1311 } 1312#end[CAS] 1313 1314#if[AtomicAdd] 1315 for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) { 1316 // Incorrect argument types 1317 check{#if[String]?CCE:WMTE}(() -> { // value reference class 1318 $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class)). 1319 invokeExact(Void.class); 1320 }); 1321 // Incorrect return type 1322 check{#if[String]?CCE:WMTE}(() -> { // reference class 1323 Void r = (Void) hs.get(am, methodType(Void.class, $type$.class)). 1324 invokeExact($value1$); 1325 }); 1326 checkWMTE(() -> { // primitive class 1327 $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$.class)). 1328 invokeExact($value1$); 1329 }); 1330 // Incorrect arity 1331 checkWMTE(() -> { // 0 1332 $type$ x = ($type$) hs.get(am, methodType($type$.class)). 1333 invokeExact(); 1334 }); 1335 checkWMTE(() -> { // > 1336 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$.class, Class.class)). 1337 invokeExact($value1$, Void.class); 1338 }); 1339 } 1340#end[AtomicAdd] 1341 } 1342 1343 1344 static void testArrayWrongMethodType(VarHandle vh) throws Throwable { 1345 $type$[] array = new $type$[10]; 1346 Arrays.fill(array, $value1$); 1347 1348 // Get 1349 // Incorrect argument types 1350 checkNPE(() -> { // null array 1351 $type$ x = ($type$) vh.get(null, 0); 1352 }); 1353 checkCCE(() -> { // array reference class 1354 $type$ x = ($type$) vh.get(Void.class, 0); 1355 }); 1356 checkWMTE(() -> { // array primitive class 1357 $type$ x = ($type$) vh.get(0, 0); 1358 }); 1359 checkWMTE(() -> { // index reference class 1360 $type$ x = ($type$) vh.get(array, Void.class); 1361 }); 1362 // Incorrect return type 1363 check{#if[String]?CCE:WMTE}(() -> { // reference class 1364 Void x = (Void) vh.get(array, 0); 1365 }); 1366 checkWMTE(() -> { // primitive class 1367 $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.get(array, 0); 1368 }); 1369 // Incorrect arity 1370 checkWMTE(() -> { // 0 1371 $type$ x = ($type$) vh.get(); 1372 }); 1373 checkWMTE(() -> { // > 1374 $type$ x = ($type$) vh.get(array, 0, Void.class); 1375 }); 1376 1377 1378 // Set 1379 // Incorrect argument types 1380 checkNPE(() -> { // null array 1381 vh.set(null, 0, $value1$); 1382 }); 1383 checkCCE(() -> { // array reference class 1384 vh.set(Void.class, 0, $value1$); 1385 }); 1386 check{#if[String]?CCE:WMTE}(() -> { // value reference class 1387 vh.set(array, 0, Void.class); 1388 }); 1389 checkWMTE(() -> { // receiver primitive class 1390 vh.set(0, 0, $value1$); 1391 }); 1392 checkWMTE(() -> { // index reference class 1393 vh.set(array, Void.class, $value1$); 1394 }); 1395 // Incorrect arity 1396 checkWMTE(() -> { // 0 1397 vh.set(); 1398 }); 1399 checkWMTE(() -> { // > 1400 vh.set(array, 0, $value1$, Void.class); 1401 }); 1402 1403 1404 // GetVolatile 1405 // Incorrect argument types 1406 checkNPE(() -> { // null array 1407 $type$ x = ($type$) vh.getVolatile(null, 0); 1408 }); 1409 checkCCE(() -> { // array reference class 1410 $type$ x = ($type$) vh.getVolatile(Void.class, 0); 1411 }); 1412 checkWMTE(() -> { // array primitive class 1413 $type$ x = ($type$) vh.getVolatile(0, 0); 1414 }); 1415 checkWMTE(() -> { // index reference class 1416 $type$ x = ($type$) vh.getVolatile(array, Void.class); 1417 }); 1418 // Incorrect return type 1419 check{#if[String]?CCE:WMTE}(() -> { // reference class 1420 Void x = (Void) vh.getVolatile(array, 0); 1421 }); 1422 checkWMTE(() -> { // primitive class 1423 $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getVolatile(array, 0); 1424 }); 1425 // Incorrect arity 1426 checkWMTE(() -> { // 0 1427 $type$ x = ($type$) vh.getVolatile(); 1428 }); 1429 checkWMTE(() -> { // > 1430 $type$ x = ($type$) vh.getVolatile(array, 0, Void.class); 1431 }); 1432 1433 1434 // SetVolatile 1435 // Incorrect argument types 1436 checkNPE(() -> { // null array 1437 vh.setVolatile(null, 0, $value1$); 1438 }); 1439 checkCCE(() -> { // array reference class 1440 vh.setVolatile(Void.class, 0, $value1$); 1441 }); 1442 check{#if[String]?CCE:WMTE}(() -> { // value reference class 1443 vh.setVolatile(array, 0, Void.class); 1444 }); 1445 checkWMTE(() -> { // receiver primitive class 1446 vh.setVolatile(0, 0, $value1$); 1447 }); 1448 checkWMTE(() -> { // index reference class 1449 vh.setVolatile(array, Void.class, $value1$); 1450 }); 1451 // Incorrect arity 1452 checkWMTE(() -> { // 0 1453 vh.setVolatile(); 1454 }); 1455 checkWMTE(() -> { // > 1456 vh.setVolatile(array, 0, $value1$, Void.class); 1457 }); 1458 1459 1460 // GetOpaque 1461 // Incorrect argument types 1462 checkNPE(() -> { // null array 1463 $type$ x = ($type$) vh.getOpaque(null, 0); 1464 }); 1465 checkCCE(() -> { // array reference class 1466 $type$ x = ($type$) vh.getOpaque(Void.class, 0); 1467 }); 1468 checkWMTE(() -> { // array primitive class 1469 $type$ x = ($type$) vh.getOpaque(0, 0); 1470 }); 1471 checkWMTE(() -> { // index reference class 1472 $type$ x = ($type$) vh.getOpaque(array, Void.class); 1473 }); 1474 // Incorrect return type 1475 check{#if[String]?CCE:WMTE}(() -> { // reference class 1476 Void x = (Void) vh.getOpaque(array, 0); 1477 }); 1478 checkWMTE(() -> { // primitive class 1479 $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getOpaque(array, 0); 1480 }); 1481 // Incorrect arity 1482 checkWMTE(() -> { // 0 1483 $type$ x = ($type$) vh.getOpaque(); 1484 }); 1485 checkWMTE(() -> { // > 1486 $type$ x = ($type$) vh.getOpaque(array, 0, Void.class); 1487 }); 1488 1489 1490 // SetOpaque 1491 // Incorrect argument types 1492 checkNPE(() -> { // null array 1493 vh.setOpaque(null, 0, $value1$); 1494 }); 1495 checkCCE(() -> { // array reference class 1496 vh.setOpaque(Void.class, 0, $value1$); 1497 }); 1498 check{#if[String]?CCE:WMTE}(() -> { // value reference class 1499 vh.setOpaque(array, 0, Void.class); 1500 }); 1501 checkWMTE(() -> { // receiver primitive class 1502 vh.setOpaque(0, 0, $value1$); 1503 }); 1504 checkWMTE(() -> { // index reference class 1505 vh.setOpaque(array, Void.class, $value1$); 1506 }); 1507 // Incorrect arity 1508 checkWMTE(() -> { // 0 1509 vh.setOpaque(); 1510 }); 1511 checkWMTE(() -> { // > 1512 vh.setOpaque(array, 0, $value1$, Void.class); 1513 }); 1514 1515 1516 // GetAcquire 1517 // Incorrect argument types 1518 checkNPE(() -> { // null array 1519 $type$ x = ($type$) vh.getAcquire(null, 0); 1520 }); 1521 checkCCE(() -> { // array reference class 1522 $type$ x = ($type$) vh.getAcquire(Void.class, 0); 1523 }); 1524 checkWMTE(() -> { // array primitive class 1525 $type$ x = ($type$) vh.getAcquire(0, 0); 1526 }); 1527 checkWMTE(() -> { // index reference class 1528 $type$ x = ($type$) vh.getAcquire(array, Void.class); 1529 }); 1530 // Incorrect return type 1531 check{#if[String]?CCE:WMTE}(() -> { // reference class 1532 Void x = (Void) vh.getAcquire(array, 0); 1533 }); 1534 checkWMTE(() -> { // primitive class 1535 $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAcquire(array, 0); 1536 }); 1537 // Incorrect arity 1538 checkWMTE(() -> { // 0 1539 $type$ x = ($type$) vh.getAcquire(); 1540 }); 1541 checkWMTE(() -> { // > 1542 $type$ x = ($type$) vh.getAcquire(array, 0, Void.class); 1543 }); 1544 1545 1546 // SetRelease 1547 // Incorrect argument types 1548 checkNPE(() -> { // null array 1549 vh.setRelease(null, 0, $value1$); 1550 }); 1551 checkCCE(() -> { // array reference class 1552 vh.setRelease(Void.class, 0, $value1$); 1553 }); 1554 check{#if[String]?CCE:WMTE}(() -> { // value reference class 1555 vh.setRelease(array, 0, Void.class); 1556 }); 1557 checkWMTE(() -> { // receiver primitive class 1558 vh.setRelease(0, 0, $value1$); 1559 }); 1560 checkWMTE(() -> { // index reference class 1561 vh.setRelease(array, Void.class, $value1$); 1562 }); 1563 // Incorrect arity 1564 checkWMTE(() -> { // 0 1565 vh.setRelease(); 1566 }); 1567 checkWMTE(() -> { // > 1568 vh.setRelease(array, 0, $value1$, Void.class); 1569 }); 1570 1571 1572#if[CAS] 1573 // CompareAndSet 1574 // Incorrect argument types 1575 checkNPE(() -> { // null receiver 1576 boolean r = vh.compareAndSet(null, 0, $value1$, $value1$); 1577 }); 1578 checkCCE(() -> { // receiver reference class 1579 boolean r = vh.compareAndSet(Void.class, 0, $value1$, $value1$); 1580 }); 1581 check{#if[String]?CCE:WMTE}(() -> { // expected reference class 1582 boolean r = vh.compareAndSet(array, 0, Void.class, $value1$); 1583 }); 1584 check{#if[String]?CCE:WMTE}(() -> { // actual reference class 1585 boolean r = vh.compareAndSet(array, 0, $value1$, Void.class); 1586 }); 1587 checkWMTE(() -> { // receiver primitive class 1588 boolean r = vh.compareAndSet(0, 0, $value1$, $value1$); 1589 }); 1590 checkWMTE(() -> { // index reference class 1591 boolean r = vh.compareAndSet(array, Void.class, $value1$, $value1$); 1592 }); 1593 // Incorrect arity 1594 checkWMTE(() -> { // 0 1595 boolean r = vh.compareAndSet(); 1596 }); 1597 checkWMTE(() -> { // > 1598 boolean r = vh.compareAndSet(array, 0, $value1$, $value1$, Void.class); 1599 }); 1600 1601 1602 // WeakCompareAndSet 1603 // Incorrect argument types 1604 checkNPE(() -> { // null receiver 1605 boolean r = vh.weakCompareAndSet(null, 0, $value1$, $value1$); 1606 }); 1607 checkCCE(() -> { // receiver reference class 1608 boolean r = vh.weakCompareAndSet(Void.class, 0, $value1$, $value1$); 1609 }); 1610 check{#if[String]?CCE:WMTE}(() -> { // expected reference class 1611 boolean r = vh.weakCompareAndSet(array, 0, Void.class, $value1$); 1612 }); 1613 check{#if[String]?CCE:WMTE}(() -> { // actual reference class 1614 boolean r = vh.weakCompareAndSet(array, 0, $value1$, Void.class); 1615 }); 1616 checkWMTE(() -> { // receiver primitive class 1617 boolean r = vh.weakCompareAndSet(0, 0, $value1$, $value1$); 1618 }); 1619 checkWMTE(() -> { // index reference class 1620 boolean r = vh.weakCompareAndSet(array, Void.class, $value1$, $value1$); 1621 }); 1622 // Incorrect arity 1623 checkWMTE(() -> { // 0 1624 boolean r = vh.weakCompareAndSet(); 1625 }); 1626 checkWMTE(() -> { // > 1627 boolean r = vh.weakCompareAndSet(array, 0, $value1$, $value1$, Void.class); 1628 }); 1629 1630 1631 // WeakCompareAndSetVolatile 1632 // Incorrect argument types 1633 checkNPE(() -> { // null receiver 1634 boolean r = vh.weakCompareAndSetVolatile(null, 0, $value1$, $value1$); 1635 }); 1636 checkCCE(() -> { // receiver reference class 1637 boolean r = vh.weakCompareAndSetVolatile(Void.class, 0, $value1$, $value1$); 1638 }); 1639 check{#if[String]?CCE:WMTE}(() -> { // expected reference class 1640 boolean r = vh.weakCompareAndSetVolatile(array, 0, Void.class, $value1$); 1641 }); 1642 check{#if[String]?CCE:WMTE}(() -> { // actual reference class 1643 boolean r = vh.weakCompareAndSetVolatile(array, 0, $value1$, Void.class); 1644 }); 1645 checkWMTE(() -> { // receiver primitive class 1646 boolean r = vh.weakCompareAndSetVolatile(0, 0, $value1$, $value1$); 1647 }); 1648 checkWMTE(() -> { // index reference class 1649 boolean r = vh.weakCompareAndSetVolatile(array, Void.class, $value1$, $value1$); 1650 }); 1651 // Incorrect arity 1652 checkWMTE(() -> { // 0 1653 boolean r = vh.weakCompareAndSetVolatile(); 1654 }); 1655 checkWMTE(() -> { // > 1656 boolean r = vh.weakCompareAndSetVolatile(array, 0, $value1$, $value1$, Void.class); 1657 }); 1658 1659 1660 // WeakCompareAndSetAcquire 1661 // Incorrect argument types 1662 checkNPE(() -> { // null receiver 1663 boolean r = vh.weakCompareAndSetAcquire(null, 0, $value1$, $value1$); 1664 }); 1665 checkCCE(() -> { // receiver reference class 1666 boolean r = vh.weakCompareAndSetAcquire(Void.class, 0, $value1$, $value1$); 1667 }); 1668 check{#if[String]?CCE:WMTE}(() -> { // expected reference class 1669 boolean r = vh.weakCompareAndSetAcquire(array, 0, Void.class, $value1$); 1670 }); 1671 check{#if[String]?CCE:WMTE}(() -> { // actual reference class 1672 boolean r = vh.weakCompareAndSetAcquire(array, 0, $value1$, Void.class); 1673 }); 1674 checkWMTE(() -> { // receiver primitive class 1675 boolean r = vh.weakCompareAndSetAcquire(0, 0, $value1$, $value1$); 1676 }); 1677 checkWMTE(() -> { // index reference class 1678 boolean r = vh.weakCompareAndSetAcquire(array, Void.class, $value1$, $value1$); 1679 }); 1680 // Incorrect arity 1681 checkWMTE(() -> { // 0 1682 boolean r = vh.weakCompareAndSetAcquire(); 1683 }); 1684 checkWMTE(() -> { // > 1685 boolean r = vh.weakCompareAndSetAcquire(array, 0, $value1$, $value1$, Void.class); 1686 }); 1687 1688 1689 // WeakCompareAndSetRelease 1690 // Incorrect argument types 1691 checkNPE(() -> { // null receiver 1692 boolean r = vh.weakCompareAndSetRelease(null, 0, $value1$, $value1$); 1693 }); 1694 checkCCE(() -> { // receiver reference class 1695 boolean r = vh.weakCompareAndSetRelease(Void.class, 0, $value1$, $value1$); 1696 }); 1697 check{#if[String]?CCE:WMTE}(() -> { // expected reference class 1698 boolean r = vh.weakCompareAndSetRelease(array, 0, Void.class, $value1$); 1699 }); 1700 check{#if[String]?CCE:WMTE}(() -> { // actual reference class 1701 boolean r = vh.weakCompareAndSetRelease(array, 0, $value1$, Void.class); 1702 }); 1703 checkWMTE(() -> { // receiver primitive class 1704 boolean r = vh.weakCompareAndSetRelease(0, 0, $value1$, $value1$); 1705 }); 1706 checkWMTE(() -> { // index reference class 1707 boolean r = vh.weakCompareAndSetRelease(array, Void.class, $value1$, $value1$); 1708 }); 1709 // Incorrect arity 1710 checkWMTE(() -> { // 0 1711 boolean r = vh.weakCompareAndSetRelease(); 1712 }); 1713 checkWMTE(() -> { // > 1714 boolean r = vh.weakCompareAndSetRelease(array, 0, $value1$, $value1$, Void.class); 1715 }); 1716 1717 1718 // CompareAndExchange 1719 // Incorrect argument types 1720 checkNPE(() -> { // null receiver 1721 $type$ x = ($type$) vh.compareAndExchange(null, 0, $value1$, $value1$); 1722 }); 1723 checkCCE(() -> { // array reference class 1724 $type$ x = ($type$) vh.compareAndExchange(Void.class, 0, $value1$, $value1$); 1725 }); 1726 check{#if[String]?CCE:WMTE}(() -> { // expected reference class 1727 $type$ x = ($type$) vh.compareAndExchange(array, 0, Void.class, $value1$); 1728 }); 1729 check{#if[String]?CCE:WMTE}(() -> { // actual reference class 1730 $type$ x = ($type$) vh.compareAndExchange(array, 0, $value1$, Void.class); 1731 }); 1732 checkWMTE(() -> { // array primitive class 1733 $type$ x = ($type$) vh.compareAndExchange(0, 0, $value1$, $value1$); 1734 }); 1735 checkWMTE(() -> { // index reference class 1736 $type$ x = ($type$) vh.compareAndExchange(array, Void.class, $value1$, $value1$); 1737 }); 1738 // Incorrect return type 1739 check{#if[String]?CCE:WMTE}(() -> { // reference class 1740 Void r = (Void) vh.compareAndExchange(array, 0, $value1$, $value1$); 1741 }); 1742 checkWMTE(() -> { // primitive class 1743 $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.compareAndExchange(array, 0, $value1$, $value1$); 1744 }); 1745 // Incorrect arity 1746 checkWMTE(() -> { // 0 1747 $type$ x = ($type$) vh.compareAndExchange(); 1748 }); 1749 checkWMTE(() -> { // > 1750 $type$ x = ($type$) vh.compareAndExchange(array, 0, $value1$, $value1$, Void.class); 1751 }); 1752 1753 1754 // CompareAndExchangeAcquire 1755 // Incorrect argument types 1756 checkNPE(() -> { // null receiver 1757 $type$ x = ($type$) vh.compareAndExchangeAcquire(null, 0, $value1$, $value1$); 1758 }); 1759 checkCCE(() -> { // array reference class 1760 $type$ x = ($type$) vh.compareAndExchangeAcquire(Void.class, 0, $value1$, $value1$); 1761 }); 1762 check{#if[String]?CCE:WMTE}(() -> { // expected reference class 1763 $type$ x = ($type$) vh.compareAndExchangeAcquire(array, 0, Void.class, $value1$); 1764 }); 1765 check{#if[String]?CCE:WMTE}(() -> { // actual reference class 1766 $type$ x = ($type$) vh.compareAndExchangeAcquire(array, 0, $value1$, Void.class); 1767 }); 1768 checkWMTE(() -> { // array primitive class 1769 $type$ x = ($type$) vh.compareAndExchangeAcquire(0, 0, $value1$, $value1$); 1770 }); 1771 checkWMTE(() -> { // index reference class 1772 $type$ x = ($type$) vh.compareAndExchangeAcquire(array, Void.class, $value1$, $value1$); 1773 }); 1774 // Incorrect return type 1775 check{#if[String]?CCE:WMTE}(() -> { // reference class 1776 Void r = (Void) vh.compareAndExchangeAcquire(array, 0, $value1$, $value1$); 1777 }); 1778 checkWMTE(() -> { // primitive class 1779 $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.compareAndExchangeAcquire(array, 0, $value1$, $value1$); 1780 }); 1781 // Incorrect arity 1782 checkWMTE(() -> { // 0 1783 $type$ x = ($type$) vh.compareAndExchangeAcquire(); 1784 }); 1785 checkWMTE(() -> { // > 1786 $type$ x = ($type$) vh.compareAndExchangeAcquire(array, 0, $value1$, $value1$, Void.class); 1787 }); 1788 1789 1790 // CompareAndExchangeRelease 1791 // Incorrect argument types 1792 checkNPE(() -> { // null receiver 1793 $type$ x = ($type$) vh.compareAndExchangeRelease(null, 0, $value1$, $value1$); 1794 }); 1795 checkCCE(() -> { // array reference class 1796 $type$ x = ($type$) vh.compareAndExchangeRelease(Void.class, 0, $value1$, $value1$); 1797 }); 1798 check{#if[String]?CCE:WMTE}(() -> { // expected reference class 1799 $type$ x = ($type$) vh.compareAndExchangeRelease(array, 0, Void.class, $value1$); 1800 }); 1801 check{#if[String]?CCE:WMTE}(() -> { // actual reference class 1802 $type$ x = ($type$) vh.compareAndExchangeRelease(array, 0, $value1$, Void.class); 1803 }); 1804 checkWMTE(() -> { // array primitive class 1805 $type$ x = ($type$) vh.compareAndExchangeRelease(0, 0, $value1$, $value1$); 1806 }); 1807 checkWMTE(() -> { // index reference class 1808 $type$ x = ($type$) vh.compareAndExchangeRelease(array, Void.class, $value1$, $value1$); 1809 }); 1810 // Incorrect return type 1811 check{#if[String]?CCE:WMTE}(() -> { // reference class 1812 Void r = (Void) vh.compareAndExchangeRelease(array, 0, $value1$, $value1$); 1813 }); 1814 checkWMTE(() -> { // primitive class 1815 $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.compareAndExchangeRelease(array, 0, $value1$, $value1$); 1816 }); 1817 // Incorrect arity 1818 checkWMTE(() -> { // 0 1819 $type$ x = ($type$) vh.compareAndExchangeRelease(); 1820 }); 1821 checkWMTE(() -> { // > 1822 $type$ x = ($type$) vh.compareAndExchangeRelease(array, 0, $value1$, $value1$, Void.class); 1823 }); 1824 1825 1826 // GetAndSet 1827 // Incorrect argument types 1828 checkNPE(() -> { // null array 1829 $type$ x = ($type$) vh.getAndSet(null, 0, $value1$); 1830 }); 1831 checkCCE(() -> { // array reference class 1832 $type$ x = ($type$) vh.getAndSet(Void.class, 0, $value1$); 1833 }); 1834 check{#if[String]?CCE:WMTE}(() -> { // value reference class 1835 $type$ x = ($type$) vh.getAndSet(array, 0, Void.class); 1836 }); 1837 checkWMTE(() -> { // reciarrayever primitive class 1838 $type$ x = ($type$) vh.getAndSet(0, 0, $value1$); 1839 }); 1840 checkWMTE(() -> { // index reference class 1841 $type$ x = ($type$) vh.getAndSet(array, Void.class, $value1$); 1842 }); 1843 // Incorrect return type 1844 check{#if[String]?CCE:WMTE}(() -> { // reference class 1845 Void r = (Void) vh.getAndSet(array, 0, $value1$); 1846 }); 1847 checkWMTE(() -> { // primitive class 1848 $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndSet(array, 0, $value1$); 1849 }); 1850 // Incorrect arity 1851 checkWMTE(() -> { // 0 1852 $type$ x = ($type$) vh.getAndSet(); 1853 }); 1854 checkWMTE(() -> { // > 1855 $type$ x = ($type$) vh.getAndSet(array, 0, $value1$, Void.class); 1856 }); 1857#end[CAS] 1858 1859#if[AtomicAdd] 1860 // GetAndAdd 1861 // Incorrect argument types 1862 checkNPE(() -> { // null array 1863 $type$ x = ($type$) vh.getAndAdd(null, 0, $value1$); 1864 }); 1865 checkCCE(() -> { // array reference class 1866 $type$ x = ($type$) vh.getAndAdd(Void.class, 0, $value1$); 1867 }); 1868 check{#if[String]?CCE:WMTE}(() -> { // value reference class 1869 $type$ x = ($type$) vh.getAndAdd(array, 0, Void.class); 1870 }); 1871 checkWMTE(() -> { // array primitive class 1872 $type$ x = ($type$) vh.getAndAdd(0, 0, $value1$); 1873 }); 1874 checkWMTE(() -> { // index reference class 1875 $type$ x = ($type$) vh.getAndAdd(array, Void.class, $value1$); 1876 }); 1877 // Incorrect return type 1878 check{#if[String]?CCE:WMTE}(() -> { // reference class 1879 Void r = (Void) vh.getAndAdd(array, 0, $value1$); 1880 }); 1881 checkWMTE(() -> { // primitive class 1882 $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndAdd(array, 0, $value1$); 1883 }); 1884 // Incorrect arity 1885 checkWMTE(() -> { // 0 1886 $type$ x = ($type$) vh.getAndAdd(); 1887 }); 1888 checkWMTE(() -> { // > 1889 $type$ x = ($type$) vh.getAndAdd(array, 0, $value1$, Void.class); 1890 }); 1891 1892 1893 // AddAndGet 1894 // Incorrect argument types 1895 checkNPE(() -> { // null array 1896 $type$ x = ($type$) vh.addAndGet(null, 0, $value1$); 1897 }); 1898 checkCCE(() -> { // array reference class 1899 $type$ x = ($type$) vh.addAndGet(Void.class, 0, $value1$); 1900 }); 1901 check{#if[String]?CCE:WMTE}(() -> { // value reference class 1902 $type$ x = ($type$) vh.addAndGet(array, 0, Void.class); 1903 }); 1904 checkWMTE(() -> { // array primitive class 1905 $type$ x = ($type$) vh.addAndGet(0, 0, $value1$); 1906 }); 1907 checkWMTE(() -> { // index reference class 1908 $type$ x = ($type$) vh.addAndGet(array, Void.class, $value1$); 1909 }); 1910 // Incorrect return type 1911 check{#if[String]?CCE:WMTE}(() -> { // reference class 1912 Void r = (Void) vh.addAndGet(array, 0, $value1$); 1913 }); 1914 checkWMTE(() -> { // primitive class 1915 $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.addAndGet(array, 0, $value1$); 1916 }); 1917 // Incorrect arity 1918 checkWMTE(() -> { // 0 1919 $type$ x = ($type$) vh.addAndGet(); 1920 }); 1921 checkWMTE(() -> { // > 1922 $type$ x = ($type$) vh.addAndGet(array, 0, $value1$, Void.class); 1923 }); 1924#end[AtomicAdd] 1925 } 1926 1927 static void testArrayWrongMethodType(Handles hs) throws Throwable { 1928 $type$[] array = new $type$[10]; 1929 Arrays.fill(array, $value1$); 1930 1931 for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) { 1932 // Incorrect argument types 1933 checkNPE(() -> { // null array 1934 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class)). 1935 invokeExact(($type$[]) null, 0); 1936 }); 1937 hs.checkWMTEOrCCE(() -> { // array reference class 1938 $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, int.class)). 1939 invokeExact(Void.class, 0); 1940 }); 1941 checkWMTE(() -> { // array primitive class 1942 $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, int.class)). 1943 invokeExact(0, 0); 1944 }); 1945 checkWMTE(() -> { // index reference class 1946 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, Class.class)). 1947 invokeExact(array, Void.class); 1948 }); 1949 // Incorrect return type 1950 {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class 1951 Void x = (Void) hs.get(am, methodType(Void.class, $type$[].class, int.class)). 1952 invokeExact(array, 0); 1953 }); 1954 checkWMTE(() -> { // primitive class 1955 $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$[].class, int.class)). 1956 invokeExact(array, 0); 1957 }); 1958 // Incorrect arity 1959 checkWMTE(() -> { // 0 1960 $type$ x = ($type$) hs.get(am, methodType($type$.class)). 1961 invokeExact(); 1962 }); 1963 checkWMTE(() -> { // > 1964 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, Class.class)). 1965 invokeExact(array, 0, Void.class); 1966 }); 1967 } 1968 1969 for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { 1970 // Incorrect argument types 1971 checkNPE(() -> { // null array 1972 hs.get(am, methodType(void.class, $type$[].class, int.class, $type$.class)). 1973 invokeExact(($type$[]) null, 0, $value1$); 1974 }); 1975 hs.checkWMTEOrCCE(() -> { // array reference class 1976 hs.get(am, methodType(void.class, Class.class, int.class, $type$.class)). 1977 invokeExact(Void.class, 0, $value1$); 1978 }); 1979 {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class 1980 hs.get(am, methodType(void.class, $type$[].class, int.class, Class.class)). 1981 invokeExact(array, 0, Void.class); 1982 }); 1983 checkWMTE(() -> { // receiver primitive class 1984 hs.get(am, methodType(void.class, int.class, int.class, $type$.class)). 1985 invokeExact(0, 0, $value1$); 1986 }); 1987 checkWMTE(() -> { // index reference class 1988 hs.get(am, methodType(void.class, $type$[].class, Class.class, $type$.class)). 1989 invokeExact(array, Void.class, $value1$); 1990 }); 1991 // Incorrect arity 1992 checkWMTE(() -> { // 0 1993 hs.get(am, methodType(void.class)). 1994 invokeExact(); 1995 }); 1996 checkWMTE(() -> { // > 1997 hs.get(am, methodType(void.class, $type$[].class, int.class, Class.class)). 1998 invokeExact(array, 0, $value1$, Void.class); 1999 }); 2000 } 2001#if[CAS] 2002 for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) { 2003 // Incorrect argument types 2004 checkNPE(() -> { // null receiver 2005 boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$[].class, int.class, $type$.class, $type$.class)). 2006 invokeExact(($type$[]) null, 0, $value1$, $value1$); 2007 }); 2008 hs.checkWMTEOrCCE(() -> { // receiver reference class 2009 boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, int.class, $type$.class, $type$.class)). 2010 invokeExact(Void.class, 0, $value1$, $value1$); 2011 }); 2012 {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // expected reference class 2013 boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$[].class, int.class, Class.class, $type$.class)). 2014 invokeExact(array, 0, Void.class, $value1$); 2015 }); 2016 {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // actual reference class 2017 boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$[].class, int.class, $type$.class, Class.class)). 2018 invokeExact(array, 0, $value1$, Void.class); 2019 }); 2020 checkWMTE(() -> { // receiver primitive class 2021 boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class, int.class, $type$.class, $type$.class)). 2022 invokeExact(0, 0, $value1$, $value1$); 2023 }); 2024 checkWMTE(() -> { // index reference class 2025 boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$[].class, Class.class, $type$.class, $type$.class)). 2026 invokeExact(array, Void.class, $value1$, $value1$); 2027 }); 2028 // Incorrect arity 2029 checkWMTE(() -> { // 0 2030 boolean r = (boolean) hs.get(am, methodType(boolean.class)). 2031 invokeExact(); 2032 }); 2033 checkWMTE(() -> { // > 2034 boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$[].class, int.class, $type$.class, $type$.class, Class.class)). 2035 invokeExact(array, 0, $value1$, $value1$, Void.class); 2036 }); 2037 } 2038 2039 for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) { 2040 // Incorrect argument types 2041 checkNPE(() -> { // null receiver 2042 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class, $type$.class)). 2043 invokeExact(($type$[]) null, 0, $value1$, $value1$); 2044 }); 2045 hs.checkWMTEOrCCE(() -> { // array reference class 2046 $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, int.class, $type$.class, $type$.class)). 2047 invokeExact(Void.class, 0, $value1$, $value1$); 2048 }); 2049 {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // expected reference class 2050 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, Class.class, $type$.class)). 2051 invokeExact(array, 0, Void.class, $value1$); 2052 }); 2053 {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // actual reference class 2054 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class, Class.class)). 2055 invokeExact(array, 0, $value1$, Void.class); 2056 }); 2057 checkWMTE(() -> { // array primitive class 2058 $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, int.class, $type$.class, $type$.class)). 2059 invokeExact(0, 0, $value1$, $value1$); 2060 }); 2061 checkWMTE(() -> { // index reference class 2062 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, Class.class, $type$.class, $type$.class)). 2063 invokeExact(array, Void.class, $value1$, $value1$); 2064 }); 2065 // Incorrect return type 2066 {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class 2067 Void r = (Void) hs.get(am, methodType(Void.class, $type$[].class, int.class, $type$.class, $type$.class)). 2068 invokeExact(array, 0, $value1$, $value1$); 2069 }); 2070 checkWMTE(() -> { // primitive class 2071 $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$[].class, int.class, $type$.class, $type$.class)). 2072 invokeExact(array, 0, $value1$, $value1$); 2073 }); 2074 // Incorrect arity 2075 checkWMTE(() -> { // 0 2076 $type$ x = ($type$) hs.get(am, methodType($type$.class)). 2077 invokeExact(); 2078 }); 2079 checkWMTE(() -> { // > 2080 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class, $type$.class, Class.class)). 2081 invokeExact(array, 0, $value1$, $value1$, Void.class); 2082 }); 2083 } 2084 2085 for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) { 2086 // Incorrect argument types 2087 checkNPE(() -> { // null array 2088 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class)). 2089 invokeExact(($type$[]) null, 0, $value1$); 2090 }); 2091 hs.checkWMTEOrCCE(() -> { // array reference class 2092 $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, int.class, $type$.class)). 2093 invokeExact(Void.class, 0, $value1$); 2094 }); 2095 {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class 2096 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, Class.class)). 2097 invokeExact(array, 0, Void.class); 2098 }); 2099 checkWMTE(() -> { // array primitive class 2100 $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, int.class, $type$.class)). 2101 invokeExact(0, 0, $value1$); 2102 }); 2103 checkWMTE(() -> { // index reference class 2104 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, Class.class, $type$.class)). 2105 invokeExact(array, Void.class, $value1$); 2106 }); 2107 // Incorrect return type 2108 {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class 2109 Void r = (Void) hs.get(am, methodType(Void.class, $type$[].class, int.class, $type$.class)). 2110 invokeExact(array, 0, $value1$); 2111 }); 2112 checkWMTE(() -> { // primitive class 2113 $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$[].class, int.class, $type$.class)). 2114 invokeExact(array, 0, $value1$); 2115 }); 2116 // Incorrect arity 2117 checkWMTE(() -> { // 0 2118 $type$ x = ($type$) hs.get(am, methodType($type$.class)). 2119 invokeExact(); 2120 }); 2121 checkWMTE(() -> { // > 2122 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class, Class.class)). 2123 invokeExact(array, 0, $value1$, Void.class); 2124 }); 2125 } 2126#end[CAS] 2127 2128#if[AtomicAdd] 2129 for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) { 2130 // Incorrect argument types 2131 checkNPE(() -> { // null array 2132 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class)). 2133 invokeExact(($type$[]) null, 0, $value1$); 2134 }); 2135 hs.checkWMTEOrCCE(() -> { // array reference class 2136 $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, int.class, $type$.class)). 2137 invokeExact(Void.class, 0, $value1$); 2138 }); 2139 {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class 2140 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, Class.class)). 2141 invokeExact(array, 0, Void.class); 2142 }); 2143 checkWMTE(() -> { // array primitive class 2144 $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, int.class, $type$.class)). 2145 invokeExact(0, 0, $value1$); 2146 }); 2147 checkWMTE(() -> { // index reference class 2148 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, Class.class, $type$.class)). 2149 invokeExact(array, Void.class, $value1$); 2150 }); 2151 // Incorrect return type 2152 {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class 2153 Void r = (Void) hs.get(am, methodType(Void.class, $type$[].class, int.class, $type$.class)). 2154 invokeExact(array, 0, $value1$); 2155 }); 2156 checkWMTE(() -> { // primitive class 2157 $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$[].class, int.class, $type$.class)). 2158 invokeExact(array, 0, $value1$); 2159 }); 2160 // Incorrect arity 2161 checkWMTE(() -> { // 0 2162 $type$ x = ($type$) hs.get(am, methodType($type$.class)). 2163 invokeExact(); 2164 }); 2165 checkWMTE(() -> { // > 2166 $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class, Class.class)). 2167 invokeExact(array, 0, $value1$, Void.class); 2168 }); 2169 } 2170#end[AtomicAdd] 2171 } 2172} 2173 2174