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