8151705: VarHandle.AccessMode enum names should conform to code style
Reviewed-by: mhaupt, shade, redestad
This commit is contained in:
parent
1a6b34885f
commit
a7aff44bbb
jdk
src/java.base/share/classes/java/lang/invoke
test/java/lang/invoke/VarHandles
VarHandleBaseTest.javaVarHandleTestAccessBoolean.javaVarHandleTestAccessByte.javaVarHandleTestAccessChar.javaVarHandleTestAccessDouble.javaVarHandleTestAccessFloat.javaVarHandleTestAccessInt.javaVarHandleTestAccessLong.javaVarHandleTestAccessShort.javaVarHandleTestAccessString.javaVarHandleTestByteArrayAsChar.javaVarHandleTestByteArrayAsDouble.javaVarHandleTestByteArrayAsFloat.javaVarHandleTestByteArrayAsInt.javaVarHandleTestByteArrayAsLong.javaVarHandleTestByteArrayAsShort.javaVarHandleTestMethodHandleAccessBoolean.javaVarHandleTestMethodHandleAccessByte.javaVarHandleTestMethodHandleAccessChar.javaVarHandleTestMethodHandleAccessDouble.javaVarHandleTestMethodHandleAccessFloat.javaVarHandleTestMethodHandleAccessInt.javaVarHandleTestMethodHandleAccessLong.javaVarHandleTestMethodHandleAccessShort.javaVarHandleTestMethodHandleAccessString.javaVarHandleTestMethodTypeBoolean.javaVarHandleTestMethodTypeByte.javaVarHandleTestMethodTypeChar.javaVarHandleTestMethodTypeDouble.javaVarHandleTestMethodTypeFloat.javaVarHandleTestMethodTypeInt.javaVarHandleTestMethodTypeLong.javaVarHandleTestMethodTypeShort.javaVarHandleTestMethodTypeString.javaVarHandleTestReflection.javaX-VarHandleTestAccess.java.templateX-VarHandleTestByteArrayView.java.templateX-VarHandleTestMethodHandleAccess.java.templateX-VarHandleTestMethodType.java.template
@ -131,11 +131,11 @@ class Invokers {
|
||||
MethodType mtype = targetType;
|
||||
MethodType invokerType = mtype.insertParameterTypes(0, VarHandle.class);
|
||||
|
||||
LambdaForm lform = varHandleMethodGenericInvokerHandleForm(ak.name(), mtype);
|
||||
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.name(), mtype), false);
|
||||
invoker = invoker.withInternalMemberName(MemberName.makeVarHandleMethodInvoke(ak.methodName(), mtype), false);
|
||||
assert(checkVarHandleInvoker(invoker));
|
||||
|
||||
maybeCompileToBytecode(invoker);
|
||||
@ -146,11 +146,11 @@ class Invokers {
|
||||
MethodType mtype = targetType;
|
||||
MethodType invokerType = mtype.insertParameterTypes(0, VarHandle.class);
|
||||
|
||||
LambdaForm lform = varHandleMethodExactInvokerHandleForm(ak.name(), mtype);
|
||||
LambdaForm lform = varHandleMethodExactInvokerHandleForm(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.name(), mtype), false);
|
||||
invoker = invoker.withInternalMemberName(MemberName.makeVarHandleMethodInvoke(ak.methodName(), mtype), false);
|
||||
assert(checkVarHandleInvoker(invoker));
|
||||
|
||||
maybeCompileToBytecode(invoker);
|
||||
|
@ -374,7 +374,7 @@ import java.util.Objects;
|
||||
}
|
||||
public static boolean isVarHandleMethodInvokeName(String name) {
|
||||
try {
|
||||
VarHandle.AccessMode.valueOf(name);
|
||||
VarHandle.AccessMode.valueFromMethodName(name);
|
||||
return true;
|
||||
} catch (IllegalArgumentException e) {
|
||||
return false;
|
||||
|
@ -423,7 +423,7 @@ class MethodHandleNatives {
|
||||
// Get the access kind from the method name
|
||||
VarHandle.AccessMode ak;
|
||||
try {
|
||||
ak = VarHandle.AccessMode.valueOf(name);
|
||||
ak = VarHandle.AccessMode.valueFromMethodName(name);
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw MethodHandleStatics.newInternalError(e);
|
||||
}
|
||||
|
@ -43,7 +43,6 @@ import sun.reflect.misc.ReflectUtil;
|
||||
import sun.security.util.SecurityConstants;
|
||||
import java.lang.invoke.LambdaForm.BasicType;
|
||||
|
||||
import static java.lang.invoke.MethodHandleStatics.*;
|
||||
import static java.lang.invoke.MethodHandleImpl.Intrinsic;
|
||||
import static java.lang.invoke.MethodHandleNatives.Constants.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@ -53,8 +52,6 @@ import java.util.stream.Stream;
|
||||
import jdk.internal.org.objectweb.asm.ClassWriter;
|
||||
import jdk.internal.org.objectweb.asm.Opcodes;
|
||||
|
||||
import static java.lang.invoke.MethodHandleImpl.Intrinsic;
|
||||
import static java.lang.invoke.MethodHandleNatives.Constants.*;
|
||||
import static java.lang.invoke.MethodHandleStatics.newIllegalArgumentException;
|
||||
|
||||
/**
|
||||
@ -952,7 +949,7 @@ assertEquals("", (String) MH_newString.invokeExact());
|
||||
}
|
||||
private MethodHandle findVirtualForVH(String name, MethodType type) {
|
||||
try {
|
||||
return varHandleInvoker(VarHandle.AccessMode.valueOf(name), type);
|
||||
return varHandleInvoker(VarHandle.AccessMode.valueFromMethodName(name), type);
|
||||
} catch (IllegalArgumentException e) {
|
||||
return null;
|
||||
}
|
||||
|
@ -69,13 +69,10 @@ class VarForm {
|
||||
for (Class<?> c = implClass; c != VarHandle.class; c = c.getSuperclass()) {
|
||||
for (Method m : c.getDeclaredMethods()) {
|
||||
if (Modifier.isStatic(m.getModifiers())) {
|
||||
try {
|
||||
AccessMode am = AccessMode.valueOf(m.getName());
|
||||
AccessMode am = AccessMode.methodNameToAccessMode.get(m.getName());
|
||||
if (am != null) {
|
||||
assert table[am.ordinal()] == null;
|
||||
table[am.ordinal()] = new MemberName(m);
|
||||
} catch (IllegalArgumentException ex) {
|
||||
// Ignore. Note the try/catch will be removed when
|
||||
// AccessMode enum constant names are renamed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,9 @@ import jdk.internal.vm.annotation.ForceInline;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import static java.lang.invoke.MethodHandleStatics.UNSAFE;
|
||||
@ -272,7 +274,7 @@ import static java.lang.invoke.MethodHandleStatics.newInternalError;
|
||||
* <pre> {@code
|
||||
* MethodHandle mh = MethodHandles.lookup().findVirtual(
|
||||
* VarHandle.class,
|
||||
* VarHandle.AccessMode.{access-mode}.name(),
|
||||
* VarHandle.AccessMode.{access-mode}.methodName(),
|
||||
* MethodType.methodType(R, p1, p2, ..., pN));
|
||||
*
|
||||
* R r = (R) mh.invokeExact(vh, p1, p2, ..., pN)
|
||||
@ -993,11 +995,11 @@ public abstract class VarHandle {
|
||||
Object addAndGet(Object... args);
|
||||
|
||||
enum AccessType {
|
||||
get, // 0
|
||||
set, // 1
|
||||
compareAndSwap, // 2
|
||||
compareAndExchange, // 3
|
||||
getAndUpdate; // 4
|
||||
GET, // 0
|
||||
SET, // 1
|
||||
COMPARE_AND_SWAP, // 2
|
||||
COMPARE_AND_EXCHANGE, // 3
|
||||
GET_AND_UPDATE; // 4
|
||||
|
||||
MethodType getMethodType(VarHandle vh) {
|
||||
return getMethodType(this.ordinal(), vh);
|
||||
@ -1036,126 +1038,179 @@ public abstract class VarHandle {
|
||||
* method
|
||||
* {@link VarHandle#get VarHandle.get}
|
||||
*/
|
||||
get(AccessType.get, Object.class), // 0
|
||||
GET("get", AccessType.GET, Object.class), // 0
|
||||
/**
|
||||
* The access mode whose access is specified by the corresponding
|
||||
* method
|
||||
* {@link VarHandle#set VarHandle.set}
|
||||
*/
|
||||
set(AccessType.set, void.class), // 1
|
||||
SET("set", AccessType.SET, void.class), // 1
|
||||
/**
|
||||
* The access mode whose access is specified by the corresponding
|
||||
* method
|
||||
* {@link VarHandle#getVolatile VarHandle.getVolatile}
|
||||
*/
|
||||
getVolatile(AccessType.get, Object.class), // 2
|
||||
GET_VOLATILE("getVolatile", AccessType.GET, Object.class), // 2
|
||||
/**
|
||||
* The access mode whose access is specified by the corresponding
|
||||
* method
|
||||
* {@link VarHandle#setVolatile VarHandle.setVolatile}
|
||||
*/
|
||||
setVolatile(AccessType.set, void.class), // 3
|
||||
SET_VOLATILE("setVolatile", AccessType.SET, void.class), // 3
|
||||
/**
|
||||
* The access mode whose access is specified by the corresponding
|
||||
* method
|
||||
* {@link VarHandle#getAcquire VarHandle.getAcquire}
|
||||
*/
|
||||
getAcquire(AccessType.get, Object.class), // 4
|
||||
GET_ACQUIRE("getAcquire", AccessType.GET, Object.class), // 4
|
||||
/**
|
||||
* The access mode whose access is specified by the corresponding
|
||||
* method
|
||||
* {@link VarHandle#setRelease VarHandle.setRelease}
|
||||
*/
|
||||
setRelease(AccessType.set, void.class), // 5
|
||||
SET_RELEASE("setRelease", AccessType.SET, void.class), // 5
|
||||
/**
|
||||
* The access mode whose access is specified by the corresponding
|
||||
* method
|
||||
* {@link VarHandle#getOpaque VarHandle.getOpaque}
|
||||
*/
|
||||
getOpaque(AccessType.get, Object.class), // 6
|
||||
GET_OPAQUE("getOpaque", AccessType.GET, Object.class), // 6
|
||||
/**
|
||||
* The access mode whose access is specified by the corresponding
|
||||
* method
|
||||
* {@link VarHandle#setOpaque VarHandle.setOpaque}
|
||||
*/
|
||||
setOpaque(AccessType.set, void.class), // 7
|
||||
SET_OPAQUE("setOpaque", AccessType.SET, void.class), // 7
|
||||
/**
|
||||
* The access mode whose access is specified by the corresponding
|
||||
* method
|
||||
* {@link VarHandle#compareAndSet VarHandle.compareAndSet}
|
||||
*/
|
||||
compareAndSet(AccessType.compareAndSwap, boolean.class), // 8
|
||||
COMPARE_AND_SET("compareAndSet", AccessType.COMPARE_AND_SWAP, boolean.class), // 8
|
||||
/**
|
||||
* The access mode whose access is specified by the corresponding
|
||||
* method
|
||||
* {@link VarHandle#compareAndExchangeVolatile VarHandle.compareAndExchangeVolatile}
|
||||
*/
|
||||
compareAndExchangeVolatile(AccessType.compareAndExchange, Object.class), // 9
|
||||
COMPARE_AND_EXCHANGE_VOLATILE("compareAndExchangeVolatile", AccessType.COMPARE_AND_EXCHANGE, Object.class), // 9
|
||||
/**
|
||||
* The access mode whose access is specified by the corresponding
|
||||
* method
|
||||
* {@link VarHandle#compareAndExchangeAcquire VarHandle.compareAndExchangeAcquire}
|
||||
*/
|
||||
compareAndExchangeAcquire(AccessType.compareAndExchange, Object.class), // 10
|
||||
COMPARE_AND_EXCHANGE_ACQUIRE("compareAndExchangeAcquire", AccessType.COMPARE_AND_EXCHANGE, Object.class), // 10
|
||||
/**
|
||||
* The access mode whose access is specified by the corresponding
|
||||
* method
|
||||
* {@link VarHandle#compareAndExchangeRelease VarHandle.compareAndExchangeRelease}
|
||||
*/
|
||||
compareAndExchangeRelease(AccessType.compareAndExchange, Object.class), // 11
|
||||
COMPARE_AND_EXCHANGE_RELEASE("compareAndExchangeRelease", AccessType.COMPARE_AND_EXCHANGE, Object.class), // 11
|
||||
/**
|
||||
* The access mode whose access is specified by the corresponding
|
||||
* method
|
||||
* {@link VarHandle#weakCompareAndSet VarHandle.weakCompareAndSet}
|
||||
*/
|
||||
weakCompareAndSet(AccessType.compareAndSwap, boolean.class), // 12
|
||||
WEAK_COMPARE_AND_SET("weakCompareAndSet", AccessType.COMPARE_AND_SWAP, boolean.class), // 12
|
||||
/**
|
||||
* The access mode whose access is specified by the corresponding
|
||||
* method
|
||||
* {@link VarHandle#weakCompareAndSetAcquire VarHandle.weakCompareAndSetAcquire}
|
||||
*/
|
||||
weakCompareAndSetAcquire(AccessType.compareAndSwap, boolean.class), // 13
|
||||
WEAK_COMPARE_AND_SET_ACQUIRE("weakCompareAndSetAcquire", AccessType.COMPARE_AND_SWAP, boolean.class), // 13
|
||||
/**
|
||||
* The access mode whose access is specified by the corresponding
|
||||
* method
|
||||
* {@link VarHandle#weakCompareAndSetRelease VarHandle.weakCompareAndSetRelease}
|
||||
*/
|
||||
weakCompareAndSetRelease(AccessType.compareAndSwap, boolean.class), // 14
|
||||
WEAK_COMPARE_AND_SET_RELEASE("weakCompareAndSetRelease", AccessType.COMPARE_AND_SWAP, boolean.class), // 14
|
||||
/**
|
||||
* The access mode whose access is specified by the corresponding
|
||||
* method
|
||||
* {@link VarHandle#getAndSet VarHandle.getAndSet}
|
||||
*/
|
||||
getAndSet(AccessType.getAndUpdate, Object.class), // 15
|
||||
GET_AND_SET("getAndSet", AccessType.GET_AND_UPDATE, Object.class), // 15
|
||||
/**
|
||||
* The access mode whose access is specified by the corresponding
|
||||
* method
|
||||
* {@link VarHandle#getAndAdd VarHandle.getAndAdd}
|
||||
*/
|
||||
getAndAdd(AccessType.getAndUpdate, Object.class), // 16
|
||||
GET_AND_ADD("getAndAdd", AccessType.GET_AND_UPDATE, Object.class), // 16
|
||||
/**
|
||||
* The access mode whose access is specified by the corresponding
|
||||
* method
|
||||
* {@link VarHandle#addAndGet VarHandle.addAndGet}
|
||||
*/
|
||||
addAndGet(AccessType.getAndUpdate, Object.class), // 17
|
||||
ADD_AND_GET("addAndGet", AccessType.GET_AND_UPDATE, Object.class), // 17
|
||||
;
|
||||
|
||||
static final Map<String, AccessMode> methodNameToAccessMode;
|
||||
static {
|
||||
// Initial capacity of # values is sufficient to avoid resizes
|
||||
// for the smallest table size (32)
|
||||
methodNameToAccessMode = new HashMap<>(AccessMode.values().length);
|
||||
for (AccessMode am : AccessMode.values()) {
|
||||
methodNameToAccessMode.put(am.methodName, am);
|
||||
}
|
||||
}
|
||||
|
||||
final String methodName;
|
||||
final AccessType at;
|
||||
final boolean isPolyMorphicInReturnType;
|
||||
final Class<?> returnType;
|
||||
|
||||
AccessMode(AccessType at, Class<?> returnType) {
|
||||
AccessMode(final String methodName, AccessType at, Class<?> returnType) {
|
||||
this.methodName = methodName;
|
||||
this.at = at;
|
||||
|
||||
// Assert method name is correctly derived from value name
|
||||
assert methodName.equals(toMethodName(name()));
|
||||
// Assert that return type is correct
|
||||
// Otherwise, when disabled avoid using reflection
|
||||
assert returnType == getReturnType(name());
|
||||
assert returnType == getReturnType(methodName);
|
||||
|
||||
this.returnType = returnType;
|
||||
isPolyMorphicInReturnType = returnType != Object.class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@code VarHandle} signature-polymorphic method name
|
||||
* associated with this {@code AccessMode} value
|
||||
*
|
||||
* @return the signature-polymorphic method name
|
||||
* @see #valueFromMethodName
|
||||
*/
|
||||
public String methodName() {
|
||||
return methodName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@code AccessMode} value associated with the specified
|
||||
* {@code VarHandle} signature-polymorphic method name.
|
||||
*
|
||||
* @param methodName the signature-polymorphic method name
|
||||
* @return the {@code AccessMode} value
|
||||
* @throws IllegalArgumentException if there is no {@code AccessMode}
|
||||
* value associated with method name (indicating the method
|
||||
* name does not correspond to a {@code VarHandle}
|
||||
* signature-polymorphic method name).
|
||||
* @see #methodName
|
||||
*/
|
||||
public static AccessMode valueFromMethodName(String methodName) {
|
||||
AccessMode am = methodNameToAccessMode.get(methodName);
|
||||
if (am != null) return am;
|
||||
throw new IllegalArgumentException("No AccessMode value for method name " + methodName);
|
||||
}
|
||||
|
||||
private static String toMethodName(String name) {
|
||||
StringBuilder s = new StringBuilder(name.toLowerCase());
|
||||
int i;
|
||||
while ((i = s.indexOf("_")) != -1) {
|
||||
s.deleteCharAt(i);
|
||||
s.setCharAt(i, Character.toUpperCase(s.charAt(i)));
|
||||
}
|
||||
return s.toString();
|
||||
}
|
||||
|
||||
private static Class<?> getReturnType(String name) {
|
||||
try {
|
||||
Method m = VarHandle.class.getMethod(name, Object[].class);
|
||||
|
@ -126,33 +126,33 @@ abstract class VarHandleBaseTest {
|
||||
|
||||
|
||||
enum TestAccessType {
|
||||
get,
|
||||
set,
|
||||
compareAndSet,
|
||||
compareAndExchange,
|
||||
getAndSet,
|
||||
getAndAdd;
|
||||
GET,
|
||||
SET,
|
||||
COMPARE_AND_SET,
|
||||
COMPARE_AND_EXCHANGE,
|
||||
GET_AND_SET,
|
||||
GET_AND_ADD;
|
||||
}
|
||||
|
||||
enum TestAccessMode {
|
||||
get(TestAccessType.get),
|
||||
set(TestAccessType.set),
|
||||
getVolatile(TestAccessType.get),
|
||||
setVolatile(TestAccessType.set),
|
||||
getAcquire(TestAccessType.get),
|
||||
setRelease(TestAccessType.set),
|
||||
getOpaque(TestAccessType.get),
|
||||
setOpaque(TestAccessType.set),
|
||||
compareAndSet(TestAccessType.compareAndSet),
|
||||
compareAndExchangeVolatile(TestAccessType.compareAndExchange),
|
||||
compareAndExchangeAcquire(TestAccessType.compareAndExchange),
|
||||
compareAndExchangeRelease(TestAccessType.compareAndExchange),
|
||||
weakCompareAndSet(TestAccessType.compareAndSet),
|
||||
weakCompareAndSetAcquire(TestAccessType.compareAndSet),
|
||||
weakCompareAndSetRelease(TestAccessType.compareAndSet),
|
||||
getAndSet(TestAccessType.getAndSet),
|
||||
getAndAdd(TestAccessType.getAndAdd),
|
||||
addAndGet(TestAccessType.getAndAdd),;
|
||||
GET(TestAccessType.GET),
|
||||
SET(TestAccessType.SET),
|
||||
GET_VOLATILE(TestAccessType.GET),
|
||||
SET_VOLATILE(TestAccessType.SET),
|
||||
GET_ACQUIRE(TestAccessType.GET),
|
||||
SET_RELEASE(TestAccessType.SET),
|
||||
GET_OPAQUE(TestAccessType.GET),
|
||||
SET_OPAQUE(TestAccessType.SET),
|
||||
COMPARE_AND_SET(TestAccessType.COMPARE_AND_SET),
|
||||
COMPARE_AND_EXCHANGE_VOLATILE(TestAccessType.COMPARE_AND_EXCHANGE),
|
||||
COMPARE_AND_EXCHANGE_ACQUIRE(TestAccessType.COMPARE_AND_EXCHANGE),
|
||||
COMPARE_AND_EXCHANGE_RELEASE(TestAccessType.COMPARE_AND_EXCHANGE),
|
||||
WEAK_COMPARE_AND_SET(TestAccessType.COMPARE_AND_SET),
|
||||
WEAK_COMPARE_AND_SET_ACQUIRE(TestAccessType.COMPARE_AND_SET),
|
||||
WEAK_COMPARE_AND_SET_RELEASE(TestAccessType.COMPARE_AND_SET),
|
||||
GET_AND_SET(TestAccessType.GET_AND_SET),
|
||||
GET_AND_ADD(TestAccessType.GET_AND_ADD),
|
||||
ADD_AND_GET(TestAccessType.GET_AND_ADD),;
|
||||
|
||||
final TestAccessType at;
|
||||
final boolean isPolyMorphicInReturnType;
|
||||
@ -162,7 +162,8 @@ abstract class VarHandleBaseTest {
|
||||
this.at = at;
|
||||
|
||||
try {
|
||||
Method m = VarHandle.class.getMethod(name(), Object[].class);
|
||||
VarHandle.AccessMode vh_am = toAccessMode();
|
||||
Method m = VarHandle.class.getMethod(vh_am.methodName(), Object[].class);
|
||||
this.returnType = m.getReturnType();
|
||||
isPolyMorphicInReturnType = returnType != Object.class;
|
||||
}
|
||||
@ -214,7 +215,7 @@ abstract class VarHandleBaseTest {
|
||||
try {
|
||||
mh = MethodHandles.publicLookup().
|
||||
findVirtual(VarHandle.class,
|
||||
tam.name(),
|
||||
tam.toAccessMode().methodName(),
|
||||
mt);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
@ -441,33 +442,33 @@ abstract class VarHandleBaseTest {
|
||||
assertEquals(amt.parameterList().subList(0, pts.size()), pts);
|
||||
}
|
||||
|
||||
for (TestAccessMode testAccessMode : testAccessModesOfType(TestAccessType.get)) {
|
||||
for (TestAccessMode testAccessMode : testAccessModesOfType(TestAccessType.GET)) {
|
||||
MethodType mt = vh.accessModeType(testAccessMode.toAccessMode());
|
||||
assertEquals(mt.returnType(), vh.varType());
|
||||
assertEquals(mt.parameterList(), pts);
|
||||
}
|
||||
|
||||
for (TestAccessMode testAccessMode : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode testAccessMode : testAccessModesOfType(TestAccessType.SET)) {
|
||||
MethodType mt = vh.accessModeType(testAccessMode.toAccessMode());
|
||||
assertEquals(mt.returnType(), void.class);
|
||||
assertEquals(mt.parameterType(mt.parameterCount() - 1), vh.varType());
|
||||
}
|
||||
|
||||
for (TestAccessMode testAccessMode : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
for (TestAccessMode testAccessMode : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
|
||||
MethodType mt = vh.accessModeType(testAccessMode.toAccessMode());
|
||||
assertEquals(mt.returnType(), boolean.class);
|
||||
assertEquals(mt.parameterType(mt.parameterCount() - 1), vh.varType());
|
||||
assertEquals(mt.parameterType(mt.parameterCount() - 2), vh.varType());
|
||||
}
|
||||
|
||||
for (TestAccessMode testAccessMode : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
for (TestAccessMode testAccessMode : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
|
||||
MethodType mt = vh.accessModeType(testAccessMode.toAccessMode());
|
||||
assertEquals(mt.returnType(), vh.varType());
|
||||
assertEquals(mt.parameterType(mt.parameterCount() - 1), vh.varType());
|
||||
assertEquals(mt.parameterType(mt.parameterCount() - 2), vh.varType());
|
||||
}
|
||||
|
||||
for (TestAccessMode testAccessMode : testAccessModesOfType(TestAccessType.getAndSet, TestAccessType.getAndAdd)) {
|
||||
for (TestAccessMode testAccessMode : testAccessModesOfType(TestAccessType.GET_AND_SET, TestAccessType.GET_AND_ADD)) {
|
||||
MethodType mt = vh.accessModeType(testAccessMode.toAccessMode());
|
||||
assertEquals(mt.returnType(), vh.varType());
|
||||
assertEquals(mt.parameterType(mt.parameterCount() - 1), vh.varType());
|
||||
|
@ -90,27 +90,27 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
|
||||
|
||||
@Test(dataProvider = "varHandlesProvider")
|
||||
public void testIsAccessModeSupported(VarHandle vh) {
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.get));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.set));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getOpaque));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setOpaque));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
|
||||
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
}
|
||||
|
||||
|
||||
|
@ -90,27 +90,27 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
|
||||
|
||||
@Test(dataProvider = "varHandlesProvider")
|
||||
public void testIsAccessModeSupported(VarHandle vh) {
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.get));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.set));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getOpaque));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setOpaque));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
|
||||
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
}
|
||||
|
||||
|
||||
|
@ -90,27 +90,27 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
|
||||
|
||||
@Test(dataProvider = "varHandlesProvider")
|
||||
public void testIsAccessModeSupported(VarHandle vh) {
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.get));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.set));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getOpaque));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setOpaque));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
|
||||
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
}
|
||||
|
||||
|
||||
|
@ -90,27 +90,27 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
|
||||
|
||||
@Test(dataProvider = "varHandlesProvider")
|
||||
public void testIsAccessModeSupported(VarHandle vh) {
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.get));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.set));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getOpaque));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setOpaque));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
|
||||
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
}
|
||||
|
||||
|
||||
|
@ -90,27 +90,27 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
|
||||
|
||||
@Test(dataProvider = "varHandlesProvider")
|
||||
public void testIsAccessModeSupported(VarHandle vh) {
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.get));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.set));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getOpaque));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setOpaque));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
|
||||
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
}
|
||||
|
||||
|
||||
|
@ -90,27 +90,27 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
|
||||
|
||||
@Test(dataProvider = "varHandlesProvider")
|
||||
public void testIsAccessModeSupported(VarHandle vh) {
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.get));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.set));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getOpaque));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setOpaque));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
}
|
||||
|
||||
|
||||
|
@ -90,27 +90,27 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
|
||||
|
||||
@Test(dataProvider = "varHandlesProvider")
|
||||
public void testIsAccessModeSupported(VarHandle vh) {
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.get));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.set));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getOpaque));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setOpaque));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
}
|
||||
|
||||
|
||||
|
@ -90,27 +90,27 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
|
||||
|
||||
@Test(dataProvider = "varHandlesProvider")
|
||||
public void testIsAccessModeSupported(VarHandle vh) {
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.get));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.set));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getOpaque));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setOpaque));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
|
||||
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
}
|
||||
|
||||
|
||||
|
@ -90,27 +90,27 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
|
||||
|
||||
@Test(dataProvider = "varHandlesProvider")
|
||||
public void testIsAccessModeSupported(VarHandle vh) {
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.get));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.set));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getOpaque));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setOpaque));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
}
|
||||
|
||||
|
||||
|
@ -76,28 +76,28 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest {
|
||||
public void testIsAccessModeSupported(VarHandleSource vhs) {
|
||||
VarHandle vh = vhs.s;
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.get));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.set));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getOpaque));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setOpaque));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
|
||||
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
}
|
||||
|
||||
@Test(dataProvider = "typesProvider")
|
||||
|
@ -76,28 +76,28 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest {
|
||||
public void testIsAccessModeSupported(VarHandleSource vhs) {
|
||||
VarHandle vh = vhs.s;
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.get));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.set));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getOpaque));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setOpaque));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
}
|
||||
|
||||
@Test(dataProvider = "typesProvider")
|
||||
|
@ -76,28 +76,28 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest {
|
||||
public void testIsAccessModeSupported(VarHandleSource vhs) {
|
||||
VarHandle vh = vhs.s;
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.get));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.set));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getOpaque));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setOpaque));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
}
|
||||
|
||||
@Test(dataProvider = "typesProvider")
|
||||
|
@ -76,28 +76,28 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
|
||||
public void testIsAccessModeSupported(VarHandleSource vhs) {
|
||||
VarHandle vh = vhs.s;
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.get));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.set));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getOpaque));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setOpaque));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
}
|
||||
|
||||
@Test(dataProvider = "typesProvider")
|
||||
|
@ -76,28 +76,28 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest {
|
||||
public void testIsAccessModeSupported(VarHandleSource vhs) {
|
||||
VarHandle vh = vhs.s;
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.get));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.set));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getOpaque));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setOpaque));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
}
|
||||
|
||||
@Test(dataProvider = "typesProvider")
|
||||
|
@ -76,28 +76,28 @@ public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest {
|
||||
public void testIsAccessModeSupported(VarHandleSource vhs) {
|
||||
VarHandle vh = vhs.s;
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.get));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.set));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getOpaque));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setOpaque));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
|
||||
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
}
|
||||
|
||||
@Test(dataProvider = "typesProvider")
|
||||
|
@ -121,30 +121,30 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
|
||||
static void testInstanceField(VarHandleTestMethodHandleAccessBoolean recv, Handles hs) throws Throwable {
|
||||
// Plain
|
||||
{
|
||||
hs.get(TestAccessMode.set).invokeExact(recv, true);
|
||||
boolean x = (boolean) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, true);
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, true, "set boolean value");
|
||||
}
|
||||
|
||||
|
||||
// Volatile
|
||||
{
|
||||
hs.get(TestAccessMode.setVolatile).invokeExact(recv, false);
|
||||
boolean x = (boolean) hs.get(TestAccessMode.getVolatile).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET_VOLATILE).invokeExact(recv, false);
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(recv);
|
||||
assertEquals(x, false, "setVolatile boolean value");
|
||||
}
|
||||
|
||||
// Lazy
|
||||
{
|
||||
hs.get(TestAccessMode.setRelease).invokeExact(recv, true);
|
||||
boolean x = (boolean) hs.get(TestAccessMode.getAcquire).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET_RELEASE).invokeExact(recv, true);
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(recv);
|
||||
assertEquals(x, true, "setRelease boolean value");
|
||||
}
|
||||
|
||||
// Opaque
|
||||
{
|
||||
hs.get(TestAccessMode.setOpaque).invokeExact(recv, false);
|
||||
boolean x = (boolean) hs.get(TestAccessMode.getOpaque).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET_OPAQUE).invokeExact(recv, false);
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(recv);
|
||||
assertEquals(x, false, "setOpaque boolean value");
|
||||
}
|
||||
|
||||
@ -152,25 +152,25 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
|
||||
}
|
||||
|
||||
static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessBoolean recv, Handles hs) throws Throwable {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
boolean r = (boolean) hs.get(am).invokeExact(recv, true, false);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
|
||||
checkUOE(am, () -> {
|
||||
boolean r = (boolean) hs.get(am).invokeExact(recv, true, false);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
boolean r = (boolean) hs.get(am).invokeExact(recv, true);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
|
||||
checkUOE(am, () -> {
|
||||
boolean r = (boolean) hs.get(am).invokeExact(recv, true);
|
||||
});
|
||||
@ -181,30 +181,30 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
|
||||
static void testStaticField(Handles hs) throws Throwable {
|
||||
// Plain
|
||||
{
|
||||
hs.get(TestAccessMode.set).invokeExact(true);
|
||||
boolean x = (boolean) hs.get(TestAccessMode.get).invokeExact();
|
||||
hs.get(TestAccessMode.SET).invokeExact(true);
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, true, "set boolean value");
|
||||
}
|
||||
|
||||
|
||||
// Volatile
|
||||
{
|
||||
hs.get(TestAccessMode.setVolatile).invokeExact(false);
|
||||
boolean x = (boolean) hs.get(TestAccessMode.getVolatile).invokeExact();
|
||||
hs.get(TestAccessMode.SET_VOLATILE).invokeExact(false);
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET_VOLATILE).invokeExact();
|
||||
assertEquals(x, false, "setVolatile boolean value");
|
||||
}
|
||||
|
||||
// Lazy
|
||||
{
|
||||
hs.get(TestAccessMode.setRelease).invokeExact(true);
|
||||
boolean x = (boolean) hs.get(TestAccessMode.getAcquire).invokeExact();
|
||||
hs.get(TestAccessMode.SET_RELEASE).invokeExact(true);
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact();
|
||||
assertEquals(x, true, "setRelease boolean value");
|
||||
}
|
||||
|
||||
// Opaque
|
||||
{
|
||||
hs.get(TestAccessMode.setOpaque).invokeExact(false);
|
||||
boolean x = (boolean) hs.get(TestAccessMode.getOpaque).invokeExact();
|
||||
hs.get(TestAccessMode.SET_OPAQUE).invokeExact(false);
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET_OPAQUE).invokeExact();
|
||||
assertEquals(x, false, "setOpaque boolean value");
|
||||
}
|
||||
|
||||
@ -212,25 +212,25 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
|
||||
}
|
||||
|
||||
static void testStaticFieldUnsupported(Handles hs) throws Throwable {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
boolean r = (boolean) hs.get(am).invokeExact(true, false);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
|
||||
checkUOE(am, () -> {
|
||||
boolean r = (boolean) hs.get(am).invokeExact(true, false);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
boolean r = (boolean) hs.get(am).invokeExact(true);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
|
||||
checkUOE(am, () -> {
|
||||
boolean r = (boolean) hs.get(am).invokeExact(true);
|
||||
});
|
||||
@ -244,30 +244,30 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
// Plain
|
||||
{
|
||||
hs.get(TestAccessMode.set).invokeExact(array, i, true);
|
||||
boolean x = (boolean) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, true);
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, true, "get boolean value");
|
||||
}
|
||||
|
||||
|
||||
// Volatile
|
||||
{
|
||||
hs.get(TestAccessMode.setVolatile).invokeExact(array, i, false);
|
||||
boolean x = (boolean) hs.get(TestAccessMode.getVolatile).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET_VOLATILE).invokeExact(array, i, false);
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(array, i);
|
||||
assertEquals(x, false, "setVolatile boolean value");
|
||||
}
|
||||
|
||||
// Lazy
|
||||
{
|
||||
hs.get(TestAccessMode.setRelease).invokeExact(array, i, true);
|
||||
boolean x = (boolean) hs.get(TestAccessMode.getAcquire).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET_RELEASE).invokeExact(array, i, true);
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(array, i);
|
||||
assertEquals(x, true, "setRelease boolean value");
|
||||
}
|
||||
|
||||
// Opaque
|
||||
{
|
||||
hs.get(TestAccessMode.setOpaque).invokeExact(array, i, false);
|
||||
boolean x = (boolean) hs.get(TestAccessMode.getOpaque).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET_OPAQUE).invokeExact(array, i, false);
|
||||
boolean x = (boolean) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(array, i);
|
||||
assertEquals(x, false, "setOpaque boolean value");
|
||||
}
|
||||
|
||||
@ -279,25 +279,25 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
|
||||
boolean[] array = new boolean[10];
|
||||
|
||||
final int i = 0;
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
boolean r = (boolean) hs.get(am).invokeExact(array, i, true, false);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
|
||||
checkUOE(am, () -> {
|
||||
boolean r = (boolean) hs.get(am).invokeExact(array, i, true, false);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
boolean r = (boolean) hs.get(am).invokeExact(array, i, true);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
|
||||
checkUOE(am, () -> {
|
||||
boolean o = (boolean) hs.get(am).invokeExact(array, i, true);
|
||||
});
|
||||
@ -310,13 +310,13 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
|
||||
for (int i : new int[]{-1, Integer.MIN_VALUE, 10, 11, Integer.MAX_VALUE}) {
|
||||
final int ci = i;
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
|
||||
checkIOOBE(am, () -> {
|
||||
boolean x = (boolean) hs.get(am).invokeExact(array, ci);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
checkIOOBE(am, () -> {
|
||||
hs.get(am).invokeExact(array, ci, true);
|
||||
});
|
||||
|
@ -121,30 +121,30 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
|
||||
static void testInstanceField(VarHandleTestMethodHandleAccessByte recv, Handles hs) throws Throwable {
|
||||
// Plain
|
||||
{
|
||||
hs.get(TestAccessMode.set).invokeExact(recv, (byte)1);
|
||||
byte x = (byte) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, (byte)1);
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (byte)1, "set byte value");
|
||||
}
|
||||
|
||||
|
||||
// Volatile
|
||||
{
|
||||
hs.get(TestAccessMode.setVolatile).invokeExact(recv, (byte)2);
|
||||
byte x = (byte) hs.get(TestAccessMode.getVolatile).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET_VOLATILE).invokeExact(recv, (byte)2);
|
||||
byte x = (byte) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(recv);
|
||||
assertEquals(x, (byte)2, "setVolatile byte value");
|
||||
}
|
||||
|
||||
// Lazy
|
||||
{
|
||||
hs.get(TestAccessMode.setRelease).invokeExact(recv, (byte)1);
|
||||
byte x = (byte) hs.get(TestAccessMode.getAcquire).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET_RELEASE).invokeExact(recv, (byte)1);
|
||||
byte x = (byte) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(recv);
|
||||
assertEquals(x, (byte)1, "setRelease byte value");
|
||||
}
|
||||
|
||||
// Opaque
|
||||
{
|
||||
hs.get(TestAccessMode.setOpaque).invokeExact(recv, (byte)2);
|
||||
byte x = (byte) hs.get(TestAccessMode.getOpaque).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET_OPAQUE).invokeExact(recv, (byte)2);
|
||||
byte x = (byte) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(recv);
|
||||
assertEquals(x, (byte)2, "setOpaque byte value");
|
||||
}
|
||||
|
||||
@ -152,25 +152,25 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
|
||||
}
|
||||
|
||||
static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessByte recv, Handles hs) throws Throwable {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
boolean r = (boolean) hs.get(am).invokeExact(recv, (byte)1, (byte)2);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
|
||||
checkUOE(am, () -> {
|
||||
byte r = (byte) hs.get(am).invokeExact(recv, (byte)1, (byte)2);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
byte r = (byte) hs.get(am).invokeExact(recv, (byte)1);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
|
||||
checkUOE(am, () -> {
|
||||
byte r = (byte) hs.get(am).invokeExact(recv, (byte)1);
|
||||
});
|
||||
@ -181,30 +181,30 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
|
||||
static void testStaticField(Handles hs) throws Throwable {
|
||||
// Plain
|
||||
{
|
||||
hs.get(TestAccessMode.set).invokeExact((byte)1);
|
||||
byte x = (byte) hs.get(TestAccessMode.get).invokeExact();
|
||||
hs.get(TestAccessMode.SET).invokeExact((byte)1);
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (byte)1, "set byte value");
|
||||
}
|
||||
|
||||
|
||||
// Volatile
|
||||
{
|
||||
hs.get(TestAccessMode.setVolatile).invokeExact((byte)2);
|
||||
byte x = (byte) hs.get(TestAccessMode.getVolatile).invokeExact();
|
||||
hs.get(TestAccessMode.SET_VOLATILE).invokeExact((byte)2);
|
||||
byte x = (byte) hs.get(TestAccessMode.GET_VOLATILE).invokeExact();
|
||||
assertEquals(x, (byte)2, "setVolatile byte value");
|
||||
}
|
||||
|
||||
// Lazy
|
||||
{
|
||||
hs.get(TestAccessMode.setRelease).invokeExact((byte)1);
|
||||
byte x = (byte) hs.get(TestAccessMode.getAcquire).invokeExact();
|
||||
hs.get(TestAccessMode.SET_RELEASE).invokeExact((byte)1);
|
||||
byte x = (byte) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact();
|
||||
assertEquals(x, (byte)1, "setRelease byte value");
|
||||
}
|
||||
|
||||
// Opaque
|
||||
{
|
||||
hs.get(TestAccessMode.setOpaque).invokeExact((byte)2);
|
||||
byte x = (byte) hs.get(TestAccessMode.getOpaque).invokeExact();
|
||||
hs.get(TestAccessMode.SET_OPAQUE).invokeExact((byte)2);
|
||||
byte x = (byte) hs.get(TestAccessMode.GET_OPAQUE).invokeExact();
|
||||
assertEquals(x, (byte)2, "setOpaque byte value");
|
||||
}
|
||||
|
||||
@ -212,25 +212,25 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
|
||||
}
|
||||
|
||||
static void testStaticFieldUnsupported(Handles hs) throws Throwable {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
boolean r = (boolean) hs.get(am).invokeExact((byte)1, (byte)2);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
|
||||
checkUOE(am, () -> {
|
||||
byte r = (byte) hs.get(am).invokeExact((byte)1, (byte)2);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
byte r = (byte) hs.get(am).invokeExact((byte)1);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
|
||||
checkUOE(am, () -> {
|
||||
byte r = (byte) hs.get(am).invokeExact((byte)1);
|
||||
});
|
||||
@ -244,30 +244,30 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
// Plain
|
||||
{
|
||||
hs.get(TestAccessMode.set).invokeExact(array, i, (byte)1);
|
||||
byte x = (byte) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)1);
|
||||
byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (byte)1, "get byte value");
|
||||
}
|
||||
|
||||
|
||||
// Volatile
|
||||
{
|
||||
hs.get(TestAccessMode.setVolatile).invokeExact(array, i, (byte)2);
|
||||
byte x = (byte) hs.get(TestAccessMode.getVolatile).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET_VOLATILE).invokeExact(array, i, (byte)2);
|
||||
byte x = (byte) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(array, i);
|
||||
assertEquals(x, (byte)2, "setVolatile byte value");
|
||||
}
|
||||
|
||||
// Lazy
|
||||
{
|
||||
hs.get(TestAccessMode.setRelease).invokeExact(array, i, (byte)1);
|
||||
byte x = (byte) hs.get(TestAccessMode.getAcquire).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET_RELEASE).invokeExact(array, i, (byte)1);
|
||||
byte x = (byte) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(array, i);
|
||||
assertEquals(x, (byte)1, "setRelease byte value");
|
||||
}
|
||||
|
||||
// Opaque
|
||||
{
|
||||
hs.get(TestAccessMode.setOpaque).invokeExact(array, i, (byte)2);
|
||||
byte x = (byte) hs.get(TestAccessMode.getOpaque).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET_OPAQUE).invokeExact(array, i, (byte)2);
|
||||
byte x = (byte) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(array, i);
|
||||
assertEquals(x, (byte)2, "setOpaque byte value");
|
||||
}
|
||||
|
||||
@ -279,25 +279,25 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
|
||||
byte[] array = new byte[10];
|
||||
|
||||
final int i = 0;
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
boolean r = (boolean) hs.get(am).invokeExact(array, i, (byte)1, (byte)2);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
|
||||
checkUOE(am, () -> {
|
||||
byte r = (byte) hs.get(am).invokeExact(array, i, (byte)1, (byte)2);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
byte r = (byte) hs.get(am).invokeExact(array, i, (byte)1);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
|
||||
checkUOE(am, () -> {
|
||||
byte o = (byte) hs.get(am).invokeExact(array, i, (byte)1);
|
||||
});
|
||||
@ -310,13 +310,13 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
|
||||
for (int i : new int[]{-1, Integer.MIN_VALUE, 10, 11, Integer.MAX_VALUE}) {
|
||||
final int ci = i;
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
|
||||
checkIOOBE(am, () -> {
|
||||
byte x = (byte) hs.get(am).invokeExact(array, ci);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
checkIOOBE(am, () -> {
|
||||
hs.get(am).invokeExact(array, ci, (byte)1);
|
||||
});
|
||||
|
@ -121,30 +121,30 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
|
||||
static void testInstanceField(VarHandleTestMethodHandleAccessChar recv, Handles hs) throws Throwable {
|
||||
// Plain
|
||||
{
|
||||
hs.get(TestAccessMode.set).invokeExact(recv, 'a');
|
||||
char x = (char) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 'a');
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, 'a', "set char value");
|
||||
}
|
||||
|
||||
|
||||
// Volatile
|
||||
{
|
||||
hs.get(TestAccessMode.setVolatile).invokeExact(recv, 'b');
|
||||
char x = (char) hs.get(TestAccessMode.getVolatile).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET_VOLATILE).invokeExact(recv, 'b');
|
||||
char x = (char) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(recv);
|
||||
assertEquals(x, 'b', "setVolatile char value");
|
||||
}
|
||||
|
||||
// Lazy
|
||||
{
|
||||
hs.get(TestAccessMode.setRelease).invokeExact(recv, 'a');
|
||||
char x = (char) hs.get(TestAccessMode.getAcquire).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET_RELEASE).invokeExact(recv, 'a');
|
||||
char x = (char) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(recv);
|
||||
assertEquals(x, 'a', "setRelease char value");
|
||||
}
|
||||
|
||||
// Opaque
|
||||
{
|
||||
hs.get(TestAccessMode.setOpaque).invokeExact(recv, 'b');
|
||||
char x = (char) hs.get(TestAccessMode.getOpaque).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET_OPAQUE).invokeExact(recv, 'b');
|
||||
char x = (char) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(recv);
|
||||
assertEquals(x, 'b', "setOpaque char value");
|
||||
}
|
||||
|
||||
@ -152,25 +152,25 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
|
||||
}
|
||||
|
||||
static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessChar recv, Handles hs) throws Throwable {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
boolean r = (boolean) hs.get(am).invokeExact(recv, 'a', 'b');
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
|
||||
checkUOE(am, () -> {
|
||||
char r = (char) hs.get(am).invokeExact(recv, 'a', 'b');
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
char r = (char) hs.get(am).invokeExact(recv, 'a');
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
|
||||
checkUOE(am, () -> {
|
||||
char r = (char) hs.get(am).invokeExact(recv, 'a');
|
||||
});
|
||||
@ -181,30 +181,30 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
|
||||
static void testStaticField(Handles hs) throws Throwable {
|
||||
// Plain
|
||||
{
|
||||
hs.get(TestAccessMode.set).invokeExact('a');
|
||||
char x = (char) hs.get(TestAccessMode.get).invokeExact();
|
||||
hs.get(TestAccessMode.SET).invokeExact('a');
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 'a', "set char value");
|
||||
}
|
||||
|
||||
|
||||
// Volatile
|
||||
{
|
||||
hs.get(TestAccessMode.setVolatile).invokeExact('b');
|
||||
char x = (char) hs.get(TestAccessMode.getVolatile).invokeExact();
|
||||
hs.get(TestAccessMode.SET_VOLATILE).invokeExact('b');
|
||||
char x = (char) hs.get(TestAccessMode.GET_VOLATILE).invokeExact();
|
||||
assertEquals(x, 'b', "setVolatile char value");
|
||||
}
|
||||
|
||||
// Lazy
|
||||
{
|
||||
hs.get(TestAccessMode.setRelease).invokeExact('a');
|
||||
char x = (char) hs.get(TestAccessMode.getAcquire).invokeExact();
|
||||
hs.get(TestAccessMode.SET_RELEASE).invokeExact('a');
|
||||
char x = (char) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact();
|
||||
assertEquals(x, 'a', "setRelease char value");
|
||||
}
|
||||
|
||||
// Opaque
|
||||
{
|
||||
hs.get(TestAccessMode.setOpaque).invokeExact('b');
|
||||
char x = (char) hs.get(TestAccessMode.getOpaque).invokeExact();
|
||||
hs.get(TestAccessMode.SET_OPAQUE).invokeExact('b');
|
||||
char x = (char) hs.get(TestAccessMode.GET_OPAQUE).invokeExact();
|
||||
assertEquals(x, 'b', "setOpaque char value");
|
||||
}
|
||||
|
||||
@ -212,25 +212,25 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
|
||||
}
|
||||
|
||||
static void testStaticFieldUnsupported(Handles hs) throws Throwable {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
boolean r = (boolean) hs.get(am).invokeExact('a', 'b');
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
|
||||
checkUOE(am, () -> {
|
||||
char r = (char) hs.get(am).invokeExact('a', 'b');
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
char r = (char) hs.get(am).invokeExact('a');
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
|
||||
checkUOE(am, () -> {
|
||||
char r = (char) hs.get(am).invokeExact('a');
|
||||
});
|
||||
@ -244,30 +244,30 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
// Plain
|
||||
{
|
||||
hs.get(TestAccessMode.set).invokeExact(array, i, 'a');
|
||||
char x = (char) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 'a');
|
||||
char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 'a', "get char value");
|
||||
}
|
||||
|
||||
|
||||
// Volatile
|
||||
{
|
||||
hs.get(TestAccessMode.setVolatile).invokeExact(array, i, 'b');
|
||||
char x = (char) hs.get(TestAccessMode.getVolatile).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET_VOLATILE).invokeExact(array, i, 'b');
|
||||
char x = (char) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(array, i);
|
||||
assertEquals(x, 'b', "setVolatile char value");
|
||||
}
|
||||
|
||||
// Lazy
|
||||
{
|
||||
hs.get(TestAccessMode.setRelease).invokeExact(array, i, 'a');
|
||||
char x = (char) hs.get(TestAccessMode.getAcquire).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET_RELEASE).invokeExact(array, i, 'a');
|
||||
char x = (char) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(array, i);
|
||||
assertEquals(x, 'a', "setRelease char value");
|
||||
}
|
||||
|
||||
// Opaque
|
||||
{
|
||||
hs.get(TestAccessMode.setOpaque).invokeExact(array, i, 'b');
|
||||
char x = (char) hs.get(TestAccessMode.getOpaque).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET_OPAQUE).invokeExact(array, i, 'b');
|
||||
char x = (char) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(array, i);
|
||||
assertEquals(x, 'b', "setOpaque char value");
|
||||
}
|
||||
|
||||
@ -279,25 +279,25 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
|
||||
char[] array = new char[10];
|
||||
|
||||
final int i = 0;
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
boolean r = (boolean) hs.get(am).invokeExact(array, i, 'a', 'b');
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
|
||||
checkUOE(am, () -> {
|
||||
char r = (char) hs.get(am).invokeExact(array, i, 'a', 'b');
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
char r = (char) hs.get(am).invokeExact(array, i, 'a');
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
|
||||
checkUOE(am, () -> {
|
||||
char o = (char) hs.get(am).invokeExact(array, i, 'a');
|
||||
});
|
||||
@ -310,13 +310,13 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
|
||||
for (int i : new int[]{-1, Integer.MIN_VALUE, 10, 11, Integer.MAX_VALUE}) {
|
||||
final int ci = i;
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
|
||||
checkIOOBE(am, () -> {
|
||||
char x = (char) hs.get(am).invokeExact(array, ci);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
checkIOOBE(am, () -> {
|
||||
hs.get(am).invokeExact(array, ci, 'a');
|
||||
});
|
||||
|
@ -121,30 +121,30 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
|
||||
static void testInstanceField(VarHandleTestMethodHandleAccessDouble recv, Handles hs) throws Throwable {
|
||||
// Plain
|
||||
{
|
||||
hs.get(TestAccessMode.set).invokeExact(recv, 1.0d);
|
||||
double x = (double) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 1.0d);
|
||||
double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, 1.0d, "set double value");
|
||||
}
|
||||
|
||||
|
||||
// Volatile
|
||||
{
|
||||
hs.get(TestAccessMode.setVolatile).invokeExact(recv, 2.0d);
|
||||
double x = (double) hs.get(TestAccessMode.getVolatile).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET_VOLATILE).invokeExact(recv, 2.0d);
|
||||
double x = (double) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(recv);
|
||||
assertEquals(x, 2.0d, "setVolatile double value");
|
||||
}
|
||||
|
||||
// Lazy
|
||||
{
|
||||
hs.get(TestAccessMode.setRelease).invokeExact(recv, 1.0d);
|
||||
double x = (double) hs.get(TestAccessMode.getAcquire).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET_RELEASE).invokeExact(recv, 1.0d);
|
||||
double x = (double) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(recv);
|
||||
assertEquals(x, 1.0d, "setRelease double value");
|
||||
}
|
||||
|
||||
// Opaque
|
||||
{
|
||||
hs.get(TestAccessMode.setOpaque).invokeExact(recv, 2.0d);
|
||||
double x = (double) hs.get(TestAccessMode.getOpaque).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET_OPAQUE).invokeExact(recv, 2.0d);
|
||||
double x = (double) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(recv);
|
||||
assertEquals(x, 2.0d, "setOpaque double value");
|
||||
}
|
||||
|
||||
@ -152,25 +152,25 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
|
||||
}
|
||||
|
||||
static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessDouble recv, Handles hs) throws Throwable {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
boolean r = (boolean) hs.get(am).invokeExact(recv, 1.0d, 2.0d);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
|
||||
checkUOE(am, () -> {
|
||||
double r = (double) hs.get(am).invokeExact(recv, 1.0d, 2.0d);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
double r = (double) hs.get(am).invokeExact(recv, 1.0d);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
|
||||
checkUOE(am, () -> {
|
||||
double r = (double) hs.get(am).invokeExact(recv, 1.0d);
|
||||
});
|
||||
@ -181,30 +181,30 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
|
||||
static void testStaticField(Handles hs) throws Throwable {
|
||||
// Plain
|
||||
{
|
||||
hs.get(TestAccessMode.set).invokeExact(1.0d);
|
||||
double x = (double) hs.get(TestAccessMode.get).invokeExact();
|
||||
hs.get(TestAccessMode.SET).invokeExact(1.0d);
|
||||
double x = (double) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 1.0d, "set double value");
|
||||
}
|
||||
|
||||
|
||||
// Volatile
|
||||
{
|
||||
hs.get(TestAccessMode.setVolatile).invokeExact(2.0d);
|
||||
double x = (double) hs.get(TestAccessMode.getVolatile).invokeExact();
|
||||
hs.get(TestAccessMode.SET_VOLATILE).invokeExact(2.0d);
|
||||
double x = (double) hs.get(TestAccessMode.GET_VOLATILE).invokeExact();
|
||||
assertEquals(x, 2.0d, "setVolatile double value");
|
||||
}
|
||||
|
||||
// Lazy
|
||||
{
|
||||
hs.get(TestAccessMode.setRelease).invokeExact(1.0d);
|
||||
double x = (double) hs.get(TestAccessMode.getAcquire).invokeExact();
|
||||
hs.get(TestAccessMode.SET_RELEASE).invokeExact(1.0d);
|
||||
double x = (double) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact();
|
||||
assertEquals(x, 1.0d, "setRelease double value");
|
||||
}
|
||||
|
||||
// Opaque
|
||||
{
|
||||
hs.get(TestAccessMode.setOpaque).invokeExact(2.0d);
|
||||
double x = (double) hs.get(TestAccessMode.getOpaque).invokeExact();
|
||||
hs.get(TestAccessMode.SET_OPAQUE).invokeExact(2.0d);
|
||||
double x = (double) hs.get(TestAccessMode.GET_OPAQUE).invokeExact();
|
||||
assertEquals(x, 2.0d, "setOpaque double value");
|
||||
}
|
||||
|
||||
@ -212,25 +212,25 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
|
||||
}
|
||||
|
||||
static void testStaticFieldUnsupported(Handles hs) throws Throwable {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
boolean r = (boolean) hs.get(am).invokeExact(1.0d, 2.0d);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
|
||||
checkUOE(am, () -> {
|
||||
double r = (double) hs.get(am).invokeExact(1.0d, 2.0d);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
double r = (double) hs.get(am).invokeExact(1.0d);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
|
||||
checkUOE(am, () -> {
|
||||
double r = (double) hs.get(am).invokeExact(1.0d);
|
||||
});
|
||||
@ -244,30 +244,30 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
// Plain
|
||||
{
|
||||
hs.get(TestAccessMode.set).invokeExact(array, i, 1.0d);
|
||||
double x = (double) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0d);
|
||||
double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 1.0d, "get double value");
|
||||
}
|
||||
|
||||
|
||||
// Volatile
|
||||
{
|
||||
hs.get(TestAccessMode.setVolatile).invokeExact(array, i, 2.0d);
|
||||
double x = (double) hs.get(TestAccessMode.getVolatile).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET_VOLATILE).invokeExact(array, i, 2.0d);
|
||||
double x = (double) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(array, i);
|
||||
assertEquals(x, 2.0d, "setVolatile double value");
|
||||
}
|
||||
|
||||
// Lazy
|
||||
{
|
||||
hs.get(TestAccessMode.setRelease).invokeExact(array, i, 1.0d);
|
||||
double x = (double) hs.get(TestAccessMode.getAcquire).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET_RELEASE).invokeExact(array, i, 1.0d);
|
||||
double x = (double) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(array, i);
|
||||
assertEquals(x, 1.0d, "setRelease double value");
|
||||
}
|
||||
|
||||
// Opaque
|
||||
{
|
||||
hs.get(TestAccessMode.setOpaque).invokeExact(array, i, 2.0d);
|
||||
double x = (double) hs.get(TestAccessMode.getOpaque).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET_OPAQUE).invokeExact(array, i, 2.0d);
|
||||
double x = (double) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(array, i);
|
||||
assertEquals(x, 2.0d, "setOpaque double value");
|
||||
}
|
||||
|
||||
@ -279,25 +279,25 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
|
||||
double[] array = new double[10];
|
||||
|
||||
final int i = 0;
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
boolean r = (boolean) hs.get(am).invokeExact(array, i, 1.0d, 2.0d);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
|
||||
checkUOE(am, () -> {
|
||||
double r = (double) hs.get(am).invokeExact(array, i, 1.0d, 2.0d);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
double r = (double) hs.get(am).invokeExact(array, i, 1.0d);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
|
||||
checkUOE(am, () -> {
|
||||
double o = (double) hs.get(am).invokeExact(array, i, 1.0d);
|
||||
});
|
||||
@ -310,13 +310,13 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
|
||||
for (int i : new int[]{-1, Integer.MIN_VALUE, 10, 11, Integer.MAX_VALUE}) {
|
||||
final int ci = i;
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
|
||||
checkIOOBE(am, () -> {
|
||||
double x = (double) hs.get(am).invokeExact(array, ci);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
checkIOOBE(am, () -> {
|
||||
hs.get(am).invokeExact(array, ci, 1.0d);
|
||||
});
|
||||
|
@ -121,30 +121,30 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
|
||||
static void testInstanceField(VarHandleTestMethodHandleAccessFloat recv, Handles hs) throws Throwable {
|
||||
// Plain
|
||||
{
|
||||
hs.get(TestAccessMode.set).invokeExact(recv, 1.0f);
|
||||
float x = (float) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 1.0f);
|
||||
float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, 1.0f, "set float value");
|
||||
}
|
||||
|
||||
|
||||
// Volatile
|
||||
{
|
||||
hs.get(TestAccessMode.setVolatile).invokeExact(recv, 2.0f);
|
||||
float x = (float) hs.get(TestAccessMode.getVolatile).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET_VOLATILE).invokeExact(recv, 2.0f);
|
||||
float x = (float) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(recv);
|
||||
assertEquals(x, 2.0f, "setVolatile float value");
|
||||
}
|
||||
|
||||
// Lazy
|
||||
{
|
||||
hs.get(TestAccessMode.setRelease).invokeExact(recv, 1.0f);
|
||||
float x = (float) hs.get(TestAccessMode.getAcquire).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET_RELEASE).invokeExact(recv, 1.0f);
|
||||
float x = (float) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(recv);
|
||||
assertEquals(x, 1.0f, "setRelease float value");
|
||||
}
|
||||
|
||||
// Opaque
|
||||
{
|
||||
hs.get(TestAccessMode.setOpaque).invokeExact(recv, 2.0f);
|
||||
float x = (float) hs.get(TestAccessMode.getOpaque).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET_OPAQUE).invokeExact(recv, 2.0f);
|
||||
float x = (float) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(recv);
|
||||
assertEquals(x, 2.0f, "setOpaque float value");
|
||||
}
|
||||
|
||||
@ -152,25 +152,25 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
|
||||
}
|
||||
|
||||
static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessFloat recv, Handles hs) throws Throwable {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
boolean r = (boolean) hs.get(am).invokeExact(recv, 1.0f, 2.0f);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
|
||||
checkUOE(am, () -> {
|
||||
float r = (float) hs.get(am).invokeExact(recv, 1.0f, 2.0f);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
float r = (float) hs.get(am).invokeExact(recv, 1.0f);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
|
||||
checkUOE(am, () -> {
|
||||
float r = (float) hs.get(am).invokeExact(recv, 1.0f);
|
||||
});
|
||||
@ -181,30 +181,30 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
|
||||
static void testStaticField(Handles hs) throws Throwable {
|
||||
// Plain
|
||||
{
|
||||
hs.get(TestAccessMode.set).invokeExact(1.0f);
|
||||
float x = (float) hs.get(TestAccessMode.get).invokeExact();
|
||||
hs.get(TestAccessMode.SET).invokeExact(1.0f);
|
||||
float x = (float) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 1.0f, "set float value");
|
||||
}
|
||||
|
||||
|
||||
// Volatile
|
||||
{
|
||||
hs.get(TestAccessMode.setVolatile).invokeExact(2.0f);
|
||||
float x = (float) hs.get(TestAccessMode.getVolatile).invokeExact();
|
||||
hs.get(TestAccessMode.SET_VOLATILE).invokeExact(2.0f);
|
||||
float x = (float) hs.get(TestAccessMode.GET_VOLATILE).invokeExact();
|
||||
assertEquals(x, 2.0f, "setVolatile float value");
|
||||
}
|
||||
|
||||
// Lazy
|
||||
{
|
||||
hs.get(TestAccessMode.setRelease).invokeExact(1.0f);
|
||||
float x = (float) hs.get(TestAccessMode.getAcquire).invokeExact();
|
||||
hs.get(TestAccessMode.SET_RELEASE).invokeExact(1.0f);
|
||||
float x = (float) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact();
|
||||
assertEquals(x, 1.0f, "setRelease float value");
|
||||
}
|
||||
|
||||
// Opaque
|
||||
{
|
||||
hs.get(TestAccessMode.setOpaque).invokeExact(2.0f);
|
||||
float x = (float) hs.get(TestAccessMode.getOpaque).invokeExact();
|
||||
hs.get(TestAccessMode.SET_OPAQUE).invokeExact(2.0f);
|
||||
float x = (float) hs.get(TestAccessMode.GET_OPAQUE).invokeExact();
|
||||
assertEquals(x, 2.0f, "setOpaque float value");
|
||||
}
|
||||
|
||||
@ -212,25 +212,25 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
|
||||
}
|
||||
|
||||
static void testStaticFieldUnsupported(Handles hs) throws Throwable {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
boolean r = (boolean) hs.get(am).invokeExact(1.0f, 2.0f);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
|
||||
checkUOE(am, () -> {
|
||||
float r = (float) hs.get(am).invokeExact(1.0f, 2.0f);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
float r = (float) hs.get(am).invokeExact(1.0f);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
|
||||
checkUOE(am, () -> {
|
||||
float r = (float) hs.get(am).invokeExact(1.0f);
|
||||
});
|
||||
@ -244,30 +244,30 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
// Plain
|
||||
{
|
||||
hs.get(TestAccessMode.set).invokeExact(array, i, 1.0f);
|
||||
float x = (float) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0f);
|
||||
float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 1.0f, "get float value");
|
||||
}
|
||||
|
||||
|
||||
// Volatile
|
||||
{
|
||||
hs.get(TestAccessMode.setVolatile).invokeExact(array, i, 2.0f);
|
||||
float x = (float) hs.get(TestAccessMode.getVolatile).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET_VOLATILE).invokeExact(array, i, 2.0f);
|
||||
float x = (float) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(array, i);
|
||||
assertEquals(x, 2.0f, "setVolatile float value");
|
||||
}
|
||||
|
||||
// Lazy
|
||||
{
|
||||
hs.get(TestAccessMode.setRelease).invokeExact(array, i, 1.0f);
|
||||
float x = (float) hs.get(TestAccessMode.getAcquire).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET_RELEASE).invokeExact(array, i, 1.0f);
|
||||
float x = (float) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(array, i);
|
||||
assertEquals(x, 1.0f, "setRelease float value");
|
||||
}
|
||||
|
||||
// Opaque
|
||||
{
|
||||
hs.get(TestAccessMode.setOpaque).invokeExact(array, i, 2.0f);
|
||||
float x = (float) hs.get(TestAccessMode.getOpaque).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET_OPAQUE).invokeExact(array, i, 2.0f);
|
||||
float x = (float) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(array, i);
|
||||
assertEquals(x, 2.0f, "setOpaque float value");
|
||||
}
|
||||
|
||||
@ -279,25 +279,25 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
|
||||
float[] array = new float[10];
|
||||
|
||||
final int i = 0;
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
boolean r = (boolean) hs.get(am).invokeExact(array, i, 1.0f, 2.0f);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
|
||||
checkUOE(am, () -> {
|
||||
float r = (float) hs.get(am).invokeExact(array, i, 1.0f, 2.0f);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
float r = (float) hs.get(am).invokeExact(array, i, 1.0f);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
|
||||
checkUOE(am, () -> {
|
||||
float o = (float) hs.get(am).invokeExact(array, i, 1.0f);
|
||||
});
|
||||
@ -310,13 +310,13 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
|
||||
for (int i : new int[]{-1, Integer.MIN_VALUE, 10, 11, Integer.MAX_VALUE}) {
|
||||
final int ci = i;
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
|
||||
checkIOOBE(am, () -> {
|
||||
float x = (float) hs.get(am).invokeExact(array, ci);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
checkIOOBE(am, () -> {
|
||||
hs.get(am).invokeExact(array, ci, 1.0f);
|
||||
});
|
||||
|
@ -121,128 +121,128 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
|
||||
static void testInstanceField(VarHandleTestMethodHandleAccessInt recv, Handles hs) throws Throwable {
|
||||
// Plain
|
||||
{
|
||||
hs.get(TestAccessMode.set).invokeExact(recv, 1);
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 1);
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, 1, "set int value");
|
||||
}
|
||||
|
||||
|
||||
// Volatile
|
||||
{
|
||||
hs.get(TestAccessMode.setVolatile).invokeExact(recv, 2);
|
||||
int x = (int) hs.get(TestAccessMode.getVolatile).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET_VOLATILE).invokeExact(recv, 2);
|
||||
int x = (int) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(recv);
|
||||
assertEquals(x, 2, "setVolatile int value");
|
||||
}
|
||||
|
||||
// Lazy
|
||||
{
|
||||
hs.get(TestAccessMode.setRelease).invokeExact(recv, 1);
|
||||
int x = (int) hs.get(TestAccessMode.getAcquire).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET_RELEASE).invokeExact(recv, 1);
|
||||
int x = (int) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(recv);
|
||||
assertEquals(x, 1, "setRelease int value");
|
||||
}
|
||||
|
||||
// Opaque
|
||||
{
|
||||
hs.get(TestAccessMode.setOpaque).invokeExact(recv, 2);
|
||||
int x = (int) hs.get(TestAccessMode.getOpaque).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET_OPAQUE).invokeExact(recv, 2);
|
||||
int x = (int) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(recv);
|
||||
assertEquals(x, 2, "setOpaque int value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.set).invokeExact(recv, 1);
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 1);
|
||||
|
||||
// Compare
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(recv, 1, 2);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, 1, 2);
|
||||
assertEquals(r, true, "success compareAndSet int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, 2, "success compareAndSet int value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(recv, 1, 3);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, 1, 3);
|
||||
assertEquals(r, false, "failing compareAndSet int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, 2, "failing compareAndSet int value");
|
||||
}
|
||||
|
||||
{
|
||||
int r = (int) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(recv, 2, 1);
|
||||
int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(recv, 2, 1);
|
||||
assertEquals(r, 2, "success compareAndExchangeVolatile int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, 1, "success compareAndExchangeVolatile int value");
|
||||
}
|
||||
|
||||
{
|
||||
int r = (int) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(recv, 2, 3);
|
||||
int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(recv, 2, 3);
|
||||
assertEquals(r, 1, "failing compareAndExchangeVolatile int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, 1, "failing compareAndExchangeVolatile int value");
|
||||
}
|
||||
|
||||
{
|
||||
int r = (int) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(recv, 1, 2);
|
||||
int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, 1, 2);
|
||||
assertEquals(r, 1, "success compareAndExchangeAcquire int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, 2, "success compareAndExchangeAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
int r = (int) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(recv, 1, 3);
|
||||
int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, 1, 3);
|
||||
assertEquals(r, 2, "failing compareAndExchangeAcquire int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, 2, "failing compareAndExchangeAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
int r = (int) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(recv, 2, 1);
|
||||
int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, 2, 1);
|
||||
assertEquals(r, 2, "success compareAndExchangeRelease int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, 1, "success compareAndExchangeRelease int value");
|
||||
}
|
||||
|
||||
{
|
||||
int r = (int) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(recv, 2, 3);
|
||||
int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, 2, 3);
|
||||
assertEquals(r, 1, "failing compareAndExchangeRelease int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, 1, "failing compareAndExchangeRelease int value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSet).invokeExact(recv, 1, 2);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 1, 2);
|
||||
assertEquals(r, true, "weakCompareAndSet int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, 2, "weakCompareAndSet int value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetAcquire).invokeExact(recv, 2, 1);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, 2, 1);
|
||||
assertEquals(r, true, "weakCompareAndSetAcquire int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, 1, "weakCompareAndSetAcquire int");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetRelease).invokeExact(recv, 1, 2);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, 1, 2);
|
||||
assertEquals(r, true, "weakCompareAndSetRelease int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, 2, "weakCompareAndSetRelease int");
|
||||
}
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
int o = (int) hs.get(TestAccessMode.getAndSet).invokeExact(recv, 1);
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_SET).invokeExact(recv, 1);
|
||||
assertEquals(o, 2, "getAndSet int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, 1, "getAndSet int value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.set).invokeExact(recv, 1);
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 1);
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
int o = (int) hs.get(TestAccessMode.getAndAdd).invokeExact(recv, 3);
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, 3);
|
||||
assertEquals(o, 1, "getAndAdd int");
|
||||
int c = (int) hs.get(TestAccessMode.addAndGet).invokeExact(recv, 3);
|
||||
int c = (int) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(recv, 3);
|
||||
assertEquals(c, 1 + 3 + 3, "getAndAdd int value");
|
||||
}
|
||||
}
|
||||
@ -255,128 +255,128 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
|
||||
static void testStaticField(Handles hs) throws Throwable {
|
||||
// Plain
|
||||
{
|
||||
hs.get(TestAccessMode.set).invokeExact(1);
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact();
|
||||
hs.get(TestAccessMode.SET).invokeExact(1);
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 1, "set int value");
|
||||
}
|
||||
|
||||
|
||||
// Volatile
|
||||
{
|
||||
hs.get(TestAccessMode.setVolatile).invokeExact(2);
|
||||
int x = (int) hs.get(TestAccessMode.getVolatile).invokeExact();
|
||||
hs.get(TestAccessMode.SET_VOLATILE).invokeExact(2);
|
||||
int x = (int) hs.get(TestAccessMode.GET_VOLATILE).invokeExact();
|
||||
assertEquals(x, 2, "setVolatile int value");
|
||||
}
|
||||
|
||||
// Lazy
|
||||
{
|
||||
hs.get(TestAccessMode.setRelease).invokeExact(1);
|
||||
int x = (int) hs.get(TestAccessMode.getAcquire).invokeExact();
|
||||
hs.get(TestAccessMode.SET_RELEASE).invokeExact(1);
|
||||
int x = (int) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact();
|
||||
assertEquals(x, 1, "setRelease int value");
|
||||
}
|
||||
|
||||
// Opaque
|
||||
{
|
||||
hs.get(TestAccessMode.setOpaque).invokeExact(2);
|
||||
int x = (int) hs.get(TestAccessMode.getOpaque).invokeExact();
|
||||
hs.get(TestAccessMode.SET_OPAQUE).invokeExact(2);
|
||||
int x = (int) hs.get(TestAccessMode.GET_OPAQUE).invokeExact();
|
||||
assertEquals(x, 2, "setOpaque int value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.set).invokeExact(1);
|
||||
hs.get(TestAccessMode.SET).invokeExact(1);
|
||||
|
||||
// Compare
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(1, 2);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(1, 2);
|
||||
assertEquals(r, true, "success compareAndSet int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact();
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 2, "success compareAndSet int value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(1, 3);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(1, 3);
|
||||
assertEquals(r, false, "failing compareAndSet int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact();
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 2, "failing compareAndSet int value");
|
||||
}
|
||||
|
||||
{
|
||||
int r = (int) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(2, 1);
|
||||
int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(2, 1);
|
||||
assertEquals(r, 2, "success compareAndExchangeVolatile int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact();
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 1, "success compareAndExchangeVolatile int value");
|
||||
}
|
||||
|
||||
{
|
||||
int r = (int) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(2, 3);
|
||||
int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(2, 3);
|
||||
assertEquals(r, 1, "failing compareAndExchangeVolatile int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact();
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 1, "failing compareAndExchangeVolatile int value");
|
||||
}
|
||||
|
||||
{
|
||||
int r = (int) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(1, 2);
|
||||
int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(1, 2);
|
||||
assertEquals(r, 1, "success compareAndExchangeAcquire int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact();
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 2, "success compareAndExchangeAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
int r = (int) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(1, 3);
|
||||
int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(1, 3);
|
||||
assertEquals(r, 2, "failing compareAndExchangeAcquire int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact();
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 2, "failing compareAndExchangeAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
int r = (int) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(2, 1);
|
||||
int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(2, 1);
|
||||
assertEquals(r, 2, "success compareAndExchangeRelease int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact();
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 1, "success compareAndExchangeRelease int value");
|
||||
}
|
||||
|
||||
{
|
||||
int r = (int) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(2, 3);
|
||||
int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(2, 3);
|
||||
assertEquals(r, 1, "failing compareAndExchangeRelease int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact();
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 1, "failing compareAndExchangeRelease int value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSet).invokeExact(1, 2);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(1, 2);
|
||||
assertEquals(r, true, "weakCompareAndSet int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact();
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 2, "weakCompareAndSet int value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetAcquire).invokeExact(2, 1);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(2, 1);
|
||||
assertEquals(r, true, "weakCompareAndSetAcquire int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact();
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 1, "weakCompareAndSetAcquire int");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetRelease).invokeExact( 1, 2);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact( 1, 2);
|
||||
assertEquals(r, true, "weakCompareAndSetRelease int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact();
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 2, "weakCompareAndSetRelease int");
|
||||
}
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
int o = (int) hs.get(TestAccessMode.getAndSet).invokeExact( 1);
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_SET).invokeExact( 1);
|
||||
assertEquals(o, 2, "getAndSet int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact();
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 1, "getAndSet int value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.set).invokeExact(1);
|
||||
hs.get(TestAccessMode.SET).invokeExact(1);
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
int o = (int) hs.get(TestAccessMode.getAndAdd).invokeExact( 3);
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_ADD).invokeExact( 3);
|
||||
assertEquals(o, 1, "getAndAdd int");
|
||||
int c = (int) hs.get(TestAccessMode.addAndGet).invokeExact(3);
|
||||
int c = (int) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(3);
|
||||
assertEquals(c, 1 + 3 + 3, "getAndAdd int value");
|
||||
}
|
||||
}
|
||||
@ -392,128 +392,128 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
// Plain
|
||||
{
|
||||
hs.get(TestAccessMode.set).invokeExact(array, i, 1);
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 1);
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 1, "get int value");
|
||||
}
|
||||
|
||||
|
||||
// Volatile
|
||||
{
|
||||
hs.get(TestAccessMode.setVolatile).invokeExact(array, i, 2);
|
||||
int x = (int) hs.get(TestAccessMode.getVolatile).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET_VOLATILE).invokeExact(array, i, 2);
|
||||
int x = (int) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(array, i);
|
||||
assertEquals(x, 2, "setVolatile int value");
|
||||
}
|
||||
|
||||
// Lazy
|
||||
{
|
||||
hs.get(TestAccessMode.setRelease).invokeExact(array, i, 1);
|
||||
int x = (int) hs.get(TestAccessMode.getAcquire).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET_RELEASE).invokeExact(array, i, 1);
|
||||
int x = (int) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(array, i);
|
||||
assertEquals(x, 1, "setRelease int value");
|
||||
}
|
||||
|
||||
// Opaque
|
||||
{
|
||||
hs.get(TestAccessMode.setOpaque).invokeExact(array, i, 2);
|
||||
int x = (int) hs.get(TestAccessMode.getOpaque).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET_OPAQUE).invokeExact(array, i, 2);
|
||||
int x = (int) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(array, i);
|
||||
assertEquals(x, 2, "setOpaque int value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.set).invokeExact(array, i, 1);
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 1);
|
||||
|
||||
// Compare
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(array, i, 1, 2);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, 1, 2);
|
||||
assertEquals(r, true, "success compareAndSet int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 2, "success compareAndSet int value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(array, i, 1, 3);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, 1, 3);
|
||||
assertEquals(r, false, "failing compareAndSet int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 2, "failing compareAndSet int value");
|
||||
}
|
||||
|
||||
{
|
||||
int r = (int) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(array, i, 2, 1);
|
||||
int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(array, i, 2, 1);
|
||||
assertEquals(r, 2, "success compareAndExchangeVolatile int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 1, "success compareAndExchangeVolatile int value");
|
||||
}
|
||||
|
||||
{
|
||||
int r = (int) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(array, i, 2, 3);
|
||||
int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(array, i, 2, 3);
|
||||
assertEquals(r, 1, "failing compareAndExchangeVolatile int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 1, "failing compareAndExchangeVolatile int value");
|
||||
}
|
||||
|
||||
{
|
||||
int r = (int) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(array, i, 1, 2);
|
||||
int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, 1, 2);
|
||||
assertEquals(r, 1, "success compareAndExchangeAcquire int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 2, "success compareAndExchangeAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
int r = (int) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(array, i, 1, 3);
|
||||
int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, 1, 3);
|
||||
assertEquals(r, 2, "failing compareAndExchangeAcquire int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 2, "failing compareAndExchangeAcquire int value");
|
||||
}
|
||||
|
||||
{
|
||||
int r = (int) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(array, i, 2, 1);
|
||||
int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, 2, 1);
|
||||
assertEquals(r, 2, "success compareAndExchangeRelease int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 1, "success compareAndExchangeRelease int value");
|
||||
}
|
||||
|
||||
{
|
||||
int r = (int) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(array, i, 2, 3);
|
||||
int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, 2, 3);
|
||||
assertEquals(r, 1, "failing compareAndExchangeRelease int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 1, "failing compareAndExchangeRelease int value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSet).invokeExact(array, i, 1, 2);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 1, 2);
|
||||
assertEquals(r, true, "weakCompareAndSet int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 2, "weakCompareAndSet int value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetAcquire).invokeExact(array, i, 2, 1);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, 2, 1);
|
||||
assertEquals(r, true, "weakCompareAndSetAcquire int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 1, "weakCompareAndSetAcquire int");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetRelease).invokeExact(array, i, 1, 2);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(array, i, 1, 2);
|
||||
assertEquals(r, true, "weakCompareAndSetRelease int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 2, "weakCompareAndSetRelease int");
|
||||
}
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
int o = (int) hs.get(TestAccessMode.getAndSet).invokeExact(array, i, 1);
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, 1);
|
||||
assertEquals(o, 2, "getAndSet int");
|
||||
int x = (int) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 1, "getAndSet int value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.set).invokeExact(array, i, 1);
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 1);
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
int o = (int) hs.get(TestAccessMode.getAndAdd).invokeExact(array, i, 3);
|
||||
int o = (int) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, 3);
|
||||
assertEquals(o, 1, "getAndAdd int");
|
||||
int c = (int) hs.get(TestAccessMode.addAndGet).invokeExact(array, i, 3);
|
||||
int c = (int) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(array, i, 3);
|
||||
assertEquals(c, 1 + 3 + 3, "getAndAdd int value");
|
||||
}
|
||||
}
|
||||
@ -532,37 +532,37 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
|
||||
for (int i : new int[]{-1, Integer.MIN_VALUE, 10, 11, Integer.MAX_VALUE}) {
|
||||
final int ci = i;
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
|
||||
checkIOOBE(am, () -> {
|
||||
int x = (int) hs.get(am).invokeExact(array, ci);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
checkIOOBE(am, () -> {
|
||||
hs.get(am).invokeExact(array, ci, 1);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
|
||||
checkIOOBE(am, () -> {
|
||||
boolean r = (boolean) hs.get(am).invokeExact(array, ci, 1, 2);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
|
||||
checkIOOBE(am, () -> {
|
||||
int r = (int) hs.get(am).invokeExact(array, ci, 2, 1);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
|
||||
checkIOOBE(am, () -> {
|
||||
int o = (int) hs.get(am).invokeExact(array, ci, 1);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
|
||||
checkIOOBE(am, () -> {
|
||||
int o = (int) hs.get(am).invokeExact(array, ci, 3);
|
||||
});
|
||||
|
@ -121,128 +121,128 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
|
||||
static void testInstanceField(VarHandleTestMethodHandleAccessLong recv, Handles hs) throws Throwable {
|
||||
// Plain
|
||||
{
|
||||
hs.get(TestAccessMode.set).invokeExact(recv, 1L);
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 1L);
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, 1L, "set long value");
|
||||
}
|
||||
|
||||
|
||||
// Volatile
|
||||
{
|
||||
hs.get(TestAccessMode.setVolatile).invokeExact(recv, 2L);
|
||||
long x = (long) hs.get(TestAccessMode.getVolatile).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET_VOLATILE).invokeExact(recv, 2L);
|
||||
long x = (long) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(recv);
|
||||
assertEquals(x, 2L, "setVolatile long value");
|
||||
}
|
||||
|
||||
// Lazy
|
||||
{
|
||||
hs.get(TestAccessMode.setRelease).invokeExact(recv, 1L);
|
||||
long x = (long) hs.get(TestAccessMode.getAcquire).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET_RELEASE).invokeExact(recv, 1L);
|
||||
long x = (long) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(recv);
|
||||
assertEquals(x, 1L, "setRelease long value");
|
||||
}
|
||||
|
||||
// Opaque
|
||||
{
|
||||
hs.get(TestAccessMode.setOpaque).invokeExact(recv, 2L);
|
||||
long x = (long) hs.get(TestAccessMode.getOpaque).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET_OPAQUE).invokeExact(recv, 2L);
|
||||
long x = (long) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(recv);
|
||||
assertEquals(x, 2L, "setOpaque long value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.set).invokeExact(recv, 1L);
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 1L);
|
||||
|
||||
// Compare
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(recv, 1L, 2L);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, 1L, 2L);
|
||||
assertEquals(r, true, "success compareAndSet long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, 2L, "success compareAndSet long value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(recv, 1L, 3L);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, 1L, 3L);
|
||||
assertEquals(r, false, "failing compareAndSet long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, 2L, "failing compareAndSet long value");
|
||||
}
|
||||
|
||||
{
|
||||
long r = (long) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(recv, 2L, 1L);
|
||||
long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(recv, 2L, 1L);
|
||||
assertEquals(r, 2L, "success compareAndExchangeVolatile long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, 1L, "success compareAndExchangeVolatile long value");
|
||||
}
|
||||
|
||||
{
|
||||
long r = (long) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(recv, 2L, 3L);
|
||||
long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(recv, 2L, 3L);
|
||||
assertEquals(r, 1L, "failing compareAndExchangeVolatile long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, 1L, "failing compareAndExchangeVolatile long value");
|
||||
}
|
||||
|
||||
{
|
||||
long r = (long) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(recv, 1L, 2L);
|
||||
long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, 1L, 2L);
|
||||
assertEquals(r, 1L, "success compareAndExchangeAcquire long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, 2L, "success compareAndExchangeAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
long r = (long) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(recv, 1L, 3L);
|
||||
long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, 1L, 3L);
|
||||
assertEquals(r, 2L, "failing compareAndExchangeAcquire long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, 2L, "failing compareAndExchangeAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
long r = (long) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(recv, 2L, 1L);
|
||||
long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, 2L, 1L);
|
||||
assertEquals(r, 2L, "success compareAndExchangeRelease long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, 1L, "success compareAndExchangeRelease long value");
|
||||
}
|
||||
|
||||
{
|
||||
long r = (long) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(recv, 2L, 3L);
|
||||
long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, 2L, 3L);
|
||||
assertEquals(r, 1L, "failing compareAndExchangeRelease long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, 1L, "failing compareAndExchangeRelease long value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSet).invokeExact(recv, 1L, 2L);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 1L, 2L);
|
||||
assertEquals(r, true, "weakCompareAndSet long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, 2L, "weakCompareAndSet long value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetAcquire).invokeExact(recv, 2L, 1L);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, 2L, 1L);
|
||||
assertEquals(r, true, "weakCompareAndSetAcquire long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, 1L, "weakCompareAndSetAcquire long");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetRelease).invokeExact(recv, 1L, 2L);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, 1L, 2L);
|
||||
assertEquals(r, true, "weakCompareAndSetRelease long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, 2L, "weakCompareAndSetRelease long");
|
||||
}
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
long o = (long) hs.get(TestAccessMode.getAndSet).invokeExact(recv, 1L);
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_SET).invokeExact(recv, 1L);
|
||||
assertEquals(o, 2L, "getAndSet long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, 1L, "getAndSet long value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.set).invokeExact(recv, 1L);
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, 1L);
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
long o = (long) hs.get(TestAccessMode.getAndAdd).invokeExact(recv, 3L);
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, 3L);
|
||||
assertEquals(o, 1L, "getAndAdd long");
|
||||
long c = (long) hs.get(TestAccessMode.addAndGet).invokeExact(recv, 3L);
|
||||
long c = (long) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(recv, 3L);
|
||||
assertEquals(c, 1L + 3L + 3L, "getAndAdd long value");
|
||||
}
|
||||
}
|
||||
@ -255,128 +255,128 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
|
||||
static void testStaticField(Handles hs) throws Throwable {
|
||||
// Plain
|
||||
{
|
||||
hs.get(TestAccessMode.set).invokeExact(1L);
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact();
|
||||
hs.get(TestAccessMode.SET).invokeExact(1L);
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 1L, "set long value");
|
||||
}
|
||||
|
||||
|
||||
// Volatile
|
||||
{
|
||||
hs.get(TestAccessMode.setVolatile).invokeExact(2L);
|
||||
long x = (long) hs.get(TestAccessMode.getVolatile).invokeExact();
|
||||
hs.get(TestAccessMode.SET_VOLATILE).invokeExact(2L);
|
||||
long x = (long) hs.get(TestAccessMode.GET_VOLATILE).invokeExact();
|
||||
assertEquals(x, 2L, "setVolatile long value");
|
||||
}
|
||||
|
||||
// Lazy
|
||||
{
|
||||
hs.get(TestAccessMode.setRelease).invokeExact(1L);
|
||||
long x = (long) hs.get(TestAccessMode.getAcquire).invokeExact();
|
||||
hs.get(TestAccessMode.SET_RELEASE).invokeExact(1L);
|
||||
long x = (long) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact();
|
||||
assertEquals(x, 1L, "setRelease long value");
|
||||
}
|
||||
|
||||
// Opaque
|
||||
{
|
||||
hs.get(TestAccessMode.setOpaque).invokeExact(2L);
|
||||
long x = (long) hs.get(TestAccessMode.getOpaque).invokeExact();
|
||||
hs.get(TestAccessMode.SET_OPAQUE).invokeExact(2L);
|
||||
long x = (long) hs.get(TestAccessMode.GET_OPAQUE).invokeExact();
|
||||
assertEquals(x, 2L, "setOpaque long value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.set).invokeExact(1L);
|
||||
hs.get(TestAccessMode.SET).invokeExact(1L);
|
||||
|
||||
// Compare
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(1L, 2L);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(1L, 2L);
|
||||
assertEquals(r, true, "success compareAndSet long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact();
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 2L, "success compareAndSet long value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(1L, 3L);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(1L, 3L);
|
||||
assertEquals(r, false, "failing compareAndSet long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact();
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 2L, "failing compareAndSet long value");
|
||||
}
|
||||
|
||||
{
|
||||
long r = (long) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(2L, 1L);
|
||||
long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(2L, 1L);
|
||||
assertEquals(r, 2L, "success compareAndExchangeVolatile long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact();
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 1L, "success compareAndExchangeVolatile long value");
|
||||
}
|
||||
|
||||
{
|
||||
long r = (long) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(2L, 3L);
|
||||
long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(2L, 3L);
|
||||
assertEquals(r, 1L, "failing compareAndExchangeVolatile long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact();
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 1L, "failing compareAndExchangeVolatile long value");
|
||||
}
|
||||
|
||||
{
|
||||
long r = (long) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(1L, 2L);
|
||||
long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(1L, 2L);
|
||||
assertEquals(r, 1L, "success compareAndExchangeAcquire long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact();
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 2L, "success compareAndExchangeAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
long r = (long) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(1L, 3L);
|
||||
long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(1L, 3L);
|
||||
assertEquals(r, 2L, "failing compareAndExchangeAcquire long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact();
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 2L, "failing compareAndExchangeAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
long r = (long) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(2L, 1L);
|
||||
long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(2L, 1L);
|
||||
assertEquals(r, 2L, "success compareAndExchangeRelease long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact();
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 1L, "success compareAndExchangeRelease long value");
|
||||
}
|
||||
|
||||
{
|
||||
long r = (long) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(2L, 3L);
|
||||
long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(2L, 3L);
|
||||
assertEquals(r, 1L, "failing compareAndExchangeRelease long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact();
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 1L, "failing compareAndExchangeRelease long value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSet).invokeExact(1L, 2L);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(1L, 2L);
|
||||
assertEquals(r, true, "weakCompareAndSet long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact();
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 2L, "weakCompareAndSet long value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetAcquire).invokeExact(2L, 1L);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(2L, 1L);
|
||||
assertEquals(r, true, "weakCompareAndSetAcquire long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact();
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 1L, "weakCompareAndSetAcquire long");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetRelease).invokeExact( 1L, 2L);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact( 1L, 2L);
|
||||
assertEquals(r, true, "weakCompareAndSetRelease long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact();
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 2L, "weakCompareAndSetRelease long");
|
||||
}
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
long o = (long) hs.get(TestAccessMode.getAndSet).invokeExact( 1L);
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_SET).invokeExact( 1L);
|
||||
assertEquals(o, 2L, "getAndSet long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact();
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, 1L, "getAndSet long value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.set).invokeExact(1L);
|
||||
hs.get(TestAccessMode.SET).invokeExact(1L);
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
long o = (long) hs.get(TestAccessMode.getAndAdd).invokeExact( 3L);
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_ADD).invokeExact( 3L);
|
||||
assertEquals(o, 1L, "getAndAdd long");
|
||||
long c = (long) hs.get(TestAccessMode.addAndGet).invokeExact(3L);
|
||||
long c = (long) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(3L);
|
||||
assertEquals(c, 1L + 3L + 3L, "getAndAdd long value");
|
||||
}
|
||||
}
|
||||
@ -392,128 +392,128 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
// Plain
|
||||
{
|
||||
hs.get(TestAccessMode.set).invokeExact(array, i, 1L);
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 1L);
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 1L, "get long value");
|
||||
}
|
||||
|
||||
|
||||
// Volatile
|
||||
{
|
||||
hs.get(TestAccessMode.setVolatile).invokeExact(array, i, 2L);
|
||||
long x = (long) hs.get(TestAccessMode.getVolatile).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET_VOLATILE).invokeExact(array, i, 2L);
|
||||
long x = (long) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(array, i);
|
||||
assertEquals(x, 2L, "setVolatile long value");
|
||||
}
|
||||
|
||||
// Lazy
|
||||
{
|
||||
hs.get(TestAccessMode.setRelease).invokeExact(array, i, 1L);
|
||||
long x = (long) hs.get(TestAccessMode.getAcquire).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET_RELEASE).invokeExact(array, i, 1L);
|
||||
long x = (long) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(array, i);
|
||||
assertEquals(x, 1L, "setRelease long value");
|
||||
}
|
||||
|
||||
// Opaque
|
||||
{
|
||||
hs.get(TestAccessMode.setOpaque).invokeExact(array, i, 2L);
|
||||
long x = (long) hs.get(TestAccessMode.getOpaque).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET_OPAQUE).invokeExact(array, i, 2L);
|
||||
long x = (long) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(array, i);
|
||||
assertEquals(x, 2L, "setOpaque long value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.set).invokeExact(array, i, 1L);
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 1L);
|
||||
|
||||
// Compare
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(array, i, 1L, 2L);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, 1L, 2L);
|
||||
assertEquals(r, true, "success compareAndSet long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 2L, "success compareAndSet long value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(array, i, 1L, 3L);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, 1L, 3L);
|
||||
assertEquals(r, false, "failing compareAndSet long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 2L, "failing compareAndSet long value");
|
||||
}
|
||||
|
||||
{
|
||||
long r = (long) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(array, i, 2L, 1L);
|
||||
long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(array, i, 2L, 1L);
|
||||
assertEquals(r, 2L, "success compareAndExchangeVolatile long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 1L, "success compareAndExchangeVolatile long value");
|
||||
}
|
||||
|
||||
{
|
||||
long r = (long) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(array, i, 2L, 3L);
|
||||
long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(array, i, 2L, 3L);
|
||||
assertEquals(r, 1L, "failing compareAndExchangeVolatile long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 1L, "failing compareAndExchangeVolatile long value");
|
||||
}
|
||||
|
||||
{
|
||||
long r = (long) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(array, i, 1L, 2L);
|
||||
long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, 1L, 2L);
|
||||
assertEquals(r, 1L, "success compareAndExchangeAcquire long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 2L, "success compareAndExchangeAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
long r = (long) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(array, i, 1L, 3L);
|
||||
long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, 1L, 3L);
|
||||
assertEquals(r, 2L, "failing compareAndExchangeAcquire long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 2L, "failing compareAndExchangeAcquire long value");
|
||||
}
|
||||
|
||||
{
|
||||
long r = (long) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(array, i, 2L, 1L);
|
||||
long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, 2L, 1L);
|
||||
assertEquals(r, 2L, "success compareAndExchangeRelease long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 1L, "success compareAndExchangeRelease long value");
|
||||
}
|
||||
|
||||
{
|
||||
long r = (long) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(array, i, 2L, 3L);
|
||||
long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, 2L, 3L);
|
||||
assertEquals(r, 1L, "failing compareAndExchangeRelease long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 1L, "failing compareAndExchangeRelease long value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSet).invokeExact(array, i, 1L, 2L);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 1L, 2L);
|
||||
assertEquals(r, true, "weakCompareAndSet long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 2L, "weakCompareAndSet long value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetAcquire).invokeExact(array, i, 2L, 1L);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, 2L, 1L);
|
||||
assertEquals(r, true, "weakCompareAndSetAcquire long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 1L, "weakCompareAndSetAcquire long");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetRelease).invokeExact(array, i, 1L, 2L);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(array, i, 1L, 2L);
|
||||
assertEquals(r, true, "weakCompareAndSetRelease long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 2L, "weakCompareAndSetRelease long");
|
||||
}
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
long o = (long) hs.get(TestAccessMode.getAndSet).invokeExact(array, i, 1L);
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, 1L);
|
||||
assertEquals(o, 2L, "getAndSet long");
|
||||
long x = (long) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, 1L, "getAndSet long value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.set).invokeExact(array, i, 1L);
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, 1L);
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
long o = (long) hs.get(TestAccessMode.getAndAdd).invokeExact(array, i, 3L);
|
||||
long o = (long) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, 3L);
|
||||
assertEquals(o, 1L, "getAndAdd long");
|
||||
long c = (long) hs.get(TestAccessMode.addAndGet).invokeExact(array, i, 3L);
|
||||
long c = (long) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(array, i, 3L);
|
||||
assertEquals(c, 1L + 3L + 3L, "getAndAdd long value");
|
||||
}
|
||||
}
|
||||
@ -532,37 +532,37 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
|
||||
for (int i : new int[]{-1, Integer.MIN_VALUE, 10, 11, Integer.MAX_VALUE}) {
|
||||
final int ci = i;
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
|
||||
checkIOOBE(am, () -> {
|
||||
long x = (long) hs.get(am).invokeExact(array, ci);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
checkIOOBE(am, () -> {
|
||||
hs.get(am).invokeExact(array, ci, 1L);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
|
||||
checkIOOBE(am, () -> {
|
||||
boolean r = (boolean) hs.get(am).invokeExact(array, ci, 1L, 2L);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
|
||||
checkIOOBE(am, () -> {
|
||||
long r = (long) hs.get(am).invokeExact(array, ci, 2L, 1L);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
|
||||
checkIOOBE(am, () -> {
|
||||
long o = (long) hs.get(am).invokeExact(array, ci, 1L);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
|
||||
checkIOOBE(am, () -> {
|
||||
long o = (long) hs.get(am).invokeExact(array, ci, 3L);
|
||||
});
|
||||
|
@ -121,30 +121,30 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
|
||||
static void testInstanceField(VarHandleTestMethodHandleAccessShort recv, Handles hs) throws Throwable {
|
||||
// Plain
|
||||
{
|
||||
hs.get(TestAccessMode.set).invokeExact(recv, (short)1);
|
||||
short x = (short) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, (short)1);
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, (short)1, "set short value");
|
||||
}
|
||||
|
||||
|
||||
// Volatile
|
||||
{
|
||||
hs.get(TestAccessMode.setVolatile).invokeExact(recv, (short)2);
|
||||
short x = (short) hs.get(TestAccessMode.getVolatile).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET_VOLATILE).invokeExact(recv, (short)2);
|
||||
short x = (short) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(recv);
|
||||
assertEquals(x, (short)2, "setVolatile short value");
|
||||
}
|
||||
|
||||
// Lazy
|
||||
{
|
||||
hs.get(TestAccessMode.setRelease).invokeExact(recv, (short)1);
|
||||
short x = (short) hs.get(TestAccessMode.getAcquire).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET_RELEASE).invokeExact(recv, (short)1);
|
||||
short x = (short) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(recv);
|
||||
assertEquals(x, (short)1, "setRelease short value");
|
||||
}
|
||||
|
||||
// Opaque
|
||||
{
|
||||
hs.get(TestAccessMode.setOpaque).invokeExact(recv, (short)2);
|
||||
short x = (short) hs.get(TestAccessMode.getOpaque).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET_OPAQUE).invokeExact(recv, (short)2);
|
||||
short x = (short) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(recv);
|
||||
assertEquals(x, (short)2, "setOpaque short value");
|
||||
}
|
||||
|
||||
@ -152,25 +152,25 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
|
||||
}
|
||||
|
||||
static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessShort recv, Handles hs) throws Throwable {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
boolean r = (boolean) hs.get(am).invokeExact(recv, (short)1, (short)2);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
|
||||
checkUOE(am, () -> {
|
||||
short r = (short) hs.get(am).invokeExact(recv, (short)1, (short)2);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
short r = (short) hs.get(am).invokeExact(recv, (short)1);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
|
||||
checkUOE(am, () -> {
|
||||
short r = (short) hs.get(am).invokeExact(recv, (short)1);
|
||||
});
|
||||
@ -181,30 +181,30 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
|
||||
static void testStaticField(Handles hs) throws Throwable {
|
||||
// Plain
|
||||
{
|
||||
hs.get(TestAccessMode.set).invokeExact((short)1);
|
||||
short x = (short) hs.get(TestAccessMode.get).invokeExact();
|
||||
hs.get(TestAccessMode.SET).invokeExact((short)1);
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, (short)1, "set short value");
|
||||
}
|
||||
|
||||
|
||||
// Volatile
|
||||
{
|
||||
hs.get(TestAccessMode.setVolatile).invokeExact((short)2);
|
||||
short x = (short) hs.get(TestAccessMode.getVolatile).invokeExact();
|
||||
hs.get(TestAccessMode.SET_VOLATILE).invokeExact((short)2);
|
||||
short x = (short) hs.get(TestAccessMode.GET_VOLATILE).invokeExact();
|
||||
assertEquals(x, (short)2, "setVolatile short value");
|
||||
}
|
||||
|
||||
// Lazy
|
||||
{
|
||||
hs.get(TestAccessMode.setRelease).invokeExact((short)1);
|
||||
short x = (short) hs.get(TestAccessMode.getAcquire).invokeExact();
|
||||
hs.get(TestAccessMode.SET_RELEASE).invokeExact((short)1);
|
||||
short x = (short) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact();
|
||||
assertEquals(x, (short)1, "setRelease short value");
|
||||
}
|
||||
|
||||
// Opaque
|
||||
{
|
||||
hs.get(TestAccessMode.setOpaque).invokeExact((short)2);
|
||||
short x = (short) hs.get(TestAccessMode.getOpaque).invokeExact();
|
||||
hs.get(TestAccessMode.SET_OPAQUE).invokeExact((short)2);
|
||||
short x = (short) hs.get(TestAccessMode.GET_OPAQUE).invokeExact();
|
||||
assertEquals(x, (short)2, "setOpaque short value");
|
||||
}
|
||||
|
||||
@ -212,25 +212,25 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
|
||||
}
|
||||
|
||||
static void testStaticFieldUnsupported(Handles hs) throws Throwable {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
boolean r = (boolean) hs.get(am).invokeExact((short)1, (short)2);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
|
||||
checkUOE(am, () -> {
|
||||
short r = (short) hs.get(am).invokeExact((short)1, (short)2);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
short r = (short) hs.get(am).invokeExact((short)1);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
|
||||
checkUOE(am, () -> {
|
||||
short r = (short) hs.get(am).invokeExact((short)1);
|
||||
});
|
||||
@ -244,30 +244,30 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
// Plain
|
||||
{
|
||||
hs.get(TestAccessMode.set).invokeExact(array, i, (short)1);
|
||||
short x = (short) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, (short)1);
|
||||
short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, (short)1, "get short value");
|
||||
}
|
||||
|
||||
|
||||
// Volatile
|
||||
{
|
||||
hs.get(TestAccessMode.setVolatile).invokeExact(array, i, (short)2);
|
||||
short x = (short) hs.get(TestAccessMode.getVolatile).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET_VOLATILE).invokeExact(array, i, (short)2);
|
||||
short x = (short) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(array, i);
|
||||
assertEquals(x, (short)2, "setVolatile short value");
|
||||
}
|
||||
|
||||
// Lazy
|
||||
{
|
||||
hs.get(TestAccessMode.setRelease).invokeExact(array, i, (short)1);
|
||||
short x = (short) hs.get(TestAccessMode.getAcquire).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET_RELEASE).invokeExact(array, i, (short)1);
|
||||
short x = (short) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(array, i);
|
||||
assertEquals(x, (short)1, "setRelease short value");
|
||||
}
|
||||
|
||||
// Opaque
|
||||
{
|
||||
hs.get(TestAccessMode.setOpaque).invokeExact(array, i, (short)2);
|
||||
short x = (short) hs.get(TestAccessMode.getOpaque).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET_OPAQUE).invokeExact(array, i, (short)2);
|
||||
short x = (short) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(array, i);
|
||||
assertEquals(x, (short)2, "setOpaque short value");
|
||||
}
|
||||
|
||||
@ -279,25 +279,25 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
|
||||
short[] array = new short[10];
|
||||
|
||||
final int i = 0;
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
boolean r = (boolean) hs.get(am).invokeExact(array, i, (short)1, (short)2);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
|
||||
checkUOE(am, () -> {
|
||||
short r = (short) hs.get(am).invokeExact(array, i, (short)1, (short)2);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
short r = (short) hs.get(am).invokeExact(array, i, (short)1);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
|
||||
checkUOE(am, () -> {
|
||||
short o = (short) hs.get(am).invokeExact(array, i, (short)1);
|
||||
});
|
||||
@ -310,13 +310,13 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
|
||||
for (int i : new int[]{-1, Integer.MIN_VALUE, 10, 11, Integer.MAX_VALUE}) {
|
||||
final int ci = i;
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
|
||||
checkIOOBE(am, () -> {
|
||||
short x = (short) hs.get(am).invokeExact(array, ci);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
checkIOOBE(am, () -> {
|
||||
hs.get(am).invokeExact(array, ci, (short)1);
|
||||
});
|
||||
|
@ -121,118 +121,118 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
|
||||
static void testInstanceField(VarHandleTestMethodHandleAccessString recv, Handles hs) throws Throwable {
|
||||
// Plain
|
||||
{
|
||||
hs.get(TestAccessMode.set).invokeExact(recv, "foo");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, "foo");
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, "foo", "set String value");
|
||||
}
|
||||
|
||||
|
||||
// Volatile
|
||||
{
|
||||
hs.get(TestAccessMode.setVolatile).invokeExact(recv, "bar");
|
||||
String x = (String) hs.get(TestAccessMode.getVolatile).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET_VOLATILE).invokeExact(recv, "bar");
|
||||
String x = (String) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(recv);
|
||||
assertEquals(x, "bar", "setVolatile String value");
|
||||
}
|
||||
|
||||
// Lazy
|
||||
{
|
||||
hs.get(TestAccessMode.setRelease).invokeExact(recv, "foo");
|
||||
String x = (String) hs.get(TestAccessMode.getAcquire).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET_RELEASE).invokeExact(recv, "foo");
|
||||
String x = (String) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(recv);
|
||||
assertEquals(x, "foo", "setRelease String value");
|
||||
}
|
||||
|
||||
// Opaque
|
||||
{
|
||||
hs.get(TestAccessMode.setOpaque).invokeExact(recv, "bar");
|
||||
String x = (String) hs.get(TestAccessMode.getOpaque).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET_OPAQUE).invokeExact(recv, "bar");
|
||||
String x = (String) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(recv);
|
||||
assertEquals(x, "bar", "setOpaque String value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.set).invokeExact(recv, "foo");
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, "foo");
|
||||
|
||||
// Compare
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(recv, "foo", "bar");
|
||||
boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, "foo", "bar");
|
||||
assertEquals(r, true, "success compareAndSet String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, "bar", "success compareAndSet String value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(recv, "foo", "baz");
|
||||
boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, "foo", "baz");
|
||||
assertEquals(r, false, "failing compareAndSet String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, "bar", "failing compareAndSet String value");
|
||||
}
|
||||
|
||||
{
|
||||
String r = (String) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(recv, "bar", "foo");
|
||||
String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(recv, "bar", "foo");
|
||||
assertEquals(r, "bar", "success compareAndExchangeVolatile String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, "foo", "success compareAndExchangeVolatile String value");
|
||||
}
|
||||
|
||||
{
|
||||
String r = (String) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(recv, "bar", "baz");
|
||||
String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(recv, "bar", "baz");
|
||||
assertEquals(r, "foo", "failing compareAndExchangeVolatile String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, "foo", "failing compareAndExchangeVolatile String value");
|
||||
}
|
||||
|
||||
{
|
||||
String r = (String) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(recv, "foo", "bar");
|
||||
String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, "foo", "bar");
|
||||
assertEquals(r, "foo", "success compareAndExchangeAcquire String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, "bar", "success compareAndExchangeAcquire String value");
|
||||
}
|
||||
|
||||
{
|
||||
String r = (String) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(recv, "foo", "baz");
|
||||
String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, "foo", "baz");
|
||||
assertEquals(r, "bar", "failing compareAndExchangeAcquire String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, "bar", "failing compareAndExchangeAcquire String value");
|
||||
}
|
||||
|
||||
{
|
||||
String r = (String) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(recv, "bar", "foo");
|
||||
String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, "bar", "foo");
|
||||
assertEquals(r, "bar", "success compareAndExchangeRelease String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, "foo", "success compareAndExchangeRelease String value");
|
||||
}
|
||||
|
||||
{
|
||||
String r = (String) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(recv, "bar", "baz");
|
||||
String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, "bar", "baz");
|
||||
assertEquals(r, "foo", "failing compareAndExchangeRelease String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, "foo", "failing compareAndExchangeRelease String value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSet).invokeExact(recv, "foo", "bar");
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, "foo", "bar");
|
||||
assertEquals(r, true, "weakCompareAndSet String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, "bar", "weakCompareAndSet String value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetAcquire).invokeExact(recv, "bar", "foo");
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, "bar", "foo");
|
||||
assertEquals(r, true, "weakCompareAndSetAcquire String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, "foo", "weakCompareAndSetAcquire String");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetRelease).invokeExact(recv, "foo", "bar");
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, "foo", "bar");
|
||||
assertEquals(r, true, "weakCompareAndSetRelease String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, "bar", "weakCompareAndSetRelease String");
|
||||
}
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
String o = (String) hs.get(TestAccessMode.getAndSet).invokeExact(recv, "foo");
|
||||
String o = (String) hs.get(TestAccessMode.GET_AND_SET).invokeExact(recv, "foo");
|
||||
assertEquals(o, "bar", "getAndSet String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, "foo", "getAndSet String value");
|
||||
}
|
||||
|
||||
@ -240,7 +240,7 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
|
||||
|
||||
static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessString recv, Handles hs) throws Throwable {
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
|
||||
checkUOE(am, () -> {
|
||||
String r = (String) hs.get(am).invokeExact(recv, "foo");
|
||||
});
|
||||
@ -251,118 +251,118 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
|
||||
static void testStaticField(Handles hs) throws Throwable {
|
||||
// Plain
|
||||
{
|
||||
hs.get(TestAccessMode.set).invokeExact("foo");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact();
|
||||
hs.get(TestAccessMode.SET).invokeExact("foo");
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, "foo", "set String value");
|
||||
}
|
||||
|
||||
|
||||
// Volatile
|
||||
{
|
||||
hs.get(TestAccessMode.setVolatile).invokeExact("bar");
|
||||
String x = (String) hs.get(TestAccessMode.getVolatile).invokeExact();
|
||||
hs.get(TestAccessMode.SET_VOLATILE).invokeExact("bar");
|
||||
String x = (String) hs.get(TestAccessMode.GET_VOLATILE).invokeExact();
|
||||
assertEquals(x, "bar", "setVolatile String value");
|
||||
}
|
||||
|
||||
// Lazy
|
||||
{
|
||||
hs.get(TestAccessMode.setRelease).invokeExact("foo");
|
||||
String x = (String) hs.get(TestAccessMode.getAcquire).invokeExact();
|
||||
hs.get(TestAccessMode.SET_RELEASE).invokeExact("foo");
|
||||
String x = (String) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact();
|
||||
assertEquals(x, "foo", "setRelease String value");
|
||||
}
|
||||
|
||||
// Opaque
|
||||
{
|
||||
hs.get(TestAccessMode.setOpaque).invokeExact("bar");
|
||||
String x = (String) hs.get(TestAccessMode.getOpaque).invokeExact();
|
||||
hs.get(TestAccessMode.SET_OPAQUE).invokeExact("bar");
|
||||
String x = (String) hs.get(TestAccessMode.GET_OPAQUE).invokeExact();
|
||||
assertEquals(x, "bar", "setOpaque String value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.set).invokeExact("foo");
|
||||
hs.get(TestAccessMode.SET).invokeExact("foo");
|
||||
|
||||
// Compare
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact("foo", "bar");
|
||||
boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact("foo", "bar");
|
||||
assertEquals(r, true, "success compareAndSet String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact();
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, "bar", "success compareAndSet String value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact("foo", "baz");
|
||||
boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact("foo", "baz");
|
||||
assertEquals(r, false, "failing compareAndSet String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact();
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, "bar", "failing compareAndSet String value");
|
||||
}
|
||||
|
||||
{
|
||||
String r = (String) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact("bar", "foo");
|
||||
String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact("bar", "foo");
|
||||
assertEquals(r, "bar", "success compareAndExchangeVolatile String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact();
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, "foo", "success compareAndExchangeVolatile String value");
|
||||
}
|
||||
|
||||
{
|
||||
String r = (String) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact("bar", "baz");
|
||||
String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact("bar", "baz");
|
||||
assertEquals(r, "foo", "failing compareAndExchangeVolatile String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact();
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, "foo", "failing compareAndExchangeVolatile String value");
|
||||
}
|
||||
|
||||
{
|
||||
String r = (String) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact("foo", "bar");
|
||||
String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact("foo", "bar");
|
||||
assertEquals(r, "foo", "success compareAndExchangeAcquire String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact();
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, "bar", "success compareAndExchangeAcquire String value");
|
||||
}
|
||||
|
||||
{
|
||||
String r = (String) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact("foo", "baz");
|
||||
String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact("foo", "baz");
|
||||
assertEquals(r, "bar", "failing compareAndExchangeAcquire String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact();
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, "bar", "failing compareAndExchangeAcquire String value");
|
||||
}
|
||||
|
||||
{
|
||||
String r = (String) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact("bar", "foo");
|
||||
String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact("bar", "foo");
|
||||
assertEquals(r, "bar", "success compareAndExchangeRelease String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact();
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, "foo", "success compareAndExchangeRelease String value");
|
||||
}
|
||||
|
||||
{
|
||||
String r = (String) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact("bar", "baz");
|
||||
String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact("bar", "baz");
|
||||
assertEquals(r, "foo", "failing compareAndExchangeRelease String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact();
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, "foo", "failing compareAndExchangeRelease String value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSet).invokeExact("foo", "bar");
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact("foo", "bar");
|
||||
assertEquals(r, true, "weakCompareAndSet String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact();
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, "bar", "weakCompareAndSet String value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetAcquire).invokeExact("bar", "foo");
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact("bar", "foo");
|
||||
assertEquals(r, true, "weakCompareAndSetAcquire String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact();
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, "foo", "weakCompareAndSetAcquire String");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetRelease).invokeExact( "foo", "bar");
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact( "foo", "bar");
|
||||
assertEquals(r, true, "weakCompareAndSetRelease String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact();
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, "bar", "weakCompareAndSetRelease String");
|
||||
}
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
String o = (String) hs.get(TestAccessMode.getAndSet).invokeExact( "foo");
|
||||
String o = (String) hs.get(TestAccessMode.GET_AND_SET).invokeExact( "foo");
|
||||
assertEquals(o, "bar", "getAndSet String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact();
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, "foo", "getAndSet String value");
|
||||
}
|
||||
|
||||
@ -370,7 +370,7 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
|
||||
|
||||
static void testStaticFieldUnsupported(Handles hs) throws Throwable {
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
|
||||
checkUOE(am, () -> {
|
||||
String r = (String) hs.get(am).invokeExact("foo");
|
||||
});
|
||||
@ -384,118 +384,118 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
// Plain
|
||||
{
|
||||
hs.get(TestAccessMode.set).invokeExact(array, i, "foo");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, "foo");
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, "foo", "get String value");
|
||||
}
|
||||
|
||||
|
||||
// Volatile
|
||||
{
|
||||
hs.get(TestAccessMode.setVolatile).invokeExact(array, i, "bar");
|
||||
String x = (String) hs.get(TestAccessMode.getVolatile).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET_VOLATILE).invokeExact(array, i, "bar");
|
||||
String x = (String) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(array, i);
|
||||
assertEquals(x, "bar", "setVolatile String value");
|
||||
}
|
||||
|
||||
// Lazy
|
||||
{
|
||||
hs.get(TestAccessMode.setRelease).invokeExact(array, i, "foo");
|
||||
String x = (String) hs.get(TestAccessMode.getAcquire).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET_RELEASE).invokeExact(array, i, "foo");
|
||||
String x = (String) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(array, i);
|
||||
assertEquals(x, "foo", "setRelease String value");
|
||||
}
|
||||
|
||||
// Opaque
|
||||
{
|
||||
hs.get(TestAccessMode.setOpaque).invokeExact(array, i, "bar");
|
||||
String x = (String) hs.get(TestAccessMode.getOpaque).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET_OPAQUE).invokeExact(array, i, "bar");
|
||||
String x = (String) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(array, i);
|
||||
assertEquals(x, "bar", "setOpaque String value");
|
||||
}
|
||||
|
||||
hs.get(TestAccessMode.set).invokeExact(array, i, "foo");
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, "foo");
|
||||
|
||||
// Compare
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(array, i, "foo", "bar");
|
||||
boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, "foo", "bar");
|
||||
assertEquals(r, true, "success compareAndSet String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, "bar", "success compareAndSet String value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(array, i, "foo", "baz");
|
||||
boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, "foo", "baz");
|
||||
assertEquals(r, false, "failing compareAndSet String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, "bar", "failing compareAndSet String value");
|
||||
}
|
||||
|
||||
{
|
||||
String r = (String) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(array, i, "bar", "foo");
|
||||
String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(array, i, "bar", "foo");
|
||||
assertEquals(r, "bar", "success compareAndExchangeVolatile String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, "foo", "success compareAndExchangeVolatile String value");
|
||||
}
|
||||
|
||||
{
|
||||
String r = (String) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(array, i, "bar", "baz");
|
||||
String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(array, i, "bar", "baz");
|
||||
assertEquals(r, "foo", "failing compareAndExchangeVolatile String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, "foo", "failing compareAndExchangeVolatile String value");
|
||||
}
|
||||
|
||||
{
|
||||
String r = (String) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(array, i, "foo", "bar");
|
||||
String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, "foo", "bar");
|
||||
assertEquals(r, "foo", "success compareAndExchangeAcquire String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, "bar", "success compareAndExchangeAcquire String value");
|
||||
}
|
||||
|
||||
{
|
||||
String r = (String) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(array, i, "foo", "baz");
|
||||
String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, "foo", "baz");
|
||||
assertEquals(r, "bar", "failing compareAndExchangeAcquire String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, "bar", "failing compareAndExchangeAcquire String value");
|
||||
}
|
||||
|
||||
{
|
||||
String r = (String) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(array, i, "bar", "foo");
|
||||
String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, "bar", "foo");
|
||||
assertEquals(r, "bar", "success compareAndExchangeRelease String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, "foo", "success compareAndExchangeRelease String value");
|
||||
}
|
||||
|
||||
{
|
||||
String r = (String) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(array, i, "bar", "baz");
|
||||
String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, "bar", "baz");
|
||||
assertEquals(r, "foo", "failing compareAndExchangeRelease String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, "foo", "failing compareAndExchangeRelease String value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSet).invokeExact(array, i, "foo", "bar");
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, "foo", "bar");
|
||||
assertEquals(r, true, "weakCompareAndSet String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, "bar", "weakCompareAndSet String value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetAcquire).invokeExact(array, i, "bar", "foo");
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, "bar", "foo");
|
||||
assertEquals(r, true, "weakCompareAndSetAcquire String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, "foo", "weakCompareAndSetAcquire String");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetRelease).invokeExact(array, i, "foo", "bar");
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(array, i, "foo", "bar");
|
||||
assertEquals(r, true, "weakCompareAndSetRelease String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, "bar", "weakCompareAndSetRelease String");
|
||||
}
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
String o = (String) hs.get(TestAccessMode.getAndSet).invokeExact(array, i, "foo");
|
||||
String o = (String) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, "foo");
|
||||
assertEquals(o, "bar", "getAndSet String");
|
||||
String x = (String) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, "foo", "getAndSet String value");
|
||||
}
|
||||
|
||||
@ -507,7 +507,7 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
|
||||
|
||||
final int i = 0;
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
|
||||
checkUOE(am, () -> {
|
||||
String o = (String) hs.get(am).invokeExact(array, i, "foo");
|
||||
});
|
||||
@ -520,31 +520,31 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
|
||||
for (int i : new int[]{-1, Integer.MIN_VALUE, 10, 11, Integer.MAX_VALUE}) {
|
||||
final int ci = i;
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
|
||||
checkIOOBE(am, () -> {
|
||||
String x = (String) hs.get(am).invokeExact(array, ci);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
checkIOOBE(am, () -> {
|
||||
hs.get(am).invokeExact(array, ci, "foo");
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
|
||||
checkIOOBE(am, () -> {
|
||||
boolean r = (boolean) hs.get(am).invokeExact(array, ci, "foo", "bar");
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
|
||||
checkIOOBE(am, () -> {
|
||||
String r = (String) hs.get(am).invokeExact(array, ci, "bar", "foo");
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
|
||||
checkIOOBE(am, () -> {
|
||||
String o = (String) hs.get(am).invokeExact(array, ci, "foo");
|
||||
});
|
||||
|
@ -326,7 +326,7 @@ public class VarHandleTestMethodTypeBoolean extends VarHandleBaseTest {
|
||||
}
|
||||
|
||||
static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeBoolean recv, Handles hs) throws Throwable {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null receiver
|
||||
boolean x = (boolean) hs.get(am, methodType(boolean.class, Void.class)).
|
||||
@ -360,7 +360,7 @@ public class VarHandleTestMethodTypeBoolean extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null receiver
|
||||
hs.get(am, methodType(void.class, Void.class, boolean.class)).
|
||||
@ -509,7 +509,7 @@ public class VarHandleTestMethodTypeBoolean extends VarHandleBaseTest {
|
||||
static void testStaticFieldWrongMethodType(Handles hs) throws Throwable {
|
||||
int i = 0;
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
|
||||
// Incorrect return type
|
||||
checkWMTE(() -> { // reference class
|
||||
Void x = (Void) hs.get(am, methodType(Void.class)).
|
||||
@ -526,7 +526,7 @@ public class VarHandleTestMethodTypeBoolean extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
checkWMTE(() -> { // value reference class
|
||||
hs.get(am, methodType(void.class, Class.class)).
|
||||
invoke(Void.class);
|
||||
@ -780,7 +780,7 @@ public class VarHandleTestMethodTypeBoolean extends VarHandleBaseTest {
|
||||
boolean[] array = new boolean[10];
|
||||
Arrays.fill(array, true);
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
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)).
|
||||
@ -818,7 +818,7 @@ public class VarHandleTestMethodTypeBoolean extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null array
|
||||
hs.get(am, methodType(void.class, Void.class, int.class, boolean.class)).
|
||||
|
@ -326,7 +326,7 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest {
|
||||
}
|
||||
|
||||
static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeByte recv, Handles hs) throws Throwable {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null receiver
|
||||
byte x = (byte) hs.get(am, methodType(byte.class, Void.class)).
|
||||
@ -360,7 +360,7 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null receiver
|
||||
hs.get(am, methodType(void.class, Void.class, byte.class)).
|
||||
@ -509,7 +509,7 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest {
|
||||
static void testStaticFieldWrongMethodType(Handles hs) throws Throwable {
|
||||
int i = 0;
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
|
||||
// Incorrect return type
|
||||
checkWMTE(() -> { // reference class
|
||||
Void x = (Void) hs.get(am, methodType(Void.class)).
|
||||
@ -526,7 +526,7 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
checkWMTE(() -> { // value reference class
|
||||
hs.get(am, methodType(void.class, Class.class)).
|
||||
invoke(Void.class);
|
||||
@ -780,7 +780,7 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest {
|
||||
byte[] array = new byte[10];
|
||||
Arrays.fill(array, (byte)1);
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
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)).
|
||||
@ -818,7 +818,7 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null array
|
||||
hs.get(am, methodType(void.class, Void.class, int.class, byte.class)).
|
||||
|
@ -326,7 +326,7 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest {
|
||||
}
|
||||
|
||||
static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeChar recv, Handles hs) throws Throwable {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null receiver
|
||||
char x = (char) hs.get(am, methodType(char.class, Void.class)).
|
||||
@ -360,7 +360,7 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null receiver
|
||||
hs.get(am, methodType(void.class, Void.class, char.class)).
|
||||
@ -509,7 +509,7 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest {
|
||||
static void testStaticFieldWrongMethodType(Handles hs) throws Throwable {
|
||||
int i = 0;
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
|
||||
// Incorrect return type
|
||||
checkWMTE(() -> { // reference class
|
||||
Void x = (Void) hs.get(am, methodType(Void.class)).
|
||||
@ -526,7 +526,7 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
checkWMTE(() -> { // value reference class
|
||||
hs.get(am, methodType(void.class, Class.class)).
|
||||
invoke(Void.class);
|
||||
@ -780,7 +780,7 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest {
|
||||
char[] array = new char[10];
|
||||
Arrays.fill(array, 'a');
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
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)).
|
||||
@ -818,7 +818,7 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null array
|
||||
hs.get(am, methodType(void.class, Void.class, int.class, char.class)).
|
||||
|
@ -326,7 +326,7 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest {
|
||||
}
|
||||
|
||||
static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeDouble recv, Handles hs) throws Throwable {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null receiver
|
||||
double x = (double) hs.get(am, methodType(double.class, Void.class)).
|
||||
@ -360,7 +360,7 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null receiver
|
||||
hs.get(am, methodType(void.class, Void.class, double.class)).
|
||||
@ -509,7 +509,7 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest {
|
||||
static void testStaticFieldWrongMethodType(Handles hs) throws Throwable {
|
||||
int i = 0;
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
|
||||
// Incorrect return type
|
||||
checkWMTE(() -> { // reference class
|
||||
Void x = (Void) hs.get(am, methodType(Void.class)).
|
||||
@ -526,7 +526,7 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
checkWMTE(() -> { // value reference class
|
||||
hs.get(am, methodType(void.class, Class.class)).
|
||||
invoke(Void.class);
|
||||
@ -780,7 +780,7 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest {
|
||||
double[] array = new double[10];
|
||||
Arrays.fill(array, 1.0d);
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
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)).
|
||||
@ -818,7 +818,7 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null array
|
||||
hs.get(am, methodType(void.class, Void.class, int.class, double.class)).
|
||||
|
@ -326,7 +326,7 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest {
|
||||
}
|
||||
|
||||
static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeFloat recv, Handles hs) throws Throwable {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null receiver
|
||||
float x = (float) hs.get(am, methodType(float.class, Void.class)).
|
||||
@ -360,7 +360,7 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null receiver
|
||||
hs.get(am, methodType(void.class, Void.class, float.class)).
|
||||
@ -509,7 +509,7 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest {
|
||||
static void testStaticFieldWrongMethodType(Handles hs) throws Throwable {
|
||||
int i = 0;
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
|
||||
// Incorrect return type
|
||||
checkWMTE(() -> { // reference class
|
||||
Void x = (Void) hs.get(am, methodType(Void.class)).
|
||||
@ -526,7 +526,7 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
checkWMTE(() -> { // value reference class
|
||||
hs.get(am, methodType(void.class, Class.class)).
|
||||
invoke(Void.class);
|
||||
@ -780,7 +780,7 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest {
|
||||
float[] array = new float[10];
|
||||
Arrays.fill(array, 1.0f);
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
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)).
|
||||
@ -818,7 +818,7 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null array
|
||||
hs.get(am, methodType(void.class, Void.class, int.class, float.class)).
|
||||
|
@ -615,7 +615,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
|
||||
}
|
||||
|
||||
static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeInt recv, Handles hs) throws Throwable {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null receiver
|
||||
int x = (int) hs.get(am, methodType(int.class, Void.class)).
|
||||
@ -649,7 +649,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null receiver
|
||||
hs.get(am, methodType(void.class, Void.class, int.class)).
|
||||
@ -678,7 +678,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
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)).
|
||||
@ -711,7 +711,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
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);
|
||||
@ -752,7 +752,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
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);
|
||||
@ -789,7 +789,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
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);
|
||||
@ -1143,7 +1143,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
|
||||
static void testStaticFieldWrongMethodType(Handles hs) throws Throwable {
|
||||
int i = 0;
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
|
||||
// Incorrect return type
|
||||
checkWMTE(() -> { // reference class
|
||||
Void x = (Void) hs.get(am, methodType(Void.class)).
|
||||
@ -1160,7 +1160,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
checkWMTE(() -> { // value reference class
|
||||
hs.get(am, methodType(void.class, Class.class)).
|
||||
invoke(Void.class);
|
||||
@ -1175,7 +1175,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
|
||||
invoke(1, Void.class);
|
||||
});
|
||||
}
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
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)).
|
||||
@ -1196,7 +1196,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
|
||||
// Incorrect argument types
|
||||
checkWMTE(() -> { // expected reference class
|
||||
int x = (int) hs.get(am, methodType(int.class, Class.class, int.class)).
|
||||
@ -1226,7 +1226,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
|
||||
// Incorrect argument types
|
||||
checkWMTE(() -> { // value reference class
|
||||
int x = (int) hs.get(am, methodType(int.class, Class.class)).
|
||||
@ -1252,7 +1252,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
|
||||
// Incorrect argument types
|
||||
checkWMTE(() -> { // value reference class
|
||||
int x = (int) hs.get(am, methodType(int.class, Class.class)).
|
||||
@ -1834,7 +1834,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
|
||||
int[] array = new int[10];
|
||||
Arrays.fill(array, 1);
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
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)).
|
||||
@ -1872,7 +1872,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null array
|
||||
hs.get(am, methodType(void.class, Void.class, int.class, int.class)).
|
||||
@ -1904,7 +1904,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
|
||||
invoke(array, 0, 1, Void.class);
|
||||
});
|
||||
}
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
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)).
|
||||
@ -1941,7 +1941,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
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)).
|
||||
@ -1987,7 +1987,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
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)).
|
||||
@ -2029,7 +2029,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
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)).
|
||||
|
@ -615,7 +615,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
|
||||
}
|
||||
|
||||
static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeLong recv, Handles hs) throws Throwable {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null receiver
|
||||
long x = (long) hs.get(am, methodType(long.class, Void.class)).
|
||||
@ -649,7 +649,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null receiver
|
||||
hs.get(am, methodType(void.class, Void.class, long.class)).
|
||||
@ -678,7 +678,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
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)).
|
||||
@ -711,7 +711,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
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);
|
||||
@ -752,7 +752,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
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);
|
||||
@ -789,7 +789,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
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);
|
||||
@ -1143,7 +1143,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
|
||||
static void testStaticFieldWrongMethodType(Handles hs) throws Throwable {
|
||||
int i = 0;
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
|
||||
// Incorrect return type
|
||||
checkWMTE(() -> { // reference class
|
||||
Void x = (Void) hs.get(am, methodType(Void.class)).
|
||||
@ -1160,7 +1160,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
checkWMTE(() -> { // value reference class
|
||||
hs.get(am, methodType(void.class, Class.class)).
|
||||
invoke(Void.class);
|
||||
@ -1175,7 +1175,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
|
||||
invoke(1L, Void.class);
|
||||
});
|
||||
}
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
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)).
|
||||
@ -1196,7 +1196,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
|
||||
// Incorrect argument types
|
||||
checkWMTE(() -> { // expected reference class
|
||||
long x = (long) hs.get(am, methodType(long.class, Class.class, long.class)).
|
||||
@ -1226,7 +1226,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
|
||||
// Incorrect argument types
|
||||
checkWMTE(() -> { // value reference class
|
||||
long x = (long) hs.get(am, methodType(long.class, Class.class)).
|
||||
@ -1252,7 +1252,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
|
||||
// Incorrect argument types
|
||||
checkWMTE(() -> { // value reference class
|
||||
long x = (long) hs.get(am, methodType(long.class, Class.class)).
|
||||
@ -1834,7 +1834,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
|
||||
long[] array = new long[10];
|
||||
Arrays.fill(array, 1L);
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
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)).
|
||||
@ -1872,7 +1872,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null array
|
||||
hs.get(am, methodType(void.class, Void.class, int.class, long.class)).
|
||||
@ -1904,7 +1904,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
|
||||
invoke(array, 0, 1L, Void.class);
|
||||
});
|
||||
}
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
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)).
|
||||
@ -1941,7 +1941,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
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)).
|
||||
@ -1987,7 +1987,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
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)).
|
||||
@ -2029,7 +2029,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
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)).
|
||||
|
@ -326,7 +326,7 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest {
|
||||
}
|
||||
|
||||
static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeShort recv, Handles hs) throws Throwable {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null receiver
|
||||
short x = (short) hs.get(am, methodType(short.class, Void.class)).
|
||||
@ -360,7 +360,7 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null receiver
|
||||
hs.get(am, methodType(void.class, Void.class, short.class)).
|
||||
@ -509,7 +509,7 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest {
|
||||
static void testStaticFieldWrongMethodType(Handles hs) throws Throwable {
|
||||
int i = 0;
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
|
||||
// Incorrect return type
|
||||
checkWMTE(() -> { // reference class
|
||||
Void x = (Void) hs.get(am, methodType(Void.class)).
|
||||
@ -526,7 +526,7 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
checkWMTE(() -> { // value reference class
|
||||
hs.get(am, methodType(void.class, Class.class)).
|
||||
invoke(Void.class);
|
||||
@ -780,7 +780,7 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest {
|
||||
short[] array = new short[10];
|
||||
Arrays.fill(array, (short)1);
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
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)).
|
||||
@ -818,7 +818,7 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null array
|
||||
hs.get(am, methodType(void.class, Void.class, int.class, short.class)).
|
||||
|
@ -557,7 +557,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
|
||||
}
|
||||
|
||||
static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeString recv, Handles hs) throws Throwable {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null receiver
|
||||
String x = (String) hs.get(am, methodType(String.class, Void.class)).
|
||||
@ -591,7 +591,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null receiver
|
||||
hs.get(am, methodType(void.class, Void.class, String.class)).
|
||||
@ -620,7 +620,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
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)).
|
||||
@ -653,7 +653,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
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");
|
||||
@ -694,7 +694,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
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");
|
||||
@ -1009,7 +1009,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
|
||||
static void testStaticFieldWrongMethodType(Handles hs) throws Throwable {
|
||||
int i = 0;
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
|
||||
// Incorrect return type
|
||||
checkCCE(() -> { // reference class
|
||||
Void x = (Void) hs.get(am, methodType(Void.class)).
|
||||
@ -1026,7 +1026,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
checkCCE(() -> { // value reference class
|
||||
hs.get(am, methodType(void.class, Class.class)).
|
||||
invoke(Void.class);
|
||||
@ -1041,7 +1041,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
|
||||
invoke("foo", Void.class);
|
||||
});
|
||||
}
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
|
||||
// Incorrect argument types
|
||||
checkCCE(() -> { // expected reference class
|
||||
boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, String.class)).
|
||||
@ -1062,7 +1062,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
|
||||
// Incorrect argument types
|
||||
checkCCE(() -> { // expected reference class
|
||||
String x = (String) hs.get(am, methodType(String.class, Class.class, String.class)).
|
||||
@ -1092,7 +1092,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
|
||||
// Incorrect argument types
|
||||
checkCCE(() -> { // value reference class
|
||||
String x = (String) hs.get(am, methodType(String.class, Class.class)).
|
||||
@ -1611,7 +1611,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
|
||||
String[] array = new String[10];
|
||||
Arrays.fill(array, "foo");
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
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)).
|
||||
@ -1649,7 +1649,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null array
|
||||
hs.get(am, methodType(void.class, Void.class, int.class, String.class)).
|
||||
@ -1681,7 +1681,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
|
||||
invoke(array, 0, "foo", Void.class);
|
||||
});
|
||||
}
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
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)).
|
||||
@ -1718,7 +1718,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
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)).
|
||||
@ -1764,7 +1764,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
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)).
|
||||
|
@ -57,7 +57,7 @@ public class VarHandleTestReflection extends VarHandleBaseTest {
|
||||
|
||||
// Try a reflective invoke using a Method
|
||||
|
||||
Method vhm = VarHandle.class.getMethod(accessMode.name(), Object[].class);
|
||||
Method vhm = VarHandle.class.getMethod(accessMode.methodName(), Object[].class);
|
||||
vhm.invoke(v, new Object[]{});
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ public class VarHandleTestReflection extends VarHandleBaseTest {
|
||||
// Try a reflective invoke using a MethodHandle
|
||||
|
||||
MethodHandle mh = MethodHandles.lookup().unreflect(
|
||||
VarHandle.class.getMethod(accessMode.name(), Object[].class));
|
||||
VarHandle.class.getMethod(accessMode.methodName(), Object[].class));
|
||||
// Use invoke to avoid WrongMethodTypeException for
|
||||
// non-signature-polymorphic return types
|
||||
Object o = (Object) mh.invoke(v, new Object[]{});
|
||||
@ -82,7 +82,7 @@ public class VarHandleTestReflection extends VarHandleBaseTest {
|
||||
// a MethodHandle
|
||||
|
||||
MethodHandle mh = MethodHandles.lookup().unreflect(
|
||||
VarHandle.class.getMethod(accessMode.name(), Object[].class));
|
||||
VarHandle.class.getMethod(accessMode.methodName(), Object[].class));
|
||||
MethodHandleInfo info = MethodHandles.lookup().revealDirect(mh);
|
||||
Method im = info.reflectAs(Method.class, MethodHandles.lookup());
|
||||
im.invoke(v, new Object[]{});
|
||||
@ -105,7 +105,7 @@ public class VarHandleTestReflection extends VarHandleBaseTest {
|
||||
VarHandle v = handle();
|
||||
|
||||
MethodHandle mh = MethodHandles.publicLookup().findVirtual(
|
||||
VarHandle.class, accessMode.name(), v.accessModeType(accessMode));
|
||||
VarHandle.class, accessMode.methodName(), v.accessModeType(accessMode));
|
||||
|
||||
MethodHandleInfo info = MethodHandles.lookup().revealDirect(mh);
|
||||
|
||||
|
@ -90,43 +90,41 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
|
||||
|
||||
@Test(dataProvider = "varHandlesProvider")
|
||||
public void testIsAccessModeSupported(VarHandle vh) {
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.get));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.set));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getOpaque));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setOpaque));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
|
||||
|
||||
#if[CAS]
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
#else[CAS]
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
#end[CAS]
|
||||
|
||||
#if[AtomicAdd]
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
#else[AtomicAdd]
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
#end[AtomicAdd]
|
||||
}
|
||||
|
||||
|
@ -76,44 +76,42 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
|
||||
public void testIsAccessModeSupported(VarHandleSource vhs) {
|
||||
VarHandle vh = vhs.s;
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.get));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.set));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
|
||||
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getOpaque));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setOpaque));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
|
||||
|
||||
#if[CAS]
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
#else[CAS]
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
|
||||
#end[CAS]
|
||||
|
||||
#if[AtomicAdd]
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
#else[AtomicAdd]
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
|
||||
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
|
||||
#end[AtomicAdd]
|
||||
}
|
||||
|
||||
|
@ -121,131 +121,131 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
|
||||
static void testInstanceField(VarHandleTestMethodHandleAccess$Type$ recv, Handles hs) throws Throwable {
|
||||
// Plain
|
||||
{
|
||||
hs.get(TestAccessMode.set).invokeExact(recv, $value1$);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, $value1$);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, $value1$, "set $type$ value");
|
||||
}
|
||||
|
||||
|
||||
// Volatile
|
||||
{
|
||||
hs.get(TestAccessMode.setVolatile).invokeExact(recv, $value2$);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.getVolatile).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET_VOLATILE).invokeExact(recv, $value2$);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(recv);
|
||||
assertEquals(x, $value2$, "setVolatile $type$ value");
|
||||
}
|
||||
|
||||
// Lazy
|
||||
{
|
||||
hs.get(TestAccessMode.setRelease).invokeExact(recv, $value1$);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.getAcquire).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET_RELEASE).invokeExact(recv, $value1$);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(recv);
|
||||
assertEquals(x, $value1$, "setRelease $type$ value");
|
||||
}
|
||||
|
||||
// Opaque
|
||||
{
|
||||
hs.get(TestAccessMode.setOpaque).invokeExact(recv, $value2$);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.getOpaque).invokeExact(recv);
|
||||
hs.get(TestAccessMode.SET_OPAQUE).invokeExact(recv, $value2$);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(recv);
|
||||
assertEquals(x, $value2$, "setOpaque $type$ value");
|
||||
}
|
||||
|
||||
#if[CAS]
|
||||
hs.get(TestAccessMode.set).invokeExact(recv, $value1$);
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, $value1$);
|
||||
|
||||
// Compare
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(recv, $value1$, $value2$);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, $value1$, $value2$);
|
||||
assertEquals(r, true, "success compareAndSet $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, $value2$, "success compareAndSet $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(recv, $value1$, $value3$);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, $value1$, $value3$);
|
||||
assertEquals(r, false, "failing compareAndSet $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, $value2$, "failing compareAndSet $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(recv, $value2$, $value1$);
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(recv, $value2$, $value1$);
|
||||
assertEquals(r, $value2$, "success compareAndExchangeVolatile $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, $value1$, "success compareAndExchangeVolatile $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(recv, $value2$, $value3$);
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(recv, $value2$, $value3$);
|
||||
assertEquals(r, $value1$, "failing compareAndExchangeVolatile $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, $value1$, "failing compareAndExchangeVolatile $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(recv, $value1$, $value2$);
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, $value1$, $value2$);
|
||||
assertEquals(r, $value1$, "success compareAndExchangeAcquire $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, $value2$, "success compareAndExchangeAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(recv, $value1$, $value3$);
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, $value1$, $value3$);
|
||||
assertEquals(r, $value2$, "failing compareAndExchangeAcquire $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, $value2$, "failing compareAndExchangeAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(recv, $value2$, $value1$);
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, $value2$, $value1$);
|
||||
assertEquals(r, $value2$, "success compareAndExchangeRelease $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, $value1$, "success compareAndExchangeRelease $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(recv, $value2$, $value3$);
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, $value2$, $value3$);
|
||||
assertEquals(r, $value1$, "failing compareAndExchangeRelease $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, $value1$, "failing compareAndExchangeRelease $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSet).invokeExact(recv, $value1$, $value2$);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, $value1$, $value2$);
|
||||
assertEquals(r, true, "weakCompareAndSet $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, $value2$, "weakCompareAndSet $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetAcquire).invokeExact(recv, $value2$, $value1$);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, $value2$, $value1$);
|
||||
assertEquals(r, true, "weakCompareAndSetAcquire $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, $value1$, "weakCompareAndSetAcquire $type$");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetRelease).invokeExact(recv, $value1$, $value2$);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, $value1$, $value2$);
|
||||
assertEquals(r, true, "weakCompareAndSetRelease $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, $value2$, "weakCompareAndSetRelease $type$");
|
||||
}
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.getAndSet).invokeExact(recv, $value1$);
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET).invokeExact(recv, $value1$);
|
||||
assertEquals(o, $value2$, "getAndSet $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(recv);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
|
||||
assertEquals(x, $value1$, "getAndSet $type$ value");
|
||||
}
|
||||
#end[CAS]
|
||||
|
||||
#if[AtomicAdd]
|
||||
hs.get(TestAccessMode.set).invokeExact(recv, $value1$);
|
||||
hs.get(TestAccessMode.SET).invokeExact(recv, $value1$);
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.getAndAdd).invokeExact(recv, $value3$);
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, $value3$);
|
||||
assertEquals(o, $value1$, "getAndAdd $type$");
|
||||
$type$ c = ($type$) hs.get(TestAccessMode.addAndGet).invokeExact(recv, $value3$);
|
||||
$type$ c = ($type$) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(recv, $value3$);
|
||||
assertEquals(c, $value1$ + $value3$ + $value3$, "getAndAdd $type$ value");
|
||||
}
|
||||
#end[AtomicAdd]
|
||||
@ -253,19 +253,19 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
|
||||
|
||||
static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccess$Type$ recv, Handles hs) throws Throwable {
|
||||
#if[!CAS]
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
boolean r = (boolean) hs.get(am).invokeExact(recv, $value1$, $value2$);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
|
||||
checkUOE(am, () -> {
|
||||
$type$ r = ($type$) hs.get(am).invokeExact(recv, $value1$, $value2$);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
$type$ r = ($type$) hs.get(am).invokeExact(recv, $value1$);
|
||||
});
|
||||
@ -273,7 +273,7 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
|
||||
#end[CAS]
|
||||
|
||||
#if[!AtomicAdd]
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
|
||||
checkUOE(am, () -> {
|
||||
$type$ r = ($type$) hs.get(am).invokeExact(recv, $value1$);
|
||||
});
|
||||
@ -285,131 +285,131 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
|
||||
static void testStaticField(Handles hs) throws Throwable {
|
||||
// Plain
|
||||
{
|
||||
hs.get(TestAccessMode.set).invokeExact($value1$);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact();
|
||||
hs.get(TestAccessMode.SET).invokeExact($value1$);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, $value1$, "set $type$ value");
|
||||
}
|
||||
|
||||
|
||||
// Volatile
|
||||
{
|
||||
hs.get(TestAccessMode.setVolatile).invokeExact($value2$);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.getVolatile).invokeExact();
|
||||
hs.get(TestAccessMode.SET_VOLATILE).invokeExact($value2$);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET_VOLATILE).invokeExact();
|
||||
assertEquals(x, $value2$, "setVolatile $type$ value");
|
||||
}
|
||||
|
||||
// Lazy
|
||||
{
|
||||
hs.get(TestAccessMode.setRelease).invokeExact($value1$);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.getAcquire).invokeExact();
|
||||
hs.get(TestAccessMode.SET_RELEASE).invokeExact($value1$);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact();
|
||||
assertEquals(x, $value1$, "setRelease $type$ value");
|
||||
}
|
||||
|
||||
// Opaque
|
||||
{
|
||||
hs.get(TestAccessMode.setOpaque).invokeExact($value2$);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.getOpaque).invokeExact();
|
||||
hs.get(TestAccessMode.SET_OPAQUE).invokeExact($value2$);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET_OPAQUE).invokeExact();
|
||||
assertEquals(x, $value2$, "setOpaque $type$ value");
|
||||
}
|
||||
|
||||
#if[CAS]
|
||||
hs.get(TestAccessMode.set).invokeExact($value1$);
|
||||
hs.get(TestAccessMode.SET).invokeExact($value1$);
|
||||
|
||||
// Compare
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact($value1$, $value2$);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact($value1$, $value2$);
|
||||
assertEquals(r, true, "success compareAndSet $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact();
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, $value2$, "success compareAndSet $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact($value1$, $value3$);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact($value1$, $value3$);
|
||||
assertEquals(r, false, "failing compareAndSet $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact();
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, $value2$, "failing compareAndSet $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact($value2$, $value1$);
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact($value2$, $value1$);
|
||||
assertEquals(r, $value2$, "success compareAndExchangeVolatile $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact();
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, $value1$, "success compareAndExchangeVolatile $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact($value2$, $value3$);
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact($value2$, $value3$);
|
||||
assertEquals(r, $value1$, "failing compareAndExchangeVolatile $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact();
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, $value1$, "failing compareAndExchangeVolatile $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact($value1$, $value2$);
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact($value1$, $value2$);
|
||||
assertEquals(r, $value1$, "success compareAndExchangeAcquire $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact();
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, $value2$, "success compareAndExchangeAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact($value1$, $value3$);
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact($value1$, $value3$);
|
||||
assertEquals(r, $value2$, "failing compareAndExchangeAcquire $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact();
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, $value2$, "failing compareAndExchangeAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact($value2$, $value1$);
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact($value2$, $value1$);
|
||||
assertEquals(r, $value2$, "success compareAndExchangeRelease $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact();
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, $value1$, "success compareAndExchangeRelease $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact($value2$, $value3$);
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact($value2$, $value3$);
|
||||
assertEquals(r, $value1$, "failing compareAndExchangeRelease $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact();
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, $value1$, "failing compareAndExchangeRelease $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSet).invokeExact($value1$, $value2$);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact($value1$, $value2$);
|
||||
assertEquals(r, true, "weakCompareAndSet $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact();
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, $value2$, "weakCompareAndSet $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetAcquire).invokeExact($value2$, $value1$);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact($value2$, $value1$);
|
||||
assertEquals(r, true, "weakCompareAndSetAcquire $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact();
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, $value1$, "weakCompareAndSetAcquire $type$");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetRelease).invokeExact( $value1$, $value2$);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact( $value1$, $value2$);
|
||||
assertEquals(r, true, "weakCompareAndSetRelease $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact();
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, $value2$, "weakCompareAndSetRelease $type$");
|
||||
}
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.getAndSet).invokeExact( $value1$);
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET).invokeExact( $value1$);
|
||||
assertEquals(o, $value2$, "getAndSet $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact();
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
|
||||
assertEquals(x, $value1$, "getAndSet $type$ value");
|
||||
}
|
||||
#end[CAS]
|
||||
|
||||
#if[AtomicAdd]
|
||||
hs.get(TestAccessMode.set).invokeExact($value1$);
|
||||
hs.get(TestAccessMode.SET).invokeExact($value1$);
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.getAndAdd).invokeExact( $value3$);
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD).invokeExact( $value3$);
|
||||
assertEquals(o, $value1$, "getAndAdd $type$");
|
||||
$type$ c = ($type$) hs.get(TestAccessMode.addAndGet).invokeExact($value3$);
|
||||
$type$ c = ($type$) hs.get(TestAccessMode.ADD_AND_GET).invokeExact($value3$);
|
||||
assertEquals(c, $value1$ + $value3$ + $value3$, "getAndAdd $type$ value");
|
||||
}
|
||||
#end[AtomicAdd]
|
||||
@ -417,19 +417,19 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
|
||||
|
||||
static void testStaticFieldUnsupported(Handles hs) throws Throwable {
|
||||
#if[!CAS]
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
boolean r = (boolean) hs.get(am).invokeExact($value1$, $value2$);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
|
||||
checkUOE(am, () -> {
|
||||
$type$ r = ($type$) hs.get(am).invokeExact($value1$, $value2$);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
$type$ r = ($type$) hs.get(am).invokeExact($value1$);
|
||||
});
|
||||
@ -437,7 +437,7 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
|
||||
#end[CAS]
|
||||
|
||||
#if[!AtomicAdd]
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
|
||||
checkUOE(am, () -> {
|
||||
$type$ r = ($type$) hs.get(am).invokeExact($value1$);
|
||||
});
|
||||
@ -452,131 +452,131 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
// Plain
|
||||
{
|
||||
hs.get(TestAccessMode.set).invokeExact(array, i, $value1$);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, $value1$, "get $type$ value");
|
||||
}
|
||||
|
||||
|
||||
// Volatile
|
||||
{
|
||||
hs.get(TestAccessMode.setVolatile).invokeExact(array, i, $value2$);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.getVolatile).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET_VOLATILE).invokeExact(array, i, $value2$);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(array, i);
|
||||
assertEquals(x, $value2$, "setVolatile $type$ value");
|
||||
}
|
||||
|
||||
// Lazy
|
||||
{
|
||||
hs.get(TestAccessMode.setRelease).invokeExact(array, i, $value1$);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.getAcquire).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET_RELEASE).invokeExact(array, i, $value1$);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(array, i);
|
||||
assertEquals(x, $value1$, "setRelease $type$ value");
|
||||
}
|
||||
|
||||
// Opaque
|
||||
{
|
||||
hs.get(TestAccessMode.setOpaque).invokeExact(array, i, $value2$);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.getOpaque).invokeExact(array, i);
|
||||
hs.get(TestAccessMode.SET_OPAQUE).invokeExact(array, i, $value2$);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(array, i);
|
||||
assertEquals(x, $value2$, "setOpaque $type$ value");
|
||||
}
|
||||
|
||||
#if[CAS]
|
||||
hs.get(TestAccessMode.set).invokeExact(array, i, $value1$);
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
|
||||
|
||||
// Compare
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(array, i, $value1$, $value2$);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, $value1$, $value2$);
|
||||
assertEquals(r, true, "success compareAndSet $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, $value2$, "success compareAndSet $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(array, i, $value1$, $value3$);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, $value1$, $value3$);
|
||||
assertEquals(r, false, "failing compareAndSet $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, $value2$, "failing compareAndSet $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(array, i, $value2$, $value1$);
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(array, i, $value2$, $value1$);
|
||||
assertEquals(r, $value2$, "success compareAndExchangeVolatile $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, $value1$, "success compareAndExchangeVolatile $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(array, i, $value2$, $value3$);
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(array, i, $value2$, $value3$);
|
||||
assertEquals(r, $value1$, "failing compareAndExchangeVolatile $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, $value1$, "failing compareAndExchangeVolatile $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(array, i, $value1$, $value2$);
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, $value1$, $value2$);
|
||||
assertEquals(r, $value1$, "success compareAndExchangeAcquire $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, $value2$, "success compareAndExchangeAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(array, i, $value1$, $value3$);
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, $value1$, $value3$);
|
||||
assertEquals(r, $value2$, "failing compareAndExchangeAcquire $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, $value2$, "failing compareAndExchangeAcquire $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(array, i, $value2$, $value1$);
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, $value2$, $value1$);
|
||||
assertEquals(r, $value2$, "success compareAndExchangeRelease $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, $value1$, "success compareAndExchangeRelease $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(array, i, $value2$, $value3$);
|
||||
$type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, $value2$, $value3$);
|
||||
assertEquals(r, $value1$, "failing compareAndExchangeRelease $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, $value1$, "failing compareAndExchangeRelease $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSet).invokeExact(array, i, $value1$, $value2$);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, $value1$, $value2$);
|
||||
assertEquals(r, true, "weakCompareAndSet $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, $value2$, "weakCompareAndSet $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetAcquire).invokeExact(array, i, $value2$, $value1$);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, $value2$, $value1$);
|
||||
assertEquals(r, true, "weakCompareAndSetAcquire $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, $value1$, "weakCompareAndSetAcquire $type$");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetRelease).invokeExact(array, i, $value1$, $value2$);
|
||||
boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(array, i, $value1$, $value2$);
|
||||
assertEquals(r, true, "weakCompareAndSetRelease $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, $value2$, "weakCompareAndSetRelease $type$");
|
||||
}
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.getAndSet).invokeExact(array, i, $value1$);
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, $value1$);
|
||||
assertEquals(o, $value2$, "getAndSet $type$");
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(array, i);
|
||||
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
|
||||
assertEquals(x, $value1$, "getAndSet $type$ value");
|
||||
}
|
||||
#end[CAS]
|
||||
|
||||
#if[AtomicAdd]
|
||||
hs.get(TestAccessMode.set).invokeExact(array, i, $value1$);
|
||||
hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
|
||||
|
||||
// get and add, add and get
|
||||
{
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.getAndAdd).invokeExact(array, i, $value3$);
|
||||
$type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, $value3$);
|
||||
assertEquals(o, $value1$, "getAndAdd $type$");
|
||||
$type$ c = ($type$) hs.get(TestAccessMode.addAndGet).invokeExact(array, i, $value3$);
|
||||
$type$ c = ($type$) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(array, i, $value3$);
|
||||
assertEquals(c, $value1$ + $value3$ + $value3$, "getAndAdd $type$ value");
|
||||
}
|
||||
#end[AtomicAdd]
|
||||
@ -588,19 +588,19 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
|
||||
|
||||
final int i = 0;
|
||||
#if[!CAS]
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
boolean r = (boolean) hs.get(am).invokeExact(array, i, $value1$, $value2$);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
|
||||
checkUOE(am, () -> {
|
||||
$type$ r = ($type$) hs.get(am).invokeExact(array, i, $value1$, $value2$);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
|
||||
checkUOE(am, () -> {
|
||||
$type$ r = ($type$) hs.get(am).invokeExact(array, i, $value1$);
|
||||
});
|
||||
@ -608,7 +608,7 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
|
||||
#end[CAS]
|
||||
|
||||
#if[!AtomicAdd]
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
|
||||
checkUOE(am, () -> {
|
||||
$type$ o = ($type$) hs.get(am).invokeExact(array, i, $value1$);
|
||||
});
|
||||
@ -622,32 +622,32 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
|
||||
for (int i : new int[]{-1, Integer.MIN_VALUE, 10, 11, Integer.MAX_VALUE}) {
|
||||
final int ci = i;
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
|
||||
checkIOOBE(am, () -> {
|
||||
$type$ x = ($type$) hs.get(am).invokeExact(array, ci);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
checkIOOBE(am, () -> {
|
||||
hs.get(am).invokeExact(array, ci, $value1$);
|
||||
});
|
||||
}
|
||||
|
||||
#if[CAS]
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
|
||||
checkIOOBE(am, () -> {
|
||||
boolean r = (boolean) hs.get(am).invokeExact(array, ci, $value1$, $value2$);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
|
||||
checkIOOBE(am, () -> {
|
||||
$type$ r = ($type$) hs.get(am).invokeExact(array, ci, $value2$, $value1$);
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
|
||||
checkIOOBE(am, () -> {
|
||||
$type$ o = ($type$) hs.get(am).invokeExact(array, ci, $value1$);
|
||||
});
|
||||
@ -655,7 +655,7 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
|
||||
#end[CAS]
|
||||
|
||||
#if[AtomicAdd]
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
|
||||
checkIOOBE(am, () -> {
|
||||
$type$ o = ($type$) hs.get(am).invokeExact(array, ci, $value3$);
|
||||
});
|
||||
|
@ -619,7 +619,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
|
||||
}
|
||||
|
||||
static void testInstanceFieldWrongMethodType(VarHandleTestMethodType$Type$ recv, Handles hs) throws Throwable {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null receiver
|
||||
$type$ x = ($type$) hs.get(am, methodType($type$.class, Void.class)).
|
||||
@ -653,7 +653,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null receiver
|
||||
hs.get(am, methodType(void.class, Void.class, $type$.class)).
|
||||
@ -683,7 +683,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
|
||||
}
|
||||
|
||||
#if[CAS]
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
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)).
|
||||
@ -716,7 +716,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
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$);
|
||||
@ -757,7 +757,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
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$);
|
||||
@ -796,7 +796,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
|
||||
#end[CAS]
|
||||
|
||||
#if[AtomicAdd]
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
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$);
|
||||
@ -1155,7 +1155,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
|
||||
static void testStaticFieldWrongMethodType(Handles hs) throws Throwable {
|
||||
int i = 0;
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
|
||||
// Incorrect return type
|
||||
check{#if[String]?CCE:WMTE}(() -> { // reference class
|
||||
Void x = (Void) hs.get(am, methodType(Void.class)).
|
||||
@ -1172,7 +1172,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
check{#if[String]?CCE:WMTE}(() -> { // value reference class
|
||||
hs.get(am, methodType(void.class, Class.class)).
|
||||
invoke(Void.class);
|
||||
@ -1188,7 +1188,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
#if[CAS]
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
|
||||
// Incorrect argument types
|
||||
check{#if[String]?CCE:WMTE}(() -> { // expected reference class
|
||||
boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, $type$.class)).
|
||||
@ -1209,7 +1209,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
|
||||
// Incorrect argument types
|
||||
check{#if[String]?CCE:WMTE}(() -> { // expected reference class
|
||||
$type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, $type$.class)).
|
||||
@ -1239,7 +1239,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
|
||||
// Incorrect argument types
|
||||
check{#if[String]?CCE:WMTE}(() -> { // value reference class
|
||||
$type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class)).
|
||||
@ -1267,7 +1267,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
|
||||
#end[CAS]
|
||||
|
||||
#if[AtomicAdd]
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
|
||||
// Incorrect argument types
|
||||
check{#if[String]?CCE:WMTE}(() -> { // value reference class
|
||||
$type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class)).
|
||||
@ -1854,7 +1854,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
|
||||
$type$[] array = new $type$[10];
|
||||
Arrays.fill(array, $value1$);
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
|
||||
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)).
|
||||
@ -1892,7 +1892,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
|
||||
// Incorrect argument types
|
||||
checkNPE(() -> { // null array
|
||||
hs.get(am, methodType(void.class, Void.class, int.class, $type$.class)).
|
||||
@ -1925,7 +1925,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
#if[CAS]
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
|
||||
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)).
|
||||
@ -1962,7 +1962,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
|
||||
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)).
|
||||
@ -2008,7 +2008,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
|
||||
});
|
||||
}
|
||||
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
|
||||
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)).
|
||||
@ -2052,7 +2052,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
|
||||
#end[CAS]
|
||||
|
||||
#if[AtomicAdd]
|
||||
for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
|
||||
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)).
|
||||
|
Loading…
x
Reference in New Issue
Block a user