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