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