X-VarHandleTestMethodType.java.template revision 15539:74cfa7836890
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.weakCompareAndSet(null, $value1$, $value1$);
358        });
359        checkCCE(() -> { // receiver reference class
360            boolean r = vh.weakCompareAndSet(Void.class, $value1$, $value1$);
361        });
362        check{#if[String]?CCE:WMTE}(() -> { // expected reference class
363            boolean r = vh.weakCompareAndSet(recv, Void.class, $value1$);
364        });
365        check{#if[String]?CCE:WMTE}(() -> { // actual reference class
366            boolean r = vh.weakCompareAndSet(recv, $value1$, Void.class);
367        });
368        checkWMTE(() -> { // receiver primitive class
369            boolean r = vh.weakCompareAndSet(0, $value1$, $value1$);
370        });
371        // Incorrect arity
372        checkWMTE(() -> { // 0
373            boolean r = vh.weakCompareAndSet();
374        });
375        checkWMTE(() -> { // >
376            boolean r = vh.weakCompareAndSet(recv, $value1$, $value1$, Void.class);
377        });
378
379
380        // WeakCompareAndSetVolatile
381        // Incorrect argument types
382        checkNPE(() -> { // null receiver
383            boolean r = vh.weakCompareAndSetVolatile(null, $value1$, $value1$);
384        });
385        checkCCE(() -> { // receiver reference class
386            boolean r = vh.weakCompareAndSetVolatile(Void.class, $value1$, $value1$);
387        });
388        check{#if[String]?CCE:WMTE}(() -> { // expected reference class
389            boolean r = vh.weakCompareAndSetVolatile(recv, Void.class, $value1$);
390        });
391        check{#if[String]?CCE:WMTE}(() -> { // actual reference class
392            boolean r = vh.weakCompareAndSetVolatile(recv, $value1$, Void.class);
393        });
394        checkWMTE(() -> { // receiver primitive class
395            boolean r = vh.weakCompareAndSetVolatile(0, $value1$, $value1$);
396        });
397        // Incorrect arity
398        checkWMTE(() -> { // 0
399            boolean r = vh.weakCompareAndSetVolatile();
400        });
401        checkWMTE(() -> { // >
402            boolean r = vh.weakCompareAndSetVolatile(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
733        // AddAndGet
734        // Incorrect argument types
735        checkNPE(() -> { // null receiver
736            $type$ x = ($type$) vh.addAndGet(null, $value1$);
737        });
738        checkCCE(() -> { // receiver reference class
739            $type$ x = ($type$) vh.addAndGet(Void.class, $value1$);
740        });
741        check{#if[String]?CCE:WMTE}(() -> { // value reference class
742            $type$ x = ($type$) vh.addAndGet(recv, Void.class);
743        });
744        checkWMTE(() -> { // reciever primitive class
745            $type$ x = ($type$) vh.addAndGet(0, $value1$);
746        });
747        // Incorrect return type
748        check{#if[String]?CCE:WMTE}(() -> { // reference class
749            Void r = (Void) vh.addAndGet(recv, $value1$);
750        });
751        checkWMTE(() -> { // primitive class
752            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.addAndGet(recv, $value1$);
753        });
754        // Incorrect arity
755        checkWMTE(() -> { // 0
756            $type$ x = ($type$) vh.addAndGet();
757        });
758        checkWMTE(() -> { // >
759            $type$ x = ($type$) vh.addAndGet(recv, $value1$, Void.class);
760        });
761#end[AtomicAdd]
762
763#if[Bitwise]
764        // GetAndBitwiseOr
765        // Incorrect argument types
766        checkNPE(() -> { // null receiver
767            $type$ x = ($type$) vh.getAndBitwiseOr(null, $value1$);
768        });
769        checkCCE(() -> { // receiver reference class
770            $type$ x = ($type$) vh.getAndBitwiseOr(Void.class, $value1$);
771        });
772        check{#if[String]?CCE:WMTE}(() -> { // value reference class
773            $type$ x = ($type$) vh.getAndBitwiseOr(recv, Void.class);
774        });
775        checkWMTE(() -> { // reciever primitive class
776            $type$ x = ($type$) vh.getAndBitwiseOr(0, $value1$);
777        });
778        // Incorrect return type
779        check{#if[String]?CCE:WMTE}(() -> { // reference class
780            Void r = (Void) vh.getAndBitwiseOr(recv, $value1$);
781        });
782        checkWMTE(() -> { // primitive class
783            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOr(recv, $value1$);
784        });
785        // Incorrect arity
786        checkWMTE(() -> { // 0
787            $type$ x = ($type$) vh.getAndBitwiseOr();
788        });
789        checkWMTE(() -> { // >
790            $type$ x = ($type$) vh.getAndBitwiseOr(recv, $value1$, Void.class);
791        });
792
793
794        // GetAndBitwiseOrAcquire
795        // Incorrect argument types
796        checkNPE(() -> { // null receiver
797            $type$ x = ($type$) vh.getAndBitwiseOrAcquire(null, $value1$);
798        });
799        checkCCE(() -> { // receiver reference class
800            $type$ x = ($type$) vh.getAndBitwiseOrAcquire(Void.class, $value1$);
801        });
802        check{#if[String]?CCE:WMTE}(() -> { // value reference class
803            $type$ x = ($type$) vh.getAndBitwiseOrAcquire(recv, Void.class);
804        });
805        checkWMTE(() -> { // reciever primitive class
806            $type$ x = ($type$) vh.getAndBitwiseOrAcquire(0, $value1$);
807        });
808        // Incorrect return type
809        check{#if[String]?CCE:WMTE}(() -> { // reference class
810            Void r = (Void) vh.getAndBitwiseOrAcquire(recv, $value1$);
811        });
812        checkWMTE(() -> { // primitive class
813            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOrAcquire(recv, $value1$);
814        });
815        // Incorrect arity
816        checkWMTE(() -> { // 0
817            $type$ x = ($type$) vh.getAndBitwiseOrAcquire();
818        });
819        checkWMTE(() -> { // >
820            $type$ x = ($type$) vh.getAndBitwiseOrAcquire(recv, $value1$, Void.class);
821        });
822
823
824        // GetAndBitwiseOrRelease
825        // Incorrect argument types
826        checkNPE(() -> { // null receiver
827            $type$ x = ($type$) vh.getAndBitwiseOrRelease(null, $value1$);
828        });
829        checkCCE(() -> { // receiver reference class
830            $type$ x = ($type$) vh.getAndBitwiseOr(Void.class, $value1$);
831        });
832        check{#if[String]?CCE:WMTE}(() -> { // value reference class
833            $type$ x = ($type$) vh.getAndBitwiseOr(recv, Void.class);
834        });
835        checkWMTE(() -> { // reciever primitive class
836            $type$ x = ($type$) vh.getAndBitwiseOr(0, $value1$);
837        });
838        // Incorrect return type
839        check{#if[String]?CCE:WMTE}(() -> { // reference class
840            Void r = (Void) vh.getAndBitwiseOr(recv, $value1$);
841        });
842        checkWMTE(() -> { // primitive class
843            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOr(recv, $value1$);
844        });
845        // Incorrect arity
846        checkWMTE(() -> { // 0
847            $type$ x = ($type$) vh.getAndBitwiseOr();
848        });
849        checkWMTE(() -> { // >
850            $type$ x = ($type$) vh.getAndBitwiseOr(recv, $value1$, Void.class);
851        });
852
853
854        // GetAndBitwiseAnd
855        // Incorrect argument types
856        checkNPE(() -> { // null receiver
857            $type$ x = ($type$) vh.getAndBitwiseAnd(null, $value1$);
858        });
859        checkCCE(() -> { // receiver reference class
860            $type$ x = ($type$) vh.getAndBitwiseAnd(Void.class, $value1$);
861        });
862        check{#if[String]?CCE:WMTE}(() -> { // value reference class
863            $type$ x = ($type$) vh.getAndBitwiseAnd(recv, Void.class);
864        });
865        checkWMTE(() -> { // reciever primitive class
866            $type$ x = ($type$) vh.getAndBitwiseAnd(0, $value1$);
867        });
868        // Incorrect return type
869        check{#if[String]?CCE:WMTE}(() -> { // reference class
870            Void r = (Void) vh.getAndBitwiseAnd(recv, $value1$);
871        });
872        checkWMTE(() -> { // primitive class
873            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAnd(recv, $value1$);
874        });
875        // Incorrect arity
876        checkWMTE(() -> { // 0
877            $type$ x = ($type$) vh.getAndBitwiseAnd();
878        });
879        checkWMTE(() -> { // >
880            $type$ x = ($type$) vh.getAndBitwiseAnd(recv, $value1$, Void.class);
881        });
882
883
884        // GetAndBitwiseAndAcquire
885        // Incorrect argument types
886        checkNPE(() -> { // null receiver
887            $type$ x = ($type$) vh.getAndBitwiseAndAcquire(null, $value1$);
888        });
889        checkCCE(() -> { // receiver reference class
890            $type$ x = ($type$) vh.getAndBitwiseAndAcquire(Void.class, $value1$);
891        });
892        check{#if[String]?CCE:WMTE}(() -> { // value reference class
893            $type$ x = ($type$) vh.getAndBitwiseAndAcquire(recv, Void.class);
894        });
895        checkWMTE(() -> { // reciever primitive class
896            $type$ x = ($type$) vh.getAndBitwiseAndAcquire(0, $value1$);
897        });
898        // Incorrect return type
899        check{#if[String]?CCE:WMTE}(() -> { // reference class
900            Void r = (Void) vh.getAndBitwiseAndAcquire(recv, $value1$);
901        });
902        checkWMTE(() -> { // primitive class
903            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAndAcquire(recv, $value1$);
904        });
905        // Incorrect arity
906        checkWMTE(() -> { // 0
907            $type$ x = ($type$) vh.getAndBitwiseAndAcquire();
908        });
909        checkWMTE(() -> { // >
910            $type$ x = ($type$) vh.getAndBitwiseAndAcquire(recv, $value1$, Void.class);
911        });
912
913
914        // GetAndBitwiseAndRelease
915        // Incorrect argument types
916        checkNPE(() -> { // null receiver
917            $type$ x = ($type$) vh.getAndBitwiseAndRelease(null, $value1$);
918        });
919        checkCCE(() -> { // receiver reference class
920            $type$ x = ($type$) vh.getAndBitwiseAnd(Void.class, $value1$);
921        });
922        check{#if[String]?CCE:WMTE}(() -> { // value reference class
923            $type$ x = ($type$) vh.getAndBitwiseAnd(recv, Void.class);
924        });
925        checkWMTE(() -> { // reciever primitive class
926            $type$ x = ($type$) vh.getAndBitwiseAnd(0, $value1$);
927        });
928        // Incorrect return type
929        check{#if[String]?CCE:WMTE}(() -> { // reference class
930            Void r = (Void) vh.getAndBitwiseAnd(recv, $value1$);
931        });
932        checkWMTE(() -> { // primitive class
933            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAnd(recv, $value1$);
934        });
935        // Incorrect arity
936        checkWMTE(() -> { // 0
937            $type$ x = ($type$) vh.getAndBitwiseAnd();
938        });
939        checkWMTE(() -> { // >
940            $type$ x = ($type$) vh.getAndBitwiseAnd(recv, $value1$, Void.class);
941        });
942
943
944        // GetAndBitwiseXor
945        // Incorrect argument types
946        checkNPE(() -> { // null receiver
947            $type$ x = ($type$) vh.getAndBitwiseXor(null, $value1$);
948        });
949        checkCCE(() -> { // receiver reference class
950            $type$ x = ($type$) vh.getAndBitwiseXor(Void.class, $value1$);
951        });
952        check{#if[String]?CCE:WMTE}(() -> { // value reference class
953            $type$ x = ($type$) vh.getAndBitwiseXor(recv, Void.class);
954        });
955        checkWMTE(() -> { // reciever primitive class
956            $type$ x = ($type$) vh.getAndBitwiseXor(0, $value1$);
957        });
958        // Incorrect return type
959        check{#if[String]?CCE:WMTE}(() -> { // reference class
960            Void r = (Void) vh.getAndBitwiseXor(recv, $value1$);
961        });
962        checkWMTE(() -> { // primitive class
963            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXor(recv, $value1$);
964        });
965        // Incorrect arity
966        checkWMTE(() -> { // 0
967            $type$ x = ($type$) vh.getAndBitwiseXor();
968        });
969        checkWMTE(() -> { // >
970            $type$ x = ($type$) vh.getAndBitwiseXor(recv, $value1$, Void.class);
971        });
972
973
974        // GetAndBitwiseXorAcquire
975        // Incorrect argument types
976        checkNPE(() -> { // null receiver
977            $type$ x = ($type$) vh.getAndBitwiseXorAcquire(null, $value1$);
978        });
979        checkCCE(() -> { // receiver reference class
980            $type$ x = ($type$) vh.getAndBitwiseXorAcquire(Void.class, $value1$);
981        });
982        check{#if[String]?CCE:WMTE}(() -> { // value reference class
983            $type$ x = ($type$) vh.getAndBitwiseXorAcquire(recv, Void.class);
984        });
985        checkWMTE(() -> { // reciever primitive class
986            $type$ x = ($type$) vh.getAndBitwiseXorAcquire(0, $value1$);
987        });
988        // Incorrect return type
989        check{#if[String]?CCE:WMTE}(() -> { // reference class
990            Void r = (Void) vh.getAndBitwiseXorAcquire(recv, $value1$);
991        });
992        checkWMTE(() -> { // primitive class
993            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXorAcquire(recv, $value1$);
994        });
995        // Incorrect arity
996        checkWMTE(() -> { // 0
997            $type$ x = ($type$) vh.getAndBitwiseXorAcquire();
998        });
999        checkWMTE(() -> { // >
1000            $type$ x = ($type$) vh.getAndBitwiseXorAcquire(recv, $value1$, Void.class);
1001        });
1002
1003
1004        // GetAndBitwiseXorRelease
1005        // Incorrect argument types
1006        checkNPE(() -> { // null receiver
1007            $type$ x = ($type$) vh.getAndBitwiseXorRelease(null, $value1$);
1008        });
1009        checkCCE(() -> { // receiver reference class
1010            $type$ x = ($type$) vh.getAndBitwiseXor(Void.class, $value1$);
1011        });
1012        check{#if[String]?CCE:WMTE}(() -> { // value reference class
1013            $type$ x = ($type$) vh.getAndBitwiseXor(recv, Void.class);
1014        });
1015        checkWMTE(() -> { // reciever primitive class
1016            $type$ x = ($type$) vh.getAndBitwiseXor(0, $value1$);
1017        });
1018        // Incorrect return type
1019        check{#if[String]?CCE:WMTE}(() -> { // reference class
1020            Void r = (Void) vh.getAndBitwiseXor(recv, $value1$);
1021        });
1022        checkWMTE(() -> { // primitive class
1023            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXor(recv, $value1$);
1024        });
1025        // Incorrect arity
1026        checkWMTE(() -> { // 0
1027            $type$ x = ($type$) vh.getAndBitwiseXor();
1028        });
1029        checkWMTE(() -> { // >
1030            $type$ x = ($type$) vh.getAndBitwiseXor(recv, $value1$, Void.class);
1031        });
1032#end[Bitwise]
1033    }
1034
1035    static void testInstanceFieldWrongMethodType(VarHandleTestMethodType$Type$ recv, Handles hs) throws Throwable {
1036        for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
1037            // Incorrect argument types
1038            checkNPE(() -> { // null receiver
1039                $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class)).
1040                    invokeExact((VarHandleTestMethodType$Type$) null);
1041            });
1042            hs.checkWMTEOrCCE(() -> { // receiver reference class
1043                $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class)).
1044                    invokeExact(Void.class);
1045            });
1046            checkWMTE(() -> { // receiver primitive class
1047                $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class)).
1048                    invokeExact(0);
1049            });
1050            // Incorrect return type
1051            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
1052                Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodType$Type$.class)).
1053                    invokeExact(recv);
1054            });
1055            checkWMTE(() -> { // primitive class
1056                $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, VarHandleTestMethodType$Type$.class)).
1057                    invokeExact(recv);
1058            });
1059            // Incorrect arity
1060            checkWMTE(() -> { // 0
1061                $type$ x = ($type$) hs.get(am, methodType($type$.class)).
1062                    invokeExact();
1063            });
1064            checkWMTE(() -> { // >
1065                $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, Class.class)).
1066                    invokeExact(recv, Void.class);
1067            });
1068        }
1069
1070        for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
1071            // Incorrect argument types
1072            checkNPE(() -> { // null receiver
1073                hs.get(am, methodType(void.class, VarHandleTestMethodType$Type$.class, $type$.class)).
1074                    invokeExact((VarHandleTestMethodType$Type$) null, $value1$);
1075            });
1076            hs.checkWMTEOrCCE(() -> { // receiver reference class
1077                hs.get(am, methodType(void.class, Class.class, $type$.class)).
1078                    invokeExact(Void.class, $value1$);
1079            });
1080            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class
1081                hs.get(am, methodType(void.class, VarHandleTestMethodType$Type$.class, Class.class)).
1082                    invokeExact(recv, Void.class);
1083            });
1084            checkWMTE(() -> { // receiver primitive class
1085                hs.get(am, methodType(void.class, int.class, $type$.class)).
1086                    invokeExact(0, $value1$);
1087            });
1088            // Incorrect arity
1089            checkWMTE(() -> { // 0
1090                hs.get(am, methodType(void.class)).
1091                    invokeExact();
1092            });
1093            checkWMTE(() -> { // >
1094                hs.get(am, methodType(void.class, VarHandleTestMethodType$Type$.class, $type$.class, Class.class)).
1095                    invokeExact(recv, $value1$, Void.class);
1096            });
1097        }
1098
1099#if[CAS]
1100        for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
1101            // Incorrect argument types
1102            checkNPE(() -> { // null receiver
1103                boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodType$Type$.class, $type$.class, $type$.class)).
1104                    invokeExact((VarHandleTestMethodType$Type$) null, $value1$, $value1$);
1105            });
1106            hs.checkWMTEOrCCE(() -> { // receiver reference class
1107                boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, $type$.class, $type$.class)).
1108                    invokeExact(Void.class, $value1$, $value1$);
1109            });
1110            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // expected reference class
1111                boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodType$Type$.class, Class.class, $type$.class)).
1112                    invokeExact(recv, Void.class, $value1$);
1113            });
1114            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // actual reference class
1115                boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodType$Type$.class, $type$.class, Class.class)).
1116                    invokeExact(recv, $value1$, Void.class);
1117            });
1118            checkWMTE(() -> { // receiver primitive class
1119                boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class , $type$.class, $type$.class)).
1120                    invokeExact(0, $value1$, $value1$);
1121            });
1122            // Incorrect arity
1123            checkWMTE(() -> { // 0
1124                boolean r = (boolean) hs.get(am, methodType(boolean.class)).
1125                    invokeExact();
1126            });
1127            checkWMTE(() -> { // >
1128                boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodType$Type$.class, $type$.class, $type$.class, Class.class)).
1129                    invokeExact(recv, $value1$, $value1$, Void.class);
1130            });
1131        }
1132
1133        for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
1134            checkNPE(() -> { // null receiver
1135                $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class, $type$.class)).
1136                    invokeExact((VarHandleTestMethodType$Type$) null, $value1$, $value1$);
1137            });
1138            hs.checkWMTEOrCCE(() -> { // receiver reference class
1139                $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, $type$.class, $type$.class)).
1140                    invokeExact(Void.class, $value1$, $value1$);
1141            });
1142            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // expected reference class
1143                $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, Class.class, $type$.class)).
1144                    invokeExact(recv, Void.class, $value1$);
1145            });
1146            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // actual reference class
1147                $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class, Class.class)).
1148                    invokeExact(recv, $value1$, Void.class);
1149            });
1150            checkWMTE(() -> { // reciever primitive class
1151                $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class , $type$.class, $type$.class)).
1152                    invokeExact(0, $value1$, $value1$);
1153            });
1154            // Incorrect return type
1155            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
1156                Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodType$Type$.class , $type$.class, $type$.class)).
1157                    invokeExact(recv, $value1$, $value1$);
1158            });
1159            checkWMTE(() -> { // primitive class
1160                $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, VarHandleTestMethodType$Type$.class , $type$.class, $type$.class)).
1161                    invokeExact(recv, $value1$, $value1$);
1162            });
1163            // Incorrect arity
1164            checkWMTE(() -> { // 0
1165                $type$ x = ($type$) hs.get(am, methodType($type$.class)).
1166                    invokeExact();
1167            });
1168            checkWMTE(() -> { // >
1169                $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class, $type$.class, Class.class)).
1170                    invokeExact(recv, $value1$, $value1$, Void.class);
1171            });
1172        }
1173
1174        for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
1175            checkNPE(() -> { // null receiver
1176                $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class)).
1177                    invokeExact((VarHandleTestMethodType$Type$) null, $value1$);
1178            });
1179            hs.checkWMTEOrCCE(() -> { // receiver reference class
1180                $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, $type$.class)).
1181                    invokeExact(Void.class, $value1$);
1182            });
1183            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class
1184                $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, Class.class)).
1185                    invokeExact(recv, Void.class);
1186            });
1187            checkWMTE(() -> { // reciever primitive class
1188                $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, $type$.class)).
1189                    invokeExact(0, $value1$);
1190            });
1191            // Incorrect return type
1192            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
1193                Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodType$Type$.class, $type$.class)).
1194                    invokeExact(recv, $value1$);
1195            });
1196            checkWMTE(() -> { // primitive class
1197                $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, VarHandleTestMethodType$Type$.class, $type$.class)).
1198                    invokeExact(recv, $value1$);
1199            });
1200            // Incorrect arity
1201            checkWMTE(() -> { // 0
1202                $type$ x = ($type$) hs.get(am, methodType($type$.class)).
1203                    invokeExact();
1204            });
1205            checkWMTE(() -> { // >
1206                $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class)).
1207                    invokeExact(recv, $value1$, Void.class);
1208            });
1209        }
1210#end[CAS]
1211
1212#if[AtomicAdd]
1213        for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
1214            checkNPE(() -> { // null receiver
1215                $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class)).
1216                    invokeExact((VarHandleTestMethodType$Type$) null, $value1$);
1217            });
1218            hs.checkWMTEOrCCE(() -> { // receiver reference class
1219                $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, $type$.class)).
1220                    invokeExact(Void.class, $value1$);
1221            });
1222            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class
1223                $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, Class.class)).
1224                    invokeExact(recv, Void.class);
1225            });
1226            checkWMTE(() -> { // reciever primitive class
1227                $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, $type$.class)).
1228                    invokeExact(0, $value1$);
1229            });
1230            // Incorrect return type
1231            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
1232                Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodType$Type$.class, $type$.class)).
1233                    invokeExact(recv, $value1$);
1234            });
1235            checkWMTE(() -> { // primitive class
1236                $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, VarHandleTestMethodType$Type$.class, $type$.class)).
1237                    invokeExact(recv, $value1$);
1238            });
1239            // Incorrect arity
1240            checkWMTE(() -> { // 0
1241                $type$ x = ($type$) hs.get(am, methodType($type$.class)).
1242                    invokeExact();
1243            });
1244            checkWMTE(() -> { // >
1245                $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class)).
1246                    invokeExact(recv, $value1$, Void.class);
1247            });
1248        }
1249#end[AtomicAdd]
1250
1251#if[Bitwise]
1252        for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
1253            checkNPE(() -> { // null receiver
1254                $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class)).
1255                    invokeExact((VarHandleTestMethodType$Type$) null, $value1$);
1256            });
1257            hs.checkWMTEOrCCE(() -> { // receiver reference class
1258                $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, $type$.class)).
1259                    invokeExact(Void.class, $value1$);
1260            });
1261            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class
1262                $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, Class.class)).
1263                    invokeExact(recv, Void.class);
1264            });
1265            checkWMTE(() -> { // reciever primitive class
1266                $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, $type$.class)).
1267                    invokeExact(0, $value1$);
1268            });
1269            // Incorrect return type
1270            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
1271                Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodType$Type$.class, $type$.class)).
1272                    invokeExact(recv, $value1$);
1273            });
1274            checkWMTE(() -> { // primitive class
1275                $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, VarHandleTestMethodType$Type$.class, $type$.class)).
1276                    invokeExact(recv, $value1$);
1277            });
1278            // Incorrect arity
1279            checkWMTE(() -> { // 0
1280                $type$ x = ($type$) hs.get(am, methodType($type$.class)).
1281                    invokeExact();
1282            });
1283            checkWMTE(() -> { // >
1284                $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class)).
1285                    invokeExact(recv, $value1$, Void.class);
1286            });
1287        }
1288#end[Bitwise]
1289    }
1290
1291
1292    static void testStaticFieldWrongMethodType(VarHandle vh) throws Throwable {
1293        // Get
1294        // Incorrect return type
1295        check{#if[String]?CCE:WMTE}(() -> { // reference class
1296            Void x = (Void) vh.get();
1297        });
1298        checkWMTE(() -> { // primitive class
1299            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.get();
1300        });
1301        // Incorrect arity
1302        checkWMTE(() -> { // >
1303            $type$ x = ($type$) vh.get(Void.class);
1304        });
1305
1306
1307        // Set
1308        // Incorrect argument types
1309        check{#if[String]?CCE:WMTE}(() -> { // value reference class
1310            vh.set(Void.class);
1311        });
1312        // Incorrect arity
1313        checkWMTE(() -> { // 0
1314            vh.set();
1315        });
1316        checkWMTE(() -> { // >
1317            vh.set($value1$, Void.class);
1318        });
1319
1320
1321        // GetVolatile
1322        // Incorrect return type
1323        check{#if[String]?CCE:WMTE}(() -> { // reference class
1324            Void x = (Void) vh.getVolatile();
1325        });
1326        checkWMTE(() -> { // primitive class
1327            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getVolatile();
1328        });
1329        checkWMTE(() -> { // >
1330            $type$ x = ($type$) vh.getVolatile(Void.class);
1331        });
1332
1333
1334        // SetVolatile
1335        // Incorrect argument types
1336        check{#if[String]?CCE:WMTE}(() -> { // value reference class
1337            vh.setVolatile(Void.class);
1338        });
1339        // Incorrect arity
1340        checkWMTE(() -> { // 0
1341            vh.setVolatile();
1342        });
1343        checkWMTE(() -> { // >
1344            vh.setVolatile($value1$, Void.class);
1345        });
1346
1347
1348        // GetOpaque
1349        // Incorrect return type
1350        check{#if[String]?CCE:WMTE}(() -> { // reference class
1351            Void x = (Void) vh.getOpaque();
1352        });
1353        checkWMTE(() -> { // primitive class
1354            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getOpaque();
1355        });
1356        checkWMTE(() -> { // >
1357            $type$ x = ($type$) vh.getOpaque(Void.class);
1358        });
1359
1360
1361        // SetOpaque
1362        // Incorrect argument types
1363        check{#if[String]?CCE:WMTE}(() -> { // value reference class
1364            vh.setOpaque(Void.class);
1365        });
1366        // Incorrect arity
1367        checkWMTE(() -> { // 0
1368            vh.setOpaque();
1369        });
1370        checkWMTE(() -> { // >
1371            vh.setOpaque($value1$, Void.class);
1372        });
1373
1374
1375        // GetAcquire
1376        // Incorrect return type
1377        check{#if[String]?CCE:WMTE}(() -> { // reference class
1378            Void x = (Void) vh.getAcquire();
1379        });
1380        checkWMTE(() -> { // primitive class
1381            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAcquire();
1382        });
1383        checkWMTE(() -> { // >
1384            $type$ x = ($type$) vh.getAcquire(Void.class);
1385        });
1386
1387
1388        // SetRelease
1389        // Incorrect argument types
1390        check{#if[String]?CCE:WMTE}(() -> { // value reference class
1391            vh.setRelease(Void.class);
1392        });
1393        // Incorrect arity
1394        checkWMTE(() -> { // 0
1395            vh.setRelease();
1396        });
1397        checkWMTE(() -> { // >
1398            vh.setRelease($value1$, Void.class);
1399        });
1400
1401
1402#if[CAS]
1403        // CompareAndSet
1404        // Incorrect argument types
1405        check{#if[String]?CCE:WMTE}(() -> { // expected reference class
1406            boolean r = vh.compareAndSet(Void.class, $value1$);
1407        });
1408        check{#if[String]?CCE:WMTE}(() -> { // actual reference class
1409            boolean r = vh.compareAndSet($value1$, Void.class);
1410        });
1411        // Incorrect arity
1412        checkWMTE(() -> { // 0
1413            boolean r = vh.compareAndSet();
1414        });
1415        checkWMTE(() -> { // >
1416            boolean r = vh.compareAndSet($value1$, $value1$, Void.class);
1417        });
1418
1419
1420        // WeakCompareAndSet
1421        // Incorrect argument types
1422        check{#if[String]?CCE:WMTE}(() -> { // expected reference class
1423            boolean r = vh.weakCompareAndSet(Void.class, $value1$);
1424        });
1425        check{#if[String]?CCE:WMTE}(() -> { // actual reference class
1426            boolean r = vh.weakCompareAndSet($value1$, Void.class);
1427        });
1428        // Incorrect arity
1429        checkWMTE(() -> { // 0
1430            boolean r = vh.weakCompareAndSet();
1431        });
1432        checkWMTE(() -> { // >
1433            boolean r = vh.weakCompareAndSet($value1$, $value1$, Void.class);
1434        });
1435
1436
1437        // WeakCompareAndSetVolatile
1438        // Incorrect argument types
1439        check{#if[String]?CCE:WMTE}(() -> { // expected reference class
1440            boolean r = vh.weakCompareAndSetVolatile(Void.class, $value1$);
1441        });
1442        check{#if[String]?CCE:WMTE}(() -> { // actual reference class
1443            boolean r = vh.weakCompareAndSetVolatile($value1$, Void.class);
1444        });
1445        // Incorrect arity
1446        checkWMTE(() -> { // 0
1447            boolean r = vh.weakCompareAndSetVolatile();
1448        });
1449        checkWMTE(() -> { // >
1450            boolean r = vh.weakCompareAndSetVolatile($value1$, $value1$, Void.class);
1451        });
1452
1453
1454        // WeakCompareAndSetAcquire
1455        // Incorrect argument types
1456        check{#if[String]?CCE:WMTE}(() -> { // expected reference class
1457            boolean r = vh.weakCompareAndSetAcquire(Void.class, $value1$);
1458        });
1459        check{#if[String]?CCE:WMTE}(() -> { // actual reference class
1460            boolean r = vh.weakCompareAndSetAcquire($value1$, Void.class);
1461        });
1462        // Incorrect arity
1463        checkWMTE(() -> { // 0
1464            boolean r = vh.weakCompareAndSetAcquire();
1465        });
1466        checkWMTE(() -> { // >
1467            boolean r = vh.weakCompareAndSetAcquire($value1$, $value1$, Void.class);
1468        });
1469
1470
1471        // WeakCompareAndSetRelease
1472        // Incorrect argument types
1473        check{#if[String]?CCE:WMTE}(() -> { // expected reference class
1474            boolean r = vh.weakCompareAndSetRelease(Void.class, $value1$);
1475        });
1476        check{#if[String]?CCE:WMTE}(() -> { // actual reference class
1477            boolean r = vh.weakCompareAndSetRelease($value1$, Void.class);
1478        });
1479        // Incorrect arity
1480        checkWMTE(() -> { // 0
1481            boolean r = vh.weakCompareAndSetRelease();
1482        });
1483        checkWMTE(() -> { // >
1484            boolean r = vh.weakCompareAndSetRelease($value1$, $value1$, Void.class);
1485        });
1486
1487
1488        // CompareAndExchange
1489        // Incorrect argument types
1490        check{#if[String]?CCE:WMTE}(() -> { // expected reference class
1491            $type$ x = ($type$) vh.compareAndExchange(Void.class, $value1$);
1492        });
1493        check{#if[String]?CCE:WMTE}(() -> { // actual reference class
1494            $type$ x = ($type$) vh.compareAndExchange($value1$, Void.class);
1495        });
1496        // Incorrect return type
1497        check{#if[String]?CCE:WMTE}(() -> { // reference class
1498            Void r = (Void) vh.compareAndExchange($value1$, $value1$);
1499        });
1500        checkWMTE(() -> { // primitive class
1501            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.compareAndExchange($value1$, $value1$);
1502        });
1503        // Incorrect arity
1504        checkWMTE(() -> { // 0
1505            $type$ x = ($type$) vh.compareAndExchange();
1506        });
1507        checkWMTE(() -> { // >
1508            $type$ x = ($type$) vh.compareAndExchange($value1$, $value1$, Void.class);
1509        });
1510
1511
1512        // CompareAndExchangeAcquire
1513        // Incorrect argument types
1514        check{#if[String]?CCE:WMTE}(() -> { // expected reference class
1515            $type$ x = ($type$) vh.compareAndExchangeAcquire(Void.class, $value1$);
1516        });
1517        check{#if[String]?CCE:WMTE}(() -> { // actual reference class
1518            $type$ x = ($type$) vh.compareAndExchangeAcquire($value1$, Void.class);
1519        });
1520        // Incorrect return type
1521        check{#if[String]?CCE:WMTE}(() -> { // reference class
1522            Void r = (Void) vh.compareAndExchangeAcquire($value1$, $value1$);
1523        });
1524        checkWMTE(() -> { // primitive class
1525            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.compareAndExchangeAcquire($value1$, $value1$);
1526        });
1527        // Incorrect arity
1528        checkWMTE(() -> { // 0
1529            $type$ x = ($type$) vh.compareAndExchangeAcquire();
1530        });
1531        checkWMTE(() -> { // >
1532            $type$ x = ($type$) vh.compareAndExchangeAcquire($value1$, $value1$, Void.class);
1533        });
1534
1535
1536        // CompareAndExchangeRelease
1537        // Incorrect argument types
1538        check{#if[String]?CCE:WMTE}(() -> { // expected reference class
1539            $type$ x = ($type$) vh.compareAndExchangeRelease(Void.class, $value1$);
1540        });
1541        check{#if[String]?CCE:WMTE}(() -> { // actual reference class
1542            $type$ x = ($type$) vh.compareAndExchangeRelease($value1$, Void.class);
1543        });
1544        // Incorrect return type
1545        check{#if[String]?CCE:WMTE}(() -> { // reference class
1546            Void r = (Void) vh.compareAndExchangeRelease($value1$, $value1$);
1547        });
1548        checkWMTE(() -> { // primitive class
1549            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.compareAndExchangeRelease($value1$, $value1$);
1550        });
1551        // Incorrect arity
1552        checkWMTE(() -> { // 0
1553            $type$ x = ($type$) vh.compareAndExchangeRelease();
1554        });
1555        checkWMTE(() -> { // >
1556            $type$ x = ($type$) vh.compareAndExchangeRelease($value1$, $value1$, Void.class);
1557        });
1558
1559
1560        // GetAndSet
1561        // Incorrect argument types
1562        check{#if[String]?CCE:WMTE}(() -> { // value reference class
1563            $type$ x = ($type$) vh.getAndSet(Void.class);
1564        });
1565        // Incorrect return type
1566        check{#if[String]?CCE:WMTE}(() -> { // reference class
1567            Void r = (Void) vh.getAndSet($value1$);
1568        });
1569        checkWMTE(() -> { // primitive class
1570            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndSet($value1$);
1571        });
1572        // Incorrect arity
1573        checkWMTE(() -> { // 0
1574            $type$ x = ($type$) vh.getAndSet();
1575        });
1576        checkWMTE(() -> { // >
1577            $type$ x = ($type$) vh.getAndSet($value1$, Void.class);
1578        });
1579
1580
1581        // GetAndSetAcquire
1582        // Incorrect argument types
1583        check{#if[String]?CCE:WMTE}(() -> { // value reference class
1584            $type$ x = ($type$) vh.getAndSetAcquire(Void.class);
1585        });
1586        // Incorrect return type
1587        check{#if[String]?CCE:WMTE}(() -> { // reference class
1588            Void r = (Void) vh.getAndSetAcquire($value1$);
1589        });
1590        checkWMTE(() -> { // primitive class
1591            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndSetAcquire($value1$);
1592        });
1593        // Incorrect arity
1594        checkWMTE(() -> { // 0
1595            $type$ x = ($type$) vh.getAndSetAcquire();
1596        });
1597        checkWMTE(() -> { // >
1598            $type$ x = ($type$) vh.getAndSetAcquire($value1$, Void.class);
1599        });
1600
1601
1602        // GetAndSetRelease
1603        // Incorrect argument types
1604        check{#if[String]?CCE:WMTE}(() -> { // value reference class
1605            $type$ x = ($type$) vh.getAndSetRelease(Void.class);
1606        });
1607        // Incorrect return type
1608        check{#if[String]?CCE:WMTE}(() -> { // reference class
1609            Void r = (Void) vh.getAndSetRelease($value1$);
1610        });
1611        checkWMTE(() -> { // primitive class
1612            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndSetRelease($value1$);
1613        });
1614        // Incorrect arity
1615        checkWMTE(() -> { // 0
1616            $type$ x = ($type$) vh.getAndSetRelease();
1617        });
1618        checkWMTE(() -> { // >
1619            $type$ x = ($type$) vh.getAndSetRelease($value1$, Void.class);
1620        });
1621#end[CAS]
1622
1623#if[AtomicAdd]
1624        // GetAndAdd
1625        // Incorrect argument types
1626        check{#if[String]?CCE:WMTE}(() -> { // value reference class
1627            $type$ x = ($type$) vh.getAndAdd(Void.class);
1628        });
1629        // Incorrect return type
1630        check{#if[String]?CCE:WMTE}(() -> { // reference class
1631            Void r = (Void) vh.getAndAdd($value1$);
1632        });
1633        checkWMTE(() -> { // primitive class
1634            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndAdd($value1$);
1635        });
1636        // Incorrect arity
1637        checkWMTE(() -> { // 0
1638            $type$ x = ($type$) vh.getAndAdd();
1639        });
1640        checkWMTE(() -> { // >
1641            $type$ x = ($type$) vh.getAndAdd($value1$, Void.class);
1642        });
1643
1644
1645        // GetAndAddAcquire
1646        // Incorrect argument types
1647        check{#if[String]?CCE:WMTE}(() -> { // value reference class
1648            $type$ x = ($type$) vh.getAndAddAcquire(Void.class);
1649        });
1650        // Incorrect return type
1651        check{#if[String]?CCE:WMTE}(() -> { // reference class
1652            Void r = (Void) vh.getAndAddAcquire($value1$);
1653        });
1654        checkWMTE(() -> { // primitive class
1655            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndAddAcquire($value1$);
1656        });
1657        // Incorrect arity
1658        checkWMTE(() -> { // 0
1659            $type$ x = ($type$) vh.getAndAddAcquire();
1660        });
1661        checkWMTE(() -> { // >
1662            $type$ x = ($type$) vh.getAndAddAcquire($value1$, Void.class);
1663        });
1664
1665
1666        // GetAndAddRelease
1667        // Incorrect argument types
1668        check{#if[String]?CCE:WMTE}(() -> { // value reference class
1669            $type$ x = ($type$) vh.getAndAddRelease(Void.class);
1670        });
1671        // Incorrect return type
1672        check{#if[String]?CCE:WMTE}(() -> { // reference class
1673            Void r = (Void) vh.getAndAddRelease($value1$);
1674        });
1675        checkWMTE(() -> { // primitive class
1676            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndAddRelease($value1$);
1677        });
1678        // Incorrect arity
1679        checkWMTE(() -> { // 0
1680            $type$ x = ($type$) vh.getAndAddRelease();
1681        });
1682        checkWMTE(() -> { // >
1683            $type$ x = ($type$) vh.getAndAddRelease($value1$, Void.class);
1684        });
1685
1686
1687        // AddAndGet
1688        // Incorrect argument types
1689        check{#if[String]?CCE:WMTE}(() -> { // value reference class
1690            $type$ x = ($type$) vh.addAndGet(Void.class);
1691        });
1692        // Incorrect return type
1693        check{#if[String]?CCE:WMTE}(() -> { // reference class
1694            Void r = (Void) vh.addAndGet($value1$);
1695        });
1696        checkWMTE(() -> { // primitive class
1697            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.addAndGet($value1$);
1698        });
1699        // Incorrect arity
1700        checkWMTE(() -> { // 0
1701            $type$ x = ($type$) vh.addAndGet();
1702        });
1703        checkWMTE(() -> { // >
1704            $type$ x = ($type$) vh.addAndGet($value1$, Void.class);
1705        });
1706#end[AtomicAdd]
1707
1708#if[Bitwise]
1709        // GetAndBitwiseOr
1710        // Incorrect argument types
1711        check{#if[String]?CCE:WMTE}(() -> { // value reference class
1712            $type$ x = ($type$) vh.getAndBitwiseOr(Void.class);
1713        });
1714        // Incorrect return type
1715        check{#if[String]?CCE:WMTE}(() -> { // reference class
1716            Void r = (Void) vh.getAndBitwiseOr($value1$);
1717        });
1718        checkWMTE(() -> { // primitive class
1719            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOr($value1$);
1720        });
1721        // Incorrect arity
1722        checkWMTE(() -> { // 0
1723            $type$ x = ($type$) vh.getAndBitwiseOr();
1724        });
1725        checkWMTE(() -> { // >
1726            $type$ x = ($type$) vh.getAndBitwiseOr($value1$, Void.class);
1727        });
1728
1729
1730        // GetAndBitwiseOrAcquire
1731        // Incorrect argument types
1732        check{#if[String]?CCE:WMTE}(() -> { // value reference class
1733            $type$ x = ($type$) vh.getAndBitwiseOrAcquire(Void.class);
1734        });
1735        // Incorrect return type
1736        check{#if[String]?CCE:WMTE}(() -> { // reference class
1737            Void r = (Void) vh.getAndBitwiseOrAcquire($value1$);
1738        });
1739        checkWMTE(() -> { // primitive class
1740            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOrAcquire($value1$);
1741        });
1742        // Incorrect arity
1743        checkWMTE(() -> { // 0
1744            $type$ x = ($type$) vh.getAndBitwiseOrAcquire();
1745        });
1746        checkWMTE(() -> { // >
1747            $type$ x = ($type$) vh.getAndBitwiseOrAcquire($value1$, Void.class);
1748        });
1749
1750
1751        // GetAndBitwiseOrReleaseRelease
1752        // Incorrect argument types
1753        check{#if[String]?CCE:WMTE}(() -> { // value reference class
1754            $type$ x = ($type$) vh.getAndBitwiseOrRelease(Void.class);
1755        });
1756        // Incorrect return type
1757        check{#if[String]?CCE:WMTE}(() -> { // reference class
1758            Void r = (Void) vh.getAndBitwiseOrRelease($value1$);
1759        });
1760        checkWMTE(() -> { // primitive class
1761            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOrRelease($value1$);
1762        });
1763        // Incorrect arity
1764        checkWMTE(() -> { // 0
1765            $type$ x = ($type$) vh.getAndBitwiseOrRelease();
1766        });
1767        checkWMTE(() -> { // >
1768            $type$ x = ($type$) vh.getAndBitwiseOrRelease($value1$, Void.class);
1769        });
1770
1771
1772        // GetAndBitwiseAnd
1773        // Incorrect argument types
1774        check{#if[String]?CCE:WMTE}(() -> { // value reference class
1775            $type$ x = ($type$) vh.getAndBitwiseAnd(Void.class);
1776        });
1777        // Incorrect return type
1778        check{#if[String]?CCE:WMTE}(() -> { // reference class
1779            Void r = (Void) vh.getAndBitwiseAnd($value1$);
1780        });
1781        checkWMTE(() -> { // primitive class
1782            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAnd($value1$);
1783        });
1784        // Incorrect arity
1785        checkWMTE(() -> { // 0
1786            $type$ x = ($type$) vh.getAndBitwiseAnd();
1787        });
1788        checkWMTE(() -> { // >
1789            $type$ x = ($type$) vh.getAndBitwiseAnd($value1$, Void.class);
1790        });
1791
1792
1793        // GetAndBitwiseAndAcquire
1794        // Incorrect argument types
1795        check{#if[String]?CCE:WMTE}(() -> { // value reference class
1796            $type$ x = ($type$) vh.getAndBitwiseAndAcquire(Void.class);
1797        });
1798        // Incorrect return type
1799        check{#if[String]?CCE:WMTE}(() -> { // reference class
1800            Void r = (Void) vh.getAndBitwiseAndAcquire($value1$);
1801        });
1802        checkWMTE(() -> { // primitive class
1803            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAndAcquire($value1$);
1804        });
1805        // Incorrect arity
1806        checkWMTE(() -> { // 0
1807            $type$ x = ($type$) vh.getAndBitwiseAndAcquire();
1808        });
1809        checkWMTE(() -> { // >
1810            $type$ x = ($type$) vh.getAndBitwiseAndAcquire($value1$, Void.class);
1811        });
1812
1813
1814        // GetAndBitwiseAndReleaseRelease
1815        // Incorrect argument types
1816        check{#if[String]?CCE:WMTE}(() -> { // value reference class
1817            $type$ x = ($type$) vh.getAndBitwiseAndRelease(Void.class);
1818        });
1819        // Incorrect return type
1820        check{#if[String]?CCE:WMTE}(() -> { // reference class
1821            Void r = (Void) vh.getAndBitwiseAndRelease($value1$);
1822        });
1823        checkWMTE(() -> { // primitive class
1824            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAndRelease($value1$);
1825        });
1826        // Incorrect arity
1827        checkWMTE(() -> { // 0
1828            $type$ x = ($type$) vh.getAndBitwiseAndRelease();
1829        });
1830        checkWMTE(() -> { // >
1831            $type$ x = ($type$) vh.getAndBitwiseAndRelease($value1$, Void.class);
1832        });
1833
1834
1835        // GetAndBitwiseXor
1836        // Incorrect argument types
1837        check{#if[String]?CCE:WMTE}(() -> { // value reference class
1838            $type$ x = ($type$) vh.getAndBitwiseXor(Void.class);
1839        });
1840        // Incorrect return type
1841        check{#if[String]?CCE:WMTE}(() -> { // reference class
1842            Void r = (Void) vh.getAndBitwiseXor($value1$);
1843        });
1844        checkWMTE(() -> { // primitive class
1845            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXor($value1$);
1846        });
1847        // Incorrect arity
1848        checkWMTE(() -> { // 0
1849            $type$ x = ($type$) vh.getAndBitwiseXor();
1850        });
1851        checkWMTE(() -> { // >
1852            $type$ x = ($type$) vh.getAndBitwiseXor($value1$, Void.class);
1853        });
1854
1855
1856        // GetAndBitwiseXorAcquire
1857        // Incorrect argument types
1858        check{#if[String]?CCE:WMTE}(() -> { // value reference class
1859            $type$ x = ($type$) vh.getAndBitwiseXorAcquire(Void.class);
1860        });
1861        // Incorrect return type
1862        check{#if[String]?CCE:WMTE}(() -> { // reference class
1863            Void r = (Void) vh.getAndBitwiseXorAcquire($value1$);
1864        });
1865        checkWMTE(() -> { // primitive class
1866            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXorAcquire($value1$);
1867        });
1868        // Incorrect arity
1869        checkWMTE(() -> { // 0
1870            $type$ x = ($type$) vh.getAndBitwiseXorAcquire();
1871        });
1872        checkWMTE(() -> { // >
1873            $type$ x = ($type$) vh.getAndBitwiseXorAcquire($value1$, Void.class);
1874        });
1875
1876
1877        // GetAndBitwiseXorReleaseRelease
1878        // Incorrect argument types
1879        check{#if[String]?CCE:WMTE}(() -> { // value reference class
1880            $type$ x = ($type$) vh.getAndBitwiseXorRelease(Void.class);
1881        });
1882        // Incorrect return type
1883        check{#if[String]?CCE:WMTE}(() -> { // reference class
1884            Void r = (Void) vh.getAndBitwiseXorRelease($value1$);
1885        });
1886        checkWMTE(() -> { // primitive class
1887            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXorRelease($value1$);
1888        });
1889        // Incorrect arity
1890        checkWMTE(() -> { // 0
1891            $type$ x = ($type$) vh.getAndBitwiseXorRelease();
1892        });
1893        checkWMTE(() -> { // >
1894            $type$ x = ($type$) vh.getAndBitwiseXorRelease($value1$, Void.class);
1895        });
1896#end[Bitwise]
1897    }
1898
1899    static void testStaticFieldWrongMethodType(Handles hs) throws Throwable {
1900        int i = 0;
1901
1902        for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
1903            // Incorrect return type
1904            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
1905                Void x = (Void) hs.get(am, methodType(Void.class)).
1906                    invokeExact();
1907            });
1908            checkWMTE(() -> { // primitive class
1909                $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class)).
1910                    invokeExact();
1911            });
1912            // Incorrect arity
1913            checkWMTE(() -> { // >
1914                $type$ x = ($type$) hs.get(am, methodType(Class.class)).
1915                    invokeExact(Void.class);
1916            });
1917        }
1918
1919        for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
1920            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class
1921                hs.get(am, methodType(void.class, Class.class)).
1922                    invokeExact(Void.class);
1923            });
1924            // Incorrect arity
1925            checkWMTE(() -> { // 0
1926                hs.get(am, methodType(void.class)).
1927                    invokeExact();
1928            });
1929            checkWMTE(() -> { // >
1930                hs.get(am, methodType(void.class, $type$.class, Class.class)).
1931                    invokeExact($value1$, Void.class);
1932            });
1933        }
1934#if[CAS]
1935        for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
1936            // Incorrect argument types
1937            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // expected reference class
1938                boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, $type$.class)).
1939                    invokeExact(Void.class, $value1$);
1940            });
1941            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // actual reference class
1942                boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$.class, Class.class)).
1943                    invokeExact($value1$, Void.class);
1944            });
1945            // Incorrect arity
1946            checkWMTE(() -> { // 0
1947                boolean r = (boolean) hs.get(am, methodType(boolean.class)).
1948                    invokeExact();
1949            });
1950            checkWMTE(() -> { // >
1951                boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$.class, $type$.class, Class.class)).
1952                    invokeExact($value1$, $value1$, Void.class);
1953            });
1954        }
1955
1956        for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
1957            // Incorrect argument types
1958            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // expected reference class
1959                $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, $type$.class)).
1960                    invokeExact(Void.class, $value1$);
1961            });
1962            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // actual reference class
1963                $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$.class, Class.class)).
1964                    invokeExact($value1$, Void.class);
1965            });
1966            // Incorrect return type
1967            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
1968                Void r = (Void) hs.get(am, methodType(Void.class, $type$.class, $type$.class)).
1969                    invokeExact($value1$, $value1$);
1970            });
1971            checkWMTE(() -> { // primitive class
1972                $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$.class, $type$.class)).
1973                    invokeExact($value1$, $value1$);
1974            });
1975            // Incorrect arity
1976            checkWMTE(() -> { // 0
1977                $type$ x = ($type$) hs.get(am, methodType($type$.class)).
1978                    invokeExact();
1979            });
1980            checkWMTE(() -> { // >
1981                $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$.class, $type$.class, Class.class)).
1982                    invokeExact($value1$, $value1$, Void.class);
1983            });
1984        }
1985
1986        for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
1987            // Incorrect argument types
1988            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class
1989                $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class)).
1990                    invokeExact(Void.class);
1991            });
1992            // Incorrect return type
1993            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
1994                Void r = (Void) hs.get(am, methodType(Void.class, $type$.class)).
1995                    invokeExact($value1$);
1996            });
1997            checkWMTE(() -> { // primitive class
1998                $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$.class)).
1999                    invokeExact($value1$);
2000            });
2001            // Incorrect arity
2002            checkWMTE(() -> { // 0
2003                $type$ x = ($type$) hs.get(am, methodType($type$.class)).
2004                    invokeExact();
2005            });
2006            checkWMTE(() -> { // >
2007                $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$.class, Class.class)).
2008                    invokeExact($value1$, Void.class);
2009            });
2010        }
2011#end[CAS]
2012
2013#if[AtomicAdd]
2014        for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
2015            // Incorrect argument types
2016            check{#if[String]?CCE:WMTE}(() -> { // value reference class
2017                $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class)).
2018                    invokeExact(Void.class);
2019            });
2020            // Incorrect return type
2021            check{#if[String]?CCE:WMTE}(() -> { // reference class
2022                Void r = (Void) hs.get(am, methodType(Void.class, $type$.class)).
2023                    invokeExact($value1$);
2024            });
2025            checkWMTE(() -> { // primitive class
2026                $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$.class)).
2027                    invokeExact($value1$);
2028            });
2029            // Incorrect arity
2030            checkWMTE(() -> { // 0
2031                $type$ x = ($type$) hs.get(am, methodType($type$.class)).
2032                    invokeExact();
2033            });
2034            checkWMTE(() -> { // >
2035                $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$.class, Class.class)).
2036                    invokeExact($value1$, Void.class);
2037            });
2038        }
2039#end[AtomicAdd]
2040
2041#if[Bitwise]
2042        for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
2043            // Incorrect argument types
2044            check{#if[String]?CCE:WMTE}(() -> { // value reference class
2045                $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class)).
2046                    invokeExact(Void.class);
2047            });
2048            // Incorrect return type
2049            check{#if[String]?CCE:WMTE}(() -> { // reference class
2050                Void r = (Void) hs.get(am, methodType(Void.class, $type$.class)).
2051                    invokeExact($value1$);
2052            });
2053            checkWMTE(() -> { // primitive class
2054                $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$.class)).
2055                    invokeExact($value1$);
2056            });
2057            // Incorrect arity
2058            checkWMTE(() -> { // 0
2059                $type$ x = ($type$) hs.get(am, methodType($type$.class)).
2060                    invokeExact();
2061            });
2062            checkWMTE(() -> { // >
2063                $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$.class, Class.class)).
2064                    invokeExact($value1$, Void.class);
2065            });
2066        }
2067#end[Bitwise]
2068    }
2069
2070
2071    static void testArrayWrongMethodType(VarHandle vh) throws Throwable {
2072        $type$[] array = new $type$[10];
2073        Arrays.fill(array, $value1$);
2074
2075        // Get
2076        // Incorrect argument types
2077        checkNPE(() -> { // null array
2078            $type$ x = ($type$) vh.get(null, 0);
2079        });
2080        checkCCE(() -> { // array reference class
2081            $type$ x = ($type$) vh.get(Void.class, 0);
2082        });
2083        checkWMTE(() -> { // array primitive class
2084            $type$ x = ($type$) vh.get(0, 0);
2085        });
2086        checkWMTE(() -> { // index reference class
2087            $type$ x = ($type$) vh.get(array, Void.class);
2088        });
2089        // Incorrect return type
2090        check{#if[String]?CCE:WMTE}(() -> { // reference class
2091            Void x = (Void) vh.get(array, 0);
2092        });
2093        checkWMTE(() -> { // primitive class
2094            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.get(array, 0);
2095        });
2096        // Incorrect arity
2097        checkWMTE(() -> { // 0
2098            $type$ x = ($type$) vh.get();
2099        });
2100        checkWMTE(() -> { // >
2101            $type$ x = ($type$) vh.get(array, 0, Void.class);
2102        });
2103
2104
2105        // Set
2106        // Incorrect argument types
2107        checkNPE(() -> { // null array
2108            vh.set(null, 0, $value1$);
2109        });
2110        checkCCE(() -> { // array reference class
2111            vh.set(Void.class, 0, $value1$);
2112        });
2113        check{#if[String]?CCE:WMTE}(() -> { // value reference class
2114            vh.set(array, 0, Void.class);
2115        });
2116        checkWMTE(() -> { // receiver primitive class
2117            vh.set(0, 0, $value1$);
2118        });
2119        checkWMTE(() -> { // index reference class
2120            vh.set(array, Void.class, $value1$);
2121        });
2122        // Incorrect arity
2123        checkWMTE(() -> { // 0
2124            vh.set();
2125        });
2126        checkWMTE(() -> { // >
2127            vh.set(array, 0, $value1$, Void.class);
2128        });
2129
2130
2131        // GetVolatile
2132        // Incorrect argument types
2133        checkNPE(() -> { // null array
2134            $type$ x = ($type$) vh.getVolatile(null, 0);
2135        });
2136        checkCCE(() -> { // array reference class
2137            $type$ x = ($type$) vh.getVolatile(Void.class, 0);
2138        });
2139        checkWMTE(() -> { // array primitive class
2140            $type$ x = ($type$) vh.getVolatile(0, 0);
2141        });
2142        checkWMTE(() -> { // index reference class
2143            $type$ x = ($type$) vh.getVolatile(array, Void.class);
2144        });
2145        // Incorrect return type
2146        check{#if[String]?CCE:WMTE}(() -> { // reference class
2147            Void x = (Void) vh.getVolatile(array, 0);
2148        });
2149        checkWMTE(() -> { // primitive class
2150            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getVolatile(array, 0);
2151        });
2152        // Incorrect arity
2153        checkWMTE(() -> { // 0
2154            $type$ x = ($type$) vh.getVolatile();
2155        });
2156        checkWMTE(() -> { // >
2157            $type$ x = ($type$) vh.getVolatile(array, 0, Void.class);
2158        });
2159
2160
2161        // SetVolatile
2162        // Incorrect argument types
2163        checkNPE(() -> { // null array
2164            vh.setVolatile(null, 0, $value1$);
2165        });
2166        checkCCE(() -> { // array reference class
2167            vh.setVolatile(Void.class, 0, $value1$);
2168        });
2169        check{#if[String]?CCE:WMTE}(() -> { // value reference class
2170            vh.setVolatile(array, 0, Void.class);
2171        });
2172        checkWMTE(() -> { // receiver primitive class
2173            vh.setVolatile(0, 0, $value1$);
2174        });
2175        checkWMTE(() -> { // index reference class
2176            vh.setVolatile(array, Void.class, $value1$);
2177        });
2178        // Incorrect arity
2179        checkWMTE(() -> { // 0
2180            vh.setVolatile();
2181        });
2182        checkWMTE(() -> { // >
2183            vh.setVolatile(array, 0, $value1$, Void.class);
2184        });
2185
2186
2187        // GetOpaque
2188        // Incorrect argument types
2189        checkNPE(() -> { // null array
2190            $type$ x = ($type$) vh.getOpaque(null, 0);
2191        });
2192        checkCCE(() -> { // array reference class
2193            $type$ x = ($type$) vh.getOpaque(Void.class, 0);
2194        });
2195        checkWMTE(() -> { // array primitive class
2196            $type$ x = ($type$) vh.getOpaque(0, 0);
2197        });
2198        checkWMTE(() -> { // index reference class
2199            $type$ x = ($type$) vh.getOpaque(array, Void.class);
2200        });
2201        // Incorrect return type
2202        check{#if[String]?CCE:WMTE}(() -> { // reference class
2203            Void x = (Void) vh.getOpaque(array, 0);
2204        });
2205        checkWMTE(() -> { // primitive class
2206            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getOpaque(array, 0);
2207        });
2208        // Incorrect arity
2209        checkWMTE(() -> { // 0
2210            $type$ x = ($type$) vh.getOpaque();
2211        });
2212        checkWMTE(() -> { // >
2213            $type$ x = ($type$) vh.getOpaque(array, 0, Void.class);
2214        });
2215
2216
2217        // SetOpaque
2218        // Incorrect argument types
2219        checkNPE(() -> { // null array
2220            vh.setOpaque(null, 0, $value1$);
2221        });
2222        checkCCE(() -> { // array reference class
2223            vh.setOpaque(Void.class, 0, $value1$);
2224        });
2225        check{#if[String]?CCE:WMTE}(() -> { // value reference class
2226            vh.setOpaque(array, 0, Void.class);
2227        });
2228        checkWMTE(() -> { // receiver primitive class
2229            vh.setOpaque(0, 0, $value1$);
2230        });
2231        checkWMTE(() -> { // index reference class
2232            vh.setOpaque(array, Void.class, $value1$);
2233        });
2234        // Incorrect arity
2235        checkWMTE(() -> { // 0
2236            vh.setOpaque();
2237        });
2238        checkWMTE(() -> { // >
2239            vh.setOpaque(array, 0, $value1$, Void.class);
2240        });
2241
2242
2243        // GetAcquire
2244        // Incorrect argument types
2245        checkNPE(() -> { // null array
2246            $type$ x = ($type$) vh.getAcquire(null, 0);
2247        });
2248        checkCCE(() -> { // array reference class
2249            $type$ x = ($type$) vh.getAcquire(Void.class, 0);
2250        });
2251        checkWMTE(() -> { // array primitive class
2252            $type$ x = ($type$) vh.getAcquire(0, 0);
2253        });
2254        checkWMTE(() -> { // index reference class
2255            $type$ x = ($type$) vh.getAcquire(array, Void.class);
2256        });
2257        // Incorrect return type
2258        check{#if[String]?CCE:WMTE}(() -> { // reference class
2259            Void x = (Void) vh.getAcquire(array, 0);
2260        });
2261        checkWMTE(() -> { // primitive class
2262            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAcquire(array, 0);
2263        });
2264        // Incorrect arity
2265        checkWMTE(() -> { // 0
2266            $type$ x = ($type$) vh.getAcquire();
2267        });
2268        checkWMTE(() -> { // >
2269            $type$ x = ($type$) vh.getAcquire(array, 0, Void.class);
2270        });
2271
2272
2273        // SetRelease
2274        // Incorrect argument types
2275        checkNPE(() -> { // null array
2276            vh.setRelease(null, 0, $value1$);
2277        });
2278        checkCCE(() -> { // array reference class
2279            vh.setRelease(Void.class, 0, $value1$);
2280        });
2281        check{#if[String]?CCE:WMTE}(() -> { // value reference class
2282            vh.setRelease(array, 0, Void.class);
2283        });
2284        checkWMTE(() -> { // receiver primitive class
2285            vh.setRelease(0, 0, $value1$);
2286        });
2287        checkWMTE(() -> { // index reference class
2288            vh.setRelease(array, Void.class, $value1$);
2289        });
2290        // Incorrect arity
2291        checkWMTE(() -> { // 0
2292            vh.setRelease();
2293        });
2294        checkWMTE(() -> { // >
2295            vh.setRelease(array, 0, $value1$, Void.class);
2296        });
2297
2298
2299#if[CAS]
2300        // CompareAndSet
2301        // Incorrect argument types
2302        checkNPE(() -> { // null receiver
2303            boolean r = vh.compareAndSet(null, 0, $value1$, $value1$);
2304        });
2305        checkCCE(() -> { // receiver reference class
2306            boolean r = vh.compareAndSet(Void.class, 0, $value1$, $value1$);
2307        });
2308        check{#if[String]?CCE:WMTE}(() -> { // expected reference class
2309            boolean r = vh.compareAndSet(array, 0, Void.class, $value1$);
2310        });
2311        check{#if[String]?CCE:WMTE}(() -> { // actual reference class
2312            boolean r = vh.compareAndSet(array, 0, $value1$, Void.class);
2313        });
2314        checkWMTE(() -> { // receiver primitive class
2315            boolean r = vh.compareAndSet(0, 0, $value1$, $value1$);
2316        });
2317        checkWMTE(() -> { // index reference class
2318            boolean r = vh.compareAndSet(array, Void.class, $value1$, $value1$);
2319        });
2320        // Incorrect arity
2321        checkWMTE(() -> { // 0
2322            boolean r = vh.compareAndSet();
2323        });
2324        checkWMTE(() -> { // >
2325            boolean r = vh.compareAndSet(array, 0, $value1$, $value1$, Void.class);
2326        });
2327
2328
2329        // WeakCompareAndSet
2330        // Incorrect argument types
2331        checkNPE(() -> { // null receiver
2332            boolean r = vh.weakCompareAndSet(null, 0, $value1$, $value1$);
2333        });
2334        checkCCE(() -> { // receiver reference class
2335            boolean r = vh.weakCompareAndSet(Void.class, 0, $value1$, $value1$);
2336        });
2337        check{#if[String]?CCE:WMTE}(() -> { // expected reference class
2338            boolean r = vh.weakCompareAndSet(array, 0, Void.class, $value1$);
2339        });
2340        check{#if[String]?CCE:WMTE}(() -> { // actual reference class
2341            boolean r = vh.weakCompareAndSet(array, 0, $value1$, Void.class);
2342        });
2343        checkWMTE(() -> { // receiver primitive class
2344            boolean r = vh.weakCompareAndSet(0, 0, $value1$, $value1$);
2345        });
2346        checkWMTE(() -> { // index reference class
2347            boolean r = vh.weakCompareAndSet(array, Void.class, $value1$, $value1$);
2348        });
2349        // Incorrect arity
2350        checkWMTE(() -> { // 0
2351            boolean r = vh.weakCompareAndSet();
2352        });
2353        checkWMTE(() -> { // >
2354            boolean r = vh.weakCompareAndSet(array, 0, $value1$, $value1$, Void.class);
2355        });
2356
2357
2358        // WeakCompareAndSetVolatile
2359        // Incorrect argument types
2360        checkNPE(() -> { // null receiver
2361            boolean r = vh.weakCompareAndSetVolatile(null, 0, $value1$, $value1$);
2362        });
2363        checkCCE(() -> { // receiver reference class
2364            boolean r = vh.weakCompareAndSetVolatile(Void.class, 0, $value1$, $value1$);
2365        });
2366        check{#if[String]?CCE:WMTE}(() -> { // expected reference class
2367            boolean r = vh.weakCompareAndSetVolatile(array, 0, Void.class, $value1$);
2368        });
2369        check{#if[String]?CCE:WMTE}(() -> { // actual reference class
2370            boolean r = vh.weakCompareAndSetVolatile(array, 0, $value1$, Void.class);
2371        });
2372        checkWMTE(() -> { // receiver primitive class
2373            boolean r = vh.weakCompareAndSetVolatile(0, 0, $value1$, $value1$);
2374        });
2375        checkWMTE(() -> { // index reference class
2376            boolean r = vh.weakCompareAndSetVolatile(array, Void.class, $value1$, $value1$);
2377        });
2378        // Incorrect arity
2379        checkWMTE(() -> { // 0
2380            boolean r = vh.weakCompareAndSetVolatile();
2381        });
2382        checkWMTE(() -> { // >
2383            boolean r = vh.weakCompareAndSetVolatile(array, 0, $value1$, $value1$, Void.class);
2384        });
2385
2386
2387        // WeakCompareAndSetAcquire
2388        // Incorrect argument types
2389        checkNPE(() -> { // null receiver
2390            boolean r = vh.weakCompareAndSetAcquire(null, 0, $value1$, $value1$);
2391        });
2392        checkCCE(() -> { // receiver reference class
2393            boolean r = vh.weakCompareAndSetAcquire(Void.class, 0, $value1$, $value1$);
2394        });
2395        check{#if[String]?CCE:WMTE}(() -> { // expected reference class
2396            boolean r = vh.weakCompareAndSetAcquire(array, 0, Void.class, $value1$);
2397        });
2398        check{#if[String]?CCE:WMTE}(() -> { // actual reference class
2399            boolean r = vh.weakCompareAndSetAcquire(array, 0, $value1$, Void.class);
2400        });
2401        checkWMTE(() -> { // receiver primitive class
2402            boolean r = vh.weakCompareAndSetAcquire(0, 0, $value1$, $value1$);
2403        });
2404        checkWMTE(() -> { // index reference class
2405            boolean r = vh.weakCompareAndSetAcquire(array, Void.class, $value1$, $value1$);
2406        });
2407        // Incorrect arity
2408        checkWMTE(() -> { // 0
2409            boolean r = vh.weakCompareAndSetAcquire();
2410        });
2411        checkWMTE(() -> { // >
2412            boolean r = vh.weakCompareAndSetAcquire(array, 0, $value1$, $value1$, Void.class);
2413        });
2414
2415
2416        // WeakCompareAndSetRelease
2417        // Incorrect argument types
2418        checkNPE(() -> { // null receiver
2419            boolean r = vh.weakCompareAndSetRelease(null, 0, $value1$, $value1$);
2420        });
2421        checkCCE(() -> { // receiver reference class
2422            boolean r = vh.weakCompareAndSetRelease(Void.class, 0, $value1$, $value1$);
2423        });
2424        check{#if[String]?CCE:WMTE}(() -> { // expected reference class
2425            boolean r = vh.weakCompareAndSetRelease(array, 0, Void.class, $value1$);
2426        });
2427        check{#if[String]?CCE:WMTE}(() -> { // actual reference class
2428            boolean r = vh.weakCompareAndSetRelease(array, 0, $value1$, Void.class);
2429        });
2430        checkWMTE(() -> { // receiver primitive class
2431            boolean r = vh.weakCompareAndSetRelease(0, 0, $value1$, $value1$);
2432        });
2433        checkWMTE(() -> { // index reference class
2434            boolean r = vh.weakCompareAndSetRelease(array, Void.class, $value1$, $value1$);
2435        });
2436        // Incorrect arity
2437        checkWMTE(() -> { // 0
2438            boolean r = vh.weakCompareAndSetRelease();
2439        });
2440        checkWMTE(() -> { // >
2441            boolean r = vh.weakCompareAndSetRelease(array, 0, $value1$, $value1$, Void.class);
2442        });
2443
2444
2445        // CompareAndExchange
2446        // Incorrect argument types
2447        checkNPE(() -> { // null receiver
2448            $type$ x = ($type$) vh.compareAndExchange(null, 0, $value1$, $value1$);
2449        });
2450        checkCCE(() -> { // array reference class
2451            $type$ x = ($type$) vh.compareAndExchange(Void.class, 0, $value1$, $value1$);
2452        });
2453        check{#if[String]?CCE:WMTE}(() -> { // expected reference class
2454            $type$ x = ($type$) vh.compareAndExchange(array, 0, Void.class, $value1$);
2455        });
2456        check{#if[String]?CCE:WMTE}(() -> { // actual reference class
2457            $type$ x = ($type$) vh.compareAndExchange(array, 0, $value1$, Void.class);
2458        });
2459        checkWMTE(() -> { // array primitive class
2460            $type$ x = ($type$) vh.compareAndExchange(0, 0, $value1$, $value1$);
2461        });
2462        checkWMTE(() -> { // index reference class
2463            $type$ x = ($type$) vh.compareAndExchange(array, Void.class, $value1$, $value1$);
2464        });
2465        // Incorrect return type
2466        check{#if[String]?CCE:WMTE}(() -> { // reference class
2467            Void r = (Void) vh.compareAndExchange(array, 0, $value1$, $value1$);
2468        });
2469        checkWMTE(() -> { // primitive class
2470            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.compareAndExchange(array, 0, $value1$, $value1$);
2471        });
2472        // Incorrect arity
2473        checkWMTE(() -> { // 0
2474            $type$ x = ($type$) vh.compareAndExchange();
2475        });
2476        checkWMTE(() -> { // >
2477            $type$ x = ($type$) vh.compareAndExchange(array, 0, $value1$, $value1$, Void.class);
2478        });
2479
2480
2481        // CompareAndExchangeAcquire
2482        // Incorrect argument types
2483        checkNPE(() -> { // null receiver
2484            $type$ x = ($type$) vh.compareAndExchangeAcquire(null, 0, $value1$, $value1$);
2485        });
2486        checkCCE(() -> { // array reference class
2487            $type$ x = ($type$) vh.compareAndExchangeAcquire(Void.class, 0, $value1$, $value1$);
2488        });
2489        check{#if[String]?CCE:WMTE}(() -> { // expected reference class
2490            $type$ x = ($type$) vh.compareAndExchangeAcquire(array, 0, Void.class, $value1$);
2491        });
2492        check{#if[String]?CCE:WMTE}(() -> { // actual reference class
2493            $type$ x = ($type$) vh.compareAndExchangeAcquire(array, 0, $value1$, Void.class);
2494        });
2495        checkWMTE(() -> { // array primitive class
2496            $type$ x = ($type$) vh.compareAndExchangeAcquire(0, 0, $value1$, $value1$);
2497        });
2498        checkWMTE(() -> { // index reference class
2499            $type$ x = ($type$) vh.compareAndExchangeAcquire(array, Void.class, $value1$, $value1$);
2500        });
2501        // Incorrect return type
2502        check{#if[String]?CCE:WMTE}(() -> { // reference class
2503            Void r = (Void) vh.compareAndExchangeAcquire(array, 0, $value1$, $value1$);
2504        });
2505        checkWMTE(() -> { // primitive class
2506            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.compareAndExchangeAcquire(array, 0, $value1$, $value1$);
2507        });
2508        // Incorrect arity
2509        checkWMTE(() -> { // 0
2510            $type$ x = ($type$) vh.compareAndExchangeAcquire();
2511        });
2512        checkWMTE(() -> { // >
2513            $type$ x = ($type$) vh.compareAndExchangeAcquire(array, 0, $value1$, $value1$, Void.class);
2514        });
2515
2516
2517        // CompareAndExchangeRelease
2518        // Incorrect argument types
2519        checkNPE(() -> { // null receiver
2520            $type$ x = ($type$) vh.compareAndExchangeRelease(null, 0, $value1$, $value1$);
2521        });
2522        checkCCE(() -> { // array reference class
2523            $type$ x = ($type$) vh.compareAndExchangeRelease(Void.class, 0, $value1$, $value1$);
2524        });
2525        check{#if[String]?CCE:WMTE}(() -> { // expected reference class
2526            $type$ x = ($type$) vh.compareAndExchangeRelease(array, 0, Void.class, $value1$);
2527        });
2528        check{#if[String]?CCE:WMTE}(() -> { // actual reference class
2529            $type$ x = ($type$) vh.compareAndExchangeRelease(array, 0, $value1$, Void.class);
2530        });
2531        checkWMTE(() -> { // array primitive class
2532            $type$ x = ($type$) vh.compareAndExchangeRelease(0, 0, $value1$, $value1$);
2533        });
2534        checkWMTE(() -> { // index reference class
2535            $type$ x = ($type$) vh.compareAndExchangeRelease(array, Void.class, $value1$, $value1$);
2536        });
2537        // Incorrect return type
2538        check{#if[String]?CCE:WMTE}(() -> { // reference class
2539            Void r = (Void) vh.compareAndExchangeRelease(array, 0, $value1$, $value1$);
2540        });
2541        checkWMTE(() -> { // primitive class
2542            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.compareAndExchangeRelease(array, 0, $value1$, $value1$);
2543        });
2544        // Incorrect arity
2545        checkWMTE(() -> { // 0
2546            $type$ x = ($type$) vh.compareAndExchangeRelease();
2547        });
2548        checkWMTE(() -> { // >
2549            $type$ x = ($type$) vh.compareAndExchangeRelease(array, 0, $value1$, $value1$, Void.class);
2550        });
2551
2552
2553        // GetAndSet
2554        // Incorrect argument types
2555        checkNPE(() -> { // null array
2556            $type$ x = ($type$) vh.getAndSet(null, 0, $value1$);
2557        });
2558        checkCCE(() -> { // array reference class
2559            $type$ x = ($type$) vh.getAndSet(Void.class, 0, $value1$);
2560        });
2561        check{#if[String]?CCE:WMTE}(() -> { // value reference class
2562            $type$ x = ($type$) vh.getAndSet(array, 0, Void.class);
2563        });
2564        checkWMTE(() -> { // reciarrayever primitive class
2565            $type$ x = ($type$) vh.getAndSet(0, 0, $value1$);
2566        });
2567        checkWMTE(() -> { // index reference class
2568            $type$ x = ($type$) vh.getAndSet(array, Void.class, $value1$);
2569        });
2570        // Incorrect return type
2571        check{#if[String]?CCE:WMTE}(() -> { // reference class
2572            Void r = (Void) vh.getAndSet(array, 0, $value1$);
2573        });
2574        checkWMTE(() -> { // primitive class
2575            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndSet(array, 0, $value1$);
2576        });
2577        // Incorrect arity
2578        checkWMTE(() -> { // 0
2579            $type$ x = ($type$) vh.getAndSet();
2580        });
2581        checkWMTE(() -> { // >
2582            $type$ x = ($type$) vh.getAndSet(array, 0, $value1$, Void.class);
2583        });
2584
2585
2586        // GetAndSetAcquire
2587        // Incorrect argument types
2588        checkNPE(() -> { // null array
2589            $type$ x = ($type$) vh.getAndSetAcquire(null, 0, $value1$);
2590        });
2591        checkCCE(() -> { // array reference class
2592            $type$ x = ($type$) vh.getAndSetAcquire(Void.class, 0, $value1$);
2593        });
2594        check{#if[String]?CCE:WMTE}(() -> { // value reference class
2595            $type$ x = ($type$) vh.getAndSetAcquire(array, 0, Void.class);
2596        });
2597        checkWMTE(() -> { // reciarrayever primitive class
2598            $type$ x = ($type$) vh.getAndSetAcquire(0, 0, $value1$);
2599        });
2600        checkWMTE(() -> { // index reference class
2601            $type$ x = ($type$) vh.getAndSetAcquire(array, Void.class, $value1$);
2602        });
2603        // Incorrect return type
2604        check{#if[String]?CCE:WMTE}(() -> { // reference class
2605            Void r = (Void) vh.getAndSetAcquire(array, 0, $value1$);
2606        });
2607        checkWMTE(() -> { // primitive class
2608            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndSetAcquire(array, 0, $value1$);
2609        });
2610        // Incorrect arity
2611        checkWMTE(() -> { // 0
2612            $type$ x = ($type$) vh.getAndSetAcquire();
2613        });
2614        checkWMTE(() -> { // >
2615            $type$ x = ($type$) vh.getAndSetAcquire(array, 0, $value1$, Void.class);
2616        });
2617
2618
2619        // GetAndSetRelease
2620        // Incorrect argument types
2621        checkNPE(() -> { // null array
2622            $type$ x = ($type$) vh.getAndSetRelease(null, 0, $value1$);
2623        });
2624        checkCCE(() -> { // array reference class
2625            $type$ x = ($type$) vh.getAndSetRelease(Void.class, 0, $value1$);
2626        });
2627        check{#if[String]?CCE:WMTE}(() -> { // value reference class
2628            $type$ x = ($type$) vh.getAndSetRelease(array, 0, Void.class);
2629        });
2630        checkWMTE(() -> { // reciarrayever primitive class
2631            $type$ x = ($type$) vh.getAndSetRelease(0, 0, $value1$);
2632        });
2633        checkWMTE(() -> { // index reference class
2634            $type$ x = ($type$) vh.getAndSetRelease(array, Void.class, $value1$);
2635        });
2636        // Incorrect return type
2637        check{#if[String]?CCE:WMTE}(() -> { // reference class
2638            Void r = (Void) vh.getAndSetRelease(array, 0, $value1$);
2639        });
2640        checkWMTE(() -> { // primitive class
2641            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndSetRelease(array, 0, $value1$);
2642        });
2643        // Incorrect arity
2644        checkWMTE(() -> { // 0
2645            $type$ x = ($type$) vh.getAndSetRelease();
2646        });
2647        checkWMTE(() -> { // >
2648            $type$ x = ($type$) vh.getAndSetRelease(array, 0, $value1$, Void.class);
2649        });
2650#end[CAS]
2651
2652#if[AtomicAdd]
2653        // GetAndAdd
2654        // Incorrect argument types
2655        checkNPE(() -> { // null array
2656            $type$ x = ($type$) vh.getAndAdd(null, 0, $value1$);
2657        });
2658        checkCCE(() -> { // array reference class
2659            $type$ x = ($type$) vh.getAndAdd(Void.class, 0, $value1$);
2660        });
2661        check{#if[String]?CCE:WMTE}(() -> { // value reference class
2662            $type$ x = ($type$) vh.getAndAdd(array, 0, Void.class);
2663        });
2664        checkWMTE(() -> { // array primitive class
2665            $type$ x = ($type$) vh.getAndAdd(0, 0, $value1$);
2666        });
2667        checkWMTE(() -> { // index reference class
2668            $type$ x = ($type$) vh.getAndAdd(array, Void.class, $value1$);
2669        });
2670        // Incorrect return type
2671        check{#if[String]?CCE:WMTE}(() -> { // reference class
2672            Void r = (Void) vh.getAndAdd(array, 0, $value1$);
2673        });
2674        checkWMTE(() -> { // primitive class
2675            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndAdd(array, 0, $value1$);
2676        });
2677        // Incorrect arity
2678        checkWMTE(() -> { // 0
2679            $type$ x = ($type$) vh.getAndAdd();
2680        });
2681        checkWMTE(() -> { // >
2682            $type$ x = ($type$) vh.getAndAdd(array, 0, $value1$, Void.class);
2683        });
2684
2685
2686        // GetAndAddAcquire
2687        // Incorrect argument types
2688        checkNPE(() -> { // null array
2689            $type$ x = ($type$) vh.getAndAddAcquire(null, 0, $value1$);
2690        });
2691        checkCCE(() -> { // array reference class
2692            $type$ x = ($type$) vh.getAndAddAcquire(Void.class, 0, $value1$);
2693        });
2694        check{#if[String]?CCE:WMTE}(() -> { // value reference class
2695            $type$ x = ($type$) vh.getAndAddAcquire(array, 0, Void.class);
2696        });
2697        checkWMTE(() -> { // array primitive class
2698            $type$ x = ($type$) vh.getAndAddAcquire(0, 0, $value1$);
2699        });
2700        checkWMTE(() -> { // index reference class
2701            $type$ x = ($type$) vh.getAndAddAcquire(array, Void.class, $value1$);
2702        });
2703        // Incorrect return type
2704        check{#if[String]?CCE:WMTE}(() -> { // reference class
2705            Void r = (Void) vh.getAndAddAcquire(array, 0, $value1$);
2706        });
2707        checkWMTE(() -> { // primitive class
2708            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndAddAcquire(array, 0, $value1$);
2709        });
2710        // Incorrect arity
2711        checkWMTE(() -> { // 0
2712            $type$ x = ($type$) vh.getAndAddAcquire();
2713        });
2714        checkWMTE(() -> { // >
2715            $type$ x = ($type$) vh.getAndAddAcquire(array, 0, $value1$, Void.class);
2716        });
2717
2718
2719        // GetAndAddRelease
2720        // Incorrect argument types
2721        checkNPE(() -> { // null array
2722            $type$ x = ($type$) vh.getAndAddRelease(null, 0, $value1$);
2723        });
2724        checkCCE(() -> { // array reference class
2725            $type$ x = ($type$) vh.getAndAddRelease(Void.class, 0, $value1$);
2726        });
2727        check{#if[String]?CCE:WMTE}(() -> { // value reference class
2728            $type$ x = ($type$) vh.getAndAddRelease(array, 0, Void.class);
2729        });
2730        checkWMTE(() -> { // array primitive class
2731            $type$ x = ($type$) vh.getAndAddRelease(0, 0, $value1$);
2732        });
2733        checkWMTE(() -> { // index reference class
2734            $type$ x = ($type$) vh.getAndAddRelease(array, Void.class, $value1$);
2735        });
2736        // Incorrect return type
2737        check{#if[String]?CCE:WMTE}(() -> { // reference class
2738            Void r = (Void) vh.getAndAddRelease(array, 0, $value1$);
2739        });
2740        checkWMTE(() -> { // primitive class
2741            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndAddRelease(array, 0, $value1$);
2742        });
2743        // Incorrect arity
2744        checkWMTE(() -> { // 0
2745            $type$ x = ($type$) vh.getAndAddRelease();
2746        });
2747        checkWMTE(() -> { // >
2748            $type$ x = ($type$) vh.getAndAddRelease(array, 0, $value1$, Void.class);
2749        });
2750
2751
2752        // AddAndGet
2753        // Incorrect argument types
2754        checkNPE(() -> { // null array
2755            $type$ x = ($type$) vh.addAndGet(null, 0, $value1$);
2756        });
2757        checkCCE(() -> { // array reference class
2758            $type$ x = ($type$) vh.addAndGet(Void.class, 0, $value1$);
2759        });
2760        check{#if[String]?CCE:WMTE}(() -> { // value reference class
2761            $type$ x = ($type$) vh.addAndGet(array, 0, Void.class);
2762        });
2763        checkWMTE(() -> { // array primitive class
2764            $type$ x = ($type$) vh.addAndGet(0, 0, $value1$);
2765        });
2766        checkWMTE(() -> { // index reference class
2767            $type$ x = ($type$) vh.addAndGet(array, Void.class, $value1$);
2768        });
2769        // Incorrect return type
2770        check{#if[String]?CCE:WMTE}(() -> { // reference class
2771            Void r = (Void) vh.addAndGet(array, 0, $value1$);
2772        });
2773        checkWMTE(() -> { // primitive class
2774            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.addAndGet(array, 0, $value1$);
2775        });
2776        // Incorrect arity
2777        checkWMTE(() -> { // 0
2778            $type$ x = ($type$) vh.addAndGet();
2779        });
2780        checkWMTE(() -> { // >
2781            $type$ x = ($type$) vh.addAndGet(array, 0, $value1$, Void.class);
2782        });
2783#end[AtomicAdd]
2784
2785#if[Bitwise]
2786        // GetAndBitwiseOr
2787        // Incorrect argument types
2788        checkNPE(() -> { // null array
2789            $type$ x = ($type$) vh.getAndBitwiseOr(null, 0, $value1$);
2790        });
2791        checkCCE(() -> { // array reference class
2792            $type$ x = ($type$) vh.getAndBitwiseOr(Void.class, 0, $value1$);
2793        });
2794        check{#if[String]?CCE:WMTE}(() -> { // value reference class
2795            $type$ x = ($type$) vh.getAndBitwiseOr(array, 0, Void.class);
2796        });
2797        checkWMTE(() -> { // array primitive class
2798            $type$ x = ($type$) vh.getAndBitwiseOr(0, 0, $value1$);
2799        });
2800        checkWMTE(() -> { // index reference class
2801            $type$ x = ($type$) vh.getAndBitwiseOr(array, Void.class, $value1$);
2802        });
2803        // Incorrect return type
2804        check{#if[String]?CCE:WMTE}(() -> { // reference class
2805            Void r = (Void) vh.getAndBitwiseOr(array, 0, $value1$);
2806        });
2807        checkWMTE(() -> { // primitive class
2808            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOr(array, 0, $value1$);
2809        });
2810        // Incorrect arity
2811        checkWMTE(() -> { // 0
2812            $type$ x = ($type$) vh.getAndBitwiseOr();
2813        });
2814        checkWMTE(() -> { // >
2815            $type$ x = ($type$) vh.getAndBitwiseOr(array, 0, $value1$, Void.class);
2816        });
2817
2818
2819        // GetAndBitwiseOrAcquire
2820        // Incorrect argument types
2821        checkNPE(() -> { // null array
2822            $type$ x = ($type$) vh.getAndBitwiseOrAcquire(null, 0, $value1$);
2823        });
2824        checkCCE(() -> { // array reference class
2825            $type$ x = ($type$) vh.getAndBitwiseOrAcquire(Void.class, 0, $value1$);
2826        });
2827        check{#if[String]?CCE:WMTE}(() -> { // value reference class
2828            $type$ x = ($type$) vh.getAndBitwiseOrAcquire(array, 0, Void.class);
2829        });
2830        checkWMTE(() -> { // array primitive class
2831            $type$ x = ($type$) vh.getAndBitwiseOrAcquire(0, 0, $value1$);
2832        });
2833        checkWMTE(() -> { // index reference class
2834            $type$ x = ($type$) vh.getAndBitwiseOrAcquire(array, Void.class, $value1$);
2835        });
2836        // Incorrect return type
2837        check{#if[String]?CCE:WMTE}(() -> { // reference class
2838            Void r = (Void) vh.getAndBitwiseOrAcquire(array, 0, $value1$);
2839        });
2840        checkWMTE(() -> { // primitive class
2841            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOrAcquire(array, 0, $value1$);
2842        });
2843        // Incorrect arity
2844        checkWMTE(() -> { // 0
2845            $type$ x = ($type$) vh.getAndBitwiseOrAcquire();
2846        });
2847        checkWMTE(() -> { // >
2848            $type$ x = ($type$) vh.getAndBitwiseOrAcquire(array, 0, $value1$, Void.class);
2849        });
2850
2851
2852        // GetAndBitwiseOrRelease
2853        // Incorrect argument types
2854        checkNPE(() -> { // null array
2855            $type$ x = ($type$) vh.getAndBitwiseOrRelease(null, 0, $value1$);
2856        });
2857        checkCCE(() -> { // array reference class
2858            $type$ x = ($type$) vh.getAndBitwiseOrRelease(Void.class, 0, $value1$);
2859        });
2860        check{#if[String]?CCE:WMTE}(() -> { // value reference class
2861            $type$ x = ($type$) vh.getAndBitwiseOrRelease(array, 0, Void.class);
2862        });
2863        checkWMTE(() -> { // array primitive class
2864            $type$ x = ($type$) vh.getAndBitwiseOrRelease(0, 0, $value1$);
2865        });
2866        checkWMTE(() -> { // index reference class
2867            $type$ x = ($type$) vh.getAndBitwiseOrRelease(array, Void.class, $value1$);
2868        });
2869        // Incorrect return type
2870        check{#if[String]?CCE:WMTE}(() -> { // reference class
2871            Void r = (Void) vh.getAndBitwiseOrRelease(array, 0, $value1$);
2872        });
2873        checkWMTE(() -> { // primitive class
2874            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOrRelease(array, 0, $value1$);
2875        });
2876        // Incorrect arity
2877        checkWMTE(() -> { // 0
2878            $type$ x = ($type$) vh.getAndBitwiseOrRelease();
2879        });
2880        checkWMTE(() -> { // >
2881            $type$ x = ($type$) vh.getAndBitwiseOrRelease(array, 0, $value1$, Void.class);
2882        });
2883
2884
2885        // GetAndBitwiseAnd
2886        // Incorrect argument types
2887        checkNPE(() -> { // null array
2888            $type$ x = ($type$) vh.getAndBitwiseAnd(null, 0, $value1$);
2889        });
2890        checkCCE(() -> { // array reference class
2891            $type$ x = ($type$) vh.getAndBitwiseAnd(Void.class, 0, $value1$);
2892        });
2893        check{#if[String]?CCE:WMTE}(() -> { // value reference class
2894            $type$ x = ($type$) vh.getAndBitwiseAnd(array, 0, Void.class);
2895        });
2896        checkWMTE(() -> { // array primitive class
2897            $type$ x = ($type$) vh.getAndBitwiseAnd(0, 0, $value1$);
2898        });
2899        checkWMTE(() -> { // index reference class
2900            $type$ x = ($type$) vh.getAndBitwiseAnd(array, Void.class, $value1$);
2901        });
2902        // Incorrect return type
2903        check{#if[String]?CCE:WMTE}(() -> { // reference class
2904            Void r = (Void) vh.getAndBitwiseAnd(array, 0, $value1$);
2905        });
2906        checkWMTE(() -> { // primitive class
2907            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAnd(array, 0, $value1$);
2908        });
2909        // Incorrect arity
2910        checkWMTE(() -> { // 0
2911            $type$ x = ($type$) vh.getAndBitwiseAnd();
2912        });
2913        checkWMTE(() -> { // >
2914            $type$ x = ($type$) vh.getAndBitwiseAnd(array, 0, $value1$, Void.class);
2915        });
2916
2917
2918        // GetAndBitwiseAndAcquire
2919        // Incorrect argument types
2920        checkNPE(() -> { // null array
2921            $type$ x = ($type$) vh.getAndBitwiseAndAcquire(null, 0, $value1$);
2922        });
2923        checkCCE(() -> { // array reference class
2924            $type$ x = ($type$) vh.getAndBitwiseAndAcquire(Void.class, 0, $value1$);
2925        });
2926        check{#if[String]?CCE:WMTE}(() -> { // value reference class
2927            $type$ x = ($type$) vh.getAndBitwiseAndAcquire(array, 0, Void.class);
2928        });
2929        checkWMTE(() -> { // array primitive class
2930            $type$ x = ($type$) vh.getAndBitwiseAndAcquire(0, 0, $value1$);
2931        });
2932        checkWMTE(() -> { // index reference class
2933            $type$ x = ($type$) vh.getAndBitwiseAndAcquire(array, Void.class, $value1$);
2934        });
2935        // Incorrect return type
2936        check{#if[String]?CCE:WMTE}(() -> { // reference class
2937            Void r = (Void) vh.getAndBitwiseAndAcquire(array, 0, $value1$);
2938        });
2939        checkWMTE(() -> { // primitive class
2940            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAndAcquire(array, 0, $value1$);
2941        });
2942        // Incorrect arity
2943        checkWMTE(() -> { // 0
2944            $type$ x = ($type$) vh.getAndBitwiseAndAcquire();
2945        });
2946        checkWMTE(() -> { // >
2947            $type$ x = ($type$) vh.getAndBitwiseAndAcquire(array, 0, $value1$, Void.class);
2948        });
2949
2950
2951        // GetAndBitwiseAndRelease
2952        // Incorrect argument types
2953        checkNPE(() -> { // null array
2954            $type$ x = ($type$) vh.getAndBitwiseAndRelease(null, 0, $value1$);
2955        });
2956        checkCCE(() -> { // array reference class
2957            $type$ x = ($type$) vh.getAndBitwiseAndRelease(Void.class, 0, $value1$);
2958        });
2959        check{#if[String]?CCE:WMTE}(() -> { // value reference class
2960            $type$ x = ($type$) vh.getAndBitwiseAndRelease(array, 0, Void.class);
2961        });
2962        checkWMTE(() -> { // array primitive class
2963            $type$ x = ($type$) vh.getAndBitwiseAndRelease(0, 0, $value1$);
2964        });
2965        checkWMTE(() -> { // index reference class
2966            $type$ x = ($type$) vh.getAndBitwiseAndRelease(array, Void.class, $value1$);
2967        });
2968        // Incorrect return type
2969        check{#if[String]?CCE:WMTE}(() -> { // reference class
2970            Void r = (Void) vh.getAndBitwiseAndRelease(array, 0, $value1$);
2971        });
2972        checkWMTE(() -> { // primitive class
2973            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAndRelease(array, 0, $value1$);
2974        });
2975        // Incorrect arity
2976        checkWMTE(() -> { // 0
2977            $type$ x = ($type$) vh.getAndBitwiseAndRelease();
2978        });
2979        checkWMTE(() -> { // >
2980            $type$ x = ($type$) vh.getAndBitwiseAndRelease(array, 0, $value1$, Void.class);
2981        });
2982
2983
2984        // GetAndBitwiseXor
2985        // Incorrect argument types
2986        checkNPE(() -> { // null array
2987            $type$ x = ($type$) vh.getAndBitwiseXor(null, 0, $value1$);
2988        });
2989        checkCCE(() -> { // array reference class
2990            $type$ x = ($type$) vh.getAndBitwiseXor(Void.class, 0, $value1$);
2991        });
2992        check{#if[String]?CCE:WMTE}(() -> { // value reference class
2993            $type$ x = ($type$) vh.getAndBitwiseXor(array, 0, Void.class);
2994        });
2995        checkWMTE(() -> { // array primitive class
2996            $type$ x = ($type$) vh.getAndBitwiseXor(0, 0, $value1$);
2997        });
2998        checkWMTE(() -> { // index reference class
2999            $type$ x = ($type$) vh.getAndBitwiseXor(array, Void.class, $value1$);
3000        });
3001        // Incorrect return type
3002        check{#if[String]?CCE:WMTE}(() -> { // reference class
3003            Void r = (Void) vh.getAndBitwiseXor(array, 0, $value1$);
3004        });
3005        checkWMTE(() -> { // primitive class
3006            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXor(array, 0, $value1$);
3007        });
3008        // Incorrect arity
3009        checkWMTE(() -> { // 0
3010            $type$ x = ($type$) vh.getAndBitwiseXor();
3011        });
3012        checkWMTE(() -> { // >
3013            $type$ x = ($type$) vh.getAndBitwiseXor(array, 0, $value1$, Void.class);
3014        });
3015
3016
3017        // GetAndBitwiseXorAcquire
3018        // Incorrect argument types
3019        checkNPE(() -> { // null array
3020            $type$ x = ($type$) vh.getAndBitwiseXorAcquire(null, 0, $value1$);
3021        });
3022        checkCCE(() -> { // array reference class
3023            $type$ x = ($type$) vh.getAndBitwiseXorAcquire(Void.class, 0, $value1$);
3024        });
3025        check{#if[String]?CCE:WMTE}(() -> { // value reference class
3026            $type$ x = ($type$) vh.getAndBitwiseXorAcquire(array, 0, Void.class);
3027        });
3028        checkWMTE(() -> { // array primitive class
3029            $type$ x = ($type$) vh.getAndBitwiseXorAcquire(0, 0, $value1$);
3030        });
3031        checkWMTE(() -> { // index reference class
3032            $type$ x = ($type$) vh.getAndBitwiseXorAcquire(array, Void.class, $value1$);
3033        });
3034        // Incorrect return type
3035        check{#if[String]?CCE:WMTE}(() -> { // reference class
3036            Void r = (Void) vh.getAndBitwiseXorAcquire(array, 0, $value1$);
3037        });
3038        checkWMTE(() -> { // primitive class
3039            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXorAcquire(array, 0, $value1$);
3040        });
3041        // Incorrect arity
3042        checkWMTE(() -> { // 0
3043            $type$ x = ($type$) vh.getAndBitwiseXorAcquire();
3044        });
3045        checkWMTE(() -> { // >
3046            $type$ x = ($type$) vh.getAndBitwiseXorAcquire(array, 0, $value1$, Void.class);
3047        });
3048
3049
3050        // GetAndBitwiseXorRelease
3051        // Incorrect argument types
3052        checkNPE(() -> { // null array
3053            $type$ x = ($type$) vh.getAndBitwiseXorRelease(null, 0, $value1$);
3054        });
3055        checkCCE(() -> { // array reference class
3056            $type$ x = ($type$) vh.getAndBitwiseXorRelease(Void.class, 0, $value1$);
3057        });
3058        check{#if[String]?CCE:WMTE}(() -> { // value reference class
3059            $type$ x = ($type$) vh.getAndBitwiseXorRelease(array, 0, Void.class);
3060        });
3061        checkWMTE(() -> { // array primitive class
3062            $type$ x = ($type$) vh.getAndBitwiseXorRelease(0, 0, $value1$);
3063        });
3064        checkWMTE(() -> { // index reference class
3065            $type$ x = ($type$) vh.getAndBitwiseXorRelease(array, Void.class, $value1$);
3066        });
3067        // Incorrect return type
3068        check{#if[String]?CCE:WMTE}(() -> { // reference class
3069            Void r = (Void) vh.getAndBitwiseXorRelease(array, 0, $value1$);
3070        });
3071        checkWMTE(() -> { // primitive class
3072            $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXorRelease(array, 0, $value1$);
3073        });
3074        // Incorrect arity
3075        checkWMTE(() -> { // 0
3076            $type$ x = ($type$) vh.getAndBitwiseXorRelease();
3077        });
3078        checkWMTE(() -> { // >
3079            $type$ x = ($type$) vh.getAndBitwiseXorRelease(array, 0, $value1$, Void.class);
3080        });
3081#end[Bitwise]
3082    }
3083
3084    static void testArrayWrongMethodType(Handles hs) throws Throwable {
3085        $type$[] array = new $type$[10];
3086        Arrays.fill(array, $value1$);
3087
3088        for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
3089            // Incorrect argument types
3090            checkNPE(() -> { // null array
3091                $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class)).
3092                    invokeExact(($type$[]) null, 0);
3093            });
3094            hs.checkWMTEOrCCE(() -> { // array reference class
3095                $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, int.class)).
3096                    invokeExact(Void.class, 0);
3097            });
3098            checkWMTE(() -> { // array primitive class
3099                $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, int.class)).
3100                    invokeExact(0, 0);
3101            });
3102            checkWMTE(() -> { // index reference class
3103                $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, Class.class)).
3104                    invokeExact(array, Void.class);
3105            });
3106            // Incorrect return type
3107            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
3108                Void x = (Void) hs.get(am, methodType(Void.class, $type$[].class, int.class)).
3109                    invokeExact(array, 0);
3110            });
3111            checkWMTE(() -> { // primitive class
3112                $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$[].class, int.class)).
3113                    invokeExact(array, 0);
3114            });
3115            // Incorrect arity
3116            checkWMTE(() -> { // 0
3117                $type$ x = ($type$) hs.get(am, methodType($type$.class)).
3118                    invokeExact();
3119            });
3120            checkWMTE(() -> { // >
3121                $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, Class.class)).
3122                    invokeExact(array, 0, Void.class);
3123            });
3124        }
3125
3126        for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
3127            // Incorrect argument types
3128            checkNPE(() -> { // null array
3129                hs.get(am, methodType(void.class, $type$[].class, int.class, $type$.class)).
3130                    invokeExact(($type$[]) null, 0, $value1$);
3131            });
3132            hs.checkWMTEOrCCE(() -> { // array reference class
3133                hs.get(am, methodType(void.class, Class.class, int.class, $type$.class)).
3134                    invokeExact(Void.class, 0, $value1$);
3135            });
3136            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class
3137                hs.get(am, methodType(void.class, $type$[].class, int.class, Class.class)).
3138                    invokeExact(array, 0, Void.class);
3139            });
3140            checkWMTE(() -> { // receiver primitive class
3141                hs.get(am, methodType(void.class, int.class, int.class, $type$.class)).
3142                    invokeExact(0, 0, $value1$);
3143            });
3144            checkWMTE(() -> { // index reference class
3145                hs.get(am, methodType(void.class, $type$[].class, Class.class, $type$.class)).
3146                    invokeExact(array, Void.class, $value1$);
3147            });
3148            // Incorrect arity
3149            checkWMTE(() -> { // 0
3150                hs.get(am, methodType(void.class)).
3151                    invokeExact();
3152            });
3153            checkWMTE(() -> { // >
3154                hs.get(am, methodType(void.class, $type$[].class, int.class, Class.class)).
3155                    invokeExact(array, 0, $value1$, Void.class);
3156            });
3157        }
3158#if[CAS]
3159        for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
3160            // Incorrect argument types
3161            checkNPE(() -> { // null receiver
3162                boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$[].class, int.class, $type$.class, $type$.class)).
3163                    invokeExact(($type$[]) null, 0, $value1$, $value1$);
3164            });
3165            hs.checkWMTEOrCCE(() -> { // receiver reference class
3166                boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, int.class, $type$.class, $type$.class)).
3167                    invokeExact(Void.class, 0, $value1$, $value1$);
3168            });
3169            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // expected reference class
3170                boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$[].class, int.class, Class.class, $type$.class)).
3171                    invokeExact(array, 0, Void.class, $value1$);
3172            });
3173            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // actual reference class
3174                boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$[].class, int.class, $type$.class, Class.class)).
3175                    invokeExact(array, 0, $value1$, Void.class);
3176            });
3177            checkWMTE(() -> { // receiver primitive class
3178                boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class, int.class, $type$.class, $type$.class)).
3179                    invokeExact(0, 0, $value1$, $value1$);
3180            });
3181            checkWMTE(() -> { // index reference class
3182                boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$[].class, Class.class, $type$.class, $type$.class)).
3183                    invokeExact(array, Void.class, $value1$, $value1$);
3184            });
3185            // Incorrect arity
3186            checkWMTE(() -> { // 0
3187                boolean r = (boolean) hs.get(am, methodType(boolean.class)).
3188                    invokeExact();
3189            });
3190            checkWMTE(() -> { // >
3191                boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$[].class, int.class, $type$.class, $type$.class, Class.class)).
3192                    invokeExact(array, 0, $value1$, $value1$, Void.class);
3193            });
3194        }
3195
3196        for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
3197            // Incorrect argument types
3198            checkNPE(() -> { // null receiver
3199                $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class, $type$.class)).
3200                    invokeExact(($type$[]) null, 0, $value1$, $value1$);
3201            });
3202            hs.checkWMTEOrCCE(() -> { // array reference class
3203                $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, int.class, $type$.class, $type$.class)).
3204                    invokeExact(Void.class, 0, $value1$, $value1$);
3205            });
3206            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // expected reference class
3207                $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, Class.class, $type$.class)).
3208                    invokeExact(array, 0, Void.class, $value1$);
3209            });
3210            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // actual reference class
3211                $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class, Class.class)).
3212                    invokeExact(array, 0, $value1$, Void.class);
3213            });
3214            checkWMTE(() -> { // array primitive class
3215                $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, int.class, $type$.class, $type$.class)).
3216                    invokeExact(0, 0, $value1$, $value1$);
3217            });
3218            checkWMTE(() -> { // index reference class
3219                $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, Class.class, $type$.class, $type$.class)).
3220                    invokeExact(array, Void.class, $value1$, $value1$);
3221            });
3222            // Incorrect return type
3223            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
3224                Void r = (Void) hs.get(am, methodType(Void.class, $type$[].class, int.class, $type$.class, $type$.class)).
3225                    invokeExact(array, 0, $value1$, $value1$);
3226            });
3227            checkWMTE(() -> { // primitive class
3228                $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$[].class, int.class, $type$.class, $type$.class)).
3229                    invokeExact(array, 0, $value1$, $value1$);
3230            });
3231            // Incorrect arity
3232            checkWMTE(() -> { // 0
3233                $type$ x = ($type$) hs.get(am, methodType($type$.class)).
3234                    invokeExact();
3235            });
3236            checkWMTE(() -> { // >
3237                $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class, $type$.class, Class.class)).
3238                    invokeExact(array, 0, $value1$, $value1$, Void.class);
3239            });
3240        }
3241
3242        for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
3243            // Incorrect argument types
3244            checkNPE(() -> { // null array
3245                $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class)).
3246                    invokeExact(($type$[]) null, 0, $value1$);
3247            });
3248            hs.checkWMTEOrCCE(() -> { // array reference class
3249                $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, int.class, $type$.class)).
3250                    invokeExact(Void.class, 0, $value1$);
3251            });
3252            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class
3253                $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, Class.class)).
3254                    invokeExact(array, 0, Void.class);
3255            });
3256            checkWMTE(() -> { // array primitive class
3257                $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, int.class, $type$.class)).
3258                    invokeExact(0, 0, $value1$);
3259            });
3260            checkWMTE(() -> { // index reference class
3261                $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, Class.class, $type$.class)).
3262                    invokeExact(array, Void.class, $value1$);
3263            });
3264            // Incorrect return type
3265            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
3266                Void r = (Void) hs.get(am, methodType(Void.class, $type$[].class, int.class, $type$.class)).
3267                    invokeExact(array, 0, $value1$);
3268            });
3269            checkWMTE(() -> { // primitive class
3270                $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$[].class, int.class, $type$.class)).
3271                    invokeExact(array, 0, $value1$);
3272            });
3273            // Incorrect arity
3274            checkWMTE(() -> { // 0
3275                $type$ x = ($type$) hs.get(am, methodType($type$.class)).
3276                    invokeExact();
3277            });
3278            checkWMTE(() -> { // >
3279                $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class, Class.class)).
3280                    invokeExact(array, 0, $value1$, Void.class);
3281            });
3282        }
3283#end[CAS]
3284
3285#if[AtomicAdd]
3286        for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
3287            // Incorrect argument types
3288            checkNPE(() -> { // null array
3289                $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class)).
3290                    invokeExact(($type$[]) null, 0, $value1$);
3291            });
3292            hs.checkWMTEOrCCE(() -> { // array reference class
3293                $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, int.class, $type$.class)).
3294                    invokeExact(Void.class, 0, $value1$);
3295            });
3296            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class
3297                $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, Class.class)).
3298                    invokeExact(array, 0, Void.class);
3299            });
3300            checkWMTE(() -> { // array primitive class
3301                $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, int.class, $type$.class)).
3302                    invokeExact(0, 0, $value1$);
3303            });
3304            checkWMTE(() -> { // index reference class
3305                $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, Class.class, $type$.class)).
3306                    invokeExact(array, Void.class, $value1$);
3307            });
3308            // Incorrect return type
3309            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
3310                Void r = (Void) hs.get(am, methodType(Void.class, $type$[].class, int.class, $type$.class)).
3311                    invokeExact(array, 0, $value1$);
3312            });
3313            checkWMTE(() -> { // primitive class
3314                $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$[].class, int.class, $type$.class)).
3315                    invokeExact(array, 0, $value1$);
3316            });
3317            // Incorrect arity
3318            checkWMTE(() -> { // 0
3319                $type$ x = ($type$) hs.get(am, methodType($type$.class)).
3320                    invokeExact();
3321            });
3322            checkWMTE(() -> { // >
3323                $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class, Class.class)).
3324                    invokeExact(array, 0, $value1$, Void.class);
3325            });
3326        }
3327#end[AtomicAdd]
3328
3329#if[Bitwise]
3330        for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
3331            // Incorrect argument types
3332            checkNPE(() -> { // null array
3333                $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class)).
3334                    invokeExact(($type$[]) null, 0, $value1$);
3335            });
3336            hs.checkWMTEOrCCE(() -> { // array reference class
3337                $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, int.class, $type$.class)).
3338                    invokeExact(Void.class, 0, $value1$);
3339            });
3340            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class
3341                $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, Class.class)).
3342                    invokeExact(array, 0, Void.class);
3343            });
3344            checkWMTE(() -> { // array primitive class
3345                $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, int.class, $type$.class)).
3346                    invokeExact(0, 0, $value1$);
3347            });
3348            checkWMTE(() -> { // index reference class
3349                $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, Class.class, $type$.class)).
3350                    invokeExact(array, Void.class, $value1$);
3351            });
3352            // Incorrect return type
3353            {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
3354                Void r = (Void) hs.get(am, methodType(Void.class, $type$[].class, int.class, $type$.class)).
3355                    invokeExact(array, 0, $value1$);
3356            });
3357            checkWMTE(() -> { // primitive class
3358                $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$[].class, int.class, $type$.class)).
3359                    invokeExact(array, 0, $value1$);
3360            });
3361            // Incorrect arity
3362            checkWMTE(() -> { // 0
3363                $type$ x = ($type$) hs.get(am, methodType($type$.class)).
3364                    invokeExact();
3365            });
3366            checkWMTE(() -> { // >
3367                $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class, Class.class)).
3368                    invokeExact(array, 0, $value1$, Void.class);
3369            });
3370        }
3371#end[Bitwise]
3372    }
3373}
3374
3375