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