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