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