--- a/jdk/make/mapfiles/libjava/mapfile-vers Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/make/mapfiles/libjava/mapfile-vers Thu Apr 14 09:32:37 2016 -0700
@@ -224,8 +224,7 @@
Java_java_lang_System_setOut0;
Java_java_lang_Thread_registerNatives;
Java_java_lang_Throwable_fillInStackTrace;
- Java_java_lang_Throwable_getStackTraceDepth;
- Java_java_lang_Throwable_getStackTraceElement;
+ Java_java_lang_Throwable_getStackTraceElements;
Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction_2;
Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction_2Ljava_security_AccessControlContext_2;
Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2;
--- a/jdk/make/mapfiles/libjava/reorder-sparc Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/make/mapfiles/libjava/reorder-sparc Thu Apr 14 09:32:37 2016 -0700
@@ -78,8 +78,7 @@
text: .text%JNU_GetEnv;
text: .text%Java_java_io_UnixFileSystem_checkAccess;
text: .text%Java_java_lang_reflect_Array_newArray;
-text: .text%Java_java_lang_Throwable_getStackTraceDepth;
-text: .text%Java_java_lang_Throwable_getStackTraceElement;
+text: .text%Java_java_lang_Throwable_getStackTraceElements;
text: .text%throwFileNotFoundException;
text: .text%JNU_NotifyAll;
# Test LoadFrame
--- a/jdk/make/mapfiles/libjava/reorder-sparcv9 Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/make/mapfiles/libjava/reorder-sparcv9 Thu Apr 14 09:32:37 2016 -0700
@@ -74,8 +74,7 @@
text: .text%JNU_GetEnv;
text: .text%Java_java_io_UnixFileSystem_checkAccess;
text: .text%Java_java_lang_reflect_Array_newArray;
-text: .text%Java_java_lang_Throwable_getStackTraceDepth;
-text: .text%Java_java_lang_Throwable_getStackTraceElement;
+text: .text%Java_java_lang_Throwable_getStackTraceElements;
text: .text%throwFileNotFoundException: OUTPUTDIR/io_util.o;
text: .text%JNU_NotifyAll;
# Test LoadFrame
--- a/jdk/make/mapfiles/libjava/reorder-x86 Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/make/mapfiles/libjava/reorder-x86 Thu Apr 14 09:32:37 2016 -0700
@@ -78,8 +78,7 @@
text: .text%Java_sun_reflect_NativeMethodAccessorImpl_invoke0;
text: .text%Java_java_io_FileInputStream_available;
text: .text%Java_java_lang_reflect_Array_newArray;
-text: .text%Java_java_lang_Throwable_getStackTraceDepth;
-text: .text%Java_java_lang_Throwable_getStackTraceElement;
+text: .text%Java_java_lang_Throwable_getStackTraceElements;
text: .text%Java_java_lang_System_identityHashCode;
text: .text%JNU_NotifyAll;
# Test LoadFrame
--- a/jdk/make/mapfiles/libnio/mapfile-linux Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/make/mapfiles/libnio/mapfile-linux Thu Apr 14 09:32:37 2016 -0700
@@ -161,7 +161,9 @@
Java_sun_nio_fs_UnixNativeDispatcher_strerror;
Java_sun_nio_fs_UnixNativeDispatcher_dup;
Java_sun_nio_fs_UnixNativeDispatcher_access0;
+ Java_sun_nio_fs_UnixNativeDispatcher_exists0;
Java_sun_nio_fs_UnixNativeDispatcher_stat0;
+ Java_sun_nio_fs_UnixNativeDispatcher_stat1;
Java_sun_nio_fs_UnixNativeDispatcher_lstat0;
Java_sun_nio_fs_UnixNativeDispatcher_fstat;
Java_sun_nio_fs_UnixNativeDispatcher_fstatat0;
--- a/jdk/make/mapfiles/libnio/mapfile-macosx Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/make/mapfiles/libnio/mapfile-macosx Thu Apr 14 09:32:37 2016 -0700
@@ -138,7 +138,9 @@
Java_sun_nio_fs_UnixNativeDispatcher_strerror;
Java_sun_nio_fs_UnixNativeDispatcher_dup;
Java_sun_nio_fs_UnixNativeDispatcher_access0;
+ Java_sun_nio_fs_UnixNativeDispatcher_exists0;
Java_sun_nio_fs_UnixNativeDispatcher_stat0;
+ Java_sun_nio_fs_UnixNativeDispatcher_stat1;
Java_sun_nio_fs_UnixNativeDispatcher_lstat0;
Java_sun_nio_fs_UnixNativeDispatcher_fstat;
Java_sun_nio_fs_UnixNativeDispatcher_fstatat0;
--- a/jdk/make/mapfiles/libnio/mapfile-solaris Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/make/mapfiles/libnio/mapfile-solaris Thu Apr 14 09:32:37 2016 -0700
@@ -138,7 +138,9 @@
Java_sun_nio_fs_UnixNativeDispatcher_strerror;
Java_sun_nio_fs_UnixNativeDispatcher_dup;
Java_sun_nio_fs_UnixNativeDispatcher_access0;
+ Java_sun_nio_fs_UnixNativeDispatcher_exists0;
Java_sun_nio_fs_UnixNativeDispatcher_stat0;
+ Java_sun_nio_fs_UnixNativeDispatcher_stat1;
Java_sun_nio_fs_UnixNativeDispatcher_lstat0;
Java_sun_nio_fs_UnixNativeDispatcher_fstat;
Java_sun_nio_fs_UnixNativeDispatcher_fstatat0;
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/AESCrypt.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/AESCrypt.java Thu Apr 14 09:32:37 2016 -0700
@@ -56,7 +56,7 @@
private boolean ROUNDS_14 = false;
/** Session and Sub keys */
- private Object[] sessionK = null;
+ private int[][] sessionK = null;
private int[] K = null;
/** Cipher encryption/decryption key */
@@ -99,7 +99,7 @@
}
// set sub key to the corresponding session Key
- this.K = (int[]) sessionK[(decrypting? 1:0)];
+ this.K = sessionK[(decrypting? 1:0)];
}
/**
@@ -680,7 +680,7 @@
limit = ROUNDS*4;
// store the expanded sub keys into 'sessionK'
- sessionK = new Object[] { expandedKe, expandedKd };
+ sessionK = new int[][] { expandedKe, expandedKd };
}
--- a/jdk/src/java.base/share/classes/java/lang/ArrayIndexOutOfBoundsException.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/ArrayIndexOutOfBoundsException.java Thu Apr 14 09:32:37 2016 -0700
@@ -64,20 +64,4 @@
public ArrayIndexOutOfBoundsException(int index) {
super("Array index out of range: " + index);
}
-
- /**
- * Constructs a new {@code ArrayIndexOutOfBoundsException} class with
- * arguments indicating two out of bound values.
- *
- * <p>The out of bound values are included in this exception's detail
- * message. The exact presentation format of the detail message is
- * unspecified.
- *
- * @param a the first out of bound value.
- * @param b the second out of bound value.
- * @since 9
- */
- public ArrayIndexOutOfBoundsException(int a, int b) {
- super("Array indexed access out of bounds: " + a + ", " + b);
- }
}
--- a/jdk/src/java.base/share/classes/java/lang/Deprecated.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/Deprecated.java Thu Apr 14 09:32:37 2016 -0700
@@ -29,14 +29,44 @@
import static java.lang.annotation.ElementType.*;
/**
- * A program element annotated @Deprecated is one that programmers
- * are discouraged from using, typically because it is dangerous,
- * or because a better alternative exists. Compilers warn when a
- * deprecated program element is used or overridden in non-deprecated code.
+ * A program element annotated {@code @Deprecated} is one that programmers
+ * are discouraged from using. An element may be deprecated for any of several
+ * reasons, for example, its usage is likely to lead to errors; it may
+ * be changed incompatibly or removed in a future version; it has been
+ * superseded by a newer, usually preferable alternative; or it is obsolete.
+ *
+ * <p>Compilers issue warnings when a deprecated program element is used or
+ * overridden in non-deprecated code. Use of the {@code @Deprecated}
+ * annotation on a local variable declaration or on a parameter declaration
+ * or a package declaration has no effect on the warnings issued by a compiler.
+ *
+ * <p>This annotation type has a string-valued element {@code since}. The value
+ * of this element indicates the version in which the annotated program element
+ * was first deprecated.
*
- * <p>Use of the @Deprecated annotation on a local variable
- * declaration or on a parameter declaration or a package declaration
- * has no effect on the warnings issued by a compiler.
+ * <p>This annotation type has a boolean-valued element {@code forRemoval}.
+ * A value of {@code true} indicates intent to remove the annotated program
+ * element in a future version. A value of {@code false} indicates that use of
+ * the annotated program element is discouraged, but at the time the program
+ * element was annotated, there was no specific intent to remove it.
+ *
+ * @apiNote
+ * It is strongly recommended that the reason for deprecating a program element
+ * be explained in the documentation, using the {@code @deprecated}
+ * javadoc tag. The documentation should also suggest and link to a
+ * recommended replacement API, if applicable. A replacement API often
+ * has subtly different semantics, so such issues should be discussed as
+ * well.
+ *
+ * <p>It is recommended that a {@code since} value be provided with all newly
+ * annotated program elements. Note that {@code since} cannot be mandatory,
+ * as there are many existing annotations that lack this element value.
+ *
+ * <p>There is no defined order among annotation elements. As a matter of
+ * style, the {@code since} element should be placed first.
+ *
+ * <p>The {@code @Deprecated} annotation should always be present if
+ * the {@code @deprecated} javadoc tag is present, and vice-versa.
*
* @author Neal Gafter
* @since 1.5
@@ -46,4 +76,23 @@
@Retention(RetentionPolicy.RUNTIME)
@Target(value={CONSTRUCTOR, FIELD, LOCAL_VARIABLE, METHOD, PACKAGE, PARAMETER, TYPE})
public @interface Deprecated {
+ /**
+ * Returns the version in which the annotated element became deprecated.
+ * The version string is in the same format and namespace as the value of
+ * the {@code @since} javadoc tag. The default value is the empty
+ * string.
+ *
+ * @return the version string
+ * @since 9
+ */
+ String since() default "";
+
+ /**
+ * Indicates whether the annotated element is subject to removal in a
+ * future version. The default value is {@code false}.
+ *
+ * @return whether the element is subject to removal
+ * @since 9
+ */
+ boolean forRemoval() default false;
}
--- a/jdk/src/java.base/share/classes/java/lang/IndexOutOfBoundsException.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/IndexOutOfBoundsException.java Thu Apr 14 09:32:37 2016 -0700
@@ -67,21 +67,4 @@
public IndexOutOfBoundsException(int index) {
super("Index out of range: " + index);
}
-
- /**
- * Constructs an {@code IndexOutOfBoundsException} with arguments indicating
- * two out of bound values.
- *
- * <p>The out of bound values are included in this exception's detail
- * message. The exact presentation format of the detail message is
- * unspecified.
- *
- * @param a the first out of bound value
- * @param b the second out of bound value
- * @since 9
- */
- public IndexOutOfBoundsException(int a, int b) {
- super("Indexed access out of bounds: " + a + ", " + b);
- }
-
}
--- a/jdk/src/java.base/share/classes/java/lang/ProcessHandleImpl.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/ProcessHandleImpl.java Thu Apr 14 09:32:37 2016 -0700
@@ -52,6 +52,11 @@
*/
final class ProcessHandleImpl implements ProcessHandle {
/**
+ * Default size of stack for reaper processes.
+ */
+ private static long REAPER_DEFAULT_STACKSIZE = 128 * 1024;
+
+ /**
* Cache the ProcessHandle of this process.
*/
private static final ProcessHandleImpl current;
@@ -79,10 +84,12 @@
ThreadGroup tg = Thread.currentThread().getThreadGroup();
while (tg.getParent() != null) tg = tg.getParent();
ThreadGroup systemThreadGroup = tg;
+ final long stackSize = Boolean.getBoolean("jdk.lang.processReaperUseDefaultStackSize")
+ ? 0 : REAPER_DEFAULT_STACKSIZE;
ThreadFactory threadFactory = grimReaper -> {
- long stackSize = Boolean.getBoolean("jdk.lang.processReaperUseDefaultStackSize") ? 0 : 32768;
- Thread t = new Thread(systemThreadGroup, grimReaper, "process reaper", stackSize);
+ Thread t = new Thread(systemThreadGroup, grimReaper,
+ "process reaper", stackSize, false);
t.setDaemon(true);
// A small attempt (probably futile) to avoid priority inversion
t.setPriority(Thread.MAX_PRIORITY);
--- a/jdk/src/java.base/share/classes/java/lang/StackTraceElement.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/StackTraceElement.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -112,6 +112,12 @@
this.lineNumber = lineNumber;
}
+
+ /**
+ * Creates an empty stack frame element to be filled in by Throwable.
+ */
+ StackTraceElement() { }
+
/**
* Returns the name of the source file containing the execution point
* represented by this stack trace element. Generally, this corresponds
--- a/jdk/src/java.base/share/classes/java/lang/StringIndexOutOfBoundsException.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/StringIndexOutOfBoundsException.java Thu Apr 14 09:32:37 2016 -0700
@@ -67,20 +67,4 @@
public StringIndexOutOfBoundsException(int index) {
super("String index out of range: " + index);
}
-
- /**
- * Constructs a new {@code StringIndexOutOfBoundsException} class with
- * arguments indicating two out of bound values.
- *
- * <p>The out of bound values are included in this exception's detail
- * message. The exact presentation format of the detail message is
- * unspecified.
- *
- * @param a the first out of bound value.
- * @param b the second out of bound value.
- * @since 9
- */
- public StringIndexOutOfBoundsException(int a, int b) {
- super("String indexed access out of bounds: " + a + ", " + b);
- }
}
--- a/jdk/src/java.base/share/classes/java/lang/Throwable.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/Throwable.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -118,7 +118,7 @@
private static final long serialVersionUID = -3042686055658047285L;
/**
- * Native code saves some indication of the stack backtrace in this slot.
+ * The JVM saves some indication of the stack backtrace in this slot.
*/
private transient Object backtrace;
@@ -211,6 +211,11 @@
*/
private StackTraceElement[] stackTrace = UNASSIGNED_STACK;
+ /**
+ * The JVM code sets the depth of the backtrace for later retrieval
+ */
+ private transient int depth;
+
// Setting this static field introduces an acceptable
// initialization dependency on a few java.util classes.
private static final List<Throwable> SUPPRESSED_SENTINEL = Collections.emptyList();
@@ -828,10 +833,11 @@
if (backtrace instanceof StackStreamFactory.StackTrace) {
stackTrace = ((StackStreamFactory.StackTrace)backtrace).getStackTraceElements();
} else {
- int depth = getStackTraceDepth();
stackTrace = new StackTraceElement[depth];
- for (int i = 0; i < depth; i++)
- stackTrace[i] = getStackTraceElement(i);
+ for (int i = 0; i < depth; i++) {
+ stackTrace[i] = new StackTraceElement();
+ }
+ getStackTraceElements(stackTrace);
}
} else if (stackTrace == null) {
return UNASSIGNED_STACK;
@@ -884,23 +890,11 @@
}
/**
- * Returns the number of elements in the stack trace (or 0 if the stack
- * trace is unavailable).
- *
- * package-protection for use by SharedSecrets.
+ * Gets the stack trace elements.
+ * @param elements
+ * @throws IndexOutOfBoundsException if {@code elements.length != depth }
*/
- native int getStackTraceDepth();
-
- /**
- * Returns the specified element of the stack trace.
- *
- * package-protection for use by SharedSecrets.
- *
- * @param index index of the element to return.
- * @throws IndexOutOfBoundsException if {@code index < 0 ||
- * index >= getStackTraceDepth() }
- */
- native StackTraceElement getStackTraceElement(int index);
+ private native void getStackTraceElements(StackTraceElement[] elements);
/**
* Reads a {@code Throwable} from a stream, enforcing
--- a/jdk/src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java Thu Apr 14 09:32:37 2016 -0700
@@ -89,8 +89,7 @@
static {
final String key = "jdk.internal.lambda.dumpProxyClasses";
String path = AccessController.doPrivileged(
- new GetPropertyAction(key), null,
- new PropertyPermission(key , "read"));
+ new GetPropertyAction(key));
dumper = (null == path) ? null : ProxyClassesDumper.getInstance(path);
}
--- a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java Thu Apr 14 09:32:37 2016 -0700
@@ -655,6 +655,8 @@
mv.visitAnnotation(DONTINLINE_SIG, true);
}
+ constantPlaceholder(lambdaForm); // keep LambdaForm instance & its compiled form lifetime tightly coupled.
+
if (lambdaForm.customized != null) {
// Since LambdaForm is customized for a particular MethodHandle, it's safe to substitute
// receiver MethodHandle (at slot #0) with an embedded constant and use it instead.
--- a/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java Thu Apr 14 09:32:37 2016 -0700
@@ -131,11 +131,11 @@
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 @@
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);
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MemberName.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MemberName.java Thu Apr 14 09:32:37 2016 -0700
@@ -374,7 +374,7 @@
}
public static boolean isVarHandleMethodInvokeName(String name) {
try {
- VarHandle.AccessMode.valueOf(name);
+ VarHandle.AccessMode.valueFromMethodName(name);
return true;
} catch (IllegalArgumentException e) {
return false;
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandle.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandle.java Thu Apr 14 09:32:37 2016 -0700
@@ -219,7 +219,8 @@
* Method handles produced by lookups or constant loads from methods or
* constructors with the variable arity modifier bit ({@code 0x0080})
* have a corresponding variable arity, as if they were defined with
- * the help of {@link #asVarargsCollector asVarargsCollector}.
+ * the help of {@link #asVarargsCollector asVarargsCollector}
+ * or {@link #withVarargs withVarargs}.
* <p>
* A method reference may refer either to a static or non-static method.
* In the non-static case, the method handle type includes an explicit
@@ -972,6 +973,36 @@
throw newIllegalArgumentException("array length is not legal for long[] or double[]", arrayLength);
}
}
+ /**
+ * Adapts this method handle to be {@linkplain #asVarargsCollector variable arity}
+ * if the boolean flag is true, else {@linkplain #asFixedArity fixed arity}.
+ * If the method handle is already of the proper arity mode, it is returned
+ * unchanged.
+ * @apiNote
+ * <p>This method is sometimes useful when adapting a method handle that
+ * may be variable arity, to ensure that the resulting adapter is also
+ * variable arity if and only if the original handle was. For example,
+ * this code changes the first argument of a handle {@code mh} to {@code int} without
+ * disturbing its variable arity property:
+ * {@code mh.asType(mh.type().changeParameterType(0,int.class))
+ * .withVarargs(mh.isVarargsCollector())}
+ * @param makeVarargs true if the return method handle should have variable arity behavior
+ * @return a method handle of the same type, with possibly adjusted variable arity behavior
+ * @throws IllegalArgumentException if {@code makeVarargs} is true and
+ * this method handle does not have a trailing array parameter
+ * @since 9
+ * @see #asVarargsCollector
+ * @see #asFixedArity
+ */
+ public MethodHandle withVarargs(boolean makeVarargs) {
+ if (!makeVarargs) {
+ return asFixedArity();
+ } else if (!isVarargsCollector()) {
+ return asVarargsCollector(type().lastParameterType());
+ } else {
+ return this;
+ }
+ }
/**
* Makes an <em>array-collecting</em> method handle, which accepts a given number of trailing
@@ -1000,7 +1031,8 @@
* to allow the target to use a simple {@code Object} as its last parameter type.)
* <p>
* In order to create a collecting adapter which is not restricted to a particular
- * number of collected arguments, use {@link #asVarargsCollector asVarargsCollector} instead.
+ * number of collected arguments, use {@link #asVarargsCollector asVarargsCollector}
+ * or {@link #withVarargs withVarargs} instead.
* <p>
* Here are some examples of array-collecting method handles:
* <blockquote><pre>{@code
@@ -1216,7 +1248,7 @@
* <p>
* No method handle transformations produce new method handles with
* variable arity, unless they are documented as doing so.
- * Therefore, besides {@code asVarargsCollector},
+ * Therefore, besides {@code asVarargsCollector} and {@code withVarargs},
* all methods in {@code MethodHandle} and {@code MethodHandles}
* will return a method handle with fixed arity,
* except in the cases where they are specified to return their original
@@ -1273,6 +1305,7 @@
* or {@code arrayType} is not assignable to this method handle's trailing parameter type
* @see #asCollector
* @see #isVarargsCollector
+ * @see #withVarargs
* @see #asFixedArity
*/
public MethodHandle asVarargsCollector(Class<?> arrayType) {
@@ -1344,6 +1377,7 @@
* @return a new method handle which accepts only a fixed number of arguments
* @see #asVarargsCollector
* @see #isVarargsCollector
+ * @see #withVarargs
*/
public MethodHandle asFixedArity() {
assert(!isVarargsCollector());
@@ -1428,11 +1462,11 @@
/*non-public*/
MethodHandle setVarargs(MemberName member) throws IllegalAccessException {
if (!member.isVarargs()) return this;
- Class<?> arrayType = type().lastParameterType();
- if (arrayType.isArray()) {
- return MethodHandleImpl.makeVarargsCollector(this, arrayType);
+ try {
+ return this.withVarargs(true);
+ } catch (IllegalArgumentException ex) {
+ throw member.makeAccessException("cannot make variable arity", null);
}
- throw member.makeAccessException("cannot make variable arity", null);
}
/*non-public*/
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1055,7 +1055,7 @@
if (!method.getInvocationType().equals(mh.type()))
throw new InternalError(method.toString());
mh = mh.withInternalMemberName(method, false);
- mh = mh.asVarargsCollector(Object[].class);
+ mh = mh.withVarargs(true);
assert(method.isVarargs());
FAKE_METHOD_HANDLE_INVOKE[idx] = mh;
return mh;
@@ -1754,6 +1754,18 @@
}
/**
+ * This method is bound as a filter in {@linkplain MethodHandles#countedLoop(MethodHandle, MethodHandle, MethodHandle,
+ * MethodHandle) counting loops} to pass the correct counter value to the body.
+ *
+ * @param counter the loop counter.
+ *
+ * @return the loop counter decremented by 1.
+ */
+ static int decrementCounter(int counter) {
+ return counter - 1;
+ }
+
+ /**
* This is bound to initialize the loop-local iterator in {@linkplain MethodHandles#iteratedLoop iterating loops}.
*
* @param it the {@link Iterable} over which the loop iterates.
@@ -1879,7 +1891,8 @@
MH_iterateNext = 11,
MH_tryFinallyExec = 12,
MH_tryFinallyVoidExec = 13,
- MH_LIMIT = 14;
+ MH_decrementCounter = 14,
+ MH_LIMIT = 15;
static MethodHandle getConstantHandle(int idx) {
MethodHandle handle = HANDLES[idx];
@@ -1949,6 +1962,9 @@
case MH_tryFinallyVoidExec:
return IMPL_LOOKUP.findStatic(MethodHandleImpl.class, "tryFinallyVoidExecutor",
MethodType.methodType(void.class, MethodHandle.class, MethodHandle.class, Object[].class));
+ case MH_decrementCounter:
+ return IMPL_LOOKUP.findStatic(MethodHandleImpl.class, "decrementCounter",
+ MethodType.methodType(int.class, int.class));
}
} catch (ReflectiveOperationException ex) {
throw newInternalError(ex);
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java Thu Apr 14 09:32:37 2016 -0700
@@ -423,7 +423,7 @@
// 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);
}
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -216,13 +216,7 @@
}
private static MethodHandle bindCaller(MethodHandle target, Class<?> hostClass) {
- MethodHandle cbmh = MethodHandleImpl.bindCaller(target, hostClass);
- if (target.isVarargsCollector()) {
- MethodType type = cbmh.type();
- int arity = type.parameterCount();
- return cbmh.asVarargsCollector(type.parameterType(arity-1));
- }
- return cbmh;
+ return MethodHandleImpl.bindCaller(target, hostClass).withVarargs(target.isVarargsCollector());
}
/**
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java Thu Apr 14 09:32:37 2016 -0700
@@ -43,7 +43,6 @@
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 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 @@
}
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;
}
@@ -1355,9 +1352,7 @@
...
MethodHandle mh0 = lookup().findVirtual(defc, name, type);
MethodHandle mh1 = mh0.bindTo(receiver);
-MethodType mt1 = mh1.type();
-if (mh0.isVarargsCollector())
- mh1 = mh1.asVarargsCollector(mt1.parameterType(mt1.parameterCount()-1));
+mh1 = mh1.withVarargs(mh0.isVarargsCollector());
return mh1;
* }</pre></blockquote>
* where {@code defc} is either {@code receiver.getClass()} or a super
@@ -2954,9 +2949,55 @@
if (ident.type().returnType() == type)
return ident;
// something like identity(Foo.class); do not bother to intern these
- assert(btw == Wrapper.OBJECT);
+ assert (btw == Wrapper.OBJECT);
return makeIdentity(type);
}
+
+ /**
+ * Produces a constant method handle of the requested return type which
+ * returns the default value for that type every time it is invoked.
+ * The resulting constant method handle will have no side effects.
+ * <p>The returned method handle is equivalent to {@code empty(methodType(type))}.
+ * It is also equivalent to {@code explicitCastArguments(constant(Object.class, null), methodType(type))},
+ * since {@code explicitCastArguments} converts {@code null} to default values.
+ * @param type the expected return type of the desired method handle
+ * @return a constant method handle that takes no arguments
+ * and returns the default value of the given type (or void, if the type is void)
+ * @throws NullPointerException if the argument is null
+ * @see MethodHandles#constant
+ * @see MethodHandles#empty
+ * @since 9
+ */
+ public static MethodHandle zero(Class<?> type) {
+ Objects.requireNonNull(type);
+ return type.isPrimitive() ? zero(Wrapper.forPrimitiveType(type), type) : zero(Wrapper.OBJECT, type);
+ }
+
+ private static MethodHandle identityOrVoid(Class<?> type) {
+ return type == void.class ? zero(type) : identity(type);
+ }
+
+ /**
+ * Produces a method handle of the requested type which ignores any arguments, does nothing,
+ * and returns a suitable default depending on the return type.
+ * That is, it returns a zero primitive value, a {@code null}, or {@code void}.
+ * <p>The returned method handle is equivalent to
+ * {@code dropArguments(zero(type.returnType()), 0, type.parameterList())}.
+ * <p>
+ * @apiNote Given a predicate and target, a useful "if-then" construct can be produced as
+ * {@code guardWithTest(pred, target, empty(target.type())}.
+ * @param type the type of the desired method handle
+ * @return a constant method handle of the given type, which returns a default value of the given return type
+ * @throws NullPointerException if the argument is null
+ * @see MethodHandles#zero
+ * @see MethodHandles#constant
+ * @since 9
+ */
+ public static MethodHandle empty(MethodType type) {
+ Objects.requireNonNull(type);
+ return dropArguments(zero(type.returnType()), 0, type.parameterList());
+ }
+
private static final MethodHandle[] IDENTITY_MHS = new MethodHandle[Wrapper.values().length];
private static MethodHandle makeIdentity(Class<?> ptype) {
MethodType mtype = MethodType.methodType(ptype, ptype);
@@ -3148,8 +3189,7 @@
* If {@code pos} is zero, the dummy arguments will precede
* the target's real arguments; if {@code pos} is <i>N</i>
* they will come after.
- * <p>
- * <b>Example:</b>
+ * @apiNote
* <blockquote><pre>{@code
import static java.lang.invoke.MethodHandles.*;
import static java.lang.invoke.MethodType.*;
@@ -3188,6 +3228,99 @@
return dropArguments(target, pos, Arrays.asList(valueTypes));
}
+ // private version which allows caller some freedom with error handling
+ private static MethodHandle dropArgumentsToMatch(MethodHandle target, int skip, List<Class<?>> newTypes, int pos,
+ boolean nullOnFailure) {
+ List<Class<?>> oldTypes = target.type().parameterList();
+ int match = oldTypes.size();
+ if (skip != 0) {
+ if (skip < 0 || skip > match) {
+ throw newIllegalArgumentException("illegal skip", skip, target);
+ }
+ oldTypes = oldTypes.subList(skip, match);
+ match -= skip;
+ }
+ List<Class<?>> addTypes = newTypes;
+ int add = addTypes.size();
+ if (pos != 0) {
+ if (pos < 0 || pos > add) {
+ throw newIllegalArgumentException("illegal pos", pos, newTypes);
+ }
+ addTypes = addTypes.subList(pos, add);
+ add -= pos; assert(addTypes.size() == add);
+ }
+ // Do not add types which already match the existing arguments.
+ if (match > add || !oldTypes.equals(addTypes.subList(0, match))) {
+ if (nullOnFailure) {
+ return null;
+ }
+ throw newIllegalArgumentException("argument lists do not match", oldTypes, newTypes);
+ }
+ addTypes = addTypes.subList(match, add);
+ add -= match; assert(addTypes.size() == add);
+ // newTypes: ( P*[pos], M*[match], A*[add] )
+ // target: ( S*[skip], M*[match] )
+ MethodHandle adapter = target;
+ if (add > 0) {
+ adapter = dropArguments(adapter, skip+ match, addTypes);
+ }
+ // adapter: (S*[skip], M*[match], A*[add] )
+ if (pos > 0) {
+ adapter = dropArguments(adapter, skip, newTypes.subList(0, pos));
+ }
+ // adapter: (S*[skip], P*[pos], M*[match], A*[add] )
+ return adapter;
+ }
+
+ /**
+ * Adapts a target method handle to match the given parameter type list, if necessary, by adding dummy arguments.
+ * Some leading parameters are first skipped; they will be left unchanged and are otherwise ignored.
+ * The remaining types in the target's parameter type list must be contained as a sub-list of the given type list,
+ * at the given position.
+ * Any non-matching parameter types (before or after the matching sub-list) are inserted in corresponding
+ * positions of the target method handle's parameters, as if by {@link #dropArguments}.
+ * (More precisely, elements in the new list before {@code pos} are inserted into the target list at {@code skip},
+ * while elements in the new list after the match beginning at {@code pos} are inserted at the end of the
+ * target list.)
+ * The target's return type will be unchanged.
+ * @apiNote
+ * Two method handles whose argument lists are "effectively identical" (i.e., identical
+ * in a common prefix) may be mutually converted to a common type
+ * by two calls to {@code dropArgumentsToMatch}, as follows:
+ * <blockquote><pre>{@code
+import static java.lang.invoke.MethodHandles.*;
+import static java.lang.invoke.MethodType.*;
+...
+...
+MethodHandle h0 = constant(boolean.class, true);
+MethodHandle h1 = lookup().findVirtual(String.class, "concat", methodType(String.class, String.class));
+MethodType bigType = h1.type().insertParameterTypes(1, String.class, int.class);
+MethodHandle h2 = dropArguments(h1, 0, bigType.parameterList());
+if (h1.type().parameterCount() < h2.type().parameterCount())
+ h1 = dropArgumentsToMatch(h1, 0, h2.type().parameterList(), 0); // lengthen h1
+else
+ h2 = dropArgumentsToMatch(h2, 0, h1.type().parameterList(), 0); // lengthen h2
+MethodHandle h3 = guardWithTest(h0, h1, h2);
+assertEquals("xy", h3.invoke("x", "y", 1, "a", "b", "c"));
+ * }</pre></blockquote>
+ * @param target the method handle to adapt
+ * @param skip number of targets parameters to disregard (they will be unchanged)
+ * @param newTypes the desired argument list of the method handle
+ * @param pos place in {@code newTypes} where the non-skipped target parameters must occur
+ * @return a possibly adapted method handle
+ * @throws NullPointerException if either argument is null
+ * @throws IllegalArgumentException
+ * if either index is out of range in its corresponding list, or
+ * if the non-skipped target parameter types match the new types at {@code pos}
+ * @since 9
+ */
+ public static
+ MethodHandle dropArgumentsToMatch(MethodHandle target, int skip, List<Class<?>> newTypes, int pos) {
+ Objects.requireNonNull(target);
+ Objects.requireNonNull(newTypes);
+ return dropArgumentsToMatch(target, skip, newTypes, pos, false);
+ }
+
/**
* Adapts a target method handle by pre-processing
* one or more of its arguments, each with its own unary filter function,
@@ -3699,13 +3832,9 @@
if (gtype.returnType() != boolean.class)
throw newIllegalArgumentException("guard type is not a predicate "+gtype);
List<Class<?>> targs = ttype.parameterList();
- List<Class<?>> gargs = gtype.parameterList();
- if (!targs.equals(gargs)) {
- int gpc = gargs.size(), tpc = targs.size();
- if (gpc >= tpc || !targs.subList(0, gpc).equals(gargs))
- throw misMatchedTypes("target and test types", ttype, gtype);
- test = dropArguments(test, gpc, targs.subList(gpc, tpc));
- gtype = test.type();
+ test = dropArgumentsToMatch(test, 0, targs, 0, true);
+ if (test == null) {
+ throw misMatchedTypes("target and test types", ttype, gtype);
}
return MethodHandleImpl.makeGuardWithTest(test, target, fallback);
}
@@ -3777,15 +3906,9 @@
throw newIllegalArgumentException("handler does not accept exception type "+exType);
if (htype.returnType() != ttype.returnType())
throw misMatchedTypes("target and handler return types", ttype, htype);
- List<Class<?>> targs = ttype.parameterList();
- List<Class<?>> hargs = htype.parameterList();
- hargs = hargs.subList(1, hargs.size()); // omit leading parameter from handler
- if (!targs.equals(hargs)) {
- int hpc = hargs.size(), tpc = targs.size();
- if (hpc >= tpc || !targs.subList(0, hpc).equals(hargs))
- throw misMatchedTypes("target and handler types", ttype, htype);
- handler = dropArguments(handler, 1+hpc, targs.subList(hpc, tpc));
- htype = handler.type();
+ handler = dropArgumentsToMatch(handler, 1, ttype.parameterList(), 0, true);
+ if (handler == null) {
+ throw misMatchedTypes("target and handler types", ttype, htype);
}
return MethodHandleImpl.makeGuardWithCatch(target, exType, handler);
}
@@ -4043,16 +4166,16 @@
for (int i = 0; i < nclauses; ++i) {
Class<?> t = iterationVariableTypes.get(i);
if (init.get(i) == null) {
- init.set(i, zeroHandle(t));
+ init.set(i, empty(MethodType.methodType(t, commonSuffix)));
}
if (step.get(i) == null) {
- step.set(i, dropArguments(t == void.class ? zeroHandle(t) : identity(t), 0, commonPrefix.subList(0, i)));
+ step.set(i, dropArgumentsToMatch(identityOrVoid(t), 0, commonParameterSequence, i));
}
if (pred.get(i) == null) {
- pred.set(i, constant(boolean.class, true));
+ pred.set(i, dropArguments(constant(boolean.class, true), 0, commonParameterSequence));
}
if (fini.get(i) == null) {
- fini.set(i, zeroHandle(t));
+ fini.set(i, empty(MethodType.methodType(t, commonParameterSequence)));
}
}
@@ -4146,7 +4269,7 @@
* @since 9
*/
public static MethodHandle whileLoop(MethodHandle init, MethodHandle pred, MethodHandle body) {
- MethodHandle fin = init == null ? zeroHandle(void.class) : identity(init.type().returnType());
+ MethodHandle fin = init == null ? zero(void.class) : identity(init.type().returnType());
MethodHandle[] checkExit = {null, null, pred, fin};
MethodHandle[] varBody = {init, body};
return loop(checkExit, varBody);
@@ -4212,7 +4335,7 @@
* @since 9
*/
public static MethodHandle doWhileLoop(MethodHandle init, MethodHandle body, MethodHandle pred) {
- MethodHandle fin = init == null ? zeroHandle(void.class) : identity(init.type().returnType());
+ MethodHandle fin = init == null ? zero(void.class) : identity(init.type().returnType());
MethodHandle[] clause = {init, body, pred, fin};
return loop(clause);
}
@@ -4322,11 +4445,13 @@
* <blockquote><pre>{@code
* MethodHandle countedLoop(MethodHandle start, MethodHandle end, MethodHandle init, MethodHandle body) {
* MethodHandle returnVar = dropArguments(identity(init.type().returnType()), 0, int.class, int.class);
- * // assume MH_increment and MH_lessThan are handles to x+1 and x<y of type int
+ * // assume MH_increment and MH_lessThan are handles to x+1 and x<y of type int,
+ * // assume MH_decrement is a handle to x-1 of type int
* MethodHandle[]
* indexVar = {start, MH_increment}, // i = start; i = i+1
* loopLimit = {end, null, MH_lessThan, returnVar }, // i<end
- * bodyClause = {init, dropArguments(body, 1, int.class)}; // v = body(i, v);
+ * bodyClause = {init,
+ * filterArgument(dropArguments(body, 1, int.class), 0, MH_decrement}; // v = body(i-1, v)
* return loop(indexVar, loopLimit, bodyClause);
* }
* }</pre></blockquote>
@@ -4347,11 +4472,13 @@
* @since 9
*/
public static MethodHandle countedLoop(MethodHandle start, MethodHandle end, MethodHandle init, MethodHandle body) {
- MethodHandle returnVar = dropArguments(init == null ? zeroHandle(void.class) : identity(init.type().returnType()),
+ MethodHandle returnVar = dropArguments(init == null ? zero(void.class) : identity(init.type().returnType()),
0, int.class, int.class);
MethodHandle[] indexVar = {start, MethodHandleImpl.getConstantHandle(MethodHandleImpl.MH_countedLoopStep)};
MethodHandle[] loopLimit = {end, null, MethodHandleImpl.getConstantHandle(MethodHandleImpl.MH_countedLoopPred), returnVar};
- MethodHandle[] bodyClause = {init, dropArguments(body, 1, int.class)};
+ MethodHandle[] bodyClause = {init,
+ filterArgument(dropArguments(body, 1, int.class), 0,
+ MethodHandleImpl.getConstantHandle(MethodHandleImpl.MH_decrementCounter))};
return loop(indexVar, loopLimit, bodyClause);
}
@@ -4448,7 +4575,7 @@
Class<?> ttype = body.type().parameterType(0);
MethodHandle returnVar =
- dropArguments(init == null ? zeroHandle(void.class) : identity(init.type().returnType()), 0, itype);
+ dropArguments(init == null ? zero(void.class) : identity(init.type().returnType()), 0, itype);
MethodHandle initnx = MethodHandleImpl.getConstantHandle(MethodHandleImpl.MH_iterateNext);
MethodHandle nextVal = initnx.asType(initnx.type().changeReturnType(ttype));
@@ -4542,15 +4669,11 @@
checkTryFinally(target, cleanup);
// Match parameter lists: if the cleanup has a shorter parameter list than the target, add ignored arguments.
- int tpSize = targetParamTypes.size();
- int cpPrefixLength = rtype == void.class ? 1 : 2;
- int cpSize = cleanupParamTypes.size();
- MethodHandle aCleanup = cpSize - cpPrefixLength < tpSize ?
- dropArguments(cleanup, cpSize, targetParamTypes.subList(tpSize - (cpSize - cpPrefixLength), tpSize)) :
- cleanup;
-
+ // The cleanup parameter list (minus the leading Throwable and result parameters) must be a sublist of the
+ // target parameter list.
+ cleanup = dropArgumentsToMatch(cleanup, (rtype == void.class ? 1 : 2), targetParamTypes, 0);
MethodHandle aTarget = target.asSpreader(Object[].class, target.type().parameterCount());
- aCleanup = aCleanup.asSpreader(Object[].class, tpSize);
+ MethodHandle aCleanup = cleanup.asSpreader(Object[].class, targetParamTypes.size());
return MethodHandleImpl.makeTryFinally(aTarget, aCleanup, rtype, targetParamTypes);
}
@@ -4641,16 +4764,6 @@
return result;
}
- /**
- * Wrap creation of a proper zero handle for a given type.
- *
- * @param type the type.
- *
- * @return a zero value for the given type.
- */
- static MethodHandle zeroHandle(Class<?> type) {
- return type.isPrimitive() ? zero(Wrapper.forPrimitiveType(type), type) : zero(Wrapper.OBJECT, type);
- }
private static void checkLoop0(MethodHandle[][] clauses) {
if (clauses == null || clauses.length == 0) {
--- a/jdk/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java Thu Apr 14 09:32:37 2016 -0700
@@ -34,11 +34,11 @@
import java.lang.invoke.MethodHandles.Lookup;
import java.security.AccessController;
-import java.security.PrivilegedAction;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.function.Function;
+import sun.security.action.GetPropertyAction;
import static jdk.internal.org.objectweb.asm.Opcodes.*;
@@ -188,20 +188,14 @@
private static final ProxyClassesDumper DUMPER;
static {
- // Poke the privileged block once, taking everything we need:
- final Object[] values = new Object[4];
- AccessController.doPrivileged((PrivilegedAction<Object>) () -> {
- values[0] = System.getProperty("java.lang.invoke.stringConcat");
- values[1] = Boolean.getBoolean("java.lang.invoke.stringConcat.cache");
- values[2] = Boolean.getBoolean("java.lang.invoke.stringConcat.debug");
- values[3] = System.getProperty("java.lang.invoke.stringConcat.dumpClasses");
- return null;
- });
-
- final String strategy = (String) values[0];
- CACHE_ENABLE = (Boolean) values[1];
- DEBUG = (Boolean) values[2];
- final String dumpPath = (String) values[3];
+ final String strategy = AccessController.doPrivileged(
+ new GetPropertyAction("java.lang.invoke.stringConcat"));
+ CACHE_ENABLE = Boolean.parseBoolean(AccessController.doPrivileged(
+ new GetPropertyAction("java.lang.invoke.stringConcat.cache")));
+ DEBUG = Boolean.parseBoolean(AccessController.doPrivileged(
+ new GetPropertyAction("java.lang.invoke.stringConcat.debug")));
+ final String dumpPath = AccessController.doPrivileged(
+ new GetPropertyAction("java.lang.invoke.stringConcat.dumpClasses"));
STRATEGY = (strategy == null) ? DEFAULT_STRATEGY : Strategy.valueOf(strategy);
CACHE = CACHE_ENABLE ? new ConcurrentHashMap<>() : null;
--- a/jdk/src/java.base/share/classes/java/lang/invoke/VarForm.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/VarForm.java Thu Apr 14 09:32:37 2016 -0700
@@ -69,13 +69,10 @@
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
}
}
}
--- a/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java Thu Apr 14 09:32:37 2016 -0700
@@ -31,8 +31,12 @@
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.Objects;
import java.util.function.BiFunction;
+import java.util.function.Function;
import static java.lang.invoke.MethodHandleStatics.UNSAFE;
import static java.lang.invoke.MethodHandleStatics.newInternalError;
@@ -152,7 +156,9 @@
* supported, which may also include documenting restrictions based on the
* variable type and whether a variable is read-only. If an access mode is not
* supported then the corresponding signature-polymorphic method will on
- * invocation throw an {@code UnsupportedOperationException}.
+ * invocation throw an {@code UnsupportedOperationException}. Factory methods
+ * should document any additional undeclared exceptions that may be thrown by
+ * access mode methods.
* The {@link #get get} access mode is supported for all
* VarHandle instances and the corresponding method never throws
* {@code UnsupportedOperationException}.
@@ -166,7 +172,7 @@
* Unless stated otherwise in the documentation of a factory method, the access
* modes {@code get} and {@code set} (if supported) provide atomic access for
* reference types and all primitives types, with the exception of {@code long}
- * and {@code double} on 32-bit platforms
+ * and {@code double} on 32-bit platforms.
*
* <p>Access modes will override any memory ordering effects specified at
* the declaration site of a variable. For example, a VarHandle accessing a
@@ -272,7 +278,7 @@
* <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)
@@ -465,6 +471,8 @@
* , statically represented using {@code Object}.
* @throws WrongMethodTypeException if the access mode type is not
* compatible with the caller's symbolic type descriptor.
+ * @throws ClassCastException if the access mode type is compatible with the
+ * caller's symbolic type descriptor, but a reference cast fails.
*/
public final native
@MethodHandle.PolymorphicSignature
@@ -489,6 +497,8 @@
* for this VarHandle.
* @throws WrongMethodTypeException if the access mode type is not
* compatible with the caller's symbolic type descriptor.
+ * @throws ClassCastException if the access mode type is compatible with the
+ * caller's symbolic type descriptor, but a reference cast fails.
*/
public final native
@MethodHandle.PolymorphicSignature
@@ -518,6 +528,8 @@
* for this VarHandle.
* @throws WrongMethodTypeException if the access mode type is not
* compatible with the caller's symbolic type descriptor.
+ * @throws ClassCastException if the access mode type is compatible with the
+ * caller's symbolic type descriptor, but a reference cast fails.
*/
public final native
@MethodHandle.PolymorphicSignature
@@ -534,6 +546,10 @@
* must match the access mode type that is the result of calling
* {@code accessModeType(VarHandle.AccessMode.setVolatile)} on this VarHandle.
*
+ * @apiNote
+ * Ignoring the many semantic differences from C and C++, this method has
+ * memory ordering effects compatible with {@code memory_order_seq_cst}.
+ *
* @param args the signature-polymorphic parameter list of the form
* {@code (CT, T newValue)}
* , statically represented using varargs.
@@ -541,9 +557,8 @@
* for this VarHandle.
* @throws WrongMethodTypeException if the access mode type is not
* compatible with the caller's symbolic type descriptor.
- * @apiNote Ignoring the many semantic differences from C and C++, this
- * method has memory ordering effects compatible with
- * {@code memory_order_seq_cst}.
+ * @throws ClassCastException if the access mode type is compatible with the
+ * caller's symbolic type descriptor, but a reference cast fails.
*/
public final native
@MethodHandle.PolymorphicSignature
@@ -571,6 +586,8 @@
* for this VarHandle.
* @throws WrongMethodTypeException if the access mode type is not
* compatible with the caller's symbolic type descriptor.
+ * @throws ClassCastException if the access mode type is compatible with the
+ * caller's symbolic type descriptor, but a reference cast fails.
*/
public final native
@MethodHandle.PolymorphicSignature
@@ -595,6 +612,8 @@
* for this VarHandle.
* @throws WrongMethodTypeException if the access mode type is not
* compatible with the caller's symbolic type descriptor.
+ * @throws ClassCastException if the access mode type is compatible with the
+ * caller's symbolic type descriptor, but a reference cast fails.
*/
public final native
@MethodHandle.PolymorphicSignature
@@ -614,6 +633,11 @@
* must match the access mode type that is the result of calling
* {@code accessModeType(VarHandle.AccessMode.getAcquire)} on this VarHandle.
*
+ * @apiNote
+ * Ignoring the many semantic differences from C and C++, this method has
+ * memory ordering effects compatible with {@code memory_order_acquire}
+ * ordering.
+ *
* @param args the signature-polymorphic parameter list of the form
* {@code (CT)}
* , statically represented using varargs.
@@ -624,9 +648,8 @@
* for this VarHandle.
* @throws WrongMethodTypeException if the access mode type is not
* compatible with the caller's symbolic type descriptor.
- * @apiNote Ignoring the many semantic differences from C and C++, this
- * method has memory ordering effects compatible with
- * {@code memory_order_acquire} ordering.
+ * @throws ClassCastException if the access mode type is compatible with the
+ * caller's symbolic type descriptor, but a reference cast fails.
*/
public final native
@MethodHandle.PolymorphicSignature
@@ -643,6 +666,11 @@
* must match the access mode type that is the result of calling
* {@code accessModeType(VarHandle.AccessMode.setRelease)} on this VarHandle.
*
+ * @apiNote
+ * Ignoring the many semantic differences from C and C++, this method has
+ * memory ordering effects compatible with {@code memory_order_release}
+ * ordering.
+ *
* @param args the signature-polymorphic parameter list of the form
* {@code (CT, T newValue)}
* , statically represented using varargs.
@@ -650,9 +678,8 @@
* for this VarHandle.
* @throws WrongMethodTypeException if the access mode type is not
* compatible with the caller's symbolic type descriptor.
- * @apiNote Ignoring the many semantic differences from C and C++, this
- * method has memory ordering effects compatible with
- * {@code memory_order_release} ordering.
+ * @throws ClassCastException if the access mode type is compatible with the
+ * caller's symbolic type descriptor, but a reference cast fails.
*/
public final native
@MethodHandle.PolymorphicSignature
@@ -685,6 +712,8 @@
* for this VarHandle.
* @throws WrongMethodTypeException if the access mode type is not
* compatible with the caller's symbolic type descriptor.
+ * @throws ClassCastException if the access mode type is compatible with the
+ * caller's symbolic type descriptor, but a reference cast fails.
* @see #setVolatile(Object...)
* @see #getVolatile(Object...)
*/
@@ -718,6 +747,8 @@
* for this VarHandle.
* @throws WrongMethodTypeException if the access mode type is not
* compatible with the caller's symbolic type descriptor.
+ * @throws ClassCastException if the access mode type is compatible with the
+ * caller's symbolic type descriptor, but a reference cast fails.
* @see #setVolatile(Object...)
* @see #getVolatile(Object...)
*/
@@ -751,6 +782,8 @@
* for this VarHandle.
* @throws WrongMethodTypeException if the access mode type is not
* compatible with the caller's symbolic type descriptor.
+ * @throws ClassCastException if the access mode type is compatible with the
+ * caller's symbolic type descriptor, but a reference cast fails.
* @see #set(Object...)
* @see #getAcquire(Object...)
*/
@@ -783,6 +816,8 @@
* for this VarHandle.
* @throws WrongMethodTypeException if the access mode type is not
* compatible with the caller's symbolic type descriptor.
+ * @throws ClassCastException if the access mode type is compatible with the
+ * caller's symbolic type descriptor, but a reference cast fails.
* @see #setRelease(Object...)
* @see #get(Object...)
*/
@@ -820,6 +855,8 @@
* for this VarHandle.
* @throws WrongMethodTypeException if the access mode type is not
* compatible with the caller's symbolic type descriptor.
+ * @throws ClassCastException if the access mode type is compatible with the
+ * caller's symbolic type descriptor, but a reference cast fails.
* @see #set(Object...)
* @see #get(Object...)
*/
@@ -855,6 +892,8 @@
* for this VarHandle.
* @throws WrongMethodTypeException if the access mode type is not
* compatible with the caller's symbolic type descriptor.
+ * @throws ClassCastException if the access mode type is compatible with the
+ * caller's symbolic type descriptor, but a reference cast fails.
* @see #set(Object...)
* @see #getAcquire(Object...)
*/
@@ -890,6 +929,8 @@
* for this VarHandle.
* @throws WrongMethodTypeException if the access mode type is not
* compatible with the caller's symbolic type descriptor.
+ * @throws ClassCastException if the access mode type is compatible with the
+ * caller's symbolic type descriptor, but a reference cast fails.
* @see #setRelease(Object...)
* @see #get(Object...)
*/
@@ -920,6 +961,8 @@
* for this VarHandle.
* @throws WrongMethodTypeException if the access mode type is not
* compatible with the caller's symbolic type descriptor.
+ * @throws ClassCastException if the access mode type is compatible with the
+ * caller's symbolic type descriptor, but a reference cast fails.
* @see #setVolatile(Object...)
* @see #getVolatile(Object...)
*/
@@ -954,6 +997,8 @@
* for this VarHandle.
* @throws WrongMethodTypeException if the access mode type is not
* compatible with the caller's symbolic type descriptor.
+ * @throws ClassCastException if the access mode type is compatible with the
+ * caller's symbolic type descriptor, but a reference cast fails.
* @see #setVolatile(Object...)
* @see #getVolatile(Object...)
*/
@@ -984,6 +1029,8 @@
* for this VarHandle.
* @throws WrongMethodTypeException if the access mode type is not
* compatible with the caller's symbolic type descriptor.
+ * @throws ClassCastException if the access mode type is compatible with the
+ * caller's symbolic type descriptor, but a reference cast fails.
* @see #setVolatile(Object...)
* @see #getVolatile(Object...)
*/
@@ -993,11 +1040,11 @@
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 +1083,179 @@
* 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);
@@ -1279,12 +1379,14 @@
UNSAFE.fullFence();
}
- static final BiFunction<Integer, Integer, ArrayIndexOutOfBoundsException> AIOOBE_SUPPLIER = new BiFunction<>() {
- @Override
- public ArrayIndexOutOfBoundsException apply(Integer a, Integer b) {
- return new ArrayIndexOutOfBoundsException(a, b);
- }
- };
+ static final BiFunction<String, List<Integer>, ArrayIndexOutOfBoundsException>
+ AIOOBE_SUPPLIER = Objects.outOfBoundsExceptionFormatter(
+ new Function<String, ArrayIndexOutOfBoundsException>() {
+ @Override
+ public ArrayIndexOutOfBoundsException apply(String s) {
+ return new ArrayIndexOutOfBoundsException(s);
+ }
+ });
private static final long VFORM_OFFSET;
--- a/jdk/src/java.base/share/classes/java/lang/reflect/Proxy.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/Proxy.java Thu Apr 14 09:32:37 2016 -0700
@@ -689,13 +689,14 @@
}
/*
- * Returns all types referenced by all public method signatures of
+ * Returns all types referenced by all public non-static method signatures of
* the proxy interfaces
*/
private static Set<Class<?>> referencedTypes(ClassLoader loader,
List<Class<?>> interfaces) {
return interfaces.stream()
.flatMap(intf -> Stream.of(intf.getMethods())
+ .filter(m -> !Modifier.isStatic(m.getModifiers()))
.flatMap(ProxyBuilder::methodRefTypes)
.map(ProxyBuilder::getElementType)
.filter(t -> !t.isPrimitive()))
@@ -795,26 +796,13 @@
// map to dynamic proxy module and add reads edge and qualified exports, if necessary
Module target = getDynamicModule(loader);
- // set up proxy class access to proxy interfaces and superinterfaces
- Deque<Class<?>> deque = new LinkedList<>(interfaces);
- Set<Class<?>> visited = new HashSet<>();
- while (!deque.isEmpty()) {
- Class<?> c = deque.poll();
- if (!visited.add(c)) {
- continue;
- }
+ // set up proxy class access to proxy interfaces and types
+ // referenced in the method signature
+ Set<Class<?>> types = new HashSet<>(interfaces);
+ types.addAll(refTypes);
+ for (Class<?> c : types) {
ensureAccess(target, c);
-
- // add all superinterfaces
- for (Class<?> intf : c.getInterfaces()) {
- deque.add(intf);
- }
}
-
- // set up proxy class access to types referenced in the method signature
- refTypes.stream()
- .filter(t -> !visited.contains(t))
- .forEach(t -> ensureAccess(target, t));
return target;
}
--- a/jdk/src/java.base/share/classes/java/net/URLClassLoader.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/net/URLClassLoader.java Thu Apr 14 09:32:37 2016 -0700
@@ -465,23 +465,21 @@
}
/**
- * Defines a new package by name in this ClassLoader. The attributes
- * contained in the specified Manifest will be used to obtain package
- * version and sealing information. For sealed packages, the additional
- * URL specifies the code source URL from which the package was loaded.
+ * Defines a new package by name in this {@code URLClassLoader}.
+ * The attributes contained in the specified {@code Manifest}
+ * will be used to obtain package version and sealing information.
+ * For sealed packages, the additional URL specifies the code source URL
+ * from which the package was loaded.
*
* @param name the package name
- * @param man the Manifest containing package version and sealing
+ * @param man the {@code Manifest} containing package version and sealing
* information
* @param url the code source url for the package, or null if none
- * @exception IllegalArgumentException if the package name duplicates
- * an existing package either in this class loader or one
- * of its ancestors
- * @return the newly defined Package object
+ * @throws IllegalArgumentException if the package name is
+ * already defined by this class loader
+ * @return the newly defined {@code Package} object
*/
- protected Package definePackage(String name, Manifest man, URL url)
- throws IllegalArgumentException
- {
+ protected Package definePackage(String name, Manifest man, URL url) {
String path = name.replace('.', '/').concat("/");
String specTitle = null, specVersion = null, specVendor = null;
String implTitle = null, implVersion = null, implVendor = null;
--- a/jdk/src/java.base/share/classes/java/nio/file/Files.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/nio/file/Files.java Thu Apr 14 09:32:37 2016 -0700
@@ -77,6 +77,8 @@
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
+import sun.nio.fs.AbstractFileSystemProvider;
+
/**
* This class consists exclusively of static methods that operate on files,
* directories, or other types of files.
@@ -2193,6 +2195,12 @@
* method denies read access to the file.
*/
public static boolean isDirectory(Path path, LinkOption... options) {
+ if (options.length == 0) {
+ FileSystemProvider provider = provider(path);
+ if (provider instanceof AbstractFileSystemProvider)
+ return ((AbstractFileSystemProvider)provider).isDirectory(path);
+ }
+
try {
return readAttributes(path, BasicFileAttributes.class, options).isDirectory();
} catch (IOException ioe) {
@@ -2230,6 +2238,12 @@
* method denies read access to the file.
*/
public static boolean isRegularFile(Path path, LinkOption... options) {
+ if (options.length == 0) {
+ FileSystemProvider provider = provider(path);
+ if (provider instanceof AbstractFileSystemProvider)
+ return ((AbstractFileSystemProvider)provider).isRegularFile(path);
+ }
+
try {
return readAttributes(path, BasicFileAttributes.class, options).isRegularFile();
} catch (IOException ioe) {
@@ -2385,6 +2399,12 @@
* @see #notExists
*/
public static boolean exists(Path path, LinkOption... options) {
+ if (options.length == 0) {
+ FileSystemProvider provider = provider(path);
+ if (provider instanceof AbstractFileSystemProvider)
+ return ((AbstractFileSystemProvider)provider).exists(path);
+ }
+
try {
if (followLinks(options)) {
provider(path).checkAccess(path);
--- a/jdk/src/java.base/share/classes/java/security/AlgorithmParameterGenerator.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/security/AlgorithmParameterGenerator.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -140,7 +140,8 @@
*
* @implNote
* The JDK Reference Implementation additionally uses the
- * {@code jdk.security.provider.preferred} property to determine
+ * {@code jdk.security.provider.preferred}
+ * {@link Security#getProperty(String) Security} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
--- a/jdk/src/java.base/share/classes/java/security/AlgorithmParameters.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/security/AlgorithmParameters.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -128,7 +128,8 @@
*
* @implNote
* The JDK Reference Implementation additionally uses the
- * {@code jdk.security.provider.preferred} property to determine
+ * {@code jdk.security.provider.preferred}
+ * {@link Security#getProperty(String) Security} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
--- a/jdk/src/java.base/share/classes/java/security/KeyFactory.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/security/KeyFactory.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -155,7 +155,8 @@
*
* @implNote
* The JDK Reference Implementation additionally uses the
- * {@code jdk.security.provider.preferred} property to determine
+ * {@code jdk.security.provider.preferred}
+ * {@link Security#getProperty(String) Security} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
--- a/jdk/src/java.base/share/classes/java/security/KeyPairGenerator.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/security/KeyPairGenerator.java Thu Apr 14 09:32:37 2016 -0700
@@ -197,7 +197,8 @@
*
* @implNote
* The JDK Reference Implementation additionally uses the
- * {@code jdk.security.provider.preferred} property to determine
+ * {@code jdk.security.provider.preferred}
+ * {@link Security#getProperty(String) Security} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
--- a/jdk/src/java.base/share/classes/java/security/KeyStore.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/security/KeyStore.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -843,7 +843,8 @@
*
* @implNote
* The JDK Reference Implementation additionally uses the
- * {@code jdk.security.provider.preferred} property to determine
+ * {@code jdk.security.provider.preferred}
+ * {@link Security#getProperty(String) Security} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
--- a/jdk/src/java.base/share/classes/java/security/MessageDigest.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/security/MessageDigest.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -148,7 +148,8 @@
*
* @implNote
* The JDK Reference Implementation additionally uses the
- * {@code jdk.security.provider.preferred} property to determine
+ * {@code jdk.security.provider.preferred}
+ * {@link Security#getProperty(String) Security} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
--- a/jdk/src/java.base/share/classes/java/security/Policy.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/security/Policy.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -357,7 +357,8 @@
*
* @implNote
* The JDK Reference Implementation additionally uses the
- * {@code jdk.security.provider.preferred} property to determine
+ * {@code jdk.security.provider.preferred}
+ * {@link Security#getProperty(String) Security} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
--- a/jdk/src/java.base/share/classes/java/security/SecureRandom.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/security/SecureRandom.java Thu Apr 14 09:32:37 2016 -0700
@@ -270,7 +270,8 @@
*
* @implNote
* The JDK Reference Implementation additionally uses the
- * {@code jdk.security.provider.preferred} property to determine
+ * {@code jdk.security.provider.preferred}
+ * {@link Security#getProperty(String) Security} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
--- a/jdk/src/java.base/share/classes/java/security/Signature.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/security/Signature.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -205,7 +205,8 @@
*
* @implNote
* The JDK Reference Implementation additionally uses the
- * {@code jdk.security.provider.preferred} property to determine
+ * {@code jdk.security.provider.preferred}
+ * {@link Security#getProperty(String) Security} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
--- a/jdk/src/java.base/share/classes/java/security/cert/CertPathBuilder.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/security/cert/CertPathBuilder.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -144,7 +144,8 @@
*
* @implNote
* The JDK Reference Implementation additionally uses the
- * {@code jdk.security.provider.preferred} property to determine
+ * {@code jdk.security.provider.preferred}
+ * {@link Security#getProperty(String) Security} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
--- a/jdk/src/java.base/share/classes/java/security/cert/CertPathValidator.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/security/cert/CertPathValidator.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -145,7 +145,8 @@
*
* @implNote
* The JDK Reference Implementation additionally uses the
- * {@code jdk.security.provider.preferred} property to determine
+ * {@code jdk.security.provider.preferred}
+ * {@link Security#getProperty(String) Security} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
--- a/jdk/src/java.base/share/classes/java/security/cert/CertStore.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/security/cert/CertStore.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -203,7 +203,8 @@
*
* @implNote
* The JDK Reference Implementation additionally uses the
- * {@code jdk.security.provider.preferred} property to determine
+ * {@code jdk.security.provider.preferred}
+ * {@link Security#getProperty(String) Security} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
--- a/jdk/src/java.base/share/classes/java/security/cert/CertificateFactory.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/security/cert/CertificateFactory.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -165,7 +165,8 @@
*
* @implNote
* The JDK Reference Implementation additionally uses the
- * {@code jdk.security.provider.preferred} property to determine
+ * {@code jdk.security.provider.preferred}
+ * {@link Security#getProperty(String) Security} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
--- a/jdk/src/java.base/share/classes/java/time/Duration.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/time/Duration.java Thu Apr 14 09:32:37 2016 -0700
@@ -1350,6 +1350,48 @@
return nanos;
}
+
+ //-----------------------------------------------------------------------
+ /**
+ * Returns a copy of this {@code Duration} truncated to the specified unit.
+ * <p>
+ * Truncating the duration returns a copy of the original with conceptual fields
+ * smaller than the specified unit set to zero.
+ * For example, truncating with the {@link ChronoUnit#MINUTES MINUTES} unit will
+ * round down to the nearest minute, setting the seconds and nanoseconds to zero.
+ * <p>
+ * The unit must have a {@linkplain TemporalUnit#getDuration() duration}
+ * that divides into the length of a standard day without remainder.
+ * This includes all supplied time units on {@link ChronoUnit} and
+ * {@link ChronoUnit#DAYS DAYS}. Other ChronoUnits throw an exception.
+ * <p>
+ * This instance is immutable and unaffected by this method call.
+ *
+ * @param unit the unit to truncate to, not null
+ * @return a {@code Duration} based on this duration with the time truncated, not null
+ * @throws DateTimeException if the unit is invalid for truncation
+ * @throws UnsupportedTemporalTypeException if the unit is not supported
+ */
+ public Duration truncatedTo(TemporalUnit unit) {
+ Objects.requireNonNull(unit, "unit");
+ if (unit == ChronoUnit.SECONDS && (seconds >= 0 || nanos == 0)) {
+ return new Duration(seconds, 0);
+ } else if (unit == ChronoUnit.NANOS) {
+ return this;
+ }
+ Duration unitDur = unit.getDuration();
+ if (unitDur.getSeconds() > LocalTime.SECONDS_PER_DAY) {
+ throw new UnsupportedTemporalTypeException("Unit is too large to be used for truncation");
+ }
+ long dur = unitDur.toNanos();
+ if ((LocalTime.NANOS_PER_DAY % dur) != 0) {
+ throw new UnsupportedTemporalTypeException("Unit must divide into a standard day without remainder");
+ }
+ long nod = (seconds % LocalTime.SECONDS_PER_DAY) * LocalTime.NANOS_PER_SECOND + nanos;
+ long result = (nod / dur) * dur ;
+ return plusNanos(result - nod);
+ }
+
//-----------------------------------------------------------------------
/**
* Compares this duration to the specified {@code Duration}.
--- a/jdk/src/java.base/share/classes/java/util/Objects.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/util/Objects.java Thu Apr 14 09:32:37 2016 -0700
@@ -25,26 +25,28 @@
package java.util;
+import jdk.internal.HotSpotIntrinsicCandidate;
+
import java.util.function.BiFunction;
+import java.util.function.Function;
import java.util.function.Supplier;
-import jdk.internal.HotSpotIntrinsicCandidate;
/**
* This class consists of {@code static} utility methods for operating
* on objects, or checking certain conditions before operation. These utilities
* include {@code null}-safe or {@code null}-tolerant methods for computing the
* hash code of an object, returning a string for an object, comparing two
- * objects, and checking if indexes or sub-range values are out of bounds.
+ * objects, and checking if indexes or sub-range values are out-of-bounds.
*
* @apiNote
* Static methods such as {@link Objects#checkIndex},
* {@link Objects#checkFromToIndex}, and {@link Objects#checkFromIndexSize} are
* provided for the convenience of checking if values corresponding to indexes
- * and sub-ranges are out of bounds.
+ * and sub-ranges are out-of-bounds.
* Variations of these static methods support customization of the runtime
* exception, and corresponding exception detail message, that is thrown when
- * values are out of bounds. Such methods accept a functional interface
- * argument, instances of {@code BiFunction}, that maps out of bound values to a
+ * values are out-of-bounds. Such methods accept a functional interface
+ * argument, instances of {@code BiFunction}, that maps out-of-bound values to a
* runtime exception. Care should be taken when using such methods in
* combination with an argument that is a lambda expression, method reference or
* class that capture values. In such cases the cost of capture, related to
@@ -347,29 +349,176 @@
}
/**
- * Maps out of bounds values to a runtime exception.
+ * Maps out-of-bounds values to a runtime exception.
*
- * @param a the first out of bound value
- * @param b the second out of bound value
- * @param oobe the exception mapping function that when applied with out of
- * bounds arguments returns a runtime exception. If {@code null}
- * then, it is as if an exception mapping function was supplied that
- * returns {@link IndexOutOfBoundsException} for any given arguments.
+ * @param checkKind the kind of bounds check, whose name may correspond
+ * to the name of one of the range check methods, checkIndex,
+ * checkFromToIndex, checkFromIndexSize
+ * @param args the out-of-bounds arguments that failed the range check.
+ * If the checkKind corresponds a the name of a range check method
+ * then the bounds arguments are those that can be passed in order
+ * to the method.
+ * @param oobef the exception formatter that when applied with a checkKind
+ * and a list out-of-bounds arguments returns a runtime exception.
+ * If {@code null} then, it is as if an exception formatter was
+ * supplied that returns {@link IndexOutOfBoundsException} for any
+ * given arguments.
* @return the runtime exception
*/
private static RuntimeException outOfBounds(
- int a, int b, BiFunction<Integer, Integer, ? extends RuntimeException> oobe) {
- RuntimeException e = oobe == null
- ? null : oobe.apply(a, b);
+ BiFunction<String, List<Integer>, ? extends RuntimeException> oobef,
+ String checkKind,
+ Integer... args) {
+ List<Integer> largs = List.of(args);
+ RuntimeException e = oobef == null
+ ? null : oobef.apply(checkKind, largs);
return e == null
- ? new IndexOutOfBoundsException(a, b) : e;
+ ? new IndexOutOfBoundsException(outOfBoundsMessage(checkKind, largs)) : e;
+ }
+
+ // Specific out-of-bounds exception producing methods that avoid
+ // the varargs-based code in the critical methods there by reducing their
+ // the byte code size, and therefore less likely to peturb inlining
+
+ private static RuntimeException outOfBoundsCheckIndex(
+ BiFunction<String, List<Integer>, ? extends RuntimeException> oobe,
+ int index, int length) {
+ return outOfBounds(oobe, "checkIndex", index, length);
+ }
+
+ private static RuntimeException outOfBoundsCheckFromToIndex(
+ BiFunction<String, List<Integer>, ? extends RuntimeException> oobe,
+ int fromIndex, int toIndex, int length) {
+ return outOfBounds(oobe, "checkFromToIndex", fromIndex, toIndex, length);
+ }
+
+ private static RuntimeException outOfBoundsCheckFromIndexSize(
+ BiFunction<String, List<Integer>, ? extends RuntimeException> oobe,
+ int fromIndex, int size, int length) {
+ return outOfBounds(oobe, "checkFromIndexSize", fromIndex, size, length);
+ }
+
+ /**
+ * Returns an out-of-bounds exception formatter from an given exception
+ * factory. The exception formatter is a function that formats an
+ * out-of-bounds message from its arguments and applies that message to the
+ * given exception factory to produce and relay an exception.
+ *
+ * <p>The exception formatter accepts two arguments: a {@code String}
+ * describing the out-of-bounds range check that failed, referred to as the
+ * <em>check kind</em>; and a {@code List<Integer>} containing the
+ * out-of-bound integer values that failed the check. The list of
+ * out-of-bound values is not modified.
+ *
+ * <p>Three check kinds are supported {@code checkIndex},
+ * {@code checkFromToIndex} and {@code checkFromIndexSize} corresponding
+ * respectively to the specified application of an exception formatter as an
+ * argument to the out-of-bounds range check methods
+ * {@link #checkIndex(int, int, BiFunction) checkIndex},
+ * {@link #checkFromToIndex(int, int, int, BiFunction) checkFromToIndex}, and
+ * {@link #checkFromIndexSize(int, int, int, BiFunction) checkFromIndexSize}.
+ * Thus a supported check kind corresponds to a method name and the
+ * out-of-bound integer values correspond to method argument values, in
+ * order, preceding the exception formatter argument (similar in many
+ * respects to the form of arguments required for a reflective invocation of
+ * such a range check method).
+ *
+ * <p>Formatter arguments conforming to such supported check kinds will
+ * produce specific exception messages describing failed out-of-bounds
+ * checks. Otherwise, more generic exception messages will be produced in
+ * any of the following cases: the check kind is supported but fewer
+ * or more out-of-bounds values are supplied, the check kind is not
+ * supported, the check kind is {@code null}, or the list of out-of-bound
+ * values is {@code null}.
+ *
+ * @apiNote
+ * This method produces an out-of-bounds exception formatter that can be
+ * passed as an argument to any of the supported out-of-bounds range check
+ * methods declared by {@code Objects}. For example, a formatter producing
+ * an {@code ArrayIndexOutOfBoundsException} may be produced and stored on a
+ * {@code static final} field as follows:
+ * <pre>{@code
+ * static final
+ * BiFunction<String, List<Integer>, ArrayIndexOutOfBoundsException> AIOOBEF =
+ * outOfBoundsExceptionFormatter(ArrayIndexOutOfBoundsException::new);
+ * }</pre>
+ * The formatter instance {@code AIOOBEF} may be passed as an argument to an
+ * out-of-bounds range check method, such as checking if an {@code index}
+ * is within the bounds of a {@code limit}:
+ * <pre>{@code
+ * checkIndex(index, limit, AIOOBEF);
+ * }</pre>
+ * If the bounds check fails then the range check method will throw an
+ * {@code ArrayIndexOutOfBoundsException} with an appropriate exception
+ * message that is a produced from {@code AIOOBEF} as follows:
+ * <pre>{@code
+ * AIOOBEF.apply("checkIndex", List.of(index, limit));
+ * }</pre>
+ *
+ * @param f the exception factory, that produces an exception from a message
+ * where the message is produced and formatted by the returned
+ * exception formatter. If this factory is stateless and side-effect
+ * free then so is the returned formatter.
+ * Exceptions thrown by the factory are relayed to the caller
+ * of the returned formatter.
+ * @param <X> the type of runtime exception to be returned by the given
+ * exception factory and relayed by the exception formatter
+ * @return the out-of-bounds exception formatter
+ */
+ public static <X extends RuntimeException>
+ BiFunction<String, List<Integer>, X> outOfBoundsExceptionFormatter(Function<String, X> f) {
+ // Use anonymous class to avoid bootstrap issues if this method is
+ // used early in startup
+ return new BiFunction<String, List<Integer>, X>() {
+ @Override
+ public X apply(String checkKind, List<Integer> args) {
+ return f.apply(outOfBoundsMessage(checkKind, args));
+ }
+ };
+ }
+
+ private static String outOfBoundsMessage(String checkKind, List<Integer> args) {
+ if (checkKind == null && args == null) {
+ return String.format("Range check failed");
+ } else if (checkKind == null) {
+ return String.format("Range check failed: %s", args);
+ } else if (args == null) {
+ return String.format("Range check failed: %s", checkKind);
+ }
+
+ int argSize = 0;
+ switch (checkKind) {
+ case "checkIndex":
+ argSize = 2;
+ break;
+ case "checkFromToIndex":
+ case "checkFromIndexSize":
+ argSize = 3;
+ break;
+ default:
+ }
+
+ // Switch to default if fewer or more arguments than required are supplied
+ switch ((args.size() != argSize) ? "" : checkKind) {
+ case "checkIndex":
+ return String.format("Index %d out-of-bounds for length %d",
+ args.get(0), args.get(1));
+ case "checkFromToIndex":
+ return String.format("Range [%d, %d) out-of-bounds for length %d",
+ args.get(0), args.get(1), args.get(2));
+ case "checkFromIndexSize":
+ return String.format("Range [%d, %<d + %d) out-of-bounds for length %d",
+ args.get(0), args.get(1), args.get(2));
+ default:
+ return String.format("Range check failed: %s %s", checkKind, args);
+ }
}
/**
* Checks if the {@code index} is within the bounds of the range from
* {@code 0} (inclusive) to {@code length} (exclusive).
*
- * <p>The {@code index} is defined to be out of bounds if any of the
+ * <p>The {@code index} is defined to be out-of-bounds if any of the
* following inequalities is true:
* <ul>
* <li>{@code index < 0}</li>
@@ -377,14 +526,20 @@
* <li>{@code length < 0}, which is implied from the former inequalities</li>
* </ul>
*
+ * <p>This method behaves as if {@link #checkIndex(int, int, BiFunction)}
+ * was called with same out-of-bounds arguments and an exception formatter
+ * argument produced from an invocation of
+ * {@code outOfBoundsExceptionFormatter(IndexOutOfBounds::new)} (though it may
+ * be more efficient).
+ *
* @param index the index
* @param length the upper-bound (exclusive) of the range
* @return {@code index} if it is within bounds of the range
- * @throws IndexOutOfBoundsException if the {@code index} is out of bounds
+ * @throws IndexOutOfBoundsException if the {@code index} is out-of-bounds
* @since 9
*/
public static
- int checkIndex(int index, int length) throws IndexOutOfBoundsException {
+ int checkIndex(int index, int length) {
return checkIndex(index, length, null);
}
@@ -392,7 +547,7 @@
* Checks if the {@code index} is within the bounds of the range from
* {@code 0} (inclusive) to {@code length} (exclusive).
*
- * <p>The {@code index} is defined to be out of bounds if any of the
+ * <p>The {@code index} is defined to be out-of-bounds if any of the
* following inequalities is true:
* <ul>
* <li>{@code index < 0}</li>
@@ -400,40 +555,42 @@
* <li>{@code length < 0}, which is implied from the former inequalities</li>
* </ul>
*
- * <p>If the {@code index} is out of bounds, then a runtime exception is
- * thrown that is the result of applying the arguments {@code index} and
- * {@code length} to the given exception mapping function.
+ * <p>If the {@code index} is out-of-bounds, then a runtime exception is
+ * thrown that is the result of applying the following arguments to the
+ * exception formatter: the name of this method, {@code checkIndex};
+ * and an unmodifiable list integers whose values are, in order, the
+ * out-of-bounds arguments {@code index} and {@code length}.
*
- * @param <T> the type of runtime exception to throw if the arguments are
- * out of bounds
+ * @param <X> the type of runtime exception to throw if the arguments are
+ * out-of-bounds
* @param index the index
* @param length the upper-bound (exclusive) of the range
- * @param oobe the exception mapping function that when applied with out
- * of bounds arguments returns a runtime exception. If {@code null}
- * or returns {@code null} then, it is as if an exception mapping
- * function was supplied that returns
- * {@link IndexOutOfBoundsException} for any given arguments.
- * Exceptions thrown by the function are relayed to the caller.
+ * @param oobef the exception formatter that when applied with this
+ * method name and out-of-bounds arguments returns a runtime
+ * exception. If {@code null} or returns {@code null} then, it is as
+ * if an exception formatter produced from an invocation of
+ * {@code outOfBoundsExceptionFormatter(IndexOutOfBounds::new)} is used
+ * instead (though it may be more efficient).
+ * Exceptions thrown by the formatter are relayed to the caller.
* @return {@code index} if it is within bounds of the range
- * @throws T if the {@code index} is out of bounds, then a runtime exception
- * is thrown that is the result of applying the out of bounds
- * arguments to the exception mapping function.
- * @throws IndexOutOfBoundsException if the {@code index} is out of bounds
- * and the exception mapping function is {@code null}
+ * @throws X if the {@code index} is out-of-bounds and the exception
+ * formatter is non-{@code null}
+ * @throws IndexOutOfBoundsException if the {@code index} is out-of-bounds
+ * and the exception formatter is {@code null}
* @since 9
*
* @implNote
- * This method is made intrinsic in optimizing compilers to guide
- * them to perform unsigned comparisons of the index and length
- * when it is known the length is a non-negative value (such as
- * that of an array length or from the upper bound of a loop)
+ * This method is made intrinsic in optimizing compilers to guide them to
+ * perform unsigned comparisons of the index and length when it is known the
+ * length is a non-negative value (such as that of an array length or from
+ * the upper bound of a loop)
*/
@HotSpotIntrinsicCandidate
- public static <T extends RuntimeException>
+ public static <X extends RuntimeException>
int checkIndex(int index, int length,
- BiFunction<Integer, Integer, T> oobe) throws T, IndexOutOfBoundsException {
+ BiFunction<String, List<Integer>, X> oobef) {
if (index < 0 || index >= length)
- throw outOfBounds(index, length, oobe);
+ throw outOfBoundsCheckIndex(oobef, index, length);
return index;
}
@@ -442,7 +599,7 @@
* {@code toIndex} (exclusive) is within the bounds of range from {@code 0}
* (inclusive) to {@code length} (exclusive).
*
- * <p>The sub-range is defined to be out of bounds if any of the following
+ * <p>The sub-range is defined to be out-of-bounds if any of the following
* inequalities is true:
* <ul>
* <li>{@code fromIndex < 0}</li>
@@ -451,15 +608,21 @@
* <li>{@code length < 0}, which is implied from the former inequalities</li>
* </ul>
*
+ * <p>This method behaves as if {@link #checkFromToIndex(int, int, int, BiFunction)}
+ * was called with same out-of-bounds arguments and an exception formatter
+ * argument produced from an invocation of
+ * {@code outOfBoundsExceptionFormatter(IndexOutOfBounds::new)} (though it may
+ * be more efficient).
+ *
* @param fromIndex the lower-bound (inclusive) of the sub-range
* @param toIndex the upper-bound (exclusive) of the sub-range
* @param length the upper-bound (exclusive) the range
* @return {@code fromIndex} if the sub-range within bounds of the range
- * @throws IndexOutOfBoundsException if the sub-range is out of bounds
+ * @throws IndexOutOfBoundsException if the sub-range is out-of-bounds
* @since 9
*/
public static
- int checkFromToIndex(int fromIndex, int toIndex, int length) throws IndexOutOfBoundsException {
+ int checkFromToIndex(int fromIndex, int toIndex, int length) {
return checkFromToIndex(fromIndex, toIndex, length, null);
}
@@ -468,7 +631,7 @@
* {@code toIndex} (exclusive) is within the bounds of range from {@code 0}
* (inclusive) to {@code length} (exclusive).
*
- * <p>The sub-range is defined to be out of bounds if any of the following
+ * <p>The sub-range is defined to be out-of-bounds if any of the following
* inequalities is true:
* <ul>
* <li>{@code fromIndex < 0}</li>
@@ -477,34 +640,36 @@
* <li>{@code length < 0}, which is implied from the former inequalities</li>
* </ul>
*
- * <p>If the sub-range is out of bounds, then a runtime exception is thrown
- * that is the result of applying the arguments {@code fromIndex} and
- * {@code toIndex} to the given exception mapping function.
+ * <p>If the sub-range is out-of-bounds, then a runtime exception is
+ * thrown that is the result of applying the following arguments to the
+ * exception formatter: the name of this method, {@code checkFromToIndex};
+ * and an unmodifiable list integers whose values are, in order, the
+ * out-of-bounds arguments {@code fromIndex}, {@code toIndex}, and {@code length}.
*
- * @param <T> the type of runtime exception to throw if the arguments are
- * out of bounds
+ * @param <X> the type of runtime exception to throw if the arguments are
+ * out-of-bounds
* @param fromIndex the lower-bound (inclusive) of the sub-range
* @param toIndex the upper-bound (exclusive) of the sub-range
* @param length the upper-bound (exclusive) the range
- * @param oobe the exception mapping function that when applied with out
- * of bounds arguments returns a runtime exception. If {@code null}
- * or returns {@code null} then, it is as if an exception mapping
- * function was supplied that returns
- * {@link IndexOutOfBoundsException} for any given arguments.
- * Exceptions thrown by the function are relayed to the caller.
+ * @param oobef the exception formatter that when applied with this
+ * method name and out-of-bounds arguments returns a runtime
+ * exception. If {@code null} or returns {@code null} then, it is as
+ * if an exception formatter produced from an invocation of
+ * {@code outOfBoundsExceptionFormatter(IndexOutOfBounds::new)} is used
+ * instead (though it may be more efficient).
+ * Exceptions thrown by the formatter are relayed to the caller.
* @return {@code fromIndex} if the sub-range within bounds of the range
- * @throws T if the sub-range is out of bounds, then a runtime exception is
- * thrown that is the result of applying the out of bounds arguments
- * to the exception mapping function.
- * @throws IndexOutOfBoundsException if the sub-range is out of bounds and
- * the exception mapping function is {@code null}
+ * @throws X if the sub-range is out-of-bounds and the exception factory
+ * function is non-{@code null}
+ * @throws IndexOutOfBoundsException if the sub-range is out-of-bounds and
+ * the exception factory function is {@code null}
* @since 9
*/
- public static <T extends RuntimeException>
+ public static <X extends RuntimeException>
int checkFromToIndex(int fromIndex, int toIndex, int length,
- BiFunction<Integer, Integer, T> oobe) throws T, IndexOutOfBoundsException {
+ BiFunction<String, List<Integer>, X> oobef) {
if (fromIndex < 0 || fromIndex > toIndex || toIndex > length)
- throw outOfBounds(fromIndex, toIndex, oobe);
+ throw outOfBoundsCheckFromToIndex(oobef, fromIndex, toIndex, length);
return fromIndex;
}
@@ -513,7 +678,7 @@
* {@code fromIndex + size} (exclusive) is within the bounds of range from
* {@code 0} (inclusive) to {@code length} (exclusive).
*
- * <p>The sub-range is defined to be out of bounds if any of the following
+ * <p>The sub-range is defined to be out-of-bounds if any of the following
* inequalities is true:
* <ul>
* <li>{@code fromIndex < 0}</li>
@@ -522,15 +687,21 @@
* <li>{@code length < 0}, which is implied from the former inequalities</li>
* </ul>
*
+ * <p>This method behaves as if {@link #checkFromIndexSize(int, int, int, BiFunction)}
+ * was called with same out-of-bounds arguments and an exception formatter
+ * argument produced from an invocation of
+ * {@code outOfBoundsExceptionFormatter(IndexOutOfBounds::new)} (though it may
+ * be more efficient).
+ *
* @param fromIndex the lower-bound (inclusive) of the sub-interval
* @param size the size of the sub-range
* @param length the upper-bound (exclusive) of the range
* @return {@code fromIndex} if the sub-range within bounds of the range
- * @throws IndexOutOfBoundsException if the sub-range is out of bounds
+ * @throws IndexOutOfBoundsException if the sub-range is out-of-bounds
* @since 9
*/
public static
- int checkFromIndexSize(int fromIndex, int size, int length) throws IndexOutOfBoundsException {
+ int checkFromIndexSize(int fromIndex, int size, int length) {
return checkFromIndexSize(fromIndex, size, length, null);
}
@@ -539,7 +710,7 @@
* {@code fromIndex + size} (exclusive) is within the bounds of range from
* {@code 0} (inclusive) to {@code length} (exclusive).
*
- * <p>The sub-range is defined to be out of bounds if any of the following
+ * <p>The sub-range is defined to be out-of-bounds if any of the following
* inequalities is true:
* <ul>
* <li>{@code fromIndex < 0}</li>
@@ -548,34 +719,37 @@
* <li>{@code length < 0}, which is implied from the former inequalities</li>
* </ul>
*
- * <p>If the sub-range is out of bounds then, a runtime exception is thrown
- * that is the result of applying the arguments {@code fromIndex} and
- * {@code size} to the given exception mapping function.
+ * <p>If the sub-range is out-of-bounds, then a runtime exception is
+ * thrown that is the result of applying the following arguments to the
+ * exception formatter: the name of this method, {@code checkFromIndexSize};
+ * and an unmodifiable list integers whose values are, in order, the
+ * out-of-bounds arguments {@code fromIndex}, {@code size}, and
+ * {@code length}.
*
- * @param <T> the type of runtime exception to throw if the arguments are
- * out of bounds
+ * @param <X> the type of runtime exception to throw if the arguments are
+ * out-of-bounds
* @param fromIndex the lower-bound (inclusive) of the sub-interval
* @param size the size of the sub-range
* @param length the upper-bound (exclusive) of the range
- * @param oobe the exception mapping function that when applied with out
- * of bounds arguments returns a runtime exception. If {@code null}
- * or returns {@code null} then, it is as if an exception mapping
- * function was supplied that returns
- * {@link IndexOutOfBoundsException} for any given arguments.
- * Exceptions thrown by the function are relayed to the caller.
+ * @param oobef the exception formatter that when applied with this
+ * method name and out-of-bounds arguments returns a runtime
+ * exception. If {@code null} or returns {@code null} then, it is as
+ * if an exception formatter produced from an invocation of
+ * {@code outOfBoundsExceptionFormatter(IndexOutOfBounds::new)} is used
+ * instead (though it may be more efficient).
+ * Exceptions thrown by the formatter are relayed to the caller.
* @return {@code fromIndex} if the sub-range within bounds of the range
- * @throws T if the sub-range is out of bounds, then a runtime exception is
- * thrown that is the result of applying the out of bounds arguments
- * to the exception mapping function.
- * @throws IndexOutOfBoundsException if the sub-range is out of bounds and
- * the exception mapping function is {@code null}
+ * @throws X if the sub-range is out-of-bounds and the exception factory
+ * function is non-{@code null}
+ * @throws IndexOutOfBoundsException if the sub-range is out-of-bounds and
+ * the exception factory function is {@code null}
* @since 9
*/
- public static <T extends RuntimeException>
+ public static <X extends RuntimeException>
int checkFromIndexSize(int fromIndex, int size, int length,
- BiFunction<Integer, Integer, T> oobe) throws T, IndexOutOfBoundsException {
+ BiFunction<String, List<Integer>, X> oobef) {
if ((length | fromIndex | size) < 0 || size > length - fromIndex)
- throw outOfBounds(fromIndex, size, oobe);
+ throw outOfBoundsCheckFromIndexSize(oobef, fromIndex, size, length);
return fromIndex;
}
}
--- a/jdk/src/java.base/share/classes/java/util/jar/JarFile.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/util/jar/JarFile.java Thu Apr 14 09:32:37 2016 -0700
@@ -894,7 +894,8 @@
private static final byte[] CLASSPATH_LASTOCC;
private static final byte[] MULTIRELEASE_CHARS =
- {'M','U','L','T','I','-','R','E','L','E', 'A', 'S', 'E', ':', ' '};
+ {'M','U','L','T','I','-','R','E','L','E', 'A', 'S', 'E', ':',
+ ' ', 'T', 'R', 'U', 'E'};
// The bad character shift for "multi-release: "
private static final byte[] MULTIRELEASE_LASTOCC;
@@ -914,17 +915,17 @@
MULTIRELEASE_LASTOCC = new byte[64];
MULTIRELEASE_LASTOCC[(int)'M' - 32] = 1;
- MULTIRELEASE_LASTOCC[(int)'U' - 32] = 2;
- MULTIRELEASE_LASTOCC[(int)'T' - 32] = 4;
MULTIRELEASE_LASTOCC[(int)'I' - 32] = 5;
MULTIRELEASE_LASTOCC[(int)'-' - 32] = 6;
- MULTIRELEASE_LASTOCC[(int)'R' - 32] = 7;
MULTIRELEASE_LASTOCC[(int)'L' - 32] = 9;
MULTIRELEASE_LASTOCC[(int)'A' - 32] = 11;
MULTIRELEASE_LASTOCC[(int)'S' - 32] = 12;
- MULTIRELEASE_LASTOCC[(int)'E' - 32] = 13;
MULTIRELEASE_LASTOCC[(int)':' - 32] = 14;
MULTIRELEASE_LASTOCC[(int)' ' - 32] = 15;
+ MULTIRELEASE_LASTOCC[(int)'T' - 32] = 16;
+ MULTIRELEASE_LASTOCC[(int)'R' - 32] = 17;
+ MULTIRELEASE_LASTOCC[(int)'U' - 32] = 18;
+ MULTIRELEASE_LASTOCC[(int)'E' - 32] = 19;
}
private JarEntry getManEntry() {
@@ -966,7 +967,7 @@
* Since there are no repeated substring in our search strings,
* the good suffix shifts can be replaced with a comparison.
*/
- private boolean match(byte[] src, byte[] b, byte[] lastOcc) {
+ private int match(byte[] src, byte[] b, byte[] lastOcc) {
int len = src.length;
int last = b.length - len;
int i = 0;
@@ -990,9 +991,9 @@
continue next;
}
}
- return true;
+ return i;
}
- return false;
+ return -1;
}
/**
@@ -1011,11 +1012,35 @@
if (manEntry != null) {
byte[] b = getBytes(manEntry);
hasClassPathAttribute = match(CLASSPATH_CHARS, b,
- CLASSPATH_LASTOCC);
+ CLASSPATH_LASTOCC) != -1;
// is this a multi-release jar file
if (MULTI_RELEASE_ENABLED && version != BASE_VERSION) {
- isMultiRelease = match(MULTIRELEASE_CHARS, b,
- MULTIRELEASE_LASTOCC);
+ int i = match(MULTIRELEASE_CHARS, b, MULTIRELEASE_LASTOCC);
+ if (i != -1) {
+ i += MULTIRELEASE_CHARS.length;
+ if (i < b.length) {
+ byte c = b[i++];
+ // Check that the value is followed by a newline
+ // and does not have a continuation
+ if (c == '\n' &&
+ (i == b.length || b[i] != ' ')) {
+ isMultiRelease = true;
+ } else if (c == '\r') {
+ if (i == b.length) {
+ isMultiRelease = true;
+ } else {
+ c = b[i++];
+ if (c == '\n') {
+ if (i == b.length || b[i] != ' ') {
+ isMultiRelease = true;
+ }
+ } else if (c != ' ') {
+ isMultiRelease = true;
+ }
+ }
+ }
+ }
+ }
}
}
hasCheckedSpecialAttributes = true;
--- a/jdk/src/java.base/share/classes/javax/crypto/Cipher.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/javax/crypto/Cipher.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -480,7 +480,8 @@
*
* @implNote
* The JDK Reference Implementation additionally uses the
- * {@code jdk.security.provider.preferred} property to determine
+ * {@code jdk.security.provider.preferred}
+ * {@link Security#getProperty(String) Security} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
--- a/jdk/src/java.base/share/classes/javax/crypto/ExemptionMechanism.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/javax/crypto/ExemptionMechanism.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -114,7 +114,8 @@
*
* @implNote
* The JDK Reference Implementation additionally uses the
- * {@code jdk.security.provider.preferred} property to determine
+ * {@code jdk.security.provider.preferred}
+ * {@link Security#getProperty(String) Security} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
--- a/jdk/src/java.base/share/classes/javax/crypto/KeyAgreement.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/javax/crypto/KeyAgreement.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -152,7 +152,8 @@
*
* @implNote
* The JDK Reference Implementation additionally uses the
- * {@code jdk.security.provider.preferred} property to determine
+ * {@code jdk.security.provider.preferred}
+ * {@link Security#getProperty(String) Security} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
--- a/jdk/src/java.base/share/classes/javax/crypto/KeyGenerator.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/javax/crypto/KeyGenerator.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -204,7 +204,8 @@
*
* @implNote
* The JDK Reference Implementation additionally uses the
- * {@code jdk.security.provider.preferred} property to determine
+ * {@code jdk.security.provider.preferred}
+ * {@link Security#getProperty(String) Security} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
--- a/jdk/src/java.base/share/classes/javax/crypto/Mac.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/javax/crypto/Mac.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -154,7 +154,8 @@
*
* @implNote
* The JDK Reference Implementation additionally uses the
- * {@code jdk.security.provider.preferred} property to determine
+ * {@code jdk.security.provider.preferred}
+ * {@link Security#getProperty(String) Security} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
--- a/jdk/src/java.base/share/classes/javax/crypto/SecretKeyFactory.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/javax/crypto/SecretKeyFactory.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -139,7 +139,8 @@
*
* @implNote
* The JDK Reference Implementation additionally uses the
- * {@code jdk.security.provider.preferred} property to determine
+ * {@code jdk.security.provider.preferred}
+ * {@link Security#getProperty(String) Security} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
--- a/jdk/src/java.base/share/classes/javax/net/ssl/KeyManagerFactory.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/KeyManagerFactory.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -118,7 +118,8 @@
*
* @implNote
* The JDK Reference Implementation additionally uses the
- * {@code jdk.security.provider.preferred} property to determine
+ * {@code jdk.security.provider.preferred}
+ * {@link Security#getProperty(String) Security} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
--- a/jdk/src/java.base/share/classes/javax/net/ssl/SSLContext.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/SSLContext.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -138,7 +138,8 @@
*
* @implNote
* The JDK Reference Implementation additionally uses the
- * {@code jdk.security.provider.preferred} property to determine
+ * {@code jdk.security.provider.preferred}
+ * {@link Security#getProperty(String) Security} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
--- a/jdk/src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -132,7 +132,8 @@
*
* @implNote
* The JDK Reference Implementation additionally uses the
- * {@code jdk.security.provider.preferred} property to determine
+ * {@code jdk.security.provider.preferred}
+ * {@link Security#getProperty(String) Security} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
--- a/jdk/src/java.base/share/classes/javax/security/auth/login/Configuration.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/javax/security/auth/login/Configuration.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -313,7 +313,8 @@
*
* @implNote
* The JDK Reference Implementation additionally uses the
- * {@code jdk.security.provider.preferred} property to determine
+ * {@code jdk.security.provider.preferred}
+ * {@link Security#getProperty(String) Security} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
--- a/jdk/src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java Thu Apr 14 09:32:37 2016 -0700
@@ -288,22 +288,24 @@
return buffer;
} else {
+ if (channel == null) {
+ throw new InternalError("Image file channel not open");
+ }
+
ByteBuffer buffer = ImageBufferCache.getBuffer(size);
- int read = 0;
-
+ int read;
try {
- if (channel == null) {
- throw new InternalError("Image file channel not open");
- }
-
read = channel.read(buffer, offset);
buffer.rewind();
} catch (IOException ex) {
+ ImageBufferCache.releaseBuffer(buffer);
throw new RuntimeException(ex);
}
if (read != size) {
ImageBufferCache.releaseBuffer(buffer);
+ throw new RuntimeException("Short read: " + read +
+ " instead of " + size + " bytes");
}
return buffer;
--- a/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageBufferCache.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageBufferCache.java Thu Apr 14 09:32:37 2016 -0700
@@ -24,110 +24,112 @@
*/
package jdk.internal.jimage;
+import java.lang.ref.WeakReference;
import java.nio.ByteBuffer;
-import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
/**
* @implNote This class needs to maintain JDK 8 source compatibility.
*
* It is used internally in the JDK to implement jimage/jrtfs access,
- * but also compiled and delivered as part of the jrtfs.jar to support access
+ * but also compiled and delivered as part of the jrt-fs.jar to support access
* to the jimage file provided by the shipped JDK by tools running on JDK 8.
*/
class ImageBufferCache {
- private static final int MAX_FREE_BUFFERS = 3;
+ private static final int MAX_CACHED_BUFFERS = 3;
private static final int LARGE_BUFFER = 0x10000;
- private static final ThreadLocal<ArrayList<ImageBufferCache>>
- threadLocal = new ThreadLocal<>();
+ private static final ThreadLocal<BufferReference[]> CACHE =
+ new ThreadLocal<BufferReference[]>() {
+ @Override
+ protected BufferReference[] initialValue() {
+ // 1 extra slot to simplify logic of releaseBuffer()
+ return new BufferReference[MAX_CACHED_BUFFERS + 1];
+ }
+ };
- private final ByteBuffer buffer;
- private boolean isUsed;
+ private static ByteBuffer allocateBuffer(long size) {
+ return ByteBuffer.allocateDirect((int)((size + 0xFFF) & ~0xFFF));
+ }
static ByteBuffer getBuffer(long size) {
if (size < 0 || Integer.MAX_VALUE < size) {
throw new IndexOutOfBoundsException("size");
}
- ByteBuffer buffer = null;
+ ByteBuffer result = null;
if (size > LARGE_BUFFER) {
- buffer = ByteBuffer.allocateDirect((int)((size + 0xFFF) & ~0xFFF));
+ result = allocateBuffer(size);
} else {
- ArrayList<ImageBufferCache> buffers = threadLocal.get();
+ BufferReference[] cache = CACHE.get();
+
+ // buffers are ordered by decreasing capacity
+ // cache[MAX_CACHED_BUFFERS] is always null
+ for (int i = MAX_CACHED_BUFFERS - 1; i >= 0; i--) {
+ BufferReference reference = cache[i];
- if (buffers == null) {
- buffers = new ArrayList<>(MAX_FREE_BUFFERS);
- threadLocal.set(buffers);
+ if (reference != null) {
+ ByteBuffer buffer = reference.get();
+
+ if (buffer != null && size <= buffer.capacity()) {
+ cache[i] = null;
+ result = buffer;
+ result.rewind();
+ break;
+ }
+ }
}
- int i = 0, j = buffers.size();
- for (ImageBufferCache imageBuffer : buffers) {
- if (size <= imageBuffer.capacity()) {
- j = i;
-
- if (!imageBuffer.isUsed) {
- imageBuffer.isUsed = true;
- buffer = imageBuffer.buffer;
-
- break;
- }
- } else {
- break;
- }
-
- i++;
- }
-
- if (buffer == null) {
- ImageBufferCache imageBuffer = new ImageBufferCache((int)size);
- buffers.add(j, imageBuffer);
- buffer = imageBuffer.buffer;
+ if (result == null) {
+ result = allocateBuffer(size);
}
}
- buffer.rewind();
- buffer.limit((int)size);
+ result.limit((int)size);
- return buffer;
+ return result;
}
static void releaseBuffer(ByteBuffer buffer) {
- ArrayList<ImageBufferCache> buffers = threadLocal.get();
-
- if (buffers == null) {
- return;
- }
-
if (buffer.capacity() > LARGE_BUFFER) {
return;
}
- int i = 0, j = buffers.size();
- for (ImageBufferCache imageBuffer : buffers) {
- if (!imageBuffer.isUsed) {
- j = Math.min(j, i);
- }
+ BufferReference[] cache = CACHE.get();
- if (imageBuffer.buffer == buffer) {
- imageBuffer.isUsed = false;
- j = Math.min(j, i);
-
- break;
+ // expunge cleared BufferRef(s)
+ for (int i = 0; i < MAX_CACHED_BUFFERS; i++) {
+ BufferReference reference = cache[i];
+ if (reference != null && reference.get() == null) {
+ cache[i] = null;
}
}
- if (buffers.size() > MAX_FREE_BUFFERS && j != buffers.size()) {
- buffers.remove(j);
- }
+ // insert buffer back with new BufferRef wrapping it
+ cache[MAX_CACHED_BUFFERS] = new BufferReference(buffer);
+ Arrays.sort(cache, DECREASING_CAPACITY_NULLS_LAST);
+ // squeeze the smallest one out
+ cache[MAX_CACHED_BUFFERS] = null;
}
- private ImageBufferCache(int needed) {
- this.buffer = ByteBuffer.allocateDirect((needed + 0xFFF) & ~0xFFF);
- this.isUsed = true;
- this.buffer.limit(needed);
- }
+ private static Comparator<BufferReference> DECREASING_CAPACITY_NULLS_LAST =
+ new Comparator<BufferReference>() {
+ @Override
+ public int compare(BufferReference br1, BufferReference br2) {
+ return Integer.compare(br2 == null ? 0 : br2.capacity,
+ br1 == null ? 0 : br1.capacity);
+ }
+ };
- private long capacity() {
- return buffer.capacity();
+ private static class BufferReference extends WeakReference<ByteBuffer> {
+ // saved capacity so that DECREASING_CAPACITY_NULLS_LAST comparator
+ // is stable in the presence of GC clearing the WeakReference concurrently
+ final int capacity;
+
+ BufferReference(ByteBuffer buffer) {
+ super(buffer);
+ capacity = buffer.capacity();
+ }
}
}
--- a/jdk/src/java.base/share/classes/sun/nio/fs/AbstractFileSystemProvider.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/classes/sun/nio/fs/AbstractFileSystemProvider.java Thu Apr 14 09:32:37 2016 -0700
@@ -25,7 +25,9 @@
package sun.nio.fs;
-import java.nio.file.*;
+import java.nio.file.Path;
+import java.nio.file.LinkOption;
+import java.nio.file.attribute.BasicFileAttributes;
import java.nio.file.spi.FileSystemProvider;
import java.io.IOException;
import java.util.Map;
@@ -34,7 +36,7 @@
* Base implementation class of FileSystemProvider
*/
-abstract class AbstractFileSystemProvider extends FileSystemProvider {
+public abstract class AbstractFileSystemProvider extends FileSystemProvider {
protected AbstractFileSystemProvider() { }
/**
@@ -107,4 +109,49 @@
public final boolean deleteIfExists(Path file) throws IOException {
return implDelete(file, false);
}
+
+ /**
+ * Tests whether a file is a directory.
+ *
+ * @return {@code true} if the file is a directory; {@code false} if
+ * the file does not exist, is not a directory, or it cannot
+ * be determined if the file is a directory or not.
+ */
+ public boolean isDirectory(Path file) {
+ try {
+ return readAttributes(file, BasicFileAttributes.class).isDirectory();
+ } catch (IOException ioe) {
+ return false;
+ }
+ }
+
+ /**
+ * Tests whether a file is a regular file with opaque content.
+ *
+ * @return {@code true} if the file is a regular file; {@code false} if
+ * the file does not exist, is not a regular file, or it
+ * cannot be determined if the file is a regular file or not.
+ */
+ public boolean isRegularFile(Path file) {
+ try {
+ return readAttributes(file, BasicFileAttributes.class).isRegularFile();
+ } catch (IOException ioe) {
+ return false;
+ }
+ }
+
+ /**
+ * Checks the existence of a file.
+ *
+ * @return {@code true} if the file exists; {@code false} if the file does
+ * not exist or its existence cannot be determined.
+ */
+ public boolean exists(Path file) {
+ try {
+ checkAccess(file);
+ return true;
+ } catch (IOException ioe) {
+ return false;
+ }
+ }
}
--- a/jdk/src/java.base/share/native/include/jvm.h Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/native/include/jvm.h Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -171,11 +171,8 @@
JNIEXPORT void JNICALL
JVM_FillInStackTrace(JNIEnv *env, jobject throwable);
-JNIEXPORT jint JNICALL
-JVM_GetStackTraceDepth(JNIEnv *env, jobject throwable);
-
-JNIEXPORT jobject JNICALL
-JVM_GetStackTraceElement(JNIEnv *env, jobject throwable, jint index);
+JNIEXPORT void JNICALL
+JVM_GetStackTraceElements(JNIEnv *env, jobject throwable, jobjectArray elements);
/*
* java.lang.StackWalker
--- a/jdk/src/java.base/share/native/libjava/Throwable.c Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/share/native/libjava/Throwable.c Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -50,15 +50,9 @@
return throwable;
}
-JNIEXPORT jint JNICALL
-Java_java_lang_Throwable_getStackTraceDepth(JNIEnv *env, jobject throwable)
+JNIEXPORT void JNICALL
+Java_java_lang_Throwable_getStackTraceElements(JNIEnv *env,
+ jobject throwable, jobjectArray elements)
{
- return JVM_GetStackTraceDepth(env, throwable);
+ JVM_GetStackTraceElements(env, throwable, elements);
}
-
-JNIEXPORT jobject JNICALL
-Java_java_lang_Throwable_getStackTraceElement(JNIEnv *env,
- jobject throwable, jint index)
-{
- return JVM_GetStackTraceElement(env, throwable, index);
-}
--- a/jdk/src/java.base/unix/classes/sun/nio/fs/UnixFileSystemProvider.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/unix/classes/sun/nio/fs/UnixFileSystemProvider.java Thu Apr 14 09:32:37 2016 -0700
@@ -499,6 +499,29 @@
}
}
+ @Override
+ public final boolean isDirectory(Path obj) {
+ UnixPath file = UnixPath.toUnixPath(obj);
+ file.checkRead();
+ int mode = UnixNativeDispatcher.stat(file);
+ return ((mode & UnixConstants.S_IFMT) == UnixConstants.S_IFDIR);
+ }
+
+ @Override
+ public final boolean isRegularFile(Path obj) {
+ UnixPath file = UnixPath.toUnixPath(obj);
+ file.checkRead();
+ int mode = UnixNativeDispatcher.stat(file);
+ return ((mode & UnixConstants.S_IFMT) == UnixConstants.S_IFREG);
+ }
+
+ @Override
+ public final boolean exists(Path obj) {
+ UnixPath file = UnixPath.toUnixPath(obj);
+ file.checkRead();
+ return UnixNativeDispatcher.exists(file);
+ }
+
/**
* Returns a {@code FileTypeDetector} for this platform.
*/
--- a/jdk/src/java.base/unix/classes/sun/nio/fs/UnixNativeDispatcher.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/unix/classes/sun/nio/fs/UnixNativeDispatcher.java Thu Apr 14 09:32:37 2016 -0700
@@ -296,6 +296,23 @@
private static native void stat0(long pathAddress, UnixFileAttributes attrs)
throws UnixException;
+
+ /**
+ * stat(const char* path, struct stat* buf)
+ *
+ * @return st_mode (file type and mode) or 0 if an error occurs.
+ */
+ static int stat(UnixPath path) {
+ NativeBuffer buffer = copyToNativeBuffer(path);
+ try {
+ return stat1(buffer.address());
+ } finally {
+ buffer.release();
+ }
+ }
+ private static native int stat1(long pathAddress);
+
+
/**
* lstat(const char* path, struct stat* buf)
*/
@@ -459,6 +476,22 @@
private static native void access0(long pathAddress, int amode) throws UnixException;
/**
+ * access(constant char* path, F_OK)
+ *
+ * @return true if the file exists, false otherwise
+ */
+ static boolean exists(UnixPath path) {
+ NativeBuffer buffer = copyToNativeBuffer(path);
+ try {
+ return exists0(buffer.address());
+ } finally {
+ buffer.release();
+ }
+ }
+ private static native boolean exists0(long pathAddress);
+
+
+ /**
* struct passwd *getpwuid(uid_t uid);
*
* @return passwd->pw_name
--- a/jdk/src/java.base/unix/classes/sun/nio/fs/UnixUriUtils.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/unix/classes/sun/nio/fs/UnixUriUtils.java Thu Apr 14 09:32:37 2016 -0700
@@ -114,12 +114,9 @@
// trailing slash if directory
if (sb.charAt(sb.length()-1) != '/') {
- try {
- if (UnixFileAttributes.get(up, true).isDirectory())
- sb.append('/');
- } catch (UnixException x) {
- // ignore
- }
+ int mode = UnixNativeDispatcher.stat(up);
+ if ((mode & UnixConstants.S_IFMT) == UnixConstants.S_IFDIR)
+ sb.append('/');
}
try {
--- a/jdk/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c Thu Apr 14 09:32:37 2016 -0700
@@ -483,6 +483,20 @@
}
}
+JNIEXPORT jint JNICALL
+Java_sun_nio_fs_UnixNativeDispatcher_stat1(JNIEnv* env, jclass this, jlong pathAddress) {
+ int err;
+ struct stat64 buf;
+ const char* path = (const char*)jlong_to_ptr(pathAddress);
+
+ RESTARTABLE(stat64(path, &buf), err);
+ if (err == -1) {
+ return 0;
+ } else {
+ return (jint)buf.st_mode;
+ }
+}
+
JNIEXPORT void JNICALL
Java_sun_nio_fs_UnixNativeDispatcher_lstat0(JNIEnv* env, jclass this,
jlong pathAddress, jobject attrs)
@@ -897,6 +911,14 @@
}
}
+JNIEXPORT jboolean JNICALL
+Java_sun_nio_fs_UnixNativeDispatcher_exists0(JNIEnv* env, jclass this, jlong pathAddress) {
+ int err;
+ const char* path = (const char*)jlong_to_ptr(pathAddress);
+ RESTARTABLE(access(path, F_OK), err);
+ return (err == 0) ? JNI_TRUE : JNI_FALSE;
+}
+
JNIEXPORT void JNICALL
Java_sun_nio_fs_UnixNativeDispatcher_statvfs0(JNIEnv* env, jclass this,
jlong pathAddress, jobject attrs)
--- a/jdk/src/java.base/windows/classes/java/net/DefaultDatagramSocketImplFactory.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/windows/classes/java/net/DefaultDatagramSocketImplFactory.java Thu Apr 14 09:32:37 2016 -0700
@@ -26,6 +26,7 @@
import java.security.AccessController;
import java.security.PrivilegedAction;
+import sun.security.action.GetPropertyAction;
/**
* This class defines a factory for creating DatagramSocketImpls. It defaults
@@ -47,64 +48,30 @@
{
private static final Class<?> prefixImplClass;
- /* the windows version. */
- private static float version;
-
/* java.net.preferIPv4Stack */
- private static boolean preferIPv4Stack = false;
-
- /* If the version supports a dual stack TCP implementation */
- private static final boolean useDualStackImpl;
-
- /* sun.net.useExclusiveBind */
- private static String exclBindProp;
+ private static final boolean preferIPv4Stack;
/* True if exclusive binding is on for Windows */
private static final boolean exclusiveBind;
static {
Class<?> prefixImplClassLocal = null;
- boolean useDualStackImplLocal = false;
- boolean exclusiveBindLocal = true;
+
+ preferIPv4Stack = Boolean.parseBoolean(
+ AccessController.doPrivileged(
+ new GetPropertyAction("java.net.preferIPv4Stack")));
- // Determine Windows Version.
- java.security.AccessController.doPrivileged(
- new PrivilegedAction<Object>() {
- public Object run() {
- version = 0;
- try {
- version = Float.parseFloat(System.getProperties()
- .getProperty("os.version"));
- preferIPv4Stack = Boolean.parseBoolean(
- System.getProperties()
- .getProperty(
- "java.net.preferIPv4Stack"));
- exclBindProp = System.getProperty(
- "sun.net.useExclusiveBind");
- } catch (NumberFormatException e) {
- assert false : e;
- }
- return null; // nothing to return
- }
- });
-
- // (version >= 6.0) implies Vista or greater.
- if (version >= 6.0 && !preferIPv4Stack) {
- useDualStackImplLocal = true;
- }
- if (exclBindProp != null) {
- // sun.net.useExclusiveBind is true
- exclusiveBindLocal = exclBindProp.length() == 0 ? true
- : Boolean.parseBoolean(exclBindProp);
- } else if (version < 6.0) {
- exclusiveBindLocal = false;
- }
+ String exclBindProp = AccessController.doPrivileged(
+ new GetPropertyAction("sun.net.useExclusiveBind", ""));
+ exclusiveBind = (exclBindProp.isEmpty())
+ ? true
+ : Boolean.parseBoolean(exclBindProp);
// impl.prefix
String prefix = null;
try {
prefix = AccessController.doPrivileged(
- new sun.security.action.GetPropertyAction("impl.prefix", null));
+ new GetPropertyAction("impl.prefix", null));
if (prefix != null)
prefixImplClassLocal = Class.forName("java.net."+prefix+"DatagramSocketImpl");
} catch (Exception e) {
@@ -114,8 +81,6 @@
}
prefixImplClass = prefixImplClassLocal;
- useDualStackImpl = useDualStackImplLocal;
- exclusiveBind = exclusiveBindLocal;
}
/**
@@ -133,7 +98,7 @@
throw new SocketException("can't instantiate DatagramSocketImpl");
}
} else {
- if (useDualStackImpl && !isMulticast)
+ if (!preferIPv4Stack && !isMulticast)
return new DualStackPlainDatagramSocketImpl(exclusiveBind);
else
return new TwoStacksPlainDatagramSocketImpl(exclusiveBind && !isMulticast);
--- a/jdk/src/java.base/windows/classes/sun/nio/fs/WindowsFileAttributeViews.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/windows/classes/sun/nio/fs/WindowsFileAttributeViews.java Thu Apr 14 09:32:37 2016 -0700
@@ -79,7 +79,7 @@
long handle = -1L;
try {
int flags = FILE_FLAG_BACKUP_SEMANTICS;
- if (!followLinks && file.getFileSystem().supportsLinks())
+ if (!followLinks)
flags |= FILE_FLAG_OPEN_REPARSE_POINT;
handle = CreateFile(file.getPathForWin32Calls(),
--- a/jdk/src/java.base/windows/classes/sun/nio/fs/WindowsFileCopy.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/windows/classes/sun/nio/fs/WindowsFileCopy.java Thu Apr 14 09:32:37 2016 -0700
@@ -168,9 +168,7 @@
// Use CopyFileEx if the file is not a directory or junction
if (!sourceAttrs.isDirectory() && !sourceAttrs.isDirectoryLink()) {
- final int flags =
- (source.getFileSystem().supportsLinks() && !followLinks) ?
- COPY_FILE_COPY_SYMLINK : 0;
+ final int flags = (!followLinks) ? COPY_FILE_COPY_SYMLINK : 0;
if (interruptible) {
// interruptible copy
--- a/jdk/src/java.base/windows/classes/sun/nio/fs/WindowsFileStore.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/windows/classes/sun/nio/fs/WindowsFileStore.java Thu Apr 14 09:32:37 2016 -0700
@@ -78,14 +78,7 @@
// if the file is a link then GetVolumePathName returns the
// volume that the link is on so we need to call it with the
// final target
- String target;
- if (file.getFileSystem().supportsLinks()) {
- target = WindowsLinkSupport.getFinalPath(file, true);
- } else {
- // file must exist
- WindowsFileAttributes.get(file, true);
- target = file.getPathForWin32Calls();
- }
+ String target = WindowsLinkSupport.getFinalPath(file, true);
try {
return createFromPath(target);
} catch (WindowsException e) {
--- a/jdk/src/java.base/windows/classes/sun/nio/fs/WindowsFileSystem.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/windows/classes/sun/nio/fs/WindowsFileSystem.java Thu Apr 14 09:32:37 2016 -0700
@@ -31,9 +31,6 @@
import java.util.*;
import java.util.regex.Pattern;
import java.io.IOException;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import sun.security.action.GetPropertyAction;
class WindowsFileSystem
extends FileSystem
@@ -44,9 +41,6 @@
private final String defaultDirectory;
private final String defaultRoot;
- private final boolean supportsLinks;
- private final boolean supportsStreamEnumeration;
-
// package-private
WindowsFileSystem(WindowsFileSystemProvider provider,
String dir)
@@ -61,18 +55,6 @@
throw new AssertionError("Default directory is not an absolute path");
this.defaultDirectory = result.path();
this.defaultRoot = result.root();
-
- PrivilegedAction<String> pa = new GetPropertyAction("os.version");
- String osversion = AccessController.doPrivileged(pa);
- String[] vers = Util.split(osversion, '.');
- int major = Integer.parseInt(vers[0]);
- int minor = Integer.parseInt(vers[1]);
-
- // symbolic links available on Vista and newer
- supportsLinks = (major >= 6);
-
- // enumeration of data streams available on Windows Server 2003 and newer
- supportsStreamEnumeration = (major >= 6) || (major == 5 && minor >= 2);
}
// package-private
@@ -84,14 +66,6 @@
return defaultRoot;
}
- boolean supportsLinks() {
- return supportsLinks;
- }
-
- boolean supportsStreamEnumeration() {
- return supportsStreamEnumeration;
- }
-
@Override
public FileSystemProvider provider() {
return provider;
--- a/jdk/src/java.base/windows/classes/sun/nio/fs/WindowsFileSystemProvider.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/windows/classes/sun/nio/fs/WindowsFileSystemProvider.java Thu Apr 14 09:32:37 2016 -0700
@@ -526,11 +526,6 @@
WindowsPath link = WindowsPath.toWindowsPath(obj1);
WindowsPath target = WindowsPath.toWindowsPath(obj2);
- if (!link.getFileSystem().supportsLinks()) {
- throw new UnsupportedOperationException("Symbolic links not supported "
- + "on this operating system");
- }
-
// no attributes allowed
if (attrs.length > 0) {
WindowsSecurityDescriptor.fromAttribute(attrs); // may throw NPE or UOE
@@ -614,9 +609,6 @@
public Path readSymbolicLink(Path obj1) throws IOException {
WindowsPath link = WindowsPath.toWindowsPath(obj1);
WindowsFileSystem fs = link.getFileSystem();
- if (!fs.supportsLinks()) {
- throw new UnsupportedOperationException("symbolic links not supported");
- }
// permission check
SecurityManager sm = System.getSecurityManager();
--- a/jdk/src/java.base/windows/classes/sun/nio/fs/WindowsLinkSupport.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/windows/classes/sun/nio/fs/WindowsLinkSupport.java Thu Apr 14 09:32:37 2016 -0700
@@ -96,7 +96,7 @@
WindowsFileSystem fs = input.getFileSystem();
try {
// if not following links then don't need final path
- if (!followLinks || !fs.supportsLinks())
+ if (!followLinks)
return input.getPathForWin32Calls();
// if file is not a sym link then don't need final path
@@ -157,8 +157,6 @@
throws IOException
{
WindowsFileSystem fs = input.getFileSystem();
- if (resolveLinks && !fs.supportsLinks())
- resolveLinks = false;
// Start with absolute path
String path = null;
--- a/jdk/src/java.base/windows/classes/sun/nio/fs/WindowsNativeDispatcher.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/windows/classes/sun/nio/fs/WindowsNativeDispatcher.java Thu Apr 14 09:32:37 2016 -0700
@@ -1071,54 +1071,6 @@
static native int GetOverlappedResult(long hFile, long lpOverlapped)
throws WindowsException;
- /**
- * BackupRead(
- * HANDLE hFile,
- * LPBYTE lpBuffer,
- * DWORD nNumberOfBytesToRead,
- * LPDWORD lpNumberOfBytesRead,
- * BOOL bAbort,
- * BOOL bProcessSecurity,
- * LPVOID* lpContext
- * )
- */
- static BackupResult BackupRead(long hFile,
- long bufferAddress,
- int bufferSize,
- boolean abort,
- long context)
- throws WindowsException
- {
- BackupResult result = new BackupResult();
- BackupRead0(hFile, bufferAddress, bufferSize, abort, context, result);
- return result;
- }
- static class BackupResult {
- private int bytesTransferred;
- private long context;
- private BackupResult() { }
-
- int bytesTransferred() { return bytesTransferred; }
- long context() { return context; }
- }
- private static native void BackupRead0(long hFile, long bufferAddress,
- int bufferSize, boolean abort, long context, BackupResult result)
- throws WindowsException;
-
- /**
- * BackupSeek(
- * HANDLE hFile,
- * DWORD dwLowBytesToSeek,
- * DWORD dwHighBytesToSeek,
- * LPDWORD lpdwLowByteSeeked,
- * LPDWORD lpdwHighByteSeeked,
- * LPVOID* lpContext
- * )
- */
- static native void BackupSeek(long hFile, long bytesToSeek, long context)
- throws WindowsException;
-
-
// -- support for copying String with a NativeBuffer --
private static final Unsafe unsafe = Unsafe.getUnsafe();
--- a/jdk/src/java.base/windows/classes/sun/nio/fs/WindowsPath.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/windows/classes/sun/nio/fs/WindowsPath.java Thu Apr 14 09:32:37 2016 -0700
@@ -780,7 +780,7 @@
throws WindowsException
{
int flags = FILE_FLAG_BACKUP_SEMANTICS;
- if (!followLinks && getFileSystem().supportsLinks())
+ if (!followLinks)
flags |= FILE_FLAG_OPEN_REPARSE_POINT;
return CreateFile(getPathForWin32Calls(),
FILE_READ_ATTRIBUTES,
--- a/jdk/src/java.base/windows/classes/sun/nio/fs/WindowsUserDefinedFileAttributeView.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/windows/classes/sun/nio/fs/WindowsUserDefinedFileAttributeView.java Thu Apr 14 09:32:37 2016 -0700
@@ -91,121 +91,11 @@
return Collections.unmodifiableList(list);
}
- // enumerates the file streams by reading the stream headers using
- // BackupRead
- private List<String> listUsingBackupRead() throws IOException {
- long handle = -1L;
- try {
- int flags = FILE_FLAG_BACKUP_SEMANTICS;
- if (!followLinks && file.getFileSystem().supportsLinks())
- flags |= FILE_FLAG_OPEN_REPARSE_POINT;
-
- handle = CreateFile(file.getPathForWin32Calls(),
- GENERIC_READ,
- FILE_SHARE_READ, // no write as we depend on file size
- OPEN_EXISTING,
- flags);
- } catch (WindowsException x) {
- x.rethrowAsIOException(file);
- }
-
- // buffer to read stream header and stream name.
- final int BUFFER_SIZE = 4096;
- NativeBuffer buffer = null;
-
- // result with names of alternative data streams
- final List<String> list = new ArrayList<>();
-
- try {
- buffer = NativeBuffers.getNativeBuffer(BUFFER_SIZE);
- long address = buffer.address();
-
- /**
- * typedef struct _WIN32_STREAM_ID {
- * DWORD dwStreamId;
- * DWORD dwStreamAttributes;
- * LARGE_INTEGER Size;
- * DWORD dwStreamNameSize;
- * WCHAR cStreamName[ANYSIZE_ARRAY];
- * } WIN32_STREAM_ID;
- */
- final int SIZEOF_STREAM_HEADER = 20;
- final int OFFSETOF_STREAM_ID = 0;
- final int OFFSETOF_STREAM_SIZE = 8;
- final int OFFSETOF_STREAM_NAME_SIZE = 16;
-
- long context = 0L;
- try {
- for (;;) {
- // read stream header
- BackupResult result = BackupRead(handle, address,
- SIZEOF_STREAM_HEADER, false, context);
- context = result.context();
- if (result.bytesTransferred() == 0)
- break;
-
- int streamId = unsafe.getInt(address + OFFSETOF_STREAM_ID);
- long streamSize = unsafe.getLong(address + OFFSETOF_STREAM_SIZE);
- int nameSize = unsafe.getInt(address + OFFSETOF_STREAM_NAME_SIZE);
-
- // read stream name
- if (nameSize > 0) {
- result = BackupRead(handle, address, nameSize, false, context);
- if (result.bytesTransferred() != nameSize)
- break;
- }
-
- // check for alternative data stream
- if (streamId == BACKUP_ALTERNATE_DATA) {
- char[] nameAsArray = new char[nameSize/2];
- unsafe.copyMemory(null, address, nameAsArray,
- Unsafe.ARRAY_CHAR_BASE_OFFSET, nameSize);
-
- String[] segs = new String(nameAsArray).split(":");
- if (segs.length == 3)
- list.add(segs[1]);
- }
-
- // sparse blocks not currently handled as documentation
- // is not sufficient on how the spase block can be skipped.
- if (streamId == BACKUP_SPARSE_BLOCK) {
- throw new IOException("Spare blocks not handled");
- }
-
- // seek to end of stream
- if (streamSize > 0L) {
- BackupSeek(handle, streamSize, context);
- }
- }
- } catch (WindowsException x) {
- // failed to read or seek
- throw new IOException(x.errorString());
- } finally {
- // release context
- if (context != 0L) {
- try {
- BackupRead(handle, 0L, 0, true, context);
- } catch (WindowsException ignore) { }
- }
- }
- } finally {
- if (buffer != null)
- buffer.release();
- CloseHandle(handle);
- }
- return Collections.unmodifiableList(list);
- }
-
@Override
public List<String> list() throws IOException {
if (System.getSecurityManager() != null)
checkAccess(file.getPathForPermissionCheck(), true, false);
- // use stream APIs on Windows Server 2003 and newer
- if (file.getFileSystem().supportsStreamEnumeration()) {
- return listUsingStreamEnumeration();
- } else {
- return listUsingBackupRead();
- }
+ return listUsingStreamEnumeration();
}
@Override
--- a/jdk/src/java.base/windows/native/libnio/fs/WindowsNativeDispatcher.c Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.base/windows/native/libnio/fs/WindowsNativeDispatcher.c Thu Apr 14 09:32:37 2016 -0700
@@ -69,10 +69,6 @@
static jfieldID completionStatus_bytesTransferred;
static jfieldID completionStatus_completionKey;
-static jfieldID backupResult_bytesTransferred;
-static jfieldID backupResult_context;
-
-
static void throwWindowsException(JNIEnv* env, DWORD lastError) {
jobject x = JNU_NewObjectByName(env, "sun/nio/fs/WindowsException",
"(I)V", lastError);
@@ -148,13 +144,6 @@
CHECK_NULL(completionStatus_bytesTransferred);
completionStatus_completionKey = (*env)->GetFieldID(env, clazz, "completionKey", "J");
CHECK_NULL(completionStatus_completionKey);
-
- clazz = (*env)->FindClass(env, "sun/nio/fs/WindowsNativeDispatcher$BackupResult");
- CHECK_NULL(clazz);
- backupResult_bytesTransferred = (*env)->GetFieldID(env, clazz, "bytesTransferred", "I");
- CHECK_NULL(backupResult_bytesTransferred);
- backupResult_context = (*env)->GetFieldID(env, clazz, "context", "J");
- CHECK_NULL(backupResult_context);
}
JNIEXPORT jlong JNICALL
@@ -1228,52 +1217,3 @@
throwWindowsException(env, GetLastError());
}
}
-
-JNIEXPORT void JNICALL
-Java_sun_nio_fs_WindowsNativeDispatcher_BackupRead0(JNIEnv* env, jclass this,
- jlong hFile, jlong bufferAddress, jint bufferSize, jboolean abort,
- jlong context, jobject obj)
-{
- BOOL res;
- DWORD bytesTransferred;
- BOOL a = (abort == JNI_TRUE) ? TRUE : FALSE;
- VOID* pContext = (VOID*)jlong_to_ptr(context);
-
- res = BackupRead((HANDLE)jlong_to_ptr(hFile),
- (LPBYTE)jlong_to_ptr(bufferAddress),
- (DWORD)bufferSize,
- &bytesTransferred,
- a,
- FALSE,
- &pContext);
- if (res == 0) {
- throwWindowsException(env, GetLastError());
- } else {
- (*env)->SetIntField(env, obj, backupResult_bytesTransferred,
- bytesTransferred);
- (*env)->SetLongField(env, obj, backupResult_context,
- ptr_to_jlong(pContext));
- }
-}
-
-JNIEXPORT void JNICALL
-Java_sun_nio_fs_WindowsNativeDispatcher_BackupSeek(JNIEnv* env, jclass this,
- jlong hFile, jlong bytesToSeek, jlong context)
-{
- BOOL res;
- jint lowBytesToSeek = (jint)bytesToSeek;
- jint highBytesToSeek = (jint)(bytesToSeek >> 32);
- DWORD lowBytesSeeked;
- DWORD highBytesSeeked;
- VOID* pContext = jlong_to_ptr(context);
-
- res = BackupSeek((HANDLE)jlong_to_ptr(hFile),
- (DWORD)lowBytesToSeek,
- (DWORD)highBytesToSeek,
- &lowBytesSeeked,
- &highBytesSeeked,
- &pContext);
- if (res == 0) {
- throwWindowsException(env, GetLastError());
- }
-}
--- a/jdk/src/java.management/share/classes/javax/management/remote/JMXServiceURL.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.management/share/classes/javax/management/remote/JMXServiceURL.java Thu Apr 14 09:32:37 2016 -0700
@@ -34,10 +34,15 @@
import java.io.ObjectInputStream;
import java.io.Serializable;
+import java.net.Inet4Address;
+import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.MalformedURLException;
+import java.net.NetworkInterface;
+import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.BitSet;
+import java.util.Enumeration;
import java.util.Locale;
import java.util.StringTokenizer;
@@ -236,10 +241,13 @@
* @param protocol the protocol part of the URL. If null, defaults
* to <code>jmxmp</code>.
*
- * @param host the host part of the URL. If null, defaults to the
- * local host name, as determined by
- * <code>InetAddress.getLocalHost().getHostName()</code>. If it
- * is a numeric IPv6 address, it can optionally be enclosed in
+ * @param host the host part of the URL. If host is null and if
+ * local host name can be resolved to an IP, then host defaults
+ * to local host name as determined by
+ * <code>InetAddress.getLocalHost().getHostName()</code>. If host is null
+ * and if local host name cannot be resolved to an IP, then host
+ * defaults to numeric IP address of one of the active network interfaces.
+ * If host is a numeric IPv6 address, it can optionally be enclosed in
* square brackets <code>[]</code>.
*
* @param port the port part of the URL.
@@ -260,10 +268,13 @@
* @param protocol the protocol part of the URL. If null, defaults
* to <code>jmxmp</code>.
*
- * @param host the host part of the URL. If null, defaults to the
- * local host name, as determined by
- * <code>InetAddress.getLocalHost().getHostName()</code>. If it
- * is a numeric IPv6 address, it can optionally be enclosed in
+ * @param host the host part of the URL. If host is null and if
+ * local host name can be resolved to an IP, then host defaults
+ * to local host name as determined by
+ * <code>InetAddress.getLocalHost().getHostName()</code>. If host is null
+ * and if local host name cannot be resolved to an IP, then host
+ * defaults to numeric IP address of one of the active network interfaces.
+ * If host is a numeric IPv6 address, it can optionally be enclosed in
* square brackets <code>[]</code>.
*
* @param port the port part of the URL.
@@ -286,32 +297,45 @@
InetAddress local;
try {
local = InetAddress.getLocalHost();
- } catch (UnknownHostException e) {
- throw new MalformedURLException("Local host name unknown: " +
- e);
- }
-
- host = local.getHostName();
+ host = local.getHostName();
- /* We might have a hostname that violates DNS naming
- rules, for example that contains an `_'. While we
- could be strict and throw an exception, this is rather
- user-hostile. Instead we use its numerical IP address.
- We can only reasonably do this for the host==null case.
- If we're given an explicit host name that is illegal we
- have to reject it. (Bug 5057532.) */
- try {
- validateHost(host, port);
- } catch (MalformedURLException e) {
- if (logger.fineOn()) {
+ /* We might have a hostname that violates DNS naming
+ rules, for example that contains an `_'. While we
+ could be strict and throw an exception, this is rather
+ user-hostile. Instead we use its numerical IP address.
+ We can only reasonably do this for the host==null case.
+ If we're given an explicit host name that is illegal we
+ have to reject it. (Bug 5057532.) */
+ try {
+ validateHost(host, port);
+ } catch (MalformedURLException e) {
+ if (logger.fineOn()) {
logger.fine("JMXServiceURL",
"Replacing illegal local host name " +
host + " with numeric IP address " +
"(see RFC 1034)", e);
}
host = local.getHostAddress();
- /* Use the numeric address, which could be either IPv4
- or IPv6. validateHost will accept either. */
+ }
+ } catch (UnknownHostException e) {
+ try {
+ /*
+ If hostname cannot be resolved, we will try and use numeric
+ IPv4/IPv6 address. If host=null while starting agent,
+ we know that it will be started on all interfaces - 0.0.0.0.
+ Hence we will use IP address of first active non-loopback
+ interface
+ */
+ host = getActiveNetworkInterfaceIP();
+ if (host == null) {
+ throw new MalformedURLException("Unable"
+ + " to resolve hostname or "
+ + "get valid IP address");
+ }
+ } catch (SocketException ex) {
+ throw new MalformedURLException("Unable"
+ + " to resolve hostname or get valid IP address");
+ }
}
}
@@ -340,6 +364,33 @@
validate();
}
+ private String getActiveNetworkInterfaceIP() throws SocketException {
+ Enumeration<NetworkInterface>
+ networkInterface = NetworkInterface.getNetworkInterfaces();
+ String ipv6AddrStr = null;
+ while (networkInterface.hasMoreElements()) {
+ NetworkInterface nic = networkInterface.nextElement();
+ if (nic.isUp() && !nic.isLoopback()) {
+ Enumeration<InetAddress> inet = nic.getInetAddresses();
+ while (inet.hasMoreElements()) {
+ InetAddress addr = inet.nextElement();
+ if (addr instanceof Inet4Address
+ && !addr.isLinkLocalAddress()) {
+ return addr.getHostAddress();
+ }else if (addr instanceof Inet6Address
+ && !addr.isLinkLocalAddress()) {
+ /*
+ We save last seen IPv6 address which we will return
+ if we do not find any interface with IPv4 address.
+ */
+ ipv6AddrStr = addr.getHostAddress();
+ }
+ }
+ }
+ }
+ return ipv6AddrStr;
+ }
+
private static final String INVALID_INSTANCE_MSG =
"Trying to deserialize an invalid instance of JMXServiceURL";
private void readObject(ObjectInputStream inputStream) throws IOException, ClassNotFoundException {
@@ -540,7 +591,9 @@
* constructor that takes a separate host parameter, the result is
* the string that was specified. If that string was null, the
* result is
- * <code>InetAddress.getLocalHost().getHostName()</code>.</p>
+ * <code>InetAddress.getLocalHost().getHostName()</code> if local host name
+ * can be resolved to an IP. Else numeric IP address of an active
+ * network interface will be used.</p>
*
* <p>In either case, if the host was specified using the
* <code>[...]</code> syntax for numeric IPv6 addresses, the
--- a/jdk/src/java.management/share/classes/sun/management/jdp/JdpBroadcaster.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.management/share/classes/sun/management/jdp/JdpBroadcaster.java Thu Apr 14 09:32:37 2016 -0700
@@ -99,30 +99,7 @@
throw new JdpException("Unable to bind to source address");
}
channel.setOption(StandardSocketOptions.IP_MULTICAST_IF, interf);
- } else {
- Enumeration<NetworkInterface> nics = NetworkInterface.getNetworkInterfaces();
- boolean succeed = false;
-
- while (nics.hasMoreElements()) {
- NetworkInterface nic = nics.nextElement();
-
- if (nic.isUp() && nic.supportsMulticast()) {
- try {
- channel.setOption(StandardSocketOptions.IP_MULTICAST_IF, nic);
- succeed = true;
- } catch (IOException ex) {
- // pass
- }
- }
-
- }
-
- if (!succeed) {
- throw new JdpException("Unable to bind to any interfaces.");
- }
-
}
-
}
/**
--- a/jdk/src/java.security.sasl/share/classes/javax/security/sasl/Sasl.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.security.sasl/share/classes/javax/security/sasl/Sasl.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -312,7 +312,8 @@
*
* @implNote
* The JDK Reference Implementation additionally uses the
- * {@code jdk.security.provider.preferred} property to determine
+ * {@code jdk.security.provider.preferred}
+ * {@link Security#getProperty(String) Security} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
@@ -461,7 +462,8 @@
*
* @implNote
* The JDK Reference Implementation additionally uses the
- * {@code jdk.security.provider.preferred} property to determine
+ * {@code jdk.security.provider.preferred}
+ * {@link Security#getProperty(String) Security} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
--- a/jdk/src/java.smartcardio/share/classes/javax/smartcardio/TerminalFactory.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.smartcardio/share/classes/javax/smartcardio/TerminalFactory.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -231,7 +231,8 @@
*
* @implNote
* The JDK Reference Implementation additionally uses the
- * {@code jdk.security.provider.preferred} property to determine
+ * {@code jdk.security.provider.preferred}
+ * {@link Security#getProperty(String) Security} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/TransformService.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/TransformService.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -138,7 +138,8 @@
*
* @implNote
* The JDK Reference Implementation additionally uses the
- * {@code jdk.security.provider.preferred} property to determine
+ * {@code jdk.security.provider.preferred}
+ * {@link Security#getProperty(String) Security} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -175,7 +175,8 @@
*
* @implNote
* The JDK Reference Implementation additionally uses the
- * {@code jdk.security.provider.preferred} property to determine
+ * {@code jdk.security.provider.preferred}
+ * {@link Security#getProperty(String) Security} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -131,7 +131,8 @@
*
* @implNote
* The JDK Reference Implementation additionally uses the
- * {@code jdk.security.provider.preferred} property to determine
+ * {@code jdk.security.provider.preferred}
+ * {@link Security#getProperty(String) Security} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
@@ -272,7 +273,8 @@
*
* @implNote
* The JDK Reference Implementation additionally uses the
- * {@code jdk.security.provider.preferred} property to determine
+ * {@code jdk.security.provider.preferred}
+ * {@link Security#getProperty(String) Security} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
--- a/jdk/test/Makefile Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/Makefile Thu Apr 14 09:32:37 2016 -0700
@@ -125,6 +125,24 @@
JTREG_NATIVE_PATH = -nativepath:$(shell $(GETMIXEDPATH) "$(TESTNATIVE_DIR)/jdk/jtreg/native")
endif
+# jtreg failure handler config
+ifeq ($(FAILURE_HANDLER_DIR), )
+ ifneq ($(TESTNATIVE_DIR), )
+ FAILURE_HANDLER_DIR := $(TESTNATIVE_DIR)/failure_handler
+ endif
+endif
+ifneq ($(FAILURE_HANDLER_DIR), )
+ FAILURE_HANDLER_DIR_MIXED := $(shell $(GETMIXEDPATH) "$(FAILURE_HANDLER_DIR)")
+ JTREG_FAILURE_HANDLER_OPTIONS := \
+ -timeoutHandlerDir:$(FAILURE_HANDLER_DIR_MIXED)/jtregFailureHandler.jar \
+ -observerDir:$(FAILURE_HANDLER_DIR_MIXED)/jtregFailureHandler.jar \
+ -timeoutHandler:jdk.test.failurehandler.jtreg.GatherProcessInfoTimeoutHandler \
+ -observer:jdk.test.failurehandler.jtreg.GatherDiagnosticInfoObserver
+ ifeq ($(UNAME_S), CYGWIN)
+ JTREG_FAILURE_HANDLER_OPTIONS += -J-Djava.library.path="$(FAILURE_HANDLER_DIR_MIXED)"
+ endif
+endif
+
# Expect JPRT to set JPRT_ARCHIVE_BUNDLE (path to zip bundle for results)
ifdef JPRT_ARCHIVE_BUNDLE
ARCHIVE_BUNDLE = $(JPRT_ARCHIVE_BUNDLE)
@@ -329,6 +347,7 @@
-w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTwork") \
-jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)") \
$(JTREG_NATIVE_PATH) \
+ $(JTREG_FAILURE_HANDLER_OPTIONS) \
$(JTREG_EXCLUSIONS) \
$(JTREG_TEST_OPTIONS) \
$(TEST_SELECTION) \
--- a/jdk/test/ProblemList.txt Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/ProblemList.txt Thu Apr 14 09:32:37 2016 -0700
@@ -153,8 +153,6 @@
javax/management/remote/mandatory/notif/NotifReconnectDeadlockTest.java 8042215 generic-all
-sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java 8147985 generic-all
-
############################################################################
# jdk_net
@@ -236,7 +234,7 @@
sun/security/pkcs11/MessageDigest/ReinitDigest.java 8077138,8023434 windows-all
sun/security/pkcs11/MessageDigest/TestCloning.java 8077138,8023434 windows-all
sun/security/pkcs11/Provider/ConfigQuotedString.sh 8077138,8023434 windows-all
-sun/security/pkcs11/Provider/Login.sh 8077138,8023434,8153545 windows-all,linux-all
+sun/security/pkcs11/Provider/Login.sh 8077138,8023434 windows-all
sun/security/pkcs11/SampleTest.java 8077138,8023434 windows-all
sun/security/pkcs11/Secmod/AddPrivateKey.java 8077138,8023434 windows-all
sun/security/pkcs11/Secmod/AddTrustedCert.java 8077138,8023434 windows-all
@@ -337,6 +335,10 @@
com/sun/jdi/GetLocalVariables4Test.sh 8067354 windows-all
+com/sun/jdi/InterfaceMethodsTest.java 8152586 generic-all
+
+com/sun/jdi/InvokeTest.java 8152586 generic-all
+
############################################################################
# jdk_util
--- a/jdk/test/com/sun/jdi/InterruptHangTest.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/com/sun/jdi/InterruptHangTest.java Thu Apr 14 09:32:37 2016 -0700
@@ -153,14 +153,17 @@
timerThread = new Thread("test timer") {
public void run() {
int mySteps = 0;
+ float timeoutFactor = Float.parseFloat(System.getProperty("test.timeout.factor", "1.0"));
+ long sleepSeconds = (long)(20 * timeoutFactor);
+ println("Timer watching for steps every " + sleepSeconds + " seconds");
while (true) {
try {
- Thread.sleep(20000);
+ Thread.sleep(sleepSeconds * 1000);
synchronized(sync) {
- System.out.println("steps = " + nSteps);
+ println("steps = " + nSteps);
if (mySteps == nSteps) {
- // no step for 10 secs
- failure("failure: Debuggee appears to be hung");
+ // no step for a long time
+ failure("failure: Debuggee appears to be hung (no steps for " + sleepSeconds + "s)");
vm().exit(-1);
break;
}
--- a/jdk/test/com/sun/jdi/ShellScaffold.sh Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/com/sun/jdi/ShellScaffold.sh Thu Apr 14 09:32:37 2016 -0700
@@ -131,6 +131,9 @@
# This can be increased if timing seems to be an issue.
sleep_seconds=1
+if [ -n "$TIMEOUT_FACTOR" ] ; then
+ sleep_seconds=$(echo $TIMEOUT_FACTOR $sleep_seconds | awk '{printf "%d\n", int($1 * $2)}')
+fi
echo "ShellScaffold.sh: Version" >& 2
topPid=$$
--- a/jdk/test/com/sun/jdi/TestScaffold.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/com/sun/jdi/TestScaffold.java Thu Apr 14 09:32:37 2016 -0700
@@ -64,6 +64,7 @@
boolean vmDisconnected = false;
final String[] args;
protected boolean testFailed = false;
+ protected long startTime;
static private class ArgInfo {
String targetVMArgs = "";
@@ -425,6 +426,7 @@
abstract protected void runTests() throws Exception;
final public void startTests() throws Exception {
+ startTime = System.currentTimeMillis();
try {
runTests();
} finally {
@@ -433,7 +435,8 @@
}
protected void println(String str) {
- System.err.println(str);
+ long elapsed = System.currentTimeMillis() - startTime;
+ System.err.println("[" + elapsed + "ms] " + str);
}
protected void print(String str) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/invoke/ConstantIdentityMHTest.java Thu Apr 14 09:32:37 2016 -0700
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @summary unit tests for java.lang.invoke.MethodHandles
+ * @run testng/othervm -ea -esa test.java.lang.invoke.ConstantIdentityMHTest
+ */
+package test.java.lang.invoke;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+import java.util.List;
+import static java.lang.invoke.MethodHandles.*;
+import static java.lang.invoke.MethodType.*;
+import static org.testng.AssertJUnit.*;
+import org.testng.annotations.*;
+
+public class ConstantIdentityMHTest {
+
+ @DataProvider(name = "testZeroData")
+ private Object[][] testZeroData() {
+ return new Object[][] {
+ {void.class, "()void"},
+ {int.class, "()int"},
+ {byte.class, "()byte"},
+ {short.class, "()short"},
+ {long.class, "()long"},
+ {float.class, "()float"},
+ {double.class, "()double"},
+ {boolean.class, "()boolean"},
+ {char.class, "()char"},
+ {Integer.class, "()Integer"}
+ };
+ }
+
+ @Test(dataProvider = "testZeroData")
+ public void testZero(Class<?> expectedtype, String expected) throws Throwable {
+ assertEquals(MethodHandles.zero(expectedtype).type().toString(), expected);
+ }
+
+ @Test
+ @ExpectedExceptions(NullPointerException.class)
+ public void testZeroNPE() {
+ MethodHandle mh = MethodHandles.zero(null);
+ }
+
+ @Test
+ void testEmpty() throws Throwable {
+ MethodHandle cat = lookup().findVirtual(String.class, "concat", methodType(String.class, String.class));
+ assertEquals("xy", (String)cat.invoke("x","y"));
+ MethodHandle mhEmpty = MethodHandles.empty(cat.type());
+ assertEquals(null, (String)mhEmpty.invoke("x","y"));
+ }
+
+ @Test
+ @ExpectedExceptions(NullPointerException.class)
+ void testEmptyNPE() {
+ MethodHandle lenEmptyMH = MethodHandles.empty(null);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/invoke/DropArgumentsTest.java Thu Apr 14 09:32:37 2016 -0700
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @summary unit tests for java.lang.invoke.MethodHandles
+ * @run testng/othervm -ea -esa test.java.lang.invoke.DropArgumentsTest
+ */
+package test.java.lang.invoke;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+import java.util.List;
+import static java.lang.invoke.MethodHandles.*;
+import static java.lang.invoke.MethodType.*;
+import static org.testng.AssertJUnit.*;
+import org.testng.annotations.*;
+
+public class DropArgumentsTest {
+
+ @Test
+ public void testDropArgumentsToMatch() throws Throwable {
+ MethodHandle cat = lookup().findVirtual(String.class, "concat", methodType(String.class, String.class));
+ MethodType bigType = cat.type().insertParameterTypes(0, String.class, String.class, int.class);
+ MethodHandle d0 = MethodHandles.dropArgumentsToMatch(cat, 0, bigType.parameterList(), 3);
+ assertEquals("xy",(String)d0.invokeExact("m", "n", 1, "x", "y"));
+ MethodHandle d1 = MethodHandles.dropArgumentsToMatch(cat, 0, bigType.parameterList(), 0);
+ assertEquals("mn",(String)d1.invokeExact("m", "n", 1, "x", "y"));
+ MethodHandle d2 = MethodHandles.dropArgumentsToMatch(cat, 1, bigType.parameterList(), 4);
+ assertEquals("xy",(String)d2.invokeExact("x", "b", "c", 1, "a", "y"));
+
+ }
+
+ @DataProvider(name = "dropArgumentsToMatchNPEData")
+ private Object[][] dropArgumentsToMatchNPEData()
+ throws NoSuchMethodException, IllegalAccessException {
+ MethodHandle cat = lookup().findVirtual(String.class, "concat", methodType(String.class, String.class));
+ return new Object[][] {
+ { (MethodHandle) null, 0, cat.type().parameterList(), 0 },
+ { cat, 0, null, 0 }
+ };
+ }
+
+ @Test(dataProvider = "dropArgumentsToMatchNPEData")
+ @ExpectedExceptions(NullPointerException.class)
+ public void dropArgumentsToMatchNPE(MethodHandle target, int pos, List<Class<?>> valueType, int skip) {
+ MethodHandles.dropArgumentsToMatch(target, pos, valueType , skip);
+ }
+
+ @DataProvider(name = "dropArgumentsToMatchIAEData")
+ private Object[][] dropArgumentsToMatchIAEData()
+ throws NoSuchMethodException, IllegalAccessException {
+ MethodHandle cat = lookup().findVirtual(String.class, "concat", methodType(String.class, String.class));
+ MethodType bigType = cat.type().insertParameterTypes(0, String.class, String.class, int.class);
+ return new Object[][] {
+ {cat, -1, bigType.parameterList(), 0},
+ {cat, 0, bigType.parameterList(), -1},
+ {cat, 3, bigType.parameterList(), 0},
+ {cat, 0, bigType.parameterList(), 2}
+ };
+ }
+
+ @Test(dataProvider = "dropArgumentsToMatchIAEData")
+ @ExpectedExceptions(IllegalArgumentException.class)
+ public void dropArgumentsToMatchIAE(MethodHandle target, int pos, List<Class<?>> valueType, int skip) {
+ MethodHandles.dropArgumentsToMatch(target, pos, valueType , skip);
+ }
+}
--- a/jdk/test/java/lang/invoke/JavaDocExamplesTest.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/JavaDocExamplesTest.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -57,7 +57,9 @@
testFindVirtual();
testFindSpecial();
testPermuteArguments();
+ testZero();
testDropArguments();
+ testDropArgumentsToMatch();
testFilterArguments();
testFoldArguments();
testFoldArguments2();
@@ -235,6 +237,17 @@
}}
}
+@Test public void testZero() throws Throwable {
+ {{
+{} /// JAVADOC
+Class<?> type = Double.class;
+MethodHandle mh1 = MethodHandles.explicitCastArguments(MethodHandles.constant(Object.class, null), methodType(type));
+assertEquals("()Double", mh1.type().toString());
+MethodHandle mh2 = MethodHandles.empty(methodType(type));
+assertEquals("()Double", mh2.type().toString());
+ }}
+ }
+
@Test public void testDropArguments() throws Throwable {
{{
{} /// JAVADOC
@@ -262,6 +275,24 @@
}}
}
+ @Test public void testDropArgumentsToMatch() throws Throwable {
+ {{
+{} /// JAVADOC
+MethodHandle h0= constant(boolean.class, true);
+MethodHandle h1 = lookup().findVirtual(String.class, "concat", methodType(String.class, String.class));
+MethodType bigType = h1.type().insertParameterTypes(1, String.class, int.class);
+MethodHandle h2 = dropArguments(h1, 0, bigType.parameterList());
+if (h1.type().parameterCount() < h2.type().parameterCount()) {
+ h1 = dropArgumentsToMatch(h1, 0, h2.type().parameterList(), 0); // lengthen h1
+}
+else {
+ h2 = dropArgumentsToMatch(h2, 0, h1.type().parameterList(), 0); // lengthen h2
+}
+MethodHandle h3 = guardWithTest(h0, h1, h2);
+assertEquals("xy", h3.invoke("x", "y", 1, "a", "b", "c"));
+ }}
+ }
+
@Test public void testFilterArguments() throws Throwable {
{{
{} /// JAVADOC
--- a/jdk/test/java/lang/invoke/LoopCombinatorTest.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/LoopCombinatorTest.java Thu Apr 14 09:32:37 2016 -0700
@@ -26,6 +26,8 @@
/* @test
* @bug 8139885
* @bug 8150635
+ * @bug 8150957
+ * @bug 8153637
* @run testng/othervm -ea -esa test.java.lang.invoke.LoopCombinatorTest
*/
@@ -302,6 +304,18 @@
}
@Test
+ public static void testCountedLoopCounterInit() throws Throwable {
+ // int x = 0; for (int i = 0; i < 5; ++i) { x += i; } return x; => 10
+ // (only if counter's first value in body is 0)
+ MethodHandle iter = MethodHandles.constant(int.class, 5);
+ MethodHandle init = MethodHandles.constant(int.class, 0);
+ MethodHandle body = Counted.MH_addCounter;
+ MethodHandle loop = MethodHandles.countedLoop(iter, init, body);
+ assertEquals(Counted.MT_counterInit, loop.type());
+ assertEquals(10, loop.invoke());
+ }
+
+ @Test
public static void testIterateSum() throws Throwable {
// Integer[] a = new Integer[]{1,2,3,4,5,6}; int sum = 0; for (int e : a) { sum += e; } return sum; => 21
MethodHandle loop = MethodHandles.iteratedLoop(Iterate.MH_sumIterator, Iterate.MH_sumInit, Iterate.MH_sumStep);
@@ -667,12 +681,17 @@
System.out.print("hello");
}
+ static int addCounter(int counter, int x) {
+ return x + counter;
+ }
+
static final Class<Counted> COUNTED = Counted.class;
static final MethodType MT_start = methodType(String.class, String.class);
static final MethodType MT_step = methodType(String.class, int.class, String.class, String.class);
static final MethodType MT_stepUpdateArray = methodType(void.class, int.class, int[].class);
static final MethodType MT_printHello = methodType(void.class, int.class);
+ static final MethodType MT_addCounter = methodType(int.class, int.class, int.class);
static final MethodHandle MH_13;
static final MethodHandle MH_m5;
@@ -681,10 +700,12 @@
static final MethodHandle MH_step;
static final MethodHandle MH_stepUpdateArray;
static final MethodHandle MH_printHello;
+ static final MethodHandle MH_addCounter;
static final MethodType MT_counted = methodType(String.class, String.class);
static final MethodType MT_arrayCounted = methodType(void.class, int[].class);
static final MethodType MT_countedPrinting = methodType(void.class);
+ static final MethodType MT_counterInit = methodType(int.class);
static {
try {
@@ -695,6 +716,7 @@
MH_step = LOOKUP.findStatic(COUNTED, "step", MT_step);
MH_stepUpdateArray = LOOKUP.findStatic(COUNTED, "stepUpdateArray", MT_stepUpdateArray);
MH_printHello = LOOKUP.findStatic(COUNTED, "printHello", MT_printHello);
+ MH_addCounter = LOOKUP.findStatic(COUNTED, "addCounter", MT_addCounter);
} catch (Exception e) {
throw new ExceptionInInitializerError(e);
}
--- a/jdk/test/java/lang/invoke/TryFinallyTest.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/TryFinallyTest.java Thu Apr 14 09:32:37 2016 -0700
@@ -25,6 +25,7 @@
/* @test
* @bug 8139885
+ * @bug 8150824
* @bug 8150825
* @run testng/othervm -ea -esa test.java.lang.invoke.TryFinallyTest
*/
@@ -71,12 +72,32 @@
}
@DataProvider
+ static Object[][] omitTrailingArguments() {
+ MethodHandle c = TryFinally.MH_voidCleanup;
+ return new Object[][]{
+ {c},
+ {MethodHandles.dropArguments(c, 1, int.class)},
+ {MethodHandles.dropArguments(c, 1, int.class, long.class)},
+ {MethodHandles.dropArguments(c, 1, int.class, long.class, Object.class, int.class)},
+ {MethodHandles.dropArguments(c, 1, int.class, long.class, Object.class, int.class, long.class)}
+ };
+ }
+
+ @Test(dataProvider = "omitTrailingArguments")
+ public static void testTryFinallyOmitTrailingArguments(MethodHandle cleanup) throws Throwable {
+ MethodHandle tf = MethodHandles.tryFinally(TryFinally.MH_dummyTarget, cleanup);
+ tf.invoke(1, 2L, "a", 23, 42L, "b");
+ }
+
+ @DataProvider
static Object[][] negativeTestData() {
MethodHandle intid = MethodHandles.identity(int.class);
MethodHandle intco = MethodHandles.constant(int.class, 0);
MethodHandle errTarget = MethodHandles.dropArguments(intco, 0, int.class, double.class, String.class, int.class);
MethodHandle errCleanup = MethodHandles.dropArguments(MethodHandles.constant(int.class, 0), 0, Throwable.class,
int.class, double.class, Object.class);
+ MethodHandle voidTarget = TryFinally.MH_voidTarget;
+ MethodHandle voidICleanup = MethodHandles.dropArguments(TryFinally.MH_voidCleanup, 1, int.class);
return new Object[][]{
{intid, MethodHandles.identity(double.class),
"target and return types must match: double != int"},
@@ -87,9 +108,9 @@
{errTarget, errCleanup,
"cleanup parameters after (Throwable,result) and target parameter list prefix must match: " +
errCleanup.type() + " != " + errTarget.type()},
- {TryFinally.MH_voidTarget, TryFinally.MH_voidCleanup,
+ {voidTarget, voidICleanup,
"cleanup parameters after (Throwable,result) and target parameter list prefix must match: " +
- TryFinally.MH_voidCleanup.type() + " != " + TryFinally.MH_voidTarget.type()}
+ voidICleanup.type() + " != " + voidTarget.type()}
};
}
@@ -133,7 +154,7 @@
static void voidTarget() {}
- static void voidCleanup(Throwable t, int a) {}
+ static void voidCleanup(Throwable t) {}
static final Class<TryFinally> TRY_FINALLY = TryFinally.class;
@@ -144,7 +165,7 @@
static final MethodType MT_greetMore = methodType(String.class, String.class, String.class);
static final MethodType MT_exclaimMore = methodType(String.class, Throwable.class, String.class, String.class);
static final MethodType MT_voidTarget = methodType(void.class);
- static final MethodType MT_voidCleanup = methodType(void.class, Throwable.class, int.class);
+ static final MethodType MT_voidCleanup = methodType(void.class, Throwable.class);
static final MethodHandle MH_greet;
static final MethodHandle MH_exclaim;
@@ -155,6 +176,8 @@
static final MethodHandle MH_voidTarget;
static final MethodHandle MH_voidCleanup;
+ static final MethodHandle MH_dummyTarget;
+
static final MethodType MT_hello = methodType(String.class, String.class);
static final MethodType MT_printHello = methodType(void.class, String.class);
static final MethodType MT_moreHello = methodType(String.class, String.class, String.class);
@@ -169,6 +192,8 @@
MH_exclaimMore = LOOKUP.findStatic(TRY_FINALLY, "exclaimMore", MT_exclaimMore);
MH_voidTarget = LOOKUP.findStatic(TRY_FINALLY, "voidTarget", MT_voidTarget);
MH_voidCleanup = LOOKUP.findStatic(TRY_FINALLY, "voidCleanup", MT_voidCleanup);
+ MH_dummyTarget = MethodHandles.dropArguments(MH_voidTarget, 0, int.class, long.class, Object.class,
+ int.class, long.class, Object.class);
} catch (Exception e) {
throw new ExceptionInInitializerError(e);
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/invoke/VarArgsTest.java Thu Apr 14 09:32:37 2016 -0700
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @summary unit tests for java.lang.invoke.MethodHandles
+ * @run testng/othervm -ea -esa test.java.lang.invoke.VarArgsTest
+ */
+package test.java.lang.invoke;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+import java.util.Arrays;
+import java.util.List;
+import static java.lang.invoke.MethodHandles.*;
+import static java.lang.invoke.MethodType.*;
+import static org.testng.AssertJUnit.*;
+import org.testng.annotations.*;
+
+public class VarArgsTest {
+
+ @Test
+ public void testWithVarargs() throws Throwable {
+ MethodHandle deepToString = publicLookup()
+ .findStatic(Arrays.class, "deepToString", methodType(String.class, Object[].class));
+ assertFalse(deepToString.isVarargsCollector());
+ MethodHandle ts = deepToString.withVarargs(false);
+ assertFalse(ts.isVarargsCollector());
+ MethodHandle ts1 = deepToString.withVarargs(true);
+ assertTrue(ts1.isVarargsCollector());
+ assertEquals("[won]", (String) ts1.invokeExact(new Object[]{"won"}));
+ assertEquals("[won]", (String) ts1.invoke(new Object[]{"won"}));
+ assertEquals("[won]", (String) ts1.invoke("won"));
+ assertEquals("[won, won]", (String) ts1.invoke("won", "won"));
+ assertEquals("[won, won]", (String) ts1.invoke(new Object[]{"won", "won"}));
+ assertEquals("[[won]]", (String) ts1.invoke((Object) new Object[]{"won"}));
+ }
+
+ @Test
+ public void testWithVarargs2() throws Throwable {
+ MethodHandle asList = publicLookup()
+ .findStatic(Arrays.class, "asList", methodType(List.class, Object[].class));
+ MethodHandle asListWithVarargs = asList.withVarargs(asList.isVarargsCollector());
+ assert(asListWithVarargs.isVarargsCollector());
+ assertEquals("[]", asListWithVarargs.invoke().toString());
+ assertEquals("[1]", asListWithVarargs.invoke(1).toString());
+ assertEquals("[two, too]", asListWithVarargs.invoke("two", "too").toString());
+ }
+
+ @Test
+ @ExpectedExceptions(IllegalArgumentException.class)
+ public void testWithVarargsIAE() throws Throwable {
+ MethodHandle lenMH = publicLookup()
+ .findVirtual(String.class, "length", methodType(int.class));
+ MethodHandle lenMHWithVarargs = lenMH.withVarargs(true);
+ }
+
+}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleBaseTest.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleBaseTest.java Thu Apr 14 09:32:37 2016 -0700
@@ -126,33 +126,33 @@
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 @@
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 @@
try {
mh = MethodHandles.publicLookup().
findVirtual(VarHandle.class,
- tam.name(),
+ tam.toAccessMode().methodName(),
mt);
} catch (Exception e) {
throw new RuntimeException(e);
@@ -441,33 +442,33 @@
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());
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java Thu Apr 14 09:32:37 2016 -0700
@@ -90,27 +90,27 @@
@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));
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java Thu Apr 14 09:32:37 2016 -0700
@@ -90,27 +90,27 @@
@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));
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java Thu Apr 14 09:32:37 2016 -0700
@@ -90,27 +90,27 @@
@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));
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java Thu Apr 14 09:32:37 2016 -0700
@@ -90,27 +90,27 @@
@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));
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java Thu Apr 14 09:32:37 2016 -0700
@@ -90,27 +90,27 @@
@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));
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java Thu Apr 14 09:32:37 2016 -0700
@@ -90,27 +90,27 @@
@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));
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java Thu Apr 14 09:32:37 2016 -0700
@@ -90,27 +90,27 @@
@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));
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java Thu Apr 14 09:32:37 2016 -0700
@@ -90,27 +90,27 @@
@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));
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessString.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessString.java Thu Apr 14 09:32:37 2016 -0700
@@ -90,27 +90,27 @@
@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));
}
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java Thu Apr 14 09:32:37 2016 -0700
@@ -76,28 +76,28 @@
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")
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java Thu Apr 14 09:32:37 2016 -0700
@@ -76,28 +76,28 @@
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")
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java Thu Apr 14 09:32:37 2016 -0700
@@ -76,28 +76,28 @@
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")
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java Thu Apr 14 09:32:37 2016 -0700
@@ -76,28 +76,28 @@
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")
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java Thu Apr 14 09:32:37 2016 -0700
@@ -76,28 +76,28 @@
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")
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java Thu Apr 14 09:32:37 2016 -0700
@@ -76,28 +76,28 @@
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")
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessBoolean.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessBoolean.java Thu Apr 14 09:32:37 2016 -0700
@@ -121,30 +121,30 @@
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 @@
}
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 @@
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 @@
}
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 @@
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 @@
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 @@
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);
});
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessByte.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessByte.java Thu Apr 14 09:32:37 2016 -0700
@@ -121,30 +121,30 @@
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 @@
}
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 @@
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 @@
}
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 @@
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 @@
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 @@
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);
});
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessChar.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessChar.java Thu Apr 14 09:32:37 2016 -0700
@@ -121,30 +121,30 @@
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 @@
}
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 @@
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 @@
}
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 @@
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 @@
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 @@
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');
});
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessDouble.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessDouble.java Thu Apr 14 09:32:37 2016 -0700
@@ -121,30 +121,30 @@
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 @@
}
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 @@
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 @@
}
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 @@
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 @@
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 @@
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);
});
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessFloat.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessFloat.java Thu Apr 14 09:32:37 2016 -0700
@@ -121,30 +121,30 @@
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 @@
}
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 @@
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 @@
}
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 @@
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 @@
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 @@
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);
});
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java Thu Apr 14 09:32:37 2016 -0700
@@ -121,128 +121,128 @@
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 @@
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 @@
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 @@
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);
});
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java Thu Apr 14 09:32:37 2016 -0700
@@ -121,128 +121,128 @@
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 @@
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 @@
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 @@
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);
});
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessShort.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessShort.java Thu Apr 14 09:32:37 2016 -0700
@@ -121,30 +121,30 @@
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 @@
}
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 @@
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 @@
}
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 @@
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 @@
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 @@
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);
});
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java Thu Apr 14 09:32:37 2016 -0700
@@ -121,118 +121,118 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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");
});
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeBoolean.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeBoolean.java Thu Apr 14 09:32:37 2016 -0700
@@ -326,7 +326,7 @@
}
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 @@
});
}
- 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 @@
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 @@
});
}
- 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 @@
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 @@
});
}
- 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)).
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeByte.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeByte.java Thu Apr 14 09:32:37 2016 -0700
@@ -326,7 +326,7 @@
}
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 @@
});
}
- 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 @@
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 @@
});
}
- 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 @@
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 @@
});
}
- 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)).
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeChar.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeChar.java Thu Apr 14 09:32:37 2016 -0700
@@ -326,7 +326,7 @@
}
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 @@
});
}
- 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 @@
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 @@
});
}
- 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 @@
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 @@
});
}
- 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)).
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeDouble.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeDouble.java Thu Apr 14 09:32:37 2016 -0700
@@ -326,7 +326,7 @@
}
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 @@
});
}
- 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 @@
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 @@
});
}
- 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 @@
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 @@
});
}
- 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)).
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeFloat.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeFloat.java Thu Apr 14 09:32:37 2016 -0700
@@ -326,7 +326,7 @@
}
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 @@
});
}
- 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 @@
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 @@
});
}
- 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 @@
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 @@
});
}
- 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)).
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeInt.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeInt.java Thu Apr 14 09:32:37 2016 -0700
@@ -615,7 +615,7 @@
}
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 @@
});
}
- 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 @@
});
}
- 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 @@
});
}
- 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 @@
});
}
- 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 @@
});
}
- 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 @@
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 @@
});
}
- 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 @@
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 @@
});
}
- 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 @@
});
}
- 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 @@
});
}
- 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 @@
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 @@
});
}
- 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 @@
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 @@
});
}
- 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 @@
});
}
- 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 @@
});
}
- 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)).
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeLong.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeLong.java Thu Apr 14 09:32:37 2016 -0700
@@ -615,7 +615,7 @@
}
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 @@
});
}
- 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 @@
});
}
- 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 @@
});
}
- 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 @@
});
}
- 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 @@
});
}
- 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 @@
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 @@
});
}
- 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 @@
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 @@
});
}
- 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 @@
});
}
- 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 @@
});
}
- 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 @@
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 @@
});
}
- 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 @@
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 @@
});
}
- 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 @@
});
}
- 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 @@
});
}
- 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)).
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeShort.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeShort.java Thu Apr 14 09:32:37 2016 -0700
@@ -326,7 +326,7 @@
}
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 @@
});
}
- 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 @@
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 @@
});
}
- 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 @@
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 @@
});
}
- 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)).
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeString.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeString.java Thu Apr 14 09:32:37 2016 -0700
@@ -557,7 +557,7 @@
}
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 @@
});
}
- 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 @@
});
}
- 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 @@
});
}
- 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 @@
});
}
- 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 @@
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 @@
});
}
- 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 @@
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 @@
});
}
- 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 @@
});
}
- 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 @@
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 @@
});
}
- 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 @@
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 @@
});
}
- 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 @@
});
}
- 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)).
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestReflection.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestReflection.java Thu Apr 14 09:32:37 2016 -0700
@@ -57,7 +57,7 @@
// 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 @@
// 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 @@
// 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 @@
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);
--- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template Thu Apr 14 09:32:37 2016 -0700
@@ -90,43 +90,41 @@
@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]
}
--- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template Thu Apr 14 09:32:37 2016 -0700
@@ -76,44 +76,42 @@
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]
}
--- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template Thu Apr 14 09:32:37 2016 -0700
@@ -121,131 +121,131 @@
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 @@
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 @@
#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 @@
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 @@
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 @@
#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 @@
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 @@
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 @@
#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 @@
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 @@
#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$);
});
--- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodType.java.template Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodType.java.template Thu Apr 14 09:32:37 2016 -0700
@@ -619,7 +619,7 @@
}
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 @@
});
}
- 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 @@
}
#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 @@
});
}
- 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 @@
});
}
- 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 @@
#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 @@
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 @@
});
}
- 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 @@
});
}
#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 @@
});
}
- 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 @@
});
}
- 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 @@
#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 @@
$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 @@
});
}
- 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 @@
});
}
#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 @@
});
}
- 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 @@
});
}
- 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 @@
#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)).
--- a/jdk/test/java/lang/management/ThreadMXBean/ThreadLists.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/lang/management/ThreadMXBean/ThreadLists.java Thu Apr 14 09:32:37 2016 -0700
@@ -35,6 +35,11 @@
public class ThreadLists {
public static void main(String args[]) {
+ // Bug id : JDK-8151797
+ // Use a lambda expression so that call-site cleaner thread is started
+ Runnable printLambda = () -> {System.out.println("Starting Test");};
+ printLambda.run();
+
// get top-level thread group
ThreadGroup top = Thread.currentThread().getThreadGroup();
ThreadGroup parent;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/URLClassLoader/definePackage/SplitPackage.java Thu Apr 14 09:32:37 2016 -0700
@@ -0,0 +1,102 @@
+/**
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8153665
+ * @summary Test two URLClassLoader define Package object of the same name
+ * @library /lib/testlibrary
+ * @build CompilerUtils
+ * @run testng SplitPackage
+ */
+
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.jar.Manifest;
+
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+public class SplitPackage {
+ private static final Path SRC_DIR = Paths.get(System.getProperty("test.src", "."));
+ private static final Path FOO_DIR = Paths.get("foo");
+ private static final Path BAR_DIR = Paths.get("bar");
+
+ @BeforeTest
+ private void setup() throws Exception {
+ Files.createDirectory(BAR_DIR);
+
+ Path pkgDir = Paths.get("p");
+ // compile classes in package p
+ assertTrue(CompilerUtils.compile(SRC_DIR.resolve(pkgDir), BAR_DIR));
+
+ // move p.Foo to a different directory
+ Path foo = pkgDir.resolve("Foo.class");
+ Files.createDirectories(FOO_DIR.resolve(pkgDir));
+ Files.move(BAR_DIR.resolve(foo), FOO_DIR.resolve(foo),
+ StandardCopyOption.REPLACE_EXISTING);
+ }
+
+ @Test
+ public void test() throws Exception {
+ URLClassLoader loader1 = new URLClassLoader(new URL[] {
+ FOO_DIR.toUri().toURL()
+ });
+ Loader loader2 = new Loader(new URL[] {
+ BAR_DIR.toUri().toURL()
+ }, loader1);
+
+ Class<?> foo = Class.forName("p.Foo", true, loader2);
+ Class<?> bar = Class.forName("p.Bar", true, loader2);
+ Class<?> baz = Class.forName("p.Baz", true, loader2);
+
+ Package pForFoo = loader1.getDefinedPackage("p");
+ Package pForBar = loader2.getDefinedPackage("p");
+
+ assertEquals(pForFoo.getName(), pForBar.getName());
+ assertTrue(pForFoo != pForBar);
+
+ try {
+ loader2.defineSplitPackage("p");
+ } catch (IllegalArgumentException e) {
+
+ }
+ }
+
+ static class Loader extends URLClassLoader {
+ Loader(URL[] urls, URLClassLoader parent) {
+ super(urls, parent);
+ }
+
+ public Package defineSplitPackage(String name) {
+ Manifest manifest = new Manifest();
+ return super.definePackage(name, manifest, null);
+ }
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/URLClassLoader/definePackage/p/Bar.java Thu Apr 14 09:32:37 2016 -0700
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package p;
+
+public class Bar { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/URLClassLoader/definePackage/p/Baz.java Thu Apr 14 09:32:37 2016 -0700
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package p;
+
+public class Baz { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/URLClassLoader/definePackage/p/Foo.java Thu Apr 14 09:32:37 2016 -0700
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package p;
+
+public class Foo { }
--- a/jdk/test/java/nio/channels/AsyncCloseAndInterrupt.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/nio/channels/AsyncCloseAndInterrupt.java Thu Apr 14 09:32:37 2016 -0700
@@ -23,7 +23,7 @@
/* @test
* @bug 4460583 4470470 4840199 6419424 6710579 6596323 6824135 6395224 7142919
- * 8151582
+ * 8151582 8068693 8153209
* @run main/othervm AsyncCloseAndInterrupt
* @summary Comprehensive test of asynchronous closing and interruption
* @author Mark Reinhold
@@ -557,7 +557,11 @@
}
// Test
- static void test(ChannelFactory cf, Op op, int test)
+ static void test(ChannelFactory cf, Op op, int test) throws Exception {
+ test(cf, op, test, true);
+ }
+
+ static void test(ChannelFactory cf, Op op, int test, boolean extraSleep)
throws Exception
{
log.println();
@@ -571,6 +575,10 @@
sleep(50);
} while (!t.ready);
+ if (extraSleep) {
+ sleep(100);
+ }
+
switch (test) {
case TEST_INTR:
@@ -603,15 +611,18 @@
break;
}
- t.finishAndThrow(500);
+ t.finishAndThrow(10000);
}
-
static void test(ChannelFactory cf, Op op) throws Exception {
+ test(cf, op, true);
+ }
+
+ static void test(ChannelFactory cf, Op op, boolean extraSleep) throws Exception {
// Test INTR cases before PREINTER cases since sometimes
// interrupted threads can't load classes
- test(cf, op, TEST_INTR);
- test(cf, op, TEST_PREINTR);
+ test(cf, op, TEST_INTR, extraSleep);
+ test(cf, op, TEST_PREINTR, extraSleep);
// Bugs, see FileChannelImpl for details
if (op == TRANSFER_FROM) {
@@ -623,7 +634,7 @@
return;
}
- test(cf, op, TEST_CLOSE);
+ test(cf, op, TEST_CLOSE, extraSleep);
}
static void test(ChannelFactory cf)
@@ -720,8 +731,8 @@
Future<Integer> pumpFuture = pumpRefuser(pumperExecutor);
waitPump("\nWait for initial Pump");
- test(socketChannelFactory, CONNECT);
- test(socketChannelFactory, FINISH_CONNECT);
+ test(socketChannelFactory, CONNECT, false);
+ test(socketChannelFactory, FINISH_CONNECT, false);
pumpDone = true;
Integer newConn = pumpFuture.get(30, TimeUnit.SECONDS);
--- a/jdk/test/java/security/testlibrary/SimpleOCSPServer.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/security/testlibrary/SimpleOCSPServer.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -86,6 +86,7 @@
private boolean logEnabled = false;
private ExecutorService threadPool;
private volatile boolean started = false;
+ private volatile boolean serverReady = false;
private volatile boolean receivedShutdown = false;
private long delayMsec = 0;
@@ -217,6 +218,9 @@
listenPort), 128);
log("Listening on " + servSocket.getLocalSocketAddress());
+ // Singal ready
+ serverReady = true;
+
// Update the listenPort with the new port number. If
// the server is restarted, it will bind to the same
// port rather than picking a new one.
@@ -242,11 +246,12 @@
threadPool.shutdown();
} catch (IOException ioe) {
err(ioe);
+ } finally {
+ // Reset state variables so the server can be restarted
+ receivedShutdown = false;
+ started = false;
+ serverReady = false;
}
-
- // Reset state variables so the server can be restarted
- receivedShutdown = false;
- started = false;
}
});
}
@@ -468,7 +473,7 @@
* server has not yet been bound to a port.
*/
public int getPort() {
- if (servSocket != null && started) {
+ if (serverReady) {
InetSocketAddress inetSock =
(InetSocketAddress)servSocket.getLocalSocketAddress();
return inetSock.getPort();
@@ -478,6 +483,15 @@
}
/**
+ * Use to check if OCSP server is ready to accept connection.
+ *
+ * @return true if server ready, false otherwise
+ */
+ public boolean isServerReady() {
+ return serverReady;
+ }
+
+ /**
* Set a delay between the reception of the request and production of
* the response.
*
--- a/jdk/test/java/time/tck/java/time/TCKDuration.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/time/tck/java/time/TCKDuration.java Thu Apr 14 09:32:37 2016 -0700
@@ -65,9 +65,11 @@
import static java.time.temporal.ChronoUnit.MICROS;
import static java.time.temporal.ChronoUnit.MILLIS;
import static java.time.temporal.ChronoUnit.MINUTES;
+import static java.time.temporal.ChronoUnit.MONTHS;
import static java.time.temporal.ChronoUnit.NANOS;
import static java.time.temporal.ChronoUnit.SECONDS;
import static java.time.temporal.ChronoUnit.WEEKS;
+import static java.time.temporal.ChronoUnit.YEARS;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
@@ -2287,6 +2289,133 @@
}
//-----------------------------------------------------------------------
+ // truncated(TemporalUnit)
+ //-----------------------------------------------------------------------
+ TemporalUnit NINETY_MINS = new TemporalUnit() {
+ @Override
+ public Duration getDuration() {
+ return Duration.ofMinutes(90);
+ }
+ @Override
+ public boolean isDurationEstimated() {
+ return false;
+ }
+ @Override
+ public boolean isDateBased() {
+ return false;
+ }
+ @Override
+ public boolean isTimeBased() {
+ return true;
+ }
+ @Override
+ public boolean isSupportedBy(Temporal temporal) {
+ return false;
+ }
+ @Override
+ public <R extends Temporal> R addTo(R temporal, long amount) {
+ throw new UnsupportedOperationException();
+ }
+ @Override
+ public long between(Temporal temporal1, Temporal temporal2) {
+ throw new UnsupportedOperationException();
+ }
+ @Override
+ public String toString() {
+ return "NinetyMins";
+ }
+ };
+
+ TemporalUnit NINETY_FIVE_MINS = new TemporalUnit() {
+ @Override
+ public Duration getDuration() {
+ return Duration.ofMinutes(95);
+ }
+ @Override
+ public boolean isDurationEstimated() {
+ return false;
+ }
+ @Override
+ public boolean isDateBased() {
+ return false;
+ }
+ @Override
+ public boolean isTimeBased() {
+ return false;
+ }
+ @Override
+ public boolean isSupportedBy(Temporal temporal) {
+ return false;
+ }
+ @Override
+ public <R extends Temporal> R addTo(R temporal, long amount) {
+ throw new UnsupportedOperationException();
+ }
+ @Override
+ public long between(Temporal temporal1, Temporal temporal2) {
+ throw new UnsupportedOperationException();
+ }
+ @Override
+ public String toString() {
+ return "NinetyFiveMins";
+ }
+ };
+
+ @DataProvider(name="truncatedToValid")
+ Object[][] data_truncatedToValid() {
+ return new Object[][] {
+ {Duration.ofSeconds(86400 + 3600 + 60 + 1, 123_456_789), NANOS, Duration.ofSeconds(86400 + 3600 + 60 + 1, 123_456_789)},
+ {Duration.ofSeconds(86400 + 3600 + 60 + 1, 123_456_789), MICROS, Duration.ofSeconds(86400 + 3600 + 60 + 1, 123_456_000)},
+ {Duration.ofSeconds(86400 + 3600 + 60 + 1, 123_456_789), MILLIS, Duration.ofSeconds(86400 + 3600 + 60 + 1, 1230_00_000)},
+ {Duration.ofSeconds(86400 + 3600 + 60 + 1, 123_456_789), SECONDS, Duration.ofSeconds(86400 + 3600 + 60 + 1, 0)},
+ {Duration.ofSeconds(86400 + 3600 + 60 + 1, 123_456_789), MINUTES, Duration.ofSeconds(86400 + 3600 + 60, 0)},
+ {Duration.ofSeconds(86400 + 3600 + 60 + 1, 123_456_789), HOURS, Duration.ofSeconds(86400 + 3600, 0)},
+ {Duration.ofSeconds(86400 + 3600 + 60 + 1, 123_456_789), DAYS, Duration.ofSeconds(86400, 0)},
+
+ {Duration.ofSeconds(86400 + 3600 + 60 + 1, 123_456_789), NINETY_MINS, Duration.ofSeconds(86400 + 0, 0)},
+ {Duration.ofSeconds(86400 + 7200 + 60 + 1, 123_456_789), NINETY_MINS, Duration.ofSeconds(86400 + 5400, 0)},
+ {Duration.ofSeconds(86400 + 10800 + 60 + 1, 123_456_789), NINETY_MINS, Duration.ofSeconds(86400 + 10800, 0)},
+
+ {Duration.ofSeconds(-86400 - 3600 - 60 - 1, 123_456_789), MINUTES, Duration.ofSeconds(-86400 - 3600 - 60, 0 )},
+ {Duration.ofSeconds(-86400 - 3600 - 60 - 1, 123_456_789), MICROS, Duration.ofSeconds(-86400 - 3600 - 60 - 1, 123_457_000)},
+
+ {Duration.ofSeconds(86400 + 3600 + 60 + 1, 0), SECONDS, Duration.ofSeconds(86400 + 3600 + 60 + 1, 0)},
+ {Duration.ofSeconds(-86400 - 3600 - 120, 0), MINUTES, Duration.ofSeconds(-86400 - 3600 - 120, 0)},
+
+ {Duration.ofSeconds(-1, 0), SECONDS, Duration.ofSeconds(-1, 0)},
+ {Duration.ofSeconds(-1, 123_456_789), SECONDS, Duration.ofSeconds(0, 0)},
+ {Duration.ofSeconds(-1, 123_456_789), NANOS, Duration.ofSeconds(0, -876_543_211)},
+ {Duration.ofSeconds(0, 123_456_789), SECONDS, Duration.ofSeconds(0, 0)},
+ {Duration.ofSeconds(0, 123_456_789), NANOS, Duration.ofSeconds(0, 123_456_789)},
+ };
+ }
+
+ @Test(dataProvider="truncatedToValid")
+ public void test_truncatedTo_valid(Duration input, TemporalUnit unit, Duration expected) {
+ assertEquals(input.truncatedTo(unit), expected);
+ }
+
+ @DataProvider(name="truncatedToInvalid")
+ Object[][] data_truncatedToInvalid() {
+ return new Object[][] {
+ {Duration.ofSeconds(1, 123_456_789), NINETY_FIVE_MINS},
+ {Duration.ofSeconds(1, 123_456_789), WEEKS},
+ {Duration.ofSeconds(1, 123_456_789), MONTHS},
+ {Duration.ofSeconds(1, 123_456_789), YEARS},
+ };
+ }
+
+ @Test(dataProvider="truncatedToInvalid", expectedExceptions=DateTimeException.class)
+ public void test_truncatedTo_invalid(Duration input, TemporalUnit unit) {
+ input.truncatedTo(unit);
+ }
+
+ @Test(expectedExceptions=NullPointerException.class)
+ public void test_truncatedTo_null() {
+ Duration.ofSeconds(1234).truncatedTo(null);
+ }
+
+ //-----------------------------------------------------------------------
// dividedBy()
//-----------------------------------------------------------------------
@DataProvider(name="DividedBy")
--- a/jdk/test/java/util/Currency/CurrencyTest.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/util/Currency/CurrencyTest.java Thu Apr 14 09:32:37 2016 -0700
@@ -23,7 +23,7 @@
/*
* @test
* @bug 4290801 4692419 4693631 5101540 5104960 6296410 6336600 6371531
- * 6488442 7036905 8008577 8039317 8074350 8074351
+ * 6488442 7036905 8008577 8039317 8074350 8074351 8150324
* @summary Basic tests for Currency class.
* @modules jdk.localedata
*/
@@ -32,12 +32,12 @@
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
-import java.util.Calendar;
-import java.util.Date;
+import java.time.LocalDate;
+import java.time.LocalTime;
+import java.time.ZoneId;
+import java.time.ZonedDateTime;
import java.util.Currency;
-import java.util.GregorianCalendar;
import java.util.Locale;
-import java.util.TimeZone;
public class CurrencyTest {
@@ -137,7 +137,7 @@
/*
* check currency changes
- * In current implementation, there is no data of old currency and transition date at jdk/src/share/classes/java/util/CurrencyData.properties.
+ * In current implementation, there is no data of old currency and transition date at jdk/make/data/currency/CurrencyData.properties.
* So, all the switch data arrays are empty. In the future, if data of old currency and transition date are necessary for any country, the
* arrays here can be updated so that the program can check the currency switch.
*/
@@ -146,15 +146,16 @@
String[] switchOverNew = {};
String[] switchOverTZ = {};
int[] switchOverYear = {};
- int[] switchOverMonth = {};
+ int[] switchOverMonth = {}; // java.time APIs accept month starting from 1 i.e. 01 for January
int[] switchOverDay = {};
for (int i = 0; i < switchOverCtry.length; i++) {
- TimeZone.setDefault(TimeZone.getTimeZone(switchOverTZ[i]));
- Calendar date = new GregorianCalendar(switchOverYear[i], switchOverMonth[i], switchOverDay[i]);
- long switchOver = date.getTime().getTime();
- boolean switchedOver = System.currentTimeMillis() >= switchOver;
- checkCountryCurrency(switchOverCtry[i], switchedOver ? switchOverNew[i] : switchOverOld[i]);
+ ZoneId zoneId = ZoneId.of(switchOverTZ[i]);
+ ZonedDateTime zonedDateAndTime = ZonedDateTime.of(LocalDate.of(switchOverYear[i], switchOverMonth[i], switchOverDay[i]),
+ LocalTime.MIDNIGHT, zoneId);
+ ZonedDateTime currentZonedDateAndTime = ZonedDateTime.now(zoneId);
+ checkCountryCurrency(switchOverCtry[i], (currentZonedDateAndTime.isAfter(zonedDateAndTime) ||
+ currentZonedDateAndTime.isEqual(zonedDateAndTime)) ? switchOverNew[i] : switchOverOld[i]);
}
// check a country code which doesn't have a currency
--- a/jdk/test/java/util/Objects/CheckIndex.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/util/Objects/CheckIndex.java Thu Apr 14 09:32:37 2016 -0700
@@ -43,22 +43,30 @@
public class CheckIndex {
static class AssertingOutOfBoundsException extends RuntimeException {
+ public AssertingOutOfBoundsException(String message) {
+ super(message);
+ }
}
- static BiFunction<Integer, Integer, AssertingOutOfBoundsException> assertingOutOfBounds(
- int expFromIndex, int expToIndexOrSizeOrLength) {
- return (fromIndex, toIndexOrSizeorLength) -> {
- assertEquals(fromIndex, Integer.valueOf(expFromIndex));
- assertEquals(toIndexOrSizeorLength, Integer.valueOf(expToIndexOrSizeOrLength));
- return new AssertingOutOfBoundsException();
+ static BiFunction<String, List<Integer>, AssertingOutOfBoundsException> assertingOutOfBounds(
+ String message, String expCheckKind, Integer... expArgs) {
+ return (checkKind, args) -> {
+ assertEquals(checkKind, expCheckKind);
+ assertEquals(args, List.of(expArgs));
+ try {
+ args.clear();
+ fail("Out of bounds List<Integer> argument should be unmodifiable");
+ } catch (Exception e) {
+ }
+ return new AssertingOutOfBoundsException(message);
};
}
- static BiFunction<Integer, Integer, AssertingOutOfBoundsException> assertingOutOfBoundsReturnNull(
- int expFromIndex, int expToIndexOrSizeOrLength) {
- return (fromIndex, toIndexOrSizeorLength) -> {
- assertEquals(fromIndex, Integer.valueOf(expFromIndex));
- assertEquals(toIndexOrSizeorLength, Integer.valueOf(expToIndexOrSizeOrLength));
+ static BiFunction<String, List<Integer>, AssertingOutOfBoundsException> assertingOutOfBoundsReturnNull(
+ String expCheckKind, Integer... expArgs) {
+ return (checkKind, args) -> {
+ assertEquals(checkKind, expCheckKind);
+ assertEquals(args, List.of(expArgs));
return null;
};
}
@@ -85,7 +93,12 @@
@Test(dataProvider = "checkIndexProvider")
public void testCheckIndex(int index, int length, boolean withinBounds) {
- BiConsumer<Class<? extends RuntimeException>, IntSupplier> check = (ec, s) -> {
+ String expectedMessage = withinBounds
+ ? null
+ : Objects.outOfBoundsExceptionFormatter(IndexOutOfBoundsException::new).
+ apply("checkIndex", List.of(index, length)).getMessage();
+
+ BiConsumer<Class<? extends RuntimeException>, IntSupplier> checker = (ec, s) -> {
try {
int rIndex = s.getAsInt();
if (!withinBounds)
@@ -98,17 +111,27 @@
if (withinBounds)
fail(String.format(
"Index %d is within bounds of [0, %d), but was reported to be out of bounds", index, length));
+ else
+ assertEquals(e.getMessage(), expectedMessage);
}
};
- check.accept(AssertingOutOfBoundsException.class,
- () -> Objects.checkIndex(index, length, assertingOutOfBounds(index, length)));
- check.accept(IndexOutOfBoundsException.class,
- () -> Objects.checkIndex(index, length, assertingOutOfBoundsReturnNull(index, length)));
- check.accept(IndexOutOfBoundsException.class,
+ checker.accept(AssertingOutOfBoundsException.class,
+ () -> Objects.checkIndex(index, length,
+ assertingOutOfBounds(expectedMessage, "checkIndex", index, length)));
+ checker.accept(IndexOutOfBoundsException.class,
+ () -> Objects.checkIndex(index, length,
+ assertingOutOfBoundsReturnNull("checkIndex", index, length)));
+ checker.accept(IndexOutOfBoundsException.class,
() -> Objects.checkIndex(index, length, null));
- check.accept(IndexOutOfBoundsException.class,
+ checker.accept(IndexOutOfBoundsException.class,
() -> Objects.checkIndex(index, length));
+ checker.accept(ArrayIndexOutOfBoundsException.class,
+ () -> Objects.checkIndex(index, length,
+ Objects.outOfBoundsExceptionFormatter(ArrayIndexOutOfBoundsException::new)));
+ checker.accept(StringIndexOutOfBoundsException.class,
+ () -> Objects.checkIndex(index, length,
+ Objects.outOfBoundsExceptionFormatter(StringIndexOutOfBoundsException::new)));
}
@@ -132,6 +155,11 @@
@Test(dataProvider = "checkFromToIndexProvider")
public void testCheckFromToIndex(int fromIndex, int toIndex, int length, boolean withinBounds) {
+ String expectedMessage = withinBounds
+ ? null
+ : Objects.outOfBoundsExceptionFormatter(IndexOutOfBoundsException::new).
+ apply("checkFromToIndex", List.of(fromIndex, toIndex, length)).getMessage();
+
BiConsumer<Class<? extends RuntimeException>, IntSupplier> check = (ec, s) -> {
try {
int rIndex = s.getAsInt();
@@ -145,17 +173,27 @@
if (withinBounds)
fail(String.format(
"Range [%d, %d) is within bounds of [0, %d), but was reported to be out of bounds", fromIndex, toIndex, length));
+ else
+ assertEquals(e.getMessage(), expectedMessage);
}
};
check.accept(AssertingOutOfBoundsException.class,
- () -> Objects.checkFromToIndex(fromIndex, toIndex, length, assertingOutOfBounds(fromIndex, toIndex)));
+ () -> Objects.checkFromToIndex(fromIndex, toIndex, length,
+ assertingOutOfBounds(expectedMessage, "checkFromToIndex", fromIndex, toIndex, length)));
check.accept(IndexOutOfBoundsException.class,
- () -> Objects.checkFromToIndex(fromIndex, toIndex, length, assertingOutOfBoundsReturnNull(fromIndex, toIndex)));
+ () -> Objects.checkFromToIndex(fromIndex, toIndex, length,
+ assertingOutOfBoundsReturnNull("checkFromToIndex", fromIndex, toIndex, length)));
check.accept(IndexOutOfBoundsException.class,
() -> Objects.checkFromToIndex(fromIndex, toIndex, length, null));
check.accept(IndexOutOfBoundsException.class,
() -> Objects.checkFromToIndex(fromIndex, toIndex, length));
+ check.accept(ArrayIndexOutOfBoundsException.class,
+ () -> Objects.checkFromToIndex(fromIndex, toIndex, length,
+ Objects.outOfBoundsExceptionFormatter(ArrayIndexOutOfBoundsException::new)));
+ check.accept(StringIndexOutOfBoundsException.class,
+ () -> Objects.checkFromToIndex(fromIndex, toIndex, length,
+ Objects.outOfBoundsExceptionFormatter(StringIndexOutOfBoundsException::new)));
}
@@ -186,6 +224,11 @@
@Test(dataProvider = "checkFromIndexSizeProvider")
public void testCheckFromIndexSize(int fromIndex, int size, int length, boolean withinBounds) {
+ String expectedMessage = withinBounds
+ ? null
+ : Objects.outOfBoundsExceptionFormatter(IndexOutOfBoundsException::new).
+ apply("checkFromIndexSize", List.of(fromIndex, size, length)).getMessage();
+
BiConsumer<Class<? extends RuntimeException>, IntSupplier> check = (ec, s) -> {
try {
int rIndex = s.getAsInt();
@@ -199,36 +242,54 @@
if (withinBounds)
fail(String.format(
"Range [%d, %d + %d) is within bounds of [0, %d), but was reported to be out of bounds", fromIndex, fromIndex, size, length));
+ else
+ assertEquals(e.getMessage(), expectedMessage);
}
};
check.accept(AssertingOutOfBoundsException.class,
- () -> Objects.checkFromIndexSize(fromIndex, size, length, assertingOutOfBounds(fromIndex, size)));
+ () -> Objects.checkFromIndexSize(fromIndex, size, length,
+ assertingOutOfBounds(expectedMessage, "checkFromIndexSize", fromIndex, size, length)));
check.accept(IndexOutOfBoundsException.class,
- () -> Objects.checkFromIndexSize(fromIndex, size, length, assertingOutOfBoundsReturnNull(fromIndex, size)));
+ () -> Objects.checkFromIndexSize(fromIndex, size, length,
+ assertingOutOfBoundsReturnNull("checkFromIndexSize", fromIndex, size, length)));
check.accept(IndexOutOfBoundsException.class,
() -> Objects.checkFromIndexSize(fromIndex, size, length, null));
check.accept(IndexOutOfBoundsException.class,
() -> Objects.checkFromIndexSize(fromIndex, size, length));
+ check.accept(ArrayIndexOutOfBoundsException.class,
+ () -> Objects.checkFromIndexSize(fromIndex, size, length,
+ Objects.outOfBoundsExceptionFormatter(ArrayIndexOutOfBoundsException::new)));
+ check.accept(StringIndexOutOfBoundsException.class,
+ () -> Objects.checkFromIndexSize(fromIndex, size, length,
+ Objects.outOfBoundsExceptionFormatter(StringIndexOutOfBoundsException::new)));
}
@Test
- public void checkIndexOutOfBoundsExceptionConstructors() {
- BiConsumer<Class<? extends RuntimeException>, IntSupplier> check = (ec, s) -> {
- try {
- s.getAsInt();
- fail("Runtime exception expected");
- }
- catch (RuntimeException e) {
- assertTrue(ec.isInstance(e));
- }
- };
+ public void uniqueMessagesForCheckKinds() {
+ BiFunction<String, List<Integer>, IndexOutOfBoundsException> f =
+ Objects.outOfBoundsExceptionFormatter(IndexOutOfBoundsException::new);
- check.accept(IndexOutOfBoundsException.class,
- () -> Objects.checkIndex(1, 0, IndexOutOfBoundsException::new));
- check.accept(StringIndexOutOfBoundsException.class,
- () -> Objects.checkIndex(1, 0, StringIndexOutOfBoundsException::new));
- check.accept(ArrayIndexOutOfBoundsException.class,
- () -> Objects.checkIndex(1, 0, ArrayIndexOutOfBoundsException::new));
+ List<String> messages = new ArrayList<>();
+ // Exact arguments
+ messages.add(f.apply("checkIndex", List.of(-1, 0)).getMessage());
+ messages.add(f.apply("checkFromToIndex", List.of(-1, 0, 0)).getMessage());
+ messages.add(f.apply("checkFromIndexSize", List.of(-1, 0, 0)).getMessage());
+ // Unknown check kind
+ messages.add(f.apply("checkUnknown", List.of(-1, 0, 0)).getMessage());
+ // Known check kind with more arguments
+ messages.add(f.apply("checkIndex", List.of(-1, 0, 0)).getMessage());
+ messages.add(f.apply("checkFromToIndex", List.of(-1, 0, 0, 0)).getMessage());
+ messages.add(f.apply("checkFromIndexSize", List.of(-1, 0, 0, 0)).getMessage());
+ // Known check kind with fewer arguments
+ messages.add(f.apply("checkIndex", List.of(-1)).getMessage());
+ messages.add(f.apply("checkFromToIndex", List.of(-1, 0)).getMessage());
+ messages.add(f.apply("checkFromIndexSize", List.of(-1, 0)).getMessage());
+ // Null arguments
+ messages.add(f.apply(null, null).getMessage());
+ messages.add(f.apply("checkNullArguments", null).getMessage());
+ messages.add(f.apply(null, List.of(-1)).getMessage());
+
+ assertEquals(messages.size(), messages.stream().distinct().count());
}
}
--- a/jdk/test/java/util/jar/JarFile/MultiReleaseJarAPI.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/java/util/jar/JarFile/MultiReleaseJarAPI.java Thu Apr 14 09:32:37 2016 -0700
@@ -54,6 +54,7 @@
static final int MAJOR_VERSION = Version.current().major();
String userdir = System.getProperty("user.dir",".");
+ CreateMultiReleaseTestJars creator = new CreateMultiReleaseTestJars();
File unversioned = new File(userdir, "unversioned.jar");
File multirelease = new File(userdir, "multi-release.jar");
File signedmultirelease = new File(userdir, "signed-multi-release.jar");
@@ -62,7 +63,6 @@
@BeforeClass
public void initialize() throws Exception {
- CreateMultiReleaseTestJars creator = new CreateMultiReleaseTestJars();
creator.compileEntries();
creator.buildUnversionedJar();
creator.buildMultiReleaseJar();
@@ -82,6 +82,10 @@
Assert.assertFalse(jf.isMultiRelease());
}
+ try (JarFile jf = new JarFile(unversioned, true, ZipFile.OPEN_READ, Release.RUNTIME)) {
+ Assert.assertFalse(jf.isMultiRelease());
+ }
+
try (JarFile jf = new JarFile(multirelease)) {
Assert.assertFalse(jf.isMultiRelease());
}
@@ -89,6 +93,28 @@
try (JarFile jf = new JarFile(multirelease, true, ZipFile.OPEN_READ, Release.RUNTIME)) {
Assert.assertTrue(jf.isMultiRelease());
}
+
+ testCustomMultiReleaseValue("true", true);
+ testCustomMultiReleaseValue("true\r\nOther: value", true);
+ testCustomMultiReleaseValue("true\nOther: value", true);
+ testCustomMultiReleaseValue("true\rOther: value", true);
+
+ testCustomMultiReleaseValue("false", false);
+ testCustomMultiReleaseValue(" true", false);
+ testCustomMultiReleaseValue("true ", false);
+ testCustomMultiReleaseValue("true\n ", false);
+ testCustomMultiReleaseValue("true\r ", false);
+ testCustomMultiReleaseValue("true\n true", false);
+ testCustomMultiReleaseValue("true\r\n true", false);
+ }
+
+ private void testCustomMultiReleaseValue(String value, boolean expected) throws Exception {
+ creator.buildCustomMultiReleaseJar("custom-mr.jar", value);
+ File custom = new File(userdir, "custom-mr.jar");
+ try (JarFile jf = new JarFile(custom, true, ZipFile.OPEN_READ, Release.RUNTIME)) {
+ Assert.assertEquals(jf.isMultiRelease(), expected);
+ }
+ Files.delete(custom.toPath());
}
@Test
--- a/jdk/test/javax/net/ssl/DTLS/CipherSuite.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/javax/net/ssl/DTLS/CipherSuite.java Thu Apr 14 09:32:37 2016 -0700
@@ -27,6 +27,7 @@
/*
* @test
* @bug 8043758
+ * @key intermittent
* @summary Datagram Transport Layer Security (DTLS)
* @modules java.base/sun.security.util
* @build DTLSOverDatagram
--- a/jdk/test/javax/net/ssl/Stapling/HttpsUrlConnClient.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/javax/net/ssl/Stapling/HttpsUrlConnClient.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
/*
* @test
- * @bug 8046321
+ * @bug 8046321 8153829
* @summary OCSP Stapling for TLS
* @library ../../../../java/security/testlibrary
* @build CertificateBuilder SimpleOCSPServer
@@ -298,12 +298,13 @@
*/
void doClientSide(ClientParameters cliParams) throws Exception {
- /*
- * Wait for server to get started.
- */
- while (!serverReady) {
+ // Wait 5 seconds for server ready
+ for (int i = 0; (i < 100 && !serverReady); i++) {
Thread.sleep(50);
}
+ if (!serverReady) {
+ throw new RuntimeException("Server not ready yet");
+ }
// Selectively enable or disable the feature
System.setProperty("jdk.tls.client.enableStatusRequestExtension",
@@ -532,7 +533,15 @@
rootOcsp.enableLog(debug);
rootOcsp.setNextUpdateInterval(3600);
rootOcsp.start();
- Thread.sleep(1000); // Give the server a second to start up
+
+ // Wait 5 seconds for server ready
+ for (int i = 0; (i < 100 && !rootOcsp.isServerReady()); i++) {
+ Thread.sleep(50);
+ }
+ if (!rootOcsp.isServerReady()) {
+ throw new RuntimeException("Server not ready yet");
+ }
+
rootOcspPort = rootOcsp.getPort();
String rootRespURI = "http://localhost:" + rootOcspPort;
log("Root OCSP Responder URI is " + rootRespURI);
@@ -577,7 +586,15 @@
intOcsp.enableLog(debug);
intOcsp.setNextUpdateInterval(3600);
intOcsp.start();
- Thread.sleep(1000);
+
+ // Wait 5 seconds for server ready
+ for (int i = 0; (i < 100 && !intOcsp.isServerReady()); i++) {
+ Thread.sleep(50);
+ }
+ if (!intOcsp.isServerReady()) {
+ throw new RuntimeException("Server not ready yet");
+ }
+
intOcspPort = intOcsp.getPort();
String intCaRespURI = "http://localhost:" + intOcspPort;
log("Intermediate CA OCSP Responder URI is " + intCaRespURI);
--- a/jdk/test/javax/net/ssl/Stapling/SSLEngineWithStapling.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/javax/net/ssl/Stapling/SSLEngineWithStapling.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
/*
* @test
- * @bug 8046321
+ * @bug 8046321 8153829
* @summary OCSP Stapling for TLS
* @library ../../../../java/security/testlibrary
* @build CertificateBuilder SimpleOCSPServer
@@ -487,7 +487,15 @@
rootOcsp.enableLog(logging);
rootOcsp.setNextUpdateInterval(3600);
rootOcsp.start();
- Thread.sleep(1000); // Give the server a second to start up
+
+ // Wait 5 seconds for server ready
+ for (int i = 0; (i < 100 && !rootOcsp.isServerReady()); i++) {
+ Thread.sleep(50);
+ }
+ if (!rootOcsp.isServerReady()) {
+ throw new RuntimeException("Server not ready yet");
+ }
+
rootOcspPort = rootOcsp.getPort();
String rootRespURI = "http://localhost:" + rootOcspPort;
log("Root OCSP Responder URI is " + rootRespURI);
@@ -532,7 +540,15 @@
intOcsp.enableLog(logging);
intOcsp.setNextUpdateInterval(3600);
intOcsp.start();
- Thread.sleep(1000);
+
+ // Wait 5 seconds for server ready
+ for (int i = 0; (i < 100 && !intOcsp.isServerReady()); i++) {
+ Thread.sleep(50);
+ }
+ if (!intOcsp.isServerReady()) {
+ throw new RuntimeException("Server not ready yet");
+ }
+
intOcspPort = intOcsp.getPort();
String intCaRespURI = "http://localhost:" + intOcspPort;
log("Intermediate CA OCSP Responder URI is " + intCaRespURI);
--- a/jdk/test/javax/net/ssl/Stapling/SSLSocketWithStapling.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/javax/net/ssl/Stapling/SSLSocketWithStapling.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
/*
* @test
- * @bug 8046321
+ * @bug 8046321 8153829
* @summary OCSP Stapling for TLS
* @library ../../../../java/security/testlibrary
* @build CertificateBuilder SimpleOCSPServer
@@ -318,6 +318,14 @@
// Start the OCSP responders up again
intOcsp.start();
rootOcsp.start();
+
+ // Wait 5 seconds for server ready
+ for (int i = 0; (i < 100 && (!intOcsp.isServerReady() || !rootOcsp.isServerReady())); i++) {
+ Thread.sleep(50);
+ }
+ if (!intOcsp.isServerReady() || !rootOcsp.isServerReady()) {
+ throw new RuntimeException("Server not ready yet");
+ }
}
/**
@@ -367,6 +375,14 @@
// Start the OCSP responders up again
intOcsp.start();
rootOcsp.start();
+
+ // Wait 5 seconds for server ready
+ for (int i = 0; (i < 100 && (!intOcsp.isServerReady() || !rootOcsp.isServerReady())); i++) {
+ Thread.sleep(50);
+ }
+ if (!intOcsp.isServerReady() || !rootOcsp.isServerReady()) {
+ throw new RuntimeException("Server not ready yet");
+ }
}
/**
@@ -394,7 +410,14 @@
rootOcsp.setDelay(3000);
rootOcsp.start();
intOcsp.start();
- Thread.sleep(1000);
+
+ // Wait 5 seconds for server ready
+ for (int i = 0; (i < 100 && (!intOcsp.isServerReady() || !rootOcsp.isServerReady())); i++) {
+ Thread.sleep(50);
+ }
+ if (!intOcsp.isServerReady() || !rootOcsp.isServerReady()) {
+ throw new RuntimeException("Server not ready yet");
+ }
System.out.println("========================================");
System.out.println("Stapling enbled in client. Server does");
@@ -442,6 +465,14 @@
rootOcsp.setDelay(0);
rootOcsp.start();
intOcsp.start();
+
+ // Wait 5 seconds for server ready
+ for (int i = 0; (i < 100 && (!intOcsp.isServerReady() || !rootOcsp.isServerReady())); i++) {
+ Thread.sleep(50);
+ }
+ if (!intOcsp.isServerReady() || !rootOcsp.isServerReady()) {
+ throw new RuntimeException("Server not ready yet");
+ }
}
/*
@@ -509,12 +540,13 @@
*/
void doClientSide(ClientParameters cliParams) throws Exception {
- /*
- * Wait for server to get started.
- */
- while (!serverReady) {
+ // Wait 5 seconds for server ready
+ for (int i = 0; (i < 100 && !serverReady); i++) {
Thread.sleep(50);
}
+ if (!serverReady) {
+ throw new RuntimeException("Server not ready yet");
+ }
// Selectively enable or disable the feature
System.setProperty("jdk.tls.client.enableStatusRequestExtension",
@@ -732,7 +764,15 @@
rootOcsp.enableLog(debug);
rootOcsp.setNextUpdateInterval(3600);
rootOcsp.start();
- Thread.sleep(1000); // Give the server a second to start up
+
+ // Wait 5 seconds for server ready
+ for (int i = 0; (i < 100 && !rootOcsp.isServerReady()); i++) {
+ Thread.sleep(50);
+ }
+ if (!rootOcsp.isServerReady()) {
+ throw new RuntimeException("Server not ready yet");
+ }
+
rootOcspPort = rootOcsp.getPort();
String rootRespURI = "http://localhost:" + rootOcspPort;
log("Root OCSP Responder URI is " + rootRespURI);
@@ -777,7 +817,15 @@
intOcsp.enableLog(debug);
intOcsp.setNextUpdateInterval(3600);
intOcsp.start();
- Thread.sleep(1000);
+
+ // Wait 5 seconds for server ready
+ for (int i = 0; (i < 100 && !intOcsp.isServerReady()); i++) {
+ Thread.sleep(50);
+ }
+ if (!intOcsp.isServerReady()) {
+ throw new RuntimeException("Server not ready yet");
+ }
+
intOcspPort = intOcsp.getPort();
String intCaRespURI = "http://localhost:" + intOcspPort;
log("Intermediate CA OCSP Responder URI is " + intCaRespURI);
--- a/jdk/test/javax/net/ssl/Stapling/StapleEnableProps.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/javax/net/ssl/Stapling/StapleEnableProps.java Thu Apr 14 09:32:37 2016 -0700
@@ -26,7 +26,7 @@
/*
* @test
- * @bug 8145854
+ * @bug 8145854 8153829
* @summary SSLContextImpl.statusResponseManager should be generated if required
* @library ../../../../java/security/testlibrary
* @build CertificateBuilder SimpleOCSPServer
@@ -588,7 +588,15 @@
rootOcsp.enableLog(logging);
rootOcsp.setNextUpdateInterval(3600);
rootOcsp.start();
- Thread.sleep(1000); // Give the server a second to start up
+
+ // Wait 5 seconds for server ready
+ for (int i = 0; (i < 100 && !rootOcsp.isServerReady()); i++) {
+ Thread.sleep(50);
+ }
+ if (!rootOcsp.isServerReady()) {
+ throw new RuntimeException("Server not ready yet");
+ }
+
rootOcspPort = rootOcsp.getPort();
String rootRespURI = "http://localhost:" + rootOcspPort;
log("Root OCSP Responder URI is " + rootRespURI);
@@ -633,7 +641,15 @@
intOcsp.enableLog(logging);
intOcsp.setNextUpdateInterval(3600);
intOcsp.start();
- Thread.sleep(1000);
+
+ // Wait 5 seconds for server ready
+ for (int i = 0; (i < 100 && !intOcsp.isServerReady()); i++) {
+ Thread.sleep(50);
+ }
+ if (!intOcsp.isServerReady()) {
+ throw new RuntimeException("Server not ready yet");
+ }
+
intOcspPort = intOcsp.getPort();
String intCaRespURI = "http://localhost:" + intOcspPort;
log("Intermediate CA OCSP Responder URI is " + intCaRespURI);
--- a/jdk/test/lib/testlibrary/java/util/jar/CreateMultiReleaseTestJars.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/lib/testlibrary/java/util/jar/CreateMultiReleaseTestJars.java Thu Apr 14 09:32:37 2016 -0700
@@ -88,8 +88,12 @@
}
public void buildMultiReleaseJar() throws IOException {
- JarBuilder jb = new JarBuilder("multi-release.jar");
- jb.addAttribute("Multi-Release", "true");
+ buildCustomMultiReleaseJar("multi-release.jar", "true");
+ }
+
+ public void buildCustomMultiReleaseJar(String filename, String multiReleaseValue) throws IOException {
+ JarBuilder jb = new JarBuilder(filename);
+ jb.addAttribute("Multi-Release", multiReleaseValue);
jb.addEntry("README", readme8.getBytes());
jb.addEntry("version/Main.java", main.getBytes());
jb.addEntry("version/Main.class", rootClasses.get("version.Main"));
--- a/jdk/test/sun/management/jdp/JdpDefaultsTest.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/sun/management/jdp/JdpDefaultsTest.java Thu Apr 14 09:32:37 2016 -0700
@@ -57,7 +57,6 @@
"-Dcom.sun.management.jmxremote.autodiscovery=true",
"-Dcom.sun.management.jdp.pause=1",
"-Dcom.sun.management.jdp.name=" + jdpName,
- "-Dcom.sun.management.jdp.address=224.0.23.178",
"-Djava.util.logging.SimpleFormatter.format='%1$tF %1$tT %4$-7s %5$s %n'",
testName
};
--- a/jdk/test/sun/management/jdp/JdpTestCase.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/sun/management/jdp/JdpTestCase.java Thu Apr 14 09:32:37 2016 -0700
@@ -122,7 +122,7 @@
*/
private void jdpPacketReceived(Map<String, String> payload) throws Exception {
final String instanceName = payload.get("INSTANCE_NAME");
- if (instanceName.equals(connection.instanceName)) {
+ if (instanceName != null && instanceName.equals(connection.instanceName)) {
packetFromThisVMReceived(payload);
} else {
packetFromOtherVMReceived(payload);
--- a/jdk/test/sun/security/pkcs11/KeyStore/Basic.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/sun/security/pkcs11/KeyStore/Basic.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -103,7 +103,7 @@
}
public static void main(String[] args) throws Exception {
- main(new Basic());
+ main(new Basic(), args);
}
public void main(Provider p) throws Exception {
--- a/jdk/test/sun/security/pkcs11/KeyStore/Basic.policy Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/sun/security/pkcs11/KeyStore/Basic.policy Thu Apr 14 09:32:37 2016 -0700
@@ -7,6 +7,7 @@
permission java.lang.RuntimePermission "loadLibrary.*";
permission java.lang.RuntimePermission "accessClassInPackage.sun.*";
permission java.lang.RuntimePermission "getProtectionDomain";
+ permission java.lang.RuntimePermission "setSecurityManager";
permission java.security.SecurityPermission "putProviderProperty.*";
permission java.io.FilePermission "<<ALL FILES>>", "read";
--- a/jdk/test/sun/security/pkcs11/KeyStore/Basic.sh Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/sun/security/pkcs11/KeyStore/Basic.sh Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -187,10 +187,8 @@
-DTEST=${TEST} \
-Dtest.src=${TESTSRC} \
-Dtest.classes=${TESTCLASSES} \
- -Djava.security.manager \
- -Djava.security.policy=${TESTSRC}${FS}Basic.policy \
-Djava.security.debug=${DEBUG} \
- Basic
+ Basic sm Basic.policy
# save error status
status=$?
--- a/jdk/test/sun/security/pkcs11/KeyStore/Solaris.sh Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/sun/security/pkcs11/KeyStore/Solaris.sh Thu Apr 14 09:32:37 2016 -0700
@@ -155,10 +155,8 @@
-DNO_DEIMOS=true \
-DTOKEN=solaris \
-DTEST=${TEST} \
- -Djava.security.manager \
- -Djava.security.policy=${TESTSRC}${FS}Basic.policy \
-Djava.security.debug=${DEBUG} \
- Basic
+ Basic sm Basic.policy
# clean up
--- a/jdk/test/sun/security/pkcs11/PKCS11Test.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/sun/security/pkcs11/PKCS11Test.java Thu Apr 14 09:32:37 2016 -0700
@@ -181,8 +181,13 @@
public static void main(PKCS11Test test, String[] args) throws Exception {
if (args != null) {
- if (args.length > 0 && "sm".equals(args[0])) {
- test.enableSM = true;
+ if (args.length > 0) {
+ if ("sm".equals(args[0])) {
+ test.enableSM = true;
+ } else {
+ throw new RuntimeException("Unknown Command, use 'sm' as "
+ + "first arguemtn to enable security manager");
+ }
}
if (test.enableSM) {
System.setProperty("java.security.policy",
--- a/jdk/test/sun/security/pkcs11/Provider/Login.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/sun/security/pkcs11/Provider/Login.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -35,7 +35,7 @@
private static char[] password;
public static void main(String[] args) throws Exception {
- main(new Login());
+ main(new Login(), args);
}
public void main(Provider p) throws Exception {
--- a/jdk/test/sun/security/pkcs11/Provider/Login.policy Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/sun/security/pkcs11/Provider/Login.policy Thu Apr 14 09:32:37 2016 -0700
@@ -4,6 +4,7 @@
permission java.lang.RuntimePermission "accessClassInPackage.apple.*";
permission java.lang.RuntimePermission "accessClassInPackage.sun.*";
permission java.lang.RuntimePermission "getProtectionDomain";
+ permission java.lang.RuntimePermission "setSecurityManager";
permission java.security.SecurityPermission "putProviderProperty.*";
--- a/jdk/test/sun/security/pkcs11/Provider/Login.sh Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/sun/security/pkcs11/Provider/Login.sh Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -127,10 +127,8 @@
-DNO_DEIMOS=true \
-Dtest.src=${TESTSRC} \
-Dtest.classes=${TESTCLASSES} \
- -Djava.security.manager \
- -Djava.security.policy=${TESTSRC}${FS}Login.policy \
-Djava.security.debug=${DEBUG} \
- Login
+ Login sm Login.policy
# save error status
status=$?
--- a/jdk/test/sun/security/provider/DSA/TestAlgParameterGenerator.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/sun/security/provider/DSA/TestAlgParameterGenerator.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -21,58 +21,61 @@
* questions.
*/
-/*
+ /*
* @test
- * @bug 7044060
+ * @bug 7044060 8055351
* @summary verify that DSA parameter generation works
- * @run main/othervm/timeout=300 TestAlgParameterGenerator
+ * @run main/timeout=600 TestAlgParameterGenerator
*/
-import java.security.*;
-import java.security.spec.*;
-import java.security.interfaces.*;
+
+import java.security.AlgorithmParameterGenerator;
+import java.security.AlgorithmParameters;
+import java.security.spec.DSAGenParameterSpec;
+import java.security.spec.DSAParameterSpec;
public class TestAlgParameterGenerator {
private static void checkParamStrength(AlgorithmParameters param,
- int strength) throws Exception {
+ int strength) throws Exception {
String algo = param.getAlgorithm();
if (!algo.equalsIgnoreCase("DSA")) {
- throw new Exception("Unexpected type of parameters: " + algo);
+ throw new RuntimeException("Unexpected type of parameters: " + algo);
}
DSAParameterSpec spec = param.getParameterSpec(DSAParameterSpec.class);
int valueL = spec.getP().bitLength();
if (strength != valueL) {
System.out.println("Expected " + strength + " but actual " + valueL);
- throw new Exception("Wrong P strength");
+ throw new RuntimeException("Wrong P strength");
}
}
+
private static void checkParamStrength(AlgorithmParameters param,
- DSAGenParameterSpec genParam)
- throws Exception {
+ DSAGenParameterSpec genParam)
+ throws Exception {
String algo = param.getAlgorithm();
if (!algo.equalsIgnoreCase("DSA")) {
- throw new Exception("Unexpected type of parameters: " + algo);
+ throw new RuntimeException("Unexpected type of parameters: " + algo);
}
DSAParameterSpec spec = param.getParameterSpec(DSAParameterSpec.class);
int valueL = spec.getP().bitLength();
int strength = genParam.getPrimePLength();
if (strength != valueL) {
System.out.println("P: Expected " + strength + " but actual " + valueL);
- throw new Exception("Wrong P strength");
+ throw new RuntimeException("Wrong P strength");
}
int valueN = spec.getQ().bitLength();
strength = genParam.getSubprimeQLength();
if (strength != valueN) {
System.out.println("Q: Expected " + strength + " but actual " + valueN);
- throw new Exception("Wrong Q strength");
+ throw new RuntimeException("Wrong Q strength");
}
}
public static void main(String[] args) throws Exception {
- AlgorithmParameterGenerator apg =
- AlgorithmParameterGenerator.getInstance("DSA", "SUN");
+ AlgorithmParameterGenerator apg
+ = AlgorithmParameterGenerator.getInstance("DSA", "SUN");
+ long start, stop;
- long start, stop;
// make sure no-init still works
start = System.currentTimeMillis();
AlgorithmParameters param = apg.generateParameters();
@@ -81,9 +84,8 @@
checkParamStrength(param, 1024);
// make sure the old model works
- int[] strengths = { 512, 768, 1024 };
- for (int i = 0; i < strengths.length; i++) {
- int sizeP = strengths[i];
+ int[] strengths = {512, 768, 1024};
+ for (int sizeP : strengths) {
System.out.println("Generating " + sizeP + "-bit DSA Parameters");
start = System.currentTimeMillis();
apg.init(sizeP);
@@ -94,18 +96,17 @@
}
// now the newer model
- DSAGenParameterSpec spec1 = new DSAGenParameterSpec(1024, 160);
- DSAGenParameterSpec spec2 = new DSAGenParameterSpec(2048, 224);
- DSAGenParameterSpec spec3 = new DSAGenParameterSpec(2048, 256);
- //DSAGenParameterSpec spec4 = new DSAGenParameterSpec(3072, 256);
DSAGenParameterSpec[] specSet = {
- spec1, spec2, spec3//, spec4
+ new DSAGenParameterSpec(1024, 160),
+ new DSAGenParameterSpec(2048, 224),
+ new DSAGenParameterSpec(2048, 256)
+ // no support for prime size 3072
+ // ,new DSAGenParameterSpec(3072, 256)
};
- for (int i = 0; i < specSet.length; i++) {
- DSAGenParameterSpec genParam = specSet[i];
- System.out.println("Generating (" + genParam.getPrimePLength() +
- ", " + genParam.getSubprimeQLength() +
- ") DSA Parameters");
+
+ for (DSAGenParameterSpec genParam : specSet) {
+ System.out.println("Generating (" + genParam.getPrimePLength()
+ + ", " + genParam.getSubprimeQLength() + ") DSA Parameters");
start = System.currentTimeMillis();
apg.init(genParam, null);
param = apg.generateParameters();
--- a/jdk/test/sun/security/ssl/StatusStapling/java.base/sun/security/ssl/StatusResponseManagerTests.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/sun/security/ssl/StatusStapling/java.base/sun/security/ssl/StatusResponseManagerTests.java Thu Apr 14 09:32:37 2016 -0700
@@ -300,7 +300,15 @@
rootOcsp.enableLog(ocspDebug);
rootOcsp.setNextUpdateInterval(3600);
rootOcsp.start();
- Thread.sleep(1000); // Give the server a second to start up
+
+ // Wait 5 seconds for server ready
+ for (int i = 0; (i < 100 && !rootOcsp.isServerReady()); i++) {
+ Thread.sleep(50);
+ }
+ if (!rootOcsp.isServerReady()) {
+ throw new RuntimeException("Server not ready yet");
+ }
+
rootOcspPort = rootOcsp.getPort();
String rootRespURI = "http://localhost:" + rootOcspPort;
log("Root OCSP Responder URI is " + rootRespURI);
@@ -345,7 +353,15 @@
intOcsp.enableLog(ocspDebug);
intOcsp.setNextUpdateInterval(3600);
intOcsp.start();
- Thread.sleep(1000);
+
+ // Wait 5 seconds for server ready
+ for (int i = 0; (i < 100 && !intOcsp.isServerReady()); i++) {
+ Thread.sleep(50);
+ }
+ if (!intOcsp.isServerReady()) {
+ throw new RuntimeException("Server not ready yet");
+ }
+
intOcspPort = intOcsp.getPort();
String intCaRespURI = "http://localhost:" + intOcspPort;
log("Intermediate CA OCSP Responder URI is " + intCaRespURI);
--- a/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java Thu Apr 14 09:32:37 2016 -0700
@@ -143,6 +143,7 @@
launch("No deadlocks found", "jstack");
launch("compiler detected", "jmap");
launch("Java System Properties", "jinfo");
+ launch("java.threads", "jsnap");
// The test throws RuntimeException on error.
// IOException is thrown if LingeredApp can't start because of some bad
--- a/jdk/test/sun/tools/jhsdb/SAGetoptTest.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/sun/tools/jhsdb/SAGetoptTest.java Thu Apr 14 09:32:37 2016 -0700
@@ -153,5 +153,8 @@
String[] optionSet6 = {"--exe", "--core", "bla_core"};
badOptionsTest(6, optionSet6, "Argument is expected for 'exe'");
+
+ String[] optionSet7 = {"--exe"};
+ badOptionsTest(7, optionSet7, "Argument is expected for 'exe'");
}
}
--- a/jdk/test/tools/pack200/BandIntegrity.java Thu Apr 14 09:09:30 2016 -0700
+++ b/jdk/test/tools/pack200/BandIntegrity.java Thu Apr 14 09:32:37 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
* @summary test ensures the proper sequencing of bands, dump bands as well.
* @compile -XDignore.symbol.file Utils.java BandIntegrity.java
* @run main BandIntegrity
+ * @key intermittent
* @author ksrini
*/
import java.io.File;