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


  24 /*
  25  * @test
  26  * @bug 8156486
  27  * @run testng/othervm VarHandleTestMethodTypeInt
  28  * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=true -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeInt
  29  * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=false VarHandleTestMethodTypeInt
  30  * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeInt
  31  */
  32 
  33 import org.testng.annotations.BeforeClass;
  34 import org.testng.annotations.DataProvider;
  35 import org.testng.annotations.Test;
  36 
  37 import java.lang.invoke.MethodHandles;
  38 import java.lang.invoke.VarHandle;
  39 import java.util.ArrayList;
  40 import java.util.Arrays;
  41 import java.util.List;
  42 
  43 import static org.testng.Assert.*;
  44 
  45 import static java.lang.invoke.MethodType.*;
  46 
  47 public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {


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