< prev index next >

test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestMethodType.java.template

Print this page
rev 55900 : 8207257: Add VarHandle access test for value type declared in ref type
Reviewed-by: tbd
   1 /*
   2  * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 











  24 /*
  25  * @test
  26  * @bug 8156486
  27  * @run testng/othervm VarHandleTestMethodType$Type$
  28  * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodType$Type$
  29  */

  30 
  31 import org.testng.annotations.BeforeClass;
  32 import org.testng.annotations.DataProvider;
  33 import org.testng.annotations.Test;
  34 
  35 import java.lang.invoke.MethodHandles;
  36 import java.lang.invoke.VarHandle;
  37 import java.util.ArrayList;
  38 import java.util.Arrays;
  39 import java.util.List;
  40 
  41 import static org.testng.Assert.*;
  42 
  43 import static java.lang.invoke.MethodType.*;
  44 
  45 public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
  46     static final $type$ static_final_v = $value1$;
  47 
  48     static $type$ static_v = $value1$;
  49 


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


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