From d0426d7d41dca8757e04cddbfaae1d6fc4c97a45 Mon Sep 17 00:00:00 2001
From: Coleen Phillimore
Date: Thu, 10 Mar 2016 14:20:59 -0500
Subject: [PATCH 01/44] 8150778: Reduce Throwable.getStackTrace() calls to the
JVM
Replace JVM_GetStackTraceDepth and JVM_GetStackTraceElement, with JVM_GetStackTraceElements that gets all the elements in the StackTraceElement[]
Reviewed-by: dfuchs, mchung, shade, hseigel
---
jdk/make/mapfiles/libjava/mapfile-vers | 3 +-
jdk/make/mapfiles/libjava/reorder-sparc | 3 +-
jdk/make/mapfiles/libjava/reorder-sparcv9 | 3 +-
jdk/make/mapfiles/libjava/reorder-x86 | 3 +-
.../classes/java/lang/StackTraceElement.java | 8 ++++-
.../share/classes/java/lang/Throwable.java | 36 ++++++++-----------
jdk/src/java.base/share/native/include/jvm.h | 9 ++---
.../share/native/libjava/Throwable.c | 16 +++------
8 files changed, 34 insertions(+), 47 deletions(-)
diff --git a/jdk/make/mapfiles/libjava/mapfile-vers b/jdk/make/mapfiles/libjava/mapfile-vers
index ac21dd24890..852716aac1f 100644
--- a/jdk/make/mapfiles/libjava/mapfile-vers
+++ b/jdk/make/mapfiles/libjava/mapfile-vers
@@ -227,8 +227,7 @@ SUNWprivate_1.1 {
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;
diff --git a/jdk/make/mapfiles/libjava/reorder-sparc b/jdk/make/mapfiles/libjava/reorder-sparc
index db653652f4f..6544e40393c 100644
--- a/jdk/make/mapfiles/libjava/reorder-sparc
+++ b/jdk/make/mapfiles/libjava/reorder-sparc
@@ -78,8 +78,7 @@ text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_Pri
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
diff --git a/jdk/make/mapfiles/libjava/reorder-sparcv9 b/jdk/make/mapfiles/libjava/reorder-sparcv9
index d6e3a326b35..71e44cf938c 100644
--- a/jdk/make/mapfiles/libjava/reorder-sparcv9
+++ b/jdk/make/mapfiles/libjava/reorder-sparcv9
@@ -74,8 +74,7 @@ text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_Pri
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
diff --git a/jdk/make/mapfiles/libjava/reorder-x86 b/jdk/make/mapfiles/libjava/reorder-x86
index 0728f662c03..5031cd133af 100644
--- a/jdk/make/mapfiles/libjava/reorder-x86
+++ b/jdk/make/mapfiles/libjava/reorder-x86
@@ -78,8 +78,7 @@ text: .text%Java_java_io_UnixFileSystem_checkAccess;
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
diff --git a/jdk/src/java.base/share/classes/java/lang/StackTraceElement.java b/jdk/src/java.base/share/classes/java/lang/StackTraceElement.java
index 58738d83c8c..fa9758f3f22 100644
--- a/jdk/src/java.base/share/classes/java/lang/StackTraceElement.java
+++ b/jdk/src/java.base/share/classes/java/lang/StackTraceElement.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, 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
@@ -74,6 +74,12 @@ public final class StackTraceElement implements java.io.Serializable {
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
diff --git a/jdk/src/java.base/share/classes/java/lang/Throwable.java b/jdk/src/java.base/share/classes/java/lang/Throwable.java
index 9d5f547c2a5..72a3455e637 100644
--- a/jdk/src/java.base/share/classes/java/lang/Throwable.java
+++ b/jdk/src/java.base/share/classes/java/lang/Throwable.java
@@ -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 @@ public class Throwable implements Serializable {
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 @@ public class Throwable implements Serializable {
*/
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 SUPPRESSED_SENTINEL = Collections.emptyList();
@@ -828,10 +833,11 @@ public class Throwable implements Serializable {
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 @@ public class Throwable implements Serializable {
}
/**
- * 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
diff --git a/jdk/src/java.base/share/native/include/jvm.h b/jdk/src/java.base/share/native/include/jvm.h
index 99f7c7f8be4..968296604fb 100644
--- a/jdk/src/java.base/share/native/include/jvm.h
+++ b/jdk/src/java.base/share/native/include/jvm.h
@@ -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 @@ JVM_IsSupportedJNIVersion(jint version);
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
diff --git a/jdk/src/java.base/share/native/libjava/Throwable.c b/jdk/src/java.base/share/native/libjava/Throwable.c
index 768c7e114a4..9944d48af19 100644
--- a/jdk/src/java.base/share/native/libjava/Throwable.c
+++ b/jdk/src/java.base/share/native/libjava/Throwable.c
@@ -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 @@ Java_java_lang_Throwable_fillInStackTrace(JNIEnv *env, jobject throwable, jint d
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);
-}
-
-JNIEXPORT jobject JNICALL
-Java_java_lang_Throwable_getStackTraceElement(JNIEnv *env,
- jobject throwable, jint index)
-{
- return JVM_GetStackTraceElement(env, throwable, index);
+ JVM_GetStackTraceElements(env, throwable, elements);
}
From ec2bb17be5155709168ee8fddc7397be25020d99 Mon Sep 17 00:00:00 2001
From: Yasumasa Suenaga
Date: Fri, 4 Mar 2016 18:13:04 +0900
Subject: [PATCH 02/44] 8151181: Add JSnap to jhsdb
Reviewed-by: dsamersoff
---
jdk/test/sun/tools/jhsdb/BasicLauncherTest.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java b/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java
index 37dd7ec0131..afba30c6055 100644
--- a/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java
+++ b/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java
@@ -143,6 +143,7 @@ public class BasicLauncherTest {
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
From 570f4df3f1be0f6438a0b207c08f54109013c00e Mon Sep 17 00:00:00 2001
From: Yasumasa Suenaga
Date: Tue, 15 Mar 2016 12:27:26 +0900
Subject: [PATCH 03/44] 8151709: jhsdb should show help message in SALauncher
Reviewed-by: dsamersoff
---
jdk/test/sun/tools/jhsdb/SAGetoptTest.java | 3 +++
1 file changed, 3 insertions(+)
diff --git a/jdk/test/sun/tools/jhsdb/SAGetoptTest.java b/jdk/test/sun/tools/jhsdb/SAGetoptTest.java
index 60ff9fffc68..736b839e071 100644
--- a/jdk/test/sun/tools/jhsdb/SAGetoptTest.java
+++ b/jdk/test/sun/tools/jhsdb/SAGetoptTest.java
@@ -152,5 +152,8 @@ public class SAGetoptTest {
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'");
}
}
From d6328fbb3ed3b8352b0adaab5f1fe077d2cf2f32 Mon Sep 17 00:00:00 2001
From: Claes Redestad
Date: Thu, 17 Mar 2016 10:26:59 +0100
Subject: [PATCH 04/44] 8152074: Avoid lambda usage in StringConcatFactory
initializer
Reviewed-by: shade, forax, chegar
---
.../java/lang/invoke/StringConcatFactory.java | 24 +++++++------------
1 file changed, 9 insertions(+), 15 deletions(-)
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java b/jdk/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java
index 5fb5277e798..853db2cbf73 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java
@@ -34,11 +34,11 @@ import jdk.internal.misc.Unsafe;
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 @@ public final class StringConcatFactory {
private static final ProxyClassesDumper DUMPER;
static {
- // Poke the privileged block once, taking everything we need:
- final Object[] values = new Object[4];
- AccessController.doPrivileged((PrivilegedAction
+ * InetAddress.getLocalHost().getHostName() if local host name
+ * can be resolved to an IP. Else numeric IP address of an active
+ * network interface will be used.
*
*
In either case, if the host was specified using the
* [...] syntax for numeric IPv6 addresses, the
From c33a6aa5ee59d3e57d627ee2de84908540a81a32 Mon Sep 17 00:00:00 2001
From: Harsha Wardhana B
Date: Tue, 22 Mar 2016 01:13:06 -0700
Subject: [PATCH 07/44] 8151797:
java/lang/management/ThreadMXBean/ThreadLists.java : inconsistent results
Create ThreadMXBean at the beginning of test so that call-site cleaner thread will be started
Reviewed-by: sla
---
jdk/test/java/lang/management/ThreadMXBean/ThreadLists.java | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/jdk/test/java/lang/management/ThreadMXBean/ThreadLists.java b/jdk/test/java/lang/management/ThreadMXBean/ThreadLists.java
index c596f7b9e9f..93bde6ff2d2 100644
--- a/jdk/test/java/lang/management/ThreadMXBean/ThreadLists.java
+++ b/jdk/test/java/lang/management/ThreadMXBean/ThreadLists.java
@@ -35,6 +35,11 @@ import java.util.Map;
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;
From c5f2279354bc155b5d476ea9f6e44d24c63dcfd3 Mon Sep 17 00:00:00 2001
From: Staffan Larsen
Date: Tue, 22 Mar 2016 19:29:25 +0100
Subject: [PATCH 08/44] 8151887: com/sun/jdi/RedefineClearBreakpoint.sh failed
with timeout
Take timeout factor into account
Reviewed-by: dsamersoff
---
jdk/test/com/sun/jdi/ShellScaffold.sh | 3 +++
1 file changed, 3 insertions(+)
diff --git a/jdk/test/com/sun/jdi/ShellScaffold.sh b/jdk/test/com/sun/jdi/ShellScaffold.sh
index b978ec1a504..ed5f79e58ac 100644
--- a/jdk/test/com/sun/jdi/ShellScaffold.sh
+++ b/jdk/test/com/sun/jdi/ShellScaffold.sh
@@ -131,6 +131,9 @@ killcmd=kill
# 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=$$
From 304d3c93fdc512eadfddd35da3070fcfd9419064 Mon Sep 17 00:00:00 2001
From: Staffan Larsen
Date: Tue, 22 Mar 2016 19:29:27 +0100
Subject: [PATCH 09/44] 7153107: com/sun/jdi/InterruptHangTest.java fails in
nightlies
Increased timeouts and added timestamped logging
Reviewed-by: sspitsyn
---
jdk/test/com/sun/jdi/InterruptHangTest.java | 11 +++++++----
jdk/test/com/sun/jdi/TestScaffold.java | 5 ++++-
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/jdk/test/com/sun/jdi/InterruptHangTest.java b/jdk/test/com/sun/jdi/InterruptHangTest.java
index fac166885d7..0e7a24ab785 100644
--- a/jdk/test/com/sun/jdi/InterruptHangTest.java
+++ b/jdk/test/com/sun/jdi/InterruptHangTest.java
@@ -153,14 +153,17 @@ public class InterruptHangTest extends TestScaffold {
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;
}
diff --git a/jdk/test/com/sun/jdi/TestScaffold.java b/jdk/test/com/sun/jdi/TestScaffold.java
index f221221a1de..4e80d408901 100644
--- a/jdk/test/com/sun/jdi/TestScaffold.java
+++ b/jdk/test/com/sun/jdi/TestScaffold.java
@@ -64,6 +64,7 @@ abstract public class TestScaffold extends TargetAdapter {
boolean vmDisconnected = false;
final String[] args;
protected boolean testFailed = false;
+ protected long startTime;
static private class ArgInfo {
String targetVMArgs = "";
@@ -425,6 +426,7 @@ abstract public class TestScaffold extends TargetAdapter {
abstract protected void runTests() throws Exception;
final public void startTests() throws Exception {
+ startTime = System.currentTimeMillis();
try {
runTests();
} finally {
@@ -433,7 +435,8 @@ abstract public class TestScaffold extends TargetAdapter {
}
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) {
From 260f238cd55fb3423fc124229fc50ee8813d11c8 Mon Sep 17 00:00:00 2001
From: Dmitry Samersoff
Date: Wed, 23 Mar 2016 21:40:20 +0300
Subject: [PATCH 10/44] 8151444: JDP not working
Don't set IP_MULTICAST_IF explicitly
Reviewed-by: sla, ysuenaga
---
.../sun/management/jdp/JdpBroadcaster.java | 23 -------------------
.../sun/management/jdp/JdpDefaultsTest.java | 1 -
jdk/test/sun/management/jdp/JdpTestCase.java | 2 +-
3 files changed, 1 insertion(+), 25 deletions(-)
diff --git a/jdk/src/java.management/share/classes/sun/management/jdp/JdpBroadcaster.java b/jdk/src/java.management/share/classes/sun/management/jdp/JdpBroadcaster.java
index cdb33ef7afa..6334bc7a06a 100644
--- a/jdk/src/java.management/share/classes/sun/management/jdp/JdpBroadcaster.java
+++ b/jdk/src/java.management/share/classes/sun/management/jdp/JdpBroadcaster.java
@@ -99,30 +99,7 @@ public final class JdpBroadcaster {
throw new JdpException("Unable to bind to source address");
}
channel.setOption(StandardSocketOptions.IP_MULTICAST_IF, interf);
- } else {
- Enumeration 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.");
- }
-
}
-
}
/**
diff --git a/jdk/test/sun/management/jdp/JdpDefaultsTest.java b/jdk/test/sun/management/jdp/JdpDefaultsTest.java
index 2156e38c4ec..029316988a4 100644
--- a/jdk/test/sun/management/jdp/JdpDefaultsTest.java
+++ b/jdk/test/sun/management/jdp/JdpDefaultsTest.java
@@ -57,7 +57,6 @@ public class JdpDefaultsTest extends DynamicLauncher {
"-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
};
diff --git a/jdk/test/sun/management/jdp/JdpTestCase.java b/jdk/test/sun/management/jdp/JdpTestCase.java
index fbd0d72ecb3..f3147fdf88a 100644
--- a/jdk/test/sun/management/jdp/JdpTestCase.java
+++ b/jdk/test/sun/management/jdp/JdpTestCase.java
@@ -122,7 +122,7 @@ public abstract class JdpTestCase {
*/
private void jdpPacketReceived(Map 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);
From 61a2d9272bdcc68318eef13b3878f9cc946caaf6 Mon Sep 17 00:00:00 2001
From: Coleen Phillimore
Date: Thu, 24 Mar 2016 15:59:29 -0400
Subject: [PATCH 11/44] 8152719: ignore this
com/sun/jdi/InterfaceMehtodsTest.java until bug is fix
Reviewed-by: ctornqvi, hseigel, sspitsyn
---
jdk/test/ProblemList.txt | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt
index 88ed7d2bf8f..925c4bec656 100644
--- a/jdk/test/ProblemList.txt
+++ b/jdk/test/ProblemList.txt
@@ -379,6 +379,12 @@ com/sun/jdi/CatchPatternTest.sh generic-all
# 8067354
com/sun/jdi/GetLocalVariables4Test.sh windows-all
+# 8152586
+com/sun/jdi/InterfaceMethodsTest.java generic-all
+
+# 8152586
+com/sun/jdi/InvokeTest.java generic-all
+
############################################################################
# jdk_util
From e23a7ba5f4bdf4f0943fbcb3c4ce9be89669f287 Mon Sep 17 00:00:00 2001
From: Alexander Kulyakhtin
Date: Thu, 24 Mar 2016 15:22:18 +0300
Subject: [PATCH 12/44] 8147987: Remove
sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java from
problemList
Re-enabling a previously excluded test
Reviewed-by: sspitsyn
---
jdk/test/ProblemList.txt | 3 ---
1 file changed, 3 deletions(-)
diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt
index 925c4bec656..8f8548ce015 100644
--- a/jdk/test/ProblemList.txt
+++ b/jdk/test/ProblemList.txt
@@ -162,9 +162,6 @@ javax/management/MBeanServer/OldMBeanServerTest.java aix-all
# 8042215
javax/management/remote/mandatory/notif/NotifReconnectDeadlockTest.java generic-all
-# 8147985
-sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java generic-all
-
############################################################################
# jdk_net
From 892fa77ffa194d686883a19a472643778fc11843 Mon Sep 17 00:00:00 2001
From: Hiroshi H Horii
Date: Wed, 30 Mar 2016 11:40:57 +0200
Subject: [PATCH 13/44] 8152172: PPC64: Support AES intrinsics
Reviewed-by: ascarpino, simonis
---
.../share/classes/com/sun/crypto/provider/AESCrypt.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/AESCrypt.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/AESCrypt.java
index 4556e0242ef..8ad6401ce9c 100644
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/AESCrypt.java
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/AESCrypt.java
@@ -56,7 +56,7 @@ final class AESCrypt extends SymmetricCipher implements AESConstants
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 @@ final class AESCrypt extends SymmetricCipher implements AESConstants
}
// 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 @@ final class AESCrypt extends SymmetricCipher implements AESConstants
limit = ROUNDS*4;
// store the expanded sub keys into 'sessionK'
- sessionK = new Object[] { expandedKe, expandedKd };
+ sessionK = new int[][] { expandedKe, expandedKd };
}
From 1f5235f540231d5c73b219a9e083c3b4de13ef5f Mon Sep 17 00:00:00 2001
From: Yasumasa Suenaga
Date: Wed, 30 Mar 2016 21:05:35 +0900
Subject: [PATCH 14/44] 8151674: STW phases at Concurrent GC should count in
PerfCounter
Reviewed-by: jmasa, sla, tschatzl
---
.../sun/tools/jstat/resources/jstat_options | 124 +++++++++++++++++-
.../sun/tools/jstat/gcCapacityOutput1.awk | 10 +-
jdk/test/sun/tools/jstat/gcCauseOutput1.awk | 6 +-
.../sun/tools/jstat/gcMetaCapacityOutput1.awk | 8 +-
.../sun/tools/jstat/gcNewCapacityOutput1.awk | 9 +-
.../sun/tools/jstat/gcOldCapacityOutput1.awk | 8 +-
jdk/test/sun/tools/jstat/gcOldOutput1.awk | 6 +-
jdk/test/sun/tools/jstat/gcOutput1.awk | 8 +-
jdk/test/sun/tools/jstat/lineCounts1.awk | 16 +--
jdk/test/sun/tools/jstat/lineCounts2.awk | 8 +-
jdk/test/sun/tools/jstat/lineCounts3.awk | 26 ++--
jdk/test/sun/tools/jstat/lineCounts4.awk | 30 ++---
jdk/test/sun/tools/jstat/timeStamp1.awk | 8 +-
13 files changed, 191 insertions(+), 76 deletions(-)
diff --git a/jdk/src/jdk.jcmd/share/classes/sun/tools/jstat/resources/jstat_options b/jdk/src/jdk.jcmd/share/classes/sun/tools/jstat/resources/jstat_options
index 9bccaebd0d0..05af6b23ded 100644
--- a/jdk/src/jdk.jcmd/share/classes/sun/tools/jstat/resources/jstat_options
+++ b/jdk/src/jdk.jcmd/share/classes/sun/tools/jstat/resources/jstat_options
@@ -254,9 +254,25 @@ option gc {
scale sec
format "0.000"
}
+ column {
+ header "^CGC^" /* Concurrent Collections (STW phase) */
+ data sun.gc.collector.2.invocations
+ align center
+ width 5
+ scale raw
+ format "0"
+ }
+ column {
+ header "^CGCT^" /* Concurrent Garbage Collection Time (STW phase) */
+ data sun.gc.collector.2.time/sun.os.hrt.frequency
+ align right
+ width 8
+ scale sec
+ format "0.000"
+ }
column {
header "^GCT^" /* Total Garbage Collection Time */
- data (sun.gc.collector.0.time + sun.gc.collector.1.time)/sun.os.hrt.frequency
+ data (sun.gc.collector.0.time + sun.gc.collector.1.time + sun.gc.collector.2.time)/sun.os.hrt.frequency
align right
width 8
scale sec
@@ -408,6 +424,14 @@ option gccapacity {
scale raw
format "0"
}
+ column {
+ header "^CGC^" /* Concurrent Collections (STW phase) */
+ data sun.gc.collector.2.invocations
+ align right
+ width 5
+ scale raw
+ format "0"
+ }
}
option gccause {
@@ -490,9 +514,25 @@ option gccause {
width 8
format "0.000"
}
+ column {
+ header "^CGC^" /* Concurrent Collections (STW phase) */
+ data sun.gc.collector.2.invocations
+ align right
+ width 5
+ scale raw
+ format "0"
+ }
+ column {
+ header "^CGCT^" /* Concurrent Garbage Collection Time (STW phase) */
+ data sun.gc.collector.2.time/sun.os.hrt.frequency
+ align right
+ width 8
+ scale sec
+ format "0.000"
+ }
column {
header "^GCT^" /* Total Garbage Collection Time */
- data (sun.gc.collector.0.time + sun.gc.collector.1.time)/sun.os.hrt.frequency
+ data (sun.gc.collector.0.time + sun.gc.collector.1.time + sun.gc.collector.2.time)/sun.os.hrt.frequency
align right
width 8
scale sec
@@ -690,6 +730,14 @@ option gcnewcapacity {
scale raw
format "0"
}
+ column {
+ header "^CGC^" /* Concurrent Collections (STW phase) */
+ data sun.gc.collector.2.invocations
+ align right
+ width 5
+ scale raw
+ format "0"
+ }
}
option gcold {
@@ -764,9 +812,25 @@ option gcold {
width 8
format "0.000"
}
+ column {
+ header "^CGC^" /* Concurrent Collections (STW phase) */
+ data sun.gc.collector.2.invocations
+ align right
+ width 5
+ scale raw
+ format "0"
+ }
+ column {
+ header "^CGCT^" /* Concurrent Garbage Collection Time (STW phase) */
+ data sun.gc.collector.2.time/sun.os.hrt.frequency
+ align right
+ width 8
+ scale sec
+ format "0.000"
+ }
column {
header "^GCT^" /* Total Garbage Collection Time */
- data (sun.gc.collector.0.time + sun.gc.collector.1.time)/sun.os.hrt.frequency
+ data (sun.gc.collector.0.time + sun.gc.collector.1.time + sun.gc.collector.2.time)/sun.os.hrt.frequency
align right
width 8
scale sec
@@ -830,9 +894,25 @@ option gcoldcapacity {
width 8
format "0.000"
}
+ column {
+ header "^CGC^" /* Concurrent Collections (STW phase) */
+ data sun.gc.collector.2.invocations
+ align right
+ width 5
+ scale raw
+ format "0"
+ }
+ column {
+ header "^CGCT^" /* Concurrent Garbage Collection Time (STW phase) */
+ data sun.gc.collector.2.time/sun.os.hrt.frequency
+ align right
+ width 8
+ scale sec
+ format "0.000"
+ }
column {
header "^GCT^" /* Total Garbage Collection Time */
- data (sun.gc.collector.0.time + sun.gc.collector.1.time)/sun.os.hrt.frequency
+ data (sun.gc.collector.0.time + sun.gc.collector.1.time + sun.gc.collector.2.time)/sun.os.hrt.frequency
align right
width 8
scale sec
@@ -912,9 +992,25 @@ option gcmetacapacity {
width 8
format "0.000"
}
+ column {
+ header "^CGC^" /* Concurrent Collections (STW phase) */
+ data sun.gc.collector.2.invocations
+ align right
+ width 5
+ scale raw
+ format "0"
+ }
+ column {
+ header "^CGCT^" /* Concurrent Garbage Collection Time (STW phase) */
+ data sun.gc.collector.2.time/sun.os.hrt.frequency
+ align right
+ width 8
+ scale sec
+ format "0.000"
+ }
column {
header "^GCT^" /* Total Garbage Collection Time */
- data (sun.gc.collector.0.time + sun.gc.collector.1.time)/sun.os.hrt.frequency
+ data (sun.gc.collector.0.time + sun.gc.collector.1.time + sun.gc.collector.2.time)/sun.os.hrt.frequency
align right
width 8
scale sec
@@ -1002,9 +1098,25 @@ option gcutil {
width 8
format "0.000"
}
+ column {
+ header "^CGC^" /* Concurrent Collections (STW phase) */
+ data sun.gc.collector.2.invocations
+ align right
+ width 5
+ scale raw
+ format "0"
+ }
+ column {
+ header "^CGCT^" /* Concurrent Garbage Collection Time (STW phase) */
+ data sun.gc.collector.2.time/sun.os.hrt.frequency
+ align right
+ width 8
+ scale sec
+ format "0.000"
+ }
column {
header "^GCT^" /* Total Garbage Collection Time */
- data (sun.gc.collector.0.time + sun.gc.collector.1.time)/sun.os.hrt.frequency
+ data (sun.gc.collector.0.time + sun.gc.collector.1.time + sun.gc.collector.2.time)/sun.os.hrt.frequency
align right
width 8
scale sec
diff --git a/jdk/test/sun/tools/jstat/gcCapacityOutput1.awk b/jdk/test/sun/tools/jstat/gcCapacityOutput1.awk
index ec7a737d55c..f556a1dd126 100644
--- a/jdk/test/sun/tools/jstat/gcCapacityOutput1.awk
+++ b/jdk/test/sun/tools/jstat/gcCapacityOutput1.awk
@@ -3,19 +3,21 @@
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
-# NGCMN NGCMX NGC S0C S1C EC OGCMN OGCMX OGC OC MCMN MCMX MC CCSMN CCSMX CCSC YGC FGC
-# 4096.0 657408.0 8192.0 512.0 512.0 3072.0 6144.0 1312768.0 6144.0 6144.0 512.0 132096.0 5120.0 512.0 131072.0 512.0 1 0
+# NGCMN NGCMX NGC S0C S1C EC OGCMN OGCMX OGC OC MCMN MCMX MC CCSMN CCSMX CCSC YGC FGC CGC
+# 4096.0 657408.0 8192.0 512.0 512.0 3072.0 6144.0 1312768.0 6144.0 6144.0 512.0 132096.0 5120.0 512.0 131072.0 512.0 1 0 0
+
+
BEGIN {
headerlines=0; datalines=0; totallines=0
}
-/^ NGCMN NGCMX NGC S0C S1C EC OGCMN OGCMX OGC OC MCMN MCMX MC CCSMN CCSMX CCSC YGC FGC $/ {
+/^ NGCMN NGCMX NGC S0C S1C EC OGCMN OGCMX OGC OC MCMN MCMX MC CCSMN CCSMX CCSC YGC FGC CGC $/ {
headerlines++;
}
-/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+$/ {
+/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+[ ]*[0-9]+$/ {
datalines++;
}
diff --git a/jdk/test/sun/tools/jstat/gcCauseOutput1.awk b/jdk/test/sun/tools/jstat/gcCauseOutput1.awk
index 005e791043a..8495b621bce 100644
--- a/jdk/test/sun/tools/jstat/gcCauseOutput1.awk
+++ b/jdk/test/sun/tools/jstat/gcCauseOutput1.awk
@@ -3,15 +3,15 @@
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
-# S0 S1 E O M CCS YGC YGCT FGC FGCT GCT LGCC GCC
-# 0.00 0.00 0.00 9.97 90.94 87.70 2 0.013 0 0.000 0.013 Allocation Failure No GC
+# S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT LGCC GCC
+# 0.00 0.00 0.00 9.97 90.94 87.70 2 0.013 0 0.000 0 0.000 0.013 Allocation Failure No GC
BEGIN {
headerlines=0; datalines=0; totallines=0
}
-/^ S0 S1 E O M CCS YGC YGCT FGC FGCT GCT LGCC GCC $/ {
+/^ S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT LGCC GCC $/ {
headerlines++;
}
diff --git a/jdk/test/sun/tools/jstat/gcMetaCapacityOutput1.awk b/jdk/test/sun/tools/jstat/gcMetaCapacityOutput1.awk
index 352e02d6cbc..2d08dcc29da 100644
--- a/jdk/test/sun/tools/jstat/gcMetaCapacityOutput1.awk
+++ b/jdk/test/sun/tools/jstat/gcMetaCapacityOutput1.awk
@@ -3,18 +3,18 @@
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
-# MCMN MCMX MC CCSMN CCSMX CCSC YGC FGC FGCT GCT
-# 512.0 132096.0 5120.0 512.0 131072.0 512.0 1 0 0.000 0.004
+# MCMN MCMX MC CCSMN CCSMX CCSC YGC FGC FGCT CGC CGCT GCT
+# 512.0 132096.0 5120.0 512.0 131072.0 512.0 1 0 0.000 0 0.000 0.004
BEGIN {
headerlines=0; datalines=0; totallines=0
}
-/^ MCMN MCMX MC CCSMN CCSMX CCSC YGC FGC FGCT GCT $/ {
+/^ MCMN MCMX MC CCSMN CCSMX CCSC YGC FGC FGCT CGC CGCT GCT $/ {
headerlines++;
}
-/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
+/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
datalines++;
}
diff --git a/jdk/test/sun/tools/jstat/gcNewCapacityOutput1.awk b/jdk/test/sun/tools/jstat/gcNewCapacityOutput1.awk
index f4473dc37e4..51b4d24cec4 100644
--- a/jdk/test/sun/tools/jstat/gcNewCapacityOutput1.awk
+++ b/jdk/test/sun/tools/jstat/gcNewCapacityOutput1.awk
@@ -3,19 +3,20 @@
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
-# NGCMN NGCMX NGC S0CMX S0C S1CMX S1C ECMX EC YGC FGC
-# 2176.0 7232.0 2176.0 192.0 64.0 192.0 64.0 6848.0 2048.0 1 0
+# NGCMN NGCMX NGC S0CMX S0C S1CMX S1C ECMX EC YGC FGC CGC
+# 2176.0 7232.0 2176.0 192.0 64.0 192.0 64.0 6848.0 2048.0 1 0 0
+
BEGIN {
headerlines=0; datalines=0; totallines=0
}
-/^ NGCMN NGCMX NGC S0CMX S0C S1CMX S1C ECMX EC YGC FGC $/ {
+/^ NGCMN NGCMX NGC S0CMX S0C S1CMX S1C ECMX EC YGC FGC CGC $/ {
headerlines++;
}
-/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+$/ {
+/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+[ ]*[0-9]+$/ {
datalines++;
}
diff --git a/jdk/test/sun/tools/jstat/gcOldCapacityOutput1.awk b/jdk/test/sun/tools/jstat/gcOldCapacityOutput1.awk
index cbf88756060..c2a3a3dcdcc 100644
--- a/jdk/test/sun/tools/jstat/gcOldCapacityOutput1.awk
+++ b/jdk/test/sun/tools/jstat/gcOldCapacityOutput1.awk
@@ -3,18 +3,18 @@
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
-# OGCMN OGCMX OGC OC YGC FGC FGCT GCT
-# 6016.0 58304.0 6016.0 6016.0 1 0 0.000 0.030
+# OGCMN OGCMX OGC OC YGC FGC FGCT CGC CGCT GCT
+# 6016.0 58304.0 6016.0 6016.0 1 0 0.000 0 0.000 0.030
BEGIN {
headerlines=0; datalines=0; totallines=0
}
-/^ OGCMN OGCMX OGC OC YGC FGC FGCT GCT $/ {
+/^ OGCMN OGCMX OGC OC YGC FGC FGCT CGC CGCT GCT $/ {
headerlines++;
}
-/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
+/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
datalines++;
}
diff --git a/jdk/test/sun/tools/jstat/gcOldOutput1.awk b/jdk/test/sun/tools/jstat/gcOldOutput1.awk
index 319f707d273..4ea47780015 100644
--- a/jdk/test/sun/tools/jstat/gcOldOutput1.awk
+++ b/jdk/test/sun/tools/jstat/gcOldOutput1.awk
@@ -3,7 +3,7 @@
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
-# MC MU CCSC CCSU OC OU YGC FGC FGCT GCT
+# MC MU CCSC CCSU OC OU YGC FGC FGCT CGC CGCT GCT
# 5120.0 4152.0 512.0 397.9 6144.0 200.0 1 0 0.000 0.005
@@ -11,11 +11,11 @@ BEGIN {
headerlines=0; datalines=0; totallines=0
}
-/^ MC MU CCSC CCSU OC OU YGC FGC FGCT GCT $/ {
+/^ MC MU CCSC CCSU OC OU YGC FGC FGCT CGC CGCT GCT $/ {
headerlines++;
}
-/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
+/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
datalines++;
}
diff --git a/jdk/test/sun/tools/jstat/gcOutput1.awk b/jdk/test/sun/tools/jstat/gcOutput1.awk
index 5bd59fe0d8e..bf27f8c3317 100644
--- a/jdk/test/sun/tools/jstat/gcOutput1.awk
+++ b/jdk/test/sun/tools/jstat/gcOutput1.awk
@@ -3,19 +3,19 @@
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
-# S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT GCT
-# 512.0 512.0 0.0 496.0 3072.0 615.5 6144.0 280.0 5120.0 4176.0 512.0 401.0 1 0.005 0 0.000 0.005
+# S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT CGC CGCT GCT
+# 512.0 512.0 0.0 496.0 3072.0 615.5 6144.0 280.0 5120.0 4176.0 512.0 401.0 1 0.005 0 0.000 0 0.000 0.005
BEGIN {
headerlines=0; datalines=0; totallines=0
}
-/^ S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT GCT $/ {
+/^ S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT CGC CGCT GCT $/ {
headerlines++;
}
-/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
+/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
datalines++;
}
diff --git a/jdk/test/sun/tools/jstat/lineCounts1.awk b/jdk/test/sun/tools/jstat/lineCounts1.awk
index cc974104b99..6eeffd4f8fe 100644
--- a/jdk/test/sun/tools/jstat/lineCounts1.awk
+++ b/jdk/test/sun/tools/jstat/lineCounts1.awk
@@ -3,22 +3,22 @@
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
-# S0 S1 E O M CCS YGC YGCT FGC FGCT GCT
-# 0.00 93.76 28.80 1.82 77.74 68.02 1 0.005 0 0.000 0.005
-# 0.00 93.76 73.04 1.82 77.74 68.02 1 0.005 0 0.000 0.005
-# 0.00 93.76 73.04 1.82 77.74 68.02 1 0.005 0 0.000 0.005
-# 0.00 93.76 73.04 1.82 77.74 68.02 1 0.005 0 0.000 0.005
-# 0.00 93.76 75.00 1.82 77.74 68.02 1 0.005 0 0.000 0.005
+# S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT
+# 0.00 93.76 28.80 1.82 77.74 68.02 1 0.005 0 0.000 0 0.000 0.005
+# 0.00 93.76 73.04 1.82 77.74 68.02 1 0.005 0 0.000 0 0.000 0.005
+# 0.00 93.76 73.04 1.82 77.74 68.02 1 0.005 0 0.000 0 0.000 0.005
+# 0.00 93.76 73.04 1.82 77.74 68.02 1 0.005 0 0.000 0 0.000 0.005
+# 0.00 93.76 75.00 1.82 77.74 68.02 1 0.005 0 0.000 0 0.000 0.005
BEGIN {
headerlines=0; datalines=0; totallines=0
}
-/^ S0 S1 E O M CCS YGC YGCT FGC FGCT GCT $/ {
+/^ S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT $/ {
headerlines++;
}
-/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+\.[0-9]+)|-[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
+/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+\.[0-9]+)|-[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
datalines++;
}
diff --git a/jdk/test/sun/tools/jstat/lineCounts2.awk b/jdk/test/sun/tools/jstat/lineCounts2.awk
index ac2009d2e0b..2766c1a3ab3 100644
--- a/jdk/test/sun/tools/jstat/lineCounts2.awk
+++ b/jdk/test/sun/tools/jstat/lineCounts2.awk
@@ -3,18 +3,18 @@
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
-# S0 S1 E O M CCS YGC YGCT FGC FGCT GCT
-# 0.00 93.76 28.40 1.82 77.74 68.02 1 0.005 0 0.000 0.005
+# S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT
+# 0.00 93.76 28.40 1.82 77.74 68.02 1 0.005 0 0.000 0 0.000 0.005
BEGIN {
headerlines=0; datalines=0; totallines=0
}
-/^ S0 S1 E O M CCS YGC YGCT FGC FGCT GCT $/ {
+/^ S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT $/ {
headerlines++;
}
-/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+\.[0-9]+)|-[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
+/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+\.[0-9]+)|-[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
datalines++;
}
diff --git a/jdk/test/sun/tools/jstat/lineCounts3.awk b/jdk/test/sun/tools/jstat/lineCounts3.awk
index 9b6d3ecec59..5577b417a3c 100644
--- a/jdk/test/sun/tools/jstat/lineCounts3.awk
+++ b/jdk/test/sun/tools/jstat/lineCounts3.awk
@@ -3,27 +3,27 @@
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
-# S0 S1 E O M CCS YGC YGCT FGC FGCT GCT
-# 0.00 93.76 26.48 1.95 77.78 68.02 1 0.006 0 0.000 0.006
-# 0.00 93.76 71.58 1.95 77.78 68.02 1 0.006 0 0.000 0.006
-# 0.00 93.76 73.58 1.95 77.78 68.02 1 0.006 0 0.000 0.006
-# 0.00 93.76 73.58 1.95 77.78 68.02 1 0.006 0 0.000 0.006
-# 0.00 93.76 73.58 1.95 77.78 68.02 1 0.006 0 0.000 0.006
-# 0.00 93.76 75.58 1.95 77.78 68.02 1 0.006 0 0.000 0.006
-# 0.00 93.76 75.58 1.95 77.78 68.02 1 0.006 0 0.000 0.006
-# 0.00 93.76 77.58 1.95 77.78 68.02 1 0.006 0 0.000 0.006
-# 0.00 93.76 77.58 1.95 77.78 68.02 1 0.006 0 0.000 0.006
-# 0.00 93.76 77.58 1.95 77.78 68.02 1 0.006 0 0.000 0.006
+# S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT
+# 0.00 93.76 26.48 1.95 77.78 68.02 1 0.006 0 0.000 0 0.000 0.006
+# 0.00 93.76 71.58 1.95 77.78 68.02 1 0.006 0 0.000 0 0.000 0.006
+# 0.00 93.76 73.58 1.95 77.78 68.02 1 0.006 0 0.000 0 0.000 0.006
+# 0.00 93.76 73.58 1.95 77.78 68.02 1 0.006 0 0.000 0 0.000 0.006
+# 0.00 93.76 73.58 1.95 77.78 68.02 1 0.006 0 0.000 0 0.000 0.006
+# 0.00 93.76 75.58 1.95 77.78 68.02 1 0.006 0 0.000 0 0.000 0.006
+# 0.00 93.76 75.58 1.95 77.78 68.02 1 0.006 0 0.000 0 0.000 0.006
+# 0.00 93.76 77.58 1.95 77.78 68.02 1 0.006 0 0.000 0 0.000 0.006
+# 0.00 93.76 77.58 1.95 77.78 68.02 1 0.006 0 0.000 0 0.000 0.006
+# 0.00 93.76 77.58 1.95 77.78 68.02 1 0.006 0 0.000 0 0.000 0.006
BEGIN {
headerlines=0; datalines=0; totallines=0
}
-/^ S0 S1 E O M CCS YGC YGCT FGC FGCT GCT $/ {
+/^ S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT $/ {
headerlines++;
}
-/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+\.[0-9]+)|-[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
+/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+\.[0-9]+)|-[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
datalines++;
}
diff --git a/jdk/test/sun/tools/jstat/lineCounts4.awk b/jdk/test/sun/tools/jstat/lineCounts4.awk
index db40ad355c6..eb20692d376 100644
--- a/jdk/test/sun/tools/jstat/lineCounts4.awk
+++ b/jdk/test/sun/tools/jstat/lineCounts4.awk
@@ -3,30 +3,30 @@
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
-# S0 S1 E O M CCS YGC YGCT FGC FGCT GCT
-# 0.00 96.88 66.55 2.34 77.78 68.02 1 0.003 0 0.000 0.003
-# 0.00 96.88 71.58 2.34 77.78 68.02 1 0.003 0 0.000 0.003
-# 0.00 96.88 73.58 2.34 77.78 68.02 1 0.003 0 0.000 0.003
-# 0.00 96.88 73.58 2.34 77.78 68.02 1 0.003 0 0.000 0.003
-# 0.00 96.88 73.58 2.34 77.78 68.02 1 0.003 0 0.000 0.003
-# 0.00 96.88 75.58 2.34 77.78 68.02 1 0.003 0 0.000 0.003
-# 0.00 96.88 75.58 2.34 77.78 68.02 1 0.003 0 0.000 0.003
-# 0.00 96.88 77.58 2.34 77.78 68.02 1 0.003 0 0.000 0.003
-# 0.00 96.88 77.58 2.34 77.78 68.02 1 0.003 0 0.000 0.003
-# 0.00 96.88 77.58 2.34 77.78 68.02 1 0.003 0 0.000 0.003
-# S0 S1 E O M CCS YGC YGCT FGC FGCT GCT
-# 0.00 96.88 79.58 2.34 77.78 68.02 1 0.003 0 0.000 0.003
+# S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT
+# 0.00 96.88 66.55 2.34 77.78 68.02 1 0.003 0 0.000 0 0.000 0.003
+# 0.00 96.88 71.58 2.34 77.78 68.02 1 0.003 0 0.000 0 0.000 0.003
+# 0.00 96.88 73.58 2.34 77.78 68.02 1 0.003 0 0.000 0 0.000 0.003
+# 0.00 96.88 73.58 2.34 77.78 68.02 1 0.003 0 0.000 0 0.000 0.003
+# 0.00 96.88 73.58 2.34 77.78 68.02 1 0.003 0 0.000 0 0.000 0.003
+# 0.00 96.88 75.58 2.34 77.78 68.02 1 0.003 0 0.000 0 0.000 0.003
+# 0.00 96.88 75.58 2.34 77.78 68.02 1 0.003 0 0.000 0 0.000 0.003
+# 0.00 96.88 77.58 2.34 77.78 68.02 1 0.003 0 0.000 0 0.000 0.003
+# 0.00 96.88 77.58 2.34 77.78 68.02 1 0.003 0 0.000 0 0.000 0.003
+# 0.00 96.88 77.58 2.34 77.78 68.02 1 0.003 0 0.000 0 0.000 0.003
+# S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT
+# 0.00 96.88 79.58 2.34 77.78 68.02 1 0.003 0 0.000 0 0.000 0.003
BEGIN {
headerlines=0; datalines=0; totallines=0
datalines2=0;
}
-/^ S0 S1 E O M CCS YGC YGCT FGC FGCT GCT $/ {
+/^ S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT $/ {
headerlines++;
}
-/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+\.[0-9]+)|-[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
+/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+\.[0-9]+)|-[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
if (headerlines == 2) {
datalines2++;
}
diff --git a/jdk/test/sun/tools/jstat/timeStamp1.awk b/jdk/test/sun/tools/jstat/timeStamp1.awk
index 908f4230419..ab955eb3d8e 100644
--- a/jdk/test/sun/tools/jstat/timeStamp1.awk
+++ b/jdk/test/sun/tools/jstat/timeStamp1.awk
@@ -3,18 +3,18 @@
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
-#Timestamp S0 S1 E O M CCS YGC YGCT FGC FGCT GCT
-# 0.3 0.00 100.00 68.74 1.95 77.73 68.02 1 0.004 0 0.000 0.004
+#Timestamp S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT
+# 0.3 0.00 100.00 68.74 1.95 77.73 68.02 1 0.004 0 0.000 0 0.000 0.004
BEGIN {
headerlines=0; datalines=0; totallines=0
}
-/^Timestamp S0 S1 E O M CCS YGC YGCT FGC FGCT GCT $/ {
+/^Timestamp S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT $/ {
headerlines++;
}
-/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+\.[0-9]+)|-[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
+/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+\.[0-9]+)|-[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
datalines++;
}
From 0060da2f236791f15a5af1c7c685fb6d58e3bf4e Mon Sep 17 00:00:00 2001
From: "Daniel D. Daugherty"
Date: Fri, 1 Apr 2016 14:29:41 -0700
Subject: [PATCH 15/44] 8153302: [BACKOUT] STW phases at Concurrent GC should
count in PerfCounter
Reviewed-by: jmasa, jwilhelm
---
.../sun/tools/jstat/resources/jstat_options | 124 +-----------------
.../sun/tools/jstat/gcCapacityOutput1.awk | 10 +-
jdk/test/sun/tools/jstat/gcCauseOutput1.awk | 6 +-
.../sun/tools/jstat/gcMetaCapacityOutput1.awk | 8 +-
.../sun/tools/jstat/gcNewCapacityOutput1.awk | 9 +-
.../sun/tools/jstat/gcOldCapacityOutput1.awk | 8 +-
jdk/test/sun/tools/jstat/gcOldOutput1.awk | 6 +-
jdk/test/sun/tools/jstat/gcOutput1.awk | 8 +-
jdk/test/sun/tools/jstat/lineCounts1.awk | 16 +--
jdk/test/sun/tools/jstat/lineCounts2.awk | 8 +-
jdk/test/sun/tools/jstat/lineCounts3.awk | 26 ++--
jdk/test/sun/tools/jstat/lineCounts4.awk | 30 ++---
jdk/test/sun/tools/jstat/timeStamp1.awk | 8 +-
13 files changed, 76 insertions(+), 191 deletions(-)
diff --git a/jdk/src/jdk.jcmd/share/classes/sun/tools/jstat/resources/jstat_options b/jdk/src/jdk.jcmd/share/classes/sun/tools/jstat/resources/jstat_options
index 05af6b23ded..9bccaebd0d0 100644
--- a/jdk/src/jdk.jcmd/share/classes/sun/tools/jstat/resources/jstat_options
+++ b/jdk/src/jdk.jcmd/share/classes/sun/tools/jstat/resources/jstat_options
@@ -254,25 +254,9 @@ option gc {
scale sec
format "0.000"
}
- column {
- header "^CGC^" /* Concurrent Collections (STW phase) */
- data sun.gc.collector.2.invocations
- align center
- width 5
- scale raw
- format "0"
- }
- column {
- header "^CGCT^" /* Concurrent Garbage Collection Time (STW phase) */
- data sun.gc.collector.2.time/sun.os.hrt.frequency
- align right
- width 8
- scale sec
- format "0.000"
- }
column {
header "^GCT^" /* Total Garbage Collection Time */
- data (sun.gc.collector.0.time + sun.gc.collector.1.time + sun.gc.collector.2.time)/sun.os.hrt.frequency
+ data (sun.gc.collector.0.time + sun.gc.collector.1.time)/sun.os.hrt.frequency
align right
width 8
scale sec
@@ -424,14 +408,6 @@ option gccapacity {
scale raw
format "0"
}
- column {
- header "^CGC^" /* Concurrent Collections (STW phase) */
- data sun.gc.collector.2.invocations
- align right
- width 5
- scale raw
- format "0"
- }
}
option gccause {
@@ -514,25 +490,9 @@ option gccause {
width 8
format "0.000"
}
- column {
- header "^CGC^" /* Concurrent Collections (STW phase) */
- data sun.gc.collector.2.invocations
- align right
- width 5
- scale raw
- format "0"
- }
- column {
- header "^CGCT^" /* Concurrent Garbage Collection Time (STW phase) */
- data sun.gc.collector.2.time/sun.os.hrt.frequency
- align right
- width 8
- scale sec
- format "0.000"
- }
column {
header "^GCT^" /* Total Garbage Collection Time */
- data (sun.gc.collector.0.time + sun.gc.collector.1.time + sun.gc.collector.2.time)/sun.os.hrt.frequency
+ data (sun.gc.collector.0.time + sun.gc.collector.1.time)/sun.os.hrt.frequency
align right
width 8
scale sec
@@ -730,14 +690,6 @@ option gcnewcapacity {
scale raw
format "0"
}
- column {
- header "^CGC^" /* Concurrent Collections (STW phase) */
- data sun.gc.collector.2.invocations
- align right
- width 5
- scale raw
- format "0"
- }
}
option gcold {
@@ -812,25 +764,9 @@ option gcold {
width 8
format "0.000"
}
- column {
- header "^CGC^" /* Concurrent Collections (STW phase) */
- data sun.gc.collector.2.invocations
- align right
- width 5
- scale raw
- format "0"
- }
- column {
- header "^CGCT^" /* Concurrent Garbage Collection Time (STW phase) */
- data sun.gc.collector.2.time/sun.os.hrt.frequency
- align right
- width 8
- scale sec
- format "0.000"
- }
column {
header "^GCT^" /* Total Garbage Collection Time */
- data (sun.gc.collector.0.time + sun.gc.collector.1.time + sun.gc.collector.2.time)/sun.os.hrt.frequency
+ data (sun.gc.collector.0.time + sun.gc.collector.1.time)/sun.os.hrt.frequency
align right
width 8
scale sec
@@ -894,25 +830,9 @@ option gcoldcapacity {
width 8
format "0.000"
}
- column {
- header "^CGC^" /* Concurrent Collections (STW phase) */
- data sun.gc.collector.2.invocations
- align right
- width 5
- scale raw
- format "0"
- }
- column {
- header "^CGCT^" /* Concurrent Garbage Collection Time (STW phase) */
- data sun.gc.collector.2.time/sun.os.hrt.frequency
- align right
- width 8
- scale sec
- format "0.000"
- }
column {
header "^GCT^" /* Total Garbage Collection Time */
- data (sun.gc.collector.0.time + sun.gc.collector.1.time + sun.gc.collector.2.time)/sun.os.hrt.frequency
+ data (sun.gc.collector.0.time + sun.gc.collector.1.time)/sun.os.hrt.frequency
align right
width 8
scale sec
@@ -992,25 +912,9 @@ option gcmetacapacity {
width 8
format "0.000"
}
- column {
- header "^CGC^" /* Concurrent Collections (STW phase) */
- data sun.gc.collector.2.invocations
- align right
- width 5
- scale raw
- format "0"
- }
- column {
- header "^CGCT^" /* Concurrent Garbage Collection Time (STW phase) */
- data sun.gc.collector.2.time/sun.os.hrt.frequency
- align right
- width 8
- scale sec
- format "0.000"
- }
column {
header "^GCT^" /* Total Garbage Collection Time */
- data (sun.gc.collector.0.time + sun.gc.collector.1.time + sun.gc.collector.2.time)/sun.os.hrt.frequency
+ data (sun.gc.collector.0.time + sun.gc.collector.1.time)/sun.os.hrt.frequency
align right
width 8
scale sec
@@ -1098,25 +1002,9 @@ option gcutil {
width 8
format "0.000"
}
- column {
- header "^CGC^" /* Concurrent Collections (STW phase) */
- data sun.gc.collector.2.invocations
- align right
- width 5
- scale raw
- format "0"
- }
- column {
- header "^CGCT^" /* Concurrent Garbage Collection Time (STW phase) */
- data sun.gc.collector.2.time/sun.os.hrt.frequency
- align right
- width 8
- scale sec
- format "0.000"
- }
column {
header "^GCT^" /* Total Garbage Collection Time */
- data (sun.gc.collector.0.time + sun.gc.collector.1.time + sun.gc.collector.2.time)/sun.os.hrt.frequency
+ data (sun.gc.collector.0.time + sun.gc.collector.1.time)/sun.os.hrt.frequency
align right
width 8
scale sec
diff --git a/jdk/test/sun/tools/jstat/gcCapacityOutput1.awk b/jdk/test/sun/tools/jstat/gcCapacityOutput1.awk
index f556a1dd126..ec7a737d55c 100644
--- a/jdk/test/sun/tools/jstat/gcCapacityOutput1.awk
+++ b/jdk/test/sun/tools/jstat/gcCapacityOutput1.awk
@@ -3,21 +3,19 @@
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
-# NGCMN NGCMX NGC S0C S1C EC OGCMN OGCMX OGC OC MCMN MCMX MC CCSMN CCSMX CCSC YGC FGC CGC
-# 4096.0 657408.0 8192.0 512.0 512.0 3072.0 6144.0 1312768.0 6144.0 6144.0 512.0 132096.0 5120.0 512.0 131072.0 512.0 1 0 0
-
-
+# NGCMN NGCMX NGC S0C S1C EC OGCMN OGCMX OGC OC MCMN MCMX MC CCSMN CCSMX CCSC YGC FGC
+# 4096.0 657408.0 8192.0 512.0 512.0 3072.0 6144.0 1312768.0 6144.0 6144.0 512.0 132096.0 5120.0 512.0 131072.0 512.0 1 0
BEGIN {
headerlines=0; datalines=0; totallines=0
}
-/^ NGCMN NGCMX NGC S0C S1C EC OGCMN OGCMX OGC OC MCMN MCMX MC CCSMN CCSMX CCSC YGC FGC CGC $/ {
+/^ NGCMN NGCMX NGC S0C S1C EC OGCMN OGCMX OGC OC MCMN MCMX MC CCSMN CCSMX CCSC YGC FGC $/ {
headerlines++;
}
-/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+[ ]*[0-9]+$/ {
+/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+$/ {
datalines++;
}
diff --git a/jdk/test/sun/tools/jstat/gcCauseOutput1.awk b/jdk/test/sun/tools/jstat/gcCauseOutput1.awk
index 8495b621bce..005e791043a 100644
--- a/jdk/test/sun/tools/jstat/gcCauseOutput1.awk
+++ b/jdk/test/sun/tools/jstat/gcCauseOutput1.awk
@@ -3,15 +3,15 @@
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
-# S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT LGCC GCC
-# 0.00 0.00 0.00 9.97 90.94 87.70 2 0.013 0 0.000 0 0.000 0.013 Allocation Failure No GC
+# S0 S1 E O M CCS YGC YGCT FGC FGCT GCT LGCC GCC
+# 0.00 0.00 0.00 9.97 90.94 87.70 2 0.013 0 0.000 0.013 Allocation Failure No GC
BEGIN {
headerlines=0; datalines=0; totallines=0
}
-/^ S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT LGCC GCC $/ {
+/^ S0 S1 E O M CCS YGC YGCT FGC FGCT GCT LGCC GCC $/ {
headerlines++;
}
diff --git a/jdk/test/sun/tools/jstat/gcMetaCapacityOutput1.awk b/jdk/test/sun/tools/jstat/gcMetaCapacityOutput1.awk
index 2d08dcc29da..352e02d6cbc 100644
--- a/jdk/test/sun/tools/jstat/gcMetaCapacityOutput1.awk
+++ b/jdk/test/sun/tools/jstat/gcMetaCapacityOutput1.awk
@@ -3,18 +3,18 @@
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
-# MCMN MCMX MC CCSMN CCSMX CCSC YGC FGC FGCT CGC CGCT GCT
-# 512.0 132096.0 5120.0 512.0 131072.0 512.0 1 0 0.000 0 0.000 0.004
+# MCMN MCMX MC CCSMN CCSMX CCSC YGC FGC FGCT GCT
+# 512.0 132096.0 5120.0 512.0 131072.0 512.0 1 0 0.000 0.004
BEGIN {
headerlines=0; datalines=0; totallines=0
}
-/^ MCMN MCMX MC CCSMN CCSMX CCSC YGC FGC FGCT CGC CGCT GCT $/ {
+/^ MCMN MCMX MC CCSMN CCSMX CCSC YGC FGC FGCT GCT $/ {
headerlines++;
}
-/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
+/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
datalines++;
}
diff --git a/jdk/test/sun/tools/jstat/gcNewCapacityOutput1.awk b/jdk/test/sun/tools/jstat/gcNewCapacityOutput1.awk
index 51b4d24cec4..f4473dc37e4 100644
--- a/jdk/test/sun/tools/jstat/gcNewCapacityOutput1.awk
+++ b/jdk/test/sun/tools/jstat/gcNewCapacityOutput1.awk
@@ -3,20 +3,19 @@
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
-# NGCMN NGCMX NGC S0CMX S0C S1CMX S1C ECMX EC YGC FGC CGC
-# 2176.0 7232.0 2176.0 192.0 64.0 192.0 64.0 6848.0 2048.0 1 0 0
-
+# NGCMN NGCMX NGC S0CMX S0C S1CMX S1C ECMX EC YGC FGC
+# 2176.0 7232.0 2176.0 192.0 64.0 192.0 64.0 6848.0 2048.0 1 0
BEGIN {
headerlines=0; datalines=0; totallines=0
}
-/^ NGCMN NGCMX NGC S0CMX S0C S1CMX S1C ECMX EC YGC FGC CGC $/ {
+/^ NGCMN NGCMX NGC S0CMX S0C S1CMX S1C ECMX EC YGC FGC $/ {
headerlines++;
}
-/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+[ ]*[0-9]+$/ {
+/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+$/ {
datalines++;
}
diff --git a/jdk/test/sun/tools/jstat/gcOldCapacityOutput1.awk b/jdk/test/sun/tools/jstat/gcOldCapacityOutput1.awk
index c2a3a3dcdcc..cbf88756060 100644
--- a/jdk/test/sun/tools/jstat/gcOldCapacityOutput1.awk
+++ b/jdk/test/sun/tools/jstat/gcOldCapacityOutput1.awk
@@ -3,18 +3,18 @@
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
-# OGCMN OGCMX OGC OC YGC FGC FGCT CGC CGCT GCT
-# 6016.0 58304.0 6016.0 6016.0 1 0 0.000 0 0.000 0.030
+# OGCMN OGCMX OGC OC YGC FGC FGCT GCT
+# 6016.0 58304.0 6016.0 6016.0 1 0 0.000 0.030
BEGIN {
headerlines=0; datalines=0; totallines=0
}
-/^ OGCMN OGCMX OGC OC YGC FGC FGCT CGC CGCT GCT $/ {
+/^ OGCMN OGCMX OGC OC YGC FGC FGCT GCT $/ {
headerlines++;
}
-/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
+/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
datalines++;
}
diff --git a/jdk/test/sun/tools/jstat/gcOldOutput1.awk b/jdk/test/sun/tools/jstat/gcOldOutput1.awk
index 4ea47780015..319f707d273 100644
--- a/jdk/test/sun/tools/jstat/gcOldOutput1.awk
+++ b/jdk/test/sun/tools/jstat/gcOldOutput1.awk
@@ -3,7 +3,7 @@
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
-# MC MU CCSC CCSU OC OU YGC FGC FGCT CGC CGCT GCT
+# MC MU CCSC CCSU OC OU YGC FGC FGCT GCT
# 5120.0 4152.0 512.0 397.9 6144.0 200.0 1 0 0.000 0.005
@@ -11,11 +11,11 @@ BEGIN {
headerlines=0; datalines=0; totallines=0
}
-/^ MC MU CCSC CCSU OC OU YGC FGC FGCT CGC CGCT GCT $/ {
+/^ MC MU CCSC CCSU OC OU YGC FGC FGCT GCT $/ {
headerlines++;
}
-/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
+/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
datalines++;
}
diff --git a/jdk/test/sun/tools/jstat/gcOutput1.awk b/jdk/test/sun/tools/jstat/gcOutput1.awk
index bf27f8c3317..5bd59fe0d8e 100644
--- a/jdk/test/sun/tools/jstat/gcOutput1.awk
+++ b/jdk/test/sun/tools/jstat/gcOutput1.awk
@@ -3,19 +3,19 @@
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
-# S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT CGC CGCT GCT
-# 512.0 512.0 0.0 496.0 3072.0 615.5 6144.0 280.0 5120.0 4176.0 512.0 401.0 1 0.005 0 0.000 0 0.000 0.005
+# S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT GCT
+# 512.0 512.0 0.0 496.0 3072.0 615.5 6144.0 280.0 5120.0 4176.0 512.0 401.0 1 0.005 0 0.000 0.005
BEGIN {
headerlines=0; datalines=0; totallines=0
}
-/^ S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT CGC CGCT GCT $/ {
+/^ S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT GCT $/ {
headerlines++;
}
-/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
+/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
datalines++;
}
diff --git a/jdk/test/sun/tools/jstat/lineCounts1.awk b/jdk/test/sun/tools/jstat/lineCounts1.awk
index 6eeffd4f8fe..cc974104b99 100644
--- a/jdk/test/sun/tools/jstat/lineCounts1.awk
+++ b/jdk/test/sun/tools/jstat/lineCounts1.awk
@@ -3,22 +3,22 @@
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
-# S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT
-# 0.00 93.76 28.80 1.82 77.74 68.02 1 0.005 0 0.000 0 0.000 0.005
-# 0.00 93.76 73.04 1.82 77.74 68.02 1 0.005 0 0.000 0 0.000 0.005
-# 0.00 93.76 73.04 1.82 77.74 68.02 1 0.005 0 0.000 0 0.000 0.005
-# 0.00 93.76 73.04 1.82 77.74 68.02 1 0.005 0 0.000 0 0.000 0.005
-# 0.00 93.76 75.00 1.82 77.74 68.02 1 0.005 0 0.000 0 0.000 0.005
+# S0 S1 E O M CCS YGC YGCT FGC FGCT GCT
+# 0.00 93.76 28.80 1.82 77.74 68.02 1 0.005 0 0.000 0.005
+# 0.00 93.76 73.04 1.82 77.74 68.02 1 0.005 0 0.000 0.005
+# 0.00 93.76 73.04 1.82 77.74 68.02 1 0.005 0 0.000 0.005
+# 0.00 93.76 73.04 1.82 77.74 68.02 1 0.005 0 0.000 0.005
+# 0.00 93.76 75.00 1.82 77.74 68.02 1 0.005 0 0.000 0.005
BEGIN {
headerlines=0; datalines=0; totallines=0
}
-/^ S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT $/ {
+/^ S0 S1 E O M CCS YGC YGCT FGC FGCT GCT $/ {
headerlines++;
}
-/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+\.[0-9]+)|-[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
+/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+\.[0-9]+)|-[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
datalines++;
}
diff --git a/jdk/test/sun/tools/jstat/lineCounts2.awk b/jdk/test/sun/tools/jstat/lineCounts2.awk
index 2766c1a3ab3..ac2009d2e0b 100644
--- a/jdk/test/sun/tools/jstat/lineCounts2.awk
+++ b/jdk/test/sun/tools/jstat/lineCounts2.awk
@@ -3,18 +3,18 @@
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
-# S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT
-# 0.00 93.76 28.40 1.82 77.74 68.02 1 0.005 0 0.000 0 0.000 0.005
+# S0 S1 E O M CCS YGC YGCT FGC FGCT GCT
+# 0.00 93.76 28.40 1.82 77.74 68.02 1 0.005 0 0.000 0.005
BEGIN {
headerlines=0; datalines=0; totallines=0
}
-/^ S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT $/ {
+/^ S0 S1 E O M CCS YGC YGCT FGC FGCT GCT $/ {
headerlines++;
}
-/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+\.[0-9]+)|-[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
+/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+\.[0-9]+)|-[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
datalines++;
}
diff --git a/jdk/test/sun/tools/jstat/lineCounts3.awk b/jdk/test/sun/tools/jstat/lineCounts3.awk
index 5577b417a3c..9b6d3ecec59 100644
--- a/jdk/test/sun/tools/jstat/lineCounts3.awk
+++ b/jdk/test/sun/tools/jstat/lineCounts3.awk
@@ -3,27 +3,27 @@
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
-# S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT
-# 0.00 93.76 26.48 1.95 77.78 68.02 1 0.006 0 0.000 0 0.000 0.006
-# 0.00 93.76 71.58 1.95 77.78 68.02 1 0.006 0 0.000 0 0.000 0.006
-# 0.00 93.76 73.58 1.95 77.78 68.02 1 0.006 0 0.000 0 0.000 0.006
-# 0.00 93.76 73.58 1.95 77.78 68.02 1 0.006 0 0.000 0 0.000 0.006
-# 0.00 93.76 73.58 1.95 77.78 68.02 1 0.006 0 0.000 0 0.000 0.006
-# 0.00 93.76 75.58 1.95 77.78 68.02 1 0.006 0 0.000 0 0.000 0.006
-# 0.00 93.76 75.58 1.95 77.78 68.02 1 0.006 0 0.000 0 0.000 0.006
-# 0.00 93.76 77.58 1.95 77.78 68.02 1 0.006 0 0.000 0 0.000 0.006
-# 0.00 93.76 77.58 1.95 77.78 68.02 1 0.006 0 0.000 0 0.000 0.006
-# 0.00 93.76 77.58 1.95 77.78 68.02 1 0.006 0 0.000 0 0.000 0.006
+# S0 S1 E O M CCS YGC YGCT FGC FGCT GCT
+# 0.00 93.76 26.48 1.95 77.78 68.02 1 0.006 0 0.000 0.006
+# 0.00 93.76 71.58 1.95 77.78 68.02 1 0.006 0 0.000 0.006
+# 0.00 93.76 73.58 1.95 77.78 68.02 1 0.006 0 0.000 0.006
+# 0.00 93.76 73.58 1.95 77.78 68.02 1 0.006 0 0.000 0.006
+# 0.00 93.76 73.58 1.95 77.78 68.02 1 0.006 0 0.000 0.006
+# 0.00 93.76 75.58 1.95 77.78 68.02 1 0.006 0 0.000 0.006
+# 0.00 93.76 75.58 1.95 77.78 68.02 1 0.006 0 0.000 0.006
+# 0.00 93.76 77.58 1.95 77.78 68.02 1 0.006 0 0.000 0.006
+# 0.00 93.76 77.58 1.95 77.78 68.02 1 0.006 0 0.000 0.006
+# 0.00 93.76 77.58 1.95 77.78 68.02 1 0.006 0 0.000 0.006
BEGIN {
headerlines=0; datalines=0; totallines=0
}
-/^ S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT $/ {
+/^ S0 S1 E O M CCS YGC YGCT FGC FGCT GCT $/ {
headerlines++;
}
-/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+\.[0-9]+)|-[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
+/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+\.[0-9]+)|-[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
datalines++;
}
diff --git a/jdk/test/sun/tools/jstat/lineCounts4.awk b/jdk/test/sun/tools/jstat/lineCounts4.awk
index eb20692d376..db40ad355c6 100644
--- a/jdk/test/sun/tools/jstat/lineCounts4.awk
+++ b/jdk/test/sun/tools/jstat/lineCounts4.awk
@@ -3,30 +3,30 @@
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
-# S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT
-# 0.00 96.88 66.55 2.34 77.78 68.02 1 0.003 0 0.000 0 0.000 0.003
-# 0.00 96.88 71.58 2.34 77.78 68.02 1 0.003 0 0.000 0 0.000 0.003
-# 0.00 96.88 73.58 2.34 77.78 68.02 1 0.003 0 0.000 0 0.000 0.003
-# 0.00 96.88 73.58 2.34 77.78 68.02 1 0.003 0 0.000 0 0.000 0.003
-# 0.00 96.88 73.58 2.34 77.78 68.02 1 0.003 0 0.000 0 0.000 0.003
-# 0.00 96.88 75.58 2.34 77.78 68.02 1 0.003 0 0.000 0 0.000 0.003
-# 0.00 96.88 75.58 2.34 77.78 68.02 1 0.003 0 0.000 0 0.000 0.003
-# 0.00 96.88 77.58 2.34 77.78 68.02 1 0.003 0 0.000 0 0.000 0.003
-# 0.00 96.88 77.58 2.34 77.78 68.02 1 0.003 0 0.000 0 0.000 0.003
-# 0.00 96.88 77.58 2.34 77.78 68.02 1 0.003 0 0.000 0 0.000 0.003
-# S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT
-# 0.00 96.88 79.58 2.34 77.78 68.02 1 0.003 0 0.000 0 0.000 0.003
+# S0 S1 E O M CCS YGC YGCT FGC FGCT GCT
+# 0.00 96.88 66.55 2.34 77.78 68.02 1 0.003 0 0.000 0.003
+# 0.00 96.88 71.58 2.34 77.78 68.02 1 0.003 0 0.000 0.003
+# 0.00 96.88 73.58 2.34 77.78 68.02 1 0.003 0 0.000 0.003
+# 0.00 96.88 73.58 2.34 77.78 68.02 1 0.003 0 0.000 0.003
+# 0.00 96.88 73.58 2.34 77.78 68.02 1 0.003 0 0.000 0.003
+# 0.00 96.88 75.58 2.34 77.78 68.02 1 0.003 0 0.000 0.003
+# 0.00 96.88 75.58 2.34 77.78 68.02 1 0.003 0 0.000 0.003
+# 0.00 96.88 77.58 2.34 77.78 68.02 1 0.003 0 0.000 0.003
+# 0.00 96.88 77.58 2.34 77.78 68.02 1 0.003 0 0.000 0.003
+# 0.00 96.88 77.58 2.34 77.78 68.02 1 0.003 0 0.000 0.003
+# S0 S1 E O M CCS YGC YGCT FGC FGCT GCT
+# 0.00 96.88 79.58 2.34 77.78 68.02 1 0.003 0 0.000 0.003
BEGIN {
headerlines=0; datalines=0; totallines=0
datalines2=0;
}
-/^ S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT $/ {
+/^ S0 S1 E O M CCS YGC YGCT FGC FGCT GCT $/ {
headerlines++;
}
-/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+\.[0-9]+)|-[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
+/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+\.[0-9]+)|-[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
if (headerlines == 2) {
datalines2++;
}
diff --git a/jdk/test/sun/tools/jstat/timeStamp1.awk b/jdk/test/sun/tools/jstat/timeStamp1.awk
index ab955eb3d8e..908f4230419 100644
--- a/jdk/test/sun/tools/jstat/timeStamp1.awk
+++ b/jdk/test/sun/tools/jstat/timeStamp1.awk
@@ -3,18 +3,18 @@
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
-#Timestamp S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT
-# 0.3 0.00 100.00 68.74 1.95 77.73 68.02 1 0.004 0 0.000 0 0.000 0.004
+#Timestamp S0 S1 E O M CCS YGC YGCT FGC FGCT GCT
+# 0.3 0.00 100.00 68.74 1.95 77.73 68.02 1 0.004 0 0.000 0.004
BEGIN {
headerlines=0; datalines=0; totallines=0
}
-/^Timestamp S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT $/ {
+/^Timestamp S0 S1 E O M CCS YGC YGCT FGC FGCT GCT $/ {
headerlines++;
}
-/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+\.[0-9]+)|-[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
+/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+\.[0-9]+)|-[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
datalines++;
}
From 8496a7c536da8534b7f135959a348148cd025650 Mon Sep 17 00:00:00 2001
From: Jamsheed Mohammed C M
Date: Mon, 4 Apr 2016 02:07:28 -0700
Subject: [PATCH 16/44] 8067247: Crash: assert(method_holder->data() == 0 ...)
failed: a) MT-unsafe modification of inline cache
Made invoker LambdaForm instance & its compiled form lifetime tightly coupled.
Reviewed-by: vlivanov
---
.../classes/java/lang/invoke/InvokerBytecodeGenerator.java | 2 ++
1 file changed, 2 insertions(+)
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
index adec7ad5a50..08e38987bf2 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
@@ -655,6 +655,8 @@ class InvokerBytecodeGenerator {
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.
From 4de86a31a6fd35883c9e9aba115bf30b5ac708b4 Mon Sep 17 00:00:00 2001
From: "Daniel D. Daugherty"
Date: Wed, 6 Apr 2016 15:16:55 -0700
Subject: [PATCH 17/44] 8153673: [BACKOUT] JDWP: Memory Leak: GlobalRefs never
deleted when processing invokeMethod command
Reviewed-by: jwilhelm, sspitsyn
---
.../share/native/libjdwp/invoker.c | 48 ---
jdk/test/com/sun/jdi/OomDebugTest.java | 312 ------------------
2 files changed, 360 deletions(-)
delete mode 100644 jdk/test/com/sun/jdi/OomDebugTest.java
diff --git a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/invoker.c b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/invoker.c
index 680a747ba0c..cd1cd2f7dc0 100644
--- a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/invoker.c
+++ b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/invoker.c
@@ -211,47 +211,6 @@ createGlobalRefs(JNIEnv *env, InvokeRequest *request)
return error;
}
-/*
- * Delete global references from the request which got put there before a
- * invoke request was carried out. See fillInvokeRequest() and invoker invoke*()
- * impls.
- */
-static void
-deleteGlobalRefs(JNIEnv *env, InvokeRequest *request)
-{
- void *cursor;
- jint argIndex = 0;
- jvalue *argument = request->arguments;
- jbyte argumentTag = firstArgumentTypeTag(request->methodSignature, &cursor);
-
- if (request->clazz != NULL) {
- tossGlobalRef(env, &(request->clazz));
- }
- if (request->instance != NULL) {
- tossGlobalRef(env, &(request->instance));
- }
- /* Delete global argument references */
- while (argIndex < request->argumentCount) {
- if ((argumentTag == JDWP_TAG(OBJECT)) ||
- (argumentTag == JDWP_TAG(ARRAY))) {
- if (argument->l != NULL) {
- tossGlobalRef(env, &(argument->l));
- }
- }
- argument++;
- argIndex++;
- argumentTag = nextArgumentTypeTag(&cursor);
- }
- /* Delete potentially saved return values */
- if ((request->invokeType == INVOKE_CONSTRUCTOR) ||
- (returnTypeTag(request->methodSignature) == JDWP_TAG(OBJECT)) ||
- (returnTypeTag(request->methodSignature) == JDWP_TAG(ARRAY))) {
- if (request->returnValue.l != NULL) {
- tossGlobalRef(env, &(request->returnValue.l));
- }
- }
-}
-
static jvmtiError
fillInvokeRequest(JNIEnv *env, InvokeRequest *request,
jbyte invokeType, jbyte options, jint id,
@@ -777,13 +736,6 @@ invoker_completeInvokeRequest(jthread thread)
(void)outStream_writeObjectRef(env, &out, exc);
outStream_sendReply(&out);
}
-
- /*
- * At this time, there's no need to retain global references on
- * arguments since the reply is processed. No one will deal with
- * this request ID anymore, so we must call deleteGlobalRefs().
- */
- deleteGlobalRefs(env, request);
}
jboolean
diff --git a/jdk/test/com/sun/jdi/OomDebugTest.java b/jdk/test/com/sun/jdi/OomDebugTest.java
deleted file mode 100644
index eadb2aaa342..00000000000
--- a/jdk/test/com/sun/jdi/OomDebugTest.java
+++ /dev/null
@@ -1,312 +0,0 @@
-/*
- * Copyright (c) 2016 Red Hat Inc.
- *
- * 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 4858370
- * @summary JDWP: Memory Leak (global references not deleted after invokeMethod).
- *
- * @author Severin Gehwolf
- *
- * @library ..
- * @run build TestScaffold VMConnection TargetListener TargetAdapter
- * @run compile -g OomDebugTest.java
- * @run main OomDebugTest OomDebugTestTarget test1
- * @run main OomDebugTest OomDebugTestTarget test2
- * @run main OomDebugTest OomDebugTestTarget test3
- * @run main OomDebugTest OomDebugTestTarget test4
- * @run main OomDebugTest OomDebugTestTarget test5
- */
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import com.sun.jdi.ArrayReference;
-import com.sun.jdi.ArrayType;
-import com.sun.jdi.ClassType;
-import com.sun.jdi.Field;
-import com.sun.jdi.InvocationException;
-import com.sun.jdi.Method;
-import com.sun.jdi.ObjectReference;
-import com.sun.jdi.ReferenceType;
-import com.sun.jdi.StackFrame;
-import com.sun.jdi.VMOutOfMemoryException;
-import com.sun.jdi.Value;
-import com.sun.jdi.event.BreakpointEvent;
-
-/***************** Target program **********************/
-
-class OomDebugTestTarget {
-
- OomDebugTestTarget() {
- System.out.println("DEBUG: invoked constructor");
- }
- static class FooCls {
- @SuppressWarnings("unused")
- private byte[] bytes = new byte[3000000];
- };
-
- FooCls fooCls = new FooCls();
- byte[] byteArray = new byte[0];
-
- void testMethod(FooCls foo) {
- System.out.println("DEBUG: invoked 'void testMethod(FooCls)', foo == " + foo);
- }
-
- void testPrimitive(byte[] foo) {
- System.out.println("DEBUG: invoked 'void testPrimitive(byte[])', foo == " + foo);
- }
-
- byte[] testPrimitiveArrRetval() {
- System.out.println("DEBUG: invoked 'byte[] testPrimitiveArrRetval()'");
- return new byte[3000000];
- }
-
- FooCls testFooClsRetval() {
- System.out.println("DEBUG: invoked 'FooCls testFooClsRetval()'");
- return new FooCls();
- }
-
- public void entry() {}
-
- public static void main(String[] args){
- System.out.println("DEBUG: OomDebugTestTarget.main");
- new OomDebugTestTarget().entry();
- }
-}
-
-/***************** Test program ************************/
-
-public class OomDebugTest extends TestScaffold {
-
- private static final int TOTAL_TESTS = 1;
- private ReferenceType targetClass;
- private ObjectReference thisObject;
- private int failedTests;
- private final String testMethodName;
-
- public OomDebugTest(String[] args) {
- super(args);
- if (args.length != 2) {
- throw new RuntimeException("Test failed unexpectedly.");
- }
- testMethodName = args[1];
- }
-
- @Override
- protected void runTests() throws Exception {
- try {
- /*
- * Get to the top of entry()
- * to determine targetClass and mainThread
- */
- BreakpointEvent bpe = startTo("OomDebugTestTarget", "entry", "()V");
- targetClass = bpe.location().declaringType();
-
- mainThread = bpe.thread();
-
- StackFrame frame = mainThread.frame(0);
- thisObject = frame.thisObject();
- java.lang.reflect.Method m = findTestMethod();
- m.invoke(this);
- } catch (NoSuchMethodException e) {
- e.printStackTrace();
- failure();
- } catch (SecurityException e) {
- e.printStackTrace();
- failure();
- }
- }
-
- private java.lang.reflect.Method findTestMethod()
- throws NoSuchMethodException, SecurityException {
- return OomDebugTest.class.getDeclaredMethod(testMethodName);
- }
-
- private void failure() {
- failedTests++;
- }
-
- /*
- * Test case: Object reference as method parameter.
- */
- @SuppressWarnings("unused") // called via reflection
- private void test1() throws Exception {
- System.out.println("DEBUG: ------------> Running " + testMethodName);
- try {
- Field field = targetClass.fieldByName("fooCls");
- ClassType clsType = (ClassType)field.type();
- Method constructor = getConstructorForClass(clsType);
- for (int i = 0; i < 15; i++) {
- @SuppressWarnings({ "rawtypes", "unchecked" })
- ObjectReference objRef = clsType.newInstance(mainThread,
- constructor,
- new ArrayList(0),
- ObjectReference.INVOKE_NONVIRTUAL);
- invoke("testMethod", "(LOomDebugTestTarget$FooCls;)V", objRef);
- }
- } catch (InvocationException e) {
- handleFailure(e);
- }
- }
-
- /*
- * Test case: Array reference as method parameter.
- */
- @SuppressWarnings("unused") // called via reflection
- private void test2() throws Exception {
- System.out.println("DEBUG: ------------> Running " + testMethodName);
- try {
- Field field = targetClass.fieldByName("byteArray");
- ArrayType arrType = (ArrayType)field.type();
-
- for (int i = 0; i < 15; i++) {
- ArrayReference byteArrayVal = arrType.newInstance(3000000);
- invoke("testPrimitive", "([B)V", byteArrayVal);
- }
- } catch (VMOutOfMemoryException e) {
- defaultHandleOOMFailure(e);
- }
- }
-
- /*
- * Test case: Array reference as return value.
- */
- @SuppressWarnings("unused") // called via reflection
- private void test3() throws Exception {
- System.out.println("DEBUG: ------------> Running " + testMethodName);
- try {
- for (int i = 0; i < 15; i++) {
- invoke("testPrimitiveArrRetval",
- "()[B",
- Collections.EMPTY_LIST,
- vm().mirrorOfVoid());
- }
- } catch (InvocationException e) {
- handleFailure(e);
- }
- }
-
- /*
- * Test case: Object reference as return value.
- */
- @SuppressWarnings("unused") // called via reflection
- private void test4() throws Exception {
- System.out.println("DEBUG: ------------> Running " + testMethodName);
- try {
- for (int i = 0; i < 15; i++) {
- invoke("testFooClsRetval",
- "()LOomDebugTestTarget$FooCls;",
- Collections.EMPTY_LIST,
- vm().mirrorOfVoid());
- }
- } catch (InvocationException e) {
- handleFailure(e);
- }
- }
-
- /*
- * Test case: Constructor
- */
- @SuppressWarnings({ "unused", "unchecked", "rawtypes" }) // called via reflection
- private void test5() throws Exception {
- System.out.println("DEBUG: ------------> Running " + testMethodName);
- try {
- ClassType type = (ClassType)thisObject.type();
- for (int i = 0; i < 15; i++) {
- type.newInstance(mainThread,
- findMethod(targetClass, "", "()V"),
- new ArrayList(0),
- ObjectReference.INVOKE_NONVIRTUAL);
- }
- } catch (InvocationException e) {
- handleFailure(e);
- }
- }
-
- private Method getConstructorForClass(ClassType clsType) {
- List methods = clsType.methodsByName("");
- if (methods.size() != 1) {
- throw new RuntimeException("FAIL. Expected only one, the default, constructor");
- }
- return methods.get(0);
- }
-
- private void handleFailure(InvocationException e) {
- // There is no good way to see the OOME diagnostic message in the target since the
- // TestScaffold might throw an exception while trying to print the stack trace. I.e
- // it might get a a VMDisconnectedException before the stack trace printing finishes.
- System.err.println("FAILURE: InvocationException caused by OOM");
- defaultHandleOOMFailure(e);
- }
-
- private void defaultHandleOOMFailure(Exception e) {
- e.printStackTrace();
- failure();
- }
-
- @SuppressWarnings({ "rawtypes", "unchecked" })
- void invoke(String methodName, String methodSig, Value value)
- throws Exception {
- List args = new ArrayList(1);
- args.add(value);
- invoke(methodName, methodSig, args, value);
- }
-
- void invoke(String methodName,
- String methodSig,
- @SuppressWarnings("rawtypes") List args,
- Value value) throws Exception {
- Method method = findMethod(targetClass, methodName, methodSig);
- if ( method == null) {
- failure("FAILED: Can't find method: "
- + methodName + " for class = " + targetClass);
- return;
- }
- invoke(method, args, value);
- }
-
- @SuppressWarnings({ "rawtypes", "unchecked" })
- void invoke(Method method, List args, Value value) throws Exception {
- thisObject.invokeMethod(mainThread, method, args, 0);
- System.out.println("DEBUG: Done invoking method via debugger.");
- }
-
- Value fieldValue(String fieldName) {
- Field field = targetClass.fieldByName(fieldName);
- return thisObject.getValue(field);
- }
-
- public static void main(String[] args) throws Exception {
- System.setProperty("test.vm.opts", "-Xmx40m"); // Set debuggee VM option
- OomDebugTest oomTest = new OomDebugTest(args);
- oomTest.startTests();
- if (oomTest.failedTests > 0) {
- throw new RuntimeException(oomTest.failedTests
- + " of " + TOTAL_TESTS + " test(s) failed.");
- }
- System.out.println("All " + TOTAL_TESTS + " tests passed.");
- }
-
-}
From 454465249484c72574f0d53003c7db37836c584d Mon Sep 17 00:00:00 2001
From: Stuart Marks
Date: Mon, 11 Apr 2016 11:45:30 -0700
Subject: [PATCH 18/44] 8145461: finalize and integrate @Deprecated annotation
specification change
Reviewed-by: scolebourne, chegar, lancea
---
.../share/classes/java/lang/Deprecated.java | 63 ++++++++++++++++---
1 file changed, 56 insertions(+), 7 deletions(-)
diff --git a/jdk/src/java.base/share/classes/java/lang/Deprecated.java b/jdk/src/java.base/share/classes/java/lang/Deprecated.java
index f9c177b38c4..eceb8127d9b 100644
--- a/jdk/src/java.base/share/classes/java/lang/Deprecated.java
+++ b/jdk/src/java.base/share/classes/java/lang/Deprecated.java
@@ -29,14 +29,44 @@ import java.lang.annotation.*;
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.
*
- *
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.
+ *
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.
+ *
+ *
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.
+ *
+ *
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.
+ *
+ *
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.
+ *
+ *
There is no defined order among annotation elements. As a matter of
+ * style, the {@code since} element should be placed first.
+ *
+ *
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 @@ import static java.lang.annotation.ElementType.*;
@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;
}
From 91f88bbdca2729d051b3efd15d8519fe770cd347 Mon Sep 17 00:00:00 2001
From: Nishit Jain
Date: Tue, 12 Apr 2016 10:15:09 +0900
Subject: [PATCH 19/44] 8150324: java/util/Currency/CurrencyTest.java does not
restore default TimeZone
Reviewed-by: okutsu, peytoia
---
jdk/test/java/util/Currency/CurrencyTest.java | 25 ++++++++++---------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/jdk/test/java/util/Currency/CurrencyTest.java b/jdk/test/java/util/Currency/CurrencyTest.java
index 05d3cbf7265..2a4b6eaeb94 100644
--- a/jdk/test/java/util/Currency/CurrencyTest.java
+++ b/jdk/test/java/util/Currency/CurrencyTest.java
@@ -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.ByteArrayInputStream;
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 @@ public class CurrencyTest {
/*
* 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 @@ public class CurrencyTest {
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
From 3eb4896664ea76614ba8d0299ac8bb657d0692c7 Mon Sep 17 00:00:00 2001
From: Amy Lu
Date: Tue, 12 Apr 2016 09:54:55 +0800
Subject: [PATCH 20/44] 8154031: Mark tools/pack200/BandIntegrity.java as
intermittently failing
Reviewed-by: darcy
---
jdk/test/tools/pack200/BandIntegrity.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/jdk/test/tools/pack200/BandIntegrity.java b/jdk/test/tools/pack200/BandIntegrity.java
index 2a59f3b8c13..3aa65ff07f4 100644
--- a/jdk/test/tools/pack200/BandIntegrity.java
+++ b/jdk/test/tools/pack200/BandIntegrity.java
@@ -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;
From 636213d1c92538b6a0dbfe57238edc1db46b5cf0 Mon Sep 17 00:00:00 2001
From: Hamlin Li
Date: Tue, 12 Apr 2016 13:53:48 +0800
Subject: [PATCH 21/44] 8068693: (ch) test
java/nio/channels/AsyncCloseAndInterrupt.java failing 8153209:
java/nio/channels/AsyncCloseAndInterrupt.java fails throwing exception:
java.nio.channels.ClosedChannelException
For JDK-8068693, 500ms is too short on busy system for channel to be closed or for thread blocking on IO to be interrupted, increase the time from 500ms to 10000ms. for JDK-8153209, it's a test regression due to JDK-8151582, do not sleep when running tests for CONNECT/FINISH_CONNECT, sleep for other test cases.
Reviewed-by: bpb, martin, rriggs
---
.../nio/channels/AsyncCloseAndInterrupt.java | 29 +++++++++++++------
1 file changed, 20 insertions(+), 9 deletions(-)
diff --git a/jdk/test/java/nio/channels/AsyncCloseAndInterrupt.java b/jdk/test/java/nio/channels/AsyncCloseAndInterrupt.java
index d897fa0ea55..8f6bf999f11 100644
--- a/jdk/test/java/nio/channels/AsyncCloseAndInterrupt.java
+++ b/jdk/test/java/nio/channels/AsyncCloseAndInterrupt.java
@@ -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 @@ public class AsyncCloseAndInterrupt {
}
// 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 @@ public class AsyncCloseAndInterrupt {
sleep(50);
} while (!t.ready);
+ if (extraSleep) {
+ sleep(100);
+ }
+
switch (test) {
case TEST_INTR:
@@ -603,15 +611,18 @@ public class AsyncCloseAndInterrupt {
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 @@ public class AsyncCloseAndInterrupt {
return;
}
- test(cf, op, TEST_CLOSE);
+ test(cf, op, TEST_CLOSE, extraSleep);
}
static void test(ChannelFactory cf)
@@ -720,8 +731,8 @@ public class AsyncCloseAndInterrupt {
Future 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);
From f767b8ce1969782d286b967834fe9232020e40a9 Mon Sep 17 00:00:00 2001
From: Steve Drach
Date: Tue, 12 Apr 2016 18:25:10 +0200
Subject: [PATCH 22/44] 8153213: Jar manifest attribute "Multi-Release" accepts
any value
Reviewed-by: psandoz, redestad
---
.../share/classes/java/util/jar/JarFile.java | 47 ++++++++++++++-----
.../util/jar/JarFile/MultiReleaseJarAPI.java | 28 ++++++++++-
.../util/jar/CreateMultiReleaseTestJars.java | 8 +++-
3 files changed, 69 insertions(+), 14 deletions(-)
diff --git a/jdk/src/java.base/share/classes/java/util/jar/JarFile.java b/jdk/src/java.base/share/classes/java/util/jar/JarFile.java
index 7f5726e3656..f28750c3a97 100644
--- a/jdk/src/java.base/share/classes/java/util/jar/JarFile.java
+++ b/jdk/src/java.base/share/classes/java/util/jar/JarFile.java
@@ -894,7 +894,8 @@ class JarFile extends ZipFile {
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 @@ class JarFile extends ZipFile {
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 @@ class JarFile extends ZipFile {
* 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 @@ class JarFile extends ZipFile {
continue next;
}
}
- return true;
+ return i;
}
- return false;
+ return -1;
}
/**
@@ -1011,11 +1012,35 @@ class JarFile extends ZipFile {
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;
diff --git a/jdk/test/java/util/jar/JarFile/MultiReleaseJarAPI.java b/jdk/test/java/util/jar/JarFile/MultiReleaseJarAPI.java
index 548b4bace19..e6dd04c23af 100644
--- a/jdk/test/java/util/jar/JarFile/MultiReleaseJarAPI.java
+++ b/jdk/test/java/util/jar/JarFile/MultiReleaseJarAPI.java
@@ -54,6 +54,7 @@ public class MultiReleaseJarAPI {
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 @@ public class MultiReleaseJarAPI {
@BeforeClass
public void initialize() throws Exception {
- CreateMultiReleaseTestJars creator = new CreateMultiReleaseTestJars();
creator.compileEntries();
creator.buildUnversionedJar();
creator.buildMultiReleaseJar();
@@ -82,6 +82,10 @@ public class MultiReleaseJarAPI {
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 @@ public class MultiReleaseJarAPI {
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
diff --git a/jdk/test/lib/testlibrary/java/util/jar/CreateMultiReleaseTestJars.java b/jdk/test/lib/testlibrary/java/util/jar/CreateMultiReleaseTestJars.java
index 390c4fa0c69..672b7c2d205 100644
--- a/jdk/test/lib/testlibrary/java/util/jar/CreateMultiReleaseTestJars.java
+++ b/jdk/test/lib/testlibrary/java/util/jar/CreateMultiReleaseTestJars.java
@@ -88,8 +88,12 @@ public class CreateMultiReleaseTestJars {
}
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"));
From cfb375b438a50bc412eaee8c71d160875e8c5005 Mon Sep 17 00:00:00 2001
From: Rajan Halade
Date: Tue, 12 Apr 2016 09:37:46 -0700
Subject: [PATCH 23/44] 8153829: javax/net/ssl/Stapling/HttpsUrlConnClient.java
fails intermittently with NullPointerException
Reviewed-by: xuelei, jnimeh
---
.../testlibrary/SimpleOCSPServer.java | 26 ++++++--
.../net/ssl/Stapling/HttpsUrlConnClient.java | 33 +++++++---
.../ssl/Stapling/SSLEngineWithStapling.java | 24 +++++--
.../ssl/Stapling/SSLSocketWithStapling.java | 66 ++++++++++++++++---
.../net/ssl/Stapling/StapleEnableProps.java | 22 ++++++-
.../ssl/StatusResponseManagerTests.java | 20 +++++-
6 files changed, 159 insertions(+), 32 deletions(-)
diff --git a/jdk/test/java/security/testlibrary/SimpleOCSPServer.java b/jdk/test/java/security/testlibrary/SimpleOCSPServer.java
index aba02e87c76..77b8bb44642 100644
--- a/jdk/test/java/security/testlibrary/SimpleOCSPServer.java
+++ b/jdk/test/java/security/testlibrary/SimpleOCSPServer.java
@@ -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 @@ public class SimpleOCSPServer {
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 @@ public class SimpleOCSPServer {
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 @@ public class SimpleOCSPServer {
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 @@ public class SimpleOCSPServer {
* 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();
@@ -477,6 +482,15 @@ public class SimpleOCSPServer {
}
}
+ /**
+ * 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.
diff --git a/jdk/test/javax/net/ssl/Stapling/HttpsUrlConnClient.java b/jdk/test/javax/net/ssl/Stapling/HttpsUrlConnClient.java
index 817f619ccdc..d54712f5ae5 100644
--- a/jdk/test/javax/net/ssl/Stapling/HttpsUrlConnClient.java
+++ b/jdk/test/javax/net/ssl/Stapling/HttpsUrlConnClient.java
@@ -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 @@ public class HttpsUrlConnClient {
*/
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 @@ public class HttpsUrlConnClient {
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 @@ public class HttpsUrlConnClient {
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);
diff --git a/jdk/test/javax/net/ssl/Stapling/SSLEngineWithStapling.java b/jdk/test/javax/net/ssl/Stapling/SSLEngineWithStapling.java
index d4264278165..2a439c94273 100644
--- a/jdk/test/javax/net/ssl/Stapling/SSLEngineWithStapling.java
+++ b/jdk/test/javax/net/ssl/Stapling/SSLEngineWithStapling.java
@@ -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 @@ public class SSLEngineWithStapling {
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 @@ public class SSLEngineWithStapling {
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);
diff --git a/jdk/test/javax/net/ssl/Stapling/SSLSocketWithStapling.java b/jdk/test/javax/net/ssl/Stapling/SSLSocketWithStapling.java
index 8a4b50bf78a..1f65e09d087 100644
--- a/jdk/test/javax/net/ssl/Stapling/SSLSocketWithStapling.java
+++ b/jdk/test/javax/net/ssl/Stapling/SSLSocketWithStapling.java
@@ -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 @@ public class SSLSocketWithStapling {
// 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 @@ public class SSLSocketWithStapling {
// 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 @@ public class SSLSocketWithStapling {
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 @@ public class SSLSocketWithStapling {
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 @@ public class SSLSocketWithStapling {
*/
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 @@ public class SSLSocketWithStapling {
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 @@ public class SSLSocketWithStapling {
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);
diff --git a/jdk/test/javax/net/ssl/Stapling/StapleEnableProps.java b/jdk/test/javax/net/ssl/Stapling/StapleEnableProps.java
index 7dece5ba724..175924b8ea4 100644
--- a/jdk/test/javax/net/ssl/Stapling/StapleEnableProps.java
+++ b/jdk/test/javax/net/ssl/Stapling/StapleEnableProps.java
@@ -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 @@ public class StapleEnableProps {
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 @@ public class StapleEnableProps {
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);
diff --git a/jdk/test/sun/security/ssl/StatusStapling/java.base/sun/security/ssl/StatusResponseManagerTests.java b/jdk/test/sun/security/ssl/StatusStapling/java.base/sun/security/ssl/StatusResponseManagerTests.java
index 7e0202e5fd8..923bfae12ee 100644
--- a/jdk/test/sun/security/ssl/StatusStapling/java.base/sun/security/ssl/StatusResponseManagerTests.java
+++ b/jdk/test/sun/security/ssl/StatusStapling/java.base/sun/security/ssl/StatusResponseManagerTests.java
@@ -300,7 +300,15 @@ public class StatusResponseManagerTests {
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 @@ public class StatusResponseManagerTests {
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);
From 08d525d5fcf1ab66f44f99470b55f625b14a2d90 Mon Sep 17 00:00:00 2001
From: Claes Redestad
Date: Tue, 12 Apr 2016 21:41:28 +0200
Subject: [PATCH 24/44] 8154067: Avoid early use of limited privilege
escalation in InnerClassLambdaMetafactory
Reviewed-by: alanb, mchung, mullan, briangoetz
---
.../classes/java/lang/invoke/InnerClassLambdaMetafactory.java | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java b/jdk/src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java
index 9a43947d34e..739573507ab 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java
@@ -89,8 +89,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
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);
}
From becc097af0790cac9deebaa5aa4285bd1623d4e2 Mon Sep 17 00:00:00 2001
From: Mandy Chung
Date: Tue, 12 Apr 2016 18:58:21 -0700
Subject: [PATCH 25/44] 8153665: URLClassLoader::definePackage no longer
inspect packages from ancestors
Reviewed-by: alanb
---
.../classes/java/net/URLClassLoader.java | 22 ++--
.../definePackage/SplitPackage.java | 102 ++++++++++++++++++
.../URLClassLoader/definePackage/p/Bar.java | 27 +++++
.../URLClassLoader/definePackage/p/Baz.java | 27 +++++
.../URLClassLoader/definePackage/p/Foo.java | 27 +++++
5 files changed, 193 insertions(+), 12 deletions(-)
create mode 100644 jdk/test/java/net/URLClassLoader/definePackage/SplitPackage.java
create mode 100644 jdk/test/java/net/URLClassLoader/definePackage/p/Bar.java
create mode 100644 jdk/test/java/net/URLClassLoader/definePackage/p/Baz.java
create mode 100644 jdk/test/java/net/URLClassLoader/definePackage/p/Foo.java
diff --git a/jdk/src/java.base/share/classes/java/net/URLClassLoader.java b/jdk/src/java.base/share/classes/java/net/URLClassLoader.java
index 472f6b6d049..025e9467811 100644
--- a/jdk/src/java.base/share/classes/java/net/URLClassLoader.java
+++ b/jdk/src/java.base/share/classes/java/net/URLClassLoader.java
@@ -465,23 +465,21 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
}
/**
- * 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;
diff --git a/jdk/test/java/net/URLClassLoader/definePackage/SplitPackage.java b/jdk/test/java/net/URLClassLoader/definePackage/SplitPackage.java
new file mode 100644
index 00000000000..0b009606624
--- /dev/null
+++ b/jdk/test/java/net/URLClassLoader/definePackage/SplitPackage.java
@@ -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);
+ }
+ }
+}
+
diff --git a/jdk/test/java/net/URLClassLoader/definePackage/p/Bar.java b/jdk/test/java/net/URLClassLoader/definePackage/p/Bar.java
new file mode 100644
index 00000000000..182b27fc2a0
--- /dev/null
+++ b/jdk/test/java/net/URLClassLoader/definePackage/p/Bar.java
@@ -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 { }
diff --git a/jdk/test/java/net/URLClassLoader/definePackage/p/Baz.java b/jdk/test/java/net/URLClassLoader/definePackage/p/Baz.java
new file mode 100644
index 00000000000..a66621c877c
--- /dev/null
+++ b/jdk/test/java/net/URLClassLoader/definePackage/p/Baz.java
@@ -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 { }
diff --git a/jdk/test/java/net/URLClassLoader/definePackage/p/Foo.java b/jdk/test/java/net/URLClassLoader/definePackage/p/Foo.java
new file mode 100644
index 00000000000..67939735f38
--- /dev/null
+++ b/jdk/test/java/net/URLClassLoader/definePackage/p/Foo.java
@@ -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 { }
From 4708667a7dc8872c63bdda4261d6dffb17b6ab6f Mon Sep 17 00:00:00 2001
From: "Daniel D. Daugherty"
Date: Tue, 12 Apr 2016 21:05:15 -0700
Subject: [PATCH 26/44] 8154121: Remove test mistakenly added during a merge
Reviewed-by: amurillo
---
.../DateFormat/DFSConstructorCloneTest.java | 70 -------------------
1 file changed, 70 deletions(-)
delete mode 100644 jdk/test/java/text/Format/DateFormat/DFSConstructorCloneTest.java
diff --git a/jdk/test/java/text/Format/DateFormat/DFSConstructorCloneTest.java b/jdk/test/java/text/Format/DateFormat/DFSConstructorCloneTest.java
deleted file mode 100644
index 8632f0932cc..00000000000
--- a/jdk/test/java/text/Format/DateFormat/DFSConstructorCloneTest.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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 8087104
- * @summary Make sure that clone() method is not called from DateFormatSymbols constructor.
- */
-import java.text.DateFormatSymbols;
-
-public class DFSymbolsCloneTest extends DateFormatSymbols {
-
- private Foo foo;
-
- public DFSymbolsCloneTest(Foo fooObj) {
- if (fooObj == null) {
- this.foo = new Foo();
- } else {
- this.foo = fooObj;
- }
- }
-
- @Override
- public Object clone() {
- DFSymbolsCloneTest dfsclone = (DFSymbolsCloneTest) super.clone();
- if (this.foo == null) {
- throw new RuntimeException("Clone method should not be called from "
- + " Superclass(DateFormatSymbols) Constructor...");
- } else {
- dfsclone.foo = (Foo) this.foo.clone();
- }
- return dfsclone;
- }
-
- public static void main(String[] args) {
- DFSymbolsCloneTest dfsctest = new DFSymbolsCloneTest(new Foo());
- }
-}
-
-class Foo {
-
- public Foo() {
- }
-
- @Override
- protected Object clone() {
- return new Foo();
- }
-
-}
From c3041101495610c793b05ab7ad91636a0d03fb5b Mon Sep 17 00:00:00 2001
From: Michael Haupt
Date: Wed, 13 Apr 2016 09:20:22 +0200
Subject: [PATCH 27/44] 8153637: MethodHandles.countedLoop/3 initialises loop
counter to 1 instead of 0
Reviewed-by: psandoz, redestad
---
.../java/lang/invoke/MethodHandleImpl.java | 18 ++++++++++++++-
.../java/lang/invoke/MethodHandles.java | 10 ++++++---
.../java/lang/invoke/LoopCombinatorTest.java | 22 +++++++++++++++++++
3 files changed, 46 insertions(+), 4 deletions(-)
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
index 026e3062ae8..ab9b906e7ff 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
@@ -1753,6 +1753,18 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
return counter + 1;
}
+ /**
+ * 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}.
*
@@ -1879,7 +1891,8 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
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 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
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);
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
index 76e29209fed..488decd542a 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
@@ -4322,11 +4322,13 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
*
{@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
@@ -4351,7 +4353,9 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
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);
}
diff --git a/jdk/test/java/lang/invoke/LoopCombinatorTest.java b/jdk/test/java/lang/invoke/LoopCombinatorTest.java
index 2bae77e6a2e..71e4b0e89d8 100644
--- a/jdk/test/java/lang/invoke/LoopCombinatorTest.java
+++ b/jdk/test/java/lang/invoke/LoopCombinatorTest.java
@@ -26,6 +26,8 @@
/* @test
* @bug 8139885
* @bug 8150635
+ * @bug 8150957
+ * @bug 8153637
* @run testng/othervm -ea -esa test.java.lang.invoke.LoopCombinatorTest
*/
@@ -301,6 +303,18 @@ public class LoopCombinatorTest {
assertEquals("na na na na na na na na na na na na na Lambdaman!", loop.invoke("Lambdaman!"));
}
+ @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
@@ -667,12 +681,17 @@ public class LoopCombinatorTest {
System.out.print("hello");
}
+ static int addCounter(int counter, int x) {
+ return x + counter;
+ }
+
static final Class 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 @@ public class LoopCombinatorTest {
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 @@ public class LoopCombinatorTest {
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);
}
From f1634255f5b843b4084f9da5ef65c1ad99b5c4a8 Mon Sep 17 00:00:00 2001
From: Nadeesh TV
Date: Wed, 13 Apr 2016 10:41:27 +0000
Subject: [PATCH 28/44] 8148849: Truncating Duration
Introduce a new method to truncatedTo()
Reviewed-by: rriggs, scolebourne
---
.../share/classes/java/time/Duration.java | 42 ++++++
.../java/time/tck/java/time/TCKDuration.java | 129 ++++++++++++++++++
2 files changed, 171 insertions(+)
diff --git a/jdk/src/java.base/share/classes/java/time/Duration.java b/jdk/src/java.base/share/classes/java/time/Duration.java
index af7abfe4226..13e8eff9783 100644
--- a/jdk/src/java.base/share/classes/java/time/Duration.java
+++ b/jdk/src/java.base/share/classes/java/time/Duration.java
@@ -1350,6 +1350,48 @@ public final class Duration
return nanos;
}
+
+ //-----------------------------------------------------------------------
+ /**
+ * Returns a copy of this {@code Duration} truncated to the specified unit.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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}.
diff --git a/jdk/test/java/time/tck/java/time/TCKDuration.java b/jdk/test/java/time/tck/java/time/TCKDuration.java
index 1e83db7ab8f..a79e423bd84 100644
--- a/jdk/test/java/time/tck/java/time/TCKDuration.java
+++ b/jdk/test/java/time/tck/java/time/TCKDuration.java
@@ -65,9 +65,11 @@ import static java.time.temporal.ChronoUnit.HOURS;
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;
@@ -2286,6 +2288,133 @@ public class TCKDuration extends AbstractTCKTest {
test.multipliedBy(Long.MIN_VALUE);
}
+ //-----------------------------------------------------------------------
+ // 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 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 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()
//-----------------------------------------------------------------------
From 1a6b34885f878f819822765b7899cfbe3665d106 Mon Sep 17 00:00:00 2001
From: Peter Levart
Date: Wed, 13 Apr 2016 09:35:26 -0300
Subject: [PATCH 29/44] 8151807: ImageBufferCache should release buffers when
all classes are loaded
Reviewed-by: jlaskey
---
.../jdk/internal/jimage/BasicImageReader.java | 14 +-
.../jdk/internal/jimage/ImageBufferCache.java | 124 +++++++++---------
2 files changed, 71 insertions(+), 67 deletions(-)
diff --git a/jdk/src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java b/jdk/src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java
index 15c888daa83..4c70a9b1547 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java
@@ -288,22 +288,24 @@ public class BasicImageReader implements AutoCloseable {
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;
diff --git a/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageBufferCache.java b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageBufferCache.java
index c9efbe114eb..d4525b2f40a 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageBufferCache.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageBufferCache.java
@@ -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>
- threadLocal = new ThreadLocal<>();
+ private static final ThreadLocal CACHE =
+ new ThreadLocal() {
+ @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 buffers = threadLocal.get();
+ BufferReference[] cache = CACHE.get();
- if (buffers == null) {
- buffers = new ArrayList<>(MAX_FREE_BUFFERS);
- threadLocal.set(buffers);
- }
+ // 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];
- 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;
+ if (reference != null) {
+ ByteBuffer buffer = reference.get();
+ if (buffer != null && size <= buffer.capacity()) {
+ cache[i] = null;
+ result = buffer;
+ result.rewind();
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 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 static Comparator DECREASING_CAPACITY_NULLS_LAST =
+ new Comparator() {
+ @Override
+ public int compare(BufferReference br1, BufferReference br2) {
+ return Integer.compare(br2 == null ? 0 : br2.capacity,
+ br1 == null ? 0 : br1.capacity);
+ }
+ };
+
+ private static class BufferReference extends WeakReference {
+ // 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();
}
}
-
- private ImageBufferCache(int needed) {
- this.buffer = ByteBuffer.allocateDirect((needed + 0xFFF) & ~0xFFF);
- this.isUsed = true;
- this.buffer.limit(needed);
- }
-
- private long capacity() {
- return buffer.capacity();
- }
}
From a7aff44bbb945eb01f0781d17c7a6e9a207a2c44 Mon Sep 17 00:00:00 2001
From: Paul Sandoz
Date: Wed, 13 Apr 2016 15:05:48 +0200
Subject: [PATCH 30/44] 8151705: VarHandle.AccessMode enum names should conform
to code style
Reviewed-by: mhaupt, shade, redestad
---
.../classes/java/lang/invoke/Invokers.java | 8 +-
.../classes/java/lang/invoke/MemberName.java | 2 +-
.../java/lang/invoke/MethodHandleNatives.java | 2 +-
.../java/lang/invoke/MethodHandles.java | 5 +-
.../classes/java/lang/invoke/VarForm.java | 7 +-
.../classes/java/lang/invoke/VarHandle.java | 107 ++++++--
.../invoke/VarHandles/VarHandleBaseTest.java | 63 ++---
.../VarHandleTestAccessBoolean.java | 38 +--
.../VarHandles/VarHandleTestAccessByte.java | 38 +--
.../VarHandles/VarHandleTestAccessChar.java | 38 +--
.../VarHandles/VarHandleTestAccessDouble.java | 38 +--
.../VarHandles/VarHandleTestAccessFloat.java | 38 +--
.../VarHandles/VarHandleTestAccessInt.java | 38 +--
.../VarHandles/VarHandleTestAccessLong.java | 38 +--
.../VarHandles/VarHandleTestAccessShort.java | 38 +--
.../VarHandles/VarHandleTestAccessString.java | 38 +--
.../VarHandleTestByteArrayAsChar.java | 38 +--
.../VarHandleTestByteArrayAsDouble.java | 38 +--
.../VarHandleTestByteArrayAsFloat.java | 38 +--
.../VarHandleTestByteArrayAsInt.java | 38 +--
.../VarHandleTestByteArrayAsLong.java | 38 +--
.../VarHandleTestByteArrayAsShort.java | 38 +--
...arHandleTestMethodHandleAccessBoolean.java | 76 +++---
.../VarHandleTestMethodHandleAccessByte.java | 76 +++---
.../VarHandleTestMethodHandleAccessChar.java | 76 +++---
...VarHandleTestMethodHandleAccessDouble.java | 76 +++---
.../VarHandleTestMethodHandleAccessFloat.java | 76 +++---
.../VarHandleTestMethodHandleAccessInt.java | 228 ++++++++--------
.../VarHandleTestMethodHandleAccessLong.java | 228 ++++++++--------
.../VarHandleTestMethodHandleAccessShort.java | 76 +++---
...VarHandleTestMethodHandleAccessString.java | 214 +++++++--------
.../VarHandleTestMethodTypeBoolean.java | 12 +-
.../VarHandleTestMethodTypeByte.java | 12 +-
.../VarHandleTestMethodTypeChar.java | 12 +-
.../VarHandleTestMethodTypeDouble.java | 12 +-
.../VarHandleTestMethodTypeFloat.java | 12 +-
.../VarHandleTestMethodTypeInt.java | 36 +--
.../VarHandleTestMethodTypeLong.java | 36 +--
.../VarHandleTestMethodTypeShort.java | 12 +-
.../VarHandleTestMethodTypeString.java | 30 +--
.../VarHandles/VarHandleTestReflection.java | 8 +-
.../X-VarHandleTestAccess.java.template | 58 ++--
...X-VarHandleTestByteArrayView.java.template | 58 ++--
...HandleTestMethodHandleAccess.java.template | 252 +++++++++---------
.../X-VarHandleTestMethodType.java.template | 36 +--
45 files changed, 1261 insertions(+), 1215 deletions(-)
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java b/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java
index 6c2b134c31c..bb6a8824058 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java
@@ -131,11 +131,11 @@ class Invokers {
MethodType mtype = targetType;
MethodType invokerType = mtype.insertParameterTypes(0, VarHandle.class);
- LambdaForm lform = varHandleMethodGenericInvokerHandleForm(ak.name(), mtype);
+ LambdaForm lform = varHandleMethodGenericInvokerHandleForm(ak.methodName(), mtype);
VarHandle.AccessDescriptor ad = new VarHandle.AccessDescriptor(mtype, ak.at.ordinal(), ak.ordinal());
MethodHandle invoker = BoundMethodHandle.bindSingle(invokerType, lform, ad);
- invoker = invoker.withInternalMemberName(MemberName.makeVarHandleMethodInvoke(ak.name(), mtype), false);
+ invoker = invoker.withInternalMemberName(MemberName.makeVarHandleMethodInvoke(ak.methodName(), mtype), false);
assert(checkVarHandleInvoker(invoker));
maybeCompileToBytecode(invoker);
@@ -146,11 +146,11 @@ class Invokers {
MethodType mtype = targetType;
MethodType invokerType = mtype.insertParameterTypes(0, VarHandle.class);
- LambdaForm lform = varHandleMethodExactInvokerHandleForm(ak.name(), mtype);
+ LambdaForm lform = varHandleMethodExactInvokerHandleForm(ak.methodName(), mtype);
VarHandle.AccessDescriptor ad = new VarHandle.AccessDescriptor(mtype, ak.at.ordinal(), ak.ordinal());
MethodHandle invoker = BoundMethodHandle.bindSingle(invokerType, lform, ad);
- invoker = invoker.withInternalMemberName(MemberName.makeVarHandleMethodInvoke(ak.name(), mtype), false);
+ invoker = invoker.withInternalMemberName(MemberName.makeVarHandleMethodInvoke(ak.methodName(), mtype), false);
assert(checkVarHandleInvoker(invoker));
maybeCompileToBytecode(invoker);
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MemberName.java b/jdk/src/java.base/share/classes/java/lang/invoke/MemberName.java
index da91db90da3..c2e68753e7b 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MemberName.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MemberName.java
@@ -374,7 +374,7 @@ import java.util.Objects;
}
public static boolean isVarHandleMethodInvokeName(String name) {
try {
- VarHandle.AccessMode.valueOf(name);
+ VarHandle.AccessMode.valueFromMethodName(name);
return true;
} catch (IllegalArgumentException e) {
return false;
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java
index 16d28faea0b..7a5d3f1f0b2 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java
@@ -423,7 +423,7 @@ class MethodHandleNatives {
// Get the access kind from the method name
VarHandle.AccessMode ak;
try {
- ak = VarHandle.AccessMode.valueOf(name);
+ ak = VarHandle.AccessMode.valueFromMethodName(name);
} catch (IllegalArgumentException e) {
throw MethodHandleStatics.newInternalError(e);
}
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
index 488decd542a..bbf65b564bf 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
@@ -43,7 +43,6 @@ import sun.reflect.misc.ReflectUtil;
import sun.security.util.SecurityConstants;
import java.lang.invoke.LambdaForm.BasicType;
-import static java.lang.invoke.MethodHandleStatics.*;
import static java.lang.invoke.MethodHandleImpl.Intrinsic;
import static java.lang.invoke.MethodHandleNatives.Constants.*;
import java.util.concurrent.ConcurrentHashMap;
@@ -53,8 +52,6 @@ import java.util.stream.Stream;
import jdk.internal.org.objectweb.asm.ClassWriter;
import jdk.internal.org.objectweb.asm.Opcodes;
-import static java.lang.invoke.MethodHandleImpl.Intrinsic;
-import static java.lang.invoke.MethodHandleNatives.Constants.*;
import static java.lang.invoke.MethodHandleStatics.newIllegalArgumentException;
/**
@@ -952,7 +949,7 @@ assertEquals("", (String) MH_newString.invokeExact());
}
private MethodHandle findVirtualForVH(String name, MethodType type) {
try {
- return varHandleInvoker(VarHandle.AccessMode.valueOf(name), type);
+ return varHandleInvoker(VarHandle.AccessMode.valueFromMethodName(name), type);
} catch (IllegalArgumentException e) {
return null;
}
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/VarForm.java b/jdk/src/java.base/share/classes/java/lang/invoke/VarForm.java
index 7c8a049d68e..54f9f8e3f18 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/VarForm.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/VarForm.java
@@ -69,13 +69,10 @@ class VarForm {
for (Class> c = implClass; c != VarHandle.class; c = c.getSuperclass()) {
for (Method m : c.getDeclaredMethods()) {
if (Modifier.isStatic(m.getModifiers())) {
- try {
- AccessMode am = AccessMode.valueOf(m.getName());
+ AccessMode am = AccessMode.methodNameToAccessMode.get(m.getName());
+ if (am != null) {
assert table[am.ordinal()] == null;
table[am.ordinal()] = new MemberName(m);
- } catch (IllegalArgumentException ex) {
- // Ignore. Note the try/catch will be removed when
- // AccessMode enum constant names are renamed
}
}
}
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java b/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java
index ed290ec7574..4186659c1b9 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java
@@ -31,7 +31,9 @@ import jdk.internal.vm.annotation.ForceInline;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.function.BiFunction;
import static java.lang.invoke.MethodHandleStatics.UNSAFE;
@@ -272,7 +274,7 @@ import static java.lang.invoke.MethodHandleStatics.newInternalError;
*
{@code
* MethodHandle mh = MethodHandles.lookup().findVirtual(
* VarHandle.class,
- * VarHandle.AccessMode.{access-mode}.name(),
+ * VarHandle.AccessMode.{access-mode}.methodName(),
* MethodType.methodType(R, p1, p2, ..., pN));
*
* R r = (R) mh.invokeExact(vh, p1, p2, ..., pN)
@@ -993,11 +995,11 @@ public abstract class VarHandle {
Object addAndGet(Object... args);
enum AccessType {
- get, // 0
- set, // 1
- compareAndSwap, // 2
- compareAndExchange, // 3
- getAndUpdate; // 4
+ GET, // 0
+ SET, // 1
+ COMPARE_AND_SWAP, // 2
+ COMPARE_AND_EXCHANGE, // 3
+ GET_AND_UPDATE; // 4
MethodType getMethodType(VarHandle vh) {
return getMethodType(this.ordinal(), vh);
@@ -1036,126 +1038,179 @@ public abstract class VarHandle {
* method
* {@link VarHandle#get VarHandle.get}
*/
- get(AccessType.get, Object.class), // 0
+ GET("get", AccessType.GET, Object.class), // 0
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#set VarHandle.set}
*/
- set(AccessType.set, void.class), // 1
+ SET("set", AccessType.SET, void.class), // 1
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#getVolatile VarHandle.getVolatile}
*/
- getVolatile(AccessType.get, Object.class), // 2
+ GET_VOLATILE("getVolatile", AccessType.GET, Object.class), // 2
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#setVolatile VarHandle.setVolatile}
*/
- setVolatile(AccessType.set, void.class), // 3
+ SET_VOLATILE("setVolatile", AccessType.SET, void.class), // 3
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#getAcquire VarHandle.getAcquire}
*/
- getAcquire(AccessType.get, Object.class), // 4
+ GET_ACQUIRE("getAcquire", AccessType.GET, Object.class), // 4
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#setRelease VarHandle.setRelease}
*/
- setRelease(AccessType.set, void.class), // 5
+ SET_RELEASE("setRelease", AccessType.SET, void.class), // 5
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#getOpaque VarHandle.getOpaque}
*/
- getOpaque(AccessType.get, Object.class), // 6
+ GET_OPAQUE("getOpaque", AccessType.GET, Object.class), // 6
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#setOpaque VarHandle.setOpaque}
*/
- setOpaque(AccessType.set, void.class), // 7
+ SET_OPAQUE("setOpaque", AccessType.SET, void.class), // 7
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#compareAndSet VarHandle.compareAndSet}
*/
- compareAndSet(AccessType.compareAndSwap, boolean.class), // 8
+ COMPARE_AND_SET("compareAndSet", AccessType.COMPARE_AND_SWAP, boolean.class), // 8
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#compareAndExchangeVolatile VarHandle.compareAndExchangeVolatile}
*/
- compareAndExchangeVolatile(AccessType.compareAndExchange, Object.class), // 9
+ COMPARE_AND_EXCHANGE_VOLATILE("compareAndExchangeVolatile", AccessType.COMPARE_AND_EXCHANGE, Object.class), // 9
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#compareAndExchangeAcquire VarHandle.compareAndExchangeAcquire}
*/
- compareAndExchangeAcquire(AccessType.compareAndExchange, Object.class), // 10
+ COMPARE_AND_EXCHANGE_ACQUIRE("compareAndExchangeAcquire", AccessType.COMPARE_AND_EXCHANGE, Object.class), // 10
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#compareAndExchangeRelease VarHandle.compareAndExchangeRelease}
*/
- compareAndExchangeRelease(AccessType.compareAndExchange, Object.class), // 11
+ COMPARE_AND_EXCHANGE_RELEASE("compareAndExchangeRelease", AccessType.COMPARE_AND_EXCHANGE, Object.class), // 11
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#weakCompareAndSet VarHandle.weakCompareAndSet}
*/
- weakCompareAndSet(AccessType.compareAndSwap, boolean.class), // 12
+ WEAK_COMPARE_AND_SET("weakCompareAndSet", AccessType.COMPARE_AND_SWAP, boolean.class), // 12
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#weakCompareAndSetAcquire VarHandle.weakCompareAndSetAcquire}
*/
- weakCompareAndSetAcquire(AccessType.compareAndSwap, boolean.class), // 13
+ WEAK_COMPARE_AND_SET_ACQUIRE("weakCompareAndSetAcquire", AccessType.COMPARE_AND_SWAP, boolean.class), // 13
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#weakCompareAndSetRelease VarHandle.weakCompareAndSetRelease}
*/
- weakCompareAndSetRelease(AccessType.compareAndSwap, boolean.class), // 14
+ WEAK_COMPARE_AND_SET_RELEASE("weakCompareAndSetRelease", AccessType.COMPARE_AND_SWAP, boolean.class), // 14
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#getAndSet VarHandle.getAndSet}
*/
- getAndSet(AccessType.getAndUpdate, Object.class), // 15
+ GET_AND_SET("getAndSet", AccessType.GET_AND_UPDATE, Object.class), // 15
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#getAndAdd VarHandle.getAndAdd}
*/
- getAndAdd(AccessType.getAndUpdate, Object.class), // 16
+ GET_AND_ADD("getAndAdd", AccessType.GET_AND_UPDATE, Object.class), // 16
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#addAndGet VarHandle.addAndGet}
*/
- addAndGet(AccessType.getAndUpdate, Object.class), // 17
+ ADD_AND_GET("addAndGet", AccessType.GET_AND_UPDATE, Object.class), // 17
;
+ static final Map 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);
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleBaseTest.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleBaseTest.java
index e41c2efc123..241d821c00a 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleBaseTest.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleBaseTest.java
@@ -126,33 +126,33 @@ abstract class VarHandleBaseTest {
enum TestAccessType {
- get,
- set,
- compareAndSet,
- compareAndExchange,
- getAndSet,
- getAndAdd;
+ GET,
+ SET,
+ COMPARE_AND_SET,
+ COMPARE_AND_EXCHANGE,
+ GET_AND_SET,
+ GET_AND_ADD;
}
enum TestAccessMode {
- get(TestAccessType.get),
- set(TestAccessType.set),
- getVolatile(TestAccessType.get),
- setVolatile(TestAccessType.set),
- getAcquire(TestAccessType.get),
- setRelease(TestAccessType.set),
- getOpaque(TestAccessType.get),
- setOpaque(TestAccessType.set),
- compareAndSet(TestAccessType.compareAndSet),
- compareAndExchangeVolatile(TestAccessType.compareAndExchange),
- compareAndExchangeAcquire(TestAccessType.compareAndExchange),
- compareAndExchangeRelease(TestAccessType.compareAndExchange),
- weakCompareAndSet(TestAccessType.compareAndSet),
- weakCompareAndSetAcquire(TestAccessType.compareAndSet),
- weakCompareAndSetRelease(TestAccessType.compareAndSet),
- getAndSet(TestAccessType.getAndSet),
- getAndAdd(TestAccessType.getAndAdd),
- addAndGet(TestAccessType.getAndAdd),;
+ GET(TestAccessType.GET),
+ SET(TestAccessType.SET),
+ GET_VOLATILE(TestAccessType.GET),
+ SET_VOLATILE(TestAccessType.SET),
+ GET_ACQUIRE(TestAccessType.GET),
+ SET_RELEASE(TestAccessType.SET),
+ GET_OPAQUE(TestAccessType.GET),
+ SET_OPAQUE(TestAccessType.SET),
+ COMPARE_AND_SET(TestAccessType.COMPARE_AND_SET),
+ COMPARE_AND_EXCHANGE_VOLATILE(TestAccessType.COMPARE_AND_EXCHANGE),
+ COMPARE_AND_EXCHANGE_ACQUIRE(TestAccessType.COMPARE_AND_EXCHANGE),
+ COMPARE_AND_EXCHANGE_RELEASE(TestAccessType.COMPARE_AND_EXCHANGE),
+ WEAK_COMPARE_AND_SET(TestAccessType.COMPARE_AND_SET),
+ WEAK_COMPARE_AND_SET_ACQUIRE(TestAccessType.COMPARE_AND_SET),
+ WEAK_COMPARE_AND_SET_RELEASE(TestAccessType.COMPARE_AND_SET),
+ GET_AND_SET(TestAccessType.GET_AND_SET),
+ GET_AND_ADD(TestAccessType.GET_AND_ADD),
+ ADD_AND_GET(TestAccessType.GET_AND_ADD),;
final TestAccessType at;
final boolean isPolyMorphicInReturnType;
@@ -162,7 +162,8 @@ abstract class VarHandleBaseTest {
this.at = at;
try {
- Method m = VarHandle.class.getMethod(name(), Object[].class);
+ VarHandle.AccessMode vh_am = toAccessMode();
+ Method m = VarHandle.class.getMethod(vh_am.methodName(), Object[].class);
this.returnType = m.getReturnType();
isPolyMorphicInReturnType = returnType != Object.class;
}
@@ -214,7 +215,7 @@ abstract class VarHandleBaseTest {
try {
mh = MethodHandles.publicLookup().
findVirtual(VarHandle.class,
- tam.name(),
+ tam.toAccessMode().methodName(),
mt);
} catch (Exception e) {
throw new RuntimeException(e);
@@ -441,33 +442,33 @@ abstract class VarHandleBaseTest {
assertEquals(amt.parameterList().subList(0, pts.size()), pts);
}
- for (TestAccessMode testAccessMode : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode testAccessMode : testAccessModesOfType(TestAccessType.GET)) {
MethodType mt = vh.accessModeType(testAccessMode.toAccessMode());
assertEquals(mt.returnType(), vh.varType());
assertEquals(mt.parameterList(), pts);
}
- for (TestAccessMode testAccessMode : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode testAccessMode : testAccessModesOfType(TestAccessType.SET)) {
MethodType mt = vh.accessModeType(testAccessMode.toAccessMode());
assertEquals(mt.returnType(), void.class);
assertEquals(mt.parameterType(mt.parameterCount() - 1), vh.varType());
}
- for (TestAccessMode testAccessMode : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode testAccessMode : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
MethodType mt = vh.accessModeType(testAccessMode.toAccessMode());
assertEquals(mt.returnType(), boolean.class);
assertEquals(mt.parameterType(mt.parameterCount() - 1), vh.varType());
assertEquals(mt.parameterType(mt.parameterCount() - 2), vh.varType());
}
- for (TestAccessMode testAccessMode : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode testAccessMode : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
MethodType mt = vh.accessModeType(testAccessMode.toAccessMode());
assertEquals(mt.returnType(), vh.varType());
assertEquals(mt.parameterType(mt.parameterCount() - 1), vh.varType());
assertEquals(mt.parameterType(mt.parameterCount() - 2), vh.varType());
}
- for (TestAccessMode testAccessMode : testAccessModesOfType(TestAccessType.getAndSet, TestAccessType.getAndAdd)) {
+ for (TestAccessMode testAccessMode : testAccessModesOfType(TestAccessType.GET_AND_SET, TestAccessType.GET_AND_ADD)) {
MethodType mt = vh.accessModeType(testAccessMode.toAccessMode());
assertEquals(mt.returnType(), vh.varType());
assertEquals(mt.parameterType(mt.parameterCount() - 1), vh.varType());
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java
index 4a315a8a1c2..5590984e493 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java
@@ -90,27 +90,27 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
@Test(dataProvider = "varHandlesProvider")
public void testIsAccessModeSupported(VarHandle vh) {
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.get));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.set));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getOpaque));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setOpaque));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
}
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java
index 8fa89891ad5..f9c9d4fc31e 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java
@@ -90,27 +90,27 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
@Test(dataProvider = "varHandlesProvider")
public void testIsAccessModeSupported(VarHandle vh) {
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.get));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.set));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getOpaque));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setOpaque));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
}
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java
index ab1a997ecad..bd1174efc5a 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java
@@ -90,27 +90,27 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
@Test(dataProvider = "varHandlesProvider")
public void testIsAccessModeSupported(VarHandle vh) {
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.get));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.set));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getOpaque));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setOpaque));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
}
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java
index d4c9ee27265..d8732d239b4 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java
@@ -90,27 +90,27 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
@Test(dataProvider = "varHandlesProvider")
public void testIsAccessModeSupported(VarHandle vh) {
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.get));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.set));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getOpaque));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setOpaque));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
}
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java
index 5970fe2de33..9976102d027 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java
@@ -90,27 +90,27 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
@Test(dataProvider = "varHandlesProvider")
public void testIsAccessModeSupported(VarHandle vh) {
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.get));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.set));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getOpaque));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setOpaque));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
}
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java
index 5ed6480d62a..c78e5cb7199 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java
@@ -90,27 +90,27 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
@Test(dataProvider = "varHandlesProvider")
public void testIsAccessModeSupported(VarHandle vh) {
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.get));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.set));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getOpaque));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setOpaque));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
}
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java
index 6d84211ea10..f82ee67960e 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java
@@ -90,27 +90,27 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
@Test(dataProvider = "varHandlesProvider")
public void testIsAccessModeSupported(VarHandle vh) {
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.get));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.set));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getOpaque));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setOpaque));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
}
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java
index ac9dfd5587b..d235e03a7bf 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java
@@ -90,27 +90,27 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
@Test(dataProvider = "varHandlesProvider")
public void testIsAccessModeSupported(VarHandle vh) {
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.get));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.set));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getOpaque));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setOpaque));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
}
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessString.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessString.java
index ac01cd467a7..61e3690447c 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessString.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessString.java
@@ -90,27 +90,27 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
@Test(dataProvider = "varHandlesProvider")
public void testIsAccessModeSupported(VarHandle vh) {
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.get));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.set));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getOpaque));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setOpaque));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
}
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java
index ba099920ea6..e6941f5fa3c 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java
@@ -76,28 +76,28 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest {
public void testIsAccessModeSupported(VarHandleSource vhs) {
VarHandle vh = vhs.s;
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.get));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.set));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getOpaque));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setOpaque));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
}
@Test(dataProvider = "typesProvider")
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java
index 794e82226d6..ec4b843b2aa 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java
@@ -76,28 +76,28 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest {
public void testIsAccessModeSupported(VarHandleSource vhs) {
VarHandle vh = vhs.s;
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.get));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.set));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getOpaque));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setOpaque));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
}
@Test(dataProvider = "typesProvider")
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java
index 090796f77e8..57d37cbe523 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java
@@ -76,28 +76,28 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest {
public void testIsAccessModeSupported(VarHandleSource vhs) {
VarHandle vh = vhs.s;
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.get));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.set));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getOpaque));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setOpaque));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
}
@Test(dataProvider = "typesProvider")
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java
index c9764200d41..ae66477d3b6 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java
@@ -76,28 +76,28 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
public void testIsAccessModeSupported(VarHandleSource vhs) {
VarHandle vh = vhs.s;
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.get));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.set));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getOpaque));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setOpaque));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
}
@Test(dataProvider = "typesProvider")
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java
index 3f97979737a..ac08db2af5c 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java
@@ -76,28 +76,28 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest {
public void testIsAccessModeSupported(VarHandleSource vhs) {
VarHandle vh = vhs.s;
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.get));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.set));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getOpaque));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setOpaque));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
}
@Test(dataProvider = "typesProvider")
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java
index d7ea851b8c8..9742fbd2522 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java
@@ -76,28 +76,28 @@ public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest {
public void testIsAccessModeSupported(VarHandleSource vhs) {
VarHandle vh = vhs.s;
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.get));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.set));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getOpaque));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setOpaque));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
}
@Test(dataProvider = "typesProvider")
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessBoolean.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessBoolean.java
index 2bde4da9a70..32761fe0e3f 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessBoolean.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessBoolean.java
@@ -121,30 +121,30 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
static void testInstanceField(VarHandleTestMethodHandleAccessBoolean recv, Handles hs) throws Throwable {
// Plain
{
- hs.get(TestAccessMode.set).invokeExact(recv, true);
- boolean x = (boolean) hs.get(TestAccessMode.get).invokeExact(recv);
+ hs.get(TestAccessMode.SET).invokeExact(recv, true);
+ boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, true, "set boolean value");
}
// Volatile
{
- hs.get(TestAccessMode.setVolatile).invokeExact(recv, false);
- boolean x = (boolean) hs.get(TestAccessMode.getVolatile).invokeExact(recv);
+ hs.get(TestAccessMode.SET_VOLATILE).invokeExact(recv, false);
+ boolean x = (boolean) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(recv);
assertEquals(x, false, "setVolatile boolean value");
}
// Lazy
{
- hs.get(TestAccessMode.setRelease).invokeExact(recv, true);
- boolean x = (boolean) hs.get(TestAccessMode.getAcquire).invokeExact(recv);
+ hs.get(TestAccessMode.SET_RELEASE).invokeExact(recv, true);
+ boolean x = (boolean) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(recv);
assertEquals(x, true, "setRelease boolean value");
}
// Opaque
{
- hs.get(TestAccessMode.setOpaque).invokeExact(recv, false);
- boolean x = (boolean) hs.get(TestAccessMode.getOpaque).invokeExact(recv);
+ hs.get(TestAccessMode.SET_OPAQUE).invokeExact(recv, false);
+ boolean x = (boolean) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(recv);
assertEquals(x, false, "setOpaque boolean value");
}
@@ -152,25 +152,25 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
}
static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessBoolean recv, Handles hs) throws Throwable {
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
checkUOE(am, () -> {
boolean r = (boolean) hs.get(am).invokeExact(recv, true, false);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkUOE(am, () -> {
boolean r = (boolean) hs.get(am).invokeExact(recv, true, false);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkUOE(am, () -> {
boolean r = (boolean) hs.get(am).invokeExact(recv, true);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkUOE(am, () -> {
boolean r = (boolean) hs.get(am).invokeExact(recv, true);
});
@@ -181,30 +181,30 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
static void testStaticField(Handles hs) throws Throwable {
// Plain
{
- hs.get(TestAccessMode.set).invokeExact(true);
- boolean x = (boolean) hs.get(TestAccessMode.get).invokeExact();
+ hs.get(TestAccessMode.SET).invokeExact(true);
+ boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, true, "set boolean value");
}
// Volatile
{
- hs.get(TestAccessMode.setVolatile).invokeExact(false);
- boolean x = (boolean) hs.get(TestAccessMode.getVolatile).invokeExact();
+ hs.get(TestAccessMode.SET_VOLATILE).invokeExact(false);
+ boolean x = (boolean) hs.get(TestAccessMode.GET_VOLATILE).invokeExact();
assertEquals(x, false, "setVolatile boolean value");
}
// Lazy
{
- hs.get(TestAccessMode.setRelease).invokeExact(true);
- boolean x = (boolean) hs.get(TestAccessMode.getAcquire).invokeExact();
+ hs.get(TestAccessMode.SET_RELEASE).invokeExact(true);
+ boolean x = (boolean) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact();
assertEquals(x, true, "setRelease boolean value");
}
// Opaque
{
- hs.get(TestAccessMode.setOpaque).invokeExact(false);
- boolean x = (boolean) hs.get(TestAccessMode.getOpaque).invokeExact();
+ hs.get(TestAccessMode.SET_OPAQUE).invokeExact(false);
+ boolean x = (boolean) hs.get(TestAccessMode.GET_OPAQUE).invokeExact();
assertEquals(x, false, "setOpaque boolean value");
}
@@ -212,25 +212,25 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
}
static void testStaticFieldUnsupported(Handles hs) throws Throwable {
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
checkUOE(am, () -> {
boolean r = (boolean) hs.get(am).invokeExact(true, false);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkUOE(am, () -> {
boolean r = (boolean) hs.get(am).invokeExact(true, false);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkUOE(am, () -> {
boolean r = (boolean) hs.get(am).invokeExact(true);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkUOE(am, () -> {
boolean r = (boolean) hs.get(am).invokeExact(true);
});
@@ -244,30 +244,30 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
for (int i = 0; i < array.length; i++) {
// Plain
{
- hs.get(TestAccessMode.set).invokeExact(array, i, true);
- boolean x = (boolean) hs.get(TestAccessMode.get).invokeExact(array, i);
+ hs.get(TestAccessMode.SET).invokeExact(array, i, true);
+ boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, true, "get boolean value");
}
// Volatile
{
- hs.get(TestAccessMode.setVolatile).invokeExact(array, i, false);
- boolean x = (boolean) hs.get(TestAccessMode.getVolatile).invokeExact(array, i);
+ hs.get(TestAccessMode.SET_VOLATILE).invokeExact(array, i, false);
+ boolean x = (boolean) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(array, i);
assertEquals(x, false, "setVolatile boolean value");
}
// Lazy
{
- hs.get(TestAccessMode.setRelease).invokeExact(array, i, true);
- boolean x = (boolean) hs.get(TestAccessMode.getAcquire).invokeExact(array, i);
+ hs.get(TestAccessMode.SET_RELEASE).invokeExact(array, i, true);
+ boolean x = (boolean) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(array, i);
assertEquals(x, true, "setRelease boolean value");
}
// Opaque
{
- hs.get(TestAccessMode.setOpaque).invokeExact(array, i, false);
- boolean x = (boolean) hs.get(TestAccessMode.getOpaque).invokeExact(array, i);
+ hs.get(TestAccessMode.SET_OPAQUE).invokeExact(array, i, false);
+ boolean x = (boolean) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(array, i);
assertEquals(x, false, "setOpaque boolean value");
}
@@ -279,25 +279,25 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
boolean[] array = new boolean[10];
final int i = 0;
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
checkUOE(am, () -> {
boolean r = (boolean) hs.get(am).invokeExact(array, i, true, false);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkUOE(am, () -> {
boolean r = (boolean) hs.get(am).invokeExact(array, i, true, false);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkUOE(am, () -> {
boolean r = (boolean) hs.get(am).invokeExact(array, i, true);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkUOE(am, () -> {
boolean o = (boolean) hs.get(am).invokeExact(array, i, true);
});
@@ -310,13 +310,13 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
for (int i : new int[]{-1, Integer.MIN_VALUE, 10, 11, Integer.MAX_VALUE}) {
final int ci = i;
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
checkIOOBE(am, () -> {
boolean x = (boolean) hs.get(am).invokeExact(array, ci);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
checkIOOBE(am, () -> {
hs.get(am).invokeExact(array, ci, true);
});
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessByte.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessByte.java
index a994faff5b2..8c36eb861c5 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessByte.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessByte.java
@@ -121,30 +121,30 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
static void testInstanceField(VarHandleTestMethodHandleAccessByte recv, Handles hs) throws Throwable {
// Plain
{
- hs.get(TestAccessMode.set).invokeExact(recv, (byte)1);
- byte x = (byte) hs.get(TestAccessMode.get).invokeExact(recv);
+ hs.get(TestAccessMode.SET).invokeExact(recv, (byte)1);
+ byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, (byte)1, "set byte value");
}
// Volatile
{
- hs.get(TestAccessMode.setVolatile).invokeExact(recv, (byte)2);
- byte x = (byte) hs.get(TestAccessMode.getVolatile).invokeExact(recv);
+ hs.get(TestAccessMode.SET_VOLATILE).invokeExact(recv, (byte)2);
+ byte x = (byte) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(recv);
assertEquals(x, (byte)2, "setVolatile byte value");
}
// Lazy
{
- hs.get(TestAccessMode.setRelease).invokeExact(recv, (byte)1);
- byte x = (byte) hs.get(TestAccessMode.getAcquire).invokeExact(recv);
+ hs.get(TestAccessMode.SET_RELEASE).invokeExact(recv, (byte)1);
+ byte x = (byte) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(recv);
assertEquals(x, (byte)1, "setRelease byte value");
}
// Opaque
{
- hs.get(TestAccessMode.setOpaque).invokeExact(recv, (byte)2);
- byte x = (byte) hs.get(TestAccessMode.getOpaque).invokeExact(recv);
+ hs.get(TestAccessMode.SET_OPAQUE).invokeExact(recv, (byte)2);
+ byte x = (byte) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(recv);
assertEquals(x, (byte)2, "setOpaque byte value");
}
@@ -152,25 +152,25 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
}
static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessByte recv, Handles hs) throws Throwable {
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
checkUOE(am, () -> {
boolean r = (boolean) hs.get(am).invokeExact(recv, (byte)1, (byte)2);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkUOE(am, () -> {
byte r = (byte) hs.get(am).invokeExact(recv, (byte)1, (byte)2);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkUOE(am, () -> {
byte r = (byte) hs.get(am).invokeExact(recv, (byte)1);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkUOE(am, () -> {
byte r = (byte) hs.get(am).invokeExact(recv, (byte)1);
});
@@ -181,30 +181,30 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
static void testStaticField(Handles hs) throws Throwable {
// Plain
{
- hs.get(TestAccessMode.set).invokeExact((byte)1);
- byte x = (byte) hs.get(TestAccessMode.get).invokeExact();
+ hs.get(TestAccessMode.SET).invokeExact((byte)1);
+ byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, (byte)1, "set byte value");
}
// Volatile
{
- hs.get(TestAccessMode.setVolatile).invokeExact((byte)2);
- byte x = (byte) hs.get(TestAccessMode.getVolatile).invokeExact();
+ hs.get(TestAccessMode.SET_VOLATILE).invokeExact((byte)2);
+ byte x = (byte) hs.get(TestAccessMode.GET_VOLATILE).invokeExact();
assertEquals(x, (byte)2, "setVolatile byte value");
}
// Lazy
{
- hs.get(TestAccessMode.setRelease).invokeExact((byte)1);
- byte x = (byte) hs.get(TestAccessMode.getAcquire).invokeExact();
+ hs.get(TestAccessMode.SET_RELEASE).invokeExact((byte)1);
+ byte x = (byte) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact();
assertEquals(x, (byte)1, "setRelease byte value");
}
// Opaque
{
- hs.get(TestAccessMode.setOpaque).invokeExact((byte)2);
- byte x = (byte) hs.get(TestAccessMode.getOpaque).invokeExact();
+ hs.get(TestAccessMode.SET_OPAQUE).invokeExact((byte)2);
+ byte x = (byte) hs.get(TestAccessMode.GET_OPAQUE).invokeExact();
assertEquals(x, (byte)2, "setOpaque byte value");
}
@@ -212,25 +212,25 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
}
static void testStaticFieldUnsupported(Handles hs) throws Throwable {
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
checkUOE(am, () -> {
boolean r = (boolean) hs.get(am).invokeExact((byte)1, (byte)2);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkUOE(am, () -> {
byte r = (byte) hs.get(am).invokeExact((byte)1, (byte)2);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkUOE(am, () -> {
byte r = (byte) hs.get(am).invokeExact((byte)1);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkUOE(am, () -> {
byte r = (byte) hs.get(am).invokeExact((byte)1);
});
@@ -244,30 +244,30 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
for (int i = 0; i < array.length; i++) {
// Plain
{
- hs.get(TestAccessMode.set).invokeExact(array, i, (byte)1);
- byte x = (byte) hs.get(TestAccessMode.get).invokeExact(array, i);
+ hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)1);
+ byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, (byte)1, "get byte value");
}
// Volatile
{
- hs.get(TestAccessMode.setVolatile).invokeExact(array, i, (byte)2);
- byte x = (byte) hs.get(TestAccessMode.getVolatile).invokeExact(array, i);
+ hs.get(TestAccessMode.SET_VOLATILE).invokeExact(array, i, (byte)2);
+ byte x = (byte) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(array, i);
assertEquals(x, (byte)2, "setVolatile byte value");
}
// Lazy
{
- hs.get(TestAccessMode.setRelease).invokeExact(array, i, (byte)1);
- byte x = (byte) hs.get(TestAccessMode.getAcquire).invokeExact(array, i);
+ hs.get(TestAccessMode.SET_RELEASE).invokeExact(array, i, (byte)1);
+ byte x = (byte) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(array, i);
assertEquals(x, (byte)1, "setRelease byte value");
}
// Opaque
{
- hs.get(TestAccessMode.setOpaque).invokeExact(array, i, (byte)2);
- byte x = (byte) hs.get(TestAccessMode.getOpaque).invokeExact(array, i);
+ hs.get(TestAccessMode.SET_OPAQUE).invokeExact(array, i, (byte)2);
+ byte x = (byte) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(array, i);
assertEquals(x, (byte)2, "setOpaque byte value");
}
@@ -279,25 +279,25 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
byte[] array = new byte[10];
final int i = 0;
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
checkUOE(am, () -> {
boolean r = (boolean) hs.get(am).invokeExact(array, i, (byte)1, (byte)2);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkUOE(am, () -> {
byte r = (byte) hs.get(am).invokeExact(array, i, (byte)1, (byte)2);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkUOE(am, () -> {
byte r = (byte) hs.get(am).invokeExact(array, i, (byte)1);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkUOE(am, () -> {
byte o = (byte) hs.get(am).invokeExact(array, i, (byte)1);
});
@@ -310,13 +310,13 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
for (int i : new int[]{-1, Integer.MIN_VALUE, 10, 11, Integer.MAX_VALUE}) {
final int ci = i;
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
checkIOOBE(am, () -> {
byte x = (byte) hs.get(am).invokeExact(array, ci);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
checkIOOBE(am, () -> {
hs.get(am).invokeExact(array, ci, (byte)1);
});
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessChar.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessChar.java
index 7e40ed00c65..fb1f3877342 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessChar.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessChar.java
@@ -121,30 +121,30 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
static void testInstanceField(VarHandleTestMethodHandleAccessChar recv, Handles hs) throws Throwable {
// Plain
{
- hs.get(TestAccessMode.set).invokeExact(recv, 'a');
- char x = (char) hs.get(TestAccessMode.get).invokeExact(recv);
+ hs.get(TestAccessMode.SET).invokeExact(recv, 'a');
+ char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 'a', "set char value");
}
// Volatile
{
- hs.get(TestAccessMode.setVolatile).invokeExact(recv, 'b');
- char x = (char) hs.get(TestAccessMode.getVolatile).invokeExact(recv);
+ hs.get(TestAccessMode.SET_VOLATILE).invokeExact(recv, 'b');
+ char x = (char) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(recv);
assertEquals(x, 'b', "setVolatile char value");
}
// Lazy
{
- hs.get(TestAccessMode.setRelease).invokeExact(recv, 'a');
- char x = (char) hs.get(TestAccessMode.getAcquire).invokeExact(recv);
+ hs.get(TestAccessMode.SET_RELEASE).invokeExact(recv, 'a');
+ char x = (char) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(recv);
assertEquals(x, 'a', "setRelease char value");
}
// Opaque
{
- hs.get(TestAccessMode.setOpaque).invokeExact(recv, 'b');
- char x = (char) hs.get(TestAccessMode.getOpaque).invokeExact(recv);
+ hs.get(TestAccessMode.SET_OPAQUE).invokeExact(recv, 'b');
+ char x = (char) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(recv);
assertEquals(x, 'b', "setOpaque char value");
}
@@ -152,25 +152,25 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
}
static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessChar recv, Handles hs) throws Throwable {
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
checkUOE(am, () -> {
boolean r = (boolean) hs.get(am).invokeExact(recv, 'a', 'b');
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkUOE(am, () -> {
char r = (char) hs.get(am).invokeExact(recv, 'a', 'b');
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkUOE(am, () -> {
char r = (char) hs.get(am).invokeExact(recv, 'a');
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkUOE(am, () -> {
char r = (char) hs.get(am).invokeExact(recv, 'a');
});
@@ -181,30 +181,30 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
static void testStaticField(Handles hs) throws Throwable {
// Plain
{
- hs.get(TestAccessMode.set).invokeExact('a');
- char x = (char) hs.get(TestAccessMode.get).invokeExact();
+ hs.get(TestAccessMode.SET).invokeExact('a');
+ char x = (char) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 'a', "set char value");
}
// Volatile
{
- hs.get(TestAccessMode.setVolatile).invokeExact('b');
- char x = (char) hs.get(TestAccessMode.getVolatile).invokeExact();
+ hs.get(TestAccessMode.SET_VOLATILE).invokeExact('b');
+ char x = (char) hs.get(TestAccessMode.GET_VOLATILE).invokeExact();
assertEquals(x, 'b', "setVolatile char value");
}
// Lazy
{
- hs.get(TestAccessMode.setRelease).invokeExact('a');
- char x = (char) hs.get(TestAccessMode.getAcquire).invokeExact();
+ hs.get(TestAccessMode.SET_RELEASE).invokeExact('a');
+ char x = (char) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact();
assertEquals(x, 'a', "setRelease char value");
}
// Opaque
{
- hs.get(TestAccessMode.setOpaque).invokeExact('b');
- char x = (char) hs.get(TestAccessMode.getOpaque).invokeExact();
+ hs.get(TestAccessMode.SET_OPAQUE).invokeExact('b');
+ char x = (char) hs.get(TestAccessMode.GET_OPAQUE).invokeExact();
assertEquals(x, 'b', "setOpaque char value");
}
@@ -212,25 +212,25 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
}
static void testStaticFieldUnsupported(Handles hs) throws Throwable {
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
checkUOE(am, () -> {
boolean r = (boolean) hs.get(am).invokeExact('a', 'b');
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkUOE(am, () -> {
char r = (char) hs.get(am).invokeExact('a', 'b');
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkUOE(am, () -> {
char r = (char) hs.get(am).invokeExact('a');
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkUOE(am, () -> {
char r = (char) hs.get(am).invokeExact('a');
});
@@ -244,30 +244,30 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
for (int i = 0; i < array.length; i++) {
// Plain
{
- hs.get(TestAccessMode.set).invokeExact(array, i, 'a');
- char x = (char) hs.get(TestAccessMode.get).invokeExact(array, i);
+ hs.get(TestAccessMode.SET).invokeExact(array, i, 'a');
+ char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 'a', "get char value");
}
// Volatile
{
- hs.get(TestAccessMode.setVolatile).invokeExact(array, i, 'b');
- char x = (char) hs.get(TestAccessMode.getVolatile).invokeExact(array, i);
+ hs.get(TestAccessMode.SET_VOLATILE).invokeExact(array, i, 'b');
+ char x = (char) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(array, i);
assertEquals(x, 'b', "setVolatile char value");
}
// Lazy
{
- hs.get(TestAccessMode.setRelease).invokeExact(array, i, 'a');
- char x = (char) hs.get(TestAccessMode.getAcquire).invokeExact(array, i);
+ hs.get(TestAccessMode.SET_RELEASE).invokeExact(array, i, 'a');
+ char x = (char) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(array, i);
assertEquals(x, 'a', "setRelease char value");
}
// Opaque
{
- hs.get(TestAccessMode.setOpaque).invokeExact(array, i, 'b');
- char x = (char) hs.get(TestAccessMode.getOpaque).invokeExact(array, i);
+ hs.get(TestAccessMode.SET_OPAQUE).invokeExact(array, i, 'b');
+ char x = (char) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(array, i);
assertEquals(x, 'b', "setOpaque char value");
}
@@ -279,25 +279,25 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
char[] array = new char[10];
final int i = 0;
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
checkUOE(am, () -> {
boolean r = (boolean) hs.get(am).invokeExact(array, i, 'a', 'b');
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkUOE(am, () -> {
char r = (char) hs.get(am).invokeExact(array, i, 'a', 'b');
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkUOE(am, () -> {
char r = (char) hs.get(am).invokeExact(array, i, 'a');
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkUOE(am, () -> {
char o = (char) hs.get(am).invokeExact(array, i, 'a');
});
@@ -310,13 +310,13 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
for (int i : new int[]{-1, Integer.MIN_VALUE, 10, 11, Integer.MAX_VALUE}) {
final int ci = i;
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
checkIOOBE(am, () -> {
char x = (char) hs.get(am).invokeExact(array, ci);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
checkIOOBE(am, () -> {
hs.get(am).invokeExact(array, ci, 'a');
});
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessDouble.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessDouble.java
index 20927000f1e..cd2c15d04d3 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessDouble.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessDouble.java
@@ -121,30 +121,30 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
static void testInstanceField(VarHandleTestMethodHandleAccessDouble recv, Handles hs) throws Throwable {
// Plain
{
- hs.get(TestAccessMode.set).invokeExact(recv, 1.0d);
- double x = (double) hs.get(TestAccessMode.get).invokeExact(recv);
+ hs.get(TestAccessMode.SET).invokeExact(recv, 1.0d);
+ double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 1.0d, "set double value");
}
// Volatile
{
- hs.get(TestAccessMode.setVolatile).invokeExact(recv, 2.0d);
- double x = (double) hs.get(TestAccessMode.getVolatile).invokeExact(recv);
+ hs.get(TestAccessMode.SET_VOLATILE).invokeExact(recv, 2.0d);
+ double x = (double) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(recv);
assertEquals(x, 2.0d, "setVolatile double value");
}
// Lazy
{
- hs.get(TestAccessMode.setRelease).invokeExact(recv, 1.0d);
- double x = (double) hs.get(TestAccessMode.getAcquire).invokeExact(recv);
+ hs.get(TestAccessMode.SET_RELEASE).invokeExact(recv, 1.0d);
+ double x = (double) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(recv);
assertEquals(x, 1.0d, "setRelease double value");
}
// Opaque
{
- hs.get(TestAccessMode.setOpaque).invokeExact(recv, 2.0d);
- double x = (double) hs.get(TestAccessMode.getOpaque).invokeExact(recv);
+ hs.get(TestAccessMode.SET_OPAQUE).invokeExact(recv, 2.0d);
+ double x = (double) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(recv);
assertEquals(x, 2.0d, "setOpaque double value");
}
@@ -152,25 +152,25 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
}
static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessDouble recv, Handles hs) throws Throwable {
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
checkUOE(am, () -> {
boolean r = (boolean) hs.get(am).invokeExact(recv, 1.0d, 2.0d);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkUOE(am, () -> {
double r = (double) hs.get(am).invokeExact(recv, 1.0d, 2.0d);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkUOE(am, () -> {
double r = (double) hs.get(am).invokeExact(recv, 1.0d);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkUOE(am, () -> {
double r = (double) hs.get(am).invokeExact(recv, 1.0d);
});
@@ -181,30 +181,30 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
static void testStaticField(Handles hs) throws Throwable {
// Plain
{
- hs.get(TestAccessMode.set).invokeExact(1.0d);
- double x = (double) hs.get(TestAccessMode.get).invokeExact();
+ hs.get(TestAccessMode.SET).invokeExact(1.0d);
+ double x = (double) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 1.0d, "set double value");
}
// Volatile
{
- hs.get(TestAccessMode.setVolatile).invokeExact(2.0d);
- double x = (double) hs.get(TestAccessMode.getVolatile).invokeExact();
+ hs.get(TestAccessMode.SET_VOLATILE).invokeExact(2.0d);
+ double x = (double) hs.get(TestAccessMode.GET_VOLATILE).invokeExact();
assertEquals(x, 2.0d, "setVolatile double value");
}
// Lazy
{
- hs.get(TestAccessMode.setRelease).invokeExact(1.0d);
- double x = (double) hs.get(TestAccessMode.getAcquire).invokeExact();
+ hs.get(TestAccessMode.SET_RELEASE).invokeExact(1.0d);
+ double x = (double) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact();
assertEquals(x, 1.0d, "setRelease double value");
}
// Opaque
{
- hs.get(TestAccessMode.setOpaque).invokeExact(2.0d);
- double x = (double) hs.get(TestAccessMode.getOpaque).invokeExact();
+ hs.get(TestAccessMode.SET_OPAQUE).invokeExact(2.0d);
+ double x = (double) hs.get(TestAccessMode.GET_OPAQUE).invokeExact();
assertEquals(x, 2.0d, "setOpaque double value");
}
@@ -212,25 +212,25 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
}
static void testStaticFieldUnsupported(Handles hs) throws Throwable {
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
checkUOE(am, () -> {
boolean r = (boolean) hs.get(am).invokeExact(1.0d, 2.0d);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkUOE(am, () -> {
double r = (double) hs.get(am).invokeExact(1.0d, 2.0d);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkUOE(am, () -> {
double r = (double) hs.get(am).invokeExact(1.0d);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkUOE(am, () -> {
double r = (double) hs.get(am).invokeExact(1.0d);
});
@@ -244,30 +244,30 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
for (int i = 0; i < array.length; i++) {
// Plain
{
- hs.get(TestAccessMode.set).invokeExact(array, i, 1.0d);
- double x = (double) hs.get(TestAccessMode.get).invokeExact(array, i);
+ hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0d);
+ double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 1.0d, "get double value");
}
// Volatile
{
- hs.get(TestAccessMode.setVolatile).invokeExact(array, i, 2.0d);
- double x = (double) hs.get(TestAccessMode.getVolatile).invokeExact(array, i);
+ hs.get(TestAccessMode.SET_VOLATILE).invokeExact(array, i, 2.0d);
+ double x = (double) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(array, i);
assertEquals(x, 2.0d, "setVolatile double value");
}
// Lazy
{
- hs.get(TestAccessMode.setRelease).invokeExact(array, i, 1.0d);
- double x = (double) hs.get(TestAccessMode.getAcquire).invokeExact(array, i);
+ hs.get(TestAccessMode.SET_RELEASE).invokeExact(array, i, 1.0d);
+ double x = (double) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(array, i);
assertEquals(x, 1.0d, "setRelease double value");
}
// Opaque
{
- hs.get(TestAccessMode.setOpaque).invokeExact(array, i, 2.0d);
- double x = (double) hs.get(TestAccessMode.getOpaque).invokeExact(array, i);
+ hs.get(TestAccessMode.SET_OPAQUE).invokeExact(array, i, 2.0d);
+ double x = (double) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(array, i);
assertEquals(x, 2.0d, "setOpaque double value");
}
@@ -279,25 +279,25 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
double[] array = new double[10];
final int i = 0;
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
checkUOE(am, () -> {
boolean r = (boolean) hs.get(am).invokeExact(array, i, 1.0d, 2.0d);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkUOE(am, () -> {
double r = (double) hs.get(am).invokeExact(array, i, 1.0d, 2.0d);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkUOE(am, () -> {
double r = (double) hs.get(am).invokeExact(array, i, 1.0d);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkUOE(am, () -> {
double o = (double) hs.get(am).invokeExact(array, i, 1.0d);
});
@@ -310,13 +310,13 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
for (int i : new int[]{-1, Integer.MIN_VALUE, 10, 11, Integer.MAX_VALUE}) {
final int ci = i;
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
checkIOOBE(am, () -> {
double x = (double) hs.get(am).invokeExact(array, ci);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
checkIOOBE(am, () -> {
hs.get(am).invokeExact(array, ci, 1.0d);
});
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessFloat.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessFloat.java
index 7ca74923cef..58d9e295298 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessFloat.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessFloat.java
@@ -121,30 +121,30 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
static void testInstanceField(VarHandleTestMethodHandleAccessFloat recv, Handles hs) throws Throwable {
// Plain
{
- hs.get(TestAccessMode.set).invokeExact(recv, 1.0f);
- float x = (float) hs.get(TestAccessMode.get).invokeExact(recv);
+ hs.get(TestAccessMode.SET).invokeExact(recv, 1.0f);
+ float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 1.0f, "set float value");
}
// Volatile
{
- hs.get(TestAccessMode.setVolatile).invokeExact(recv, 2.0f);
- float x = (float) hs.get(TestAccessMode.getVolatile).invokeExact(recv);
+ hs.get(TestAccessMode.SET_VOLATILE).invokeExact(recv, 2.0f);
+ float x = (float) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(recv);
assertEquals(x, 2.0f, "setVolatile float value");
}
// Lazy
{
- hs.get(TestAccessMode.setRelease).invokeExact(recv, 1.0f);
- float x = (float) hs.get(TestAccessMode.getAcquire).invokeExact(recv);
+ hs.get(TestAccessMode.SET_RELEASE).invokeExact(recv, 1.0f);
+ float x = (float) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(recv);
assertEquals(x, 1.0f, "setRelease float value");
}
// Opaque
{
- hs.get(TestAccessMode.setOpaque).invokeExact(recv, 2.0f);
- float x = (float) hs.get(TestAccessMode.getOpaque).invokeExact(recv);
+ hs.get(TestAccessMode.SET_OPAQUE).invokeExact(recv, 2.0f);
+ float x = (float) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(recv);
assertEquals(x, 2.0f, "setOpaque float value");
}
@@ -152,25 +152,25 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
}
static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessFloat recv, Handles hs) throws Throwable {
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
checkUOE(am, () -> {
boolean r = (boolean) hs.get(am).invokeExact(recv, 1.0f, 2.0f);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkUOE(am, () -> {
float r = (float) hs.get(am).invokeExact(recv, 1.0f, 2.0f);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkUOE(am, () -> {
float r = (float) hs.get(am).invokeExact(recv, 1.0f);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkUOE(am, () -> {
float r = (float) hs.get(am).invokeExact(recv, 1.0f);
});
@@ -181,30 +181,30 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
static void testStaticField(Handles hs) throws Throwable {
// Plain
{
- hs.get(TestAccessMode.set).invokeExact(1.0f);
- float x = (float) hs.get(TestAccessMode.get).invokeExact();
+ hs.get(TestAccessMode.SET).invokeExact(1.0f);
+ float x = (float) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 1.0f, "set float value");
}
// Volatile
{
- hs.get(TestAccessMode.setVolatile).invokeExact(2.0f);
- float x = (float) hs.get(TestAccessMode.getVolatile).invokeExact();
+ hs.get(TestAccessMode.SET_VOLATILE).invokeExact(2.0f);
+ float x = (float) hs.get(TestAccessMode.GET_VOLATILE).invokeExact();
assertEquals(x, 2.0f, "setVolatile float value");
}
// Lazy
{
- hs.get(TestAccessMode.setRelease).invokeExact(1.0f);
- float x = (float) hs.get(TestAccessMode.getAcquire).invokeExact();
+ hs.get(TestAccessMode.SET_RELEASE).invokeExact(1.0f);
+ float x = (float) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact();
assertEquals(x, 1.0f, "setRelease float value");
}
// Opaque
{
- hs.get(TestAccessMode.setOpaque).invokeExact(2.0f);
- float x = (float) hs.get(TestAccessMode.getOpaque).invokeExact();
+ hs.get(TestAccessMode.SET_OPAQUE).invokeExact(2.0f);
+ float x = (float) hs.get(TestAccessMode.GET_OPAQUE).invokeExact();
assertEquals(x, 2.0f, "setOpaque float value");
}
@@ -212,25 +212,25 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
}
static void testStaticFieldUnsupported(Handles hs) throws Throwable {
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
checkUOE(am, () -> {
boolean r = (boolean) hs.get(am).invokeExact(1.0f, 2.0f);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkUOE(am, () -> {
float r = (float) hs.get(am).invokeExact(1.0f, 2.0f);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkUOE(am, () -> {
float r = (float) hs.get(am).invokeExact(1.0f);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkUOE(am, () -> {
float r = (float) hs.get(am).invokeExact(1.0f);
});
@@ -244,30 +244,30 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
for (int i = 0; i < array.length; i++) {
// Plain
{
- hs.get(TestAccessMode.set).invokeExact(array, i, 1.0f);
- float x = (float) hs.get(TestAccessMode.get).invokeExact(array, i);
+ hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0f);
+ float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 1.0f, "get float value");
}
// Volatile
{
- hs.get(TestAccessMode.setVolatile).invokeExact(array, i, 2.0f);
- float x = (float) hs.get(TestAccessMode.getVolatile).invokeExact(array, i);
+ hs.get(TestAccessMode.SET_VOLATILE).invokeExact(array, i, 2.0f);
+ float x = (float) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(array, i);
assertEquals(x, 2.0f, "setVolatile float value");
}
// Lazy
{
- hs.get(TestAccessMode.setRelease).invokeExact(array, i, 1.0f);
- float x = (float) hs.get(TestAccessMode.getAcquire).invokeExact(array, i);
+ hs.get(TestAccessMode.SET_RELEASE).invokeExact(array, i, 1.0f);
+ float x = (float) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(array, i);
assertEquals(x, 1.0f, "setRelease float value");
}
// Opaque
{
- hs.get(TestAccessMode.setOpaque).invokeExact(array, i, 2.0f);
- float x = (float) hs.get(TestAccessMode.getOpaque).invokeExact(array, i);
+ hs.get(TestAccessMode.SET_OPAQUE).invokeExact(array, i, 2.0f);
+ float x = (float) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(array, i);
assertEquals(x, 2.0f, "setOpaque float value");
}
@@ -279,25 +279,25 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
float[] array = new float[10];
final int i = 0;
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
checkUOE(am, () -> {
boolean r = (boolean) hs.get(am).invokeExact(array, i, 1.0f, 2.0f);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkUOE(am, () -> {
float r = (float) hs.get(am).invokeExact(array, i, 1.0f, 2.0f);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkUOE(am, () -> {
float r = (float) hs.get(am).invokeExact(array, i, 1.0f);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkUOE(am, () -> {
float o = (float) hs.get(am).invokeExact(array, i, 1.0f);
});
@@ -310,13 +310,13 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
for (int i : new int[]{-1, Integer.MIN_VALUE, 10, 11, Integer.MAX_VALUE}) {
final int ci = i;
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
checkIOOBE(am, () -> {
float x = (float) hs.get(am).invokeExact(array, ci);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
checkIOOBE(am, () -> {
hs.get(am).invokeExact(array, ci, 1.0f);
});
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java
index 66711948767..4e8de0c3bc8 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java
@@ -121,128 +121,128 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
static void testInstanceField(VarHandleTestMethodHandleAccessInt recv, Handles hs) throws Throwable {
// Plain
{
- hs.get(TestAccessMode.set).invokeExact(recv, 1);
- int x = (int) hs.get(TestAccessMode.get).invokeExact(recv);
+ hs.get(TestAccessMode.SET).invokeExact(recv, 1);
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 1, "set int value");
}
// Volatile
{
- hs.get(TestAccessMode.setVolatile).invokeExact(recv, 2);
- int x = (int) hs.get(TestAccessMode.getVolatile).invokeExact(recv);
+ hs.get(TestAccessMode.SET_VOLATILE).invokeExact(recv, 2);
+ int x = (int) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(recv);
assertEquals(x, 2, "setVolatile int value");
}
// Lazy
{
- hs.get(TestAccessMode.setRelease).invokeExact(recv, 1);
- int x = (int) hs.get(TestAccessMode.getAcquire).invokeExact(recv);
+ hs.get(TestAccessMode.SET_RELEASE).invokeExact(recv, 1);
+ int x = (int) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(recv);
assertEquals(x, 1, "setRelease int value");
}
// Opaque
{
- hs.get(TestAccessMode.setOpaque).invokeExact(recv, 2);
- int x = (int) hs.get(TestAccessMode.getOpaque).invokeExact(recv);
+ hs.get(TestAccessMode.SET_OPAQUE).invokeExact(recv, 2);
+ int x = (int) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(recv);
assertEquals(x, 2, "setOpaque int value");
}
- hs.get(TestAccessMode.set).invokeExact(recv, 1);
+ hs.get(TestAccessMode.SET).invokeExact(recv, 1);
// Compare
{
- boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(recv, 1, 2);
+ boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, 1, 2);
assertEquals(r, true, "success compareAndSet int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact(recv);
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 2, "success compareAndSet int value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(recv, 1, 3);
+ boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, 1, 3);
assertEquals(r, false, "failing compareAndSet int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact(recv);
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 2, "failing compareAndSet int value");
}
{
- int r = (int) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(recv, 2, 1);
+ int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(recv, 2, 1);
assertEquals(r, 2, "success compareAndExchangeVolatile int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact(recv);
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 1, "success compareAndExchangeVolatile int value");
}
{
- int r = (int) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(recv, 2, 3);
+ int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(recv, 2, 3);
assertEquals(r, 1, "failing compareAndExchangeVolatile int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact(recv);
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 1, "failing compareAndExchangeVolatile int value");
}
{
- int r = (int) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(recv, 1, 2);
+ int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, 1, 2);
assertEquals(r, 1, "success compareAndExchangeAcquire int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact(recv);
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 2, "success compareAndExchangeAcquire int value");
}
{
- int r = (int) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(recv, 1, 3);
+ int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, 1, 3);
assertEquals(r, 2, "failing compareAndExchangeAcquire int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact(recv);
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 2, "failing compareAndExchangeAcquire int value");
}
{
- int r = (int) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(recv, 2, 1);
+ int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, 2, 1);
assertEquals(r, 2, "success compareAndExchangeRelease int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact(recv);
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 1, "success compareAndExchangeRelease int value");
}
{
- int r = (int) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(recv, 2, 3);
+ int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, 2, 3);
assertEquals(r, 1, "failing compareAndExchangeRelease int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact(recv);
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 1, "failing compareAndExchangeRelease int value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSet).invokeExact(recv, 1, 2);
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 1, 2);
assertEquals(r, true, "weakCompareAndSet int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact(recv);
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 2, "weakCompareAndSet int value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetAcquire).invokeExact(recv, 2, 1);
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, 2, 1);
assertEquals(r, true, "weakCompareAndSetAcquire int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact(recv);
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 1, "weakCompareAndSetAcquire int");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetRelease).invokeExact(recv, 1, 2);
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, 1, 2);
assertEquals(r, true, "weakCompareAndSetRelease int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact(recv);
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 2, "weakCompareAndSetRelease int");
}
// Compare set and get
{
- int o = (int) hs.get(TestAccessMode.getAndSet).invokeExact(recv, 1);
+ int o = (int) hs.get(TestAccessMode.GET_AND_SET).invokeExact(recv, 1);
assertEquals(o, 2, "getAndSet int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact(recv);
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 1, "getAndSet int value");
}
- hs.get(TestAccessMode.set).invokeExact(recv, 1);
+ hs.get(TestAccessMode.SET).invokeExact(recv, 1);
// get and add, add and get
{
- int o = (int) hs.get(TestAccessMode.getAndAdd).invokeExact(recv, 3);
+ int o = (int) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, 3);
assertEquals(o, 1, "getAndAdd int");
- int c = (int) hs.get(TestAccessMode.addAndGet).invokeExact(recv, 3);
+ int c = (int) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(recv, 3);
assertEquals(c, 1 + 3 + 3, "getAndAdd int value");
}
}
@@ -255,128 +255,128 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
static void testStaticField(Handles hs) throws Throwable {
// Plain
{
- hs.get(TestAccessMode.set).invokeExact(1);
- int x = (int) hs.get(TestAccessMode.get).invokeExact();
+ hs.get(TestAccessMode.SET).invokeExact(1);
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 1, "set int value");
}
// Volatile
{
- hs.get(TestAccessMode.setVolatile).invokeExact(2);
- int x = (int) hs.get(TestAccessMode.getVolatile).invokeExact();
+ hs.get(TestAccessMode.SET_VOLATILE).invokeExact(2);
+ int x = (int) hs.get(TestAccessMode.GET_VOLATILE).invokeExact();
assertEquals(x, 2, "setVolatile int value");
}
// Lazy
{
- hs.get(TestAccessMode.setRelease).invokeExact(1);
- int x = (int) hs.get(TestAccessMode.getAcquire).invokeExact();
+ hs.get(TestAccessMode.SET_RELEASE).invokeExact(1);
+ int x = (int) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact();
assertEquals(x, 1, "setRelease int value");
}
// Opaque
{
- hs.get(TestAccessMode.setOpaque).invokeExact(2);
- int x = (int) hs.get(TestAccessMode.getOpaque).invokeExact();
+ hs.get(TestAccessMode.SET_OPAQUE).invokeExact(2);
+ int x = (int) hs.get(TestAccessMode.GET_OPAQUE).invokeExact();
assertEquals(x, 2, "setOpaque int value");
}
- hs.get(TestAccessMode.set).invokeExact(1);
+ hs.get(TestAccessMode.SET).invokeExact(1);
// Compare
{
- boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(1, 2);
+ boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(1, 2);
assertEquals(r, true, "success compareAndSet int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact();
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 2, "success compareAndSet int value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(1, 3);
+ boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(1, 3);
assertEquals(r, false, "failing compareAndSet int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact();
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 2, "failing compareAndSet int value");
}
{
- int r = (int) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(2, 1);
+ int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(2, 1);
assertEquals(r, 2, "success compareAndExchangeVolatile int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact();
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 1, "success compareAndExchangeVolatile int value");
}
{
- int r = (int) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(2, 3);
+ int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(2, 3);
assertEquals(r, 1, "failing compareAndExchangeVolatile int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact();
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 1, "failing compareAndExchangeVolatile int value");
}
{
- int r = (int) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(1, 2);
+ int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(1, 2);
assertEquals(r, 1, "success compareAndExchangeAcquire int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact();
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 2, "success compareAndExchangeAcquire int value");
}
{
- int r = (int) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(1, 3);
+ int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(1, 3);
assertEquals(r, 2, "failing compareAndExchangeAcquire int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact();
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 2, "failing compareAndExchangeAcquire int value");
}
{
- int r = (int) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(2, 1);
+ int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(2, 1);
assertEquals(r, 2, "success compareAndExchangeRelease int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact();
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 1, "success compareAndExchangeRelease int value");
}
{
- int r = (int) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(2, 3);
+ int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(2, 3);
assertEquals(r, 1, "failing compareAndExchangeRelease int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact();
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 1, "failing compareAndExchangeRelease int value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSet).invokeExact(1, 2);
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(1, 2);
assertEquals(r, true, "weakCompareAndSet int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact();
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 2, "weakCompareAndSet int value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetAcquire).invokeExact(2, 1);
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(2, 1);
assertEquals(r, true, "weakCompareAndSetAcquire int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact();
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 1, "weakCompareAndSetAcquire int");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetRelease).invokeExact( 1, 2);
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact( 1, 2);
assertEquals(r, true, "weakCompareAndSetRelease int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact();
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 2, "weakCompareAndSetRelease int");
}
// Compare set and get
{
- int o = (int) hs.get(TestAccessMode.getAndSet).invokeExact( 1);
+ int o = (int) hs.get(TestAccessMode.GET_AND_SET).invokeExact( 1);
assertEquals(o, 2, "getAndSet int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact();
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 1, "getAndSet int value");
}
- hs.get(TestAccessMode.set).invokeExact(1);
+ hs.get(TestAccessMode.SET).invokeExact(1);
// get and add, add and get
{
- int o = (int) hs.get(TestAccessMode.getAndAdd).invokeExact( 3);
+ int o = (int) hs.get(TestAccessMode.GET_AND_ADD).invokeExact( 3);
assertEquals(o, 1, "getAndAdd int");
- int c = (int) hs.get(TestAccessMode.addAndGet).invokeExact(3);
+ int c = (int) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(3);
assertEquals(c, 1 + 3 + 3, "getAndAdd int value");
}
}
@@ -392,128 +392,128 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
for (int i = 0; i < array.length; i++) {
// Plain
{
- hs.get(TestAccessMode.set).invokeExact(array, i, 1);
- int x = (int) hs.get(TestAccessMode.get).invokeExact(array, i);
+ hs.get(TestAccessMode.SET).invokeExact(array, i, 1);
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 1, "get int value");
}
// Volatile
{
- hs.get(TestAccessMode.setVolatile).invokeExact(array, i, 2);
- int x = (int) hs.get(TestAccessMode.getVolatile).invokeExact(array, i);
+ hs.get(TestAccessMode.SET_VOLATILE).invokeExact(array, i, 2);
+ int x = (int) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(array, i);
assertEquals(x, 2, "setVolatile int value");
}
// Lazy
{
- hs.get(TestAccessMode.setRelease).invokeExact(array, i, 1);
- int x = (int) hs.get(TestAccessMode.getAcquire).invokeExact(array, i);
+ hs.get(TestAccessMode.SET_RELEASE).invokeExact(array, i, 1);
+ int x = (int) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(array, i);
assertEquals(x, 1, "setRelease int value");
}
// Opaque
{
- hs.get(TestAccessMode.setOpaque).invokeExact(array, i, 2);
- int x = (int) hs.get(TestAccessMode.getOpaque).invokeExact(array, i);
+ hs.get(TestAccessMode.SET_OPAQUE).invokeExact(array, i, 2);
+ int x = (int) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(array, i);
assertEquals(x, 2, "setOpaque int value");
}
- hs.get(TestAccessMode.set).invokeExact(array, i, 1);
+ hs.get(TestAccessMode.SET).invokeExact(array, i, 1);
// Compare
{
- boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(array, i, 1, 2);
+ boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, 1, 2);
assertEquals(r, true, "success compareAndSet int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact(array, i);
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 2, "success compareAndSet int value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(array, i, 1, 3);
+ boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, 1, 3);
assertEquals(r, false, "failing compareAndSet int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact(array, i);
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 2, "failing compareAndSet int value");
}
{
- int r = (int) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(array, i, 2, 1);
+ int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(array, i, 2, 1);
assertEquals(r, 2, "success compareAndExchangeVolatile int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact(array, i);
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 1, "success compareAndExchangeVolatile int value");
}
{
- int r = (int) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(array, i, 2, 3);
+ int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(array, i, 2, 3);
assertEquals(r, 1, "failing compareAndExchangeVolatile int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact(array, i);
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 1, "failing compareAndExchangeVolatile int value");
}
{
- int r = (int) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(array, i, 1, 2);
+ int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, 1, 2);
assertEquals(r, 1, "success compareAndExchangeAcquire int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact(array, i);
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 2, "success compareAndExchangeAcquire int value");
}
{
- int r = (int) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(array, i, 1, 3);
+ int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, 1, 3);
assertEquals(r, 2, "failing compareAndExchangeAcquire int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact(array, i);
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 2, "failing compareAndExchangeAcquire int value");
}
{
- int r = (int) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(array, i, 2, 1);
+ int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, 2, 1);
assertEquals(r, 2, "success compareAndExchangeRelease int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact(array, i);
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 1, "success compareAndExchangeRelease int value");
}
{
- int r = (int) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(array, i, 2, 3);
+ int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, 2, 3);
assertEquals(r, 1, "failing compareAndExchangeRelease int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact(array, i);
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 1, "failing compareAndExchangeRelease int value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSet).invokeExact(array, i, 1, 2);
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 1, 2);
assertEquals(r, true, "weakCompareAndSet int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact(array, i);
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 2, "weakCompareAndSet int value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetAcquire).invokeExact(array, i, 2, 1);
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, 2, 1);
assertEquals(r, true, "weakCompareAndSetAcquire int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact(array, i);
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 1, "weakCompareAndSetAcquire int");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetRelease).invokeExact(array, i, 1, 2);
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(array, i, 1, 2);
assertEquals(r, true, "weakCompareAndSetRelease int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact(array, i);
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 2, "weakCompareAndSetRelease int");
}
// Compare set and get
{
- int o = (int) hs.get(TestAccessMode.getAndSet).invokeExact(array, i, 1);
+ int o = (int) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, 1);
assertEquals(o, 2, "getAndSet int");
- int x = (int) hs.get(TestAccessMode.get).invokeExact(array, i);
+ int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 1, "getAndSet int value");
}
- hs.get(TestAccessMode.set).invokeExact(array, i, 1);
+ hs.get(TestAccessMode.SET).invokeExact(array, i, 1);
// get and add, add and get
{
- int o = (int) hs.get(TestAccessMode.getAndAdd).invokeExact(array, i, 3);
+ int o = (int) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, 3);
assertEquals(o, 1, "getAndAdd int");
- int c = (int) hs.get(TestAccessMode.addAndGet).invokeExact(array, i, 3);
+ int c = (int) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(array, i, 3);
assertEquals(c, 1 + 3 + 3, "getAndAdd int value");
}
}
@@ -532,37 +532,37 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
for (int i : new int[]{-1, Integer.MIN_VALUE, 10, 11, Integer.MAX_VALUE}) {
final int ci = i;
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
checkIOOBE(am, () -> {
int x = (int) hs.get(am).invokeExact(array, ci);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
checkIOOBE(am, () -> {
hs.get(am).invokeExact(array, ci, 1);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
checkIOOBE(am, () -> {
boolean r = (boolean) hs.get(am).invokeExact(array, ci, 1, 2);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkIOOBE(am, () -> {
int r = (int) hs.get(am).invokeExact(array, ci, 2, 1);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkIOOBE(am, () -> {
int o = (int) hs.get(am).invokeExact(array, ci, 1);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkIOOBE(am, () -> {
int o = (int) hs.get(am).invokeExact(array, ci, 3);
});
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java
index c3a38c7c425..05efd70079b 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java
@@ -121,128 +121,128 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
static void testInstanceField(VarHandleTestMethodHandleAccessLong recv, Handles hs) throws Throwable {
// Plain
{
- hs.get(TestAccessMode.set).invokeExact(recv, 1L);
- long x = (long) hs.get(TestAccessMode.get).invokeExact(recv);
+ hs.get(TestAccessMode.SET).invokeExact(recv, 1L);
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 1L, "set long value");
}
// Volatile
{
- hs.get(TestAccessMode.setVolatile).invokeExact(recv, 2L);
- long x = (long) hs.get(TestAccessMode.getVolatile).invokeExact(recv);
+ hs.get(TestAccessMode.SET_VOLATILE).invokeExact(recv, 2L);
+ long x = (long) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(recv);
assertEquals(x, 2L, "setVolatile long value");
}
// Lazy
{
- hs.get(TestAccessMode.setRelease).invokeExact(recv, 1L);
- long x = (long) hs.get(TestAccessMode.getAcquire).invokeExact(recv);
+ hs.get(TestAccessMode.SET_RELEASE).invokeExact(recv, 1L);
+ long x = (long) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(recv);
assertEquals(x, 1L, "setRelease long value");
}
// Opaque
{
- hs.get(TestAccessMode.setOpaque).invokeExact(recv, 2L);
- long x = (long) hs.get(TestAccessMode.getOpaque).invokeExact(recv);
+ hs.get(TestAccessMode.SET_OPAQUE).invokeExact(recv, 2L);
+ long x = (long) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(recv);
assertEquals(x, 2L, "setOpaque long value");
}
- hs.get(TestAccessMode.set).invokeExact(recv, 1L);
+ hs.get(TestAccessMode.SET).invokeExact(recv, 1L);
// Compare
{
- boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(recv, 1L, 2L);
+ boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, 1L, 2L);
assertEquals(r, true, "success compareAndSet long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact(recv);
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 2L, "success compareAndSet long value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(recv, 1L, 3L);
+ boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, 1L, 3L);
assertEquals(r, false, "failing compareAndSet long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact(recv);
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 2L, "failing compareAndSet long value");
}
{
- long r = (long) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(recv, 2L, 1L);
+ long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(recv, 2L, 1L);
assertEquals(r, 2L, "success compareAndExchangeVolatile long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact(recv);
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 1L, "success compareAndExchangeVolatile long value");
}
{
- long r = (long) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(recv, 2L, 3L);
+ long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(recv, 2L, 3L);
assertEquals(r, 1L, "failing compareAndExchangeVolatile long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact(recv);
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 1L, "failing compareAndExchangeVolatile long value");
}
{
- long r = (long) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(recv, 1L, 2L);
+ long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, 1L, 2L);
assertEquals(r, 1L, "success compareAndExchangeAcquire long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact(recv);
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 2L, "success compareAndExchangeAcquire long value");
}
{
- long r = (long) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(recv, 1L, 3L);
+ long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, 1L, 3L);
assertEquals(r, 2L, "failing compareAndExchangeAcquire long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact(recv);
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 2L, "failing compareAndExchangeAcquire long value");
}
{
- long r = (long) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(recv, 2L, 1L);
+ long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, 2L, 1L);
assertEquals(r, 2L, "success compareAndExchangeRelease long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact(recv);
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 1L, "success compareAndExchangeRelease long value");
}
{
- long r = (long) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(recv, 2L, 3L);
+ long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, 2L, 3L);
assertEquals(r, 1L, "failing compareAndExchangeRelease long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact(recv);
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 1L, "failing compareAndExchangeRelease long value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSet).invokeExact(recv, 1L, 2L);
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 1L, 2L);
assertEquals(r, true, "weakCompareAndSet long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact(recv);
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 2L, "weakCompareAndSet long value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetAcquire).invokeExact(recv, 2L, 1L);
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, 2L, 1L);
assertEquals(r, true, "weakCompareAndSetAcquire long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact(recv);
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 1L, "weakCompareAndSetAcquire long");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetRelease).invokeExact(recv, 1L, 2L);
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, 1L, 2L);
assertEquals(r, true, "weakCompareAndSetRelease long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact(recv);
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 2L, "weakCompareAndSetRelease long");
}
// Compare set and get
{
- long o = (long) hs.get(TestAccessMode.getAndSet).invokeExact(recv, 1L);
+ long o = (long) hs.get(TestAccessMode.GET_AND_SET).invokeExact(recv, 1L);
assertEquals(o, 2L, "getAndSet long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact(recv);
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 1L, "getAndSet long value");
}
- hs.get(TestAccessMode.set).invokeExact(recv, 1L);
+ hs.get(TestAccessMode.SET).invokeExact(recv, 1L);
// get and add, add and get
{
- long o = (long) hs.get(TestAccessMode.getAndAdd).invokeExact(recv, 3L);
+ long o = (long) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, 3L);
assertEquals(o, 1L, "getAndAdd long");
- long c = (long) hs.get(TestAccessMode.addAndGet).invokeExact(recv, 3L);
+ long c = (long) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(recv, 3L);
assertEquals(c, 1L + 3L + 3L, "getAndAdd long value");
}
}
@@ -255,128 +255,128 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
static void testStaticField(Handles hs) throws Throwable {
// Plain
{
- hs.get(TestAccessMode.set).invokeExact(1L);
- long x = (long) hs.get(TestAccessMode.get).invokeExact();
+ hs.get(TestAccessMode.SET).invokeExact(1L);
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 1L, "set long value");
}
// Volatile
{
- hs.get(TestAccessMode.setVolatile).invokeExact(2L);
- long x = (long) hs.get(TestAccessMode.getVolatile).invokeExact();
+ hs.get(TestAccessMode.SET_VOLATILE).invokeExact(2L);
+ long x = (long) hs.get(TestAccessMode.GET_VOLATILE).invokeExact();
assertEquals(x, 2L, "setVolatile long value");
}
// Lazy
{
- hs.get(TestAccessMode.setRelease).invokeExact(1L);
- long x = (long) hs.get(TestAccessMode.getAcquire).invokeExact();
+ hs.get(TestAccessMode.SET_RELEASE).invokeExact(1L);
+ long x = (long) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact();
assertEquals(x, 1L, "setRelease long value");
}
// Opaque
{
- hs.get(TestAccessMode.setOpaque).invokeExact(2L);
- long x = (long) hs.get(TestAccessMode.getOpaque).invokeExact();
+ hs.get(TestAccessMode.SET_OPAQUE).invokeExact(2L);
+ long x = (long) hs.get(TestAccessMode.GET_OPAQUE).invokeExact();
assertEquals(x, 2L, "setOpaque long value");
}
- hs.get(TestAccessMode.set).invokeExact(1L);
+ hs.get(TestAccessMode.SET).invokeExact(1L);
// Compare
{
- boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(1L, 2L);
+ boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(1L, 2L);
assertEquals(r, true, "success compareAndSet long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact();
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 2L, "success compareAndSet long value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(1L, 3L);
+ boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(1L, 3L);
assertEquals(r, false, "failing compareAndSet long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact();
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 2L, "failing compareAndSet long value");
}
{
- long r = (long) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(2L, 1L);
+ long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(2L, 1L);
assertEquals(r, 2L, "success compareAndExchangeVolatile long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact();
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 1L, "success compareAndExchangeVolatile long value");
}
{
- long r = (long) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(2L, 3L);
+ long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(2L, 3L);
assertEquals(r, 1L, "failing compareAndExchangeVolatile long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact();
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 1L, "failing compareAndExchangeVolatile long value");
}
{
- long r = (long) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(1L, 2L);
+ long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(1L, 2L);
assertEquals(r, 1L, "success compareAndExchangeAcquire long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact();
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 2L, "success compareAndExchangeAcquire long value");
}
{
- long r = (long) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(1L, 3L);
+ long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(1L, 3L);
assertEquals(r, 2L, "failing compareAndExchangeAcquire long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact();
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 2L, "failing compareAndExchangeAcquire long value");
}
{
- long r = (long) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(2L, 1L);
+ long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(2L, 1L);
assertEquals(r, 2L, "success compareAndExchangeRelease long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact();
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 1L, "success compareAndExchangeRelease long value");
}
{
- long r = (long) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(2L, 3L);
+ long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(2L, 3L);
assertEquals(r, 1L, "failing compareAndExchangeRelease long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact();
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 1L, "failing compareAndExchangeRelease long value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSet).invokeExact(1L, 2L);
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(1L, 2L);
assertEquals(r, true, "weakCompareAndSet long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact();
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 2L, "weakCompareAndSet long value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetAcquire).invokeExact(2L, 1L);
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(2L, 1L);
assertEquals(r, true, "weakCompareAndSetAcquire long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact();
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 1L, "weakCompareAndSetAcquire long");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetRelease).invokeExact( 1L, 2L);
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact( 1L, 2L);
assertEquals(r, true, "weakCompareAndSetRelease long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact();
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 2L, "weakCompareAndSetRelease long");
}
// Compare set and get
{
- long o = (long) hs.get(TestAccessMode.getAndSet).invokeExact( 1L);
+ long o = (long) hs.get(TestAccessMode.GET_AND_SET).invokeExact( 1L);
assertEquals(o, 2L, "getAndSet long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact();
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 1L, "getAndSet long value");
}
- hs.get(TestAccessMode.set).invokeExact(1L);
+ hs.get(TestAccessMode.SET).invokeExact(1L);
// get and add, add and get
{
- long o = (long) hs.get(TestAccessMode.getAndAdd).invokeExact( 3L);
+ long o = (long) hs.get(TestAccessMode.GET_AND_ADD).invokeExact( 3L);
assertEquals(o, 1L, "getAndAdd long");
- long c = (long) hs.get(TestAccessMode.addAndGet).invokeExact(3L);
+ long c = (long) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(3L);
assertEquals(c, 1L + 3L + 3L, "getAndAdd long value");
}
}
@@ -392,128 +392,128 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
for (int i = 0; i < array.length; i++) {
// Plain
{
- hs.get(TestAccessMode.set).invokeExact(array, i, 1L);
- long x = (long) hs.get(TestAccessMode.get).invokeExact(array, i);
+ hs.get(TestAccessMode.SET).invokeExact(array, i, 1L);
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 1L, "get long value");
}
// Volatile
{
- hs.get(TestAccessMode.setVolatile).invokeExact(array, i, 2L);
- long x = (long) hs.get(TestAccessMode.getVolatile).invokeExact(array, i);
+ hs.get(TestAccessMode.SET_VOLATILE).invokeExact(array, i, 2L);
+ long x = (long) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(array, i);
assertEquals(x, 2L, "setVolatile long value");
}
// Lazy
{
- hs.get(TestAccessMode.setRelease).invokeExact(array, i, 1L);
- long x = (long) hs.get(TestAccessMode.getAcquire).invokeExact(array, i);
+ hs.get(TestAccessMode.SET_RELEASE).invokeExact(array, i, 1L);
+ long x = (long) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(array, i);
assertEquals(x, 1L, "setRelease long value");
}
// Opaque
{
- hs.get(TestAccessMode.setOpaque).invokeExact(array, i, 2L);
- long x = (long) hs.get(TestAccessMode.getOpaque).invokeExact(array, i);
+ hs.get(TestAccessMode.SET_OPAQUE).invokeExact(array, i, 2L);
+ long x = (long) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(array, i);
assertEquals(x, 2L, "setOpaque long value");
}
- hs.get(TestAccessMode.set).invokeExact(array, i, 1L);
+ hs.get(TestAccessMode.SET).invokeExact(array, i, 1L);
// Compare
{
- boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(array, i, 1L, 2L);
+ boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, 1L, 2L);
assertEquals(r, true, "success compareAndSet long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact(array, i);
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 2L, "success compareAndSet long value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(array, i, 1L, 3L);
+ boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, 1L, 3L);
assertEquals(r, false, "failing compareAndSet long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact(array, i);
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 2L, "failing compareAndSet long value");
}
{
- long r = (long) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(array, i, 2L, 1L);
+ long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(array, i, 2L, 1L);
assertEquals(r, 2L, "success compareAndExchangeVolatile long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact(array, i);
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 1L, "success compareAndExchangeVolatile long value");
}
{
- long r = (long) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(array, i, 2L, 3L);
+ long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(array, i, 2L, 3L);
assertEquals(r, 1L, "failing compareAndExchangeVolatile long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact(array, i);
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 1L, "failing compareAndExchangeVolatile long value");
}
{
- long r = (long) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(array, i, 1L, 2L);
+ long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, 1L, 2L);
assertEquals(r, 1L, "success compareAndExchangeAcquire long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact(array, i);
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 2L, "success compareAndExchangeAcquire long value");
}
{
- long r = (long) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(array, i, 1L, 3L);
+ long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, 1L, 3L);
assertEquals(r, 2L, "failing compareAndExchangeAcquire long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact(array, i);
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 2L, "failing compareAndExchangeAcquire long value");
}
{
- long r = (long) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(array, i, 2L, 1L);
+ long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, 2L, 1L);
assertEquals(r, 2L, "success compareAndExchangeRelease long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact(array, i);
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 1L, "success compareAndExchangeRelease long value");
}
{
- long r = (long) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(array, i, 2L, 3L);
+ long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, 2L, 3L);
assertEquals(r, 1L, "failing compareAndExchangeRelease long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact(array, i);
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 1L, "failing compareAndExchangeRelease long value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSet).invokeExact(array, i, 1L, 2L);
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 1L, 2L);
assertEquals(r, true, "weakCompareAndSet long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact(array, i);
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 2L, "weakCompareAndSet long value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetAcquire).invokeExact(array, i, 2L, 1L);
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, 2L, 1L);
assertEquals(r, true, "weakCompareAndSetAcquire long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact(array, i);
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 1L, "weakCompareAndSetAcquire long");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetRelease).invokeExact(array, i, 1L, 2L);
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(array, i, 1L, 2L);
assertEquals(r, true, "weakCompareAndSetRelease long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact(array, i);
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 2L, "weakCompareAndSetRelease long");
}
// Compare set and get
{
- long o = (long) hs.get(TestAccessMode.getAndSet).invokeExact(array, i, 1L);
+ long o = (long) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, 1L);
assertEquals(o, 2L, "getAndSet long");
- long x = (long) hs.get(TestAccessMode.get).invokeExact(array, i);
+ long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 1L, "getAndSet long value");
}
- hs.get(TestAccessMode.set).invokeExact(array, i, 1L);
+ hs.get(TestAccessMode.SET).invokeExact(array, i, 1L);
// get and add, add and get
{
- long o = (long) hs.get(TestAccessMode.getAndAdd).invokeExact(array, i, 3L);
+ long o = (long) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, 3L);
assertEquals(o, 1L, "getAndAdd long");
- long c = (long) hs.get(TestAccessMode.addAndGet).invokeExact(array, i, 3L);
+ long c = (long) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(array, i, 3L);
assertEquals(c, 1L + 3L + 3L, "getAndAdd long value");
}
}
@@ -532,37 +532,37 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
for (int i : new int[]{-1, Integer.MIN_VALUE, 10, 11, Integer.MAX_VALUE}) {
final int ci = i;
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
checkIOOBE(am, () -> {
long x = (long) hs.get(am).invokeExact(array, ci);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
checkIOOBE(am, () -> {
hs.get(am).invokeExact(array, ci, 1L);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
checkIOOBE(am, () -> {
boolean r = (boolean) hs.get(am).invokeExact(array, ci, 1L, 2L);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkIOOBE(am, () -> {
long r = (long) hs.get(am).invokeExact(array, ci, 2L, 1L);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkIOOBE(am, () -> {
long o = (long) hs.get(am).invokeExact(array, ci, 1L);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkIOOBE(am, () -> {
long o = (long) hs.get(am).invokeExact(array, ci, 3L);
});
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessShort.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessShort.java
index da7a12b3692..6edc9b19b68 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessShort.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessShort.java
@@ -121,30 +121,30 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
static void testInstanceField(VarHandleTestMethodHandleAccessShort recv, Handles hs) throws Throwable {
// Plain
{
- hs.get(TestAccessMode.set).invokeExact(recv, (short)1);
- short x = (short) hs.get(TestAccessMode.get).invokeExact(recv);
+ hs.get(TestAccessMode.SET).invokeExact(recv, (short)1);
+ short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, (short)1, "set short value");
}
// Volatile
{
- hs.get(TestAccessMode.setVolatile).invokeExact(recv, (short)2);
- short x = (short) hs.get(TestAccessMode.getVolatile).invokeExact(recv);
+ hs.get(TestAccessMode.SET_VOLATILE).invokeExact(recv, (short)2);
+ short x = (short) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(recv);
assertEquals(x, (short)2, "setVolatile short value");
}
// Lazy
{
- hs.get(TestAccessMode.setRelease).invokeExact(recv, (short)1);
- short x = (short) hs.get(TestAccessMode.getAcquire).invokeExact(recv);
+ hs.get(TestAccessMode.SET_RELEASE).invokeExact(recv, (short)1);
+ short x = (short) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(recv);
assertEquals(x, (short)1, "setRelease short value");
}
// Opaque
{
- hs.get(TestAccessMode.setOpaque).invokeExact(recv, (short)2);
- short x = (short) hs.get(TestAccessMode.getOpaque).invokeExact(recv);
+ hs.get(TestAccessMode.SET_OPAQUE).invokeExact(recv, (short)2);
+ short x = (short) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(recv);
assertEquals(x, (short)2, "setOpaque short value");
}
@@ -152,25 +152,25 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
}
static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessShort recv, Handles hs) throws Throwable {
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
checkUOE(am, () -> {
boolean r = (boolean) hs.get(am).invokeExact(recv, (short)1, (short)2);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkUOE(am, () -> {
short r = (short) hs.get(am).invokeExact(recv, (short)1, (short)2);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkUOE(am, () -> {
short r = (short) hs.get(am).invokeExact(recv, (short)1);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkUOE(am, () -> {
short r = (short) hs.get(am).invokeExact(recv, (short)1);
});
@@ -181,30 +181,30 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
static void testStaticField(Handles hs) throws Throwable {
// Plain
{
- hs.get(TestAccessMode.set).invokeExact((short)1);
- short x = (short) hs.get(TestAccessMode.get).invokeExact();
+ hs.get(TestAccessMode.SET).invokeExact((short)1);
+ short x = (short) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, (short)1, "set short value");
}
// Volatile
{
- hs.get(TestAccessMode.setVolatile).invokeExact((short)2);
- short x = (short) hs.get(TestAccessMode.getVolatile).invokeExact();
+ hs.get(TestAccessMode.SET_VOLATILE).invokeExact((short)2);
+ short x = (short) hs.get(TestAccessMode.GET_VOLATILE).invokeExact();
assertEquals(x, (short)2, "setVolatile short value");
}
// Lazy
{
- hs.get(TestAccessMode.setRelease).invokeExact((short)1);
- short x = (short) hs.get(TestAccessMode.getAcquire).invokeExact();
+ hs.get(TestAccessMode.SET_RELEASE).invokeExact((short)1);
+ short x = (short) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact();
assertEquals(x, (short)1, "setRelease short value");
}
// Opaque
{
- hs.get(TestAccessMode.setOpaque).invokeExact((short)2);
- short x = (short) hs.get(TestAccessMode.getOpaque).invokeExact();
+ hs.get(TestAccessMode.SET_OPAQUE).invokeExact((short)2);
+ short x = (short) hs.get(TestAccessMode.GET_OPAQUE).invokeExact();
assertEquals(x, (short)2, "setOpaque short value");
}
@@ -212,25 +212,25 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
}
static void testStaticFieldUnsupported(Handles hs) throws Throwable {
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
checkUOE(am, () -> {
boolean r = (boolean) hs.get(am).invokeExact((short)1, (short)2);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkUOE(am, () -> {
short r = (short) hs.get(am).invokeExact((short)1, (short)2);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkUOE(am, () -> {
short r = (short) hs.get(am).invokeExact((short)1);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkUOE(am, () -> {
short r = (short) hs.get(am).invokeExact((short)1);
});
@@ -244,30 +244,30 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
for (int i = 0; i < array.length; i++) {
// Plain
{
- hs.get(TestAccessMode.set).invokeExact(array, i, (short)1);
- short x = (short) hs.get(TestAccessMode.get).invokeExact(array, i);
+ hs.get(TestAccessMode.SET).invokeExact(array, i, (short)1);
+ short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, (short)1, "get short value");
}
// Volatile
{
- hs.get(TestAccessMode.setVolatile).invokeExact(array, i, (short)2);
- short x = (short) hs.get(TestAccessMode.getVolatile).invokeExact(array, i);
+ hs.get(TestAccessMode.SET_VOLATILE).invokeExact(array, i, (short)2);
+ short x = (short) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(array, i);
assertEquals(x, (short)2, "setVolatile short value");
}
// Lazy
{
- hs.get(TestAccessMode.setRelease).invokeExact(array, i, (short)1);
- short x = (short) hs.get(TestAccessMode.getAcquire).invokeExact(array, i);
+ hs.get(TestAccessMode.SET_RELEASE).invokeExact(array, i, (short)1);
+ short x = (short) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(array, i);
assertEquals(x, (short)1, "setRelease short value");
}
// Opaque
{
- hs.get(TestAccessMode.setOpaque).invokeExact(array, i, (short)2);
- short x = (short) hs.get(TestAccessMode.getOpaque).invokeExact(array, i);
+ hs.get(TestAccessMode.SET_OPAQUE).invokeExact(array, i, (short)2);
+ short x = (short) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(array, i);
assertEquals(x, (short)2, "setOpaque short value");
}
@@ -279,25 +279,25 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
short[] array = new short[10];
final int i = 0;
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
checkUOE(am, () -> {
boolean r = (boolean) hs.get(am).invokeExact(array, i, (short)1, (short)2);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkUOE(am, () -> {
short r = (short) hs.get(am).invokeExact(array, i, (short)1, (short)2);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkUOE(am, () -> {
short r = (short) hs.get(am).invokeExact(array, i, (short)1);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkUOE(am, () -> {
short o = (short) hs.get(am).invokeExact(array, i, (short)1);
});
@@ -310,13 +310,13 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
for (int i : new int[]{-1, Integer.MIN_VALUE, 10, 11, Integer.MAX_VALUE}) {
final int ci = i;
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
checkIOOBE(am, () -> {
short x = (short) hs.get(am).invokeExact(array, ci);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
checkIOOBE(am, () -> {
hs.get(am).invokeExact(array, ci, (short)1);
});
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java
index 6034dd268d9..62ef4ae7f37 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java
@@ -121,118 +121,118 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
static void testInstanceField(VarHandleTestMethodHandleAccessString recv, Handles hs) throws Throwable {
// Plain
{
- hs.get(TestAccessMode.set).invokeExact(recv, "foo");
- String x = (String) hs.get(TestAccessMode.get).invokeExact(recv);
+ hs.get(TestAccessMode.SET).invokeExact(recv, "foo");
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, "foo", "set String value");
}
// Volatile
{
- hs.get(TestAccessMode.setVolatile).invokeExact(recv, "bar");
- String x = (String) hs.get(TestAccessMode.getVolatile).invokeExact(recv);
+ hs.get(TestAccessMode.SET_VOLATILE).invokeExact(recv, "bar");
+ String x = (String) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(recv);
assertEquals(x, "bar", "setVolatile String value");
}
// Lazy
{
- hs.get(TestAccessMode.setRelease).invokeExact(recv, "foo");
- String x = (String) hs.get(TestAccessMode.getAcquire).invokeExact(recv);
+ hs.get(TestAccessMode.SET_RELEASE).invokeExact(recv, "foo");
+ String x = (String) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(recv);
assertEquals(x, "foo", "setRelease String value");
}
// Opaque
{
- hs.get(TestAccessMode.setOpaque).invokeExact(recv, "bar");
- String x = (String) hs.get(TestAccessMode.getOpaque).invokeExact(recv);
+ hs.get(TestAccessMode.SET_OPAQUE).invokeExact(recv, "bar");
+ String x = (String) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(recv);
assertEquals(x, "bar", "setOpaque String value");
}
- hs.get(TestAccessMode.set).invokeExact(recv, "foo");
+ hs.get(TestAccessMode.SET).invokeExact(recv, "foo");
// Compare
{
- boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(recv, "foo", "bar");
+ boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, "foo", "bar");
assertEquals(r, true, "success compareAndSet String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact(recv);
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, "bar", "success compareAndSet String value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(recv, "foo", "baz");
+ boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, "foo", "baz");
assertEquals(r, false, "failing compareAndSet String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact(recv);
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, "bar", "failing compareAndSet String value");
}
{
- String r = (String) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(recv, "bar", "foo");
+ String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(recv, "bar", "foo");
assertEquals(r, "bar", "success compareAndExchangeVolatile String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact(recv);
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, "foo", "success compareAndExchangeVolatile String value");
}
{
- String r = (String) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(recv, "bar", "baz");
+ String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(recv, "bar", "baz");
assertEquals(r, "foo", "failing compareAndExchangeVolatile String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact(recv);
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, "foo", "failing compareAndExchangeVolatile String value");
}
{
- String r = (String) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(recv, "foo", "bar");
+ String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, "foo", "bar");
assertEquals(r, "foo", "success compareAndExchangeAcquire String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact(recv);
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, "bar", "success compareAndExchangeAcquire String value");
}
{
- String r = (String) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(recv, "foo", "baz");
+ String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, "foo", "baz");
assertEquals(r, "bar", "failing compareAndExchangeAcquire String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact(recv);
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, "bar", "failing compareAndExchangeAcquire String value");
}
{
- String r = (String) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(recv, "bar", "foo");
+ String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, "bar", "foo");
assertEquals(r, "bar", "success compareAndExchangeRelease String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact(recv);
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, "foo", "success compareAndExchangeRelease String value");
}
{
- String r = (String) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(recv, "bar", "baz");
+ String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, "bar", "baz");
assertEquals(r, "foo", "failing compareAndExchangeRelease String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact(recv);
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, "foo", "failing compareAndExchangeRelease String value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSet).invokeExact(recv, "foo", "bar");
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, "foo", "bar");
assertEquals(r, true, "weakCompareAndSet String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact(recv);
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, "bar", "weakCompareAndSet String value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetAcquire).invokeExact(recv, "bar", "foo");
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, "bar", "foo");
assertEquals(r, true, "weakCompareAndSetAcquire String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact(recv);
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, "foo", "weakCompareAndSetAcquire String");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetRelease).invokeExact(recv, "foo", "bar");
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, "foo", "bar");
assertEquals(r, true, "weakCompareAndSetRelease String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact(recv);
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, "bar", "weakCompareAndSetRelease String");
}
// Compare set and get
{
- String o = (String) hs.get(TestAccessMode.getAndSet).invokeExact(recv, "foo");
+ String o = (String) hs.get(TestAccessMode.GET_AND_SET).invokeExact(recv, "foo");
assertEquals(o, "bar", "getAndSet String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact(recv);
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, "foo", "getAndSet String value");
}
@@ -240,7 +240,7 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessString recv, Handles hs) throws Throwable {
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkUOE(am, () -> {
String r = (String) hs.get(am).invokeExact(recv, "foo");
});
@@ -251,118 +251,118 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
static void testStaticField(Handles hs) throws Throwable {
// Plain
{
- hs.get(TestAccessMode.set).invokeExact("foo");
- String x = (String) hs.get(TestAccessMode.get).invokeExact();
+ hs.get(TestAccessMode.SET).invokeExact("foo");
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, "foo", "set String value");
}
// Volatile
{
- hs.get(TestAccessMode.setVolatile).invokeExact("bar");
- String x = (String) hs.get(TestAccessMode.getVolatile).invokeExact();
+ hs.get(TestAccessMode.SET_VOLATILE).invokeExact("bar");
+ String x = (String) hs.get(TestAccessMode.GET_VOLATILE).invokeExact();
assertEquals(x, "bar", "setVolatile String value");
}
// Lazy
{
- hs.get(TestAccessMode.setRelease).invokeExact("foo");
- String x = (String) hs.get(TestAccessMode.getAcquire).invokeExact();
+ hs.get(TestAccessMode.SET_RELEASE).invokeExact("foo");
+ String x = (String) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact();
assertEquals(x, "foo", "setRelease String value");
}
// Opaque
{
- hs.get(TestAccessMode.setOpaque).invokeExact("bar");
- String x = (String) hs.get(TestAccessMode.getOpaque).invokeExact();
+ hs.get(TestAccessMode.SET_OPAQUE).invokeExact("bar");
+ String x = (String) hs.get(TestAccessMode.GET_OPAQUE).invokeExact();
assertEquals(x, "bar", "setOpaque String value");
}
- hs.get(TestAccessMode.set).invokeExact("foo");
+ hs.get(TestAccessMode.SET).invokeExact("foo");
// Compare
{
- boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact("foo", "bar");
+ boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact("foo", "bar");
assertEquals(r, true, "success compareAndSet String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact();
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, "bar", "success compareAndSet String value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact("foo", "baz");
+ boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact("foo", "baz");
assertEquals(r, false, "failing compareAndSet String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact();
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, "bar", "failing compareAndSet String value");
}
{
- String r = (String) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact("bar", "foo");
+ String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact("bar", "foo");
assertEquals(r, "bar", "success compareAndExchangeVolatile String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact();
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, "foo", "success compareAndExchangeVolatile String value");
}
{
- String r = (String) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact("bar", "baz");
+ String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact("bar", "baz");
assertEquals(r, "foo", "failing compareAndExchangeVolatile String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact();
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, "foo", "failing compareAndExchangeVolatile String value");
}
{
- String r = (String) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact("foo", "bar");
+ String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact("foo", "bar");
assertEquals(r, "foo", "success compareAndExchangeAcquire String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact();
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, "bar", "success compareAndExchangeAcquire String value");
}
{
- String r = (String) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact("foo", "baz");
+ String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact("foo", "baz");
assertEquals(r, "bar", "failing compareAndExchangeAcquire String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact();
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, "bar", "failing compareAndExchangeAcquire String value");
}
{
- String r = (String) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact("bar", "foo");
+ String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact("bar", "foo");
assertEquals(r, "bar", "success compareAndExchangeRelease String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact();
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, "foo", "success compareAndExchangeRelease String value");
}
{
- String r = (String) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact("bar", "baz");
+ String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact("bar", "baz");
assertEquals(r, "foo", "failing compareAndExchangeRelease String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact();
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, "foo", "failing compareAndExchangeRelease String value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSet).invokeExact("foo", "bar");
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact("foo", "bar");
assertEquals(r, true, "weakCompareAndSet String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact();
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, "bar", "weakCompareAndSet String value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetAcquire).invokeExact("bar", "foo");
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact("bar", "foo");
assertEquals(r, true, "weakCompareAndSetAcquire String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact();
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, "foo", "weakCompareAndSetAcquire String");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetRelease).invokeExact( "foo", "bar");
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact( "foo", "bar");
assertEquals(r, true, "weakCompareAndSetRelease String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact();
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, "bar", "weakCompareAndSetRelease String");
}
// Compare set and get
{
- String o = (String) hs.get(TestAccessMode.getAndSet).invokeExact( "foo");
+ String o = (String) hs.get(TestAccessMode.GET_AND_SET).invokeExact( "foo");
assertEquals(o, "bar", "getAndSet String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact();
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, "foo", "getAndSet String value");
}
@@ -370,7 +370,7 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
static void testStaticFieldUnsupported(Handles hs) throws Throwable {
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkUOE(am, () -> {
String r = (String) hs.get(am).invokeExact("foo");
});
@@ -384,118 +384,118 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
for (int i = 0; i < array.length; i++) {
// Plain
{
- hs.get(TestAccessMode.set).invokeExact(array, i, "foo");
- String x = (String) hs.get(TestAccessMode.get).invokeExact(array, i);
+ hs.get(TestAccessMode.SET).invokeExact(array, i, "foo");
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, "foo", "get String value");
}
// Volatile
{
- hs.get(TestAccessMode.setVolatile).invokeExact(array, i, "bar");
- String x = (String) hs.get(TestAccessMode.getVolatile).invokeExact(array, i);
+ hs.get(TestAccessMode.SET_VOLATILE).invokeExact(array, i, "bar");
+ String x = (String) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(array, i);
assertEquals(x, "bar", "setVolatile String value");
}
// Lazy
{
- hs.get(TestAccessMode.setRelease).invokeExact(array, i, "foo");
- String x = (String) hs.get(TestAccessMode.getAcquire).invokeExact(array, i);
+ hs.get(TestAccessMode.SET_RELEASE).invokeExact(array, i, "foo");
+ String x = (String) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(array, i);
assertEquals(x, "foo", "setRelease String value");
}
// Opaque
{
- hs.get(TestAccessMode.setOpaque).invokeExact(array, i, "bar");
- String x = (String) hs.get(TestAccessMode.getOpaque).invokeExact(array, i);
+ hs.get(TestAccessMode.SET_OPAQUE).invokeExact(array, i, "bar");
+ String x = (String) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(array, i);
assertEquals(x, "bar", "setOpaque String value");
}
- hs.get(TestAccessMode.set).invokeExact(array, i, "foo");
+ hs.get(TestAccessMode.SET).invokeExact(array, i, "foo");
// Compare
{
- boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(array, i, "foo", "bar");
+ boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, "foo", "bar");
assertEquals(r, true, "success compareAndSet String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact(array, i);
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, "bar", "success compareAndSet String value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(array, i, "foo", "baz");
+ boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, "foo", "baz");
assertEquals(r, false, "failing compareAndSet String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact(array, i);
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, "bar", "failing compareAndSet String value");
}
{
- String r = (String) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(array, i, "bar", "foo");
+ String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(array, i, "bar", "foo");
assertEquals(r, "bar", "success compareAndExchangeVolatile String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact(array, i);
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, "foo", "success compareAndExchangeVolatile String value");
}
{
- String r = (String) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(array, i, "bar", "baz");
+ String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(array, i, "bar", "baz");
assertEquals(r, "foo", "failing compareAndExchangeVolatile String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact(array, i);
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, "foo", "failing compareAndExchangeVolatile String value");
}
{
- String r = (String) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(array, i, "foo", "bar");
+ String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, "foo", "bar");
assertEquals(r, "foo", "success compareAndExchangeAcquire String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact(array, i);
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, "bar", "success compareAndExchangeAcquire String value");
}
{
- String r = (String) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(array, i, "foo", "baz");
+ String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, "foo", "baz");
assertEquals(r, "bar", "failing compareAndExchangeAcquire String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact(array, i);
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, "bar", "failing compareAndExchangeAcquire String value");
}
{
- String r = (String) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(array, i, "bar", "foo");
+ String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, "bar", "foo");
assertEquals(r, "bar", "success compareAndExchangeRelease String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact(array, i);
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, "foo", "success compareAndExchangeRelease String value");
}
{
- String r = (String) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(array, i, "bar", "baz");
+ String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, "bar", "baz");
assertEquals(r, "foo", "failing compareAndExchangeRelease String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact(array, i);
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, "foo", "failing compareAndExchangeRelease String value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSet).invokeExact(array, i, "foo", "bar");
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, "foo", "bar");
assertEquals(r, true, "weakCompareAndSet String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact(array, i);
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, "bar", "weakCompareAndSet String value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetAcquire).invokeExact(array, i, "bar", "foo");
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, "bar", "foo");
assertEquals(r, true, "weakCompareAndSetAcquire String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact(array, i);
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, "foo", "weakCompareAndSetAcquire String");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetRelease).invokeExact(array, i, "foo", "bar");
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(array, i, "foo", "bar");
assertEquals(r, true, "weakCompareAndSetRelease String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact(array, i);
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, "bar", "weakCompareAndSetRelease String");
}
// Compare set and get
{
- String o = (String) hs.get(TestAccessMode.getAndSet).invokeExact(array, i, "foo");
+ String o = (String) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, "foo");
assertEquals(o, "bar", "getAndSet String");
- String x = (String) hs.get(TestAccessMode.get).invokeExact(array, i);
+ String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, "foo", "getAndSet String value");
}
@@ -507,7 +507,7 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
final int i = 0;
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkUOE(am, () -> {
String o = (String) hs.get(am).invokeExact(array, i, "foo");
});
@@ -520,31 +520,31 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
for (int i : new int[]{-1, Integer.MIN_VALUE, 10, 11, Integer.MAX_VALUE}) {
final int ci = i;
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
checkIOOBE(am, () -> {
String x = (String) hs.get(am).invokeExact(array, ci);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
checkIOOBE(am, () -> {
hs.get(am).invokeExact(array, ci, "foo");
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
checkIOOBE(am, () -> {
boolean r = (boolean) hs.get(am).invokeExact(array, ci, "foo", "bar");
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkIOOBE(am, () -> {
String r = (String) hs.get(am).invokeExact(array, ci, "bar", "foo");
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkIOOBE(am, () -> {
String o = (String) hs.get(am).invokeExact(array, ci, "foo");
});
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeBoolean.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeBoolean.java
index f0c79ea9f60..75ba7ae3dc2 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeBoolean.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeBoolean.java
@@ -326,7 +326,7 @@ public class VarHandleTestMethodTypeBoolean extends VarHandleBaseTest {
}
static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeBoolean recv, Handles hs) throws Throwable {
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
boolean x = (boolean) hs.get(am, methodType(boolean.class, Void.class)).
@@ -360,7 +360,7 @@ public class VarHandleTestMethodTypeBoolean extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
hs.get(am, methodType(void.class, Void.class, boolean.class)).
@@ -509,7 +509,7 @@ public class VarHandleTestMethodTypeBoolean extends VarHandleBaseTest {
static void testStaticFieldWrongMethodType(Handles hs) throws Throwable {
int i = 0;
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect return type
checkWMTE(() -> { // reference class
Void x = (Void) hs.get(am, methodType(Void.class)).
@@ -526,7 +526,7 @@ public class VarHandleTestMethodTypeBoolean extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, Class.class)).
invoke(Void.class);
@@ -780,7 +780,7 @@ public class VarHandleTestMethodTypeBoolean extends VarHandleBaseTest {
boolean[] array = new boolean[10];
Arrays.fill(array, true);
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null array
boolean x = (boolean) hs.get(am, methodType(boolean.class, Void.class, int.class)).
@@ -818,7 +818,7 @@ public class VarHandleTestMethodTypeBoolean extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null array
hs.get(am, methodType(void.class, Void.class, int.class, boolean.class)).
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeByte.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeByte.java
index 1969c464348..b212bfc9d7d 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeByte.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeByte.java
@@ -326,7 +326,7 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest {
}
static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeByte recv, Handles hs) throws Throwable {
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
byte x = (byte) hs.get(am, methodType(byte.class, Void.class)).
@@ -360,7 +360,7 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
hs.get(am, methodType(void.class, Void.class, byte.class)).
@@ -509,7 +509,7 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest {
static void testStaticFieldWrongMethodType(Handles hs) throws Throwable {
int i = 0;
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect return type
checkWMTE(() -> { // reference class
Void x = (Void) hs.get(am, methodType(Void.class)).
@@ -526,7 +526,7 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, Class.class)).
invoke(Void.class);
@@ -780,7 +780,7 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest {
byte[] array = new byte[10];
Arrays.fill(array, (byte)1);
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null array
byte x = (byte) hs.get(am, methodType(byte.class, Void.class, int.class)).
@@ -818,7 +818,7 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null array
hs.get(am, methodType(void.class, Void.class, int.class, byte.class)).
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeChar.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeChar.java
index 296806255c3..6ac8a0fed70 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeChar.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeChar.java
@@ -326,7 +326,7 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest {
}
static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeChar recv, Handles hs) throws Throwable {
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
char x = (char) hs.get(am, methodType(char.class, Void.class)).
@@ -360,7 +360,7 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
hs.get(am, methodType(void.class, Void.class, char.class)).
@@ -509,7 +509,7 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest {
static void testStaticFieldWrongMethodType(Handles hs) throws Throwable {
int i = 0;
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect return type
checkWMTE(() -> { // reference class
Void x = (Void) hs.get(am, methodType(Void.class)).
@@ -526,7 +526,7 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, Class.class)).
invoke(Void.class);
@@ -780,7 +780,7 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest {
char[] array = new char[10];
Arrays.fill(array, 'a');
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null array
char x = (char) hs.get(am, methodType(char.class, Void.class, int.class)).
@@ -818,7 +818,7 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null array
hs.get(am, methodType(void.class, Void.class, int.class, char.class)).
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeDouble.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeDouble.java
index c09a73c6ddb..e5fc073d191 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeDouble.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeDouble.java
@@ -326,7 +326,7 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest {
}
static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeDouble recv, Handles hs) throws Throwable {
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
double x = (double) hs.get(am, methodType(double.class, Void.class)).
@@ -360,7 +360,7 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
hs.get(am, methodType(void.class, Void.class, double.class)).
@@ -509,7 +509,7 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest {
static void testStaticFieldWrongMethodType(Handles hs) throws Throwable {
int i = 0;
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect return type
checkWMTE(() -> { // reference class
Void x = (Void) hs.get(am, methodType(Void.class)).
@@ -526,7 +526,7 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, Class.class)).
invoke(Void.class);
@@ -780,7 +780,7 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest {
double[] array = new double[10];
Arrays.fill(array, 1.0d);
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null array
double x = (double) hs.get(am, methodType(double.class, Void.class, int.class)).
@@ -818,7 +818,7 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null array
hs.get(am, methodType(void.class, Void.class, int.class, double.class)).
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeFloat.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeFloat.java
index 0ea65921dd4..c1bee039b73 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeFloat.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeFloat.java
@@ -326,7 +326,7 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest {
}
static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeFloat recv, Handles hs) throws Throwable {
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
float x = (float) hs.get(am, methodType(float.class, Void.class)).
@@ -360,7 +360,7 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
hs.get(am, methodType(void.class, Void.class, float.class)).
@@ -509,7 +509,7 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest {
static void testStaticFieldWrongMethodType(Handles hs) throws Throwable {
int i = 0;
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect return type
checkWMTE(() -> { // reference class
Void x = (Void) hs.get(am, methodType(Void.class)).
@@ -526,7 +526,7 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, Class.class)).
invoke(Void.class);
@@ -780,7 +780,7 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest {
float[] array = new float[10];
Arrays.fill(array, 1.0f);
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null array
float x = (float) hs.get(am, methodType(float.class, Void.class, int.class)).
@@ -818,7 +818,7 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null array
hs.get(am, methodType(void.class, Void.class, int.class, float.class)).
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeInt.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeInt.java
index fd8e57d597e..0a41906c4a5 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeInt.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeInt.java
@@ -615,7 +615,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
}
static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeInt recv, Handles hs) throws Throwable {
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
int x = (int) hs.get(am, methodType(int.class, Void.class)).
@@ -649,7 +649,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
hs.get(am, methodType(void.class, Void.class, int.class)).
@@ -678,7 +678,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
boolean r = (boolean) hs.get(am, methodType(boolean.class, Void.class, int.class, int.class)).
@@ -711,7 +711,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkNPE(() -> { // null receiver
int x = (int) hs.get(am, methodType(int.class, Void.class, int.class, int.class)).
invoke(null, 1, 1);
@@ -752,7 +752,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkNPE(() -> { // null receiver
int x = (int) hs.get(am, methodType(int.class, Void.class, int.class)).
invoke(null, 1);
@@ -789,7 +789,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkNPE(() -> { // null receiver
int x = (int) hs.get(am, methodType(int.class, Void.class, int.class)).
invoke(null, 1);
@@ -1143,7 +1143,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
static void testStaticFieldWrongMethodType(Handles hs) throws Throwable {
int i = 0;
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect return type
checkWMTE(() -> { // reference class
Void x = (Void) hs.get(am, methodType(Void.class)).
@@ -1160,7 +1160,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, Class.class)).
invoke(Void.class);
@@ -1175,7 +1175,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
invoke(1, Void.class);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
// Incorrect argument types
checkWMTE(() -> { // expected reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, int.class)).
@@ -1196,7 +1196,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
// Incorrect argument types
checkWMTE(() -> { // expected reference class
int x = (int) hs.get(am, methodType(int.class, Class.class, int.class)).
@@ -1226,7 +1226,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
// Incorrect argument types
checkWMTE(() -> { // value reference class
int x = (int) hs.get(am, methodType(int.class, Class.class)).
@@ -1252,7 +1252,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
// Incorrect argument types
checkWMTE(() -> { // value reference class
int x = (int) hs.get(am, methodType(int.class, Class.class)).
@@ -1834,7 +1834,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
int[] array = new int[10];
Arrays.fill(array, 1);
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null array
int x = (int) hs.get(am, methodType(int.class, Void.class, int.class)).
@@ -1872,7 +1872,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null array
hs.get(am, methodType(void.class, Void.class, int.class, int.class)).
@@ -1904,7 +1904,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
invoke(array, 0, 1, Void.class);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
boolean r = (boolean) hs.get(am, methodType(boolean.class, Void.class, int.class, int.class, int.class)).
@@ -1941,7 +1941,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
int x = (int) hs.get(am, methodType(int.class, Void.class, int.class, int.class, int.class)).
@@ -1987,7 +1987,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
// Incorrect argument types
checkNPE(() -> { // null array
int x = (int) hs.get(am, methodType(int.class, Void.class, int.class, int.class)).
@@ -2029,7 +2029,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
// Incorrect argument types
checkNPE(() -> { // null array
int x = (int) hs.get(am, methodType(int.class, Void.class, int.class, int.class)).
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeLong.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeLong.java
index 91cbcf5f3be..f520a619a20 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeLong.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeLong.java
@@ -615,7 +615,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
}
static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeLong recv, Handles hs) throws Throwable {
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
long x = (long) hs.get(am, methodType(long.class, Void.class)).
@@ -649,7 +649,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
hs.get(am, methodType(void.class, Void.class, long.class)).
@@ -678,7 +678,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
boolean r = (boolean) hs.get(am, methodType(boolean.class, Void.class, long.class, long.class)).
@@ -711,7 +711,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkNPE(() -> { // null receiver
long x = (long) hs.get(am, methodType(long.class, Void.class, long.class, long.class)).
invoke(null, 1L, 1L);
@@ -752,7 +752,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkNPE(() -> { // null receiver
long x = (long) hs.get(am, methodType(long.class, Void.class, long.class)).
invoke(null, 1L);
@@ -789,7 +789,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkNPE(() -> { // null receiver
long x = (long) hs.get(am, methodType(long.class, Void.class, long.class)).
invoke(null, 1L);
@@ -1143,7 +1143,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
static void testStaticFieldWrongMethodType(Handles hs) throws Throwable {
int i = 0;
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect return type
checkWMTE(() -> { // reference class
Void x = (Void) hs.get(am, methodType(Void.class)).
@@ -1160,7 +1160,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, Class.class)).
invoke(Void.class);
@@ -1175,7 +1175,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
invoke(1L, Void.class);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
// Incorrect argument types
checkWMTE(() -> { // expected reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, long.class)).
@@ -1196,7 +1196,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
// Incorrect argument types
checkWMTE(() -> { // expected reference class
long x = (long) hs.get(am, methodType(long.class, Class.class, long.class)).
@@ -1226,7 +1226,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
// Incorrect argument types
checkWMTE(() -> { // value reference class
long x = (long) hs.get(am, methodType(long.class, Class.class)).
@@ -1252,7 +1252,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
// Incorrect argument types
checkWMTE(() -> { // value reference class
long x = (long) hs.get(am, methodType(long.class, Class.class)).
@@ -1834,7 +1834,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
long[] array = new long[10];
Arrays.fill(array, 1L);
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null array
long x = (long) hs.get(am, methodType(long.class, Void.class, int.class)).
@@ -1872,7 +1872,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null array
hs.get(am, methodType(void.class, Void.class, int.class, long.class)).
@@ -1904,7 +1904,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
invoke(array, 0, 1L, Void.class);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
boolean r = (boolean) hs.get(am, methodType(boolean.class, Void.class, int.class, long.class, long.class)).
@@ -1941,7 +1941,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
long x = (long) hs.get(am, methodType(long.class, Void.class, int.class, long.class, long.class)).
@@ -1987,7 +1987,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
// Incorrect argument types
checkNPE(() -> { // null array
long x = (long) hs.get(am, methodType(long.class, Void.class, int.class, long.class)).
@@ -2029,7 +2029,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
// Incorrect argument types
checkNPE(() -> { // null array
long x = (long) hs.get(am, methodType(long.class, Void.class, int.class, long.class)).
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeShort.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeShort.java
index a8059959630..634646e78c1 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeShort.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeShort.java
@@ -326,7 +326,7 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest {
}
static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeShort recv, Handles hs) throws Throwable {
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
short x = (short) hs.get(am, methodType(short.class, Void.class)).
@@ -360,7 +360,7 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
hs.get(am, methodType(void.class, Void.class, short.class)).
@@ -509,7 +509,7 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest {
static void testStaticFieldWrongMethodType(Handles hs) throws Throwable {
int i = 0;
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect return type
checkWMTE(() -> { // reference class
Void x = (Void) hs.get(am, methodType(Void.class)).
@@ -526,7 +526,7 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
checkWMTE(() -> { // value reference class
hs.get(am, methodType(void.class, Class.class)).
invoke(Void.class);
@@ -780,7 +780,7 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest {
short[] array = new short[10];
Arrays.fill(array, (short)1);
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null array
short x = (short) hs.get(am, methodType(short.class, Void.class, int.class)).
@@ -818,7 +818,7 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null array
hs.get(am, methodType(void.class, Void.class, int.class, short.class)).
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeString.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeString.java
index 631fe33466c..674cc10a236 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeString.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeString.java
@@ -557,7 +557,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
}
static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeString recv, Handles hs) throws Throwable {
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
String x = (String) hs.get(am, methodType(String.class, Void.class)).
@@ -591,7 +591,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
hs.get(am, methodType(void.class, Void.class, String.class)).
@@ -620,7 +620,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
boolean r = (boolean) hs.get(am, methodType(boolean.class, Void.class, String.class, String.class)).
@@ -653,7 +653,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkNPE(() -> { // null receiver
String x = (String) hs.get(am, methodType(String.class, Void.class, String.class, String.class)).
invoke(null, "foo", "foo");
@@ -694,7 +694,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkNPE(() -> { // null receiver
String x = (String) hs.get(am, methodType(String.class, Void.class, String.class)).
invoke(null, "foo");
@@ -1009,7 +1009,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
static void testStaticFieldWrongMethodType(Handles hs) throws Throwable {
int i = 0;
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect return type
checkCCE(() -> { // reference class
Void x = (Void) hs.get(am, methodType(Void.class)).
@@ -1026,7 +1026,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
checkCCE(() -> { // value reference class
hs.get(am, methodType(void.class, Class.class)).
invoke(Void.class);
@@ -1041,7 +1041,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
invoke("foo", Void.class);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
// Incorrect argument types
checkCCE(() -> { // expected reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, String.class)).
@@ -1062,7 +1062,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
// Incorrect argument types
checkCCE(() -> { // expected reference class
String x = (String) hs.get(am, methodType(String.class, Class.class, String.class)).
@@ -1092,7 +1092,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
// Incorrect argument types
checkCCE(() -> { // value reference class
String x = (String) hs.get(am, methodType(String.class, Class.class)).
@@ -1611,7 +1611,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
String[] array = new String[10];
Arrays.fill(array, "foo");
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null array
String x = (String) hs.get(am, methodType(String.class, Void.class, int.class)).
@@ -1649,7 +1649,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null array
hs.get(am, methodType(void.class, Void.class, int.class, String.class)).
@@ -1681,7 +1681,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
invoke(array, 0, "foo", Void.class);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
boolean r = (boolean) hs.get(am, methodType(boolean.class, Void.class, int.class, String.class, String.class)).
@@ -1718,7 +1718,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
String x = (String) hs.get(am, methodType(String.class, Void.class, int.class, String.class, String.class)).
@@ -1764,7 +1764,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
// Incorrect argument types
checkNPE(() -> { // null array
String x = (String) hs.get(am, methodType(String.class, Void.class, int.class, String.class)).
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestReflection.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestReflection.java
index e198c68e9a1..652272ca8a8 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestReflection.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestReflection.java
@@ -57,7 +57,7 @@ public class VarHandleTestReflection extends VarHandleBaseTest {
// Try a reflective invoke using a Method
- Method vhm = VarHandle.class.getMethod(accessMode.name(), Object[].class);
+ Method vhm = VarHandle.class.getMethod(accessMode.methodName(), Object[].class);
vhm.invoke(v, new Object[]{});
}
@@ -68,7 +68,7 @@ public class VarHandleTestReflection extends VarHandleBaseTest {
// Try a reflective invoke using a MethodHandle
MethodHandle mh = MethodHandles.lookup().unreflect(
- VarHandle.class.getMethod(accessMode.name(), Object[].class));
+ VarHandle.class.getMethod(accessMode.methodName(), Object[].class));
// Use invoke to avoid WrongMethodTypeException for
// non-signature-polymorphic return types
Object o = (Object) mh.invoke(v, new Object[]{});
@@ -82,7 +82,7 @@ public class VarHandleTestReflection extends VarHandleBaseTest {
// a MethodHandle
MethodHandle mh = MethodHandles.lookup().unreflect(
- VarHandle.class.getMethod(accessMode.name(), Object[].class));
+ VarHandle.class.getMethod(accessMode.methodName(), Object[].class));
MethodHandleInfo info = MethodHandles.lookup().revealDirect(mh);
Method im = info.reflectAs(Method.class, MethodHandles.lookup());
im.invoke(v, new Object[]{});
@@ -105,7 +105,7 @@ public class VarHandleTestReflection extends VarHandleBaseTest {
VarHandle v = handle();
MethodHandle mh = MethodHandles.publicLookup().findVirtual(
- VarHandle.class, accessMode.name(), v.accessModeType(accessMode));
+ VarHandle.class, accessMode.methodName(), v.accessModeType(accessMode));
MethodHandleInfo info = MethodHandles.lookup().revealDirect(mh);
diff --git a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template
index 4372df85478..fb44c8bbb2b 100644
--- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template
+++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template
@@ -90,43 +90,41 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
@Test(dataProvider = "varHandlesProvider")
public void testIsAccessModeSupported(VarHandle vh) {
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.get));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.set));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getOpaque));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setOpaque));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
#if[CAS]
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
#else[CAS]
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
#end[CAS]
#if[AtomicAdd]
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
#else[AtomicAdd]
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
#end[AtomicAdd]
}
diff --git a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template
index ab9dac228d1..1c323e2f195 100644
--- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template
+++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template
@@ -76,44 +76,42 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
public void testIsAccessModeSupported(VarHandleSource vhs) {
VarHandle vh = vhs.s;
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.get));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.set));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getOpaque));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.setOpaque));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
#if[CAS]
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
#else[CAS]
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndSet));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeVolatile));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeAcquire));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.compareAndExchangeRelease));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSet));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetAcquire));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.weakCompareAndSetRelease));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndSet));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
#end[CAS]
#if[AtomicAdd]
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
+ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
#else[AtomicAdd]
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.getAndAdd));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.addAndGet));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
+ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET));
#end[AtomicAdd]
}
diff --git a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template
index f28ab09da3d..8e40761a4f3 100644
--- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template
+++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template
@@ -121,131 +121,131 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
static void testInstanceField(VarHandleTestMethodHandleAccess$Type$ recv, Handles hs) throws Throwable {
// Plain
{
- hs.get(TestAccessMode.set).invokeExact(recv, $value1$);
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(recv);
+ hs.get(TestAccessMode.SET).invokeExact(recv, $value1$);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, $value1$, "set $type$ value");
}
// Volatile
{
- hs.get(TestAccessMode.setVolatile).invokeExact(recv, $value2$);
- $type$ x = ($type$) hs.get(TestAccessMode.getVolatile).invokeExact(recv);
+ hs.get(TestAccessMode.SET_VOLATILE).invokeExact(recv, $value2$);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(recv);
assertEquals(x, $value2$, "setVolatile $type$ value");
}
// Lazy
{
- hs.get(TestAccessMode.setRelease).invokeExact(recv, $value1$);
- $type$ x = ($type$) hs.get(TestAccessMode.getAcquire).invokeExact(recv);
+ hs.get(TestAccessMode.SET_RELEASE).invokeExact(recv, $value1$);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(recv);
assertEquals(x, $value1$, "setRelease $type$ value");
}
// Opaque
{
- hs.get(TestAccessMode.setOpaque).invokeExact(recv, $value2$);
- $type$ x = ($type$) hs.get(TestAccessMode.getOpaque).invokeExact(recv);
+ hs.get(TestAccessMode.SET_OPAQUE).invokeExact(recv, $value2$);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(recv);
assertEquals(x, $value2$, "setOpaque $type$ value");
}
#if[CAS]
- hs.get(TestAccessMode.set).invokeExact(recv, $value1$);
+ hs.get(TestAccessMode.SET).invokeExact(recv, $value1$);
// Compare
{
- boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(recv, $value1$, $value2$);
+ boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, $value1$, $value2$);
assertEquals(r, true, "success compareAndSet $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(recv);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, $value2$, "success compareAndSet $type$ value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(recv, $value1$, $value3$);
+ boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, $value1$, $value3$);
assertEquals(r, false, "failing compareAndSet $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(recv);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, $value2$, "failing compareAndSet $type$ value");
}
{
- $type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(recv, $value2$, $value1$);
+ $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(recv, $value2$, $value1$);
assertEquals(r, $value2$, "success compareAndExchangeVolatile $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(recv);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, $value1$, "success compareAndExchangeVolatile $type$ value");
}
{
- $type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(recv, $value2$, $value3$);
+ $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(recv, $value2$, $value3$);
assertEquals(r, $value1$, "failing compareAndExchangeVolatile $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(recv);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, $value1$, "failing compareAndExchangeVolatile $type$ value");
}
{
- $type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(recv, $value1$, $value2$);
+ $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, $value1$, $value2$);
assertEquals(r, $value1$, "success compareAndExchangeAcquire $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(recv);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, $value2$, "success compareAndExchangeAcquire $type$ value");
}
{
- $type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(recv, $value1$, $value3$);
+ $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, $value1$, $value3$);
assertEquals(r, $value2$, "failing compareAndExchangeAcquire $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(recv);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, $value2$, "failing compareAndExchangeAcquire $type$ value");
}
{
- $type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(recv, $value2$, $value1$);
+ $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, $value2$, $value1$);
assertEquals(r, $value2$, "success compareAndExchangeRelease $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(recv);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, $value1$, "success compareAndExchangeRelease $type$ value");
}
{
- $type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(recv, $value2$, $value3$);
+ $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, $value2$, $value3$);
assertEquals(r, $value1$, "failing compareAndExchangeRelease $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(recv);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, $value1$, "failing compareAndExchangeRelease $type$ value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSet).invokeExact(recv, $value1$, $value2$);
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, $value1$, $value2$);
assertEquals(r, true, "weakCompareAndSet $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(recv);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, $value2$, "weakCompareAndSet $type$ value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetAcquire).invokeExact(recv, $value2$, $value1$);
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, $value2$, $value1$);
assertEquals(r, true, "weakCompareAndSetAcquire $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(recv);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, $value1$, "weakCompareAndSetAcquire $type$");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetRelease).invokeExact(recv, $value1$, $value2$);
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, $value1$, $value2$);
assertEquals(r, true, "weakCompareAndSetRelease $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(recv);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, $value2$, "weakCompareAndSetRelease $type$");
}
// Compare set and get
{
- $type$ o = ($type$) hs.get(TestAccessMode.getAndSet).invokeExact(recv, $value1$);
+ $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET).invokeExact(recv, $value1$);
assertEquals(o, $value2$, "getAndSet $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(recv);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, $value1$, "getAndSet $type$ value");
}
#end[CAS]
#if[AtomicAdd]
- hs.get(TestAccessMode.set).invokeExact(recv, $value1$);
+ hs.get(TestAccessMode.SET).invokeExact(recv, $value1$);
// get and add, add and get
{
- $type$ o = ($type$) hs.get(TestAccessMode.getAndAdd).invokeExact(recv, $value3$);
+ $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, $value3$);
assertEquals(o, $value1$, "getAndAdd $type$");
- $type$ c = ($type$) hs.get(TestAccessMode.addAndGet).invokeExact(recv, $value3$);
+ $type$ c = ($type$) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(recv, $value3$);
assertEquals(c, $value1$ + $value3$ + $value3$, "getAndAdd $type$ value");
}
#end[AtomicAdd]
@@ -253,19 +253,19 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccess$Type$ recv, Handles hs) throws Throwable {
#if[!CAS]
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
checkUOE(am, () -> {
boolean r = (boolean) hs.get(am).invokeExact(recv, $value1$, $value2$);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkUOE(am, () -> {
$type$ r = ($type$) hs.get(am).invokeExact(recv, $value1$, $value2$);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkUOE(am, () -> {
$type$ r = ($type$) hs.get(am).invokeExact(recv, $value1$);
});
@@ -273,7 +273,7 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
#end[CAS]
#if[!AtomicAdd]
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkUOE(am, () -> {
$type$ r = ($type$) hs.get(am).invokeExact(recv, $value1$);
});
@@ -285,131 +285,131 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
static void testStaticField(Handles hs) throws Throwable {
// Plain
{
- hs.get(TestAccessMode.set).invokeExact($value1$);
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact();
+ hs.get(TestAccessMode.SET).invokeExact($value1$);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, $value1$, "set $type$ value");
}
// Volatile
{
- hs.get(TestAccessMode.setVolatile).invokeExact($value2$);
- $type$ x = ($type$) hs.get(TestAccessMode.getVolatile).invokeExact();
+ hs.get(TestAccessMode.SET_VOLATILE).invokeExact($value2$);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET_VOLATILE).invokeExact();
assertEquals(x, $value2$, "setVolatile $type$ value");
}
// Lazy
{
- hs.get(TestAccessMode.setRelease).invokeExact($value1$);
- $type$ x = ($type$) hs.get(TestAccessMode.getAcquire).invokeExact();
+ hs.get(TestAccessMode.SET_RELEASE).invokeExact($value1$);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact();
assertEquals(x, $value1$, "setRelease $type$ value");
}
// Opaque
{
- hs.get(TestAccessMode.setOpaque).invokeExact($value2$);
- $type$ x = ($type$) hs.get(TestAccessMode.getOpaque).invokeExact();
+ hs.get(TestAccessMode.SET_OPAQUE).invokeExact($value2$);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET_OPAQUE).invokeExact();
assertEquals(x, $value2$, "setOpaque $type$ value");
}
#if[CAS]
- hs.get(TestAccessMode.set).invokeExact($value1$);
+ hs.get(TestAccessMode.SET).invokeExact($value1$);
// Compare
{
- boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact($value1$, $value2$);
+ boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact($value1$, $value2$);
assertEquals(r, true, "success compareAndSet $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact();
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, $value2$, "success compareAndSet $type$ value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact($value1$, $value3$);
+ boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact($value1$, $value3$);
assertEquals(r, false, "failing compareAndSet $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact();
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, $value2$, "failing compareAndSet $type$ value");
}
{
- $type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact($value2$, $value1$);
+ $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact($value2$, $value1$);
assertEquals(r, $value2$, "success compareAndExchangeVolatile $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact();
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, $value1$, "success compareAndExchangeVolatile $type$ value");
}
{
- $type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact($value2$, $value3$);
+ $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact($value2$, $value3$);
assertEquals(r, $value1$, "failing compareAndExchangeVolatile $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact();
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, $value1$, "failing compareAndExchangeVolatile $type$ value");
}
{
- $type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact($value1$, $value2$);
+ $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact($value1$, $value2$);
assertEquals(r, $value1$, "success compareAndExchangeAcquire $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact();
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, $value2$, "success compareAndExchangeAcquire $type$ value");
}
{
- $type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact($value1$, $value3$);
+ $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact($value1$, $value3$);
assertEquals(r, $value2$, "failing compareAndExchangeAcquire $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact();
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, $value2$, "failing compareAndExchangeAcquire $type$ value");
}
{
- $type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact($value2$, $value1$);
+ $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact($value2$, $value1$);
assertEquals(r, $value2$, "success compareAndExchangeRelease $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact();
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, $value1$, "success compareAndExchangeRelease $type$ value");
}
{
- $type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact($value2$, $value3$);
+ $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact($value2$, $value3$);
assertEquals(r, $value1$, "failing compareAndExchangeRelease $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact();
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, $value1$, "failing compareAndExchangeRelease $type$ value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSet).invokeExact($value1$, $value2$);
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact($value1$, $value2$);
assertEquals(r, true, "weakCompareAndSet $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact();
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, $value2$, "weakCompareAndSet $type$ value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetAcquire).invokeExact($value2$, $value1$);
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact($value2$, $value1$);
assertEquals(r, true, "weakCompareAndSetAcquire $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact();
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, $value1$, "weakCompareAndSetAcquire $type$");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetRelease).invokeExact( $value1$, $value2$);
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact( $value1$, $value2$);
assertEquals(r, true, "weakCompareAndSetRelease $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact();
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, $value2$, "weakCompareAndSetRelease $type$");
}
// Compare set and get
{
- $type$ o = ($type$) hs.get(TestAccessMode.getAndSet).invokeExact( $value1$);
+ $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET).invokeExact( $value1$);
assertEquals(o, $value2$, "getAndSet $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact();
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, $value1$, "getAndSet $type$ value");
}
#end[CAS]
#if[AtomicAdd]
- hs.get(TestAccessMode.set).invokeExact($value1$);
+ hs.get(TestAccessMode.SET).invokeExact($value1$);
// get and add, add and get
{
- $type$ o = ($type$) hs.get(TestAccessMode.getAndAdd).invokeExact( $value3$);
+ $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD).invokeExact( $value3$);
assertEquals(o, $value1$, "getAndAdd $type$");
- $type$ c = ($type$) hs.get(TestAccessMode.addAndGet).invokeExact($value3$);
+ $type$ c = ($type$) hs.get(TestAccessMode.ADD_AND_GET).invokeExact($value3$);
assertEquals(c, $value1$ + $value3$ + $value3$, "getAndAdd $type$ value");
}
#end[AtomicAdd]
@@ -417,19 +417,19 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
static void testStaticFieldUnsupported(Handles hs) throws Throwable {
#if[!CAS]
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
checkUOE(am, () -> {
boolean r = (boolean) hs.get(am).invokeExact($value1$, $value2$);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkUOE(am, () -> {
$type$ r = ($type$) hs.get(am).invokeExact($value1$, $value2$);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkUOE(am, () -> {
$type$ r = ($type$) hs.get(am).invokeExact($value1$);
});
@@ -437,7 +437,7 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
#end[CAS]
#if[!AtomicAdd]
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkUOE(am, () -> {
$type$ r = ($type$) hs.get(am).invokeExact($value1$);
});
@@ -452,131 +452,131 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
for (int i = 0; i < array.length; i++) {
// Plain
{
- hs.get(TestAccessMode.set).invokeExact(array, i, $value1$);
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(array, i);
+ hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, $value1$, "get $type$ value");
}
// Volatile
{
- hs.get(TestAccessMode.setVolatile).invokeExact(array, i, $value2$);
- $type$ x = ($type$) hs.get(TestAccessMode.getVolatile).invokeExact(array, i);
+ hs.get(TestAccessMode.SET_VOLATILE).invokeExact(array, i, $value2$);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(array, i);
assertEquals(x, $value2$, "setVolatile $type$ value");
}
// Lazy
{
- hs.get(TestAccessMode.setRelease).invokeExact(array, i, $value1$);
- $type$ x = ($type$) hs.get(TestAccessMode.getAcquire).invokeExact(array, i);
+ hs.get(TestAccessMode.SET_RELEASE).invokeExact(array, i, $value1$);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(array, i);
assertEquals(x, $value1$, "setRelease $type$ value");
}
// Opaque
{
- hs.get(TestAccessMode.setOpaque).invokeExact(array, i, $value2$);
- $type$ x = ($type$) hs.get(TestAccessMode.getOpaque).invokeExact(array, i);
+ hs.get(TestAccessMode.SET_OPAQUE).invokeExact(array, i, $value2$);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(array, i);
assertEquals(x, $value2$, "setOpaque $type$ value");
}
#if[CAS]
- hs.get(TestAccessMode.set).invokeExact(array, i, $value1$);
+ hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
// Compare
{
- boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(array, i, $value1$, $value2$);
+ boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, $value1$, $value2$);
assertEquals(r, true, "success compareAndSet $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(array, i);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, $value2$, "success compareAndSet $type$ value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.compareAndSet).invokeExact(array, i, $value1$, $value3$);
+ boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, $value1$, $value3$);
assertEquals(r, false, "failing compareAndSet $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(array, i);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, $value2$, "failing compareAndSet $type$ value");
}
{
- $type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(array, i, $value2$, $value1$);
+ $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(array, i, $value2$, $value1$);
assertEquals(r, $value2$, "success compareAndExchangeVolatile $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(array, i);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, $value1$, "success compareAndExchangeVolatile $type$ value");
}
{
- $type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeVolatile).invokeExact(array, i, $value2$, $value3$);
+ $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_VOLATILE).invokeExact(array, i, $value2$, $value3$);
assertEquals(r, $value1$, "failing compareAndExchangeVolatile $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(array, i);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, $value1$, "failing compareAndExchangeVolatile $type$ value");
}
{
- $type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(array, i, $value1$, $value2$);
+ $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, $value1$, $value2$);
assertEquals(r, $value1$, "success compareAndExchangeAcquire $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(array, i);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, $value2$, "success compareAndExchangeAcquire $type$ value");
}
{
- $type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeAcquire).invokeExact(array, i, $value1$, $value3$);
+ $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, $value1$, $value3$);
assertEquals(r, $value2$, "failing compareAndExchangeAcquire $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(array, i);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, $value2$, "failing compareAndExchangeAcquire $type$ value");
}
{
- $type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(array, i, $value2$, $value1$);
+ $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, $value2$, $value1$);
assertEquals(r, $value2$, "success compareAndExchangeRelease $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(array, i);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, $value1$, "success compareAndExchangeRelease $type$ value");
}
{
- $type$ r = ($type$) hs.get(TestAccessMode.compareAndExchangeRelease).invokeExact(array, i, $value2$, $value3$);
+ $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, $value2$, $value3$);
assertEquals(r, $value1$, "failing compareAndExchangeRelease $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(array, i);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, $value1$, "failing compareAndExchangeRelease $type$ value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSet).invokeExact(array, i, $value1$, $value2$);
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, $value1$, $value2$);
assertEquals(r, true, "weakCompareAndSet $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(array, i);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, $value2$, "weakCompareAndSet $type$ value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetAcquire).invokeExact(array, i, $value2$, $value1$);
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, $value2$, $value1$);
assertEquals(r, true, "weakCompareAndSetAcquire $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(array, i);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, $value1$, "weakCompareAndSetAcquire $type$");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.weakCompareAndSetRelease).invokeExact(array, i, $value1$, $value2$);
+ boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(array, i, $value1$, $value2$);
assertEquals(r, true, "weakCompareAndSetRelease $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(array, i);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, $value2$, "weakCompareAndSetRelease $type$");
}
// Compare set and get
{
- $type$ o = ($type$) hs.get(TestAccessMode.getAndSet).invokeExact(array, i, $value1$);
+ $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, $value1$);
assertEquals(o, $value2$, "getAndSet $type$");
- $type$ x = ($type$) hs.get(TestAccessMode.get).invokeExact(array, i);
+ $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, $value1$, "getAndSet $type$ value");
}
#end[CAS]
#if[AtomicAdd]
- hs.get(TestAccessMode.set).invokeExact(array, i, $value1$);
+ hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
// get and add, add and get
{
- $type$ o = ($type$) hs.get(TestAccessMode.getAndAdd).invokeExact(array, i, $value3$);
+ $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, $value3$);
assertEquals(o, $value1$, "getAndAdd $type$");
- $type$ c = ($type$) hs.get(TestAccessMode.addAndGet).invokeExact(array, i, $value3$);
+ $type$ c = ($type$) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(array, i, $value3$);
assertEquals(c, $value1$ + $value3$ + $value3$, "getAndAdd $type$ value");
}
#end[AtomicAdd]
@@ -588,19 +588,19 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
final int i = 0;
#if[!CAS]
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
checkUOE(am, () -> {
boolean r = (boolean) hs.get(am).invokeExact(array, i, $value1$, $value2$);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkUOE(am, () -> {
$type$ r = ($type$) hs.get(am).invokeExact(array, i, $value1$, $value2$);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkUOE(am, () -> {
$type$ r = ($type$) hs.get(am).invokeExact(array, i, $value1$);
});
@@ -608,7 +608,7 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
#end[CAS]
#if[!AtomicAdd]
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkUOE(am, () -> {
$type$ o = ($type$) hs.get(am).invokeExact(array, i, $value1$);
});
@@ -622,32 +622,32 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
for (int i : new int[]{-1, Integer.MIN_VALUE, 10, 11, Integer.MAX_VALUE}) {
final int ci = i;
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
checkIOOBE(am, () -> {
$type$ x = ($type$) hs.get(am).invokeExact(array, ci);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
checkIOOBE(am, () -> {
hs.get(am).invokeExact(array, ci, $value1$);
});
}
#if[CAS]
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
checkIOOBE(am, () -> {
boolean r = (boolean) hs.get(am).invokeExact(array, ci, $value1$, $value2$);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkIOOBE(am, () -> {
$type$ r = ($type$) hs.get(am).invokeExact(array, ci, $value2$, $value1$);
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkIOOBE(am, () -> {
$type$ o = ($type$) hs.get(am).invokeExact(array, ci, $value1$);
});
@@ -655,7 +655,7 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
#end[CAS]
#if[AtomicAdd]
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkIOOBE(am, () -> {
$type$ o = ($type$) hs.get(am).invokeExact(array, ci, $value3$);
});
diff --git a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodType.java.template b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodType.java.template
index 85010bc5c5a..98e4698c4e4 100644
--- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodType.java.template
+++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodType.java.template
@@ -619,7 +619,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
}
static void testInstanceFieldWrongMethodType(VarHandleTestMethodType$Type$ recv, Handles hs) throws Throwable {
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
$type$ x = ($type$) hs.get(am, methodType($type$.class, Void.class)).
@@ -653,7 +653,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
hs.get(am, methodType(void.class, Void.class, $type$.class)).
@@ -683,7 +683,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
}
#if[CAS]
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
boolean r = (boolean) hs.get(am, methodType(boolean.class, Void.class, $type$.class, $type$.class)).
@@ -716,7 +716,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
checkNPE(() -> { // null receiver
$type$ x = ($type$) hs.get(am, methodType($type$.class, Void.class, $type$.class, $type$.class)).
invoke(null, $value1$, $value1$);
@@ -757,7 +757,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
checkNPE(() -> { // null receiver
$type$ x = ($type$) hs.get(am, methodType($type$.class, Void.class, $type$.class)).
invoke(null, $value1$);
@@ -796,7 +796,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
#end[CAS]
#if[AtomicAdd]
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
checkNPE(() -> { // null receiver
$type$ x = ($type$) hs.get(am, methodType($type$.class, Void.class, $type$.class)).
invoke(null, $value1$);
@@ -1155,7 +1155,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
static void testStaticFieldWrongMethodType(Handles hs) throws Throwable {
int i = 0;
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect return type
check{#if[String]?CCE:WMTE}(() -> { // reference class
Void x = (Void) hs.get(am, methodType(Void.class)).
@@ -1172,7 +1172,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
check{#if[String]?CCE:WMTE}(() -> { // value reference class
hs.get(am, methodType(void.class, Class.class)).
invoke(Void.class);
@@ -1188,7 +1188,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
});
}
#if[CAS]
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
// Incorrect argument types
check{#if[String]?CCE:WMTE}(() -> { // expected reference class
boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, $type$.class)).
@@ -1209,7 +1209,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
// Incorrect argument types
check{#if[String]?CCE:WMTE}(() -> { // expected reference class
$type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, $type$.class)).
@@ -1239,7 +1239,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
// Incorrect argument types
check{#if[String]?CCE:WMTE}(() -> { // value reference class
$type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class)).
@@ -1267,7 +1267,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
#end[CAS]
#if[AtomicAdd]
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
// Incorrect argument types
check{#if[String]?CCE:WMTE}(() -> { // value reference class
$type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class)).
@@ -1854,7 +1854,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
$type$[] array = new $type$[10];
Arrays.fill(array, $value1$);
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.get)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) {
// Incorrect argument types
checkNPE(() -> { // null array
$type$ x = ($type$) hs.get(am, methodType($type$.class, Void.class, int.class)).
@@ -1892,7 +1892,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.set)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) {
// Incorrect argument types
checkNPE(() -> { // null array
hs.get(am, methodType(void.class, Void.class, int.class, $type$.class)).
@@ -1925,7 +1925,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
});
}
#if[CAS]
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
boolean r = (boolean) hs.get(am, methodType(boolean.class, Void.class, int.class, $type$.class, $type$.class)).
@@ -1962,7 +1962,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.compareAndExchange)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
// Incorrect argument types
checkNPE(() -> { // null receiver
$type$ x = ($type$) hs.get(am, methodType($type$.class, Void.class, int.class, $type$.class, $type$.class)).
@@ -2008,7 +2008,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
});
}
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndSet)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) {
// Incorrect argument types
checkNPE(() -> { // null array
$type$ x = ($type$) hs.get(am, methodType($type$.class, Void.class, int.class, $type$.class)).
@@ -2052,7 +2052,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
#end[CAS]
#if[AtomicAdd]
- for (TestAccessMode am : testAccessModesOfType(TestAccessType.getAndAdd)) {
+ for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) {
// Incorrect argument types
checkNPE(() -> { // null array
$type$ x = ($type$) hs.get(am, methodType($type$.class, Void.class, int.class, $type$.class)).
From e10605459a73f3d02df206fb3a7bf5059840e550 Mon Sep 17 00:00:00 2001
From: Paul Sandoz
Date: Wed, 13 Apr 2016 15:05:49 +0200
Subject: [PATCH 31/44] 8151198: VarHandle factory-specific exceptions
Reviewed-by: shade
---
.../classes/java/lang/invoke/VarHandle.java | 65 +++++++++++++++----
1 file changed, 54 insertions(+), 11 deletions(-)
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java b/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java
index 4186659c1b9..ec7a8c1a327 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java
@@ -154,7 +154,9 @@ import static java.lang.invoke.MethodHandleStatics.newInternalError;
* 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}.
@@ -168,7 +170,7 @@ import static java.lang.invoke.MethodHandleStatics.newInternalError;
* 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.
*
*
Access modes will override any memory ordering effects specified at
* the declaration site of a variable. For example, a VarHandle accessing a
@@ -467,6 +469,8 @@ public abstract class VarHandle {
* , 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
@@ -491,6 +495,8 @@ public abstract class VarHandle {
* 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
@@ -520,6 +526,8 @@ public abstract class VarHandle {
* 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
@@ -536,6 +544,10 @@ public abstract class VarHandle {
* 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.
@@ -543,9 +555,8 @@ public abstract class VarHandle {
* 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
@@ -573,6 +584,8 @@ public abstract class VarHandle {
* 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
@@ -597,6 +610,8 @@ public abstract class VarHandle {
* 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
@@ -616,6 +631,11 @@ public abstract class VarHandle {
* 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.
@@ -626,9 +646,8 @@ public abstract class VarHandle {
* 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
@@ -645,6 +664,11 @@ public abstract class VarHandle {
* 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.
@@ -652,9 +676,8 @@ public abstract class VarHandle {
* 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
@@ -687,6 +710,8 @@ public abstract class VarHandle {
* 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...)
*/
@@ -720,6 +745,8 @@ public abstract class VarHandle {
* 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...)
*/
@@ -753,6 +780,8 @@ public abstract class VarHandle {
* 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...)
*/
@@ -785,6 +814,8 @@ public abstract class VarHandle {
* 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...)
*/
@@ -822,6 +853,8 @@ public abstract class VarHandle {
* 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...)
*/
@@ -857,6 +890,8 @@ public abstract class VarHandle {
* 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...)
*/
@@ -892,6 +927,8 @@ public abstract class VarHandle {
* 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...)
*/
@@ -922,6 +959,8 @@ public abstract class VarHandle {
* 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...)
*/
@@ -956,6 +995,8 @@ public abstract class VarHandle {
* 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...)
*/
@@ -986,6 +1027,8 @@ public abstract class VarHandle {
* 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...)
*/
From 87c6cee72e833bc7b63e1234d7dcaac6327582d8 Mon Sep 17 00:00:00 2001
From: Paul Sandoz
Date: Wed, 13 Apr 2016 15:05:50 +0200
Subject: [PATCH 32/44] 8146458: Improve exception reporting for
Objects.checkIndex/checkFromToIndex/checkFromIndexSize
Reviewed-by: jrose, smarks
---
.../lang/ArrayIndexOutOfBoundsException.java | 16 -
.../java/lang/IndexOutOfBoundsException.java | 17 -
.../lang/StringIndexOutOfBoundsException.java | 16 -
.../classes/java/lang/invoke/VarHandle.java | 16 +-
.../share/classes/java/util/Objects.java | 354 +++++++++++++-----
jdk/test/java/util/Objects/CheckIndex.java | 137 +++++--
6 files changed, 373 insertions(+), 183 deletions(-)
diff --git a/jdk/src/java.base/share/classes/java/lang/ArrayIndexOutOfBoundsException.java b/jdk/src/java.base/share/classes/java/lang/ArrayIndexOutOfBoundsException.java
index 5b896ab79b8..6b1507629f2 100644
--- a/jdk/src/java.base/share/classes/java/lang/ArrayIndexOutOfBoundsException.java
+++ b/jdk/src/java.base/share/classes/java/lang/ArrayIndexOutOfBoundsException.java
@@ -64,20 +64,4 @@ public class ArrayIndexOutOfBoundsException extends IndexOutOfBoundsException {
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.
- *
- *
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);
- }
}
diff --git a/jdk/src/java.base/share/classes/java/lang/IndexOutOfBoundsException.java b/jdk/src/java.base/share/classes/java/lang/IndexOutOfBoundsException.java
index a328a7bacfd..4da92e1077b 100644
--- a/jdk/src/java.base/share/classes/java/lang/IndexOutOfBoundsException.java
+++ b/jdk/src/java.base/share/classes/java/lang/IndexOutOfBoundsException.java
@@ -67,21 +67,4 @@ public class IndexOutOfBoundsException extends RuntimeException {
public IndexOutOfBoundsException(int index) {
super("Index out of range: " + index);
}
-
- /**
- * Constructs an {@code IndexOutOfBoundsException} with arguments indicating
- * two out of bound values.
- *
- *
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);
- }
-
}
diff --git a/jdk/src/java.base/share/classes/java/lang/StringIndexOutOfBoundsException.java b/jdk/src/java.base/share/classes/java/lang/StringIndexOutOfBoundsException.java
index d4cb333f98a..3a160016647 100644
--- a/jdk/src/java.base/share/classes/java/lang/StringIndexOutOfBoundsException.java
+++ b/jdk/src/java.base/share/classes/java/lang/StringIndexOutOfBoundsException.java
@@ -67,20 +67,4 @@ public class StringIndexOutOfBoundsException extends IndexOutOfBoundsException {
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.
- *
- *
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);
- }
}
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java b/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java
index ec7a8c1a327..cf869b3ebe7 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java
@@ -34,7 +34,9 @@ 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;
@@ -1377,12 +1379,14 @@ public abstract class VarHandle {
UNSAFE.fullFence();
}
- static final BiFunction AIOOBE_SUPPLIER = new BiFunction<>() {
- @Override
- public ArrayIndexOutOfBoundsException apply(Integer a, Integer b) {
- return new ArrayIndexOutOfBoundsException(a, b);
- }
- };
+ static final BiFunction, ArrayIndexOutOfBoundsException>
+ AIOOBE_SUPPLIER = Objects.outOfBoundsExceptionFormatter(
+ new Function() {
+ @Override
+ public ArrayIndexOutOfBoundsException apply(String s) {
+ return new ArrayIndexOutOfBoundsException(s);
+ }
+ });
private static final long VFORM_OFFSET;
diff --git a/jdk/src/java.base/share/classes/java/util/Objects.java b/jdk/src/java.base/share/classes/java/util/Objects.java
index 567870e2498..28b39d08969 100644
--- a/jdk/src/java.base/share/classes/java/util/Objects.java
+++ b/jdk/src/java.base/share/classes/java/util/Objects.java
@@ -25,26 +25,28 @@
package java.util;
-import java.util.function.BiFunction;
-import java.util.function.Supplier;
import jdk.internal.HotSpotIntrinsicCandidate;
+import java.util.function.BiFunction;
+import java.util.function.Function;
+import java.util.function.Supplier;
+
/**
* 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 @@ public final class Objects {
}
/**
- * 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 oobe) {
- RuntimeException e = oobe == null
- ? null : oobe.apply(a, b);
+ BiFunction, ? extends RuntimeException> oobef,
+ String checkKind,
+ Integer... args) {
+ List 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, ? extends RuntimeException> oobe,
+ int index, int length) {
+ return outOfBounds(oobe, "checkIndex", index, length);
+ }
+
+ private static RuntimeException outOfBoundsCheckFromToIndex(
+ BiFunction, ? extends RuntimeException> oobe,
+ int fromIndex, int toIndex, int length) {
+ return outOfBounds(oobe, "checkFromToIndex", fromIndex, toIndex, length);
+ }
+
+ private static RuntimeException outOfBoundsCheckFromIndexSize(
+ BiFunction, ? 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.
+ *
+ *
The exception formatter accepts two arguments: a {@code String}
+ * describing the out-of-bounds range check that failed, referred to as the
+ * check kind; and a {@code List} containing the
+ * out-of-bound integer values that failed the check. The list of
+ * out-of-bound values is not modified.
+ *
+ *
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).
+ *
+ *
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:
+ *
+ * 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}:
+ *
+ * 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:
+ *
+ *
+ * @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 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
+ BiFunction, X> outOfBoundsExceptionFormatter(Function f) {
+ // Use anonymous class to avoid bootstrap issues if this method is
+ // used early in startup
+ return new BiFunction, X>() {
+ @Override
+ public X apply(String checkKind, List args) {
+ return f.apply(outOfBoundsMessage(checkKind, args));
+ }
+ };
+ }
+
+ private static String outOfBoundsMessage(String checkKind, List 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, %The {@code index} is defined to be out of bounds if any of the
+ *
The {@code index} is defined to be out-of-bounds if any of the
* following inequalities is true:
*
*
{@code index < 0}
@@ -377,14 +526,20 @@ public final class Objects {
*
{@code length < 0}, which is implied from the former inequalities
*
*
+ *
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 @@ public final class Objects {
* Checks if the {@code index} is within the bounds of the range from
* {@code 0} (inclusive) to {@code length} (exclusive).
*
- *
The {@code index} is defined to be out of bounds if any of the
+ *
The {@code index} is defined to be out-of-bounds if any of the
* following inequalities is true:
*
*
{@code index < 0}
@@ -400,40 +555,42 @@ public final class Objects {
*
{@code length < 0}, which is implied from the former inequalities
*
*
- *
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.
+ *
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 the type of runtime exception to throw if the arguments are
- * out of bounds
+ * @param 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
+ public static
int checkIndex(int index, int length,
- BiFunction oobe) throws T, IndexOutOfBoundsException {
+ BiFunction, X> oobef) {
if (index < 0 || index >= length)
- throw outOfBounds(index, length, oobe);
+ throw outOfBoundsCheckIndex(oobef, index, length);
return index;
}
@@ -442,7 +599,7 @@ public final class Objects {
* {@code toIndex} (exclusive) is within the bounds of range from {@code 0}
* (inclusive) to {@code length} (exclusive).
*
- *
The sub-range is defined to be out of bounds if any of the following
+ *
The sub-range is defined to be out-of-bounds if any of the following
* inequalities is true:
*
*
{@code fromIndex < 0}
@@ -451,15 +608,21 @@ public final class Objects {
*
{@code length < 0}, which is implied from the former inequalities
*
*
+ *
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 @@ public final class Objects {
* {@code toIndex} (exclusive) is within the bounds of range from {@code 0}
* (inclusive) to {@code length} (exclusive).
*
- *
The sub-range is defined to be out of bounds if any of the following
+ *
The sub-range is defined to be out-of-bounds if any of the following
* inequalities is true:
*
*
{@code fromIndex < 0}
@@ -477,34 +640,36 @@ public final class Objects {
*
{@code length < 0}, which is implied from the former inequalities
*
*
- *
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.
+ *
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 the type of runtime exception to throw if the arguments are
- * out of bounds
+ * @param 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
+ public static
int checkFromToIndex(int fromIndex, int toIndex, int length,
- BiFunction oobe) throws T, IndexOutOfBoundsException {
+ BiFunction, 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 @@ public final class Objects {
* {@code fromIndex + size} (exclusive) is within the bounds of range from
* {@code 0} (inclusive) to {@code length} (exclusive).
*
- *
The sub-range is defined to be out of bounds if any of the following
+ *
The sub-range is defined to be out-of-bounds if any of the following
* inequalities is true:
*
*
{@code fromIndex < 0}
@@ -522,15 +687,21 @@ public final class Objects {
*
{@code length < 0}, which is implied from the former inequalities
*
*
+ *
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 @@ public final class Objects {
* {@code fromIndex + size} (exclusive) is within the bounds of range from
* {@code 0} (inclusive) to {@code length} (exclusive).
*
- *
The sub-range is defined to be out of bounds if any of the following
+ *
The sub-range is defined to be out-of-bounds if any of the following
* inequalities is true:
*
*
{@code fromIndex < 0}
@@ -548,34 +719,37 @@ public final class Objects {
*
{@code length < 0}, which is implied from the former inequalities
*
*
- *
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.
+ *
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 the type of runtime exception to throw if the arguments are
- * out of bounds
+ * @param 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
+ public static
int checkFromIndexSize(int fromIndex, int size, int length,
- BiFunction oobe) throws T, IndexOutOfBoundsException {
+ BiFunction, X> oobef) {
if ((length | fromIndex | size) < 0 || size > length - fromIndex)
- throw outOfBounds(fromIndex, size, oobe);
+ throw outOfBoundsCheckFromIndexSize(oobef, fromIndex, size, length);
return fromIndex;
}
}
diff --git a/jdk/test/java/util/Objects/CheckIndex.java b/jdk/test/java/util/Objects/CheckIndex.java
index d809bf4fe50..c4efdb1c253 100644
--- a/jdk/test/java/util/Objects/CheckIndex.java
+++ b/jdk/test/java/util/Objects/CheckIndex.java
@@ -43,22 +43,30 @@ import static org.testng.Assert.*;
public class CheckIndex {
static class AssertingOutOfBoundsException extends RuntimeException {
+ public AssertingOutOfBoundsException(String message) {
+ super(message);
+ }
}
- static BiFunction assertingOutOfBounds(
- int expFromIndex, int expToIndexOrSizeOrLength) {
- return (fromIndex, toIndexOrSizeorLength) -> {
- assertEquals(fromIndex, Integer.valueOf(expFromIndex));
- assertEquals(toIndexOrSizeorLength, Integer.valueOf(expToIndexOrSizeOrLength));
- return new AssertingOutOfBoundsException();
+ static BiFunction, 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 argument should be unmodifiable");
+ } catch (Exception e) {
+ }
+ return new AssertingOutOfBoundsException(message);
};
}
- static BiFunction assertingOutOfBoundsReturnNull(
- int expFromIndex, int expToIndexOrSizeOrLength) {
- return (fromIndex, toIndexOrSizeorLength) -> {
- assertEquals(fromIndex, Integer.valueOf(expFromIndex));
- assertEquals(toIndexOrSizeorLength, Integer.valueOf(expToIndexOrSizeOrLength));
+ static BiFunction, AssertingOutOfBoundsException> assertingOutOfBoundsReturnNull(
+ String expCheckKind, Integer... expArgs) {
+ return (checkKind, args) -> {
+ assertEquals(checkKind, expCheckKind);
+ assertEquals(args, List.of(expArgs));
return null;
};
}
@@ -85,7 +93,12 @@ public class CheckIndex {
@Test(dataProvider = "checkIndexProvider")
public void testCheckIndex(int index, int length, boolean withinBounds) {
- BiConsumer, IntSupplier> check = (ec, s) -> {
+ String expectedMessage = withinBounds
+ ? null
+ : Objects.outOfBoundsExceptionFormatter(IndexOutOfBoundsException::new).
+ apply("checkIndex", List.of(index, length)).getMessage();
+
+ BiConsumer, IntSupplier> checker = (ec, s) -> {
try {
int rIndex = s.getAsInt();
if (!withinBounds)
@@ -98,17 +111,27 @@ public class CheckIndex {
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 @@ public class CheckIndex {
@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, IntSupplier> check = (ec, s) -> {
try {
int rIndex = s.getAsInt();
@@ -145,17 +173,27 @@ public class CheckIndex {
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 @@ public class CheckIndex {
@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, IntSupplier> check = (ec, s) -> {
try {
int rIndex = s.getAsInt();
@@ -199,36 +242,54 @@ public class CheckIndex {
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, IntSupplier> check = (ec, s) -> {
- try {
- s.getAsInt();
- fail("Runtime exception expected");
- }
- catch (RuntimeException e) {
- assertTrue(ec.isInstance(e));
- }
- };
+ public void uniqueMessagesForCheckKinds() {
+ BiFunction, 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 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());
}
}
From 33a3b1cdf07e752c4f5ae425ff5b3b0bf80f5477 Mon Sep 17 00:00:00 2001
From: Alan Bateman
Date: Wed, 13 Apr 2016 14:29:25 +0100
Subject: [PATCH 33/44] 8154077: (fs) Reduce number of file system classes
loaded during startup
Reviewed-by: bpb, chegar
---
jdk/make/mapfiles/libnio/mapfile-linux | 2 +
jdk/make/mapfiles/libnio/mapfile-macosx | 2 +
jdk/make/mapfiles/libnio/mapfile-solaris | 2 +
.../share/classes/java/nio/file/Files.java | 20 ++++++++
.../nio/fs/AbstractFileSystemProvider.java | 51 ++++++++++++++++++-
.../sun/nio/fs/UnixFileSystemProvider.java | 23 +++++++++
.../sun/nio/fs/UnixNativeDispatcher.java | 33 ++++++++++++
.../unix/classes/sun/nio/fs/UnixUriUtils.java | 9 ++--
.../native/libnio/fs/UnixNativeDispatcher.c | 22 ++++++++
9 files changed, 156 insertions(+), 8 deletions(-)
diff --git a/jdk/make/mapfiles/libnio/mapfile-linux b/jdk/make/mapfiles/libnio/mapfile-linux
index e4563b10c12..f2676187ed5 100644
--- a/jdk/make/mapfiles/libnio/mapfile-linux
+++ b/jdk/make/mapfiles/libnio/mapfile-linux
@@ -161,7 +161,9 @@ SUNWprivate_1.1 {
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;
diff --git a/jdk/make/mapfiles/libnio/mapfile-macosx b/jdk/make/mapfiles/libnio/mapfile-macosx
index daee0371e3c..a3f6d5d9c1c 100644
--- a/jdk/make/mapfiles/libnio/mapfile-macosx
+++ b/jdk/make/mapfiles/libnio/mapfile-macosx
@@ -138,7 +138,9 @@ SUNWprivate_1.1 {
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;
diff --git a/jdk/make/mapfiles/libnio/mapfile-solaris b/jdk/make/mapfiles/libnio/mapfile-solaris
index a1e0d99b0e6..a38701ab3b5 100644
--- a/jdk/make/mapfiles/libnio/mapfile-solaris
+++ b/jdk/make/mapfiles/libnio/mapfile-solaris
@@ -138,7 +138,9 @@ SUNWprivate_1.1 {
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;
diff --git a/jdk/src/java.base/share/classes/java/nio/file/Files.java b/jdk/src/java.base/share/classes/java/nio/file/Files.java
index 982846e6e25..e1ab41b7759 100644
--- a/jdk/src/java.base/share/classes/java/nio/file/Files.java
+++ b/jdk/src/java.base/share/classes/java/nio/file/Files.java
@@ -77,6 +77,8 @@ import java.util.function.BiPredicate;
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 @@ public final class Files {
* 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 @@ public final class Files {
* 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 @@ public final class Files {
* @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);
diff --git a/jdk/src/java.base/share/classes/sun/nio/fs/AbstractFileSystemProvider.java b/jdk/src/java.base/share/classes/sun/nio/fs/AbstractFileSystemProvider.java
index 9e1dc6133ac..0e325414f5d 100644
--- a/jdk/src/java.base/share/classes/sun/nio/fs/AbstractFileSystemProvider.java
+++ b/jdk/src/java.base/share/classes/sun/nio/fs/AbstractFileSystemProvider.java
@@ -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 @@ import java.util.Map;
* Base implementation class of FileSystemProvider
*/
-abstract class AbstractFileSystemProvider extends FileSystemProvider {
+public abstract class AbstractFileSystemProvider extends FileSystemProvider {
protected AbstractFileSystemProvider() { }
/**
@@ -107,4 +109,49 @@ abstract class AbstractFileSystemProvider extends FileSystemProvider {
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;
+ }
+ }
}
diff --git a/jdk/src/java.base/unix/classes/sun/nio/fs/UnixFileSystemProvider.java b/jdk/src/java.base/unix/classes/sun/nio/fs/UnixFileSystemProvider.java
index f161bd3e0bf..b738cc3c5d2 100644
--- a/jdk/src/java.base/unix/classes/sun/nio/fs/UnixFileSystemProvider.java
+++ b/jdk/src/java.base/unix/classes/sun/nio/fs/UnixFileSystemProvider.java
@@ -499,6 +499,29 @@ public abstract class UnixFileSystemProvider
}
}
+ @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.
*/
diff --git a/jdk/src/java.base/unix/classes/sun/nio/fs/UnixNativeDispatcher.java b/jdk/src/java.base/unix/classes/sun/nio/fs/UnixNativeDispatcher.java
index c64374125cb..e6a62faf966 100644
--- a/jdk/src/java.base/unix/classes/sun/nio/fs/UnixNativeDispatcher.java
+++ b/jdk/src/java.base/unix/classes/sun/nio/fs/UnixNativeDispatcher.java
@@ -296,6 +296,23 @@ class UnixNativeDispatcher {
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)
*/
@@ -458,6 +475,22 @@ class UnixNativeDispatcher {
}
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);
*
diff --git a/jdk/src/java.base/unix/classes/sun/nio/fs/UnixUriUtils.java b/jdk/src/java.base/unix/classes/sun/nio/fs/UnixUriUtils.java
index a0df3e3102e..45fd404e8c0 100644
--- a/jdk/src/java.base/unix/classes/sun/nio/fs/UnixUriUtils.java
+++ b/jdk/src/java.base/unix/classes/sun/nio/fs/UnixUriUtils.java
@@ -114,12 +114,9 @@ class UnixUriUtils {
// 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 {
diff --git a/jdk/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c b/jdk/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c
index 7e6e5286473..fe203cdf2dc 100644
--- a/jdk/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c
+++ b/jdk/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c
@@ -483,6 +483,20 @@ Java_sun_nio_fs_UnixNativeDispatcher_stat0(JNIEnv* env, jclass this,
}
}
+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 @@ Java_sun_nio_fs_UnixNativeDispatcher_access0(JNIEnv* env, jclass this,
}
}
+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)
From 284ec15fed0d3d2fbd72aff379fce01fe717aaf4 Mon Sep 17 00:00:00 2001
From: Shilpi Rastogi
Date: Wed, 13 Apr 2016 15:48:14 +0200
Subject: [PATCH 34/44] 8150829: Enhanced drop-args, identity and default
constant, varargs adjustment
Reviewed-by: psandoz, mhaupt, jrose
---
.../java/lang/invoke/MethodHandle.java | 48 +++-
.../java/lang/invoke/MethodHandleImpl.java | 4 +-
.../java/lang/invoke/MethodHandleProxies.java | 10 +-
.../java/lang/invoke/MethodHandles.java | 208 ++++++++++++++----
.../lang/invoke/ConstantIdentityMHTest.java | 83 +++++++
.../java/lang/invoke/DropArgumentsTest.java | 90 ++++++++
.../java/lang/invoke/JavaDocExamplesTest.java | 33 ++-
jdk/test/java/lang/invoke/VarArgsTest.java | 80 +++++++
8 files changed, 490 insertions(+), 66 deletions(-)
create mode 100644 jdk/test/java/lang/invoke/ConstantIdentityMHTest.java
create mode 100644 jdk/test/java/lang/invoke/DropArgumentsTest.java
create mode 100644 jdk/test/java/lang/invoke/VarArgsTest.java
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandle.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandle.java
index 98b43b6213d..ac260aac481 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandle.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandle.java
@@ -219,7 +219,8 @@ import static java.lang.invoke.MethodHandleStatics.*;
* 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}.
*
* 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 @@ assertEquals("[A, B, C]", (String) caToString2.invokeExact('A', "BC".toCharArray
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
+ *
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 array-collecting method handle, which accepts a given number of trailing
@@ -1000,7 +1031,8 @@ assertEquals("[A, B, C]", (String) caToString2.invokeExact('A', "BC".toCharArray
* to allow the target to use a simple {@code Object} as its last parameter type.)
*
* 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.
*
* Here are some examples of array-collecting method handles:
*
* 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 @@ assertEquals("[three, thee, tee]", Arrays.toString((Object[])ls.get(0)));
* 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 @@ assertEquals("[three, thee, tee]", asListFix.invoke((Object)argv).toString());
* @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 @@ assertEquals("[three, thee, tee]", asListFix.invoke((Object)argv).toString());
/*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*/
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
index ab9b906e7ff..3f1bb2034a6 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
@@ -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 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
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;
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java
index 37373de1a59..18ec5d6894d 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java
@@ -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 @@ public class MethodHandleProxies {
}
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());
}
/**
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
index bbf65b564bf..dd6c3d0384a 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
@@ -1352,9 +1352,7 @@ import static java.lang.invoke.MethodType.*;
...
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;
* }
* where {@code defc} is either {@code receiver.getClass()} or a super
@@ -2951,9 +2949,55 @@ assert((int)twice.invokeExact(21) == 42);
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.
+ *
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}.
+ *
The returned method handle is equivalent to
+ * {@code dropArguments(zero(type.returnType()), 0, type.parameterList())}.
+ *
+ * @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);
@@ -3145,8 +3189,7 @@ assertEquals("yz", (String) d0.invokeExact(123, "x", "y", "z"));
* If {@code pos} is zero, the dummy arguments will precede
* the target's real arguments; if {@code pos} is N
* they will come after.
- *
- * Example:
+ * @apiNote
*
{@code
import static java.lang.invoke.MethodHandles.*;
import static java.lang.invoke.MethodType.*;
@@ -3185,6 +3228,99 @@ assertEquals("xz", (String) d12.invokeExact("x", 12, true, "z"));
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> newTypes, int pos,
+ boolean nullOnFailure) {
+ List> 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> 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:
+ *
+ * @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> 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,
@@ -3696,13 +3832,9 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
if (gtype.returnType() != boolean.class)
throw newIllegalArgumentException("guard type is not a predicate "+gtype);
List> targs = ttype.parameterList();
- List> 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);
}
@@ -3774,15 +3906,9 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
throw newIllegalArgumentException("handler does not accept exception type "+exType);
if (htype.returnType() != ttype.returnType())
throw misMatchedTypes("target and handler return types", ttype, htype);
- List> targs = ttype.parameterList();
- List> 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);
}
@@ -4040,16 +4166,16 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
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)));
}
}
@@ -4143,7 +4269,7 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
* @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);
@@ -4209,7 +4335,7 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
* @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);
}
@@ -4346,7 +4472,7 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
* @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};
@@ -4449,7 +4575,7 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
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));
@@ -4543,15 +4669,11 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
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);
}
@@ -4642,16 +4764,6 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
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) {
diff --git a/jdk/test/java/lang/invoke/ConstantIdentityMHTest.java b/jdk/test/java/lang/invoke/ConstantIdentityMHTest.java
new file mode 100644
index 00000000000..a80e30e2189
--- /dev/null
+++ b/jdk/test/java/lang/invoke/ConstantIdentityMHTest.java
@@ -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);
+ }
+}
diff --git a/jdk/test/java/lang/invoke/DropArgumentsTest.java b/jdk/test/java/lang/invoke/DropArgumentsTest.java
new file mode 100644
index 00000000000..d3d9e482d0c
--- /dev/null
+++ b/jdk/test/java/lang/invoke/DropArgumentsTest.java
@@ -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> 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> valueType, int skip) {
+ MethodHandles.dropArgumentsToMatch(target, pos, valueType , skip);
+ }
+}
diff --git a/jdk/test/java/lang/invoke/JavaDocExamplesTest.java b/jdk/test/java/lang/invoke/JavaDocExamplesTest.java
index 79a31087550..76b0906bffc 100644
--- a/jdk/test/java/lang/invoke/JavaDocExamplesTest.java
+++ b/jdk/test/java/lang/invoke/JavaDocExamplesTest.java
@@ -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 @@ public class JavaDocExamplesTest {
testFindVirtual();
testFindSpecial();
testPermuteArguments();
+ testZero();
testDropArguments();
+ testDropArgumentsToMatch();
testFilterArguments();
testFoldArguments();
testFoldArguments2();
@@ -235,6 +237,17 @@ assertEquals("xz", (String) d12.invokeExact("x", 12, true, "z"));
}}
}
+@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 @@ assertEquals("xz", (String) d12.invokeExact("x", 12, true, "z"));
}}
}
+ @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
diff --git a/jdk/test/java/lang/invoke/VarArgsTest.java b/jdk/test/java/lang/invoke/VarArgsTest.java
new file mode 100644
index 00000000000..2fef2cd90b0
--- /dev/null
+++ b/jdk/test/java/lang/invoke/VarArgsTest.java
@@ -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);
+ }
+
+}
From 87bdca868498ae4592f5248e9c331665e6fdb53e Mon Sep 17 00:00:00 2001
From: Anthony Scarpino
Date: Wed, 13 Apr 2016 10:20:40 -0700
Subject: [PATCH 35/44] 8152205: jdk.security.provider.preferred is ambiguously
documented
Reviewed-by: wetmore, xuelei, weijun
---
.../java/security/AlgorithmParameterGenerator.java | 5 +++--
.../share/classes/java/security/AlgorithmParameters.java | 5 +++--
.../java.base/share/classes/java/security/KeyFactory.java | 5 +++--
.../share/classes/java/security/KeyPairGenerator.java | 3 ++-
.../java.base/share/classes/java/security/KeyStore.java | 5 +++--
.../share/classes/java/security/MessageDigest.java | 5 +++--
jdk/src/java.base/share/classes/java/security/Policy.java | 5 +++--
.../share/classes/java/security/SecureRandom.java | 3 ++-
.../java.base/share/classes/java/security/Signature.java | 5 +++--
.../share/classes/java/security/cert/CertPathBuilder.java | 5 +++--
.../classes/java/security/cert/CertPathValidator.java | 5 +++--
.../share/classes/java/security/cert/CertStore.java | 5 +++--
.../classes/java/security/cert/CertificateFactory.java | 5 +++--
jdk/src/java.base/share/classes/javax/crypto/Cipher.java | 5 +++--
.../share/classes/javax/crypto/ExemptionMechanism.java | 5 +++--
.../share/classes/javax/crypto/KeyAgreement.java | 5 +++--
.../share/classes/javax/crypto/KeyGenerator.java | 5 +++--
jdk/src/java.base/share/classes/javax/crypto/Mac.java | 5 +++--
.../share/classes/javax/crypto/SecretKeyFactory.java | 5 +++--
.../share/classes/javax/net/ssl/KeyManagerFactory.java | 5 +++--
.../java.base/share/classes/javax/net/ssl/SSLContext.java | 5 +++--
.../share/classes/javax/net/ssl/TrustManagerFactory.java | 5 +++--
.../classes/javax/security/auth/login/Configuration.java | 5 +++--
.../share/classes/javax/security/sasl/Sasl.java | 8 +++++---
.../share/classes/javax/smartcardio/TerminalFactory.java | 5 +++--
.../classes/javax/xml/crypto/dsig/TransformService.java | 5 +++--
.../javax/xml/crypto/dsig/XMLSignatureFactory.java | 5 +++--
.../javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java | 8 +++++---
28 files changed, 86 insertions(+), 56 deletions(-)
diff --git a/jdk/src/java.base/share/classes/java/security/AlgorithmParameterGenerator.java b/jdk/src/java.base/share/classes/java/security/AlgorithmParameterGenerator.java
index 36b2a65cbfa..1d3c24b7361 100644
--- a/jdk/src/java.base/share/classes/java/security/AlgorithmParameterGenerator.java
+++ b/jdk/src/java.base/share/classes/java/security/AlgorithmParameterGenerator.java
@@ -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 @@ public class AlgorithmParameterGenerator {
*
* @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()}.
diff --git a/jdk/src/java.base/share/classes/java/security/AlgorithmParameters.java b/jdk/src/java.base/share/classes/java/security/AlgorithmParameters.java
index aab0b993f0b..be8a2c91abf 100644
--- a/jdk/src/java.base/share/classes/java/security/AlgorithmParameters.java
+++ b/jdk/src/java.base/share/classes/java/security/AlgorithmParameters.java
@@ -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 @@ public class AlgorithmParameters {
*
* @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()}.
diff --git a/jdk/src/java.base/share/classes/java/security/KeyFactory.java b/jdk/src/java.base/share/classes/java/security/KeyFactory.java
index 76076cea2f2..5bbce1a3b74 100644
--- a/jdk/src/java.base/share/classes/java/security/KeyFactory.java
+++ b/jdk/src/java.base/share/classes/java/security/KeyFactory.java
@@ -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 @@ public class KeyFactory {
*
* @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()}.
diff --git a/jdk/src/java.base/share/classes/java/security/KeyPairGenerator.java b/jdk/src/java.base/share/classes/java/security/KeyPairGenerator.java
index 285e19a1639..46686b522a1 100644
--- a/jdk/src/java.base/share/classes/java/security/KeyPairGenerator.java
+++ b/jdk/src/java.base/share/classes/java/security/KeyPairGenerator.java
@@ -197,7 +197,8 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
*
* @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()}.
diff --git a/jdk/src/java.base/share/classes/java/security/KeyStore.java b/jdk/src/java.base/share/classes/java/security/KeyStore.java
index 39721622fc2..14da8cb9d4c 100644
--- a/jdk/src/java.base/share/classes/java/security/KeyStore.java
+++ b/jdk/src/java.base/share/classes/java/security/KeyStore.java
@@ -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 @@ public class KeyStore {
*
* @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()}.
diff --git a/jdk/src/java.base/share/classes/java/security/MessageDigest.java b/jdk/src/java.base/share/classes/java/security/MessageDigest.java
index 0892140c581..a226bfd3da2 100644
--- a/jdk/src/java.base/share/classes/java/security/MessageDigest.java
+++ b/jdk/src/java.base/share/classes/java/security/MessageDigest.java
@@ -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 @@ public abstract class MessageDigest extends MessageDigestSpi {
*
* @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()}.
diff --git a/jdk/src/java.base/share/classes/java/security/Policy.java b/jdk/src/java.base/share/classes/java/security/Policy.java
index 9d02d76f8d8..79ecf9c688d 100644
--- a/jdk/src/java.base/share/classes/java/security/Policy.java
+++ b/jdk/src/java.base/share/classes/java/security/Policy.java
@@ -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 @@ public abstract class Policy {
*
* @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()}.
diff --git a/jdk/src/java.base/share/classes/java/security/SecureRandom.java b/jdk/src/java.base/share/classes/java/security/SecureRandom.java
index d7495f4ad52..da7329fb9e3 100644
--- a/jdk/src/java.base/share/classes/java/security/SecureRandom.java
+++ b/jdk/src/java.base/share/classes/java/security/SecureRandom.java
@@ -270,7 +270,8 @@ public class SecureRandom extends java.util.Random {
*
* @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()}.
diff --git a/jdk/src/java.base/share/classes/java/security/Signature.java b/jdk/src/java.base/share/classes/java/security/Signature.java
index 73fb85c8566..7efa9c9a7e6 100644
--- a/jdk/src/java.base/share/classes/java/security/Signature.java
+++ b/jdk/src/java.base/share/classes/java/security/Signature.java
@@ -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 @@ public abstract class Signature extends SignatureSpi {
*
* @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()}.
diff --git a/jdk/src/java.base/share/classes/java/security/cert/CertPathBuilder.java b/jdk/src/java.base/share/classes/java/security/cert/CertPathBuilder.java
index 8cd1ec09d0c..b9100826c09 100644
--- a/jdk/src/java.base/share/classes/java/security/cert/CertPathBuilder.java
+++ b/jdk/src/java.base/share/classes/java/security/cert/CertPathBuilder.java
@@ -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 @@ public class CertPathBuilder {
*
* @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()}.
diff --git a/jdk/src/java.base/share/classes/java/security/cert/CertPathValidator.java b/jdk/src/java.base/share/classes/java/security/cert/CertPathValidator.java
index 3a22c37cb04..be5bd77fd96 100644
--- a/jdk/src/java.base/share/classes/java/security/cert/CertPathValidator.java
+++ b/jdk/src/java.base/share/classes/java/security/cert/CertPathValidator.java
@@ -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 @@ public class CertPathValidator {
*
* @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()}.
diff --git a/jdk/src/java.base/share/classes/java/security/cert/CertStore.java b/jdk/src/java.base/share/classes/java/security/cert/CertStore.java
index cb281633929..dcf7b922471 100644
--- a/jdk/src/java.base/share/classes/java/security/cert/CertStore.java
+++ b/jdk/src/java.base/share/classes/java/security/cert/CertStore.java
@@ -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 @@ public class CertStore {
*
* @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()}.
diff --git a/jdk/src/java.base/share/classes/java/security/cert/CertificateFactory.java b/jdk/src/java.base/share/classes/java/security/cert/CertificateFactory.java
index 735c2df21fc..e2680e90c30 100644
--- a/jdk/src/java.base/share/classes/java/security/cert/CertificateFactory.java
+++ b/jdk/src/java.base/share/classes/java/security/cert/CertificateFactory.java
@@ -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 @@ public class CertificateFactory {
*
* @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()}.
diff --git a/jdk/src/java.base/share/classes/javax/crypto/Cipher.java b/jdk/src/java.base/share/classes/javax/crypto/Cipher.java
index fde8cb491cf..8b5fb7875af 100644
--- a/jdk/src/java.base/share/classes/javax/crypto/Cipher.java
+++ b/jdk/src/java.base/share/classes/javax/crypto/Cipher.java
@@ -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 @@ public class Cipher {
*
* @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()}.
diff --git a/jdk/src/java.base/share/classes/javax/crypto/ExemptionMechanism.java b/jdk/src/java.base/share/classes/javax/crypto/ExemptionMechanism.java
index db5f5c77684..e6bbf825fa2 100644
--- a/jdk/src/java.base/share/classes/javax/crypto/ExemptionMechanism.java
+++ b/jdk/src/java.base/share/classes/javax/crypto/ExemptionMechanism.java
@@ -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 @@ public class ExemptionMechanism {
*
* @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()}.
diff --git a/jdk/src/java.base/share/classes/javax/crypto/KeyAgreement.java b/jdk/src/java.base/share/classes/javax/crypto/KeyAgreement.java
index a2c951e0275..dd8057ab485 100644
--- a/jdk/src/java.base/share/classes/javax/crypto/KeyAgreement.java
+++ b/jdk/src/java.base/share/classes/javax/crypto/KeyAgreement.java
@@ -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 @@ public class KeyAgreement {
*
* @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()}.
diff --git a/jdk/src/java.base/share/classes/javax/crypto/KeyGenerator.java b/jdk/src/java.base/share/classes/javax/crypto/KeyGenerator.java
index 46d3ee75fdf..0719699d6f8 100644
--- a/jdk/src/java.base/share/classes/javax/crypto/KeyGenerator.java
+++ b/jdk/src/java.base/share/classes/javax/crypto/KeyGenerator.java
@@ -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 @@ public class KeyGenerator {
*
* @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()}.
diff --git a/jdk/src/java.base/share/classes/javax/crypto/Mac.java b/jdk/src/java.base/share/classes/javax/crypto/Mac.java
index 2c5ba4b6aa2..2d793ca45d7 100644
--- a/jdk/src/java.base/share/classes/javax/crypto/Mac.java
+++ b/jdk/src/java.base/share/classes/javax/crypto/Mac.java
@@ -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 @@ public class Mac implements Cloneable {
*
* @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()}.
diff --git a/jdk/src/java.base/share/classes/javax/crypto/SecretKeyFactory.java b/jdk/src/java.base/share/classes/javax/crypto/SecretKeyFactory.java
index 9dd815149b9..091e08ac025 100644
--- a/jdk/src/java.base/share/classes/javax/crypto/SecretKeyFactory.java
+++ b/jdk/src/java.base/share/classes/javax/crypto/SecretKeyFactory.java
@@ -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 @@ public class SecretKeyFactory {
*
* @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()}.
diff --git a/jdk/src/java.base/share/classes/javax/net/ssl/KeyManagerFactory.java b/jdk/src/java.base/share/classes/javax/net/ssl/KeyManagerFactory.java
index 04515510af8..271974f90d9 100644
--- a/jdk/src/java.base/share/classes/javax/net/ssl/KeyManagerFactory.java
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/KeyManagerFactory.java
@@ -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 @@ public class KeyManagerFactory {
*
* @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()}.
diff --git a/jdk/src/java.base/share/classes/javax/net/ssl/SSLContext.java b/jdk/src/java.base/share/classes/javax/net/ssl/SSLContext.java
index 1ed527569a6..598696b3427 100644
--- a/jdk/src/java.base/share/classes/javax/net/ssl/SSLContext.java
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/SSLContext.java
@@ -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 @@ public class SSLContext {
*
* @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()}.
diff --git a/jdk/src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java b/jdk/src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java
index 4e9bdf2b7e0..dd5ce10d5bd 100644
--- a/jdk/src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java
@@ -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 @@ public class TrustManagerFactory {
*
* @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()}.
diff --git a/jdk/src/java.base/share/classes/javax/security/auth/login/Configuration.java b/jdk/src/java.base/share/classes/javax/security/auth/login/Configuration.java
index b5a2a2cd107..8db88e0c0d3 100644
--- a/jdk/src/java.base/share/classes/javax/security/auth/login/Configuration.java
+++ b/jdk/src/java.base/share/classes/javax/security/auth/login/Configuration.java
@@ -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 @@ public abstract class Configuration {
*
* @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()}.
diff --git a/jdk/src/java.security.sasl/share/classes/javax/security/sasl/Sasl.java b/jdk/src/java.security.sasl/share/classes/javax/security/sasl/Sasl.java
index aaeaae4c1ae..46461d35541 100644
--- a/jdk/src/java.security.sasl/share/classes/javax/security/sasl/Sasl.java
+++ b/jdk/src/java.security.sasl/share/classes/javax/security/sasl/Sasl.java
@@ -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 @@ public class Sasl {
*
* @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 @@ public class Sasl {
*
* @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()}.
diff --git a/jdk/src/java.smartcardio/share/classes/javax/smartcardio/TerminalFactory.java b/jdk/src/java.smartcardio/share/classes/javax/smartcardio/TerminalFactory.java
index f83bc78f53e..8ded0720b46 100644
--- a/jdk/src/java.smartcardio/share/classes/javax/smartcardio/TerminalFactory.java
+++ b/jdk/src/java.smartcardio/share/classes/javax/smartcardio/TerminalFactory.java
@@ -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 @@ public final class TerminalFactory {
*
* @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()}.
diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/TransformService.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/TransformService.java
index 84212c45c90..21320d03610 100644
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/TransformService.java
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/TransformService.java
@@ -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 @@ public abstract class TransformService implements Transform {
*
* @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()}.
diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java
index def0a5d013f..e23bb652cc7 100644
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java
@@ -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 @@ public abstract class XMLSignatureFactory {
*
* @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()}.
diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java
index beaa1820e9e..11187d580a2 100644
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java
@@ -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 @@ public abstract class KeyInfoFactory {
*
* @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 @@ public abstract class KeyInfoFactory {
*
* @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()}.
From c5f11b19c48b52f1610480389a9c550069b379ca Mon Sep 17 00:00:00 2001
From: Mandy Chung
Date: Wed, 13 Apr 2016 11:03:16 -0700
Subject: [PATCH 36/44] 8153895: (proxy) redundant read edges to
superinterfaces of proxy interfaces
Reviewed-by: sundar, plevart
---
.../classes/java/lang/reflect/Proxy.java | 26 +++++--------------
1 file changed, 7 insertions(+), 19 deletions(-)
diff --git a/jdk/src/java.base/share/classes/java/lang/reflect/Proxy.java b/jdk/src/java.base/share/classes/java/lang/reflect/Proxy.java
index f1827ddbd0b..ea281b137e9 100644
--- a/jdk/src/java.base/share/classes/java/lang/reflect/Proxy.java
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/Proxy.java
@@ -689,13 +689,14 @@ public class Proxy implements java.io.Serializable {
}
/*
- * 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> referencedTypes(ClassLoader loader,
List> 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 @@ public class Proxy implements java.io.Serializable {
// 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> deque = new LinkedList<>(interfaces);
- Set> 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> 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;
}
From 38659d2ed9996a7d02f0edfd793474c9d74c0748 Mon Sep 17 00:00:00 2001
From: Roger Riggs
Date: Wed, 13 Apr 2016 16:57:49 -0400
Subject: [PATCH 37/44] 8086278: java/lang/ProcessHandle/TreeTest.java failed -
ProcessReaper StackOverflowException
Increase reaper stack size by 50% to 48k
Reviewed-by: chegar, martin
---
.../share/classes/java/lang/ProcessHandleImpl.java | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/jdk/src/java.base/share/classes/java/lang/ProcessHandleImpl.java b/jdk/src/java.base/share/classes/java/lang/ProcessHandleImpl.java
index 91fa5623174..15a2bd4c029 100644
--- a/jdk/src/java.base/share/classes/java/lang/ProcessHandleImpl.java
+++ b/jdk/src/java.base/share/classes/java/lang/ProcessHandleImpl.java
@@ -51,6 +51,11 @@ import static java.security.AccessController.doPrivileged;
* @since 9
*/
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.
*/
@@ -79,10 +84,12 @@ final class ProcessHandleImpl implements ProcessHandle {
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);
From bf4e4ed961f3f63128bcdd8c177570d821bdaaec Mon Sep 17 00:00:00 2001
From: Rajan Halade
Date: Wed, 13 Apr 2016 16:05:31 -0700
Subject: [PATCH 38/44] 8055351:
sun/security/provider/DSA/TestAlgParameterGenerator.java failed with
interrupted! (timed out?)
Reviewed-by: valeriep
---
.../DSA/TestAlgParameterGenerator.java | 63 ++++++++++---------
1 file changed, 32 insertions(+), 31 deletions(-)
diff --git a/jdk/test/sun/security/provider/DSA/TestAlgParameterGenerator.java b/jdk/test/sun/security/provider/DSA/TestAlgParameterGenerator.java
index c416c1d8423..10af6794866 100644
--- a/jdk/test/sun/security/provider/DSA/TestAlgParameterGenerator.java
+++ b/jdk/test/sun/security/provider/DSA/TestAlgParameterGenerator.java
@@ -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;
+
// make sure no-init still works
start = System.currentTimeMillis();
AlgorithmParameters param = apg.generateParameters();
@@ -81,9 +84,8 @@ public class TestAlgParameterGenerator {
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 @@ public class TestAlgParameterGenerator {
}
// 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();
From dc0f21b3663d584246a681ab5ab1e1f7287fc00f Mon Sep 17 00:00:00 2001
From: Rajan Halade
Date: Wed, 13 Apr 2016 16:08:43 -0700
Subject: [PATCH 39/44] 8154196: Mark javax/net/ssl/DTLS/CipherSuite.java as
intermittently failing
Reviewed-by: xuelei
---
jdk/test/javax/net/ssl/DTLS/CipherSuite.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/jdk/test/javax/net/ssl/DTLS/CipherSuite.java b/jdk/test/javax/net/ssl/DTLS/CipherSuite.java
index 92896565b8c..259b09c8e17 100644
--- a/jdk/test/javax/net/ssl/DTLS/CipherSuite.java
+++ b/jdk/test/javax/net/ssl/DTLS/CipherSuite.java
@@ -27,6 +27,7 @@
/*
* @test
* @bug 8043758
+ * @key intermittent
* @summary Datagram Transport Layer Security (DTLS)
* @modules java.base/sun.security.util
* @build DTLSOverDatagram
From 6edbf9b42d7315d4299a0117e566f09d6e9ab465 Mon Sep 17 00:00:00 2001
From: Amanda Jiang
Date: Thu, 14 Apr 2016 09:45:37 +0800
Subject: [PATCH 40/44] 8153545: sun/security/pkcs11/Provider/Login.sh fails on
Linux
Reviewed-by: vinnie, weijun
---
jdk/test/ProblemList.txt | 2 +-
jdk/test/sun/security/pkcs11/KeyStore/Basic.java | 4 ++--
jdk/test/sun/security/pkcs11/KeyStore/Basic.policy | 1 +
jdk/test/sun/security/pkcs11/KeyStore/Basic.sh | 6 ++----
jdk/test/sun/security/pkcs11/KeyStore/Solaris.sh | 4 +---
jdk/test/sun/security/pkcs11/PKCS11Test.java | 9 +++++++--
jdk/test/sun/security/pkcs11/Provider/Login.java | 4 ++--
jdk/test/sun/security/pkcs11/Provider/Login.policy | 1 +
jdk/test/sun/security/pkcs11/Provider/Login.sh | 6 ++----
9 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt
index e301226a6e3..ee17885babd 100644
--- a/jdk/test/ProblemList.txt
+++ b/jdk/test/ProblemList.txt
@@ -234,7 +234,7 @@ sun/security/pkcs11/MessageDigest/DigestKAT.java 8077138,8023434
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
diff --git a/jdk/test/sun/security/pkcs11/KeyStore/Basic.java b/jdk/test/sun/security/pkcs11/KeyStore/Basic.java
index 59ccf01ec44..af98ae3ba4d 100644
--- a/jdk/test/sun/security/pkcs11/KeyStore/Basic.java
+++ b/jdk/test/sun/security/pkcs11/KeyStore/Basic.java
@@ -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 class Basic extends PKCS11Test {
}
public static void main(String[] args) throws Exception {
- main(new Basic());
+ main(new Basic(), args);
}
public void main(Provider p) throws Exception {
diff --git a/jdk/test/sun/security/pkcs11/KeyStore/Basic.policy b/jdk/test/sun/security/pkcs11/KeyStore/Basic.policy
index 2175b9549e8..0de26ecc564 100644
--- a/jdk/test/sun/security/pkcs11/KeyStore/Basic.policy
+++ b/jdk/test/sun/security/pkcs11/KeyStore/Basic.policy
@@ -7,6 +7,7 @@ grant {
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 "<>", "read";
diff --git a/jdk/test/sun/security/pkcs11/KeyStore/Basic.sh b/jdk/test/sun/security/pkcs11/KeyStore/Basic.sh
index 037b5d792ce..d2908b89667 100644
--- a/jdk/test/sun/security/pkcs11/KeyStore/Basic.sh
+++ b/jdk/test/sun/security/pkcs11/KeyStore/Basic.sh
@@ -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 @@ ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
-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=$?
diff --git a/jdk/test/sun/security/pkcs11/KeyStore/Solaris.sh b/jdk/test/sun/security/pkcs11/KeyStore/Solaris.sh
index 2d34ef440af..54c16027f9e 100644
--- a/jdk/test/sun/security/pkcs11/KeyStore/Solaris.sh
+++ b/jdk/test/sun/security/pkcs11/KeyStore/Solaris.sh
@@ -155,10 +155,8 @@ ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
-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
diff --git a/jdk/test/sun/security/pkcs11/PKCS11Test.java b/jdk/test/sun/security/pkcs11/PKCS11Test.java
index bd85ea6058f..f3e14c7d213 100644
--- a/jdk/test/sun/security/pkcs11/PKCS11Test.java
+++ b/jdk/test/sun/security/pkcs11/PKCS11Test.java
@@ -181,8 +181,13 @@ public abstract class PKCS11Test {
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",
diff --git a/jdk/test/sun/security/pkcs11/Provider/Login.java b/jdk/test/sun/security/pkcs11/Provider/Login.java
index 8b8dbe8f6ab..9a8318d62b6 100644
--- a/jdk/test/sun/security/pkcs11/Provider/Login.java
+++ b/jdk/test/sun/security/pkcs11/Provider/Login.java
@@ -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 @@ public class Login extends PKCS11Test {
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 {
diff --git a/jdk/test/sun/security/pkcs11/Provider/Login.policy b/jdk/test/sun/security/pkcs11/Provider/Login.policy
index a386103f315..af6c98d8ebe 100644
--- a/jdk/test/sun/security/pkcs11/Provider/Login.policy
+++ b/jdk/test/sun/security/pkcs11/Provider/Login.policy
@@ -4,6 +4,7 @@ grant {
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.*";
diff --git a/jdk/test/sun/security/pkcs11/Provider/Login.sh b/jdk/test/sun/security/pkcs11/Provider/Login.sh
index 35f9ed562ea..cb62242ca60 100644
--- a/jdk/test/sun/security/pkcs11/Provider/Login.sh
+++ b/jdk/test/sun/security/pkcs11/Provider/Login.sh
@@ -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 @@ ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
-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=$?
From 44613235d7e4328878c691bd4a1ca7d977bed094 Mon Sep 17 00:00:00 2001
From: Claes Redestad
Date: Thu, 14 Apr 2016 12:16:05 +0200
Subject: [PATCH 41/44] 8154185: Drop code to support Windows XP in
DefaultDatagramSocketImplFactory
Reviewed-by: chegar
---
.../net/DefaultDatagramSocketImplFactory.java | 59 ++++---------------
1 file changed, 12 insertions(+), 47 deletions(-)
diff --git a/jdk/src/java.base/windows/classes/java/net/DefaultDatagramSocketImplFactory.java b/jdk/src/java.base/windows/classes/java/net/DefaultDatagramSocketImplFactory.java
index 1cd26bcb33c..fb632a4a816 100644
--- a/jdk/src/java.base/windows/classes/java/net/DefaultDatagramSocketImplFactory.java
+++ b/jdk/src/java.base/windows/classes/java/net/DefaultDatagramSocketImplFactory.java
@@ -26,6 +26,7 @@ package java.net;
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 @@ class DefaultDatagramSocketImplFactory
{
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;
- // Determine Windows Version.
- java.security.AccessController.doPrivileged(
- new PrivilegedAction