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