6961894: TEST_BUG: jdk_lang tests fail in samevm mode
Fixed jdk_lang tests to run in samevm mode or mark to run in othervm
Reviewed-by: alanb
diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt
index b088cf0..560d37b 100644
--- a/jdk/test/ProblemList.txt
+++ b/jdk/test/ProblemList.txt
@@ -337,68 +337,12 @@
# jdk_lang
-# Some of these tests (like java/lang/management) may just need to be marked
-# othervm, but that is partially speculation.
-
# Times out on solaris 10 sparc
java/lang/ClassLoader/Assert.java generic-all
-# Fedora 9 X64, RuntimeException: MyThread expected to be blocked on lock, but got null
-java/lang/management/ThreadMXBean/ThreadStateTest.java generic-all
-
-# RuntimeException: Uptime of the JVM is more than 30 minutes (32 minutes).
-java/lang/management/RuntimeMXBean/UpTime.java generic-all
-
# Solaris sparc, samevm, java.lang.Exception: Read from closed pipe hangs
java/lang/Runtime/exec/SleepyCat.java generic-all
-# Fedora 9 32bit, -client, samevm, Error while cleaning up threads after test
-java/lang/management/ThreadMXBean/Locks.java generic-all
-
-# Need to be marked othervm, or changed to be samevm safe
-java/lang/management/ClassLoadingMXBean/LoadCounts.java generic-all
-java/lang/management/ManagementFactory/MBeanServerMXBeanUnsupportedTest.java generic-all
-java/lang/management/ManagementFactory/MXBeanProxyTest.java generic-all
-java/lang/management/ManagementFactory/ThreadMXBeanProxy.java generic-all
-java/lang/management/MemoryMXBean/CollectionUsageThreshold.java generic-all
-java/lang/management/MemoryMXBean/GetMBeanInfo.java generic-all
-java/lang/management/MemoryMXBean/LowMemoryTest.java generic-all
-java/lang/management/MemoryMXBean/MemoryManagement.java generic-all
-java/lang/management/MemoryMXBean/MemoryTest.java generic-all
-java/lang/management/MemoryMXBean/Pending.java generic-all
-
-# Problematic on all platforms (even as othervm)
-java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java generic-all
-
-# Causes jtreg exit samevm issues due to non-String object in system properties
-java/lang/management/RuntimeMXBean/GetSystemProperties.java generic-all
-
-# Need to be marked othervm, or changed to be samevm safe
-java/lang/management/RuntimeMXBean/PropertiesTest.java generic-all
-java/lang/management/ThreadMXBean/AllThreadIds.java generic-all
-java/lang/management/ThreadMXBean/EnableTest.java generic-all
-java/lang/management/ThreadMXBean/FindMonitorDeadlock.java generic-all
-java/lang/management/ThreadMXBean/LockingThread.java generic-all
-java/lang/management/ThreadMXBean/MonitorDeadlock.java generic-all
-java/lang/management/ThreadMXBean/MyOwnSynchronizer.java generic-all
-java/lang/management/ThreadMXBean/SharedSynchronizer.java generic-all
-java/lang/management/ThreadMXBean/SynchronizerLockingThread.java generic-all
-java/lang/management/ThreadMXBean/ThreadCounts.java generic-all
-
-# Need to be marked othervm, or changed to be samevm safe
-java/lang/reflect/Proxy/Boxing.java generic-all
-java/lang/reflect/Proxy/ClassRestrictions.java generic-all
-java/lang/reflect/Proxy/returnTypes/Test.java generic-all
-
-# Need to be marked othervm, or changed to be samevm safe
-java/lang/Runtime/exec/LotsOfOutput.java generic-all
-java/lang/System/ExitFinalizersAndJIT.java generic-all
-java/lang/System/finalization/FinThreads.java generic-all
-java/lang/Thread/GenerifyStackTraces.java generic-all
-java/lang/Thread/StackTraces.java generic-all
-java/lang/ThreadGroup/Daemon.java generic-all
-java/lang/ThreadGroup/NullThreadName.java generic-all
-
# Times out on solaris sparc -server
java/lang/ThreadLocal/MemoryLeak.java solaris-all
@@ -415,9 +359,6 @@
# Access denied messages on windows/mks, filed 6954450
sun/management/jmxremote/bootstrap/RmiSslNoKeyStoreTest.sh windows-all
-# Filed 6951284, fails on linux 64bit Fedora 9, peak thread count differences
-java/lang/management/ThreadMXBean/ResetPeakThreadCount.java generic-all
-
# Started failing on linux and solaris (filed 6950927)
# com.sun.tools.attach.AttachNotSupportedException:
# Unable to open socket file:
@@ -1166,12 +1107,6 @@
# 11 separate stacktraces created... file reuse problem?
java/util/zip/ZipFile/ReadLongZipFileName.java generic-all
-# Recent failure on all platforms
-sun/util/resources/TimeZone/Bug6317929.java generic-all
-
-# Fails with -ea -esa on all platforms with Assertion error
-java/util/ResourceBundle/Test4300693.java generic-all
-
# Failing on all -client 32bit platforms starting with b77? See 6908348.
java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java generic-all
@@ -1199,10 +1134,6 @@
java/util/Formatter/Constructors.java generic-all
# Need to be marked othervm, or changed to be samevm safe
-java/util/Locale/Bug4175998Test.java generic-all
-java/util/Locale/LocaleTest.java generic-all
-
-# Need to be marked othervm, or changed to be samevm safe
java/util/WeakHashMap/GCDuringIteration.java generic-all
############################################################################
diff --git a/jdk/test/java/lang/System/ExitFinalizersAndJIT.java b/jdk/test/java/lang/System/ExitFinalizersAndJIT.java
index bc98b12..4fe5078 100644
--- a/jdk/test/java/lang/System/ExitFinalizersAndJIT.java
+++ b/jdk/test/java/lang/System/ExitFinalizersAndJIT.java
@@ -26,6 +26,7 @@
@summary runFinalizersOnExit(true) causes JIT to be unloaded and
crashes the VM. Interim fix for 1.2 beta4 -- don't unload
native libraries loaded by system classes.
+ @run main/othervm ExitFinalizersAndJIT
*/
public class ExitFinalizersAndJIT {
diff --git a/jdk/test/java/lang/Thread/GenerifyStackTraces.java b/jdk/test/java/lang/Thread/GenerifyStackTraces.java
index 4167265..98de450 100644
--- a/jdk/test/java/lang/Thread/GenerifyStackTraces.java
+++ b/jdk/test/java/lang/Thread/GenerifyStackTraces.java
@@ -155,7 +155,7 @@
printStack(t, stack);
}
int frame = stack.length - 1;
- for (int i = 0; i < depth; i++) {
+ for (int i = 0; i < depth && frame >= 0; i++) {
if (! stack[frame].getMethodName().equals(methodNames[i])) {
throw new RuntimeException("Expected " + methodNames[i] +
" in frame " + frame + " but got " +
diff --git a/jdk/test/java/lang/Thread/StackTraces.java b/jdk/test/java/lang/Thread/StackTraces.java
index b5f3d05..141c81a 100644
--- a/jdk/test/java/lang/Thread/StackTraces.java
+++ b/jdk/test/java/lang/Thread/StackTraces.java
@@ -159,7 +159,7 @@
printStack(t, stack);
}
int frame = stack.length - 1;
- for (int i = 0; i < depth; i++) {
+ for (int i = 0; i < depth && frame >= 0; i++) {
if (! stack[frame].getMethodName().equals(methodNames[i])) {
throw new RuntimeException("Expected " + methodNames[i] +
" in frame " + frame + " but got " +
diff --git a/jdk/test/java/lang/management/ClassLoadingMXBean/LoadCounts.java b/jdk/test/java/lang/management/ClassLoadingMXBean/LoadCounts.java
index 2eac763..d2daf80 100644
--- a/jdk/test/java/lang/management/ClassLoadingMXBean/LoadCounts.java
+++ b/jdk/test/java/lang/management/ClassLoadingMXBean/LoadCounts.java
@@ -118,9 +118,21 @@
}
class Slave {}
-class LeftHand extends ClassLoader {}
-class RightHand extends ClassLoader {}
+class LeftHand extends ClassLoader {
+ public LeftHand() {
+ super(LeftHand.class.getClassLoader());
+ }
+}
+class RightHand extends ClassLoader {
+ public RightHand() {
+ super(RightHand.class.getClassLoader());
+ }
+}
class Body {}
-class LoaderForTwoInstances extends ClassLoader {}
+class LoaderForTwoInstances extends ClassLoader {
+ public LoaderForTwoInstances() {
+ super(LoaderForTwoInstances.class.getClassLoader());
+ }
+}
class TheSameClass {}
diff --git a/jdk/test/java/lang/management/ManagementFactory/MXBeanProxyTest.java b/jdk/test/java/lang/management/ManagementFactory/MXBeanProxyTest.java
index efcd0e9..545d724 100644
--- a/jdk/test/java/lang/management/ManagementFactory/MXBeanProxyTest.java
+++ b/jdk/test/java/lang/management/ManagementFactory/MXBeanProxyTest.java
@@ -25,6 +25,7 @@
* @test
* @bug 5024531
* @summary Basic Test for ManagementFactory.newPlatformMXBean().
+ * @run main/othervm MXBeanProxyTest
* @author Mandy Chung
*/
import javax.management.*;
diff --git a/jdk/test/java/lang/management/MemoryMXBean/CollectionUsageThreshold.java b/jdk/test/java/lang/management/MemoryMXBean/CollectionUsageThreshold.java
index f81f40b..b7a04e0 100644
--- a/jdk/test/java/lang/management/MemoryMXBean/CollectionUsageThreshold.java
+++ b/jdk/test/java/lang/management/MemoryMXBean/CollectionUsageThreshold.java
@@ -41,9 +41,9 @@
public class CollectionUsageThreshold {
private static MemoryMXBean mm = ManagementFactory.getMemoryMXBean();
- private static List pools = ManagementFactory.getMemoryPoolMXBeans();
- private static List managers = ManagementFactory.getMemoryManagerMXBeans();
- private static Map result = new HashMap();
+ private static List<MemoryPoolMXBean> pools = ManagementFactory.getMemoryPoolMXBeans();
+ private static List<MemoryManagerMXBean> managers = ManagementFactory.getMemoryManagerMXBeans();
+ private static Map<String, PoolRecord> result = new HashMap<>();
private static boolean trace = false;
private static boolean testFailed = false;
private static final int EXPECTED_NUM_POOLS = 2;
@@ -119,8 +119,7 @@
}
// Find the Old generation which supports low memory detection
- for (ListIterator iter = pools.listIterator(); iter.hasNext(); ) {
- MemoryPoolMXBean p = (MemoryPoolMXBean) iter.next();
+ for (MemoryPoolMXBean p : pools) {
MemoryUsage u = p.getUsage();
if (p.isUsageThresholdSupported() && p.isCollectionUsageThresholdSupported()) {
PoolRecord pr = new PoolRecord(p);
@@ -134,25 +133,30 @@
throw new RuntimeException("Unexpected number of selected pools");
}
- checker = new Checker("Checker thread");
- checker.setDaemon(true);
- checker.start();
+ try {
+ checker = new Checker("Checker thread");
+ checker.setDaemon(true);
+ checker.start();
- for (Iterator iter = result.values().iterator(); iter.hasNext();) {
- PoolRecord pr = (PoolRecord) iter.next();
- pr.getPool().setCollectionUsageThreshold(THRESHOLD);
- System.out.println("Collection usage threshold of " +
- pr.getPool().getName() + " set to " + THRESHOLD);
- }
+ for (PoolRecord pr : result.values()) {
+ pr.getPool().setCollectionUsageThreshold(THRESHOLD);
+ System.out.println("Collection usage threshold of " +
+ pr.getPool().getName() + " set to " + THRESHOLD);
+ }
- SensorListener listener = new SensorListener();
- NotificationEmitter emitter = (NotificationEmitter) mm;
- emitter.addNotificationListener(listener, null, null);
+ SensorListener listener = new SensorListener();
+ NotificationEmitter emitter = (NotificationEmitter) mm;
+ emitter.addNotificationListener(listener, null, null);
- mm.setVerbose(true);
- for (int i = 0; i < NUM_GCS; i++) {
- invokeGC();
- checker.waitForCheckResult();
+ for (int i = 0; i < NUM_GCS; i++) {
+ invokeGC();
+ checker.waitForCheckResult();
+ }
+ } finally {
+ // restore the default
+ for (PoolRecord pr : result.values()) {
+ pr.getPool().setCollectionUsageThreshold(0);
+ }
}
if (testFailed)
@@ -168,8 +172,7 @@
mm.gc();
if (trace) {
- for (Iterator iter = result.values().iterator(); iter.hasNext();) {
- PoolRecord pr = (PoolRecord) iter.next();
+ for (PoolRecord pr : result.values()) {
System.out.println("Usage after GC for: " + pr.getPool().getName());
MemoryUtil.printMemoryUsage(pr.getPool().getUsage());
}
@@ -200,8 +203,7 @@
}
}
private void checkResult() {
- for (Iterator iter = result.values().iterator(); iter.hasNext();) {
- PoolRecord pr = (PoolRecord) iter.next();
+ for (PoolRecord pr : result.values()) {
if (pr.getListenerInvokedCount() != numGCs) {
throw new RuntimeException("Listeners invoked count = " +
pr.getListenerInvokedCount() + " expected to be " +
diff --git a/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java b/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java
index f029ca2..00d8b4d 100644
--- a/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java
+++ b/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java
@@ -31,7 +31,7 @@
* @author Mandy Chung
*
* @build LowMemoryTest MemoryUtil
- * @run main/timeout=600 LowMemoryTest
+ * @run main/othervm/timeout=600 LowMemoryTest
*/
import java.lang.management.*;
diff --git a/jdk/test/java/lang/management/MemoryMXBean/MemoryManagement.java b/jdk/test/java/lang/management/MemoryMXBean/MemoryManagement.java
index 9edabf1..f6b3b16 100644
--- a/jdk/test/java/lang/management/MemoryMXBean/MemoryManagement.java
+++ b/jdk/test/java/lang/management/MemoryMXBean/MemoryManagement.java
@@ -31,7 +31,7 @@
* @author Mandy Chung
*
* @build MemoryManagement MemoryUtil
- * @run main/timeout=600 MemoryManagement
+ * @run main/othervm/timeout=600 MemoryManagement
*/
import java.lang.management.*;
diff --git a/jdk/test/java/lang/management/MemoryMXBean/Pending.java b/jdk/test/java/lang/management/MemoryMXBean/Pending.java
index 91c71c1..62df8fe 100644
--- a/jdk/test/java/lang/management/MemoryMXBean/Pending.java
+++ b/jdk/test/java/lang/management/MemoryMXBean/Pending.java
@@ -62,9 +62,21 @@
trace = true;
}
- // Turn on verbose:gc to track GC
- mbean.setVerbose(true);
+ try {
+ if (trace) {
+ // Turn on verbose:gc to track GC
+ mbean.setVerbose(true);
+ }
+ test();
+ } finally {
+ if (trace) {
+ mbean.setVerbose(false);
+ }
+ }
+ System.out.println("Test passed.");
+ }
+ private static void test() throws Exception {
// Clean the memory and remove all objects that are pending
// finalization
System.gc();
@@ -130,7 +142,6 @@
+ " end = " + snapshot);
}
- System.out.println("Test passed.");
}
private static void checkFinalizerCount(int expectedTotal, int curFinalized)
diff --git a/jdk/test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java b/jdk/test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java
index b72d6c9..da37945 100644
--- a/jdk/test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java
+++ b/jdk/test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java
@@ -28,7 +28,7 @@
* @author Mandy Chung
*
* @build ResetPeakMemoryUsage MemoryUtil
- * @run main ResetPeakMemoryUsage
+ * @run main/othervm ResetPeakMemoryUsage
*/
import java.lang.management.*;
diff --git a/jdk/test/java/lang/management/MemoryPoolMXBean/ThresholdTest.java b/jdk/test/java/lang/management/MemoryPoolMXBean/ThresholdTest.java
index f34e8d0..622fc68 100644
--- a/jdk/test/java/lang/management/MemoryPoolMXBean/ThresholdTest.java
+++ b/jdk/test/java/lang/management/MemoryPoolMXBean/ThresholdTest.java
@@ -37,11 +37,23 @@
public class ThresholdTest {
public static void main(String args[]) throws Exception {
List<MemoryPoolMXBean> pools = ManagementFactory.getMemoryPoolMXBeans();
- for (MemoryPoolMXBean p : pools) {
- // verify if isUsageThresholdExceeded() returns correct value
- checkUsageThreshold(p);
- // verify if isCollectionUsageThresholdExceeded() returns correct value
- checkCollectionUsageThreshold(p);
+ try {
+ for (MemoryPoolMXBean p : pools) {
+ // verify if isUsageThresholdExceeded() returns correct value
+ checkUsageThreshold(p);
+ // verify if isCollectionUsageThresholdExceeded() returns correct value
+ checkCollectionUsageThreshold(p);
+ }
+ } finally {
+ // restore the default
+ for (MemoryPoolMXBean p : pools) {
+ if (p.isUsageThresholdSupported()) {
+ p.setUsageThreshold(0);
+ }
+ if (p.isCollectionUsageThresholdSupported()) {
+ p.setCollectionUsageThreshold(0);
+ }
+ }
}
System.out.println("Test passed.");
diff --git a/jdk/test/java/lang/management/RuntimeMXBean/UpTime.java b/jdk/test/java/lang/management/RuntimeMXBean/UpTime.java
index fc368f6..4dca590f 100644
--- a/jdk/test/java/lang/management/RuntimeMXBean/UpTime.java
+++ b/jdk/test/java/lang/management/RuntimeMXBean/UpTime.java
@@ -37,13 +37,18 @@
= ManagementFactory.getRuntimeMXBean();
public static void main(String argv[]) throws Exception {
+ long jvmStartTime = metrics.getStartTime();
long systemStartOuter = System.currentTimeMillis();
long metricsStart = metrics.getUptime();
long systemStartInner = System.currentTimeMillis();
+ // This JVM might have been running for some time if this test runs
+ // in samevm mode. The sanity check should apply to the test uptime.
+ long testUptime = metricsStart - (systemStartOuter - jvmStartTime);
+
// If uptime is more than 30 minutes then it looks like a bug in
// the method
- if (metricsStart > TIMEOUT * 60 * 1000)
+ if (testUptime > TIMEOUT * 60 * 1000)
throw new RuntimeException("Uptime of the JVM is more than 30 "
+ "minutes ("
+ (metricsStart / 60 / 1000)
diff --git a/jdk/test/java/lang/management/ThreadMXBean/AllThreadIds.java b/jdk/test/java/lang/management/ThreadMXBean/AllThreadIds.java
index 59df52b..fa6ec61 100644
--- a/jdk/test/java/lang/management/ThreadMXBean/AllThreadIds.java
+++ b/jdk/test/java/lang/management/ThreadMXBean/AllThreadIds.java
@@ -28,7 +28,7 @@
* @author Alexei Guibadoulline and Mandy Chung
*
* @run build Barrier
- * @run main AllThreadIds
+ * @run main/othervm AllThreadIds
*/
import java.lang.management.*;
@@ -70,6 +70,12 @@
}
}
+ private static void fail(String msg) {
+ trace = true;
+ printThreadList();
+ throw new RuntimeException(msg);
+ }
+
private static void checkThreadCount(int numNewThreads,
int numTerminatedThreads)
throws Exception {
@@ -82,27 +88,27 @@
if ((curLiveThreadCount - prevLiveThreadCount) !=
(numNewThreads - numTerminatedThreads)) {
- throw new RuntimeException("Unexpected number of live threads: " +
- " Prev Total = " + prevTotalThreadCount +
- " Current Total = " + curTotalThreadCount +
+ fail("Unexpected number of live threads: " +
+ " Prev live = " + prevLiveThreadCount +
+ " Current live = " + curLiveThreadCount +
" Threads added = " + numNewThreads +
" Threads terminated = " + numTerminatedThreads);
}
if (curPeakThreadCount - prevPeakThreadCount != numNewThreads) {
- throw new RuntimeException("Unexpected number of peak threads: " +
- " Prev Total = " + prevTotalThreadCount +
- " Current Total = " + curTotalThreadCount +
+ fail("Unexpected number of peak threads: " +
+ " Prev peak = " + prevPeakThreadCount +
+ " Current peak = " + curPeakThreadCount +
" Threads added = " + numNewThreads);
}
if (curTotalThreadCount - prevTotalThreadCount != numNewThreads) {
- throw new RuntimeException("Unexpected number of total threads: " +
+ fail("Unexpected number of total threads: " +
" Prev Total = " + prevTotalThreadCount +
" Current Total = " + curTotalThreadCount +
" Threads added = " + numNewThreads);
}
long[] list = mbean.getAllThreadIds();
if (list.length != curLiveThreadCount) {
- throw new RuntimeException("Array length returned by " +
+ fail("Array length returned by " +
"getAllThreadIds() = " + list.length +
" not matched count = " + curLiveThreadCount);
}
diff --git a/jdk/test/java/lang/management/ThreadMXBean/DisableTest.java b/jdk/test/java/lang/management/ThreadMXBean/DisableTest.java
index eb27760..f5b763a 100644
--- a/jdk/test/java/lang/management/ThreadMXBean/DisableTest.java
+++ b/jdk/test/java/lang/management/ThreadMXBean/DisableTest.java
@@ -36,8 +36,18 @@
private static ThreadMXBean tm = ManagementFactory.getThreadMXBean();
public static void main(String args[]) throws Exception {
- testThreadContentionMonitoring();
- testThreadCpuMonitoring();
+ try {
+ testThreadContentionMonitoring();
+ testThreadCpuMonitoring();
+ } finally {
+ // restore the default
+ if (tm.isThreadContentionMonitoringSupported()) {
+ tm.setThreadContentionMonitoringEnabled(false);
+ }
+ if (tm.isThreadCpuTimeSupported()) {
+ tm.setThreadCpuTimeEnabled(false);
+ }
+ }
System.out.println("Test passed.");
}
diff --git a/jdk/test/java/lang/management/ThreadMXBean/EnableTest.java b/jdk/test/java/lang/management/ThreadMXBean/EnableTest.java
index 57085b5..a3530e4 100644
--- a/jdk/test/java/lang/management/ThreadMXBean/EnableTest.java
+++ b/jdk/test/java/lang/management/ThreadMXBean/EnableTest.java
@@ -119,8 +119,19 @@
}
public static void main(String args[]) throws Exception {
- testThreadContentionMonitoring();
- testThreadCpuTime();
+ try {
+ testThreadContentionMonitoring();
+ testThreadCpuTime();
+ } finally {
+ // restore the default
+ if (tm.isThreadContentionMonitoringSupported()) {
+ tm.setThreadContentionMonitoringEnabled(false);
+ }
+ if (tm.isThreadCpuTimeSupported()) {
+ tm.setThreadCpuTimeEnabled(false);
+ }
+ }
+
System.out.println("Test passed.");
}
diff --git a/jdk/test/java/lang/management/ThreadMXBean/FindDeadlocks.java b/jdk/test/java/lang/management/ThreadMXBean/FindDeadlocks.java
index 99c9edf..b913147 100644
--- a/jdk/test/java/lang/management/ThreadMXBean/FindDeadlocks.java
+++ b/jdk/test/java/lang/management/ThreadMXBean/FindDeadlocks.java
@@ -33,7 +33,7 @@
* @build MonitorDeadlock
* @build SynchronizerDeadlock
* @build ThreadDump
- * @run main FindDeadlocks
+ * @run main/othervm FindDeadlocks
*/
import java.lang.management.*;
diff --git a/jdk/test/java/lang/management/ThreadMXBean/FindMonitorDeadlock.java b/jdk/test/java/lang/management/ThreadMXBean/FindMonitorDeadlock.java
index 06c55c4..7381bc0 100644
--- a/jdk/test/java/lang/management/ThreadMXBean/FindMonitorDeadlock.java
+++ b/jdk/test/java/lang/management/ThreadMXBean/FindMonitorDeadlock.java
@@ -30,7 +30,7 @@
*
* @build MonitorDeadlock
* @build ThreadDump
- * @run main FindMonitorDeadlock
+ * @run main/othervm FindMonitorDeadlock
*/
import java.lang.management.*;
diff --git a/jdk/test/java/lang/management/ThreadMXBean/Locks.java b/jdk/test/java/lang/management/ThreadMXBean/Locks.java
index 28a4027..1541a08 100644
--- a/jdk/test/java/lang/management/ThreadMXBean/Locks.java
+++ b/jdk/test/java/lang/management/ThreadMXBean/Locks.java
@@ -29,7 +29,7 @@
* @author Mandy Chung
*
* @build ThreadExecutionSynchronizer
- * @run main Locks
+ * @run main/othervm Locks
*/
import java.lang.management.*;
diff --git a/jdk/test/java/lang/reflect/Proxy/Boxing.java b/jdk/test/java/lang/reflect/Proxy/Boxing.java
index a32a6f7..2c4c245 100644
--- a/jdk/test/java/lang/reflect/Proxy/Boxing.java
+++ b/jdk/test/java/lang/reflect/Proxy/Boxing.java
@@ -71,8 +71,8 @@
Random random = new Random(42); // ensure consistent test domain
Test proxy = (Test) Proxy.newProxyInstance(
- ClassLoader.getSystemClassLoader(),
- new Class[] { Test.class },
+ Test.class.getClassLoader(),
+ new Class<?>[] { Test.class },
new TestHandler());
for (int rep = 0; rep < REPS; rep++) {
diff --git a/jdk/test/java/lang/reflect/Proxy/ClassRestrictions.java b/jdk/test/java/lang/reflect/Proxy/ClassRestrictions.java
index 905e351..6c35d75 100644
--- a/jdk/test/java/lang/reflect/Proxy/ClassRestrictions.java
+++ b/jdk/test/java/lang/reflect/Proxy/ClassRestrictions.java
@@ -54,16 +54,16 @@
"\nTest of restrictions on parameters to Proxy.getProxyClass\n");
try {
- ClassLoader loader = ClassLoader.getSystemClassLoader();
- Class[] interfaces;
- Class proxyClass;
+ ClassLoader loader = ClassRestrictions.class.getClassLoader();
+ Class<?>[] interfaces;
+ Class<?> proxyClass;
/*
* All of the Class objects in the interfaces array must represent
* interfaces, not classes or primitive types.
*/
try {
- interfaces = new Class[] { Object.class };
+ interfaces = new Class<?>[] { Object.class };
proxyClass = Proxy.getProxyClass(loader, interfaces);
throw new RuntimeException(
"proxy class created with java.lang.Object as interface");
@@ -73,7 +73,7 @@
// assume exception is for intended failure
}
try {
- interfaces = new Class[] { Integer.TYPE };
+ interfaces = new Class<?>[] { Integer.TYPE };
proxyClass = Proxy.getProxyClass(loader, interfaces);
throw new RuntimeException(
"proxy class created with int.class as interface");
@@ -88,7 +88,7 @@
* Class objects.
*/
try {
- interfaces = new Class[] { Bar.class, Bar.class };
+ interfaces = new Class<?>[] { Bar.class, Bar.class };
proxyClass = Proxy.getProxyClass(loader, interfaces);
throw new RuntimeException(
"proxy class created with repeated interfaces");
@@ -107,7 +107,7 @@
Class altBarClass;
altBarClass = Class.forName(Bar.class.getName(), false, altLoader);
try {
- interfaces = new Class[] { altBarClass };
+ interfaces = new Class<?>[] { altBarClass };
proxyClass = Proxy.getProxyClass(loader, interfaces);
throw new RuntimeException(
"proxy class created with interface " +
@@ -121,8 +121,8 @@
/*
* All non-public interfaces must be in the same package.
*/
- Class nonPublic1 = Bashful.class;
- Class nonPublic2 = null;
+ Class<?> nonPublic1 = Bashful.class;
+ Class<?> nonPublic2 = null;
String[] nonPublicInterfaces = new String[] {
"java.awt.Conditional",
"java.util.zip.ZipConstants",
@@ -147,7 +147,7 @@
"no second non-public interface found for test");
}
try {
- interfaces = new Class[] { nonPublic1, nonPublic2 };
+ interfaces = new Class<?>[] { nonPublic1, nonPublic2 };
proxyClass = Proxy.getProxyClass(loader, interfaces);
throw new RuntimeException(
"proxy class created with two non-public interfaces " +
@@ -163,7 +163,7 @@
* parameter signature but different return type.
*/
try {
- interfaces = new Class[] { Bar.class, Baz.class };
+ interfaces = new Class<?>[] { Bar.class, Baz.class };
proxyClass = Proxy.getProxyClass(loader, interfaces);
throw new RuntimeException(
"proxy class created with conflicting methods");
diff --git a/jdk/test/java/lang/reflect/Proxy/returnTypes/Test.java b/jdk/test/java/lang/reflect/Proxy/returnTypes/Test.java
index d775840..754e965 100644
--- a/jdk/test/java/lang/reflect/Proxy/returnTypes/Test.java
+++ b/jdk/test/java/lang/reflect/Proxy/returnTypes/Test.java
@@ -42,7 +42,7 @@
// additional test cases may be added to both of these lists:
- private static final Class[][] GOOD = {
+ private static final Class<?>[][] GOOD = {
{ Collection.class },
{ Iterable.class, Collection.class },
{ Iterable.class, Collection.class, List.class },
@@ -51,7 +51,7 @@
GetArray.class }
};
- private static final Class[][] BAD = {
+ private static final Class<?>[][] BAD = {
{ Runnable.class, PrivilegedAction.class },
{ GetSerializable.class, GetCloneable.class },
{ GetObject.class, GetSerializable.class, GetCloneable.class }
@@ -60,12 +60,12 @@
public static void main(String[] args) throws Exception {
System.err.println("\nRegression test for bug 4838310\n");
- ClassLoader loader = ClassLoader.getSystemClassLoader();
+ ClassLoader loader = Test.class.getClassLoader();
System.err.println("Testing GOOD combinations:");
for (int i = 0; i < GOOD.length; i++) {
- Class[] interfaces = GOOD[i];
+ Class<?>[] interfaces = GOOD[i];
System.err.println(Arrays.asList(interfaces));
Proxy.getProxyClass(loader, interfaces);
System.err.println("--- OK.");
@@ -74,7 +74,7 @@
System.err.println("Testing BAD combinations:");
for (int i = 0; i < BAD.length; i++) {
- Class[] interfaces = BAD[i];
+ Class<?>[] interfaces = BAD[i];
System.err.println(Arrays.asList(interfaces));
try {
Proxy.getProxyClass(loader, interfaces);