< prev index next > test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeByte.java
Print this page
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+ // -- This file was mechanically generated: Do not edit! -- //
+
/*
* @test
* @bug 8156486
* @run testng/othervm VarHandleTestMethodTypeByte
* @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=true -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeByte
import static org.testng.Assert.*;
import static java.lang.invoke.MethodType.*;
public class VarHandleTestMethodTypeByte extends VarHandleBaseTest {
+ static final Class<?> type = byte.class;
+
static final byte static_final_v = (byte)0x01;
static byte static_v = (byte)0x01;
final byte final_v = (byte)0x01;
VarHandle vhArray;
@BeforeClass
public void setup() throws Exception {
vhFinalField = MethodHandles.lookup().findVarHandle(
! VarHandleTestMethodTypeByte.class, "final_v", byte.class);
vhField = MethodHandles.lookup().findVarHandle(
! VarHandleTestMethodTypeByte.class, "v", byte.class);
vhStaticFinalField = MethodHandles.lookup().findStaticVarHandle(
! VarHandleTestMethodTypeByte.class, "static_final_v", byte.class);
vhStaticField = MethodHandles.lookup().findStaticVarHandle(
! VarHandleTestMethodTypeByte.class, "static_v", byte.class);
vhArray = MethodHandles.arrayElementVarHandle(byte[].class);
}
@DataProvider
VarHandle vhArray;
@BeforeClass
public void setup() throws Exception {
vhFinalField = MethodHandles.lookup().findVarHandle(
! VarHandleTestMethodTypeByte.class, "final_v", type);
vhField = MethodHandles.lookup().findVarHandle(
! VarHandleTestMethodTypeByte.class, "v", type);
vhStaticFinalField = MethodHandles.lookup().findStaticVarHandle(
! VarHandleTestMethodTypeByte.class, "static_final_v", type);
vhStaticField = MethodHandles.lookup().findStaticVarHandle(
! VarHandleTestMethodTypeByte.class, "static_v", type);
vhArray = MethodHandles.arrayElementVarHandle(byte[].class);
}
@DataProvider
static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeByte recv, Handles hs) throws Throwable {
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
! byte x = (byte) hs.get(am, methodType(byte.class, VarHandleTestMethodTypeByte.class)).
invokeExact((VarHandleTestMethodTypeByte) null);
});
hs.checkWMTEOrCCE(() -> { // receiver reference class
! byte x = (byte) hs.get(am, methodType(byte.class, Class.class)).
invokeExact(Void.class);
});
checkWMTE(() -> { // receiver primitive class
! byte x = (byte) hs.get(am, methodType(byte.class, int.class)).
invokeExact(0);
});
// Incorrect return type
checkWMTE(() -> { // reference class
Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeByte.class)).
static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeByte recv, Handles hs) throws Throwable {
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
! byte x = (byte) hs.get(am, methodType(type, VarHandleTestMethodTypeByte.class)).
invokeExact((VarHandleTestMethodTypeByte) null);
});
hs.checkWMTEOrCCE(() -> { // receiver reference class
! byte x = (byte) hs.get(am, methodType(type, Class.class)).
invokeExact(Void.class);
});
checkWMTE(() -> { // receiver primitive class
! byte x = (byte) hs.get(am, methodType(type, int.class)).
invokeExact(0);
});
// Incorrect return type
checkWMTE(() -> { // reference class
Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeByte.class)).
boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeByte.class)).
invokeExact(recv);
});
// Incorrect arity
checkWMTE(() -> { // 0
! byte x = (byte) hs.get(am, methodType(byte.class)).
invokeExact();
});
checkWMTE(() -> { // >
! byte x = (byte) hs.get(am, methodType(byte.class, VarHandleTestMethodTypeByte.class, Class.class)).
invokeExact(recv, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
! hs.get(am, methodType(void.class, VarHandleTestMethodTypeByte.class, byte.class)).
invokeExact((VarHandleTestMethodTypeByte) null, (byte)0x01);
});
hs.checkWMTEOrCCE(() -> { // receiver reference class
! hs.get(am, methodType(void.class, Class.class, byte.class)).
invokeExact(Void.class, (byte)0x01);
});
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, VarHandleTestMethodTypeByte.class, Class.class)).
invokeExact(recv, Void.class);
});
checkWMTE(() -> { // receiver primitive class
! hs.get(am, methodType(void.class, int.class, byte.class)).
invokeExact(0, (byte)0x01);
});
// Incorrect arity
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
invokeExact();
});
checkWMTE(() -> { // >
! hs.get(am, methodType(void.class, VarHandleTestMethodTypeByte.class, byte.class, Class.class)).
invokeExact(recv, (byte)0x01, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
! boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeByte.class, byte.class, byte.class)).
invokeExact((VarHandleTestMethodTypeByte) null, (byte)0x01, (byte)0x01);
});
hs.checkWMTEOrCCE(() -> { // receiver reference class
! boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, byte.class, byte.class)).
invokeExact(Void.class, (byte)0x01, (byte)0x01);
});
checkWMTE(() -> { // expected reference class
! boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeByte.class, Class.class, byte.class)).
invokeExact(recv, Void.class, (byte)0x01);
});
checkWMTE(() -> { // actual reference class
! boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeByte.class, byte.class, Class.class)).
invokeExact(recv, (byte)0x01, Void.class);
});
checkWMTE(() -> { // receiver primitive class
! boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class , byte.class, byte.class)).
invokeExact(0, (byte)0x01, (byte)0x01);
});
// Incorrect arity
checkWMTE(() -> { // 0
boolean r = (boolean) hs.get(am, methodType(boolean.class)).
invokeExact();
});
checkWMTE(() -> { // >
! boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeByte.class, byte.class, byte.class, Class.class)).
invokeExact(recv, (byte)0x01, (byte)0x01, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkNPE(() -> { // null receiver
! byte x = (byte) hs.get(am, methodType(byte.class, VarHandleTestMethodTypeByte.class, byte.class, byte.class)).
invokeExact((VarHandleTestMethodTypeByte) null, (byte)0x01, (byte)0x01);
});
hs.checkWMTEOrCCE(() -> { // receiver reference class
! byte x = (byte) hs.get(am, methodType(byte.class, Class.class, byte.class, byte.class)).
invokeExact(Void.class, (byte)0x01, (byte)0x01);
});
checkWMTE(() -> { // expected reference class
! byte x = (byte) hs.get(am, methodType(byte.class, VarHandleTestMethodTypeByte.class, Class.class, byte.class)).
invokeExact(recv, Void.class, (byte)0x01);
});
checkWMTE(() -> { // actual reference class
! byte x = (byte) hs.get(am, methodType(byte.class, VarHandleTestMethodTypeByte.class, byte.class, Class.class)).
invokeExact(recv, (byte)0x01, Void.class);
});
checkWMTE(() -> { // reciever primitive class
! byte x = (byte) hs.get(am, methodType(byte.class, int.class , byte.class, byte.class)).
invokeExact(0, (byte)0x01, (byte)0x01);
});
// Incorrect return type
checkWMTE(() -> { // reference class
! Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeByte.class , byte.class, byte.class)).
invokeExact(recv, (byte)0x01, (byte)0x01);
});
checkWMTE(() -> { // primitive class
! boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeByte.class , byte.class, byte.class)).
invokeExact(recv, (byte)0x01, (byte)0x01);
});
// Incorrect arity
checkWMTE(() -> { // 0
! byte x = (byte) hs.get(am, methodType(byte.class)).
invokeExact();
});
checkWMTE(() -> { // >
! byte x = (byte) hs.get(am, methodType(byte.class, VarHandleTestMethodTypeByte.class, byte.class, byte.class, Class.class)).
invokeExact(recv, (byte)0x01, (byte)0x01, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkNPE(() -> { // null receiver
! byte x = (byte) hs.get(am, methodType(byte.class, VarHandleTestMethodTypeByte.class, byte.class)).
invokeExact((VarHandleTestMethodTypeByte) null, (byte)0x01);
});
hs.checkWMTEOrCCE(() -> { // receiver reference class
! byte x = (byte) hs.get(am, methodType(byte.class, Class.class, byte.class)).
invokeExact(Void.class, (byte)0x01);
});
checkWMTE(() -> { // value reference class
! byte x = (byte) hs.get(am, methodType(byte.class, VarHandleTestMethodTypeByte.class, Class.class)).
invokeExact(recv, Void.class);
});
checkWMTE(() -> { // reciever primitive class
! byte x = (byte) hs.get(am, methodType(byte.class, int.class, byte.class)).
invokeExact(0, (byte)0x01);
});
// Incorrect return type
checkWMTE(() -> { // reference class
! Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeByte.class, byte.class)).
invokeExact(recv, (byte)0x01);
});
checkWMTE(() -> { // primitive class
! boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeByte.class, byte.class)).
invokeExact(recv, (byte)0x01);
});
// Incorrect arity
checkWMTE(() -> { // 0
! byte x = (byte) hs.get(am, methodType(byte.class)).
invokeExact();
});
checkWMTE(() -> { // >
! byte x = (byte) hs.get(am, methodType(byte.class, VarHandleTestMethodTypeByte.class, byte.class)).
invokeExact(recv, (byte)0x01, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkNPE(() -> { // null receiver
! byte x = (byte) hs.get(am, methodType(byte.class, VarHandleTestMethodTypeByte.class, byte.class)).
invokeExact((VarHandleTestMethodTypeByte) null, (byte)0x01);
});
hs.checkWMTEOrCCE(() -> { // receiver reference class
! byte x = (byte) hs.get(am, methodType(byte.class, Class.class, byte.class)).
invokeExact(Void.class, (byte)0x01);
});
checkWMTE(() -> { // value reference class
! byte x = (byte) hs.get(am, methodType(byte.class, VarHandleTestMethodTypeByte.class, Class.class)).
invokeExact(recv, Void.class);
});
checkWMTE(() -> { // reciever primitive class
! byte x = (byte) hs.get(am, methodType(byte.class, int.class, byte.class)).
invokeExact(0, (byte)0x01);
});
// Incorrect return type
checkWMTE(() -> { // reference class
! Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeByte.class, byte.class)).
invokeExact(recv, (byte)0x01);
});
checkWMTE(() -> { // primitive class
! boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeByte.class, byte.class)).
invokeExact(recv, (byte)0x01);
});
// Incorrect arity
checkWMTE(() -> { // 0
! byte x = (byte) hs.get(am, methodType(byte.class)).
invokeExact();
});
checkWMTE(() -> { // >
! byte x = (byte) hs.get(am, methodType(byte.class, VarHandleTestMethodTypeByte.class, byte.class)).
invokeExact(recv, (byte)0x01, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
checkNPE(() -> { // null receiver
! byte x = (byte) hs.get(am, methodType(byte.class, VarHandleTestMethodTypeByte.class, byte.class)).
invokeExact((VarHandleTestMethodTypeByte) null, (byte)0x01);
});
hs.checkWMTEOrCCE(() -> { // receiver reference class
! byte x = (byte) hs.get(am, methodType(byte.class, Class.class, byte.class)).
invokeExact(Void.class, (byte)0x01);
});
checkWMTE(() -> { // value reference class
! byte x = (byte) hs.get(am, methodType(byte.class, VarHandleTestMethodTypeByte.class, Class.class)).
invokeExact(recv, Void.class);
});
checkWMTE(() -> { // reciever primitive class
! byte x = (byte) hs.get(am, methodType(byte.class, int.class, byte.class)).
invokeExact(0, (byte)0x01);
});
// Incorrect return type
checkWMTE(() -> { // reference class
! Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeByte.class, byte.class)).
invokeExact(recv, (byte)0x01);
});
checkWMTE(() -> { // primitive class
! boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeByte.class, byte.class)).
invokeExact(recv, (byte)0x01);
});
// Incorrect arity
checkWMTE(() -> { // 0
! byte x = (byte) hs.get(am, methodType(byte.class)).
invokeExact();
});
checkWMTE(() -> { // >
! byte x = (byte) hs.get(am, methodType(byte.class, VarHandleTestMethodTypeByte.class, byte.class)).
invokeExact(recv, (byte)0x01, Void.class);
});
}
}
boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeByte.class)).
invokeExact(recv);
});
// Incorrect arity
checkWMTE(() -> { // 0
! byte x = (byte) hs.get(am, methodType(type)).
invokeExact();
});
checkWMTE(() -> { // >
! byte x = (byte) hs.get(am, methodType(type, VarHandleTestMethodTypeByte.class, Class.class)).
invokeExact(recv, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
! hs.get(am, methodType(void.class, VarHandleTestMethodTypeByte.class, type)).
invokeExact((VarHandleTestMethodTypeByte) null, (byte)0x01);
});
hs.checkWMTEOrCCE(() -> { // receiver reference class
! hs.get(am, methodType(void.class, Class.class, type)).
invokeExact(Void.class, (byte)0x01);
});
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, VarHandleTestMethodTypeByte.class, Class.class)).
invokeExact(recv, Void.class);
});
checkWMTE(() -> { // receiver primitive class
! hs.get(am, methodType(void.class, int.class, type)).
invokeExact(0, (byte)0x01);
});
// Incorrect arity
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
invokeExact();
});
checkWMTE(() -> { // >
! hs.get(am, methodType(void.class, VarHandleTestMethodTypeByte.class, type, Class.class)).
invokeExact(recv, (byte)0x01, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
! boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeByte.class, type, type)).
invokeExact((VarHandleTestMethodTypeByte) null, (byte)0x01, (byte)0x01);
});
hs.checkWMTEOrCCE(() -> { // receiver reference class
! boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, type, type)).
invokeExact(Void.class, (byte)0x01, (byte)0x01);
});
checkWMTE(() -> { // expected reference class
! boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeByte.class, Class.class, type)).
invokeExact(recv, Void.class, (byte)0x01);
});
checkWMTE(() -> { // actual reference class
! boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeByte.class, type, Class.class)).
invokeExact(recv, (byte)0x01, Void.class);
});
checkWMTE(() -> { // receiver primitive class
! boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class , type, type)).
invokeExact(0, (byte)0x01, (byte)0x01);
});
// Incorrect arity
checkWMTE(() -> { // 0
boolean r = (boolean) hs.get(am, methodType(boolean.class)).
invokeExact();
});
checkWMTE(() -> { // >
! boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeByte.class, type, type, Class.class)).
invokeExact(recv, (byte)0x01, (byte)0x01, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkNPE(() -> { // null receiver
! byte x = (byte) hs.get(am, methodType(type, VarHandleTestMethodTypeByte.class, type, type)).
invokeExact((VarHandleTestMethodTypeByte) null, (byte)0x01, (byte)0x01);
});
hs.checkWMTEOrCCE(() -> { // receiver reference class
! byte x = (byte) hs.get(am, methodType(type, Class.class, type, type)).
invokeExact(Void.class, (byte)0x01, (byte)0x01);
});
checkWMTE(() -> { // expected reference class
! byte x = (byte) hs.get(am, methodType(type, VarHandleTestMethodTypeByte.class, Class.class, type)).
invokeExact(recv, Void.class, (byte)0x01);
});
checkWMTE(() -> { // actual reference class
! byte x = (byte) hs.get(am, methodType(type, VarHandleTestMethodTypeByte.class, type, Class.class)).
invokeExact(recv, (byte)0x01, Void.class);
});
checkWMTE(() -> { // reciever primitive class
! byte x = (byte) hs.get(am, methodType(type, int.class , type, type)).
invokeExact(0, (byte)0x01, (byte)0x01);
});
// Incorrect return type
checkWMTE(() -> { // reference class
! Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeByte.class , type, type)).
invokeExact(recv, (byte)0x01, (byte)0x01);
});
checkWMTE(() -> { // primitive class
! boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeByte.class , type, type)).
invokeExact(recv, (byte)0x01, (byte)0x01);
});
// Incorrect arity
checkWMTE(() -> { // 0
! byte x = (byte) hs.get(am, methodType(type)).
invokeExact();
});
checkWMTE(() -> { // >
! byte x = (byte) hs.get(am, methodType(type, VarHandleTestMethodTypeByte.class, type, type, Class.class)).
invokeExact(recv, (byte)0x01, (byte)0x01, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkNPE(() -> { // null receiver
! byte x = (byte) hs.get(am, methodType(type, VarHandleTestMethodTypeByte.class, type)).
invokeExact((VarHandleTestMethodTypeByte) null, (byte)0x01);
});
hs.checkWMTEOrCCE(() -> { // receiver reference class
! byte x = (byte) hs.get(am, methodType(type, Class.class, type)).
invokeExact(Void.class, (byte)0x01);
});
checkWMTE(() -> { // value reference class
! byte x = (byte) hs.get(am, methodType(type, VarHandleTestMethodTypeByte.class, Class.class)).
invokeExact(recv, Void.class);
});
checkWMTE(() -> { // reciever primitive class
! byte x = (byte) hs.get(am, methodType(type, int.class, type)).
invokeExact(0, (byte)0x01);
});
// Incorrect return type
checkWMTE(() -> { // reference class
! Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeByte.class, type)).
invokeExact(recv, (byte)0x01);
});
checkWMTE(() -> { // primitive class
! boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeByte.class, type)).
invokeExact(recv, (byte)0x01);
});
// Incorrect arity
checkWMTE(() -> { // 0
! byte x = (byte) hs.get(am, methodType(type)).
invokeExact();
});
checkWMTE(() -> { // >
! byte x = (byte) hs.get(am, methodType(type, VarHandleTestMethodTypeByte.class, type)).
invokeExact(recv, (byte)0x01, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkNPE(() -> { // null receiver
! byte x = (byte) hs.get(am, methodType(type, VarHandleTestMethodTypeByte.class, type)).
invokeExact((VarHandleTestMethodTypeByte) null, (byte)0x01);
});
hs.checkWMTEOrCCE(() -> { // receiver reference class
! byte x = (byte) hs.get(am, methodType(type, Class.class, type)).
invokeExact(Void.class, (byte)0x01);
});
checkWMTE(() -> { // value reference class
! byte x = (byte) hs.get(am, methodType(type, VarHandleTestMethodTypeByte.class, Class.class)).
invokeExact(recv, Void.class);
});
checkWMTE(() -> { // reciever primitive class
! byte x = (byte) hs.get(am, methodType(type, int.class, type)).
invokeExact(0, (byte)0x01);
});
// Incorrect return type
checkWMTE(() -> { // reference class
! Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeByte.class, type)).
invokeExact(recv, (byte)0x01);
});
checkWMTE(() -> { // primitive class
! boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeByte.class, type)).
invokeExact(recv, (byte)0x01);
});
// Incorrect arity
checkWMTE(() -> { // 0
! byte x = (byte) hs.get(am, methodType(type)).
invokeExact();
});
checkWMTE(() -> { // >
! byte x = (byte) hs.get(am, methodType(type, VarHandleTestMethodTypeByte.class, type)).
invokeExact(recv, (byte)0x01, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
checkNPE(() -> { // null receiver
! byte x = (byte) hs.get(am, methodType(type, VarHandleTestMethodTypeByte.class, type)).
invokeExact((VarHandleTestMethodTypeByte) null, (byte)0x01);
});
hs.checkWMTEOrCCE(() -> { // receiver reference class
! byte x = (byte) hs.get(am, methodType(type, Class.class, type)).
invokeExact(Void.class, (byte)0x01);
});
checkWMTE(() -> { // value reference class
! byte x = (byte) hs.get(am, methodType(type, VarHandleTestMethodTypeByte.class, Class.class)).
invokeExact(recv, Void.class);
});
checkWMTE(() -> { // reciever primitive class
! byte x = (byte) hs.get(am, methodType(type, int.class, type)).
invokeExact(0, (byte)0x01);
});
// Incorrect return type
checkWMTE(() -> { // reference class
! Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeByte.class, type)).
invokeExact(recv, (byte)0x01);
});
checkWMTE(() -> { // primitive class
! boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeByte.class, type)).
invokeExact(recv, (byte)0x01);
});
// Incorrect arity
checkWMTE(() -> { // 0
! byte x = (byte) hs.get(am, methodType(type)).
invokeExact();
});
checkWMTE(() -> { // >
! byte x = (byte) hs.get(am, methodType(type, VarHandleTestMethodTypeByte.class, type)).
invokeExact(recv, (byte)0x01, Void.class);
});
}
}
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
invokeExact();
});
checkWMTE(() -> { // >
! hs.get(am, methodType(void.class, byte.class, Class.class)).
invokeExact((byte)0x01, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
// Incorrect argument types
checkWMTE(() -> { // expected reference class
! boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, byte.class)).
invokeExact(Void.class, (byte)0x01);
});
checkWMTE(() -> { // actual reference class
! boolean r = (boolean) hs.get(am, methodType(boolean.class, byte.class, Class.class)).
invokeExact((byte)0x01, Void.class);
});
// Incorrect arity
checkWMTE(() -> { // 0
boolean r = (boolean) hs.get(am, methodType(boolean.class)).
invokeExact();
});
checkWMTE(() -> { // >
! boolean r = (boolean) hs.get(am, methodType(boolean.class, byte.class, byte.class, Class.class)).
invokeExact((byte)0x01, (byte)0x01, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
// Incorrect argument types
checkWMTE(() -> { // expected reference class
! byte x = (byte) hs.get(am, methodType(byte.class, Class.class, byte.class)).
invokeExact(Void.class, (byte)0x01);
});
checkWMTE(() -> { // actual reference class
! byte x = (byte) hs.get(am, methodType(byte.class, byte.class, Class.class)).
invokeExact((byte)0x01, Void.class);
});
// Incorrect return type
checkWMTE(() -> { // reference class
! Void r = (Void) hs.get(am, methodType(Void.class, byte.class, byte.class)).
invokeExact((byte)0x01, (byte)0x01);
});
checkWMTE(() -> { // primitive class
! boolean x = (boolean) hs.get(am, methodType(boolean.class, byte.class, byte.class)).
invokeExact((byte)0x01, (byte)0x01);
});
// Incorrect arity
checkWMTE(() -> { // 0
! byte x = (byte) hs.get(am, methodType(byte.class)).
invokeExact();
});
checkWMTE(() -> { // >
! byte x = (byte) hs.get(am, methodType(byte.class, byte.class, byte.class, Class.class)).
invokeExact((byte)0x01, (byte)0x01, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
// Incorrect argument types
checkWMTE(() -> { // value reference class
! byte x = (byte) hs.get(am, methodType(byte.class, Class.class)).
invokeExact(Void.class);
});
// Incorrect return type
checkWMTE(() -> { // reference class
! Void r = (Void) hs.get(am, methodType(Void.class, byte.class)).
invokeExact((byte)0x01);
});
checkWMTE(() -> { // primitive class
! boolean x = (boolean) hs.get(am, methodType(boolean.class, byte.class)).
invokeExact((byte)0x01);
});
// Incorrect arity
checkWMTE(() -> { // 0
! byte x = (byte) hs.get(am, methodType(byte.class)).
invokeExact();
});
checkWMTE(() -> { // >
! byte x = (byte) hs.get(am, methodType(byte.class, byte.class, Class.class)).
invokeExact((byte)0x01, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
// Incorrect argument types
checkWMTE(() -> { // value reference class
! byte x = (byte) hs.get(am, methodType(byte.class, Class.class)).
invokeExact(Void.class);
});
// Incorrect return type
checkWMTE(() -> { // reference class
! Void r = (Void) hs.get(am, methodType(Void.class, byte.class)).
invokeExact((byte)0x01);
});
checkWMTE(() -> { // primitive class
! boolean x = (boolean) hs.get(am, methodType(boolean.class, byte.class)).
invokeExact((byte)0x01);
});
// Incorrect arity
checkWMTE(() -> { // 0
! byte x = (byte) hs.get(am, methodType(byte.class)).
invokeExact();
});
checkWMTE(() -> { // >
! byte x = (byte) hs.get(am, methodType(byte.class, byte.class, Class.class)).
invokeExact((byte)0x01, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
// Incorrect argument types
checkWMTE(() -> { // value reference class
! byte x = (byte) hs.get(am, methodType(byte.class, Class.class)).
invokeExact(Void.class);
});
// Incorrect return type
checkWMTE(() -> { // reference class
! Void r = (Void) hs.get(am, methodType(Void.class, byte.class)).
invokeExact((byte)0x01);
});
checkWMTE(() -> { // primitive class
! boolean x = (boolean) hs.get(am, methodType(boolean.class, byte.class)).
invokeExact((byte)0x01);
});
// Incorrect arity
checkWMTE(() -> { // 0
! byte x = (byte) hs.get(am, methodType(byte.class)).
invokeExact();
});
checkWMTE(() -> { // >
! byte x = (byte) hs.get(am, methodType(byte.class, byte.class, Class.class)).
invokeExact((byte)0x01, Void.class);
});
}
}
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
invokeExact();
});
checkWMTE(() -> { // >
! hs.get(am, methodType(void.class, type, Class.class)).
invokeExact((byte)0x01, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
// Incorrect argument types
checkWMTE(() -> { // expected reference class
! boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, type)).
invokeExact(Void.class, (byte)0x01);
});
checkWMTE(() -> { // actual reference class
! boolean r = (boolean) hs.get(am, methodType(boolean.class, type, Class.class)).
invokeExact((byte)0x01, Void.class);
});
// Incorrect arity
checkWMTE(() -> { // 0
boolean r = (boolean) hs.get(am, methodType(boolean.class)).
invokeExact();
});
checkWMTE(() -> { // >
! boolean r = (boolean) hs.get(am, methodType(boolean.class, type, type, Class.class)).
invokeExact((byte)0x01, (byte)0x01, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
// Incorrect argument types
checkWMTE(() -> { // expected reference class
! byte x = (byte) hs.get(am, methodType(type, Class.class, type)).
invokeExact(Void.class, (byte)0x01);
});
checkWMTE(() -> { // actual reference class
! byte x = (byte) hs.get(am, methodType(type, type, Class.class)).
invokeExact((byte)0x01, Void.class);
});
// Incorrect return type
checkWMTE(() -> { // reference class
! Void r = (Void) hs.get(am, methodType(Void.class, type, type)).
invokeExact((byte)0x01, (byte)0x01);
});
checkWMTE(() -> { // primitive class
! boolean x = (boolean) hs.get(am, methodType(boolean.class, type, type)).
invokeExact((byte)0x01, (byte)0x01);
});
// Incorrect arity
checkWMTE(() -> { // 0
! byte x = (byte) hs.get(am, methodType(type)).
invokeExact();
});
checkWMTE(() -> { // >
! byte x = (byte) hs.get(am, methodType(type, type, type, Class.class)).
invokeExact((byte)0x01, (byte)0x01, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
// Incorrect argument types
checkWMTE(() -> { // value reference class
! byte x = (byte) hs.get(am, methodType(type, Class.class)).
invokeExact(Void.class);
});
// Incorrect return type
checkWMTE(() -> { // reference class
! Void r = (Void) hs.get(am, methodType(Void.class, type)).
invokeExact((byte)0x01);
});
checkWMTE(() -> { // primitive class
! boolean x = (boolean) hs.get(am, methodType(boolean.class, type)).
invokeExact((byte)0x01);
});
// Incorrect arity
checkWMTE(() -> { // 0
! byte x = (byte) hs.get(am, methodType(type)).
invokeExact();
});
checkWMTE(() -> { // >
! byte x = (byte) hs.get(am, methodType(type, type, Class.class)).
invokeExact((byte)0x01, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
// Incorrect argument types
checkWMTE(() -> { // value reference class
! byte x = (byte) hs.get(am, methodType(type, Class.class)).
invokeExact(Void.class);
});
// Incorrect return type
checkWMTE(() -> { // reference class
! Void r = (Void) hs.get(am, methodType(Void.class, type)).
invokeExact((byte)0x01);
});
checkWMTE(() -> { // primitive class
! boolean x = (boolean) hs.get(am, methodType(boolean.class, type)).
invokeExact((byte)0x01);
});
// Incorrect arity
checkWMTE(() -> { // 0
! byte x = (byte) hs.get(am, methodType(type)).
invokeExact();
});
checkWMTE(() -> { // >
! byte x = (byte) hs.get(am, methodType(type, type, Class.class)).
invokeExact((byte)0x01, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
// Incorrect argument types
checkWMTE(() -> { // value reference class
! byte x = (byte) hs.get(am, methodType(type, Class.class)).
invokeExact(Void.class);
});
// Incorrect return type
checkWMTE(() -> { // reference class
! Void r = (Void) hs.get(am, methodType(Void.class, type)).
invokeExact((byte)0x01);
});
checkWMTE(() -> { // primitive class
! boolean x = (boolean) hs.get(am, methodType(boolean.class, type)).
invokeExact((byte)0x01);
});
// Incorrect arity
checkWMTE(() -> { // 0
! byte x = (byte) hs.get(am, methodType(type)).
invokeExact();
});
checkWMTE(() -> { // >
! byte x = (byte) hs.get(am, methodType(type, type, Class.class)).
invokeExact((byte)0x01, Void.class);
});
}
}
Arrays.fill(array, (byte)0x01);
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null array
! byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, int.class)).
invokeExact((byte[]) null, 0);
});
hs.checkWMTEOrCCE(() -> { // array reference class
! byte x = (byte) hs.get(am, methodType(byte.class, Class.class, int.class)).
invokeExact(Void.class, 0);
});
checkWMTE(() -> { // array primitive class
! byte x = (byte) hs.get(am, methodType(byte.class, int.class, int.class)).
invokeExact(0, 0);
});
checkWMTE(() -> { // index reference class
! byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, Class.class)).
invokeExact(array, Void.class);
});
// Incorrect return type
checkWMTE(() -> { // reference class
Void x = (Void) hs.get(am, methodType(Void.class, byte[].class, int.class)).
Arrays.fill(array, (byte)0x01);
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null array
! byte x = (byte) hs.get(am, methodType(type, byte[].class, int.class)).
invokeExact((byte[]) null, 0);
});
hs.checkWMTEOrCCE(() -> { // array reference class
! byte x = (byte) hs.get(am, methodType(type, Class.class, int.class)).
invokeExact(Void.class, 0);
});
checkWMTE(() -> { // array primitive class
! byte x = (byte) hs.get(am, methodType(type, int.class, int.class)).
invokeExact(0, 0);
});
checkWMTE(() -> { // index reference class
! byte x = (byte) hs.get(am, methodType(type, byte[].class, Class.class)).
invokeExact(array, Void.class);
});
// Incorrect return type
checkWMTE(() -> { // reference class
Void x = (Void) hs.get(am, methodType(Void.class, byte[].class, int.class)).
boolean x = (boolean) hs.get(am, methodType(boolean.class, byte[].class, int.class)).
invokeExact(array, 0);
});
// Incorrect arity
checkWMTE(() -> { // 0
! byte x = (byte) hs.get(am, methodType(byte.class)).
invokeExact();
});
checkWMTE(() -> { // >
! byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, int.class, Class.class)).
invokeExact(array, 0, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null array
! hs.get(am, methodType(void.class, byte[].class, int.class, byte.class)).
invokeExact((byte[]) null, 0, (byte)0x01);
});
hs.checkWMTEOrCCE(() -> { // array reference class
! hs.get(am, methodType(void.class, Class.class, int.class, byte.class)).
invokeExact(Void.class, 0, (byte)0x01);
});
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, byte[].class, int.class, Class.class)).
invokeExact(array, 0, Void.class);
});
checkWMTE(() -> { // receiver primitive class
! hs.get(am, methodType(void.class, int.class, int.class, byte.class)).
invokeExact(0, 0, (byte)0x01);
});
checkWMTE(() -> { // index reference class
! hs.get(am, methodType(void.class, byte[].class, Class.class, byte.class)).
invokeExact(array, Void.class, (byte)0x01);
});
// Incorrect arity
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
boolean x = (boolean) hs.get(am, methodType(boolean.class, byte[].class, int.class)).
invokeExact(array, 0);
});
// Incorrect arity
checkWMTE(() -> { // 0
! byte x = (byte) hs.get(am, methodType(type)).
invokeExact();
});
checkWMTE(() -> { // >
! byte x = (byte) hs.get(am, methodType(type, byte[].class, int.class, Class.class)).
invokeExact(array, 0, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null array
! hs.get(am, methodType(void.class, byte[].class, int.class, type)).
invokeExact((byte[]) null, 0, (byte)0x01);
});
hs.checkWMTEOrCCE(() -> { // array reference class
! hs.get(am, methodType(void.class, Class.class, int.class, type)).
invokeExact(Void.class, 0, (byte)0x01);
});
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, byte[].class, int.class, Class.class)).
invokeExact(array, 0, Void.class);
});
checkWMTE(() -> { // receiver primitive class
! hs.get(am, methodType(void.class, int.class, int.class, type)).
invokeExact(0, 0, (byte)0x01);
});
checkWMTE(() -> { // index reference class
! hs.get(am, methodType(void.class, byte[].class, Class.class, type)).
invokeExact(array, Void.class, (byte)0x01);
});
// Incorrect arity
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
! boolean r = (boolean) hs.get(am, methodType(boolean.class, byte[].class, int.class, byte.class, byte.class)).
invokeExact((byte[]) null, 0, (byte)0x01, (byte)0x01);
});
hs.checkWMTEOrCCE(() -> { // receiver reference class
! boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, int.class, byte.class, byte.class)).
invokeExact(Void.class, 0, (byte)0x01, (byte)0x01);
});
checkWMTE(() -> { // expected reference class
! boolean r = (boolean) hs.get(am, methodType(boolean.class, byte[].class, int.class, Class.class, byte.class)).
invokeExact(array, 0, Void.class, (byte)0x01);
});
checkWMTE(() -> { // actual reference class
! boolean r = (boolean) hs.get(am, methodType(boolean.class, byte[].class, int.class, byte.class, Class.class)).
invokeExact(array, 0, (byte)0x01, Void.class);
});
checkWMTE(() -> { // receiver primitive class
! boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class, int.class, byte.class, byte.class)).
invokeExact(0, 0, (byte)0x01, (byte)0x01);
});
checkWMTE(() -> { // index reference class
! boolean r = (boolean) hs.get(am, methodType(boolean.class, byte[].class, Class.class, byte.class, byte.class)).
invokeExact(array, Void.class, (byte)0x01, (byte)0x01);
});
// Incorrect arity
checkWMTE(() -> { // 0
boolean r = (boolean) hs.get(am, methodType(boolean.class)).
invokeExact();
});
checkWMTE(() -> { // >
! boolean r = (boolean) hs.get(am, methodType(boolean.class, byte[].class, int.class, byte.class, byte.class, Class.class)).
invokeExact(array, 0, (byte)0x01, (byte)0x01, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
! byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, int.class, byte.class, byte.class)).
invokeExact((byte[]) null, 0, (byte)0x01, (byte)0x01);
});
hs.checkWMTEOrCCE(() -> { // array reference class
! byte x = (byte) hs.get(am, methodType(byte.class, Class.class, int.class, byte.class, byte.class)).
invokeExact(Void.class, 0, (byte)0x01, (byte)0x01);
});
checkWMTE(() -> { // expected reference class
! byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, int.class, Class.class, byte.class)).
invokeExact(array, 0, Void.class, (byte)0x01);
});
checkWMTE(() -> { // actual reference class
! byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, int.class, byte.class, Class.class)).
invokeExact(array, 0, (byte)0x01, Void.class);
});
checkWMTE(() -> { // array primitive class
! byte x = (byte) hs.get(am, methodType(byte.class, int.class, int.class, byte.class, byte.class)).
invokeExact(0, 0, (byte)0x01, (byte)0x01);
});
checkWMTE(() -> { // index reference class
! byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, Class.class, byte.class, byte.class)).
invokeExact(array, Void.class, (byte)0x01, (byte)0x01);
});
// Incorrect return type
checkWMTE(() -> { // reference class
! Void r = (Void) hs.get(am, methodType(Void.class, byte[].class, int.class, byte.class, byte.class)).
invokeExact(array, 0, (byte)0x01, (byte)0x01);
});
checkWMTE(() -> { // primitive class
! boolean x = (boolean) hs.get(am, methodType(boolean.class, byte[].class, int.class, byte.class, byte.class)).
invokeExact(array, 0, (byte)0x01, (byte)0x01);
});
// Incorrect arity
checkWMTE(() -> { // 0
! byte x = (byte) hs.get(am, methodType(byte.class)).
invokeExact();
});
checkWMTE(() -> { // >
! byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, int.class, byte.class, byte.class, Class.class)).
invokeExact(array, 0, (byte)0x01, (byte)0x01, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
// Incorrect argument types
checkNPE(() -> { // null array
! byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, int.class, byte.class)).
invokeExact((byte[]) null, 0, (byte)0x01);
});
hs.checkWMTEOrCCE(() -> { // array reference class
! byte x = (byte) hs.get(am, methodType(byte.class, Class.class, int.class, byte.class)).
invokeExact(Void.class, 0, (byte)0x01);
});
checkWMTE(() -> { // value reference class
! byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, int.class, Class.class)).
invokeExact(array, 0, Void.class);
});
checkWMTE(() -> { // array primitive class
! byte x = (byte) hs.get(am, methodType(byte.class, int.class, int.class, byte.class)).
invokeExact(0, 0, (byte)0x01);
});
checkWMTE(() -> { // index reference class
! byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, Class.class, byte.class)).
invokeExact(array, Void.class, (byte)0x01);
});
// Incorrect return type
checkWMTE(() -> { // reference class
! Void r = (Void) hs.get(am, methodType(Void.class, byte[].class, int.class, byte.class)).
invokeExact(array, 0, (byte)0x01);
});
checkWMTE(() -> { // primitive class
! boolean x = (boolean) hs.get(am, methodType(boolean.class, byte[].class, int.class, byte.class)).
invokeExact(array, 0, (byte)0x01);
});
// Incorrect arity
checkWMTE(() -> { // 0
! byte x = (byte) hs.get(am, methodType(byte.class)).
invokeExact();
});
checkWMTE(() -> { // >
! byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, int.class, byte.class, Class.class)).
invokeExact(array, 0, (byte)0x01, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
// Incorrect argument types
checkNPE(() -> { // null array
! byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, int.class, byte.class)).
invokeExact((byte[]) null, 0, (byte)0x01);
});
hs.checkWMTEOrCCE(() -> { // array reference class
! byte x = (byte) hs.get(am, methodType(byte.class, Class.class, int.class, byte.class)).
invokeExact(Void.class, 0, (byte)0x01);
});
checkWMTE(() -> { // value reference class
! byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, int.class, Class.class)).
invokeExact(array, 0, Void.class);
});
checkWMTE(() -> { // array primitive class
! byte x = (byte) hs.get(am, methodType(byte.class, int.class, int.class, byte.class)).
invokeExact(0, 0, (byte)0x01);
});
checkWMTE(() -> { // index reference class
! byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, Class.class, byte.class)).
invokeExact(array, Void.class, (byte)0x01);
});
// Incorrect return type
checkWMTE(() -> { // reference class
! Void r = (Void) hs.get(am, methodType(Void.class, byte[].class, int.class, byte.class)).
invokeExact(array, 0, (byte)0x01);
});
checkWMTE(() -> { // primitive class
! boolean x = (boolean) hs.get(am, methodType(boolean.class, byte[].class, int.class, byte.class)).
invokeExact(array, 0, (byte)0x01);
});
// Incorrect arity
checkWMTE(() -> { // 0
! byte x = (byte) hs.get(am, methodType(byte.class)).
invokeExact();
});
checkWMTE(() -> { // >
! byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, int.class, byte.class, Class.class)).
invokeExact(array, 0, (byte)0x01, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
// Incorrect argument types
checkNPE(() -> { // null array
! byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, int.class, byte.class)).
invokeExact((byte[]) null, 0, (byte)0x01);
});
hs.checkWMTEOrCCE(() -> { // array reference class
! byte x = (byte) hs.get(am, methodType(byte.class, Class.class, int.class, byte.class)).
invokeExact(Void.class, 0, (byte)0x01);
});
checkWMTE(() -> { // value reference class
! byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, int.class, Class.class)).
invokeExact(array, 0, Void.class);
});
checkWMTE(() -> { // array primitive class
! byte x = (byte) hs.get(am, methodType(byte.class, int.class, int.class, byte.class)).
invokeExact(0, 0, (byte)0x01);
});
checkWMTE(() -> { // index reference class
! byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, Class.class, byte.class)).
invokeExact(array, Void.class, (byte)0x01);
});
// Incorrect return type
checkWMTE(() -> { // reference class
! Void r = (Void) hs.get(am, methodType(Void.class, byte[].class, int.class, byte.class)).
invokeExact(array, 0, (byte)0x01);
});
checkWMTE(() -> { // primitive class
! boolean x = (boolean) hs.get(am, methodType(boolean.class, byte[].class, int.class, byte.class)).
invokeExact(array, 0, (byte)0x01);
});
// Incorrect arity
checkWMTE(() -> { // 0
! byte x = (byte) hs.get(am, methodType(byte.class)).
invokeExact();
});
checkWMTE(() -> { // >
! byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, int.class, byte.class, Class.class)).
invokeExact(array, 0, (byte)0x01, Void.class);
});
}
}
}
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
! boolean r = (boolean) hs.get(am, methodType(boolean.class, byte[].class, int.class, type, type)).
invokeExact((byte[]) null, 0, (byte)0x01, (byte)0x01);
});
hs.checkWMTEOrCCE(() -> { // receiver reference class
! boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, int.class, type, type)).
invokeExact(Void.class, 0, (byte)0x01, (byte)0x01);
});
checkWMTE(() -> { // expected reference class
! boolean r = (boolean) hs.get(am, methodType(boolean.class, byte[].class, int.class, Class.class, type)).
invokeExact(array, 0, Void.class, (byte)0x01);
});
checkWMTE(() -> { // actual reference class
! boolean r = (boolean) hs.get(am, methodType(boolean.class, byte[].class, int.class, type, Class.class)).
invokeExact(array, 0, (byte)0x01, Void.class);
});
checkWMTE(() -> { // receiver primitive class
! boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class, int.class, type, type)).
invokeExact(0, 0, (byte)0x01, (byte)0x01);
});
checkWMTE(() -> { // index reference class
! boolean r = (boolean) hs.get(am, methodType(boolean.class, byte[].class, Class.class, type, type)).
invokeExact(array, Void.class, (byte)0x01, (byte)0x01);
});
// Incorrect arity
checkWMTE(() -> { // 0
boolean r = (boolean) hs.get(am, methodType(boolean.class)).
invokeExact();
});
checkWMTE(() -> { // >
! boolean r = (boolean) hs.get(am, methodType(boolean.class, byte[].class, int.class, type, type, Class.class)).
invokeExact(array, 0, (byte)0x01, (byte)0x01, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
! byte x = (byte) hs.get(am, methodType(type, byte[].class, int.class, type, type)).
invokeExact((byte[]) null, 0, (byte)0x01, (byte)0x01);
});
hs.checkWMTEOrCCE(() -> { // array reference class
! byte x = (byte) hs.get(am, methodType(type, Class.class, int.class, type, type)).
invokeExact(Void.class, 0, (byte)0x01, (byte)0x01);
});
checkWMTE(() -> { // expected reference class
! byte x = (byte) hs.get(am, methodType(type, byte[].class, int.class, Class.class, type)).
invokeExact(array, 0, Void.class, (byte)0x01);
});
checkWMTE(() -> { // actual reference class
! byte x = (byte) hs.get(am, methodType(type, byte[].class, int.class, type, Class.class)).
invokeExact(array, 0, (byte)0x01, Void.class);
});
checkWMTE(() -> { // array primitive class
! byte x = (byte) hs.get(am, methodType(type, int.class, int.class, type, type)).
invokeExact(0, 0, (byte)0x01, (byte)0x01);
});
checkWMTE(() -> { // index reference class
! byte x = (byte) hs.get(am, methodType(type, byte[].class, Class.class, type, type)).
invokeExact(array, Void.class, (byte)0x01, (byte)0x01);
});
// Incorrect return type
checkWMTE(() -> { // reference class
! Void r = (Void) hs.get(am, methodType(Void.class, byte[].class, int.class, type, type)).
invokeExact(array, 0, (byte)0x01, (byte)0x01);
});
checkWMTE(() -> { // primitive class
! boolean x = (boolean) hs.get(am, methodType(boolean.class, byte[].class, int.class, type, type)).
invokeExact(array, 0, (byte)0x01, (byte)0x01);
});
// Incorrect arity
checkWMTE(() -> { // 0
! byte x = (byte) hs.get(am, methodType(type)).
invokeExact();
});
checkWMTE(() -> { // >
! byte x = (byte) hs.get(am, methodType(type, byte[].class, int.class, type, type, Class.class)).
invokeExact(array, 0, (byte)0x01, (byte)0x01, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
// Incorrect argument types
checkNPE(() -> { // null array
! byte x = (byte) hs.get(am, methodType(type, byte[].class, int.class, type)).
invokeExact((byte[]) null, 0, (byte)0x01);
});
hs.checkWMTEOrCCE(() -> { // array reference class
! byte x = (byte) hs.get(am, methodType(type, Class.class, int.class, type)).
invokeExact(Void.class, 0, (byte)0x01);
});
checkWMTE(() -> { // value reference class
! byte x = (byte) hs.get(am, methodType(type, byte[].class, int.class, Class.class)).
invokeExact(array, 0, Void.class);
});
checkWMTE(() -> { // array primitive class
! byte x = (byte) hs.get(am, methodType(type, int.class, int.class, type)).
invokeExact(0, 0, (byte)0x01);
});
checkWMTE(() -> { // index reference class
! byte x = (byte) hs.get(am, methodType(type, byte[].class, Class.class, type)).
invokeExact(array, Void.class, (byte)0x01);
});
// Incorrect return type
checkWMTE(() -> { // reference class
! Void r = (Void) hs.get(am, methodType(Void.class, byte[].class, int.class, type)).
invokeExact(array, 0, (byte)0x01);
});
checkWMTE(() -> { // primitive class
! boolean x = (boolean) hs.get(am, methodType(boolean.class, byte[].class, int.class, type)).
invokeExact(array, 0, (byte)0x01);
});
// Incorrect arity
checkWMTE(() -> { // 0
! byte x = (byte) hs.get(am, methodType(type)).
invokeExact();
});
checkWMTE(() -> { // >
! byte x = (byte) hs.get(am, methodType(type, byte[].class, int.class, type, Class.class)).
invokeExact(array, 0, (byte)0x01, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
// Incorrect argument types
checkNPE(() -> { // null array
! byte x = (byte) hs.get(am, methodType(type, byte[].class, int.class, type)).
invokeExact((byte[]) null, 0, (byte)0x01);
});
hs.checkWMTEOrCCE(() -> { // array reference class
! byte x = (byte) hs.get(am, methodType(type, Class.class, int.class, type)).
invokeExact(Void.class, 0, (byte)0x01);
});
checkWMTE(() -> { // value reference class
! byte x = (byte) hs.get(am, methodType(type, byte[].class, int.class, Class.class)).
invokeExact(array, 0, Void.class);
});
checkWMTE(() -> { // array primitive class
! byte x = (byte) hs.get(am, methodType(type, int.class, int.class, type)).
invokeExact(0, 0, (byte)0x01);
});
checkWMTE(() -> { // index reference class
! byte x = (byte) hs.get(am, methodType(type, byte[].class, Class.class, type)).
invokeExact(array, Void.class, (byte)0x01);
});
// Incorrect return type
checkWMTE(() -> { // reference class
! Void r = (Void) hs.get(am, methodType(Void.class, byte[].class, int.class, type)).
invokeExact(array, 0, (byte)0x01);
});
checkWMTE(() -> { // primitive class
! boolean x = (boolean) hs.get(am, methodType(boolean.class, byte[].class, int.class, type)).
invokeExact(array, 0, (byte)0x01);
});
// Incorrect arity
checkWMTE(() -> { // 0
! byte x = (byte) hs.get(am, methodType(type)).
invokeExact();
});
checkWMTE(() -> { // >
! byte x = (byte) hs.get(am, methodType(type, byte[].class, int.class, type, Class.class)).
invokeExact(array, 0, (byte)0x01, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) {
// Incorrect argument types
checkNPE(() -> { // null array
! byte x = (byte) hs.get(am, methodType(type, byte[].class, int.class, type)).
invokeExact((byte[]) null, 0, (byte)0x01);
});
hs.checkWMTEOrCCE(() -> { // array reference class
! byte x = (byte) hs.get(am, methodType(type, Class.class, int.class, type)).
invokeExact(Void.class, 0, (byte)0x01);
});
checkWMTE(() -> { // value reference class
! byte x = (byte) hs.get(am, methodType(type, byte[].class, int.class, Class.class)).
invokeExact(array, 0, Void.class);
});
checkWMTE(() -> { // array primitive class
! byte x = (byte) hs.get(am, methodType(type, int.class, int.class, type)).
invokeExact(0, 0, (byte)0x01);
});
checkWMTE(() -> { // index reference class
! byte x = (byte) hs.get(am, methodType(type, byte[].class, Class.class, type)).
invokeExact(array, Void.class, (byte)0x01);
});
// Incorrect return type
checkWMTE(() -> { // reference class
! Void r = (Void) hs.get(am, methodType(Void.class, byte[].class, int.class, type)).
invokeExact(array, 0, (byte)0x01);
});
checkWMTE(() -> { // primitive class
! boolean x = (boolean) hs.get(am, methodType(boolean.class, byte[].class, int.class, type)).
invokeExact(array, 0, (byte)0x01);
});
// Incorrect arity
checkWMTE(() -> { // 0
! byte x = (byte) hs.get(am, methodType(type)).
invokeExact();
});
checkWMTE(() -> { // >
! byte x = (byte) hs.get(am, methodType(type, byte[].class, int.class, type, Class.class)).
invokeExact(array, 0, (byte)0x01, Void.class);
});
}
}
}
< prev index next >