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