8156485: MethodHandles.varHandleExactInvoker should perform exact checks
Reviewed-by: vlivanov
--- a/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java Tue May 17 12:06:41 2016 +0200
@@ -95,12 +95,12 @@
/*non-public*/ MethodHandle varHandleMethodInvoker(VarHandle.AccessMode ak) {
// TODO cache invoker
- return makeVarHandleMethodInvoker(ak);
+ return makeVarHandleMethodInvoker(ak, false);
}
/*non-public*/ MethodHandle varHandleMethodExactInvoker(VarHandle.AccessMode ak) {
// TODO cache invoker
- return makeVarHandleMethodExactInvoker(ak);
+ return makeVarHandleMethodInvoker(ak, true);
}
private MethodHandle cachedInvoker(int idx) {
@@ -127,26 +127,11 @@
return invoker;
}
- private MethodHandle makeVarHandleMethodInvoker(VarHandle.AccessMode ak) {
+ private MethodHandle makeVarHandleMethodInvoker(VarHandle.AccessMode ak, boolean isExact) {
MethodType mtype = targetType;
MethodType invokerType = mtype.insertParameterTypes(0, VarHandle.class);
- LambdaForm lform = varHandleMethodGenericInvokerHandleForm(ak.methodName(), mtype);
- VarHandle.AccessDescriptor ad = new VarHandle.AccessDescriptor(mtype, ak.at.ordinal(), ak.ordinal());
- MethodHandle invoker = BoundMethodHandle.bindSingle(invokerType, lform, ad);
-
- invoker = invoker.withInternalMemberName(MemberName.makeVarHandleMethodInvoke(ak.methodName(), mtype), false);
- assert(checkVarHandleInvoker(invoker));
-
- maybeCompileToBytecode(invoker);
- return invoker;
- }
-
- private MethodHandle makeVarHandleMethodExactInvoker(VarHandle.AccessMode ak) {
- MethodType mtype = targetType;
- MethodType invokerType = mtype.insertParameterTypes(0, VarHandle.class);
-
- LambdaForm lform = varHandleMethodExactInvokerHandleForm(ak.methodName(), mtype);
+ LambdaForm lform = varHandleMethodInvokerHandleForm(ak.methodName(), mtype, isExact);
VarHandle.AccessDescriptor ad = new VarHandle.AccessDescriptor(mtype, ak.at.ordinal(), ak.ordinal());
MethodHandle invoker = BoundMethodHandle.bindSingle(invokerType, lform, ad);
@@ -400,59 +385,7 @@
return lform;
}
- private static LambdaForm varHandleMethodExactInvokerHandleForm(String name, MethodType mtype) {
- // TODO Cache form?
-
- final int THIS_MH = 0;
- final int CALL_VH = THIS_MH + 1;
- final int ARG_BASE = CALL_VH + 1;
- final int ARG_LIMIT = ARG_BASE + mtype.parameterCount();
- int nameCursor = ARG_LIMIT;
- final int VAD_ARG = nameCursor++;
- final int CHECK_TYPE = nameCursor++;
- final int GET_MEMBER = nameCursor++;
- final int LINKER_CALL = nameCursor++;
-
- MethodType invokerFormType = mtype.insertParameterTypes(0, VarHandle.class)
- .basicType()
- .appendParameterTypes(MemberName.class);
-
- MemberName linker = new MemberName(MethodHandle.class, "linkToStatic", invokerFormType, REF_invokeStatic);
- try {
- linker = MemberName.getFactory().resolveOrFail(REF_invokeStatic, linker, null, NoSuchMethodException.class);
- } catch (ReflectiveOperationException ex) {
- throw newInternalError(ex);
- }
-
- Name[] names = new Name[LINKER_CALL + 1];
- names[THIS_MH] = argument(THIS_MH, BasicType.basicType(Object.class));
- names[CALL_VH] = argument(CALL_VH, BasicType.basicType(Object.class));
- for (int i = 0; i < mtype.parameterCount(); i++) {
- names[ARG_BASE + i] = argument(ARG_BASE + i, BasicType.basicType(mtype.parameterType(i)));
- }
-
- BoundMethodHandle.SpeciesData speciesData = BoundMethodHandle.speciesData_L();
- names[THIS_MH] = names[THIS_MH].withConstraint(speciesData);
-
- NamedFunction getter = speciesData.getterFunction(0);
- names[VAD_ARG] = new Name(getter, names[THIS_MH]);
-
- Object[] outArgs = Arrays.copyOfRange(names, CALL_VH, ARG_LIMIT + 1, Object[].class);
-
- names[CHECK_TYPE] = new Name(NF_checkVarHandleExactType, names[CALL_VH], names[VAD_ARG]);
-
- names[GET_MEMBER] = new Name(NF_getVarHandleMemberName, names[CALL_VH], names[VAD_ARG]);
- outArgs[outArgs.length - 1] = names[GET_MEMBER];
-
- names[LINKER_CALL] = new Name(linker, outArgs);
- LambdaForm lform = new LambdaForm(name + ":VarHandle_exactInvoker" + shortenSignature(basicTypeSignature(mtype)),
- ARG_LIMIT, names);
-
- lform.compileToBytecode();
- return lform;
- }
-
- private static LambdaForm varHandleMethodGenericInvokerHandleForm(String name, MethodType mtype) {
+ private static LambdaForm varHandleMethodInvokerHandleForm(String name, MethodType mtype, boolean isExact) {
// TODO Cache form?
final int THIS_MH = 0;
@@ -477,8 +410,11 @@
NamedFunction getter = speciesData.getterFunction(0);
names[VAD_ARG] = new Name(getter, names[THIS_MH]);
- names[CHECK_TYPE] = new Name(NF_checkVarHandleGenericType, names[CALL_VH], names[VAD_ARG]);
-
+ if (isExact) {
+ names[CHECK_TYPE] = new Name(NF_checkVarHandleExactType, names[CALL_VH], names[VAD_ARG]);
+ } else {
+ names[CHECK_TYPE] = new Name(NF_checkVarHandleGenericType, names[CALL_VH], names[VAD_ARG]);
+ }
Object[] outArgs = new Object[ARG_LIMIT];
outArgs[0] = names[CHECK_TYPE];
for (int i = 1; i < ARG_LIMIT; i++) {
@@ -488,7 +424,8 @@
MethodType outCallType = mtype.insertParameterTypes(0, VarHandle.class)
.basicType();
names[LINKER_CALL] = new Name(outCallType, outArgs);
- LambdaForm lform = new LambdaForm(name + ":VarHandle_invoker" + shortenSignature(basicTypeSignature(mtype)),
+ String debugName = isExact ? ":VarHandle_exactInvoker" : ":VarHandle_invoker";
+ LambdaForm lform = new LambdaForm(name + debugName + shortenSignature(basicTypeSignature(mtype)),
ARG_LIMIT, names);
lform.prepare();
@@ -511,21 +448,13 @@
/*non-public*/ static
@ForceInline
- void checkVarHandleExactType(VarHandle handle, VarHandle.AccessDescriptor ad) {
- MethodType erasedTarget = handle.vform.methodType_table[ad.type];
- MethodType erasedSymbolic = ad.symbolicMethodTypeErased;
- if (erasedTarget != erasedSymbolic)
- throw newWrongMethodTypeException(erasedTarget, erasedSymbolic);
- }
-
- /*non-public*/ static
- @ForceInline
- MemberName getVarHandleMemberName(VarHandle handle, VarHandle.AccessDescriptor ad) {
- MemberName mn = handle.vform.memberName_table[ad.mode];
- if (mn == null) {
- throw handle.unsupported();
+ MethodHandle checkVarHandleExactType(VarHandle handle, VarHandle.AccessDescriptor ad) {
+ MethodHandle mh = handle.getMethodHandle(ad.mode);
+ MethodType mt = mh.type();
+ if (mt != ad.symbolicMethodTypeInvoker) {
+ throw newWrongMethodTypeException(mt, ad.symbolicMethodTypeInvoker);
}
- return mn;
+ return mh;
}
/*non-public*/ static
@@ -649,8 +578,7 @@
NF_getCallSiteTarget,
NF_checkCustomized,
NF_checkVarHandleGenericType,
- NF_checkVarHandleExactType,
- NF_getVarHandleMemberName;
+ NF_checkVarHandleExactType;
static {
try {
NamedFunction nfs[] = {
@@ -666,8 +594,6 @@
.getDeclaredMethod("checkVarHandleGenericType", VarHandle.class, VarHandle.AccessDescriptor.class)),
NF_checkVarHandleExactType = new NamedFunction(Invokers.class
.getDeclaredMethod("checkVarHandleExactType", VarHandle.class, VarHandle.AccessDescriptor.class)),
- NF_getVarHandleMemberName = new NamedFunction(Invokers.class
- .getDeclaredMethod("getVarHandleMemberName", VarHandle.class, VarHandle.AccessDescriptor.class))
};
// Each nf must be statically invocable or we get tied up in our bootstraps.
assert(InvokerBytecodeGenerator.isStaticallyInvocable(nfs));
--- a/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java Tue May 17 12:06:41 2016 +0200
@@ -1475,11 +1475,11 @@
TypesAndInvokers tis = getTypesAndInvokers();
MethodHandle mh = tis.methodHandle_table[mode];
if (mh == null) {
- mh = tis.methodHandle_table[mode] = getMethodHandleUncached(tis, mode);
+ mh = tis.methodHandle_table[mode] = getMethodHandleUncached(mode);
}
return mh;
}
- private final MethodHandle getMethodHandleUncached(TypesAndInvokers tis, int mode) {
+ private final MethodHandle getMethodHandleUncached(int mode) {
MethodType mt = accessModeType(AccessMode.values()[mode]).
insertParameterTypes(0, VarHandle.class);
MemberName mn = vform.getMemberName(mode);
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleBaseTest.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleBaseTest.java Tue May 17 12:06:41 2016 +0200
@@ -211,7 +211,6 @@
}
static MethodHandle findVirtual(VarHandle vh, TestAccessMode tam, MethodType mt) {
- mt = vh.accessModeType(tam.toAccessMode());
MethodHandle mh;
try {
mh = MethodHandles.publicLookup().
@@ -221,36 +220,26 @@
} catch (Exception e) {
throw new RuntimeException(e);
}
- return bind(vh, tam, mh, mt);
+ return bind(vh, mh, mt);
}
- static MethodHandle varHandleInvokerWithAccessModeType(VarHandle vh, TestAccessMode tam, MethodType mt) {
- mt = vh.accessModeType(tam.toAccessMode());
+ static MethodHandle varHandleInvoker(VarHandle vh, TestAccessMode tam, MethodType mt) {
MethodHandle mh = MethodHandles.varHandleInvoker(
tam.toAccessMode(),
mt);
- return bind(vh, tam, mh, mt);
+ return bind(vh, mh, mt);
}
- static MethodHandle varHandleInvokerWithSymbolicTypeDescriptor(VarHandle vh, TestAccessMode tam, MethodType mt) {
- MethodHandle mh = MethodHandles.varHandleInvoker(
- tam.toAccessMode(),
- mt);
-
- return bind(vh, tam, mh, mt);
- }
-
- static MethodHandle varHandleExactInvokerWithAccessModeType(VarHandle vh, TestAccessMode tam, MethodType mt) {
- mt = vh.accessModeType(tam.toAccessMode());
+ static MethodHandle varHandleExactInvoker(VarHandle vh, TestAccessMode tam, MethodType mt) {
MethodHandle mh = MethodHandles.varHandleExactInvoker(
tam.toAccessMode(),
mt);
- return bind(vh, tam, mh, mt);
+ return bind(vh, mh, mt);
}
- private static MethodHandle bind(VarHandle vh, TestAccessMode testAccessMode, MethodHandle mh, MethodType emt) {
+ private static MethodHandle bind(VarHandle vh, MethodHandle mh, MethodType emt) {
assertEquals(mh.type(), emt.insertParameterTypes(0, VarHandle.class),
"MethodHandle type differs from access mode type");
@@ -268,33 +257,30 @@
enum VarHandleToMethodHandle {
VAR_HANDLE_TO_METHOD_HANDLE(
"VarHandle.toMethodHandle",
+ true,
VarHandleBaseTest::toMethodHandle),
METHOD_HANDLES_LOOKUP_FIND_VIRTUAL(
"Lookup.findVirtual",
+ false,
VarHandleBaseTest::findVirtual),
- METHOD_HANDLES_VAR_HANDLE_INVOKER_WITH_ACCESS_MODE_TYPE(
- "MethodHandles.varHandleInvoker(accessModeType)",
- VarHandleBaseTest::varHandleInvokerWithAccessModeType),
- METHOD_HANDLES_VAR_HANDLE_INVOKER_WITH_SYMBOLIC_TYPE_DESCRIPTOR(
- "MethodHandles.varHandleInvoker(symbolicTypeDescriptor)",
- VarHandleBaseTest::varHandleInvokerWithSymbolicTypeDescriptor),
- METHOD_HANDLES_VAR_HANDLE_EXACT_INVOKER_WITH_ACCESS_MODE_TYPE(
- "MethodHandles.varHandleExactInvoker(accessModeType)",
- VarHandleBaseTest::varHandleExactInvokerWithAccessModeType);
+ METHOD_HANDLES_VAR_HANDLE_INVOKER(
+ "MethodHandles.varHandleInvoker",
+ false,
+ VarHandleBaseTest::varHandleInvoker),
+ METHOD_HANDLES_VAR_HANDLE_EXACT_INVOKER(
+ "MethodHandles.varHandleExactInvoker",
+ true,
+ VarHandleBaseTest::varHandleExactInvoker);
final String desc;
+ final boolean isExact;
final TriFunction<VarHandle, TestAccessMode, MethodType, MethodHandle> f;
- final boolean exact;
- VarHandleToMethodHandle(String desc, TriFunction<VarHandle, TestAccessMode, MethodType, MethodHandle> f) {
- this(desc, f, false);
- }
-
- VarHandleToMethodHandle(String desc, TriFunction<VarHandle, TestAccessMode, MethodType, MethodHandle> f,
- boolean exact) {
+ VarHandleToMethodHandle(String desc, boolean isExact,
+ TriFunction<VarHandle, TestAccessMode, MethodType, MethodHandle> f) {
this.desc = desc;
this.f = f;
- this.exact = exact;
+ this.isExact = isExact;
}
MethodHandle apply(VarHandle vh, TestAccessMode am, MethodType mt) {
@@ -363,6 +349,15 @@
return amToHandle.computeIfAbsent(
amt, k -> f.apply(vh, am, mt));
}
+
+ Class<? extends Throwable> getWMTEOOrOther(Class<? extends Throwable> c) {
+ return f.isExact ? WrongMethodTypeException.class : c;
+ }
+
+ void checkWMTEOrCCE(ThrowingRunnable r) {
+ checkWithThrowable(getWMTEOOrOther(ClassCastException.class), null, r);
+ }
+
}
interface AccessTestAction<T> {
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java Tue May 17 12:06:41 2016 +0200
@@ -27,6 +27,7 @@
* @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestAccessBoolean
* @run testng/othervm -Diters=20000 VarHandleTestAccessBoolean
* @run testng/othervm -Diters=20000 -XX:-TieredCompilation VarHandleTestAccessBoolean
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestAccessBoolean
*/
import org.testng.annotations.BeforeClass;
@@ -293,6 +294,10 @@
});
checkUOE(() -> {
+ boolean r = (boolean) vh.getAndSet(recv, true);
+ });
+
+ checkUOE(() -> {
boolean o = (boolean) vh.getAndAdd(recv, true);
});
@@ -379,6 +384,10 @@
});
checkUOE(() -> {
+ boolean r = (boolean) vh.getAndSet(true);
+ });
+
+ checkUOE(() -> {
boolean o = (boolean) vh.getAndAdd(true);
});
@@ -455,6 +464,10 @@
});
checkUOE(() -> {
+ boolean r = (boolean) vh.getAndSet(recv, true);
+ });
+
+ checkUOE(() -> {
boolean o = (boolean) vh.getAndAdd(recv, true);
});
@@ -531,6 +544,10 @@
});
checkUOE(() -> {
+ boolean r = (boolean) vh.getAndSet(true);
+ });
+
+ checkUOE(() -> {
boolean o = (boolean) vh.getAndAdd(true);
});
@@ -614,6 +631,10 @@
});
checkUOE(() -> {
+ boolean r = (boolean) vh.getAndSet(array, i, true);
+ });
+
+ checkUOE(() -> {
boolean o = (boolean) vh.getAndAdd(array, i, true);
});
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java Tue May 17 12:06:41 2016 +0200
@@ -27,6 +27,7 @@
* @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestAccessByte
* @run testng/othervm -Diters=20000 VarHandleTestAccessByte
* @run testng/othervm -Diters=20000 -XX:-TieredCompilation VarHandleTestAccessByte
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestAccessByte
*/
import org.testng.annotations.BeforeClass;
@@ -293,6 +294,10 @@
});
checkUOE(() -> {
+ byte r = (byte) vh.getAndSet(recv, (byte)1);
+ });
+
+ checkUOE(() -> {
byte o = (byte) vh.getAndAdd(recv, (byte)1);
});
@@ -379,6 +384,10 @@
});
checkUOE(() -> {
+ byte r = (byte) vh.getAndSet((byte)1);
+ });
+
+ checkUOE(() -> {
byte o = (byte) vh.getAndAdd((byte)1);
});
@@ -455,6 +464,10 @@
});
checkUOE(() -> {
+ byte r = (byte) vh.getAndSet(recv, (byte)1);
+ });
+
+ checkUOE(() -> {
byte o = (byte) vh.getAndAdd(recv, (byte)1);
});
@@ -531,6 +544,10 @@
});
checkUOE(() -> {
+ byte r = (byte) vh.getAndSet((byte)1);
+ });
+
+ checkUOE(() -> {
byte o = (byte) vh.getAndAdd((byte)1);
});
@@ -614,6 +631,10 @@
});
checkUOE(() -> {
+ byte r = (byte) vh.getAndSet(array, i, (byte)1);
+ });
+
+ checkUOE(() -> {
byte o = (byte) vh.getAndAdd(array, i, (byte)1);
});
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java Tue May 17 12:06:41 2016 +0200
@@ -27,6 +27,7 @@
* @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestAccessChar
* @run testng/othervm -Diters=20000 VarHandleTestAccessChar
* @run testng/othervm -Diters=20000 -XX:-TieredCompilation VarHandleTestAccessChar
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestAccessChar
*/
import org.testng.annotations.BeforeClass;
@@ -293,6 +294,10 @@
});
checkUOE(() -> {
+ char r = (char) vh.getAndSet(recv, 'a');
+ });
+
+ checkUOE(() -> {
char o = (char) vh.getAndAdd(recv, 'a');
});
@@ -379,6 +384,10 @@
});
checkUOE(() -> {
+ char r = (char) vh.getAndSet('a');
+ });
+
+ checkUOE(() -> {
char o = (char) vh.getAndAdd('a');
});
@@ -455,6 +464,10 @@
});
checkUOE(() -> {
+ char r = (char) vh.getAndSet(recv, 'a');
+ });
+
+ checkUOE(() -> {
char o = (char) vh.getAndAdd(recv, 'a');
});
@@ -531,6 +544,10 @@
});
checkUOE(() -> {
+ char r = (char) vh.getAndSet('a');
+ });
+
+ checkUOE(() -> {
char o = (char) vh.getAndAdd('a');
});
@@ -614,6 +631,10 @@
});
checkUOE(() -> {
+ char r = (char) vh.getAndSet(array, i, 'a');
+ });
+
+ checkUOE(() -> {
char o = (char) vh.getAndAdd(array, i, 'a');
});
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java Tue May 17 12:06:41 2016 +0200
@@ -27,6 +27,7 @@
* @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestAccessDouble
* @run testng/othervm -Diters=20000 VarHandleTestAccessDouble
* @run testng/othervm -Diters=20000 -XX:-TieredCompilation VarHandleTestAccessDouble
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestAccessDouble
*/
import org.testng.annotations.BeforeClass;
@@ -293,6 +294,10 @@
});
checkUOE(() -> {
+ double r = (double) vh.getAndSet(recv, 1.0d);
+ });
+
+ checkUOE(() -> {
double o = (double) vh.getAndAdd(recv, 1.0d);
});
@@ -379,6 +384,10 @@
});
checkUOE(() -> {
+ double r = (double) vh.getAndSet(1.0d);
+ });
+
+ checkUOE(() -> {
double o = (double) vh.getAndAdd(1.0d);
});
@@ -455,6 +464,10 @@
});
checkUOE(() -> {
+ double r = (double) vh.getAndSet(recv, 1.0d);
+ });
+
+ checkUOE(() -> {
double o = (double) vh.getAndAdd(recv, 1.0d);
});
@@ -531,6 +544,10 @@
});
checkUOE(() -> {
+ double r = (double) vh.getAndSet(1.0d);
+ });
+
+ checkUOE(() -> {
double o = (double) vh.getAndAdd(1.0d);
});
@@ -614,6 +631,10 @@
});
checkUOE(() -> {
+ double r = (double) vh.getAndSet(array, i, 1.0d);
+ });
+
+ checkUOE(() -> {
double o = (double) vh.getAndAdd(array, i, 1.0d);
});
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java Tue May 17 12:06:41 2016 +0200
@@ -27,6 +27,7 @@
* @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestAccessFloat
* @run testng/othervm -Diters=20000 VarHandleTestAccessFloat
* @run testng/othervm -Diters=20000 -XX:-TieredCompilation VarHandleTestAccessFloat
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestAccessFloat
*/
import org.testng.annotations.BeforeClass;
@@ -293,6 +294,10 @@
});
checkUOE(() -> {
+ float r = (float) vh.getAndSet(recv, 1.0f);
+ });
+
+ checkUOE(() -> {
float o = (float) vh.getAndAdd(recv, 1.0f);
});
@@ -379,6 +384,10 @@
});
checkUOE(() -> {
+ float r = (float) vh.getAndSet(1.0f);
+ });
+
+ checkUOE(() -> {
float o = (float) vh.getAndAdd(1.0f);
});
@@ -455,6 +464,10 @@
});
checkUOE(() -> {
+ float r = (float) vh.getAndSet(recv, 1.0f);
+ });
+
+ checkUOE(() -> {
float o = (float) vh.getAndAdd(recv, 1.0f);
});
@@ -531,6 +544,10 @@
});
checkUOE(() -> {
+ float r = (float) vh.getAndSet(1.0f);
+ });
+
+ checkUOE(() -> {
float o = (float) vh.getAndAdd(1.0f);
});
@@ -614,6 +631,10 @@
});
checkUOE(() -> {
+ float r = (float) vh.getAndSet(array, i, 1.0f);
+ });
+
+ checkUOE(() -> {
float o = (float) vh.getAndAdd(array, i, 1.0f);
});
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java Tue May 17 12:06:41 2016 +0200
@@ -27,6 +27,7 @@
* @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestAccessInt
* @run testng/othervm -Diters=20000 VarHandleTestAccessInt
* @run testng/othervm -Diters=20000 -XX:-TieredCompilation VarHandleTestAccessInt
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestAccessInt
*/
import org.testng.annotations.BeforeClass;
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java Tue May 17 12:06:41 2016 +0200
@@ -27,6 +27,7 @@
* @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestAccessLong
* @run testng/othervm -Diters=20000 VarHandleTestAccessLong
* @run testng/othervm -Diters=20000 -XX:-TieredCompilation VarHandleTestAccessLong
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestAccessLong
*/
import org.testng.annotations.BeforeClass;
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java Tue May 17 12:06:41 2016 +0200
@@ -27,6 +27,7 @@
* @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestAccessShort
* @run testng/othervm -Diters=20000 VarHandleTestAccessShort
* @run testng/othervm -Diters=20000 -XX:-TieredCompilation VarHandleTestAccessShort
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestAccessShort
*/
import org.testng.annotations.BeforeClass;
@@ -293,6 +294,10 @@
});
checkUOE(() -> {
+ short r = (short) vh.getAndSet(recv, (short)1);
+ });
+
+ checkUOE(() -> {
short o = (short) vh.getAndAdd(recv, (short)1);
});
@@ -379,6 +384,10 @@
});
checkUOE(() -> {
+ short r = (short) vh.getAndSet((short)1);
+ });
+
+ checkUOE(() -> {
short o = (short) vh.getAndAdd((short)1);
});
@@ -455,6 +464,10 @@
});
checkUOE(() -> {
+ short r = (short) vh.getAndSet(recv, (short)1);
+ });
+
+ checkUOE(() -> {
short o = (short) vh.getAndAdd(recv, (short)1);
});
@@ -531,6 +544,10 @@
});
checkUOE(() -> {
+ short r = (short) vh.getAndSet((short)1);
+ });
+
+ checkUOE(() -> {
short o = (short) vh.getAndAdd((short)1);
});
@@ -614,6 +631,10 @@
});
checkUOE(() -> {
+ short r = (short) vh.getAndSet(array, i, (short)1);
+ });
+
+ checkUOE(() -> {
short o = (short) vh.getAndAdd(array, i, (short)1);
});
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessString.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessString.java Tue May 17 12:06:41 2016 +0200
@@ -27,6 +27,7 @@
* @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestAccessString
* @run testng/othervm -Diters=20000 VarHandleTestAccessString
* @run testng/othervm -Diters=20000 -XX:-TieredCompilation VarHandleTestAccessString
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestAccessString
*/
import org.testng.annotations.BeforeClass;
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java Tue May 17 12:06:41 2016 +0200
@@ -27,6 +27,7 @@
* @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsChar
* @run testng/othervm -Diters=20000 VarHandleTestByteArrayAsChar
* @run testng/othervm -Diters=20000 -XX:-TieredCompilation VarHandleTestByteArrayAsChar
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestByteArrayAsChar
*/
import org.testng.annotations.DataProvider;
@@ -254,6 +255,10 @@
vh.setOpaque(array, ci, VALUE_1);
});
checkUOE(() -> {
+ boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2);
+ });
+
+ checkUOE(() -> {
char r = (char) vh.compareAndExchangeVolatile(array, ci, VALUE_2, VALUE_1);
});
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java Tue May 17 12:06:41 2016 +0200
@@ -27,6 +27,7 @@
* @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsDouble
* @run testng/othervm -Diters=20000 VarHandleTestByteArrayAsDouble
* @run testng/othervm -Diters=20000 -XX:-TieredCompilation VarHandleTestByteArrayAsDouble
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestByteArrayAsDouble
*/
import org.testng.annotations.DataProvider;
@@ -254,9 +255,7 @@
checkROBE(() -> {
double o = (double) vh.getAndSet(array, ci, VALUE_1);
});
- checkUOE(() -> {
- boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2);
- });
+
checkUOE(() -> {
double o = (double) vh.getAndAdd(array, ci, VALUE_1);
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java Tue May 17 12:06:41 2016 +0200
@@ -27,6 +27,7 @@
* @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsFloat
* @run testng/othervm -Diters=20000 VarHandleTestByteArrayAsFloat
* @run testng/othervm -Diters=20000 -XX:-TieredCompilation VarHandleTestByteArrayAsFloat
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestByteArrayAsFloat
*/
import org.testng.annotations.DataProvider;
@@ -254,9 +255,7 @@
checkROBE(() -> {
float o = (float) vh.getAndSet(array, ci, VALUE_1);
});
- checkUOE(() -> {
- boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2);
- });
+
checkUOE(() -> {
float o = (float) vh.getAndAdd(array, ci, VALUE_1);
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java Tue May 17 12:06:41 2016 +0200
@@ -27,6 +27,7 @@
* @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsInt
* @run testng/othervm -Diters=20000 VarHandleTestByteArrayAsInt
* @run testng/othervm -Diters=20000 -XX:-TieredCompilation VarHandleTestByteArrayAsInt
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestByteArrayAsInt
*/
import org.testng.annotations.DataProvider;
@@ -247,9 +248,7 @@
checkROBE(() -> {
int o = (int) vh.getAndSet(array, ci, VALUE_1);
});
- checkUOE(() -> {
- boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2);
- });
+
checkROBE(() -> {
int o = (int) vh.getAndAdd(array, ci, VALUE_1);
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java Tue May 17 12:06:41 2016 +0200
@@ -27,6 +27,7 @@
* @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsLong
* @run testng/othervm -Diters=20000 VarHandleTestByteArrayAsLong
* @run testng/othervm -Diters=20000 -XX:-TieredCompilation VarHandleTestByteArrayAsLong
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestByteArrayAsLong
*/
import org.testng.annotations.DataProvider;
@@ -247,9 +248,7 @@
checkROBE(() -> {
long o = (long) vh.getAndSet(array, ci, VALUE_1);
});
- checkUOE(() -> {
- boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2);
- });
+
checkROBE(() -> {
long o = (long) vh.getAndAdd(array, ci, VALUE_1);
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java Tue May 17 12:06:41 2016 +0200
@@ -27,6 +27,7 @@
* @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsShort
* @run testng/othervm -Diters=20000 VarHandleTestByteArrayAsShort
* @run testng/othervm -Diters=20000 -XX:-TieredCompilation VarHandleTestByteArrayAsShort
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestByteArrayAsShort
*/
import org.testng.annotations.DataProvider;
@@ -254,6 +255,10 @@
vh.setOpaque(array, ci, VALUE_1);
});
checkUOE(() -> {
+ boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2);
+ });
+
+ checkUOE(() -> {
short r = (short) vh.compareAndExchangeVolatile(array, ci, VALUE_2, VALUE_1);
});
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessBoolean.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessBoolean.java Tue May 17 12:06:41 2016 +0200
@@ -24,6 +24,7 @@
/*
* @test
* @run testng/othervm -Diters=20000 VarHandleTestMethodHandleAccessBoolean
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodHandleAccessBoolean
*/
import org.testng.annotations.BeforeClass;
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessByte.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessByte.java Tue May 17 12:06:41 2016 +0200
@@ -24,6 +24,7 @@
/*
* @test
* @run testng/othervm -Diters=20000 VarHandleTestMethodHandleAccessByte
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodHandleAccessByte
*/
import org.testng.annotations.BeforeClass;
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessChar.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessChar.java Tue May 17 12:06:41 2016 +0200
@@ -24,6 +24,7 @@
/*
* @test
* @run testng/othervm -Diters=20000 VarHandleTestMethodHandleAccessChar
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodHandleAccessChar
*/
import org.testng.annotations.BeforeClass;
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessDouble.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessDouble.java Tue May 17 12:06:41 2016 +0200
@@ -24,6 +24,7 @@
/*
* @test
* @run testng/othervm -Diters=20000 VarHandleTestMethodHandleAccessDouble
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodHandleAccessDouble
*/
import org.testng.annotations.BeforeClass;
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessFloat.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessFloat.java Tue May 17 12:06:41 2016 +0200
@@ -24,6 +24,7 @@
/*
* @test
* @run testng/othervm -Diters=20000 VarHandleTestMethodHandleAccessFloat
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodHandleAccessFloat
*/
import org.testng.annotations.BeforeClass;
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java Tue May 17 12:06:41 2016 +0200
@@ -24,6 +24,7 @@
/*
* @test
* @run testng/othervm -Diters=20000 VarHandleTestMethodHandleAccessInt
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodHandleAccessInt
*/
import org.testng.annotations.BeforeClass;
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java Tue May 17 12:06:41 2016 +0200
@@ -24,6 +24,7 @@
/*
* @test
* @run testng/othervm -Diters=20000 VarHandleTestMethodHandleAccessLong
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodHandleAccessLong
*/
import org.testng.annotations.BeforeClass;
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessShort.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessShort.java Tue May 17 12:06:41 2016 +0200
@@ -24,6 +24,7 @@
/*
* @test
* @run testng/othervm -Diters=20000 VarHandleTestMethodHandleAccessShort
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodHandleAccessShort
*/
import org.testng.annotations.BeforeClass;
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java Tue May 17 12:06:41 2016 +0200
@@ -24,6 +24,7 @@
/*
* @test
* @run testng/othervm -Diters=20000 VarHandleTestMethodHandleAccessString
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodHandleAccessString
*/
import org.testng.annotations.BeforeClass;
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeBoolean.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeBoolean.java Tue May 17 12:06:41 2016 +0200
@@ -23,6 +23,7 @@
/*
* @test
+ * @bug 8156486
* @run testng/othervm VarHandleTestMethodTypeBoolean
* @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodTypeBoolean
*/
@@ -81,27 +82,28 @@
public Object[][] accessTestCaseProvider() throws Exception {
List<AccessTestCase<?>> cases = new ArrayList<>();
- cases.add(new VarHandleAccessTestCase("Instance field wrong method type",
+ cases.add(new VarHandleAccessTestCase("Instance field",
vhField, vh -> testInstanceFieldWrongMethodType(this, vh),
false));
- cases.add(new VarHandleAccessTestCase("Static field wrong method type",
+ cases.add(new VarHandleAccessTestCase("Static field",
vhStaticField, VarHandleTestMethodTypeBoolean::testStaticFieldWrongMethodType,
false));
- cases.add(new VarHandleAccessTestCase("Array wrong method type",
+ cases.add(new VarHandleAccessTestCase("Array",
vhArray, VarHandleTestMethodTypeBoolean::testArrayWrongMethodType,
false));
+
for (VarHandleToMethodHandle f : VarHandleToMethodHandle.values()) {
- cases.add(new MethodHandleAccessTestCase("Instance field wrong method type",
+ cases.add(new MethodHandleAccessTestCase("Instance field",
vhField, f, hs -> testInstanceFieldWrongMethodType(this, hs),
false));
- cases.add(new MethodHandleAccessTestCase("Static field wrong method type",
+ cases.add(new MethodHandleAccessTestCase("Static field",
vhStaticField, f, VarHandleTestMethodTypeBoolean::testStaticFieldWrongMethodType,
false));
- cases.add(new MethodHandleAccessTestCase("Array wrong method type",
+ cases.add(new MethodHandleAccessTestCase("Array",
vhArray, f, VarHandleTestMethodTypeBoolean::testArrayWrongMethodType,
false));
}
@@ -329,63 +331,63 @@
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
- boolean x = (boolean) hs.get(am, methodType(boolean.class, Void.class)).
- invoke(null);
+ boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeBoolean.class)).
+ invokeExact((VarHandleTestMethodTypeBoolean) null);
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
boolean x = (boolean) hs.get(am, methodType(boolean.class, Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
checkWMTE(() -> { // receiver primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, int.class)).
- invoke(0);
+ invokeExact(0);
});
// Incorrect return type
checkWMTE(() -> { // reference class
- Void x = (Void) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeBoolean.class)).
- invoke(recv);
+ Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeBoolean.class)).
+ invokeExact(recv);
});
checkWMTE(() -> { // primitive class
int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeBoolean.class)).
- invoke(recv);
+ invokeExact(recv);
});
// Incorrect arity
checkWMTE(() -> { // 0
boolean x = (boolean) hs.get(am, methodType(boolean.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeBoolean.class, Class.class)).
- invoke(recv, Void.class);
+ invokeExact(recv, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
- hs.get(am, methodType(void.class, Void.class, boolean.class)).
- invoke(null, true);
+ hs.get(am, methodType(void.class, VarHandleTestMethodTypeBoolean.class, boolean.class)).
+ invokeExact((VarHandleTestMethodTypeBoolean) null, true);
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
hs.get(am, methodType(void.class, Class.class, boolean.class)).
- invoke(Void.class, true);
+ invokeExact(Void.class, true);
});
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, VarHandleTestMethodTypeBoolean.class, Class.class)).
- invoke(recv, Void.class);
+ invokeExact(recv, Void.class);
});
checkWMTE(() -> { // receiver primitive class
hs.get(am, methodType(void.class, int.class, boolean.class)).
- invoke(0, true);
+ invokeExact(0, true);
});
// Incorrect arity
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
hs.get(am, methodType(void.class, VarHandleTestMethodTypeBoolean.class, boolean.class, Class.class)).
- invoke(recv, true, Void.class);
+ invokeExact(recv, true, Void.class);
});
}
@@ -513,32 +515,32 @@
// Incorrect return type
checkWMTE(() -> { // reference class
Void x = (Void) hs.get(am, methodType(Void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // primitive class
int x = (int) hs.get(am, methodType(int.class)).
- invoke();
+ invokeExact();
});
// Incorrect arity
checkWMTE(() -> { // >
boolean x = (boolean) hs.get(am, methodType(Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
// Incorrect arity
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
hs.get(am, methodType(void.class, boolean.class, Class.class)).
- invoke(true, Void.class);
+ invokeExact(true, Void.class);
});
}
@@ -783,71 +785,71 @@
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null array
- boolean x = (boolean) hs.get(am, methodType(boolean.class, Void.class, int.class)).
- invoke(null, 0);
+ boolean x = (boolean) hs.get(am, methodType(boolean.class, boolean[].class, int.class)).
+ invokeExact((boolean[]) null, 0);
});
- checkCCE(() -> { // array reference class
+ hs.checkWMTEOrCCE(() -> { // array reference class
boolean x = (boolean) hs.get(am, methodType(boolean.class, Class.class, int.class)).
- invoke(Void.class, 0);
+ invokeExact(Void.class, 0);
});
checkWMTE(() -> { // array primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, int.class, int.class)).
- invoke(0, 0);
+ invokeExact(0, 0);
});
checkWMTE(() -> { // index reference class
boolean x = (boolean) hs.get(am, methodType(boolean.class, boolean[].class, Class.class)).
- invoke(array, Void.class);
+ invokeExact(array, Void.class);
});
// Incorrect return type
checkWMTE(() -> { // reference class
Void x = (Void) hs.get(am, methodType(Void.class, boolean[].class, int.class)).
- invoke(array, 0);
+ invokeExact(array, 0);
});
checkWMTE(() -> { // primitive class
int x = (int) hs.get(am, methodType(int.class, boolean[].class, int.class)).
- invoke(array, 0);
+ invokeExact(array, 0);
});
// Incorrect arity
checkWMTE(() -> { // 0
boolean x = (boolean) hs.get(am, methodType(boolean.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
boolean x = (boolean) hs.get(am, methodType(boolean.class, boolean[].class, int.class, Class.class)).
- invoke(array, 0, Void.class);
+ invokeExact(array, 0, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null array
- hs.get(am, methodType(void.class, Void.class, int.class, boolean.class)).
- invoke(null, 0, true);
+ hs.get(am, methodType(void.class, boolean[].class, int.class, boolean.class)).
+ invokeExact((boolean[]) null, 0, true);
});
- checkCCE(() -> { // array reference class
+ hs.checkWMTEOrCCE(() -> { // array reference class
hs.get(am, methodType(void.class, Class.class, int.class, boolean.class)).
- invoke(Void.class, 0, true);
+ invokeExact(Void.class, 0, true);
});
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, boolean[].class, int.class, Class.class)).
- invoke(array, 0, Void.class);
+ invokeExact(array, 0, Void.class);
});
checkWMTE(() -> { // receiver primitive class
hs.get(am, methodType(void.class, int.class, int.class, boolean.class)).
- invoke(0, 0, true);
+ invokeExact(0, 0, true);
});
checkWMTE(() -> { // index reference class
hs.get(am, methodType(void.class, boolean[].class, Class.class, boolean.class)).
- invoke(array, Void.class, true);
+ invokeExact(array, Void.class, true);
});
// Incorrect arity
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
hs.get(am, methodType(void.class, boolean[].class, int.class, Class.class)).
- invoke(array, 0, true, Void.class);
+ invokeExact(array, 0, true, Void.class);
});
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeByte.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeByte.java Tue May 17 12:06:41 2016 +0200
@@ -23,6 +23,7 @@
/*
* @test
+ * @bug 8156486
* @run testng/othervm VarHandleTestMethodTypeByte
* @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodTypeByte
*/
@@ -81,27 +82,28 @@
public Object[][] accessTestCaseProvider() throws Exception {
List<AccessTestCase<?>> cases = new ArrayList<>();
- cases.add(new VarHandleAccessTestCase("Instance field wrong method type",
+ cases.add(new VarHandleAccessTestCase("Instance field",
vhField, vh -> testInstanceFieldWrongMethodType(this, vh),
false));
- cases.add(new VarHandleAccessTestCase("Static field wrong method type",
+ cases.add(new VarHandleAccessTestCase("Static field",
vhStaticField, VarHandleTestMethodTypeByte::testStaticFieldWrongMethodType,
false));
- cases.add(new VarHandleAccessTestCase("Array wrong method type",
+ cases.add(new VarHandleAccessTestCase("Array",
vhArray, VarHandleTestMethodTypeByte::testArrayWrongMethodType,
false));
+
for (VarHandleToMethodHandle f : VarHandleToMethodHandle.values()) {
- cases.add(new MethodHandleAccessTestCase("Instance field wrong method type",
+ cases.add(new MethodHandleAccessTestCase("Instance field",
vhField, f, hs -> testInstanceFieldWrongMethodType(this, hs),
false));
- cases.add(new MethodHandleAccessTestCase("Static field wrong method type",
+ cases.add(new MethodHandleAccessTestCase("Static field",
vhStaticField, f, VarHandleTestMethodTypeByte::testStaticFieldWrongMethodType,
false));
- cases.add(new MethodHandleAccessTestCase("Array wrong method type",
+ cases.add(new MethodHandleAccessTestCase("Array",
vhArray, f, VarHandleTestMethodTypeByte::testArrayWrongMethodType,
false));
}
@@ -329,63 +331,63 @@
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
- byte x = (byte) hs.get(am, methodType(byte.class, Void.class)).
- invoke(null);
+ byte x = (byte) hs.get(am, methodType(byte.class, VarHandleTestMethodTypeByte.class)).
+ invokeExact((VarHandleTestMethodTypeByte) null);
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
byte x = (byte) hs.get(am, methodType(byte.class, Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
checkWMTE(() -> { // receiver primitive class
byte x = (byte) hs.get(am, methodType(byte.class, int.class)).
- invoke(0);
+ invokeExact(0);
});
// Incorrect return type
checkWMTE(() -> { // reference class
- Void x = (Void) hs.get(am, methodType(byte.class, VarHandleTestMethodTypeByte.class)).
- invoke(recv);
+ Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeByte.class)).
+ invokeExact(recv);
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeByte.class)).
- invoke(recv);
+ invokeExact(recv);
});
// Incorrect arity
checkWMTE(() -> { // 0
byte x = (byte) hs.get(am, methodType(byte.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
byte x = (byte) hs.get(am, methodType(byte.class, VarHandleTestMethodTypeByte.class, Class.class)).
- invoke(recv, Void.class);
+ invokeExact(recv, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
- hs.get(am, methodType(void.class, Void.class, byte.class)).
- invoke(null, (byte)1);
+ hs.get(am, methodType(void.class, VarHandleTestMethodTypeByte.class, byte.class)).
+ invokeExact((VarHandleTestMethodTypeByte) null, (byte)1);
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
hs.get(am, methodType(void.class, Class.class, byte.class)).
- invoke(Void.class, (byte)1);
+ invokeExact(Void.class, (byte)1);
});
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, VarHandleTestMethodTypeByte.class, Class.class)).
- invoke(recv, Void.class);
+ invokeExact(recv, Void.class);
});
checkWMTE(() -> { // receiver primitive class
hs.get(am, methodType(void.class, int.class, byte.class)).
- invoke(0, (byte)1);
+ invokeExact(0, (byte)1);
});
// Incorrect arity
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
hs.get(am, methodType(void.class, VarHandleTestMethodTypeByte.class, byte.class, Class.class)).
- invoke(recv, (byte)1, Void.class);
+ invokeExact(recv, (byte)1, Void.class);
});
}
@@ -513,32 +515,32 @@
// Incorrect return type
checkWMTE(() -> { // reference class
Void x = (Void) hs.get(am, methodType(Void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class)).
- invoke();
+ invokeExact();
});
// Incorrect arity
checkWMTE(() -> { // >
byte x = (byte) hs.get(am, methodType(Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
// Incorrect arity
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
hs.get(am, methodType(void.class, byte.class, Class.class)).
- invoke((byte)1, Void.class);
+ invokeExact((byte)1, Void.class);
});
}
@@ -783,71 +785,71 @@
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null array
- byte x = (byte) hs.get(am, methodType(byte.class, Void.class, int.class)).
- invoke(null, 0);
+ byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, int.class)).
+ invokeExact((byte[]) null, 0);
});
- checkCCE(() -> { // array reference class
+ hs.checkWMTEOrCCE(() -> { // array reference class
byte x = (byte) hs.get(am, methodType(byte.class, Class.class, int.class)).
- invoke(Void.class, 0);
+ invokeExact(Void.class, 0);
});
checkWMTE(() -> { // array primitive class
byte x = (byte) hs.get(am, methodType(byte.class, int.class, int.class)).
- invoke(0, 0);
+ invokeExact(0, 0);
});
checkWMTE(() -> { // index reference class
byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, Class.class)).
- invoke(array, Void.class);
+ invokeExact(array, Void.class);
});
// Incorrect return type
checkWMTE(() -> { // reference class
Void x = (Void) hs.get(am, methodType(Void.class, byte[].class, int.class)).
- invoke(array, 0);
+ invokeExact(array, 0);
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, byte[].class, int.class)).
- invoke(array, 0);
+ invokeExact(array, 0);
});
// Incorrect arity
checkWMTE(() -> { // 0
byte x = (byte) hs.get(am, methodType(byte.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, int.class, Class.class)).
- invoke(array, 0, Void.class);
+ invokeExact(array, 0, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null array
- hs.get(am, methodType(void.class, Void.class, int.class, byte.class)).
- invoke(null, 0, (byte)1);
+ hs.get(am, methodType(void.class, byte[].class, int.class, byte.class)).
+ invokeExact((byte[]) null, 0, (byte)1);
});
- checkCCE(() -> { // array reference class
+ hs.checkWMTEOrCCE(() -> { // array reference class
hs.get(am, methodType(void.class, Class.class, int.class, byte.class)).
- invoke(Void.class, 0, (byte)1);
+ invokeExact(Void.class, 0, (byte)1);
});
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, byte[].class, int.class, Class.class)).
- invoke(array, 0, Void.class);
+ invokeExact(array, 0, Void.class);
});
checkWMTE(() -> { // receiver primitive class
hs.get(am, methodType(void.class, int.class, int.class, byte.class)).
- invoke(0, 0, (byte)1);
+ invokeExact(0, 0, (byte)1);
});
checkWMTE(() -> { // index reference class
hs.get(am, methodType(void.class, byte[].class, Class.class, byte.class)).
- invoke(array, Void.class, (byte)1);
+ invokeExact(array, Void.class, (byte)1);
});
// Incorrect arity
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
hs.get(am, methodType(void.class, byte[].class, int.class, Class.class)).
- invoke(array, 0, (byte)1, Void.class);
+ invokeExact(array, 0, (byte)1, Void.class);
});
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeChar.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeChar.java Tue May 17 12:06:41 2016 +0200
@@ -23,6 +23,7 @@
/*
* @test
+ * @bug 8156486
* @run testng/othervm VarHandleTestMethodTypeChar
* @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodTypeChar
*/
@@ -81,27 +82,28 @@
public Object[][] accessTestCaseProvider() throws Exception {
List<AccessTestCase<?>> cases = new ArrayList<>();
- cases.add(new VarHandleAccessTestCase("Instance field wrong method type",
+ cases.add(new VarHandleAccessTestCase("Instance field",
vhField, vh -> testInstanceFieldWrongMethodType(this, vh),
false));
- cases.add(new VarHandleAccessTestCase("Static field wrong method type",
+ cases.add(new VarHandleAccessTestCase("Static field",
vhStaticField, VarHandleTestMethodTypeChar::testStaticFieldWrongMethodType,
false));
- cases.add(new VarHandleAccessTestCase("Array wrong method type",
+ cases.add(new VarHandleAccessTestCase("Array",
vhArray, VarHandleTestMethodTypeChar::testArrayWrongMethodType,
false));
+
for (VarHandleToMethodHandle f : VarHandleToMethodHandle.values()) {
- cases.add(new MethodHandleAccessTestCase("Instance field wrong method type",
+ cases.add(new MethodHandleAccessTestCase("Instance field",
vhField, f, hs -> testInstanceFieldWrongMethodType(this, hs),
false));
- cases.add(new MethodHandleAccessTestCase("Static field wrong method type",
+ cases.add(new MethodHandleAccessTestCase("Static field",
vhStaticField, f, VarHandleTestMethodTypeChar::testStaticFieldWrongMethodType,
false));
- cases.add(new MethodHandleAccessTestCase("Array wrong method type",
+ cases.add(new MethodHandleAccessTestCase("Array",
vhArray, f, VarHandleTestMethodTypeChar::testArrayWrongMethodType,
false));
}
@@ -329,63 +331,63 @@
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
- char x = (char) hs.get(am, methodType(char.class, Void.class)).
- invoke(null);
+ char x = (char) hs.get(am, methodType(char.class, VarHandleTestMethodTypeChar.class)).
+ invokeExact((VarHandleTestMethodTypeChar) null);
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
char x = (char) hs.get(am, methodType(char.class, Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
checkWMTE(() -> { // receiver primitive class
char x = (char) hs.get(am, methodType(char.class, int.class)).
- invoke(0);
+ invokeExact(0);
});
// Incorrect return type
checkWMTE(() -> { // reference class
- Void x = (Void) hs.get(am, methodType(char.class, VarHandleTestMethodTypeChar.class)).
- invoke(recv);
+ Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeChar.class)).
+ invokeExact(recv);
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeChar.class)).
- invoke(recv);
+ invokeExact(recv);
});
// Incorrect arity
checkWMTE(() -> { // 0
char x = (char) hs.get(am, methodType(char.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
char x = (char) hs.get(am, methodType(char.class, VarHandleTestMethodTypeChar.class, Class.class)).
- invoke(recv, Void.class);
+ invokeExact(recv, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
- hs.get(am, methodType(void.class, Void.class, char.class)).
- invoke(null, 'a');
+ hs.get(am, methodType(void.class, VarHandleTestMethodTypeChar.class, char.class)).
+ invokeExact((VarHandleTestMethodTypeChar) null, 'a');
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
hs.get(am, methodType(void.class, Class.class, char.class)).
- invoke(Void.class, 'a');
+ invokeExact(Void.class, 'a');
});
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, VarHandleTestMethodTypeChar.class, Class.class)).
- invoke(recv, Void.class);
+ invokeExact(recv, Void.class);
});
checkWMTE(() -> { // receiver primitive class
hs.get(am, methodType(void.class, int.class, char.class)).
- invoke(0, 'a');
+ invokeExact(0, 'a');
});
// Incorrect arity
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
hs.get(am, methodType(void.class, VarHandleTestMethodTypeChar.class, char.class, Class.class)).
- invoke(recv, 'a', Void.class);
+ invokeExact(recv, 'a', Void.class);
});
}
@@ -513,32 +515,32 @@
// Incorrect return type
checkWMTE(() -> { // reference class
Void x = (Void) hs.get(am, methodType(Void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class)).
- invoke();
+ invokeExact();
});
// Incorrect arity
checkWMTE(() -> { // >
char x = (char) hs.get(am, methodType(Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
// Incorrect arity
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
hs.get(am, methodType(void.class, char.class, Class.class)).
- invoke('a', Void.class);
+ invokeExact('a', Void.class);
});
}
@@ -783,71 +785,71 @@
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null array
- char x = (char) hs.get(am, methodType(char.class, Void.class, int.class)).
- invoke(null, 0);
+ char x = (char) hs.get(am, methodType(char.class, char[].class, int.class)).
+ invokeExact((char[]) null, 0);
});
- checkCCE(() -> { // array reference class
+ hs.checkWMTEOrCCE(() -> { // array reference class
char x = (char) hs.get(am, methodType(char.class, Class.class, int.class)).
- invoke(Void.class, 0);
+ invokeExact(Void.class, 0);
});
checkWMTE(() -> { // array primitive class
char x = (char) hs.get(am, methodType(char.class, int.class, int.class)).
- invoke(0, 0);
+ invokeExact(0, 0);
});
checkWMTE(() -> { // index reference class
char x = (char) hs.get(am, methodType(char.class, char[].class, Class.class)).
- invoke(array, Void.class);
+ invokeExact(array, Void.class);
});
// Incorrect return type
checkWMTE(() -> { // reference class
Void x = (Void) hs.get(am, methodType(Void.class, char[].class, int.class)).
- invoke(array, 0);
+ invokeExact(array, 0);
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, char[].class, int.class)).
- invoke(array, 0);
+ invokeExact(array, 0);
});
// Incorrect arity
checkWMTE(() -> { // 0
char x = (char) hs.get(am, methodType(char.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
char x = (char) hs.get(am, methodType(char.class, char[].class, int.class, Class.class)).
- invoke(array, 0, Void.class);
+ invokeExact(array, 0, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null array
- hs.get(am, methodType(void.class, Void.class, int.class, char.class)).
- invoke(null, 0, 'a');
+ hs.get(am, methodType(void.class, char[].class, int.class, char.class)).
+ invokeExact((char[]) null, 0, 'a');
});
- checkCCE(() -> { // array reference class
+ hs.checkWMTEOrCCE(() -> { // array reference class
hs.get(am, methodType(void.class, Class.class, int.class, char.class)).
- invoke(Void.class, 0, 'a');
+ invokeExact(Void.class, 0, 'a');
});
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, char[].class, int.class, Class.class)).
- invoke(array, 0, Void.class);
+ invokeExact(array, 0, Void.class);
});
checkWMTE(() -> { // receiver primitive class
hs.get(am, methodType(void.class, int.class, int.class, char.class)).
- invoke(0, 0, 'a');
+ invokeExact(0, 0, 'a');
});
checkWMTE(() -> { // index reference class
hs.get(am, methodType(void.class, char[].class, Class.class, char.class)).
- invoke(array, Void.class, 'a');
+ invokeExact(array, Void.class, 'a');
});
// Incorrect arity
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
hs.get(am, methodType(void.class, char[].class, int.class, Class.class)).
- invoke(array, 0, 'a', Void.class);
+ invokeExact(array, 0, 'a', Void.class);
});
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeDouble.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeDouble.java Tue May 17 12:06:41 2016 +0200
@@ -23,6 +23,7 @@
/*
* @test
+ * @bug 8156486
* @run testng/othervm VarHandleTestMethodTypeDouble
* @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodTypeDouble
*/
@@ -81,27 +82,28 @@
public Object[][] accessTestCaseProvider() throws Exception {
List<AccessTestCase<?>> cases = new ArrayList<>();
- cases.add(new VarHandleAccessTestCase("Instance field wrong method type",
+ cases.add(new VarHandleAccessTestCase("Instance field",
vhField, vh -> testInstanceFieldWrongMethodType(this, vh),
false));
- cases.add(new VarHandleAccessTestCase("Static field wrong method type",
+ cases.add(new VarHandleAccessTestCase("Static field",
vhStaticField, VarHandleTestMethodTypeDouble::testStaticFieldWrongMethodType,
false));
- cases.add(new VarHandleAccessTestCase("Array wrong method type",
+ cases.add(new VarHandleAccessTestCase("Array",
vhArray, VarHandleTestMethodTypeDouble::testArrayWrongMethodType,
false));
+
for (VarHandleToMethodHandle f : VarHandleToMethodHandle.values()) {
- cases.add(new MethodHandleAccessTestCase("Instance field wrong method type",
+ cases.add(new MethodHandleAccessTestCase("Instance field",
vhField, f, hs -> testInstanceFieldWrongMethodType(this, hs),
false));
- cases.add(new MethodHandleAccessTestCase("Static field wrong method type",
+ cases.add(new MethodHandleAccessTestCase("Static field",
vhStaticField, f, VarHandleTestMethodTypeDouble::testStaticFieldWrongMethodType,
false));
- cases.add(new MethodHandleAccessTestCase("Array wrong method type",
+ cases.add(new MethodHandleAccessTestCase("Array",
vhArray, f, VarHandleTestMethodTypeDouble::testArrayWrongMethodType,
false));
}
@@ -329,63 +331,63 @@
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
- double x = (double) hs.get(am, methodType(double.class, Void.class)).
- invoke(null);
+ double x = (double) hs.get(am, methodType(double.class, VarHandleTestMethodTypeDouble.class)).
+ invokeExact((VarHandleTestMethodTypeDouble) null);
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
double x = (double) hs.get(am, methodType(double.class, Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
checkWMTE(() -> { // receiver primitive class
double x = (double) hs.get(am, methodType(double.class, int.class)).
- invoke(0);
+ invokeExact(0);
});
// Incorrect return type
checkWMTE(() -> { // reference class
- Void x = (Void) hs.get(am, methodType(double.class, VarHandleTestMethodTypeDouble.class)).
- invoke(recv);
+ Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeDouble.class)).
+ invokeExact(recv);
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeDouble.class)).
- invoke(recv);
+ invokeExact(recv);
});
// Incorrect arity
checkWMTE(() -> { // 0
double x = (double) hs.get(am, methodType(double.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
double x = (double) hs.get(am, methodType(double.class, VarHandleTestMethodTypeDouble.class, Class.class)).
- invoke(recv, Void.class);
+ invokeExact(recv, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
- hs.get(am, methodType(void.class, Void.class, double.class)).
- invoke(null, 1.0d);
+ hs.get(am, methodType(void.class, VarHandleTestMethodTypeDouble.class, double.class)).
+ invokeExact((VarHandleTestMethodTypeDouble) null, 1.0d);
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
hs.get(am, methodType(void.class, Class.class, double.class)).
- invoke(Void.class, 1.0d);
+ invokeExact(Void.class, 1.0d);
});
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, VarHandleTestMethodTypeDouble.class, Class.class)).
- invoke(recv, Void.class);
+ invokeExact(recv, Void.class);
});
checkWMTE(() -> { // receiver primitive class
hs.get(am, methodType(void.class, int.class, double.class)).
- invoke(0, 1.0d);
+ invokeExact(0, 1.0d);
});
// Incorrect arity
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
hs.get(am, methodType(void.class, VarHandleTestMethodTypeDouble.class, double.class, Class.class)).
- invoke(recv, 1.0d, Void.class);
+ invokeExact(recv, 1.0d, Void.class);
});
}
@@ -513,32 +515,32 @@
// Incorrect return type
checkWMTE(() -> { // reference class
Void x = (Void) hs.get(am, methodType(Void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class)).
- invoke();
+ invokeExact();
});
// Incorrect arity
checkWMTE(() -> { // >
double x = (double) hs.get(am, methodType(Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
// Incorrect arity
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
hs.get(am, methodType(void.class, double.class, Class.class)).
- invoke(1.0d, Void.class);
+ invokeExact(1.0d, Void.class);
});
}
@@ -783,71 +785,71 @@
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null array
- double x = (double) hs.get(am, methodType(double.class, Void.class, int.class)).
- invoke(null, 0);
+ double x = (double) hs.get(am, methodType(double.class, double[].class, int.class)).
+ invokeExact((double[]) null, 0);
});
- checkCCE(() -> { // array reference class
+ hs.checkWMTEOrCCE(() -> { // array reference class
double x = (double) hs.get(am, methodType(double.class, Class.class, int.class)).
- invoke(Void.class, 0);
+ invokeExact(Void.class, 0);
});
checkWMTE(() -> { // array primitive class
double x = (double) hs.get(am, methodType(double.class, int.class, int.class)).
- invoke(0, 0);
+ invokeExact(0, 0);
});
checkWMTE(() -> { // index reference class
double x = (double) hs.get(am, methodType(double.class, double[].class, Class.class)).
- invoke(array, Void.class);
+ invokeExact(array, Void.class);
});
// Incorrect return type
checkWMTE(() -> { // reference class
Void x = (Void) hs.get(am, methodType(Void.class, double[].class, int.class)).
- invoke(array, 0);
+ invokeExact(array, 0);
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, double[].class, int.class)).
- invoke(array, 0);
+ invokeExact(array, 0);
});
// Incorrect arity
checkWMTE(() -> { // 0
double x = (double) hs.get(am, methodType(double.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
double x = (double) hs.get(am, methodType(double.class, double[].class, int.class, Class.class)).
- invoke(array, 0, Void.class);
+ invokeExact(array, 0, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null array
- hs.get(am, methodType(void.class, Void.class, int.class, double.class)).
- invoke(null, 0, 1.0d);
+ hs.get(am, methodType(void.class, double[].class, int.class, double.class)).
+ invokeExact((double[]) null, 0, 1.0d);
});
- checkCCE(() -> { // array reference class
+ hs.checkWMTEOrCCE(() -> { // array reference class
hs.get(am, methodType(void.class, Class.class, int.class, double.class)).
- invoke(Void.class, 0, 1.0d);
+ invokeExact(Void.class, 0, 1.0d);
});
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, double[].class, int.class, Class.class)).
- invoke(array, 0, Void.class);
+ invokeExact(array, 0, Void.class);
});
checkWMTE(() -> { // receiver primitive class
hs.get(am, methodType(void.class, int.class, int.class, double.class)).
- invoke(0, 0, 1.0d);
+ invokeExact(0, 0, 1.0d);
});
checkWMTE(() -> { // index reference class
hs.get(am, methodType(void.class, double[].class, Class.class, double.class)).
- invoke(array, Void.class, 1.0d);
+ invokeExact(array, Void.class, 1.0d);
});
// Incorrect arity
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
hs.get(am, methodType(void.class, double[].class, int.class, Class.class)).
- invoke(array, 0, 1.0d, Void.class);
+ invokeExact(array, 0, 1.0d, Void.class);
});
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeFloat.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeFloat.java Tue May 17 12:06:41 2016 +0200
@@ -23,6 +23,7 @@
/*
* @test
+ * @bug 8156486
* @run testng/othervm VarHandleTestMethodTypeFloat
* @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodTypeFloat
*/
@@ -81,27 +82,28 @@
public Object[][] accessTestCaseProvider() throws Exception {
List<AccessTestCase<?>> cases = new ArrayList<>();
- cases.add(new VarHandleAccessTestCase("Instance field wrong method type",
+ cases.add(new VarHandleAccessTestCase("Instance field",
vhField, vh -> testInstanceFieldWrongMethodType(this, vh),
false));
- cases.add(new VarHandleAccessTestCase("Static field wrong method type",
+ cases.add(new VarHandleAccessTestCase("Static field",
vhStaticField, VarHandleTestMethodTypeFloat::testStaticFieldWrongMethodType,
false));
- cases.add(new VarHandleAccessTestCase("Array wrong method type",
+ cases.add(new VarHandleAccessTestCase("Array",
vhArray, VarHandleTestMethodTypeFloat::testArrayWrongMethodType,
false));
+
for (VarHandleToMethodHandle f : VarHandleToMethodHandle.values()) {
- cases.add(new MethodHandleAccessTestCase("Instance field wrong method type",
+ cases.add(new MethodHandleAccessTestCase("Instance field",
vhField, f, hs -> testInstanceFieldWrongMethodType(this, hs),
false));
- cases.add(new MethodHandleAccessTestCase("Static field wrong method type",
+ cases.add(new MethodHandleAccessTestCase("Static field",
vhStaticField, f, VarHandleTestMethodTypeFloat::testStaticFieldWrongMethodType,
false));
- cases.add(new MethodHandleAccessTestCase("Array wrong method type",
+ cases.add(new MethodHandleAccessTestCase("Array",
vhArray, f, VarHandleTestMethodTypeFloat::testArrayWrongMethodType,
false));
}
@@ -329,63 +331,63 @@
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
- float x = (float) hs.get(am, methodType(float.class, Void.class)).
- invoke(null);
+ float x = (float) hs.get(am, methodType(float.class, VarHandleTestMethodTypeFloat.class)).
+ invokeExact((VarHandleTestMethodTypeFloat) null);
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
float x = (float) hs.get(am, methodType(float.class, Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
checkWMTE(() -> { // receiver primitive class
float x = (float) hs.get(am, methodType(float.class, int.class)).
- invoke(0);
+ invokeExact(0);
});
// Incorrect return type
checkWMTE(() -> { // reference class
- Void x = (Void) hs.get(am, methodType(float.class, VarHandleTestMethodTypeFloat.class)).
- invoke(recv);
+ Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeFloat.class)).
+ invokeExact(recv);
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeFloat.class)).
- invoke(recv);
+ invokeExact(recv);
});
// Incorrect arity
checkWMTE(() -> { // 0
float x = (float) hs.get(am, methodType(float.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
float x = (float) hs.get(am, methodType(float.class, VarHandleTestMethodTypeFloat.class, Class.class)).
- invoke(recv, Void.class);
+ invokeExact(recv, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
- hs.get(am, methodType(void.class, Void.class, float.class)).
- invoke(null, 1.0f);
+ hs.get(am, methodType(void.class, VarHandleTestMethodTypeFloat.class, float.class)).
+ invokeExact((VarHandleTestMethodTypeFloat) null, 1.0f);
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
hs.get(am, methodType(void.class, Class.class, float.class)).
- invoke(Void.class, 1.0f);
+ invokeExact(Void.class, 1.0f);
});
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, VarHandleTestMethodTypeFloat.class, Class.class)).
- invoke(recv, Void.class);
+ invokeExact(recv, Void.class);
});
checkWMTE(() -> { // receiver primitive class
hs.get(am, methodType(void.class, int.class, float.class)).
- invoke(0, 1.0f);
+ invokeExact(0, 1.0f);
});
// Incorrect arity
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
hs.get(am, methodType(void.class, VarHandleTestMethodTypeFloat.class, float.class, Class.class)).
- invoke(recv, 1.0f, Void.class);
+ invokeExact(recv, 1.0f, Void.class);
});
}
@@ -513,32 +515,32 @@
// Incorrect return type
checkWMTE(() -> { // reference class
Void x = (Void) hs.get(am, methodType(Void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class)).
- invoke();
+ invokeExact();
});
// Incorrect arity
checkWMTE(() -> { // >
float x = (float) hs.get(am, methodType(Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
// Incorrect arity
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
hs.get(am, methodType(void.class, float.class, Class.class)).
- invoke(1.0f, Void.class);
+ invokeExact(1.0f, Void.class);
});
}
@@ -783,71 +785,71 @@
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null array
- float x = (float) hs.get(am, methodType(float.class, Void.class, int.class)).
- invoke(null, 0);
+ float x = (float) hs.get(am, methodType(float.class, float[].class, int.class)).
+ invokeExact((float[]) null, 0);
});
- checkCCE(() -> { // array reference class
+ hs.checkWMTEOrCCE(() -> { // array reference class
float x = (float) hs.get(am, methodType(float.class, Class.class, int.class)).
- invoke(Void.class, 0);
+ invokeExact(Void.class, 0);
});
checkWMTE(() -> { // array primitive class
float x = (float) hs.get(am, methodType(float.class, int.class, int.class)).
- invoke(0, 0);
+ invokeExact(0, 0);
});
checkWMTE(() -> { // index reference class
float x = (float) hs.get(am, methodType(float.class, float[].class, Class.class)).
- invoke(array, Void.class);
+ invokeExact(array, Void.class);
});
// Incorrect return type
checkWMTE(() -> { // reference class
Void x = (Void) hs.get(am, methodType(Void.class, float[].class, int.class)).
- invoke(array, 0);
+ invokeExact(array, 0);
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, float[].class, int.class)).
- invoke(array, 0);
+ invokeExact(array, 0);
});
// Incorrect arity
checkWMTE(() -> { // 0
float x = (float) hs.get(am, methodType(float.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
float x = (float) hs.get(am, methodType(float.class, float[].class, int.class, Class.class)).
- invoke(array, 0, Void.class);
+ invokeExact(array, 0, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null array
- hs.get(am, methodType(void.class, Void.class, int.class, float.class)).
- invoke(null, 0, 1.0f);
+ hs.get(am, methodType(void.class, float[].class, int.class, float.class)).
+ invokeExact((float[]) null, 0, 1.0f);
});
- checkCCE(() -> { // array reference class
+ hs.checkWMTEOrCCE(() -> { // array reference class
hs.get(am, methodType(void.class, Class.class, int.class, float.class)).
- invoke(Void.class, 0, 1.0f);
+ invokeExact(Void.class, 0, 1.0f);
});
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, float[].class, int.class, Class.class)).
- invoke(array, 0, Void.class);
+ invokeExact(array, 0, Void.class);
});
checkWMTE(() -> { // receiver primitive class
hs.get(am, methodType(void.class, int.class, int.class, float.class)).
- invoke(0, 0, 1.0f);
+ invokeExact(0, 0, 1.0f);
});
checkWMTE(() -> { // index reference class
hs.get(am, methodType(void.class, float[].class, Class.class, float.class)).
- invoke(array, Void.class, 1.0f);
+ invokeExact(array, Void.class, 1.0f);
});
// Incorrect arity
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
hs.get(am, methodType(void.class, float[].class, int.class, Class.class)).
- invoke(array, 0, 1.0f, Void.class);
+ invokeExact(array, 0, 1.0f, Void.class);
});
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeInt.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeInt.java Tue May 17 12:06:41 2016 +0200
@@ -23,6 +23,7 @@
/*
* @test
+ * @bug 8156486
* @run testng/othervm VarHandleTestMethodTypeInt
* @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodTypeInt
*/
@@ -81,27 +82,28 @@
public Object[][] accessTestCaseProvider() throws Exception {
List<AccessTestCase<?>> cases = new ArrayList<>();
- cases.add(new VarHandleAccessTestCase("Instance field wrong method type",
+ cases.add(new VarHandleAccessTestCase("Instance field",
vhField, vh -> testInstanceFieldWrongMethodType(this, vh),
false));
- cases.add(new VarHandleAccessTestCase("Static field wrong method type",
+ cases.add(new VarHandleAccessTestCase("Static field",
vhStaticField, VarHandleTestMethodTypeInt::testStaticFieldWrongMethodType,
false));
- cases.add(new VarHandleAccessTestCase("Array wrong method type",
+ cases.add(new VarHandleAccessTestCase("Array",
vhArray, VarHandleTestMethodTypeInt::testArrayWrongMethodType,
false));
+
for (VarHandleToMethodHandle f : VarHandleToMethodHandle.values()) {
- cases.add(new MethodHandleAccessTestCase("Instance field wrong method type",
+ cases.add(new MethodHandleAccessTestCase("Instance field",
vhField, f, hs -> testInstanceFieldWrongMethodType(this, hs),
false));
- cases.add(new MethodHandleAccessTestCase("Static field wrong method type",
+ cases.add(new MethodHandleAccessTestCase("Static field",
vhStaticField, f, VarHandleTestMethodTypeInt::testStaticFieldWrongMethodType,
false));
- cases.add(new MethodHandleAccessTestCase("Array wrong method type",
+ cases.add(new MethodHandleAccessTestCase("Array",
vhArray, f, VarHandleTestMethodTypeInt::testArrayWrongMethodType,
false));
}
@@ -644,211 +646,211 @@
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
- int x = (int) hs.get(am, methodType(int.class, Void.class)).
- invoke(null);
+ int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class)).
+ invokeExact((VarHandleTestMethodTypeInt) null);
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
int x = (int) hs.get(am, methodType(int.class, Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
checkWMTE(() -> { // receiver primitive class
int x = (int) hs.get(am, methodType(int.class, int.class)).
- invoke(0);
+ invokeExact(0);
});
// Incorrect return type
checkWMTE(() -> { // reference class
- Void x = (Void) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class)).
- invoke(recv);
+ Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeInt.class)).
+ invokeExact(recv);
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeInt.class)).
- invoke(recv);
+ invokeExact(recv);
});
// Incorrect arity
checkWMTE(() -> { // 0
int x = (int) hs.get(am, methodType(int.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, Class.class)).
- invoke(recv, Void.class);
+ invokeExact(recv, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
- hs.get(am, methodType(void.class, Void.class, int.class)).
- invoke(null, 1);
+ hs.get(am, methodType(void.class, VarHandleTestMethodTypeInt.class, int.class)).
+ invokeExact((VarHandleTestMethodTypeInt) null, 1);
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
hs.get(am, methodType(void.class, Class.class, int.class)).
- invoke(Void.class, 1);
+ invokeExact(Void.class, 1);
});
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, VarHandleTestMethodTypeInt.class, Class.class)).
- invoke(recv, Void.class);
+ invokeExact(recv, Void.class);
});
checkWMTE(() -> { // receiver primitive class
hs.get(am, methodType(void.class, int.class, int.class)).
- invoke(0, 1);
+ invokeExact(0, 1);
});
// Incorrect arity
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
hs.get(am, methodType(void.class, VarHandleTestMethodTypeInt.class, int.class, Class.class)).
- invoke(recv, 1, Void.class);
+ invokeExact(recv, 1, 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, Void.class, int.class, int.class)).
- invoke(null, 1, 1);
+ boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeInt.class, int.class, int.class)).
+ invokeExact((VarHandleTestMethodTypeInt) null, 1, 1);
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, int.class, int.class)).
- invoke(Void.class, 1, 1);
+ invokeExact(Void.class, 1, 1);
});
checkWMTE(() -> { // expected reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeInt.class, Class.class, int.class)).
- invoke(recv, Void.class, 1);
+ invokeExact(recv, Void.class, 1);
});
checkWMTE(() -> { // actual reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeInt.class, int.class, Class.class)).
- invoke(recv, 1, Void.class);
+ invokeExact(recv, 1, Void.class);
});
checkWMTE(() -> { // receiver primitive class
boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class , int.class, int.class)).
- invoke(0, 1, 1);
+ invokeExact(0, 1, 1);
});
// Incorrect arity
checkWMTE(() -> { // 0
boolean r = (boolean) hs.get(am, methodType(boolean.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeInt.class, int.class, int.class, Class.class)).
- invoke(recv, 1, 1, Void.class);
+ invokeExact(recv, 1, 1, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkNPE(() -> { // null receiver
- int x = (int) hs.get(am, methodType(int.class, Void.class, int.class, int.class)).
- invoke(null, 1, 1);
+ int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, int.class, int.class)).
+ invokeExact((VarHandleTestMethodTypeInt) null, 1, 1);
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
int x = (int) hs.get(am, methodType(int.class, Class.class, int.class, int.class)).
- invoke(Void.class, 1, 1);
+ invokeExact(Void.class, 1, 1);
});
checkWMTE(() -> { // expected reference class
int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, Class.class, int.class)).
- invoke(recv, Void.class, 1);
+ invokeExact(recv, Void.class, 1);
});
checkWMTE(() -> { // actual reference class
int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, int.class, Class.class)).
- invoke(recv, 1, Void.class);
+ invokeExact(recv, 1, Void.class);
});
checkWMTE(() -> { // reciever primitive class
int x = (int) hs.get(am, methodType(int.class, int.class , int.class, int.class)).
- invoke(0, 1, 1);
+ invokeExact(0, 1, 1);
});
// Incorrect return type
checkWMTE(() -> { // reference class
Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeInt.class , int.class, int.class)).
- invoke(recv, 1, 1);
+ invokeExact(recv, 1, 1);
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeInt.class , int.class, int.class)).
- invoke(recv, 1, 1);
+ invokeExact(recv, 1, 1);
});
// Incorrect arity
checkWMTE(() -> { // 0
int x = (int) hs.get(am, methodType(int.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, int.class, int.class, Class.class)).
- invoke(recv, 1, 1, Void.class);
+ invokeExact(recv, 1, 1, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkNPE(() -> { // null receiver
- int x = (int) hs.get(am, methodType(int.class, Void.class, int.class)).
- invoke(null, 1);
+ int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, int.class)).
+ invokeExact((VarHandleTestMethodTypeInt) null, 1);
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
int x = (int) hs.get(am, methodType(int.class, Class.class, int.class)).
- invoke(Void.class, 1);
+ invokeExact(Void.class, 1);
});
checkWMTE(() -> { // value reference class
int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, Class.class)).
- invoke(recv, Void.class);
+ invokeExact(recv, Void.class);
});
checkWMTE(() -> { // reciever primitive class
int x = (int) hs.get(am, methodType(int.class, int.class, int.class)).
- invoke(0, 1);
+ invokeExact(0, 1);
});
// Incorrect return type
checkWMTE(() -> { // reference class
Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeInt.class, int.class)).
- invoke(recv, 1);
+ invokeExact(recv, 1);
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeInt.class, int.class)).
- invoke(recv, 1);
+ invokeExact(recv, 1);
});
// Incorrect arity
checkWMTE(() -> { // 0
int x = (int) hs.get(am, methodType(int.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, int.class)).
- invoke(recv, 1, Void.class);
+ invokeExact(recv, 1, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkNPE(() -> { // null receiver
- int x = (int) hs.get(am, methodType(int.class, Void.class, int.class)).
- invoke(null, 1);
+ int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, int.class)).
+ invokeExact((VarHandleTestMethodTypeInt) null, 1);
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
int x = (int) hs.get(am, methodType(int.class, Class.class, int.class)).
- invoke(Void.class, 1);
+ invokeExact(Void.class, 1);
});
checkWMTE(() -> { // value reference class
int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, Class.class)).
- invoke(recv, Void.class);
+ invokeExact(recv, Void.class);
});
checkWMTE(() -> { // reciever primitive class
int x = (int) hs.get(am, methodType(int.class, int.class, int.class)).
- invoke(0, 1);
+ invokeExact(0, 1);
});
// Incorrect return type
checkWMTE(() -> { // reference class
Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeInt.class, int.class)).
- invoke(recv, 1);
+ invokeExact(recv, 1);
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeInt.class, int.class)).
- invoke(recv, 1);
+ invokeExact(recv, 1);
});
// Incorrect arity
checkWMTE(() -> { // 0
int x = (int) hs.get(am, methodType(int.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, int.class)).
- invoke(recv, 1, Void.class);
+ invokeExact(recv, 1, Void.class);
});
}
}
@@ -1190,52 +1192,52 @@
// Incorrect return type
checkWMTE(() -> { // reference class
Void x = (Void) hs.get(am, methodType(Void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class)).
- invoke();
+ invokeExact();
});
// Incorrect arity
checkWMTE(() -> { // >
int x = (int) hs.get(am, methodType(Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
// Incorrect arity
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
hs.get(am, methodType(void.class, int.class, Class.class)).
- invoke(1, Void.class);
+ invokeExact(1, 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, int.class)).
- invoke(Void.class, 1);
+ invokeExact(Void.class, 1);
});
checkWMTE(() -> { // actual reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class, Class.class)).
- invoke(1, Void.class);
+ invokeExact(1, Void.class);
});
// Incorrect arity
checkWMTE(() -> { // 0
boolean r = (boolean) hs.get(am, methodType(boolean.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class, int.class, Class.class)).
- invoke(1, 1, Void.class);
+ invokeExact(1, 1, Void.class);
});
}
@@ -1243,29 +1245,29 @@
// Incorrect argument types
checkWMTE(() -> { // expected reference class
int x = (int) hs.get(am, methodType(int.class, Class.class, int.class)).
- invoke(Void.class, 1);
+ invokeExact(Void.class, 1);
});
checkWMTE(() -> { // actual reference class
int x = (int) hs.get(am, methodType(int.class, int.class, Class.class)).
- invoke(1, Void.class);
+ invokeExact(1, Void.class);
});
// Incorrect return type
checkWMTE(() -> { // reference class
Void r = (Void) hs.get(am, methodType(Void.class, int.class, int.class)).
- invoke(1, 1);
+ invokeExact(1, 1);
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, int.class, int.class)).
- invoke(1, 1);
+ invokeExact(1, 1);
});
// Incorrect arity
checkWMTE(() -> { // 0
int x = (int) hs.get(am, methodType(int.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
int x = (int) hs.get(am, methodType(int.class, int.class, int.class, Class.class)).
- invoke(1, 1, Void.class);
+ invokeExact(1, 1, Void.class);
});
}
@@ -1273,25 +1275,25 @@
// Incorrect argument types
checkWMTE(() -> { // value reference class
int x = (int) hs.get(am, methodType(int.class, Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
// Incorrect return type
checkWMTE(() -> { // reference class
Void r = (Void) hs.get(am, methodType(Void.class, int.class)).
- invoke(1);
+ invokeExact(1);
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, int.class)).
- invoke(1);
+ invokeExact(1);
});
// Incorrect arity
checkWMTE(() -> { // 0
int x = (int) hs.get(am, methodType(int.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
int x = (int) hs.get(am, methodType(int.class, int.class, Class.class)).
- invoke(1, Void.class);
+ invokeExact(1, Void.class);
});
}
@@ -1299,25 +1301,25 @@
// Incorrect argument types
checkWMTE(() -> { // value reference class
int x = (int) hs.get(am, methodType(int.class, Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
// Incorrect return type
checkWMTE(() -> { // reference class
Void r = (Void) hs.get(am, methodType(Void.class, int.class)).
- invoke(1);
+ invokeExact(1);
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, int.class)).
- invoke(1);
+ invokeExact(1);
});
// Incorrect arity
checkWMTE(() -> { // 0
int x = (int) hs.get(am, methodType(int.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
int x = (int) hs.get(am, methodType(int.class, int.class, Class.class)).
- invoke(1, Void.class);
+ invokeExact(1, Void.class);
});
}
}
@@ -1909,237 +1911,237 @@
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null array
- int x = (int) hs.get(am, methodType(int.class, Void.class, int.class)).
- invoke(null, 0);
+ int x = (int) hs.get(am, methodType(int.class, int[].class, int.class)).
+ invokeExact((int[]) null, 0);
});
- checkCCE(() -> { // array reference class
+ hs.checkWMTEOrCCE(() -> { // array reference class
int x = (int) hs.get(am, methodType(int.class, Class.class, int.class)).
- invoke(Void.class, 0);
+ invokeExact(Void.class, 0);
});
checkWMTE(() -> { // array primitive class
int x = (int) hs.get(am, methodType(int.class, int.class, int.class)).
- invoke(0, 0);
+ invokeExact(0, 0);
});
checkWMTE(() -> { // index reference class
int x = (int) hs.get(am, methodType(int.class, int[].class, Class.class)).
- invoke(array, Void.class);
+ invokeExact(array, Void.class);
});
// Incorrect return type
checkWMTE(() -> { // reference class
Void x = (Void) hs.get(am, methodType(Void.class, int[].class, int.class)).
- invoke(array, 0);
+ invokeExact(array, 0);
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, int[].class, int.class)).
- invoke(array, 0);
+ invokeExact(array, 0);
});
// Incorrect arity
checkWMTE(() -> { // 0
int x = (int) hs.get(am, methodType(int.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, Class.class)).
- invoke(array, 0, Void.class);
+ invokeExact(array, 0, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null array
- hs.get(am, methodType(void.class, Void.class, int.class, int.class)).
- invoke(null, 0, 1);
+ hs.get(am, methodType(void.class, int[].class, int.class, int.class)).
+ invokeExact((int[]) null, 0, 1);
});
- checkCCE(() -> { // array reference class
+ hs.checkWMTEOrCCE(() -> { // array reference class
hs.get(am, methodType(void.class, Class.class, int.class, int.class)).
- invoke(Void.class, 0, 1);
+ invokeExact(Void.class, 0, 1);
});
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, int[].class, int.class, Class.class)).
- invoke(array, 0, Void.class);
+ invokeExact(array, 0, Void.class);
});
checkWMTE(() -> { // receiver primitive class
hs.get(am, methodType(void.class, int.class, int.class, int.class)).
- invoke(0, 0, 1);
+ invokeExact(0, 0, 1);
});
checkWMTE(() -> { // index reference class
hs.get(am, methodType(void.class, int[].class, Class.class, int.class)).
- invoke(array, Void.class, 1);
+ invokeExact(array, Void.class, 1);
});
// Incorrect arity
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
hs.get(am, methodType(void.class, int[].class, int.class, Class.class)).
- invoke(array, 0, 1, Void.class);
+ invokeExact(array, 0, 1, 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, Void.class, int.class, int.class, int.class)).
- invoke(null, 0, 1, 1);
+ boolean r = (boolean) hs.get(am, methodType(boolean.class, int[].class, int.class, int.class, int.class)).
+ invokeExact((int[]) null, 0, 1, 1);
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, int.class, int.class, int.class)).
- invoke(Void.class, 0, 1, 1);
+ invokeExact(Void.class, 0, 1, 1);
});
checkWMTE(() -> { // expected reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, int[].class, int.class, Class.class, int.class)).
- invoke(array, 0, Void.class, 1);
+ invokeExact(array, 0, Void.class, 1);
});
checkWMTE(() -> { // actual reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, int[].class, int.class, int.class, Class.class)).
- invoke(array, 0, 1, Void.class);
+ invokeExact(array, 0, 1, Void.class);
});
checkWMTE(() -> { // receiver primitive class
boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class, int.class, int.class, int.class)).
- invoke(0, 0, 1, 1);
+ invokeExact(0, 0, 1, 1);
});
checkWMTE(() -> { // index reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, int[].class, Class.class, int.class, int.class)).
- invoke(array, Void.class, 1, 1);
+ invokeExact(array, Void.class, 1, 1);
});
// Incorrect arity
checkWMTE(() -> { // 0
boolean r = (boolean) hs.get(am, methodType(boolean.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
boolean r = (boolean) hs.get(am, methodType(boolean.class, int[].class, int.class, int.class, int.class, Class.class)).
- invoke(array, 0, 1, 1, Void.class);
+ invokeExact(array, 0, 1, 1, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
- int x = (int) hs.get(am, methodType(int.class, Void.class, int.class, int.class, int.class)).
- invoke(null, 0, 1, 1);
+ int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, int.class, int.class)).
+ invokeExact((int[]) null, 0, 1, 1);
});
- checkCCE(() -> { // array reference class
+ hs.checkWMTEOrCCE(() -> { // array reference class
int x = (int) hs.get(am, methodType(int.class, Class.class, int.class, int.class, int.class)).
- invoke(Void.class, 0, 1, 1);
+ invokeExact(Void.class, 0, 1, 1);
});
checkWMTE(() -> { // expected reference class
int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, Class.class, int.class)).
- invoke(array, 0, Void.class, 1);
+ invokeExact(array, 0, Void.class, 1);
});
checkWMTE(() -> { // actual reference class
int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, int.class, Class.class)).
- invoke(array, 0, 1, Void.class);
+ invokeExact(array, 0, 1, Void.class);
});
checkWMTE(() -> { // array primitive class
int x = (int) hs.get(am, methodType(int.class, int.class, int.class, int.class, int.class)).
- invoke(0, 0, 1, 1);
+ invokeExact(0, 0, 1, 1);
});
checkWMTE(() -> { // index reference class
int x = (int) hs.get(am, methodType(int.class, int[].class, Class.class, int.class, int.class)).
- invoke(array, Void.class, 1, 1);
+ invokeExact(array, Void.class, 1, 1);
});
// Incorrect return type
checkWMTE(() -> { // reference class
Void r = (Void) hs.get(am, methodType(Void.class, int[].class, int.class, int.class, int.class)).
- invoke(array, 0, 1, 1);
+ invokeExact(array, 0, 1, 1);
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, int[].class, int.class, int.class, int.class)).
- invoke(array, 0, 1, 1);
+ invokeExact(array, 0, 1, 1);
});
// Incorrect arity
checkWMTE(() -> { // 0
int x = (int) hs.get(am, methodType(int.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, int.class, int.class, Class.class)).
- invoke(array, 0, 1, 1, Void.class);
+ invokeExact(array, 0, 1, 1, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
// Incorrect argument types
checkNPE(() -> { // null array
- int x = (int) hs.get(am, methodType(int.class, Void.class, int.class, int.class)).
- invoke(null, 0, 1);
+ int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, int.class)).
+ invokeExact((int[]) null, 0, 1);
});
- checkCCE(() -> { // array reference class
+ hs.checkWMTEOrCCE(() -> { // array reference class
int x = (int) hs.get(am, methodType(int.class, Class.class, int.class, int.class)).
- invoke(Void.class, 0, 1);
+ invokeExact(Void.class, 0, 1);
});
checkWMTE(() -> { // value reference class
int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, Class.class)).
- invoke(array, 0, Void.class);
+ invokeExact(array, 0, Void.class);
});
checkWMTE(() -> { // array primitive class
int x = (int) hs.get(am, methodType(int.class, int.class, int.class, int.class)).
- invoke(0, 0, 1);
+ invokeExact(0, 0, 1);
});
checkWMTE(() -> { // index reference class
int x = (int) hs.get(am, methodType(int.class, int[].class, Class.class, int.class)).
- invoke(array, Void.class, 1);
+ invokeExact(array, Void.class, 1);
});
// Incorrect return type
checkWMTE(() -> { // reference class
Void r = (Void) hs.get(am, methodType(Void.class, int[].class, int.class, int.class)).
- invoke(array, 0, 1);
+ invokeExact(array, 0, 1);
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, int[].class, int.class, int.class)).
- invoke(array, 0, 1);
+ invokeExact(array, 0, 1);
});
// Incorrect arity
checkWMTE(() -> { // 0
int x = (int) hs.get(am, methodType(int.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, int.class, Class.class)).
- invoke(array, 0, 1, Void.class);
+ invokeExact(array, 0, 1, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
// Incorrect argument types
checkNPE(() -> { // null array
- int x = (int) hs.get(am, methodType(int.class, Void.class, int.class, int.class)).
- invoke(null, 0, 1);
+ int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, int.class)).
+ invokeExact((int[]) null, 0, 1);
});
- checkCCE(() -> { // array reference class
+ hs.checkWMTEOrCCE(() -> { // array reference class
int x = (int) hs.get(am, methodType(int.class, Class.class, int.class, int.class)).
- invoke(Void.class, 0, 1);
+ invokeExact(Void.class, 0, 1);
});
checkWMTE(() -> { // value reference class
int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, Class.class)).
- invoke(array, 0, Void.class);
+ invokeExact(array, 0, Void.class);
});
checkWMTE(() -> { // array primitive class
int x = (int) hs.get(am, methodType(int.class, int.class, int.class, int.class)).
- invoke(0, 0, 1);
+ invokeExact(0, 0, 1);
});
checkWMTE(() -> { // index reference class
int x = (int) hs.get(am, methodType(int.class, int[].class, Class.class, int.class)).
- invoke(array, Void.class, 1);
+ invokeExact(array, Void.class, 1);
});
// Incorrect return type
checkWMTE(() -> { // reference class
Void r = (Void) hs.get(am, methodType(Void.class, int[].class, int.class, int.class)).
- invoke(array, 0, 1);
+ invokeExact(array, 0, 1);
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, int[].class, int.class, int.class)).
- invoke(array, 0, 1);
+ invokeExact(array, 0, 1);
});
// Incorrect arity
checkWMTE(() -> { // 0
int x = (int) hs.get(am, methodType(int.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, int.class, Class.class)).
- invoke(array, 0, 1, Void.class);
+ invokeExact(array, 0, 1, Void.class);
});
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeLong.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeLong.java Tue May 17 12:06:41 2016 +0200
@@ -23,6 +23,7 @@
/*
* @test
+ * @bug 8156486
* @run testng/othervm VarHandleTestMethodTypeLong
* @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodTypeLong
*/
@@ -81,27 +82,28 @@
public Object[][] accessTestCaseProvider() throws Exception {
List<AccessTestCase<?>> cases = new ArrayList<>();
- cases.add(new VarHandleAccessTestCase("Instance field wrong method type",
+ cases.add(new VarHandleAccessTestCase("Instance field",
vhField, vh -> testInstanceFieldWrongMethodType(this, vh),
false));
- cases.add(new VarHandleAccessTestCase("Static field wrong method type",
+ cases.add(new VarHandleAccessTestCase("Static field",
vhStaticField, VarHandleTestMethodTypeLong::testStaticFieldWrongMethodType,
false));
- cases.add(new VarHandleAccessTestCase("Array wrong method type",
+ cases.add(new VarHandleAccessTestCase("Array",
vhArray, VarHandleTestMethodTypeLong::testArrayWrongMethodType,
false));
+
for (VarHandleToMethodHandle f : VarHandleToMethodHandle.values()) {
- cases.add(new MethodHandleAccessTestCase("Instance field wrong method type",
+ cases.add(new MethodHandleAccessTestCase("Instance field",
vhField, f, hs -> testInstanceFieldWrongMethodType(this, hs),
false));
- cases.add(new MethodHandleAccessTestCase("Static field wrong method type",
+ cases.add(new MethodHandleAccessTestCase("Static field",
vhStaticField, f, VarHandleTestMethodTypeLong::testStaticFieldWrongMethodType,
false));
- cases.add(new MethodHandleAccessTestCase("Array wrong method type",
+ cases.add(new MethodHandleAccessTestCase("Array",
vhArray, f, VarHandleTestMethodTypeLong::testArrayWrongMethodType,
false));
}
@@ -644,211 +646,211 @@
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
- long x = (long) hs.get(am, methodType(long.class, Void.class)).
- invoke(null);
+ long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class)).
+ invokeExact((VarHandleTestMethodTypeLong) null);
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
long x = (long) hs.get(am, methodType(long.class, Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
checkWMTE(() -> { // receiver primitive class
long x = (long) hs.get(am, methodType(long.class, int.class)).
- invoke(0);
+ invokeExact(0);
});
// Incorrect return type
checkWMTE(() -> { // reference class
- Void x = (Void) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class)).
- invoke(recv);
+ Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeLong.class)).
+ invokeExact(recv);
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeLong.class)).
- invoke(recv);
+ invokeExact(recv);
});
// Incorrect arity
checkWMTE(() -> { // 0
long x = (long) hs.get(am, methodType(long.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, Class.class)).
- invoke(recv, Void.class);
+ invokeExact(recv, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
- hs.get(am, methodType(void.class, Void.class, long.class)).
- invoke(null, 1L);
+ hs.get(am, methodType(void.class, VarHandleTestMethodTypeLong.class, long.class)).
+ invokeExact((VarHandleTestMethodTypeLong) null, 1L);
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
hs.get(am, methodType(void.class, Class.class, long.class)).
- invoke(Void.class, 1L);
+ invokeExact(Void.class, 1L);
});
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, VarHandleTestMethodTypeLong.class, Class.class)).
- invoke(recv, Void.class);
+ invokeExact(recv, Void.class);
});
checkWMTE(() -> { // receiver primitive class
hs.get(am, methodType(void.class, int.class, long.class)).
- invoke(0, 1L);
+ invokeExact(0, 1L);
});
// Incorrect arity
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
hs.get(am, methodType(void.class, VarHandleTestMethodTypeLong.class, long.class, Class.class)).
- invoke(recv, 1L, Void.class);
+ invokeExact(recv, 1L, 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, Void.class, long.class, long.class)).
- invoke(null, 1L, 1L);
+ boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeLong.class, long.class, long.class)).
+ invokeExact((VarHandleTestMethodTypeLong) null, 1L, 1L);
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, long.class, long.class)).
- invoke(Void.class, 1L, 1L);
+ invokeExact(Void.class, 1L, 1L);
});
checkWMTE(() -> { // expected reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeLong.class, Class.class, long.class)).
- invoke(recv, Void.class, 1L);
+ invokeExact(recv, Void.class, 1L);
});
checkWMTE(() -> { // actual reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeLong.class, long.class, Class.class)).
- invoke(recv, 1L, Void.class);
+ invokeExact(recv, 1L, Void.class);
});
checkWMTE(() -> { // receiver primitive class
boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class , long.class, long.class)).
- invoke(0, 1L, 1L);
+ invokeExact(0, 1L, 1L);
});
// Incorrect arity
checkWMTE(() -> { // 0
boolean r = (boolean) hs.get(am, methodType(boolean.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeLong.class, long.class, long.class, Class.class)).
- invoke(recv, 1L, 1L, Void.class);
+ invokeExact(recv, 1L, 1L, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkNPE(() -> { // null receiver
- long x = (long) hs.get(am, methodType(long.class, Void.class, long.class, long.class)).
- invoke(null, 1L, 1L);
+ long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, long.class, long.class)).
+ invokeExact((VarHandleTestMethodTypeLong) null, 1L, 1L);
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
long x = (long) hs.get(am, methodType(long.class, Class.class, long.class, long.class)).
- invoke(Void.class, 1L, 1L);
+ invokeExact(Void.class, 1L, 1L);
});
checkWMTE(() -> { // expected reference class
long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, Class.class, long.class)).
- invoke(recv, Void.class, 1L);
+ invokeExact(recv, Void.class, 1L);
});
checkWMTE(() -> { // actual reference class
long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, long.class, Class.class)).
- invoke(recv, 1L, Void.class);
+ invokeExact(recv, 1L, Void.class);
});
checkWMTE(() -> { // reciever primitive class
long x = (long) hs.get(am, methodType(long.class, int.class , long.class, long.class)).
- invoke(0, 1L, 1L);
+ invokeExact(0, 1L, 1L);
});
// Incorrect return type
checkWMTE(() -> { // reference class
Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeLong.class , long.class, long.class)).
- invoke(recv, 1L, 1L);
+ invokeExact(recv, 1L, 1L);
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeLong.class , long.class, long.class)).
- invoke(recv, 1L, 1L);
+ invokeExact(recv, 1L, 1L);
});
// Incorrect arity
checkWMTE(() -> { // 0
long x = (long) hs.get(am, methodType(long.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, long.class, long.class, Class.class)).
- invoke(recv, 1L, 1L, Void.class);
+ invokeExact(recv, 1L, 1L, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkNPE(() -> { // null receiver
- long x = (long) hs.get(am, methodType(long.class, Void.class, long.class)).
- invoke(null, 1L);
+ long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, long.class)).
+ invokeExact((VarHandleTestMethodTypeLong) null, 1L);
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
long x = (long) hs.get(am, methodType(long.class, Class.class, long.class)).
- invoke(Void.class, 1L);
+ invokeExact(Void.class, 1L);
});
checkWMTE(() -> { // value reference class
long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, Class.class)).
- invoke(recv, Void.class);
+ invokeExact(recv, Void.class);
});
checkWMTE(() -> { // reciever primitive class
long x = (long) hs.get(am, methodType(long.class, int.class, long.class)).
- invoke(0, 1L);
+ invokeExact(0, 1L);
});
// Incorrect return type
checkWMTE(() -> { // reference class
Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeLong.class, long.class)).
- invoke(recv, 1L);
+ invokeExact(recv, 1L);
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeLong.class, long.class)).
- invoke(recv, 1L);
+ invokeExact(recv, 1L);
});
// Incorrect arity
checkWMTE(() -> { // 0
long x = (long) hs.get(am, methodType(long.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, long.class)).
- invoke(recv, 1L, Void.class);
+ invokeExact(recv, 1L, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkNPE(() -> { // null receiver
- long x = (long) hs.get(am, methodType(long.class, Void.class, long.class)).
- invoke(null, 1L);
+ long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, long.class)).
+ invokeExact((VarHandleTestMethodTypeLong) null, 1L);
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
long x = (long) hs.get(am, methodType(long.class, Class.class, long.class)).
- invoke(Void.class, 1L);
+ invokeExact(Void.class, 1L);
});
checkWMTE(() -> { // value reference class
long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, Class.class)).
- invoke(recv, Void.class);
+ invokeExact(recv, Void.class);
});
checkWMTE(() -> { // reciever primitive class
long x = (long) hs.get(am, methodType(long.class, int.class, long.class)).
- invoke(0, 1L);
+ invokeExact(0, 1L);
});
// Incorrect return type
checkWMTE(() -> { // reference class
Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeLong.class, long.class)).
- invoke(recv, 1L);
+ invokeExact(recv, 1L);
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeLong.class, long.class)).
- invoke(recv, 1L);
+ invokeExact(recv, 1L);
});
// Incorrect arity
checkWMTE(() -> { // 0
long x = (long) hs.get(am, methodType(long.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, long.class)).
- invoke(recv, 1L, Void.class);
+ invokeExact(recv, 1L, Void.class);
});
}
}
@@ -1190,52 +1192,52 @@
// Incorrect return type
checkWMTE(() -> { // reference class
Void x = (Void) hs.get(am, methodType(Void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class)).
- invoke();
+ invokeExact();
});
// Incorrect arity
checkWMTE(() -> { // >
long x = (long) hs.get(am, methodType(Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
// Incorrect arity
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
hs.get(am, methodType(void.class, long.class, Class.class)).
- invoke(1L, Void.class);
+ invokeExact(1L, 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, long.class)).
- invoke(Void.class, 1L);
+ invokeExact(Void.class, 1L);
});
checkWMTE(() -> { // actual reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, long.class, Class.class)).
- invoke(1L, Void.class);
+ invokeExact(1L, Void.class);
});
// Incorrect arity
checkWMTE(() -> { // 0
boolean r = (boolean) hs.get(am, methodType(boolean.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
boolean r = (boolean) hs.get(am, methodType(boolean.class, long.class, long.class, Class.class)).
- invoke(1L, 1L, Void.class);
+ invokeExact(1L, 1L, Void.class);
});
}
@@ -1243,29 +1245,29 @@
// Incorrect argument types
checkWMTE(() -> { // expected reference class
long x = (long) hs.get(am, methodType(long.class, Class.class, long.class)).
- invoke(Void.class, 1L);
+ invokeExact(Void.class, 1L);
});
checkWMTE(() -> { // actual reference class
long x = (long) hs.get(am, methodType(long.class, long.class, Class.class)).
- invoke(1L, Void.class);
+ invokeExact(1L, Void.class);
});
// Incorrect return type
checkWMTE(() -> { // reference class
Void r = (Void) hs.get(am, methodType(Void.class, long.class, long.class)).
- invoke(1L, 1L);
+ invokeExact(1L, 1L);
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, long.class, long.class)).
- invoke(1L, 1L);
+ invokeExact(1L, 1L);
});
// Incorrect arity
checkWMTE(() -> { // 0
long x = (long) hs.get(am, methodType(long.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
long x = (long) hs.get(am, methodType(long.class, long.class, long.class, Class.class)).
- invoke(1L, 1L, Void.class);
+ invokeExact(1L, 1L, Void.class);
});
}
@@ -1273,25 +1275,25 @@
// Incorrect argument types
checkWMTE(() -> { // value reference class
long x = (long) hs.get(am, methodType(long.class, Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
// Incorrect return type
checkWMTE(() -> { // reference class
Void r = (Void) hs.get(am, methodType(Void.class, long.class)).
- invoke(1L);
+ invokeExact(1L);
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, long.class)).
- invoke(1L);
+ invokeExact(1L);
});
// Incorrect arity
checkWMTE(() -> { // 0
long x = (long) hs.get(am, methodType(long.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
long x = (long) hs.get(am, methodType(long.class, long.class, Class.class)).
- invoke(1L, Void.class);
+ invokeExact(1L, Void.class);
});
}
@@ -1299,25 +1301,25 @@
// Incorrect argument types
checkWMTE(() -> { // value reference class
long x = (long) hs.get(am, methodType(long.class, Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
// Incorrect return type
checkWMTE(() -> { // reference class
Void r = (Void) hs.get(am, methodType(Void.class, long.class)).
- invoke(1L);
+ invokeExact(1L);
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, long.class)).
- invoke(1L);
+ invokeExact(1L);
});
// Incorrect arity
checkWMTE(() -> { // 0
long x = (long) hs.get(am, methodType(long.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
long x = (long) hs.get(am, methodType(long.class, long.class, Class.class)).
- invoke(1L, Void.class);
+ invokeExact(1L, Void.class);
});
}
}
@@ -1909,237 +1911,237 @@
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null array
- long x = (long) hs.get(am, methodType(long.class, Void.class, int.class)).
- invoke(null, 0);
+ long x = (long) hs.get(am, methodType(long.class, long[].class, int.class)).
+ invokeExact((long[]) null, 0);
});
- checkCCE(() -> { // array reference class
+ hs.checkWMTEOrCCE(() -> { // array reference class
long x = (long) hs.get(am, methodType(long.class, Class.class, int.class)).
- invoke(Void.class, 0);
+ invokeExact(Void.class, 0);
});
checkWMTE(() -> { // array primitive class
long x = (long) hs.get(am, methodType(long.class, int.class, int.class)).
- invoke(0, 0);
+ invokeExact(0, 0);
});
checkWMTE(() -> { // index reference class
long x = (long) hs.get(am, methodType(long.class, long[].class, Class.class)).
- invoke(array, Void.class);
+ invokeExact(array, Void.class);
});
// Incorrect return type
checkWMTE(() -> { // reference class
Void x = (Void) hs.get(am, methodType(Void.class, long[].class, int.class)).
- invoke(array, 0);
+ invokeExact(array, 0);
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, long[].class, int.class)).
- invoke(array, 0);
+ invokeExact(array, 0);
});
// Incorrect arity
checkWMTE(() -> { // 0
long x = (long) hs.get(am, methodType(long.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, Class.class)).
- invoke(array, 0, Void.class);
+ invokeExact(array, 0, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null array
- hs.get(am, methodType(void.class, Void.class, int.class, long.class)).
- invoke(null, 0, 1L);
+ hs.get(am, methodType(void.class, long[].class, int.class, long.class)).
+ invokeExact((long[]) null, 0, 1L);
});
- checkCCE(() -> { // array reference class
+ hs.checkWMTEOrCCE(() -> { // array reference class
hs.get(am, methodType(void.class, Class.class, int.class, long.class)).
- invoke(Void.class, 0, 1L);
+ invokeExact(Void.class, 0, 1L);
});
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, long[].class, int.class, Class.class)).
- invoke(array, 0, Void.class);
+ invokeExact(array, 0, Void.class);
});
checkWMTE(() -> { // receiver primitive class
hs.get(am, methodType(void.class, int.class, int.class, long.class)).
- invoke(0, 0, 1L);
+ invokeExact(0, 0, 1L);
});
checkWMTE(() -> { // index reference class
hs.get(am, methodType(void.class, long[].class, Class.class, long.class)).
- invoke(array, Void.class, 1L);
+ invokeExact(array, Void.class, 1L);
});
// Incorrect arity
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
hs.get(am, methodType(void.class, long[].class, int.class, Class.class)).
- invoke(array, 0, 1L, Void.class);
+ invokeExact(array, 0, 1L, 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, Void.class, int.class, long.class, long.class)).
- invoke(null, 0, 1L, 1L);
+ boolean r = (boolean) hs.get(am, methodType(boolean.class, long[].class, int.class, long.class, long.class)).
+ invokeExact((long[]) null, 0, 1L, 1L);
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, int.class, long.class, long.class)).
- invoke(Void.class, 0, 1L, 1L);
+ invokeExact(Void.class, 0, 1L, 1L);
});
checkWMTE(() -> { // expected reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, long[].class, int.class, Class.class, long.class)).
- invoke(array, 0, Void.class, 1L);
+ invokeExact(array, 0, Void.class, 1L);
});
checkWMTE(() -> { // actual reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, long[].class, int.class, long.class, Class.class)).
- invoke(array, 0, 1L, Void.class);
+ invokeExact(array, 0, 1L, Void.class);
});
checkWMTE(() -> { // receiver primitive class
boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class, int.class, long.class, long.class)).
- invoke(0, 0, 1L, 1L);
+ invokeExact(0, 0, 1L, 1L);
});
checkWMTE(() -> { // index reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, long[].class, Class.class, long.class, long.class)).
- invoke(array, Void.class, 1L, 1L);
+ invokeExact(array, Void.class, 1L, 1L);
});
// Incorrect arity
checkWMTE(() -> { // 0
boolean r = (boolean) hs.get(am, methodType(boolean.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
boolean r = (boolean) hs.get(am, methodType(boolean.class, long[].class, int.class, long.class, long.class, Class.class)).
- invoke(array, 0, 1L, 1L, Void.class);
+ invokeExact(array, 0, 1L, 1L, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
- long x = (long) hs.get(am, methodType(long.class, Void.class, int.class, long.class, long.class)).
- invoke(null, 0, 1L, 1L);
+ long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, long.class, long.class)).
+ invokeExact((long[]) null, 0, 1L, 1L);
});
- checkCCE(() -> { // array reference class
+ hs.checkWMTEOrCCE(() -> { // array reference class
long x = (long) hs.get(am, methodType(long.class, Class.class, int.class, long.class, long.class)).
- invoke(Void.class, 0, 1L, 1L);
+ invokeExact(Void.class, 0, 1L, 1L);
});
checkWMTE(() -> { // expected reference class
long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, Class.class, long.class)).
- invoke(array, 0, Void.class, 1L);
+ invokeExact(array, 0, Void.class, 1L);
});
checkWMTE(() -> { // actual reference class
long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, long.class, Class.class)).
- invoke(array, 0, 1L, Void.class);
+ invokeExact(array, 0, 1L, Void.class);
});
checkWMTE(() -> { // array primitive class
long x = (long) hs.get(am, methodType(long.class, int.class, int.class, long.class, long.class)).
- invoke(0, 0, 1L, 1L);
+ invokeExact(0, 0, 1L, 1L);
});
checkWMTE(() -> { // index reference class
long x = (long) hs.get(am, methodType(long.class, long[].class, Class.class, long.class, long.class)).
- invoke(array, Void.class, 1L, 1L);
+ invokeExact(array, Void.class, 1L, 1L);
});
// Incorrect return type
checkWMTE(() -> { // reference class
Void r = (Void) hs.get(am, methodType(Void.class, long[].class, int.class, long.class, long.class)).
- invoke(array, 0, 1L, 1L);
+ invokeExact(array, 0, 1L, 1L);
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, long[].class, int.class, long.class, long.class)).
- invoke(array, 0, 1L, 1L);
+ invokeExact(array, 0, 1L, 1L);
});
// Incorrect arity
checkWMTE(() -> { // 0
long x = (long) hs.get(am, methodType(long.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, long.class, long.class, Class.class)).
- invoke(array, 0, 1L, 1L, Void.class);
+ invokeExact(array, 0, 1L, 1L, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
// Incorrect argument types
checkNPE(() -> { // null array
- long x = (long) hs.get(am, methodType(long.class, Void.class, int.class, long.class)).
- invoke(null, 0, 1L);
+ long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, long.class)).
+ invokeExact((long[]) null, 0, 1L);
});
- checkCCE(() -> { // array reference class
+ hs.checkWMTEOrCCE(() -> { // array reference class
long x = (long) hs.get(am, methodType(long.class, Class.class, int.class, long.class)).
- invoke(Void.class, 0, 1L);
+ invokeExact(Void.class, 0, 1L);
});
checkWMTE(() -> { // value reference class
long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, Class.class)).
- invoke(array, 0, Void.class);
+ invokeExact(array, 0, Void.class);
});
checkWMTE(() -> { // array primitive class
long x = (long) hs.get(am, methodType(long.class, int.class, int.class, long.class)).
- invoke(0, 0, 1L);
+ invokeExact(0, 0, 1L);
});
checkWMTE(() -> { // index reference class
long x = (long) hs.get(am, methodType(long.class, long[].class, Class.class, long.class)).
- invoke(array, Void.class, 1L);
+ invokeExact(array, Void.class, 1L);
});
// Incorrect return type
checkWMTE(() -> { // reference class
Void r = (Void) hs.get(am, methodType(Void.class, long[].class, int.class, long.class)).
- invoke(array, 0, 1L);
+ invokeExact(array, 0, 1L);
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, long[].class, int.class, long.class)).
- invoke(array, 0, 1L);
+ invokeExact(array, 0, 1L);
});
// Incorrect arity
checkWMTE(() -> { // 0
long x = (long) hs.get(am, methodType(long.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, long.class, Class.class)).
- invoke(array, 0, 1L, Void.class);
+ invokeExact(array, 0, 1L, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
// Incorrect argument types
checkNPE(() -> { // null array
- long x = (long) hs.get(am, methodType(long.class, Void.class, int.class, long.class)).
- invoke(null, 0, 1L);
+ long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, long.class)).
+ invokeExact((long[]) null, 0, 1L);
});
- checkCCE(() -> { // array reference class
+ hs.checkWMTEOrCCE(() -> { // array reference class
long x = (long) hs.get(am, methodType(long.class, Class.class, int.class, long.class)).
- invoke(Void.class, 0, 1L);
+ invokeExact(Void.class, 0, 1L);
});
checkWMTE(() -> { // value reference class
long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, Class.class)).
- invoke(array, 0, Void.class);
+ invokeExact(array, 0, Void.class);
});
checkWMTE(() -> { // array primitive class
long x = (long) hs.get(am, methodType(long.class, int.class, int.class, long.class)).
- invoke(0, 0, 1L);
+ invokeExact(0, 0, 1L);
});
checkWMTE(() -> { // index reference class
long x = (long) hs.get(am, methodType(long.class, long[].class, Class.class, long.class)).
- invoke(array, Void.class, 1L);
+ invokeExact(array, Void.class, 1L);
});
// Incorrect return type
checkWMTE(() -> { // reference class
Void r = (Void) hs.get(am, methodType(Void.class, long[].class, int.class, long.class)).
- invoke(array, 0, 1L);
+ invokeExact(array, 0, 1L);
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, long[].class, int.class, long.class)).
- invoke(array, 0, 1L);
+ invokeExact(array, 0, 1L);
});
// Incorrect arity
checkWMTE(() -> { // 0
long x = (long) hs.get(am, methodType(long.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, long.class, Class.class)).
- invoke(array, 0, 1L, Void.class);
+ invokeExact(array, 0, 1L, Void.class);
});
}
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeShort.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeShort.java Tue May 17 12:06:41 2016 +0200
@@ -23,6 +23,7 @@
/*
* @test
+ * @bug 8156486
* @run testng/othervm VarHandleTestMethodTypeShort
* @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodTypeShort
*/
@@ -81,27 +82,28 @@
public Object[][] accessTestCaseProvider() throws Exception {
List<AccessTestCase<?>> cases = new ArrayList<>();
- cases.add(new VarHandleAccessTestCase("Instance field wrong method type",
+ cases.add(new VarHandleAccessTestCase("Instance field",
vhField, vh -> testInstanceFieldWrongMethodType(this, vh),
false));
- cases.add(new VarHandleAccessTestCase("Static field wrong method type",
+ cases.add(new VarHandleAccessTestCase("Static field",
vhStaticField, VarHandleTestMethodTypeShort::testStaticFieldWrongMethodType,
false));
- cases.add(new VarHandleAccessTestCase("Array wrong method type",
+ cases.add(new VarHandleAccessTestCase("Array",
vhArray, VarHandleTestMethodTypeShort::testArrayWrongMethodType,
false));
+
for (VarHandleToMethodHandle f : VarHandleToMethodHandle.values()) {
- cases.add(new MethodHandleAccessTestCase("Instance field wrong method type",
+ cases.add(new MethodHandleAccessTestCase("Instance field",
vhField, f, hs -> testInstanceFieldWrongMethodType(this, hs),
false));
- cases.add(new MethodHandleAccessTestCase("Static field wrong method type",
+ cases.add(new MethodHandleAccessTestCase("Static field",
vhStaticField, f, VarHandleTestMethodTypeShort::testStaticFieldWrongMethodType,
false));
- cases.add(new MethodHandleAccessTestCase("Array wrong method type",
+ cases.add(new MethodHandleAccessTestCase("Array",
vhArray, f, VarHandleTestMethodTypeShort::testArrayWrongMethodType,
false));
}
@@ -329,63 +331,63 @@
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
- short x = (short) hs.get(am, methodType(short.class, Void.class)).
- invoke(null);
+ short x = (short) hs.get(am, methodType(short.class, VarHandleTestMethodTypeShort.class)).
+ invokeExact((VarHandleTestMethodTypeShort) null);
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
short x = (short) hs.get(am, methodType(short.class, Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
checkWMTE(() -> { // receiver primitive class
short x = (short) hs.get(am, methodType(short.class, int.class)).
- invoke(0);
+ invokeExact(0);
});
// Incorrect return type
checkWMTE(() -> { // reference class
- Void x = (Void) hs.get(am, methodType(short.class, VarHandleTestMethodTypeShort.class)).
- invoke(recv);
+ Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeShort.class)).
+ invokeExact(recv);
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeShort.class)).
- invoke(recv);
+ invokeExact(recv);
});
// Incorrect arity
checkWMTE(() -> { // 0
short x = (short) hs.get(am, methodType(short.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
short x = (short) hs.get(am, methodType(short.class, VarHandleTestMethodTypeShort.class, Class.class)).
- invoke(recv, Void.class);
+ invokeExact(recv, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
- hs.get(am, methodType(void.class, Void.class, short.class)).
- invoke(null, (short)1);
+ hs.get(am, methodType(void.class, VarHandleTestMethodTypeShort.class, short.class)).
+ invokeExact((VarHandleTestMethodTypeShort) null, (short)1);
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
hs.get(am, methodType(void.class, Class.class, short.class)).
- invoke(Void.class, (short)1);
+ invokeExact(Void.class, (short)1);
});
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, VarHandleTestMethodTypeShort.class, Class.class)).
- invoke(recv, Void.class);
+ invokeExact(recv, Void.class);
});
checkWMTE(() -> { // receiver primitive class
hs.get(am, methodType(void.class, int.class, short.class)).
- invoke(0, (short)1);
+ invokeExact(0, (short)1);
});
// Incorrect arity
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
hs.get(am, methodType(void.class, VarHandleTestMethodTypeShort.class, short.class, Class.class)).
- invoke(recv, (short)1, Void.class);
+ invokeExact(recv, (short)1, Void.class);
});
}
@@ -513,32 +515,32 @@
// Incorrect return type
checkWMTE(() -> { // reference class
Void x = (Void) hs.get(am, methodType(Void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class)).
- invoke();
+ invokeExact();
});
// Incorrect arity
checkWMTE(() -> { // >
short x = (short) hs.get(am, methodType(Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
// Incorrect arity
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
hs.get(am, methodType(void.class, short.class, Class.class)).
- invoke((short)1, Void.class);
+ invokeExact((short)1, Void.class);
});
}
@@ -783,71 +785,71 @@
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null array
- short x = (short) hs.get(am, methodType(short.class, Void.class, int.class)).
- invoke(null, 0);
+ short x = (short) hs.get(am, methodType(short.class, short[].class, int.class)).
+ invokeExact((short[]) null, 0);
});
- checkCCE(() -> { // array reference class
+ hs.checkWMTEOrCCE(() -> { // array reference class
short x = (short) hs.get(am, methodType(short.class, Class.class, int.class)).
- invoke(Void.class, 0);
+ invokeExact(Void.class, 0);
});
checkWMTE(() -> { // array primitive class
short x = (short) hs.get(am, methodType(short.class, int.class, int.class)).
- invoke(0, 0);
+ invokeExact(0, 0);
});
checkWMTE(() -> { // index reference class
short x = (short) hs.get(am, methodType(short.class, short[].class, Class.class)).
- invoke(array, Void.class);
+ invokeExact(array, Void.class);
});
// Incorrect return type
checkWMTE(() -> { // reference class
Void x = (Void) hs.get(am, methodType(Void.class, short[].class, int.class)).
- invoke(array, 0);
+ invokeExact(array, 0);
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, short[].class, int.class)).
- invoke(array, 0);
+ invokeExact(array, 0);
});
// Incorrect arity
checkWMTE(() -> { // 0
short x = (short) hs.get(am, methodType(short.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
short x = (short) hs.get(am, methodType(short.class, short[].class, int.class, Class.class)).
- invoke(array, 0, Void.class);
+ invokeExact(array, 0, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null array
- hs.get(am, methodType(void.class, Void.class, int.class, short.class)).
- invoke(null, 0, (short)1);
+ hs.get(am, methodType(void.class, short[].class, int.class, short.class)).
+ invokeExact((short[]) null, 0, (short)1);
});
- checkCCE(() -> { // array reference class
+ hs.checkWMTEOrCCE(() -> { // array reference class
hs.get(am, methodType(void.class, Class.class, int.class, short.class)).
- invoke(Void.class, 0, (short)1);
+ invokeExact(Void.class, 0, (short)1);
});
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, short[].class, int.class, Class.class)).
- invoke(array, 0, Void.class);
+ invokeExact(array, 0, Void.class);
});
checkWMTE(() -> { // receiver primitive class
hs.get(am, methodType(void.class, int.class, int.class, short.class)).
- invoke(0, 0, (short)1);
+ invokeExact(0, 0, (short)1);
});
checkWMTE(() -> { // index reference class
hs.get(am, methodType(void.class, short[].class, Class.class, short.class)).
- invoke(array, Void.class, (short)1);
+ invokeExact(array, Void.class, (short)1);
});
// Incorrect arity
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
hs.get(am, methodType(void.class, short[].class, int.class, Class.class)).
- invoke(array, 0, (short)1, Void.class);
+ invokeExact(array, 0, (short)1, Void.class);
});
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeString.java Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeString.java Tue May 17 12:06:41 2016 +0200
@@ -23,6 +23,7 @@
/*
* @test
+ * @bug 8156486
* @run testng/othervm VarHandleTestMethodTypeString
* @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodTypeString
*/
@@ -81,27 +82,28 @@
public Object[][] accessTestCaseProvider() throws Exception {
List<AccessTestCase<?>> cases = new ArrayList<>();
- cases.add(new VarHandleAccessTestCase("Instance field wrong method type",
+ cases.add(new VarHandleAccessTestCase("Instance field",
vhField, vh -> testInstanceFieldWrongMethodType(this, vh),
false));
- cases.add(new VarHandleAccessTestCase("Static field wrong method type",
+ cases.add(new VarHandleAccessTestCase("Static field",
vhStaticField, VarHandleTestMethodTypeString::testStaticFieldWrongMethodType,
false));
- cases.add(new VarHandleAccessTestCase("Array wrong method type",
+ cases.add(new VarHandleAccessTestCase("Array",
vhArray, VarHandleTestMethodTypeString::testArrayWrongMethodType,
false));
+
for (VarHandleToMethodHandle f : VarHandleToMethodHandle.values()) {
- cases.add(new MethodHandleAccessTestCase("Instance field wrong method type",
+ cases.add(new MethodHandleAccessTestCase("Instance field",
vhField, f, hs -> testInstanceFieldWrongMethodType(this, hs),
false));
- cases.add(new MethodHandleAccessTestCase("Static field wrong method type",
+ cases.add(new MethodHandleAccessTestCase("Static field",
vhStaticField, f, VarHandleTestMethodTypeString::testStaticFieldWrongMethodType,
false));
- cases.add(new MethodHandleAccessTestCase("Array wrong method type",
+ cases.add(new MethodHandleAccessTestCase("Array",
vhArray, f, VarHandleTestMethodTypeString::testArrayWrongMethodType,
false));
}
@@ -586,174 +588,174 @@
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
- String x = (String) hs.get(am, methodType(String.class, Void.class)).
- invoke(null);
+ String x = (String) hs.get(am, methodType(String.class, VarHandleTestMethodTypeString.class)).
+ invokeExact((VarHandleTestMethodTypeString) null);
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
String x = (String) hs.get(am, methodType(String.class, Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
checkWMTE(() -> { // receiver primitive class
String x = (String) hs.get(am, methodType(String.class, int.class)).
- invoke(0);
+ invokeExact(0);
});
// Incorrect return type
- checkCCE(() -> { // reference class
- Void x = (Void) hs.get(am, methodType(String.class, VarHandleTestMethodTypeString.class)).
- invoke(recv);
+ hs.checkWMTEOrCCE(() -> { // reference class
+ Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeString.class)).
+ invokeExact(recv);
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeString.class)).
- invoke(recv);
+ invokeExact(recv);
});
// Incorrect arity
checkWMTE(() -> { // 0
String x = (String) hs.get(am, methodType(String.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
String x = (String) hs.get(am, methodType(String.class, VarHandleTestMethodTypeString.class, Class.class)).
- invoke(recv, Void.class);
+ invokeExact(recv, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
- hs.get(am, methodType(void.class, Void.class, String.class)).
- invoke(null, "foo");
+ hs.get(am, methodType(void.class, VarHandleTestMethodTypeString.class, String.class)).
+ invokeExact((VarHandleTestMethodTypeString) null, "foo");
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
hs.get(am, methodType(void.class, Class.class, String.class)).
- invoke(Void.class, "foo");
+ invokeExact(Void.class, "foo");
});
- checkCCE(() -> { // value reference class
+ hs.checkWMTEOrCCE(() -> { // value reference class
hs.get(am, methodType(void.class, VarHandleTestMethodTypeString.class, Class.class)).
- invoke(recv, Void.class);
+ invokeExact(recv, Void.class);
});
checkWMTE(() -> { // receiver primitive class
hs.get(am, methodType(void.class, int.class, String.class)).
- invoke(0, "foo");
+ invokeExact(0, "foo");
});
// Incorrect arity
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
hs.get(am, methodType(void.class, VarHandleTestMethodTypeString.class, String.class, Class.class)).
- invoke(recv, "foo", Void.class);
+ invokeExact(recv, "foo", 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, Void.class, String.class, String.class)).
- invoke(null, "foo", "foo");
+ boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeString.class, String.class, String.class)).
+ invokeExact((VarHandleTestMethodTypeString) null, "foo", "foo");
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, String.class, String.class)).
- invoke(Void.class, "foo", "foo");
+ invokeExact(Void.class, "foo", "foo");
});
- checkCCE(() -> { // expected reference class
+ hs.checkWMTEOrCCE(() -> { // expected reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeString.class, Class.class, String.class)).
- invoke(recv, Void.class, "foo");
+ invokeExact(recv, Void.class, "foo");
});
- checkCCE(() -> { // actual reference class
+ hs.checkWMTEOrCCE(() -> { // actual reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeString.class, String.class, Class.class)).
- invoke(recv, "foo", Void.class);
+ invokeExact(recv, "foo", Void.class);
});
checkWMTE(() -> { // receiver primitive class
boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class , String.class, String.class)).
- invoke(0, "foo", "foo");
+ invokeExact(0, "foo", "foo");
});
// Incorrect arity
checkWMTE(() -> { // 0
boolean r = (boolean) hs.get(am, methodType(boolean.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeString.class, String.class, String.class, Class.class)).
- invoke(recv, "foo", "foo", Void.class);
+ invokeExact(recv, "foo", "foo", Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkNPE(() -> { // null receiver
- String x = (String) hs.get(am, methodType(String.class, Void.class, String.class, String.class)).
- invoke(null, "foo", "foo");
+ String x = (String) hs.get(am, methodType(String.class, VarHandleTestMethodTypeString.class, String.class, String.class)).
+ invokeExact((VarHandleTestMethodTypeString) null, "foo", "foo");
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
String x = (String) hs.get(am, methodType(String.class, Class.class, String.class, String.class)).
- invoke(Void.class, "foo", "foo");
+ invokeExact(Void.class, "foo", "foo");
});
- checkCCE(() -> { // expected reference class
+ hs.checkWMTEOrCCE(() -> { // expected reference class
String x = (String) hs.get(am, methodType(String.class, VarHandleTestMethodTypeString.class, Class.class, String.class)).
- invoke(recv, Void.class, "foo");
+ invokeExact(recv, Void.class, "foo");
});
- checkCCE(() -> { // actual reference class
+ hs.checkWMTEOrCCE(() -> { // actual reference class
String x = (String) hs.get(am, methodType(String.class, VarHandleTestMethodTypeString.class, String.class, Class.class)).
- invoke(recv, "foo", Void.class);
+ invokeExact(recv, "foo", Void.class);
});
checkWMTE(() -> { // reciever primitive class
String x = (String) hs.get(am, methodType(String.class, int.class , String.class, String.class)).
- invoke(0, "foo", "foo");
+ invokeExact(0, "foo", "foo");
});
// Incorrect return type
- checkCCE(() -> { // reference class
+ hs.checkWMTEOrCCE(() -> { // reference class
Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeString.class , String.class, String.class)).
- invoke(recv, "foo", "foo");
+ invokeExact(recv, "foo", "foo");
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeString.class , String.class, String.class)).
- invoke(recv, "foo", "foo");
+ invokeExact(recv, "foo", "foo");
});
// Incorrect arity
checkWMTE(() -> { // 0
String x = (String) hs.get(am, methodType(String.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
String x = (String) hs.get(am, methodType(String.class, VarHandleTestMethodTypeString.class, String.class, String.class, Class.class)).
- invoke(recv, "foo", "foo", Void.class);
+ invokeExact(recv, "foo", "foo", Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkNPE(() -> { // null receiver
- String x = (String) hs.get(am, methodType(String.class, Void.class, String.class)).
- invoke(null, "foo");
+ String x = (String) hs.get(am, methodType(String.class, VarHandleTestMethodTypeString.class, String.class)).
+ invokeExact((VarHandleTestMethodTypeString) null, "foo");
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
String x = (String) hs.get(am, methodType(String.class, Class.class, String.class)).
- invoke(Void.class, "foo");
+ invokeExact(Void.class, "foo");
});
- checkCCE(() -> { // value reference class
+ hs.checkWMTEOrCCE(() -> { // value reference class
String x = (String) hs.get(am, methodType(String.class, VarHandleTestMethodTypeString.class, Class.class)).
- invoke(recv, Void.class);
+ invokeExact(recv, Void.class);
});
checkWMTE(() -> { // reciever primitive class
String x = (String) hs.get(am, methodType(String.class, int.class, String.class)).
- invoke(0, "foo");
+ invokeExact(0, "foo");
});
// Incorrect return type
- checkCCE(() -> { // reference class
+ hs.checkWMTEOrCCE(() -> { // reference class
Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeString.class, String.class)).
- invoke(recv, "foo");
+ invokeExact(recv, "foo");
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeString.class, String.class)).
- invoke(recv, "foo");
+ invokeExact(recv, "foo");
});
// Incorrect arity
checkWMTE(() -> { // 0
String x = (String) hs.get(am, methodType(String.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
String x = (String) hs.get(am, methodType(String.class, VarHandleTestMethodTypeString.class, String.class)).
- invoke(recv, "foo", Void.class);
+ invokeExact(recv, "foo", Void.class);
});
}
@@ -1054,110 +1056,110 @@
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect return type
- checkCCE(() -> { // reference class
+ hs.checkWMTEOrCCE(() -> { // reference class
Void x = (Void) hs.get(am, methodType(Void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class)).
- invoke();
+ invokeExact();
});
// Incorrect arity
checkWMTE(() -> { // >
String x = (String) hs.get(am, methodType(Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
- checkCCE(() -> { // value reference class
+ hs.checkWMTEOrCCE(() -> { // value reference class
hs.get(am, methodType(void.class, Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
// Incorrect arity
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
hs.get(am, methodType(void.class, String.class, Class.class)).
- invoke("foo", Void.class);
+ invokeExact("foo", Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
// Incorrect argument types
- checkCCE(() -> { // expected reference class
+ hs.checkWMTEOrCCE(() -> { // expected reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, String.class)).
- invoke(Void.class, "foo");
+ invokeExact(Void.class, "foo");
});
- checkCCE(() -> { // actual reference class
+ hs.checkWMTEOrCCE(() -> { // actual reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, String.class, Class.class)).
- invoke("foo", Void.class);
+ invokeExact("foo", Void.class);
});
// Incorrect arity
checkWMTE(() -> { // 0
boolean r = (boolean) hs.get(am, methodType(boolean.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
boolean r = (boolean) hs.get(am, methodType(boolean.class, String.class, String.class, Class.class)).
- invoke("foo", "foo", Void.class);
+ invokeExact("foo", "foo", Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
// Incorrect argument types
- checkCCE(() -> { // expected reference class
+ hs.checkWMTEOrCCE(() -> { // expected reference class
String x = (String) hs.get(am, methodType(String.class, Class.class, String.class)).
- invoke(Void.class, "foo");
+ invokeExact(Void.class, "foo");
});
- checkCCE(() -> { // actual reference class
+ hs.checkWMTEOrCCE(() -> { // actual reference class
String x = (String) hs.get(am, methodType(String.class, String.class, Class.class)).
- invoke("foo", Void.class);
+ invokeExact("foo", Void.class);
});
// Incorrect return type
- checkCCE(() -> { // reference class
+ hs.checkWMTEOrCCE(() -> { // reference class
Void r = (Void) hs.get(am, methodType(Void.class, String.class, String.class)).
- invoke("foo", "foo");
+ invokeExact("foo", "foo");
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, String.class, String.class)).
- invoke("foo", "foo");
+ invokeExact("foo", "foo");
});
// Incorrect arity
checkWMTE(() -> { // 0
String x = (String) hs.get(am, methodType(String.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
String x = (String) hs.get(am, methodType(String.class, String.class, String.class, Class.class)).
- invoke("foo", "foo", Void.class);
+ invokeExact("foo", "foo", Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
// Incorrect argument types
- checkCCE(() -> { // value reference class
+ hs.checkWMTEOrCCE(() -> { // value reference class
String x = (String) hs.get(am, methodType(String.class, Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
// Incorrect return type
- checkCCE(() -> { // reference class
+ hs.checkWMTEOrCCE(() -> { // reference class
Void r = (Void) hs.get(am, methodType(Void.class, String.class)).
- invoke("foo");
+ invokeExact("foo");
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, String.class)).
- invoke("foo");
+ invokeExact("foo");
});
// Incorrect arity
checkWMTE(() -> { // 0
String x = (String) hs.get(am, methodType(String.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
String x = (String) hs.get(am, methodType(String.class, String.class, Class.class)).
- invoke("foo", Void.class);
+ invokeExact("foo", Void.class);
});
}
@@ -1686,195 +1688,195 @@
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null array
- String x = (String) hs.get(am, methodType(String.class, Void.class, int.class)).
- invoke(null, 0);
+ String x = (String) hs.get(am, methodType(String.class, String[].class, int.class)).
+ invokeExact((String[]) null, 0);
});
- checkCCE(() -> { // array reference class
+ hs.checkWMTEOrCCE(() -> { // array reference class
String x = (String) hs.get(am, methodType(String.class, Class.class, int.class)).
- invoke(Void.class, 0);
+ invokeExact(Void.class, 0);
});
checkWMTE(() -> { // array primitive class
String x = (String) hs.get(am, methodType(String.class, int.class, int.class)).
- invoke(0, 0);
+ invokeExact(0, 0);
});
checkWMTE(() -> { // index reference class
String x = (String) hs.get(am, methodType(String.class, String[].class, Class.class)).
- invoke(array, Void.class);
+ invokeExact(array, Void.class);
});
// Incorrect return type
- checkCCE(() -> { // reference class
+ hs.checkWMTEOrCCE(() -> { // reference class
Void x = (Void) hs.get(am, methodType(Void.class, String[].class, int.class)).
- invoke(array, 0);
+ invokeExact(array, 0);
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, String[].class, int.class)).
- invoke(array, 0);
+ invokeExact(array, 0);
});
// Incorrect arity
checkWMTE(() -> { // 0
String x = (String) hs.get(am, methodType(String.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
String x = (String) hs.get(am, methodType(String.class, String[].class, int.class, Class.class)).
- invoke(array, 0, Void.class);
+ invokeExact(array, 0, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null array
- hs.get(am, methodType(void.class, Void.class, int.class, String.class)).
- invoke(null, 0, "foo");
+ hs.get(am, methodType(void.class, String[].class, int.class, String.class)).
+ invokeExact((String[]) null, 0, "foo");
});
- checkCCE(() -> { // array reference class
+ hs.checkWMTEOrCCE(() -> { // array reference class
hs.get(am, methodType(void.class, Class.class, int.class, String.class)).
- invoke(Void.class, 0, "foo");
+ invokeExact(Void.class, 0, "foo");
});
- checkCCE(() -> { // value reference class
+ hs.checkWMTEOrCCE(() -> { // value reference class
hs.get(am, methodType(void.class, String[].class, int.class, Class.class)).
- invoke(array, 0, Void.class);
+ invokeExact(array, 0, Void.class);
});
checkWMTE(() -> { // receiver primitive class
hs.get(am, methodType(void.class, int.class, int.class, String.class)).
- invoke(0, 0, "foo");
+ invokeExact(0, 0, "foo");
});
checkWMTE(() -> { // index reference class
hs.get(am, methodType(void.class, String[].class, Class.class, String.class)).
- invoke(array, Void.class, "foo");
+ invokeExact(array, Void.class, "foo");
});
// Incorrect arity
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
hs.get(am, methodType(void.class, String[].class, int.class, Class.class)).
- invoke(array, 0, "foo", Void.class);
+ invokeExact(array, 0, "foo", 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, Void.class, int.class, String.class, String.class)).
- invoke(null, 0, "foo", "foo");
+ boolean r = (boolean) hs.get(am, methodType(boolean.class, String[].class, int.class, String.class, String.class)).
+ invokeExact((String[]) null, 0, "foo", "foo");
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, int.class, String.class, String.class)).
- invoke(Void.class, 0, "foo", "foo");
+ invokeExact(Void.class, 0, "foo", "foo");
});
- checkCCE(() -> { // expected reference class
+ hs.checkWMTEOrCCE(() -> { // expected reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, String[].class, int.class, Class.class, String.class)).
- invoke(array, 0, Void.class, "foo");
+ invokeExact(array, 0, Void.class, "foo");
});
- checkCCE(() -> { // actual reference class
+ hs.checkWMTEOrCCE(() -> { // actual reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, String[].class, int.class, String.class, Class.class)).
- invoke(array, 0, "foo", Void.class);
+ invokeExact(array, 0, "foo", Void.class);
});
checkWMTE(() -> { // receiver primitive class
boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class, int.class, String.class, String.class)).
- invoke(0, 0, "foo", "foo");
+ invokeExact(0, 0, "foo", "foo");
});
checkWMTE(() -> { // index reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, String[].class, Class.class, String.class, String.class)).
- invoke(array, Void.class, "foo", "foo");
+ invokeExact(array, Void.class, "foo", "foo");
});
// Incorrect arity
checkWMTE(() -> { // 0
boolean r = (boolean) hs.get(am, methodType(boolean.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
boolean r = (boolean) hs.get(am, methodType(boolean.class, String[].class, int.class, String.class, String.class, Class.class)).
- invoke(array, 0, "foo", "foo", Void.class);
+ invokeExact(array, 0, "foo", "foo", Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
- String x = (String) hs.get(am, methodType(String.class, Void.class, int.class, String.class, String.class)).
- invoke(null, 0, "foo", "foo");
+ String x = (String) hs.get(am, methodType(String.class, String[].class, int.class, String.class, String.class)).
+ invokeExact((String[]) null, 0, "foo", "foo");
});
- checkCCE(() -> { // array reference class
+ hs.checkWMTEOrCCE(() -> { // array reference class
String x = (String) hs.get(am, methodType(String.class, Class.class, int.class, String.class, String.class)).
- invoke(Void.class, 0, "foo", "foo");
+ invokeExact(Void.class, 0, "foo", "foo");
});
- checkCCE(() -> { // expected reference class
+ hs.checkWMTEOrCCE(() -> { // expected reference class
String x = (String) hs.get(am, methodType(String.class, String[].class, int.class, Class.class, String.class)).
- invoke(array, 0, Void.class, "foo");
+ invokeExact(array, 0, Void.class, "foo");
});
- checkCCE(() -> { // actual reference class
+ hs.checkWMTEOrCCE(() -> { // actual reference class
String x = (String) hs.get(am, methodType(String.class, String[].class, int.class, String.class, Class.class)).
- invoke(array, 0, "foo", Void.class);
+ invokeExact(array, 0, "foo", Void.class);
});
checkWMTE(() -> { // array primitive class
String x = (String) hs.get(am, methodType(String.class, int.class, int.class, String.class, String.class)).
- invoke(0, 0, "foo", "foo");
+ invokeExact(0, 0, "foo", "foo");
});
checkWMTE(() -> { // index reference class
String x = (String) hs.get(am, methodType(String.class, String[].class, Class.class, String.class, String.class)).
- invoke(array, Void.class, "foo", "foo");
+ invokeExact(array, Void.class, "foo", "foo");
});
// Incorrect return type
- checkCCE(() -> { // reference class
+ hs.checkWMTEOrCCE(() -> { // reference class
Void r = (Void) hs.get(am, methodType(Void.class, String[].class, int.class, String.class, String.class)).
- invoke(array, 0, "foo", "foo");
+ invokeExact(array, 0, "foo", "foo");
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, String[].class, int.class, String.class, String.class)).
- invoke(array, 0, "foo", "foo");
+ invokeExact(array, 0, "foo", "foo");
});
// Incorrect arity
checkWMTE(() -> { // 0
String x = (String) hs.get(am, methodType(String.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
String x = (String) hs.get(am, methodType(String.class, String[].class, int.class, String.class, String.class, Class.class)).
- invoke(array, 0, "foo", "foo", Void.class);
+ invokeExact(array, 0, "foo", "foo", Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
// Incorrect argument types
checkNPE(() -> { // null array
- String x = (String) hs.get(am, methodType(String.class, Void.class, int.class, String.class)).
- invoke(null, 0, "foo");
+ String x = (String) hs.get(am, methodType(String.class, String[].class, int.class, String.class)).
+ invokeExact((String[]) null, 0, "foo");
});
- checkCCE(() -> { // array reference class
+ hs.checkWMTEOrCCE(() -> { // array reference class
String x = (String) hs.get(am, methodType(String.class, Class.class, int.class, String.class)).
- invoke(Void.class, 0, "foo");
+ invokeExact(Void.class, 0, "foo");
});
- checkCCE(() -> { // value reference class
+ hs.checkWMTEOrCCE(() -> { // value reference class
String x = (String) hs.get(am, methodType(String.class, String[].class, int.class, Class.class)).
- invoke(array, 0, Void.class);
+ invokeExact(array, 0, Void.class);
});
checkWMTE(() -> { // array primitive class
String x = (String) hs.get(am, methodType(String.class, int.class, int.class, String.class)).
- invoke(0, 0, "foo");
+ invokeExact(0, 0, "foo");
});
checkWMTE(() -> { // index reference class
String x = (String) hs.get(am, methodType(String.class, String[].class, Class.class, String.class)).
- invoke(array, Void.class, "foo");
+ invokeExact(array, Void.class, "foo");
});
// Incorrect return type
- checkCCE(() -> { // reference class
+ hs.checkWMTEOrCCE(() -> { // reference class
Void r = (Void) hs.get(am, methodType(Void.class, String[].class, int.class, String.class)).
- invoke(array, 0, "foo");
+ invokeExact(array, 0, "foo");
});
checkWMTE(() -> { // primitive class
boolean x = (boolean) hs.get(am, methodType(boolean.class, String[].class, int.class, String.class)).
- invoke(array, 0, "foo");
+ invokeExact(array, 0, "foo");
});
// Incorrect arity
checkWMTE(() -> { // 0
String x = (String) hs.get(am, methodType(String.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
String x = (String) hs.get(am, methodType(String.class, String[].class, int.class, String.class, Class.class)).
- invoke(array, 0, "foo", Void.class);
+ invokeExact(array, 0, "foo", Void.class);
});
}
--- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template Tue May 17 12:06:41 2016 +0200
@@ -27,6 +27,7 @@
* @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestAccess$Type$
* @run testng/othervm -Diters=20000 VarHandleTestAccess$Type$
* @run testng/othervm -Diters=20000 -XX:-TieredCompilation VarHandleTestAccess$Type$
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestAccess$Type$
*/
import org.testng.annotations.BeforeClass;
@@ -309,6 +310,10 @@
checkUOE(() -> {
boolean r = vh.weakCompareAndSetRelease(recv, $value1$, $value2$);
});
+
+ checkUOE(() -> {
+ $type$ r = ($type$) vh.getAndSet(recv, $value1$);
+ });
#end[CAS]
#if[!AtomicAdd]
@@ -399,6 +404,10 @@
checkUOE(() -> {
boolean r = vh.weakCompareAndSetRelease($value1$, $value2$);
});
+
+ checkUOE(() -> {
+ $type$ r = ($type$) vh.getAndSet($value1$);
+ });
#end[CAS]
#if[!AtomicAdd]
@@ -586,6 +595,10 @@
checkUOE(() -> {
boolean r = vh.weakCompareAndSetRelease(recv, $value1$, $value2$);
});
+
+ checkUOE(() -> {
+ $type$ r = ($type$) vh.getAndSet(recv, $value1$);
+ });
#end[CAS]
#if[!AtomicAdd]
@@ -773,6 +786,10 @@
checkUOE(() -> {
boolean r = vh.weakCompareAndSetRelease($value1$, $value2$);
});
+
+ checkUOE(() -> {
+ $type$ r = ($type$) vh.getAndSet($value1$);
+ });
#end[CAS]
#if[!AtomicAdd]
@@ -967,6 +984,10 @@
checkUOE(() -> {
boolean r = vh.weakCompareAndSetRelease(array, i, $value1$, $value2$);
});
+
+ checkUOE(() -> {
+ $type$ r = ($type$) vh.getAndSet(array, i, $value1$);
+ });
#end[CAS]
#if[!AtomicAdd]
--- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template Tue May 17 12:06:41 2016 +0200
@@ -27,6 +27,7 @@
* @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAs$Type$
* @run testng/othervm -Diters=20000 VarHandleTestByteArrayAs$Type$
* @run testng/othervm -Diters=20000 -XX:-TieredCompilation VarHandleTestByteArrayAs$Type$
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestByteArrayAs$Type$
*/
import org.testng.annotations.DataProvider;
@@ -311,10 +312,12 @@
checkROBE(() -> {
$type$ o = ($type$) vh.getAndSet(array, ci, VALUE_1);
});
+
+#else[CAS]
checkUOE(() -> {
boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2);
});
-#else[CAS]
+
checkUOE(() -> {
$type$ r = ($type$) vh.compareAndExchangeVolatile(array, ci, VALUE_2, VALUE_1);
});
--- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template Tue May 17 12:06:41 2016 +0200
@@ -24,6 +24,7 @@
/*
* @test
* @run testng/othervm -Diters=20000 VarHandleTestMethodHandleAccess$Type$
+ * @run testng/othervm -Diters=20000 -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodHandleAccess$Type$
*/
import org.testng.annotations.BeforeClass;
--- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodType.java.template Tue May 17 02:34:56 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodType.java.template Tue May 17 12:06:41 2016 +0200
@@ -23,6 +23,7 @@
/*
* @test
+ * @bug 8156486
* @run testng/othervm VarHandleTestMethodType$Type$
* @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodType$Type$
*/
@@ -81,27 +82,28 @@
public Object[][] accessTestCaseProvider() throws Exception {
List<AccessTestCase<?>> cases = new ArrayList<>();
- cases.add(new VarHandleAccessTestCase("Instance field wrong method type",
+ cases.add(new VarHandleAccessTestCase("Instance field",
vhField, vh -> testInstanceFieldWrongMethodType(this, vh),
false));
- cases.add(new VarHandleAccessTestCase("Static field wrong method type",
+ cases.add(new VarHandleAccessTestCase("Static field",
vhStaticField, VarHandleTestMethodType$Type$::testStaticFieldWrongMethodType,
false));
- cases.add(new VarHandleAccessTestCase("Array wrong method type",
+ cases.add(new VarHandleAccessTestCase("Array",
vhArray, VarHandleTestMethodType$Type$::testArrayWrongMethodType,
false));
+
for (VarHandleToMethodHandle f : VarHandleToMethodHandle.values()) {
- cases.add(new MethodHandleAccessTestCase("Instance field wrong method type",
+ cases.add(new MethodHandleAccessTestCase("Instance field",
vhField, f, hs -> testInstanceFieldWrongMethodType(this, hs),
false));
- cases.add(new MethodHandleAccessTestCase("Static field wrong method type",
+ cases.add(new MethodHandleAccessTestCase("Static field",
vhStaticField, f, VarHandleTestMethodType$Type$::testStaticFieldWrongMethodType,
false));
- cases.add(new MethodHandleAccessTestCase("Array wrong method type",
+ cases.add(new MethodHandleAccessTestCase("Array",
vhArray, f, VarHandleTestMethodType$Type$::testArrayWrongMethodType,
false));
}
@@ -648,63 +650,63 @@
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
- $type$ x = ($type$) hs.get(am, methodType($type$.class, Void.class)).
- invoke(null);
+ $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class)).
+ invokeExact((VarHandleTestMethodType$Type$) null);
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
$type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
checkWMTE(() -> { // receiver primitive class
$type$ x = ($type$) hs.get(am, methodType($type$.class, int.class)).
- invoke(0);
+ invokeExact(0);
});
// Incorrect return type
- check{#if[String]?CCE:WMTE}(() -> { // reference class
- Void x = (Void) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class)).
- invoke(recv);
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
+ Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodType$Type$.class)).
+ invokeExact(recv);
});
checkWMTE(() -> { // primitive class
$wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, VarHandleTestMethodType$Type$.class)).
- invoke(recv);
+ invokeExact(recv);
});
// Incorrect arity
checkWMTE(() -> { // 0
$type$ x = ($type$) hs.get(am, methodType($type$.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
$type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, Class.class)).
- invoke(recv, Void.class);
+ invokeExact(recv, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
- hs.get(am, methodType(void.class, Void.class, $type$.class)).
- invoke(null, $value1$);
+ hs.get(am, methodType(void.class, VarHandleTestMethodType$Type$.class, $type$.class)).
+ invokeExact((VarHandleTestMethodType$Type$) null, $value1$);
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
hs.get(am, methodType(void.class, Class.class, $type$.class)).
- invoke(Void.class, $value1$);
+ invokeExact(Void.class, $value1$);
});
- check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class
hs.get(am, methodType(void.class, VarHandleTestMethodType$Type$.class, Class.class)).
- invoke(recv, Void.class);
+ invokeExact(recv, Void.class);
});
checkWMTE(() -> { // receiver primitive class
hs.get(am, methodType(void.class, int.class, $type$.class)).
- invoke(0, $value1$);
+ invokeExact(0, $value1$);
});
// Incorrect arity
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
hs.get(am, methodType(void.class, VarHandleTestMethodType$Type$.class, $type$.class, Class.class)).
- invoke(recv, $value1$, Void.class);
+ invokeExact(recv, $value1$, Void.class);
});
}
@@ -712,111 +714,111 @@
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
- boolean r = (boolean) hs.get(am, methodType(boolean.class, Void.class, $type$.class, $type$.class)).
- invoke(null, $value1$, $value1$);
+ boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodType$Type$.class, $type$.class, $type$.class)).
+ invokeExact((VarHandleTestMethodType$Type$) null, $value1$, $value1$);
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, $type$.class, $type$.class)).
- invoke(Void.class, $value1$, $value1$);
+ invokeExact(Void.class, $value1$, $value1$);
});
- check{#if[String]?CCE:WMTE}(() -> { // expected reference class
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // expected reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodType$Type$.class, Class.class, $type$.class)).
- invoke(recv, Void.class, $value1$);
+ invokeExact(recv, Void.class, $value1$);
});
- check{#if[String]?CCE:WMTE}(() -> { // actual reference class
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // actual reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodType$Type$.class, $type$.class, Class.class)).
- invoke(recv, $value1$, Void.class);
+ invokeExact(recv, $value1$, Void.class);
});
checkWMTE(() -> { // receiver primitive class
boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class , $type$.class, $type$.class)).
- invoke(0, $value1$, $value1$);
+ invokeExact(0, $value1$, $value1$);
});
// Incorrect arity
checkWMTE(() -> { // 0
boolean r = (boolean) hs.get(am, methodType(boolean.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodType$Type$.class, $type$.class, $type$.class, Class.class)).
- invoke(recv, $value1$, $value1$, Void.class);
+ invokeExact(recv, $value1$, $value1$, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkNPE(() -> { // null receiver
- $type$ x = ($type$) hs.get(am, methodType($type$.class, Void.class, $type$.class, $type$.class)).
- invoke(null, $value1$, $value1$);
+ $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class, $type$.class)).
+ invokeExact((VarHandleTestMethodType$Type$) null, $value1$, $value1$);
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
$type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, $type$.class, $type$.class)).
- invoke(Void.class, $value1$, $value1$);
+ invokeExact(Void.class, $value1$, $value1$);
});
- check{#if[String]?CCE:WMTE}(() -> { // expected reference class
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // expected reference class
$type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, Class.class, $type$.class)).
- invoke(recv, Void.class, $value1$);
+ invokeExact(recv, Void.class, $value1$);
});
- check{#if[String]?CCE:WMTE}(() -> { // actual reference class
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // actual reference class
$type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class, Class.class)).
- invoke(recv, $value1$, Void.class);
+ invokeExact(recv, $value1$, Void.class);
});
checkWMTE(() -> { // reciever primitive class
$type$ x = ($type$) hs.get(am, methodType($type$.class, int.class , $type$.class, $type$.class)).
- invoke(0, $value1$, $value1$);
+ invokeExact(0, $value1$, $value1$);
});
// Incorrect return type
- check{#if[String]?CCE:WMTE}(() -> { // reference class
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodType$Type$.class , $type$.class, $type$.class)).
- invoke(recv, $value1$, $value1$);
+ invokeExact(recv, $value1$, $value1$);
});
checkWMTE(() -> { // primitive class
$wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, VarHandleTestMethodType$Type$.class , $type$.class, $type$.class)).
- invoke(recv, $value1$, $value1$);
+ invokeExact(recv, $value1$, $value1$);
});
// Incorrect arity
checkWMTE(() -> { // 0
$type$ x = ($type$) hs.get(am, methodType($type$.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
$type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class, $type$.class, Class.class)).
- invoke(recv, $value1$, $value1$, Void.class);
+ invokeExact(recv, $value1$, $value1$, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkNPE(() -> { // null receiver
- $type$ x = ($type$) hs.get(am, methodType($type$.class, Void.class, $type$.class)).
- invoke(null, $value1$);
+ $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class)).
+ invokeExact((VarHandleTestMethodType$Type$) null, $value1$);
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
$type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, $type$.class)).
- invoke(Void.class, $value1$);
+ invokeExact(Void.class, $value1$);
});
- check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class
$type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, Class.class)).
- invoke(recv, Void.class);
+ invokeExact(recv, Void.class);
});
checkWMTE(() -> { // reciever primitive class
$type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, $type$.class)).
- invoke(0, $value1$);
+ invokeExact(0, $value1$);
});
// Incorrect return type
- check{#if[String]?CCE:WMTE}(() -> { // reference class
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodType$Type$.class, $type$.class)).
- invoke(recv, $value1$);
+ invokeExact(recv, $value1$);
});
checkWMTE(() -> { // primitive class
$wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, VarHandleTestMethodType$Type$.class, $type$.class)).
- invoke(recv, $value1$);
+ invokeExact(recv, $value1$);
});
// Incorrect arity
checkWMTE(() -> { // 0
$type$ x = ($type$) hs.get(am, methodType($type$.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
$type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class)).
- invoke(recv, $value1$, Void.class);
+ invokeExact(recv, $value1$, Void.class);
});
}
#end[CAS]
@@ -824,38 +826,38 @@
#if[AtomicAdd]
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkNPE(() -> { // null receiver
- $type$ x = ($type$) hs.get(am, methodType($type$.class, Void.class, $type$.class)).
- invoke(null, $value1$);
+ $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class)).
+ invokeExact((VarHandleTestMethodType$Type$) null, $value1$);
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
$type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, $type$.class)).
- invoke(Void.class, $value1$);
+ invokeExact(Void.class, $value1$);
});
- check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class
$type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, Class.class)).
- invoke(recv, Void.class);
+ invokeExact(recv, Void.class);
});
checkWMTE(() -> { // reciever primitive class
$type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, $type$.class)).
- invoke(0, $value1$);
+ invokeExact(0, $value1$);
});
// Incorrect return type
- check{#if[String]?CCE:WMTE}(() -> { // reference class
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodType$Type$.class, $type$.class)).
- invoke(recv, $value1$);
+ invokeExact(recv, $value1$);
});
checkWMTE(() -> { // primitive class
$wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, VarHandleTestMethodType$Type$.class, $type$.class)).
- invoke(recv, $value1$);
+ invokeExact(recv, $value1$);
});
// Incorrect arity
checkWMTE(() -> { // 0
$type$ x = ($type$) hs.get(am, methodType($type$.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
$type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class)).
- invoke(recv, $value1$, Void.class);
+ invokeExact(recv, $value1$, Void.class);
});
}
#end[AtomicAdd]
@@ -1200,111 +1202,111 @@
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect return type
- check{#if[String]?CCE:WMTE}(() -> { // reference class
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
Void x = (Void) hs.get(am, methodType(Void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // primitive class
$wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class)).
- invoke();
+ invokeExact();
});
// Incorrect arity
checkWMTE(() -> { // >
$type$ x = ($type$) hs.get(am, methodType(Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
- check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class
hs.get(am, methodType(void.class, Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
// Incorrect arity
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
hs.get(am, methodType(void.class, $type$.class, Class.class)).
- invoke($value1$, Void.class);
+ invokeExact($value1$, Void.class);
});
}
#if[CAS]
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
// Incorrect argument types
- check{#if[String]?CCE:WMTE}(() -> { // expected reference class
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // expected reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, $type$.class)).
- invoke(Void.class, $value1$);
+ invokeExact(Void.class, $value1$);
});
- check{#if[String]?CCE:WMTE}(() -> { // actual reference class
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // actual reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$.class, Class.class)).
- invoke($value1$, Void.class);
+ invokeExact($value1$, Void.class);
});
// Incorrect arity
checkWMTE(() -> { // 0
boolean r = (boolean) hs.get(am, methodType(boolean.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$.class, $type$.class, Class.class)).
- invoke($value1$, $value1$, Void.class);
+ invokeExact($value1$, $value1$, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
// Incorrect argument types
- check{#if[String]?CCE:WMTE}(() -> { // expected reference class
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // expected reference class
$type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, $type$.class)).
- invoke(Void.class, $value1$);
+ invokeExact(Void.class, $value1$);
});
- check{#if[String]?CCE:WMTE}(() -> { // actual reference class
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // actual reference class
$type$ x = ($type$) hs.get(am, methodType($type$.class, $type$.class, Class.class)).
- invoke($value1$, Void.class);
+ invokeExact($value1$, Void.class);
});
// Incorrect return type
- check{#if[String]?CCE:WMTE}(() -> { // reference class
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
Void r = (Void) hs.get(am, methodType(Void.class, $type$.class, $type$.class)).
- invoke($value1$, $value1$);
+ invokeExact($value1$, $value1$);
});
checkWMTE(() -> { // primitive class
$wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$.class, $type$.class)).
- invoke($value1$, $value1$);
+ invokeExact($value1$, $value1$);
});
// Incorrect arity
checkWMTE(() -> { // 0
$type$ x = ($type$) hs.get(am, methodType($type$.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
$type$ x = ($type$) hs.get(am, methodType($type$.class, $type$.class, $type$.class, Class.class)).
- invoke($value1$, $value1$, Void.class);
+ invokeExact($value1$, $value1$, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
// Incorrect argument types
- check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class
$type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
// Incorrect return type
- check{#if[String]?CCE:WMTE}(() -> { // reference class
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
Void r = (Void) hs.get(am, methodType(Void.class, $type$.class)).
- invoke($value1$);
+ invokeExact($value1$);
});
checkWMTE(() -> { // primitive class
$wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$.class)).
- invoke($value1$);
+ invokeExact($value1$);
});
// Incorrect arity
checkWMTE(() -> { // 0
$type$ x = ($type$) hs.get(am, methodType($type$.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
$type$ x = ($type$) hs.get(am, methodType($type$.class, $type$.class, Class.class)).
- invoke($value1$, Void.class);
+ invokeExact($value1$, Void.class);
});
}
#end[CAS]
@@ -1314,25 +1316,25 @@
// Incorrect argument types
check{#if[String]?CCE:WMTE}(() -> { // value reference class
$type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class)).
- invoke(Void.class);
+ invokeExact(Void.class);
});
// Incorrect return type
check{#if[String]?CCE:WMTE}(() -> { // reference class
Void r = (Void) hs.get(am, methodType(Void.class, $type$.class)).
- invoke($value1$);
+ invokeExact($value1$);
});
checkWMTE(() -> { // primitive class
$wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$.class)).
- invoke($value1$);
+ invokeExact($value1$);
});
// Incorrect arity
checkWMTE(() -> { // 0
$type$ x = ($type$) hs.get(am, methodType($type$.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
$type$ x = ($type$) hs.get(am, methodType($type$.class, $type$.class, Class.class)).
- invoke($value1$, Void.class);
+ invokeExact($value1$, Void.class);
});
}
#end[AtomicAdd]
@@ -1929,196 +1931,196 @@
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null array
- $type$ x = ($type$) hs.get(am, methodType($type$.class, Void.class, int.class)).
- invoke(null, 0);
+ $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class)).
+ invokeExact(($type$[]) null, 0);
});
- checkCCE(() -> { // array reference class
+ hs.checkWMTEOrCCE(() -> { // array reference class
$type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, int.class)).
- invoke(Void.class, 0);
+ invokeExact(Void.class, 0);
});
checkWMTE(() -> { // array primitive class
$type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, int.class)).
- invoke(0, 0);
+ invokeExact(0, 0);
});
checkWMTE(() -> { // index reference class
$type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, Class.class)).
- invoke(array, Void.class);
+ invokeExact(array, Void.class);
});
// Incorrect return type
- check{#if[String]?CCE:WMTE}(() -> { // reference class
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
Void x = (Void) hs.get(am, methodType(Void.class, $type$[].class, int.class)).
- invoke(array, 0);
+ invokeExact(array, 0);
});
checkWMTE(() -> { // primitive class
$wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$[].class, int.class)).
- invoke(array, 0);
+ invokeExact(array, 0);
});
// Incorrect arity
checkWMTE(() -> { // 0
$type$ x = ($type$) hs.get(am, methodType($type$.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
$type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, Class.class)).
- invoke(array, 0, Void.class);
+ invokeExact(array, 0, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null array
- hs.get(am, methodType(void.class, Void.class, int.class, $type$.class)).
- invoke(null, 0, $value1$);
+ hs.get(am, methodType(void.class, $type$[].class, int.class, $type$.class)).
+ invokeExact(($type$[]) null, 0, $value1$);
});
- checkCCE(() -> { // array reference class
+ hs.checkWMTEOrCCE(() -> { // array reference class
hs.get(am, methodType(void.class, Class.class, int.class, $type$.class)).
- invoke(Void.class, 0, $value1$);
+ invokeExact(Void.class, 0, $value1$);
});
- check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class
hs.get(am, methodType(void.class, $type$[].class, int.class, Class.class)).
- invoke(array, 0, Void.class);
+ invokeExact(array, 0, Void.class);
});
checkWMTE(() -> { // receiver primitive class
hs.get(am, methodType(void.class, int.class, int.class, $type$.class)).
- invoke(0, 0, $value1$);
+ invokeExact(0, 0, $value1$);
});
checkWMTE(() -> { // index reference class
hs.get(am, methodType(void.class, $type$[].class, Class.class, $type$.class)).
- invoke(array, Void.class, $value1$);
+ invokeExact(array, Void.class, $value1$);
});
// Incorrect arity
checkWMTE(() -> { // 0
hs.get(am, methodType(void.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
hs.get(am, methodType(void.class, $type$[].class, int.class, Class.class)).
- invoke(array, 0, $value1$, Void.class);
+ invokeExact(array, 0, $value1$, Void.class);
});
}
#if[CAS]
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
- boolean r = (boolean) hs.get(am, methodType(boolean.class, Void.class, int.class, $type$.class, $type$.class)).
- invoke(null, 0, $value1$, $value1$);
+ boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$[].class, int.class, $type$.class, $type$.class)).
+ invokeExact(($type$[]) null, 0, $value1$, $value1$);
});
- checkCCE(() -> { // receiver reference class
+ hs.checkWMTEOrCCE(() -> { // receiver reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, int.class, $type$.class, $type$.class)).
- invoke(Void.class, 0, $value1$, $value1$);
+ invokeExact(Void.class, 0, $value1$, $value1$);
});
- check{#if[String]?CCE:WMTE}(() -> { // expected reference class
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // expected reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$[].class, int.class, Class.class, $type$.class)).
- invoke(array, 0, Void.class, $value1$);
+ invokeExact(array, 0, Void.class, $value1$);
});
- check{#if[String]?CCE:WMTE}(() -> { // actual reference class
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // actual reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$[].class, int.class, $type$.class, Class.class)).
- invoke(array, 0, $value1$, Void.class);
+ invokeExact(array, 0, $value1$, Void.class);
});
checkWMTE(() -> { // receiver primitive class
boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class, int.class, $type$.class, $type$.class)).
- invoke(0, 0, $value1$, $value1$);
+ invokeExact(0, 0, $value1$, $value1$);
});
checkWMTE(() -> { // index reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$[].class, Class.class, $type$.class, $type$.class)).
- invoke(array, Void.class, $value1$, $value1$);
+ invokeExact(array, Void.class, $value1$, $value1$);
});
// Incorrect arity
checkWMTE(() -> { // 0
boolean r = (boolean) hs.get(am, methodType(boolean.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$[].class, int.class, $type$.class, $type$.class, Class.class)).
- invoke(array, 0, $value1$, $value1$, Void.class);
+ invokeExact(array, 0, $value1$, $value1$, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
- $type$ x = ($type$) hs.get(am, methodType($type$.class, Void.class, int.class, $type$.class, $type$.class)).
- invoke(null, 0, $value1$, $value1$);
+ $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class, $type$.class)).
+ invokeExact(($type$[]) null, 0, $value1$, $value1$);
});
- checkCCE(() -> { // array reference class
+ hs.checkWMTEOrCCE(() -> { // array reference class
$type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, int.class, $type$.class, $type$.class)).
- invoke(Void.class, 0, $value1$, $value1$);
+ invokeExact(Void.class, 0, $value1$, $value1$);
});
- check{#if[String]?CCE:WMTE}(() -> { // expected reference class
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // expected reference class
$type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, Class.class, $type$.class)).
- invoke(array, 0, Void.class, $value1$);
+ invokeExact(array, 0, Void.class, $value1$);
});
- check{#if[String]?CCE:WMTE}(() -> { // actual reference class
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // actual reference class
$type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class, Class.class)).
- invoke(array, 0, $value1$, Void.class);
+ invokeExact(array, 0, $value1$, Void.class);
});
checkWMTE(() -> { // array primitive class
$type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, int.class, $type$.class, $type$.class)).
- invoke(0, 0, $value1$, $value1$);
+ invokeExact(0, 0, $value1$, $value1$);
});
checkWMTE(() -> { // index reference class
$type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, Class.class, $type$.class, $type$.class)).
- invoke(array, Void.class, $value1$, $value1$);
+ invokeExact(array, Void.class, $value1$, $value1$);
});
// Incorrect return type
- check{#if[String]?CCE:WMTE}(() -> { // reference class
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
Void r = (Void) hs.get(am, methodType(Void.class, $type$[].class, int.class, $type$.class, $type$.class)).
- invoke(array, 0, $value1$, $value1$);
+ invokeExact(array, 0, $value1$, $value1$);
});
checkWMTE(() -> { // primitive class
$wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$[].class, int.class, $type$.class, $type$.class)).
- invoke(array, 0, $value1$, $value1$);
+ invokeExact(array, 0, $value1$, $value1$);
});
// Incorrect arity
checkWMTE(() -> { // 0
$type$ x = ($type$) hs.get(am, methodType($type$.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
$type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class, $type$.class, Class.class)).
- invoke(array, 0, $value1$, $value1$, Void.class);
+ invokeExact(array, 0, $value1$, $value1$, Void.class);
});
}
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
// Incorrect argument types
checkNPE(() -> { // null array
- $type$ x = ($type$) hs.get(am, methodType($type$.class, Void.class, int.class, $type$.class)).
- invoke(null, 0, $value1$);
+ $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class)).
+ invokeExact(($type$[]) null, 0, $value1$);
});
- checkCCE(() -> { // array reference class
+ hs.checkWMTEOrCCE(() -> { // array reference class
$type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, int.class, $type$.class)).
- invoke(Void.class, 0, $value1$);
+ invokeExact(Void.class, 0, $value1$);
});
- check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class
$type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, Class.class)).
- invoke(array, 0, Void.class);
+ invokeExact(array, 0, Void.class);
});
checkWMTE(() -> { // array primitive class
$type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, int.class, $type$.class)).
- invoke(0, 0, $value1$);
+ invokeExact(0, 0, $value1$);
});
checkWMTE(() -> { // index reference class
$type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, Class.class, $type$.class)).
- invoke(array, Void.class, $value1$);
+ invokeExact(array, Void.class, $value1$);
});
// Incorrect return type
- check{#if[String]?CCE:WMTE}(() -> { // reference class
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
Void r = (Void) hs.get(am, methodType(Void.class, $type$[].class, int.class, $type$.class)).
- invoke(array, 0, $value1$);
+ invokeExact(array, 0, $value1$);
});
checkWMTE(() -> { // primitive class
$wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$[].class, int.class, $type$.class)).
- invoke(array, 0, $value1$);
+ invokeExact(array, 0, $value1$);
});
// Incorrect arity
checkWMTE(() -> { // 0
$type$ x = ($type$) hs.get(am, methodType($type$.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
$type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class, Class.class)).
- invoke(array, 0, $value1$, Void.class);
+ invokeExact(array, 0, $value1$, Void.class);
});
}
#end[CAS]
@@ -2127,42 +2129,42 @@
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
// Incorrect argument types
checkNPE(() -> { // null array
- $type$ x = ($type$) hs.get(am, methodType($type$.class, Void.class, int.class, $type$.class)).
- invoke(null, 0, $value1$);
+ $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class)).
+ invokeExact(($type$[]) null, 0, $value1$);
});
- checkCCE(() -> { // array reference class
+ hs.checkWMTEOrCCE(() -> { // array reference class
$type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, int.class, $type$.class)).
- invoke(Void.class, 0, $value1$);
+ invokeExact(Void.class, 0, $value1$);
});
- check{#if[String]?CCE:WMTE}(() -> { // value reference class
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class
$type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, Class.class)).
- invoke(array, 0, Void.class);
+ invokeExact(array, 0, Void.class);
});
checkWMTE(() -> { // array primitive class
$type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, int.class, $type$.class)).
- invoke(0, 0, $value1$);
+ invokeExact(0, 0, $value1$);
});
checkWMTE(() -> { // index reference class
$type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, Class.class, $type$.class)).
- invoke(array, Void.class, $value1$);
+ invokeExact(array, Void.class, $value1$);
});
// Incorrect return type
- check{#if[String]?CCE:WMTE}(() -> { // reference class
+ {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class
Void r = (Void) hs.get(am, methodType(Void.class, $type$[].class, int.class, $type$.class)).
- invoke(array, 0, $value1$);
+ invokeExact(array, 0, $value1$);
});
checkWMTE(() -> { // primitive class
$wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$[].class, int.class, $type$.class)).
- invoke(array, 0, $value1$);
+ invokeExact(array, 0, $value1$);
});
// Incorrect arity
checkWMTE(() -> { // 0
$type$ x = ($type$) hs.get(am, methodType($type$.class)).
- invoke();
+ invokeExact();
});
checkWMTE(() -> { // >
$type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class, Class.class)).
- invoke(array, 0, $value1$, Void.class);
+ invokeExact(array, 0, $value1$, Void.class);
});
}
#end[AtomicAdd]