-#endif
#include "childproc.h"
@@ -390,7 +388,6 @@ forkChild(ChildStuff *c) {
return resultPid;
}
-#if defined(__solaris__) || defined(_ALLBSD_SOURCE) || defined(_AIX)
static pid_t
spawnChild(JNIEnv *env, jobject process, ChildStuff *c, const char *helperpath) {
pid_t resultPid;
@@ -473,7 +470,6 @@ spawnChild(JNIEnv *env, jobject process, ChildStuff *c, const char *helperpath)
* via the statement below */
return resultPid;
}
-#endif
/*
* Start a child process running function childProcess.
@@ -489,10 +485,8 @@ startChild(JNIEnv *env, jobject process, ChildStuff *c, const char *helperpath)
#endif
case MODE_FORK:
return forkChild(c);
-#if defined(__solaris__) || defined(_ALLBSD_SOURCE) || defined(_AIX)
case MODE_POSIX_SPAWN:
return spawnChild(env, process, c, helperpath);
-#endif
default:
return -1;
}
diff --git a/src/java.base/unix/native/libjava/java_props_md.c b/src/java.base/unix/native/libjava/java_props_md.c
index 352df91ec7f..5129ba74fdb 100644
--- a/src/java.base/unix/native/libjava/java_props_md.c
+++ b/src/java.base/unix/native/libjava/java_props_md.c
@@ -399,7 +399,7 @@ GetJavaProperties(JNIEnv *env)
#endif
/* patches/service packs installed */
- sprops.patch_level = "unknown";
+ sprops.patch_level = NULL; // leave it undefined
/* Java 2D/AWT properties */
#ifdef MACOSX
@@ -488,19 +488,15 @@ GetJavaProperties(JNIEnv *env)
&(sprops.format_variant),
&(sprops.encoding))) {
ParseLocale(env, LC_MESSAGES,
- &(sprops.language),
- &(sprops.script),
- &(sprops.country),
- &(sprops.variant),
+ &(sprops.display_language),
+ &(sprops.display_script),
+ &(sprops.display_country),
+ &(sprops.display_variant),
NULL);
} else {
- sprops.language = "en";
+ sprops.display_language = "en";
sprops.encoding = "ISO8859-1";
}
- sprops.display_language = sprops.language;
- sprops.display_script = sprops.script;
- sprops.display_country = sprops.country;
- sprops.display_variant = sprops.variant;
/* ParseLocale failed with OOME */
JNU_CHECK_EXCEPTION_RETURN(env, NULL);
@@ -543,18 +539,12 @@ GetJavaProperties(JNIEnv *env)
}
}
- /* User TIMEZONE */
- {
- /*
- * We defer setting up timezone until it's actually necessary.
- * Refer to TimeZone.getDefault(). However, the system
- * property is necessary to be able to be set by the command
- * line interface -D. Here temporarily set a null string to
- * timezone.
- */
- tzset(); /* for compatibility */
- sprops.timezone = "";
- }
+ /* User TIMEZONE
+ * We defer setting up timezone until it's actually necessary.
+ * Refer to TimeZone.getDefault(). The system property
+ * is able to be set by the command line interface -Duser.timezone.
+ */
+ tzset(); /* for compatibility */
/* Current directory */
{
diff --git a/src/java.base/unix/native/libjsig/jsig.c b/src/java.base/unix/native/libjsig/jsig.c
index 3578b99bb6c..e0972174191 100644
--- a/src/java.base/unix/native/libjsig/jsig.c
+++ b/src/java.base/unix/native/libjsig/jsig.c
@@ -77,7 +77,7 @@ static __thread bool reentry = false; /* prevent reentry deadlock (per-thread) *
/* Used to synchronize the installation of signal handlers. */
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
-static pthread_t tid = 0;
+static pthread_t tid;
typedef void (*sa_handler_t)(int);
typedef void (*sa_sigaction_t)(int, siginfo_t *, void *);
@@ -110,8 +110,11 @@ static void signal_lock() {
/* When the jvm is installing its set of signal handlers, threads
* other than the jvm thread should wait. */
if (jvm_signal_installing) {
- if (tid != pthread_self()) {
- pthread_cond_wait(&cond, &mutex);
+ /* tid is not initialized until jvm_signal_installing is set to true. */
+ if (pthread_equal(tid, pthread_self()) == 0) {
+ do {
+ pthread_cond_wait(&cond, &mutex);
+ } while (jvm_signal_installing);
}
}
}
diff --git a/src/java.base/windows/classes/java/lang/ProcessImpl.java b/src/java.base/windows/classes/java/lang/ProcessImpl.java
index 23a2c0b721e..b2208faf849 100644
--- a/src/java.base/windows/classes/java/lang/ProcessImpl.java
+++ b/src/java.base/windows/classes/java/lang/ProcessImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2018, 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
@@ -43,8 +43,8 @@ import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import jdk.internal.misc.JavaIOFileDescriptorAccess;
-import jdk.internal.misc.SharedSecrets;
+import jdk.internal.access.JavaIOFileDescriptorAccess;
+import jdk.internal.access.SharedSecrets;
import jdk.internal.ref.CleanerFactory;
/* This class is for the exclusive use of ProcessBuilder.start() to
diff --git a/src/java.base/windows/classes/java/net/DualStackPlainDatagramSocketImpl.java b/src/java.base/windows/classes/java/net/DualStackPlainDatagramSocketImpl.java
index 3363f388188..8b8ca588e3e 100644
--- a/src/java.base/windows/classes/java/net/DualStackPlainDatagramSocketImpl.java
+++ b/src/java.base/windows/classes/java/net/DualStackPlainDatagramSocketImpl.java
@@ -25,8 +25,8 @@
package java.net;
import java.io.IOException;
-import jdk.internal.misc.SharedSecrets;
-import jdk.internal.misc.JavaIOFileDescriptorAccess;
+import jdk.internal.access.SharedSecrets;
+import jdk.internal.access.JavaIOFileDescriptorAccess;
/**
* This class defines the plain DatagramSocketImpl that is used on
diff --git a/src/java.base/windows/classes/java/net/PlainSocketImpl.java b/src/java.base/windows/classes/java/net/PlainSocketImpl.java
index 643411d3769..14c834a5447 100644
--- a/src/java.base/windows/classes/java/net/PlainSocketImpl.java
+++ b/src/java.base/windows/classes/java/net/PlainSocketImpl.java
@@ -27,10 +27,10 @@ package java.net;
import java.io.IOException;
import java.io.FileDescriptor;
import java.security.AccessController;
-import java.security.PrivilegedAction;
+
import sun.security.action.GetPropertyAction;
-import jdk.internal.misc.SharedSecrets;
-import jdk.internal.misc.JavaIOFileDescriptorAccess;
+import jdk.internal.access.SharedSecrets;
+import jdk.internal.access.JavaIOFileDescriptorAccess;
/**
* On Windows system we simply delegate to native methods.
diff --git a/src/java.base/windows/classes/sun/nio/ch/FileDispatcherImpl.java b/src/java.base/windows/classes/sun/nio/ch/FileDispatcherImpl.java
index bc35a5d710f..e79c7eec3f0 100644
--- a/src/java.base/windows/classes/sun/nio/ch/FileDispatcherImpl.java
+++ b/src/java.base/windows/classes/sun/nio/ch/FileDispatcherImpl.java
@@ -27,8 +27,8 @@ package sun.nio.ch;
import java.io.FileDescriptor;
import java.io.IOException;
-import jdk.internal.misc.SharedSecrets;
-import jdk.internal.misc.JavaIOFileDescriptorAccess;
+import jdk.internal.access.SharedSecrets;
+import jdk.internal.access.JavaIOFileDescriptorAccess;
import sun.security.action.GetPropertyAction;
import java.io.File;
import java.nio.CharBuffer;
diff --git a/src/java.base/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java b/src/java.base/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java
index 2a4fda647d8..78fd92f3afe 100644
--- a/src/java.base/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java
+++ b/src/java.base/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2018, 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
@@ -31,8 +31,8 @@ import java.nio.ByteBuffer;
import java.nio.BufferOverflowException;
import java.io.IOException;
import java.io.FileDescriptor;
-import jdk.internal.misc.SharedSecrets;
-import jdk.internal.misc.JavaIOFileDescriptorAccess;
+import jdk.internal.access.SharedSecrets;
+import jdk.internal.access.JavaIOFileDescriptorAccess;
/**
* Windows implementation of AsynchronousFileChannel using overlapped I/O.
diff --git a/src/java.base/windows/classes/sun/nio/fs/WindowsChannelFactory.java b/src/java.base/windows/classes/sun/nio/fs/WindowsChannelFactory.java
index 3e219c98f24..89c500fad81 100644
--- a/src/java.base/windows/classes/sun/nio/fs/WindowsChannelFactory.java
+++ b/src/java.base/windows/classes/sun/nio/fs/WindowsChannelFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2018, 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
@@ -34,8 +34,8 @@ import java.nio.file.OpenOption;
import java.nio.file.StandardOpenOption;
import java.util.Set;
-import jdk.internal.misc.JavaIOFileDescriptorAccess;
-import jdk.internal.misc.SharedSecrets;
+import jdk.internal.access.JavaIOFileDescriptorAccess;
+import jdk.internal.access.SharedSecrets;
import sun.nio.ch.FileChannelImpl;
import sun.nio.ch.ThreadPool;
import sun.nio.ch.WindowsAsynchronousFileChannelImpl;
diff --git a/src/java.base/windows/native/libjava/java_props_md.c b/src/java.base/windows/native/libjava/java_props_md.c
index 6e616d73ba8..3d738613a1d 100644
--- a/src/java.base/windows/native/libjava/java_props_md.c
+++ b/src/java.base/windows/native/libjava/java_props_md.c
@@ -661,12 +661,6 @@ GetJavaProperties(JNIEnv* env)
userDefaultUILang = userDefaultLCID;
}
- SetupI18nProps(userDefaultUILang,
- &sprops.language,
- &sprops.script,
- &sprops.country,
- &sprops.variant,
- &display_encoding);
SetupI18nProps(userDefaultLCID,
&sprops.format_language,
&sprops.format_script,
@@ -710,17 +704,12 @@ GetJavaProperties(JNIEnv* env)
}
sprops.unicode_encoding = "UnicodeLittle";
- /* User TIMEZONE */
- {
- /*
- * We defer setting up timezone until it's actually necessary.
- * Refer to TimeZone.getDefault(). However, the system
- * property is necessary to be able to be set by the command
- * line interface -D. Here temporarily set a null string to
- * timezone.
- */
- sprops.timezone = "";
- }
+
+ /* User TIMEZONE
+ * We defer setting up timezone until it's actually necessary.
+ * Refer to TimeZone.getDefault(). The system property
+ * is able to be set by the command line interface -Duser.timezone.
+ */
/* Current directory */
{
diff --git a/src/java.base/windows/native/libnio/fs/WindowsNativeDispatcher.c b/src/java.base/windows/native/libnio/fs/WindowsNativeDispatcher.c
index 07ba6e4a1f6..63cb363d17e 100644
--- a/src/java.base/windows/native/libnio/fs/WindowsNativeDispatcher.c
+++ b/src/java.base/windows/native/libnio/fs/WindowsNativeDispatcher.c
@@ -311,8 +311,10 @@ Java_sun_nio_fs_WindowsNativeDispatcher_FindFirstFile0(JNIEnv* env, jclass this,
HANDLE handle = FindFirstFileW(lpFileName, &data);
if (handle != INVALID_HANDLE_VALUE) {
jstring name = (*env)->NewString(env, data.cFileName, (jsize)wcslen(data.cFileName));
- if (name == NULL)
+ if (name == NULL) {
+ FindClose(handle);
return;
+ }
(*env)->SetLongField(env, obj, findFirst_handle, ptr_to_jlong(handle));
(*env)->SetObjectField(env, obj, findFirst_name, name);
(*env)->SetIntField(env, obj, findFirst_attributes, data.dwFileAttributes);
@@ -362,8 +364,10 @@ Java_sun_nio_fs_WindowsNativeDispatcher_FindFirstStream0(JNIEnv* env, jclass thi
handle = FindFirstStreamW(lpFileName, FindStreamInfoStandard, &data, 0);
if (handle != INVALID_HANDLE_VALUE) {
jstring name = (*env)->NewString(env, data.cStreamName, (jsize)wcslen(data.cStreamName));
- if (name == NULL)
+ if (name == NULL) {
+ FindClose(handle);
return;
+ }
(*env)->SetLongField(env, obj, findStream_handle, ptr_to_jlong(handle));
(*env)->SetObjectField(env, obj, findStream_name, name);
} else {
diff --git a/src/java.compiler/share/classes/javax/annotation/processing/RoundEnvironment.java b/src/java.compiler/share/classes/javax/annotation/processing/RoundEnvironment.java
index 9f7fb7f6f6b..b8c53c2df1d 100644
--- a/src/java.compiler/share/classes/javax/annotation/processing/RoundEnvironment.java
+++ b/src/java.compiler/share/classes/javax/annotation/processing/RoundEnvironment.java
@@ -143,11 +143,26 @@ public interface RoundEnvironment {
* simply because a {@code module-info} file for that module was
* created.
*
+ * Note: An implementation of this method typically performs
+ * an internal conversion from the runtime reflective
+ * representation of an annotation type as a {@code Class} object
+ * to a different representation used for annotation
+ * processing. The set of annotation types present in the runtime
+ * context may differ from the set of annotation types present in
+ * the context of annotation processing in a particular
+ * environmental configuration. If an runtime annotation type is
+ * not present in the annotation processing context, the situation
+ * is not treated as an error and no elements are found for that
+ * annotation type.
+ *
* @param a annotation type being requested
* @return the elements annotated with the given annotation type,
* or an empty set if there are none
* @throws IllegalArgumentException if the argument does not
* represent an annotation type
+ *
+ * @see javax.lang.model.AnnotatedConstruct#getAnnotation(Class)
+ * @see javax.lang.model.AnnotatedConstruct#getAnnotationsByType(Class)
*/
Set extends Element> getElementsAnnotatedWith(Class extends Annotation> a);
@@ -155,6 +170,18 @@ public interface RoundEnvironment {
* Returns the elements annotated with one or more of the given
* annotation types.
*
+ *
Note: An implementation of this method typically performs
+ * an internal conversion from the runtime reflective
+ * representation of an annotation type as a {@code Class} object
+ * to a different representation used for annotation
+ * processing. The set of annotation types present in the runtime
+ * context may differ from the set of annotation types present in
+ * the context of annotation processing in a particular
+ * environmental configuration. If an runtime annotation type is
+ * not present in the annotation processing context, the situation
+ * is not treated as an error and no elements are found for that
+ * annotation type.
+ *
* @apiNote This method may be useful when processing repeating
* annotations by looking for an annotation type and its
* containing annotation type at the same time.
@@ -172,6 +199,10 @@ public interface RoundEnvironment {
* @throws IllegalArgumentException if the any elements of the
* argument set do not represent an annotation type
* @jls 9.6.3 Repeatable Annotation Types
+ *
+ * @see javax.lang.model.AnnotatedConstruct#getAnnotation(Class)
+ * @see javax.lang.model.AnnotatedConstruct#getAnnotationsByType(Class)
+ *
* @since 9
*/
default Set extends Element> getElementsAnnotatedWithAny(Set> annotations){
diff --git a/src/java.desktop/share/classes/com/sun/beans/decoder/DocumentHandler.java b/src/java.desktop/share/classes/com/sun/beans/decoder/DocumentHandler.java
index 6c9607e7ea9..e48bb07f773 100644
--- a/src/java.desktop/share/classes/com/sun/beans/decoder/DocumentHandler.java
+++ b/src/java.desktop/share/classes/com/sun/beans/decoder/DocumentHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2018, 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,7 +50,7 @@ import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
-import jdk.internal.misc.SharedSecrets;
+import jdk.internal.access.SharedSecrets;
/**
* The main class to parse JavaBeans XML archive.
diff --git a/src/java.desktop/share/classes/java/awt/EventQueue.java b/src/java.desktop/share/classes/java/awt/EventQueue.java
index c2da2bdce68..9ee82f2e2f0 100644
--- a/src/java.desktop/share/classes/java/awt/EventQueue.java
+++ b/src/java.desktop/share/classes/java/awt/EventQueue.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2018, 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
@@ -47,8 +47,8 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.security.AccessControlContext;
-import jdk.internal.misc.SharedSecrets;
-import jdk.internal.misc.JavaSecurityAccess;
+import jdk.internal.access.SharedSecrets;
+import jdk.internal.access.JavaSecurityAccess;
/**
* {@code EventQueue} is a platform-independent class
diff --git a/src/java.desktop/share/classes/java/awt/font/JavaAWTFontAccessImpl.java b/src/java.desktop/share/classes/java/awt/font/JavaAWTFontAccessImpl.java
index 738cd6c9dc9..74545140966 100644
--- a/src/java.desktop/share/classes/java/awt/font/JavaAWTFontAccessImpl.java
+++ b/src/java.desktop/share/classes/java/awt/font/JavaAWTFontAccessImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -25,7 +25,7 @@
package java.awt.font;
-import jdk.internal.misc.JavaAWTFontAccess;
+import jdk.internal.access.JavaAWTFontAccess;
class JavaAWTFontAccessImpl implements JavaAWTFontAccess {
diff --git a/src/java.desktop/share/classes/java/awt/font/NumericShaper.java b/src/java.desktop/share/classes/java/awt/font/NumericShaper.java
index b14bc566109..c36082c6d03 100644
--- a/src/java.desktop/share/classes/java/awt/font/NumericShaper.java
+++ b/src/java.desktop/share/classes/java/awt/font/NumericShaper.java
@@ -31,7 +31,7 @@ import java.util.Arrays;
import java.util.Comparator;
import java.util.EnumSet;
import java.util.Set;
-import jdk.internal.misc.SharedSecrets;
+import jdk.internal.access.SharedSecrets;
/**
* The {@code NumericShaper} class is used to convert Latin-1 (European)
diff --git a/src/java.desktop/share/classes/java/awt/font/TextAttribute.java b/src/java.desktop/share/classes/java/awt/font/TextAttribute.java
index d357ff974a4..47aa4b87aa6 100644
--- a/src/java.desktop/share/classes/java/awt/font/TextAttribute.java
+++ b/src/java.desktop/share/classes/java/awt/font/TextAttribute.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, 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
@@ -44,7 +44,7 @@ import java.io.InvalidObjectException;
import java.text.AttributedCharacterIterator.Attribute;
import java.util.Map;
import java.util.HashMap;
-import jdk.internal.misc.SharedSecrets;
+import jdk.internal.access.SharedSecrets;
/**
* The {@code TextAttribute} class defines attribute keys and
diff --git a/src/java.desktop/share/classes/java/beans/Introspector.java b/src/java.desktop/share/classes/java/beans/Introspector.java
index 3eb50f7647e..24c7ef4e5d0 100644
--- a/src/java.desktop/share/classes/java/beans/Introspector.java
+++ b/src/java.desktop/share/classes/java/beans/Introspector.java
@@ -42,15 +42,14 @@ import java.lang.reflect.Type;
import java.util.Map;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.EventObject;
import java.util.List;
import java.util.TreeMap;
-import jdk.internal.misc.JavaBeansAccess;
-import jdk.internal.misc.SharedSecrets;
+import jdk.internal.access.JavaBeansAccess;
+import jdk.internal.access.SharedSecrets;
import sun.reflect.misc.ReflectUtil;
/**
diff --git a/src/java.desktop/share/classes/javax/swing/RepaintManager.java b/src/java.desktop/share/classes/javax/swing/RepaintManager.java
index 3bbda1bbdfd..9615a272238 100644
--- a/src/java.desktop/share/classes/javax/swing/RepaintManager.java
+++ b/src/java.desktop/share/classes/javax/swing/RepaintManager.java
@@ -35,8 +35,8 @@ import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.applet.*;
-import jdk.internal.misc.JavaSecurityAccess;
-import jdk.internal.misc.SharedSecrets;
+import jdk.internal.access.JavaSecurityAccess;
+import jdk.internal.access.SharedSecrets;
import sun.awt.AWTAccessor;
import sun.awt.AppContext;
import sun.awt.DisplayChangedListener;
diff --git a/src/java.desktop/share/classes/javax/swing/TransferHandler.java b/src/java.desktop/share/classes/javax/swing/TransferHandler.java
index 6c7075488a0..ad4a8944703 100644
--- a/src/java.desktop/share/classes/javax/swing/TransferHandler.java
+++ b/src/java.desktop/share/classes/javax/swing/TransferHandler.java
@@ -46,9 +46,9 @@ import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.AccessControlContext;
-import java.security.ProtectionDomain;
-import jdk.internal.misc.SharedSecrets;
-import jdk.internal.misc.JavaSecurityAccess;
+
+import jdk.internal.access.SharedSecrets;
+import jdk.internal.access.JavaSecurityAccess;
import sun.awt.AWTAccessor;
diff --git a/src/java.desktop/share/classes/sun/awt/AppContext.java b/src/java.desktop/share/classes/sun/awt/AppContext.java
index e966905d2e0..d2fd17b08b7 100644
--- a/src/java.desktop/share/classes/sun/awt/AppContext.java
+++ b/src/java.desktop/share/classes/sun/awt/AppContext.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2018, 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
@@ -44,8 +44,8 @@ import java.beans.PropertyChangeSupport;
import java.beans.PropertyChangeListener;
import java.lang.ref.SoftReference;
-import jdk.internal.misc.JavaAWTAccess;
-import jdk.internal.misc.SharedSecrets;
+import jdk.internal.access.JavaAWTAccess;
+import jdk.internal.access.SharedSecrets;
import sun.util.logging.PlatformLogger;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
diff --git a/src/java.logging/share/classes/java/util/logging/Level.java b/src/java.logging/share/classes/java/util/logging/Level.java
index 8607519f3a9..2bb73effda1 100644
--- a/src/java.logging/share/classes/java/util/logging/Level.java
+++ b/src/java.logging/share/classes/java/util/logging/Level.java
@@ -40,8 +40,8 @@ import java.util.Optional;
import java.util.ResourceBundle;
import java.util.function.Function;
import jdk.internal.loader.ClassLoaderValue;
-import jdk.internal.misc.JavaUtilResourceBundleAccess;
-import jdk.internal.misc.SharedSecrets;
+import jdk.internal.access.JavaUtilResourceBundleAccess;
+import jdk.internal.access.SharedSecrets;
/**
* The Level class defines a set of standard logging levels that
diff --git a/src/java.logging/share/classes/java/util/logging/LogManager.java b/src/java.logging/share/classes/java/util/logging/LogManager.java
index 736f07694f0..fdcf73b6ce5 100644
--- a/src/java.logging/share/classes/java/util/logging/LogManager.java
+++ b/src/java.logging/share/classes/java/util/logging/LogManager.java
@@ -39,8 +39,8 @@ import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import jdk.internal.misc.JavaAWTAccess;
-import jdk.internal.misc.SharedSecrets;
+import jdk.internal.access.JavaAWTAccess;
+import jdk.internal.access.SharedSecrets;
import sun.util.logging.internal.LoggingProviderImpl;
import static jdk.internal.logger.DefaultLoggerFinder.isSystem;
diff --git a/src/java.logging/share/classes/java/util/logging/Logger.java b/src/java.logging/share/classes/java/util/logging/Logger.java
index f82e6856802..d75fd6f27b2 100644
--- a/src/java.logging/share/classes/java/util/logging/Logger.java
+++ b/src/java.logging/share/classes/java/util/logging/Logger.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2018, 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
@@ -37,8 +37,8 @@ import java.util.ResourceBundle;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.function.Supplier;
-import jdk.internal.misc.JavaUtilResourceBundleAccess;
-import jdk.internal.misc.SharedSecrets;
+import jdk.internal.access.JavaUtilResourceBundleAccess;
+import jdk.internal.access.SharedSecrets;
import jdk.internal.reflect.CallerSensitive;
import jdk.internal.reflect.Reflection;
import static jdk.internal.logger.DefaultLoggerFinder.isSystem;
diff --git a/src/java.management/share/classes/com/sun/jmx/mbeanserver/JavaBeansAccessor.java b/src/java.management/share/classes/com/sun/jmx/mbeanserver/JavaBeansAccessor.java
index bd2edb6b9fb..d8692d32e31 100644
--- a/src/java.management/share/classes/com/sun/jmx/mbeanserver/JavaBeansAccessor.java
+++ b/src/java.management/share/classes/com/sun/jmx/mbeanserver/JavaBeansAccessor.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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,8 +26,8 @@ package com.sun.jmx.mbeanserver;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
-import jdk.internal.misc.JavaBeansAccess;
-import jdk.internal.misc.SharedSecrets;
+import jdk.internal.access.JavaBeansAccess;
+import jdk.internal.access.SharedSecrets;
/**
* A centralized place for gaining access to java.beans related functionality -
diff --git a/src/java.management/share/classes/java/lang/management/package.html b/src/java.management/share/classes/java/lang/management/package.html
index f1d22738272..5c020fa0b09 100644
--- a/src/java.management/share/classes/java/lang/management/package.html
+++ b/src/java.management/share/classes/java/lang/management/package.html
@@ -1,5 +1,5 @@
@@ -68,28 +74,28 @@ public class TestVolatiles {
// i.e. GC type plus GC conifg
switch(testType) {
case "G1":
- argcount = 8;
+ argcount = 9;
procArgs = new String[argcount];
procArgs[argcount - 2] = "-XX:+UseG1GC";
break;
case "Parallel":
- argcount = 8;
+ argcount = 9;
procArgs = new String[argcount];
procArgs[argcount - 2] = "-XX:+UseParallelGC";
break;
case "Serial":
- argcount = 8;
+ argcount = 9;
procArgs = new String[argcount];
procArgs[argcount - 2] = "-XX:+UseSerialGC";
break;
case "CMS":
- argcount = 9 ;
+ argcount = 10;
procArgs = new String[argcount];
procArgs[argcount - 3] = "-XX:+UseConcMarkSweepGC";
procArgs[argcount - 2] = "-XX:-UseCondCardMark";
break;
case "CMSCondMark":
- argcount = 9 ;
+ argcount = 10;
procArgs = new String[argcount];
procArgs[argcount - 3] = "-XX:+UseConcMarkSweepGC";
procArgs[argcount - 2] = "-XX:+UseCondCardMark";
@@ -106,14 +112,34 @@ public class TestVolatiles {
// disable the transform.
procArgs[0] = "-XX:-UseBarriersForVolatile";
+ procArgs[1] = "-XX:+UseCompressedOops";
- procArgs[1] = "-XX:-TieredCompilation";
- procArgs[2] = "-XX:+PrintOptoAssembly";
- procArgs[3] = "-XX:CompileCommand=compileonly," + fullclassname + "::" + "test*";
- procArgs[4] = "--add-exports";
- procArgs[5] = "java.base/jdk.internal.misc=ALL-UNNAMED";
+ procArgs[2] = "-XX:-TieredCompilation";
+ procArgs[3] = "-XX:+PrintOptoAssembly";
+ procArgs[4] = "-XX:CompileCommand=compileonly," + fullclassname + "::" + "test*";
+ procArgs[5] = "--add-exports";
+ procArgs[6] = "java.base/jdk.internal.misc=ALL-UNNAMED";
procArgs[argcount - 1] = fullclassname;
+ runtest(classname, testType, false, true, procArgs);
+ // rerun the test class without the transform applied and
+ // check the alternative generation is as expected
+
+ procArgs[0] = "-XX:+UseBarriersForVolatile";
+ runtest(classname, testType, true, true, procArgs);
+
+ if (!classname.equals("TestUnsafeVolatileGAA")) {
+ procArgs[0] = "-XX:-UseBarriersForVolatile";
+ procArgs[1] = "-XX:-UseCompressedOops";
+ runtest(classname, testType, false, false, procArgs);
+
+ procArgs[0] = "-XX:+UseBarriersForVolatile";
+ runtest(classname, testType, true, false, procArgs);
+ }
+ }
+
+
+ public void runtest(String classname, String testType, boolean useBarriersForVolatile, boolean useCompressedOops, String[] procArgs) throws Throwable {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(procArgs);
OutputAnalyzer output = new OutputAnalyzer(pb.start());
@@ -125,23 +151,7 @@ public class TestVolatiles {
// appropriate to test class, test type and whether transform
// was applied
- checkoutput(output, classname, testType, false);
-
- // rerun the test class without the transform applied and
- // check the alternative generation is as expected
-
- procArgs[0] = "-XX:+UseBarriersForVolatile";
-
- pb = ProcessTools.createJavaProcessBuilder(procArgs);
- output = new OutputAnalyzer(pb.start());
-
- output.stderrShouldBeEmptyIgnoreVMWarnings();
- output.stdoutShouldNotBeEmpty();
- output.shouldHaveExitValue(0);
-
- // again check the output for the correct asm sequence
-
- checkoutput(output, classname, testType, true);
+ checkoutput(output, classname, testType, useBarriersForVolatile, useCompressedOops);
}
// skip through output returning a line containing the desireed
@@ -150,7 +160,7 @@ public class TestVolatiles {
{
while (iter.hasNext()) {
String nextLine = iter.next();
- if (nextLine.contains(substring)) {
+ if (nextLine.matches(".*" + substring + ".*")) {
return nextLine;
}
}
@@ -163,7 +173,7 @@ public class TestVolatiles {
// n.b. the spawned JVM's output is included in the exception
// message to make it easeir to identify what is missing.
- private void checkCompile(Iterator iter, String methodname, String[] expected, OutputAnalyzer output)
+ private boolean checkCompile(Iterator iter, String methodname, String[] expected, OutputAnalyzer output, boolean do_throw)
{
// trace call to allow eyeball check of what we are checking against
System.out.println("checkCompile(" + methodname + ",");
@@ -176,30 +186,43 @@ public class TestVolatiles {
System.out.println(" })");
// look for the start of an opto assembly print block
- String match = skipTo(iter, "{method}");
+ String match = skipTo(iter, Pattern.quote("{method}"));
if (match == null) {
- throw new RuntimeException("Missing compiler output for " + methodname + "!\n\n" + output.getOutput());
+ if (do_throw) {
+ throw new RuntimeException("Missing compiler output for " + methodname + "!\n\n" + output.getOutput());
+ }
+ return false;
}
// check the compiled method name is right
- match = skipTo(iter, "- name:");
+ match = skipTo(iter, Pattern.quote("- name:"));
if (match == null) {
- throw new RuntimeException("Missing compiled method name!\n\n" + output.getOutput());
+ if (do_throw) {
+ throw new RuntimeException("Missing compiled method name!\n\n" + output.getOutput());
+ }
+ return false;
}
if (!match.contains(methodname)) {
- throw new RuntimeException("Wrong method " + match + "!\n -- expecting " + methodname + "\n\n" + output.getOutput());
+ if (do_throw) {
+ throw new RuntimeException("Wrong method " + match + "!\n -- expecting " + methodname + "\n\n" + output.getOutput());
+ }
+ return false;
}
// make sure we can match each expected term in order
for (String s : expected) {
match = skipTo(iter, s);
if (match == null) {
- throw new RuntimeException("Missing expected output " + s + "!\n\n" + output.getOutput());
+ if (do_throw) {
+ throw new RuntimeException("Missing expected output " + s + "!\n\n" + output.getOutput());
+ }
+ return false;
}
}
+ return true;
}
// check for expected asm output from a volatile load
- private void checkload(OutputAnalyzer output, String testType, boolean useBarriersForVolatile) throws Throwable
+ private void checkload(OutputAnalyzer output, String testType, boolean useBarriersForVolatile, boolean useCompressedOops) throws Throwable
{
Iterator iter = output.asLines().listIterator();
@@ -211,7 +234,7 @@ public class TestVolatiles {
if (!useBarriersForVolatile) {
matches = new String[] {
"ldarw",
- "membar_acquire (elided)",
+ "membar_acquire \\(elided\\)",
"ret"
};
} else {
@@ -223,15 +246,30 @@ public class TestVolatiles {
};
}
- checkCompile(iter, "testInt", matches, output);
+ checkCompile(iter, "testInt", matches, output, true);
- checkCompile(iter, "testObj", matches, output) ;
+ if (!useBarriersForVolatile) {
+ matches = new String[] {
+ useCompressedOops ? "ldarw?" : "ldar",
+ "membar_acquire \\(elided\\)",
+ "ret"
+ };
+ } else {
+ matches = new String[] {
+ useCompressedOops ? "ldrw?" : "ldr",
+ "membar_acquire",
+ "dmb ish",
+ "ret"
+ };
+ }
+
+ checkCompile(iter, "testObj", matches, output, true);
}
// check for expected asm output from a volatile store
- private void checkstore(OutputAnalyzer output, String testType, boolean useBarriersForVolatile) throws Throwable
+ private void checkstore(OutputAnalyzer output, String testType, boolean useBarriersForVolatile, boolean useCompressedOops) throws Throwable
{
Iterator iter = output.asLines().listIterator();
@@ -241,9 +279,9 @@ public class TestVolatiles {
if (!useBarriersForVolatile) {
// this is the sequence of instructions for all cases
matches = new String[] {
- "membar_release (elided)",
+ "membar_release \\(elided\\)",
"stlrw",
- "membar_volatile (elided)",
+ "membar_volatile \\(elided\\)",
"ret"
};
} else {
@@ -258,7 +296,7 @@ public class TestVolatiles {
};
}
- checkCompile(iter, "testInt", matches, output);
+ checkCompile(iter, "testInt", matches, output, true);
// object stores will be as above except for when the GC
// introduces barriers for card marking
@@ -268,9 +306,9 @@ public class TestVolatiles {
default:
// this is the basic sequence of instructions
matches = new String[] {
- "membar_release (elided)",
- "stlrw",
- "membar_volatile (elided)",
+ "membar_release \\(elided\\)",
+ useCompressedOops ? "stlrw?" : "stlr",
+ "membar_volatile \\(elided\\)",
"ret"
};
break;
@@ -278,12 +316,12 @@ public class TestVolatiles {
// a card mark volatile barrier should be generated
// before the card mark strb
matches = new String[] {
- "membar_release (elided)",
- "stlrw",
+ "membar_release \\(elided\\)",
+ useCompressedOops ? "stlrw?" : "stlr",
"membar_volatile",
"dmb ish",
"strb",
- "membar_volatile (elided)",
+ "membar_volatile \\(elided\\)",
"ret"
};
break;
@@ -292,13 +330,13 @@ public class TestVolatiles {
// before the card mark strb from the StoreCM and the
// storestore barrier from the StoreCM should be elided
matches = new String[] {
- "membar_release (elided)",
- "stlrw",
+ "membar_release \\(elided\\)",
+ useCompressedOops ? "stlrw?" : "stlr",
"membar_volatile",
"dmb ish",
- "storestore (elided)",
+ "storestore \\(elided\\)",
"strb",
- "membar_volatile (elided)",
+ "membar_volatile \\(elided\\)",
"ret"
};
break;
@@ -308,12 +346,12 @@ public class TestVolatiles {
// storestore barrier from the StoreCM should be
// generated as "dmb ishst"
matches = new String[] {
- "membar_release (elided)",
- "stlrw",
+ "membar_release \\(elided\\)",
+ useCompressedOops ? "stlrw?" : "stlr",
"storestore",
"dmb ishst",
"strb",
- "membar_volatile (elided)",
+ "membar_volatile \\(elided\\)",
"ret"
};
break;
@@ -325,7 +363,7 @@ public class TestVolatiles {
matches = new String[] {
"membar_release",
"dmb ish",
- "strw",
+ useCompressedOops ? "strw?" : "str",
"membar_volatile",
"dmb ish",
"ret"
@@ -337,7 +375,7 @@ public class TestVolatiles {
matches = new String[] {
"membar_release",
"dmb ish",
- "strw",
+ useCompressedOops ? "strw?" : "str",
"membar_volatile",
"dmb ish",
"strb",
@@ -353,10 +391,10 @@ public class TestVolatiles {
matches = new String[] {
"membar_release",
"dmb ish",
- "strw",
+ useCompressedOops ? "strw?" : "str",
"membar_volatile",
"dmb ish",
- "storestore (elided)",
+ "storestore \\(elided\\)",
"strb",
"membar_volatile",
"dmb ish",
@@ -371,7 +409,7 @@ public class TestVolatiles {
matches = new String[] {
"membar_release",
"dmb ish",
- "strw",
+ useCompressedOops ? "strw?" : "str",
"storestore",
"dmb ishst",
"strb",
@@ -383,40 +421,48 @@ public class TestVolatiles {
}
}
- checkCompile(iter, "testObj", matches, output);
+ checkCompile(iter, "testObj", matches, output, true);
}
// check for expected asm output from a volatile cas
- private void checkcas(OutputAnalyzer output, String testType, boolean useBarriersForVolatile) throws Throwable
+ private void checkcas(OutputAnalyzer output, String testType, boolean useBarriersForVolatile, boolean useCompressedOops) throws Throwable
{
Iterator iter = output.asLines().listIterator();
String[] matches;
+ String[][] tests = {
+ { "testInt", "cmpxchgw" },
+ { "testLong", "cmpxchg" },
+ { "testByte", "cmpxchgb" },
+ { "testShort", "cmpxchgs" },
+ };
- // non object stores are straightforward
- if (!useBarriersForVolatile) {
- // this is the sequence of instructions for all cases
- matches = new String[] {
- "membar_release (elided)",
- "cmpxchgw_acq",
- "membar_acquire (elided)",
- "ret"
- };
- } else {
- // this is the alternative sequence of instructions
- matches = new String[] {
- "membar_release",
- "dmb ish",
- "cmpxchgw",
- "membar_acquire",
- "dmb ish",
- "ret"
- };
+ for (String[] test : tests) {
+ // non object stores are straightforward
+ if (!useBarriersForVolatile) {
+ // this is the sequence of instructions for all cases
+ matches = new String[] {
+ "membar_release \\(elided\\)",
+ test[1] + "_acq",
+ "membar_acquire \\(elided\\)",
+ "ret"
+ };
+ } else {
+ // this is the alternative sequence of instructions
+ matches = new String[] {
+ "membar_release",
+ "dmb ish",
+ test[1] + " ",
+ "membar_acquire",
+ "dmb ish",
+ "ret"
+ };
+ }
+
+ checkCompile(iter, test[0], matches, output, true);
}
- checkCompile(iter, "testInt", matches, output);
-
// object stores will be as above except for when the GC
// introduces barriers for card marking
@@ -425,10 +471,10 @@ public class TestVolatiles {
default:
// this is the basic sequence of instructions
matches = new String[] {
- "membar_release (elided)",
- "cmpxchgw_acq",
+ "membar_release \\(elided\\)",
+ useCompressedOops ? "cmpxchgw?_acq" : "cmpxchg_acq",
"strb",
- "membar_acquire (elided)",
+ "membar_acquire \\(elided\\)",
"ret"
};
break;
@@ -436,12 +482,12 @@ public class TestVolatiles {
// a card mark volatile barrier should be generated
// before the card mark strb
matches = new String[] {
- "membar_release (elided)",
- "cmpxchgw_acq",
+ "membar_release \\(elided\\)",
+ useCompressedOops ? "cmpxchgw?_acq" : "cmpxchg_acq",
"membar_volatile",
"dmb ish",
"strb",
- "membar_acquire (elided)",
+ "membar_acquire \\(elided\\)",
"ret"
};
break;
@@ -450,13 +496,13 @@ public class TestVolatiles {
// before the card mark strb from the StoreCM and the
// storestore barrier from the StoreCM should be elided
matches = new String[] {
- "membar_release (elided)",
- "cmpxchgw_acq",
+ "membar_release \\(elided\\)",
+ useCompressedOops ? "cmpxchgw?_acq" : "cmpxchg_acq",
"membar_volatile",
"dmb ish",
- "storestore (elided)",
+ "storestore \\(elided\\)",
"strb",
- "membar_acquire (elided)",
+ "membar_acquire \\(elided\\)",
"ret"
};
break;
@@ -465,12 +511,12 @@ public class TestVolatiles {
// before the card mark strb from the StoreCM and the
// storestore barrier from the StoreCM should be elided
matches = new String[] {
- "membar_release (elided)",
- "cmpxchgw_acq",
+ "membar_release \\(elided\\)",
+ useCompressedOops ? "cmpxchgw?_acq" : "cmpxchg_acq",
"storestore",
"dmb ishst",
"strb",
- "membar_acquire (elided)",
+ "membar_acquire \\(elided\\)",
"ret"
};
break;
@@ -482,7 +528,7 @@ public class TestVolatiles {
matches = new String[] {
"membar_release",
"dmb ish",
- "cmpxchgw",
+ useCompressedOops ? "cmpxchgw? " : "cmpxchg ",
"membar_acquire",
"dmb ish",
"ret"
@@ -494,7 +540,7 @@ public class TestVolatiles {
matches = new String[] {
"membar_release",
"dmb ish",
- "cmpxchgw",
+ useCompressedOops ? "cmpxchgw? " : "cmpxchg ",
"membar_volatile",
"dmb ish",
"strb",
@@ -510,10 +556,10 @@ public class TestVolatiles {
matches = new String[] {
"membar_release",
"dmb ish",
- "cmpxchgw",
+ useCompressedOops ? "cmpxchgw? " : "cmpxchg ",
"membar_volatile",
"dmb ish",
- "storestore (elided)",
+ "storestore \\(elided\\)",
"strb",
"membar_acquire",
"dmb ish",
@@ -528,7 +574,7 @@ public class TestVolatiles {
matches = new String[] {
"membar_release",
"dmb ish",
- "cmpxchgw",
+ useCompressedOops ? "cmpxchgw? " : "cmpxchg ",
"storestore",
"dmb ishst",
"strb",
@@ -540,12 +586,391 @@ public class TestVolatiles {
}
}
- checkCompile(iter, "testObj", matches, output);
+ checkCompile(iter, "testObj", matches, output, true);
+ }
+
+ private void checkcae(OutputAnalyzer output, String testType, boolean useBarriersForVolatile, boolean useCompressedOops) throws Throwable
+ {
+ ListIterator iter = output.asLines().listIterator();
+
+ String[] matches;
+ String[][] tests = {
+ { "testInt", "cmpxchgw" },
+ { "testLong", "cmpxchg" },
+ { "testByte", "cmpxchgb" },
+ { "testShort", "cmpxchgs" },
+ };
+
+ for (String[] test : tests) {
+ // non object stores are straightforward
+ if (!useBarriersForVolatile) {
+ // this is the sequence of instructions for all cases
+ matches = new String[] {
+ "membar_release \\(elided\\)",
+ test[1] + "_acq",
+ "membar_acquire \\(elided\\)",
+ "ret"
+ };
+ } else {
+ // this is the alternative sequence of instructions
+ matches = new String[] {
+ "membar_release",
+ "dmb ish",
+ test[1] + " ",
+ "membar_acquire",
+ "dmb ish",
+ "ret"
+ };
+ }
+
+ checkCompile(iter, test[0], matches, output, true);
+ }
+
+ // object stores will be as above except for when the GC
+ // introduces barriers for card marking
+
+ if (!useBarriersForVolatile) {
+ switch (testType) {
+ default:
+ // this is the basic sequence of instructions
+ matches = new String[] {
+ "membar_release \\(elided\\)",
+ "strb",
+ useCompressedOops ? "cmpxchgw?_acq" : "cmpxchg_acq",
+ "membar_acquire \\(elided\\)",
+ "ret"
+ };
+
+ // card marking store may be scheduled before or after
+ // the cmpxchg so try both sequences.
+ int idx = iter.nextIndex();
+ if (!checkCompile(iter, "testObj", matches, output, false)) {
+ iter = output.asLines().listIterator(idx);
+
+ matches = new String[] {
+ "membar_release \\(elided\\)",
+ useCompressedOops ? "cmpxchgw?_acq" : "cmpxchg_acq",
+ "strb",
+ "membar_acquire \\(elided\\)",
+ "ret"
+ };
+
+ checkCompile(iter, "testObj", matches, output, true);
+ }
+ return;
+
+ case "G1":
+ // a card mark volatile barrier should be generated
+ // before the card mark strb
+ matches = new String[] {
+ "membar_release \\(elided\\)",
+ useCompressedOops ? "cmpxchgw?_acq" : "cmpxchg_acq",
+ "membar_volatile",
+ "dmb ish",
+ "strb",
+ "membar_acquire \\(elided\\)",
+ "ret"
+ };
+ break;
+ case "CMSCondMark":
+ // a card mark volatile barrier should be generated
+ // before the card mark strb from the StoreCM and the
+ // storestore barrier from the StoreCM should be elided
+ matches = new String[] {
+ "membar_release \\(elided\\)",
+ useCompressedOops ? "cmpxchgw?_acq" : "cmpxchg_acq",
+ "membar_volatile",
+ "dmb ish",
+ "storestore \\(elided\\)",
+ "strb",
+ "membar_acquire \\(elided\\)",
+ "ret"
+ };
+ break;
+ case "CMS":
+ // a volatile card mark membar should not be generated
+ // before the card mark strb from the StoreCM and the
+ // storestore barrier from the StoreCM should be elided
+ matches = new String[] {
+ "membar_release \\(elided\\)",
+ useCompressedOops ? "cmpxchgw?_acq" : "cmpxchg_acq",
+ "storestore",
+ "dmb ishst",
+ "strb",
+ "membar_acquire \\(elided\\)",
+ "ret"
+ };
+ break;
+ }
+ } else {
+ switch (testType) {
+ default:
+ // this is the basic sequence of instructions
+ matches = new String[] {
+ "membar_release",
+ "dmb ish",
+ useCompressedOops ? "cmpxchgw? " : "cmpxchg ",
+ "membar_acquire",
+ "dmb ish",
+ "ret"
+ };
+ break;
+ case "G1":
+ // a card mark volatile barrier should be generated
+ // before the card mark strb
+ matches = new String[] {
+ "membar_release",
+ "dmb ish",
+ useCompressedOops ? "cmpxchgw? " : "cmpxchg ",
+ "membar_volatile",
+ "dmb ish",
+ "strb",
+ "membar_acquire",
+ "dmb ish",
+ "ret"
+ };
+ break;
+ case "CMSCondMark":
+ // a card mark volatile barrier should be generated
+ // before the card mark strb from the StoreCM and the
+ // storestore barrier from the StoreCM should be elided
+ matches = new String[] {
+ "membar_release",
+ "dmb ish",
+ useCompressedOops ? "cmpxchgw? " : "cmpxchg ",
+ "membar_volatile",
+ "dmb ish",
+ "storestore \\(elided\\)",
+ "strb",
+ "membar_acquire",
+ "dmb ish",
+ "ret"
+ };
+ break;
+ case "CMS":
+ // a volatile card mark membar should not be generated
+ // before the card mark strb from the StoreCM and the
+ // storestore barrier from the StoreCM should be generated
+ // as "dmb ishst"
+ matches = new String[] {
+ "membar_release",
+ "dmb ish",
+ useCompressedOops ? "cmpxchgw? " : "cmpxchg ",
+ "storestore",
+ "dmb ishst",
+ "strb",
+ "membar_acquire",
+ "dmb ish",
+ "ret"
+ };
+ break;
+ }
+ }
+
+ checkCompile(iter, "testObj", matches, output, true);
+ }
+
+ private void checkgas(OutputAnalyzer output, String testType, boolean useBarriersForVolatile, boolean useCompressedOops) throws Throwable
+ {
+ Iterator iter = output.asLines().listIterator();
+
+ String[] matches;
+ String[][] tests = {
+ { "testInt", "atomic_xchgw" },
+ { "testLong", "atomic_xchg" },
+ };
+
+ for (String[] test : tests) {
+ // non object stores are straightforward
+ if (!useBarriersForVolatile) {
+ // this is the sequence of instructions for all cases
+ matches = new String[] {
+ "membar_release \\(elided\\)",
+ test[1] + "_acq",
+ "membar_acquire \\(elided\\)",
+ "ret"
+ };
+ } else {
+ // this is the alternative sequence of instructions
+ matches = new String[] {
+ "membar_release",
+ "dmb ish",
+ test[1] + " ",
+ "membar_acquire",
+ "dmb ish",
+ "ret"
+ };
+ }
+
+ checkCompile(iter, test[0], matches, output, true);
+ }
+
+ // object stores will be as above except for when the GC
+ // introduces barriers for card marking
+
+ if (!useBarriersForVolatile) {
+ switch (testType) {
+ default:
+ // this is the basic sequence of instructions
+ matches = new String[] {
+ "membar_release \\(elided\\)",
+ useCompressedOops ? "atomic_xchgw?_acq" : "atomic_xchg_acq",
+ "strb",
+ "membar_acquire \\(elided\\)",
+ "ret"
+ };
+ break;
+ case "G1":
+ // a card mark volatile barrier should be generated
+ // before the card mark strb
+ matches = new String[] {
+ "membar_release \\(elided\\)",
+ useCompressedOops ? "atomic_xchgw?_acq" : "atomic_xchg_acq",
+ "membar_volatile",
+ "dmb ish",
+ "strb",
+ "membar_acquire \\(elided\\)",
+ "ret"
+ };
+ break;
+ case "CMSCondMark":
+ // a card mark volatile barrier should be generated
+ // before the card mark strb from the StoreCM and the
+ // storestore barrier from the StoreCM should be elided
+ matches = new String[] {
+ "membar_release \\(elided\\)",
+ useCompressedOops ? "atomic_xchgw?_acq" : "atomic_xchg_acq",
+ "membar_volatile",
+ "dmb ish",
+ "storestore \\(elided\\)",
+ "strb",
+ "membar_acquire \\(elided\\)",
+ "ret"
+ };
+ break;
+ case "CMS":
+ // a volatile card mark membar should not be generated
+ // before the card mark strb from the StoreCM and the
+ // storestore barrier from the StoreCM should be elided
+ matches = new String[] {
+ "membar_release \\(elided\\)",
+ useCompressedOops ? "atomic_xchgw?_acq" : "atomic_xchg_acq",
+ "storestore",
+ "dmb ishst",
+ "strb",
+ "membar_acquire \\(elided\\)",
+ "ret"
+ };
+ break;
+ }
+ } else {
+ switch (testType) {
+ default:
+ // this is the basic sequence of instructions
+ matches = new String[] {
+ "membar_release",
+ "dmb ish",
+ useCompressedOops ? "atomic_xchgw? " : "atomic_xchg ",
+ "membar_acquire",
+ "dmb ish",
+ "ret"
+ };
+ break;
+ case "G1":
+ // a card mark volatile barrier should be generated
+ // before the card mark strb
+ matches = new String[] {
+ "membar_release",
+ "dmb ish",
+ useCompressedOops ? "atomic_xchgw? " : "atomic_xchg ",
+ "membar_volatile",
+ "dmb ish",
+ "strb",
+ "membar_acquire",
+ "dmb ish",
+ "ret"
+ };
+ break;
+ case "CMSCondMark":
+ // a card mark volatile barrier should be generated
+ // before the card mark strb from the StoreCM and the
+ // storestore barrier from the StoreCM should be elided
+ matches = new String[] {
+ "membar_release",
+ "dmb ish",
+ useCompressedOops ? "atomic_xchgw? " : "atomic_xchg ",
+ "membar_volatile",
+ "dmb ish",
+ "storestore \\(elided\\)",
+ "strb",
+ "membar_acquire",
+ "dmb ish",
+ "ret"
+ };
+ break;
+ case "CMS":
+ // a volatile card mark membar should not be generated
+ // before the card mark strb from the StoreCM and the
+ // storestore barrier from the StoreCM should be generated
+ // as "dmb ishst"
+ matches = new String[] {
+ "membar_release",
+ "dmb ish",
+ useCompressedOops ? "atomic_xchgw? " : "atomic_xchg ",
+ "storestore",
+ "dmb ishst",
+ "strb",
+ "membar_acquire",
+ "dmb ish",
+ "ret"
+ };
+ break;
+ }
+ }
+
+ checkCompile(iter, "testObj", matches, output, true);
+ }
+
+ private void checkgaa(OutputAnalyzer output, String testType, boolean useBarriersForVolatile) throws Throwable
+ {
+ Iterator iter = output.asLines().listIterator();
+
+ String[] matches;
+ String[][] tests = {
+ { "testInt", "get_and_addI" },
+ { "testLong", "get_and_addL" },
+ };
+
+ for (String[] test : tests) {
+ // non object stores are straightforward
+ if (!useBarriersForVolatile) {
+ // this is the sequence of instructions for all cases
+ matches = new String[] {
+ "membar_release \\(elided\\)",
+ test[1] + "_acq",
+ "membar_acquire \\(elided\\)",
+ "ret"
+ };
+ } else {
+ // this is the alternative sequence of instructions
+ matches = new String[] {
+ "membar_release",
+ "dmb ish",
+ test[1] + " ",
+ "membar_acquire",
+ "dmb ish",
+ "ret"
+ };
+ }
+
+ checkCompile(iter, test[0], matches, output, true);
+ }
+
}
// perform a check appropriate to the classname
- private void checkoutput(OutputAnalyzer output, String classname, String testType, boolean useBarriersForVolatile) throws Throwable
+ private void checkoutput(OutputAnalyzer output, String classname, String testType, boolean useBarriersForVolatile, boolean useCompressedOops) throws Throwable
{
// trace call to allow eyeball check of what is being checked
System.out.println("checkoutput(" +
@@ -556,19 +981,29 @@ public class TestVolatiles {
switch (classname) {
case "TestVolatileLoad":
- checkload(output, testType, useBarriersForVolatile);
+ checkload(output, testType, useBarriersForVolatile, useCompressedOops);
break;
case "TestVolatileStore":
- checkstore(output, testType, useBarriersForVolatile);
+ checkstore(output, testType, useBarriersForVolatile, useCompressedOops);
break;
case "TestUnsafeVolatileLoad":
- checkload(output, testType, useBarriersForVolatile);
+ checkload(output, testType, useBarriersForVolatile, useCompressedOops);
break;
case "TestUnsafeVolatileStore":
- checkstore(output, testType, useBarriersForVolatile);
+ checkstore(output, testType, useBarriersForVolatile, useCompressedOops);
break;
case "TestUnsafeVolatileCAS":
- checkcas(output, testType, useBarriersForVolatile);
+ case "TestUnsafeVolatileWeakCAS":
+ checkcas(output, testType, useBarriersForVolatile, useCompressedOops);
+ break;
+ case "TestUnsafeVolatileCAE":
+ checkcae(output, testType, useBarriersForVolatile, useCompressedOops);
+ break;
+ case "TestUnsafeVolatileGAS":
+ checkgas(output, testType, useBarriersForVolatile, useCompressedOops);
+ break;
+ case "TestUnsafeVolatileGAA":
+ checkgaa(output, testType, useBarriersForVolatile);
break;
}
}
diff --git a/test/hotspot/jtreg/compiler/c2/aarch64/TestVolatilesCMS.java b/test/hotspot/jtreg/compiler/c2/aarch64/TestVolatilesCMS.java
index e65250ff579..3397fda6a4d 100644
--- a/test/hotspot/jtreg/compiler/c2/aarch64/TestVolatilesCMS.java
+++ b/test/hotspot/jtreg/compiler/c2/aarch64/TestVolatilesCMS.java
@@ -38,6 +38,9 @@
* compiler.c2.aarch64.TestVolatileStore
* compiler.c2.aarch64.TestUnsafeVolatileStore
* compiler.c2.aarch64.TestUnsafeVolatileCAS
+ * compiler.c2.aarch64.TestUnsafeVolatileWeakCAS
+ * compiler.c2.aarch64.TestUnsafeVolatileCAE
+ * compiler.c2.aarch64.TestUnsafeVolatileGAS
*
* @run driver compiler.c2.aarch64.TestVolatilesCMS
* TestVolatileLoad CMS
@@ -53,6 +56,15 @@
*
* @run driver compiler.c2.aarch64.TestVolatilesCMS
* TestUnsafeVolatileCAS CMS
+ *
+ * @run driver compiler.c2.aarch64.TestVolatilesCMS
+ * TestUnsafeVolatileWeakCAS CMS
+ *
+ * @run driver compiler.c2.aarch64.TestVolatilesCMS
+ * TestUnsafeVolatileCAE CMS
+ *
+ * @run driver compiler.c2.aarch64.TestVolatilesCMS
+ * TestUnsafeVolatileGAS CMS
*/
package compiler.c2.aarch64;
diff --git a/test/hotspot/jtreg/compiler/c2/aarch64/TestVolatilesCMSCondMark.java b/test/hotspot/jtreg/compiler/c2/aarch64/TestVolatilesCMSCondMark.java
index b0931b1631b..29ce80493c8 100644
--- a/test/hotspot/jtreg/compiler/c2/aarch64/TestVolatilesCMSCondMark.java
+++ b/test/hotspot/jtreg/compiler/c2/aarch64/TestVolatilesCMSCondMark.java
@@ -38,6 +38,9 @@
* compiler.c2.aarch64.TestVolatileStore
* compiler.c2.aarch64.TestUnsafeVolatileStore
* compiler.c2.aarch64.TestUnsafeVolatileCAS
+ * compiler.c2.aarch64.TestUnsafeVolatileWeakCAS
+ * compiler.c2.aarch64.TestUnsafeVolatileCAE
+ * compiler.c2.aarch64.TestUnsafeVolatileGAS
*
* @run driver compiler.c2.aarch64.TestVolatilesCMSCondMark
* TestVolatileLoad CMSCondMark
@@ -53,6 +56,15 @@
*
* @run driver compiler.c2.aarch64.TestVolatilesCMSCondMark
* TestUnsafeVolatileCAS CMSCondMark
+ *
+ * @run driver compiler.c2.aarch64.TestVolatilesCMSCondMark
+ * TestUnsafeVolatileWeakCAS CMSCondMark
+ *
+ * @run driver compiler.c2.aarch64.TestVolatilesCMSCondMark
+ * TestUnsafeVolatileCAE CMSCondMark
+ *
+ * @run driver compiler.c2.aarch64.TestVolatilesCMSCondMark
+ * TestUnsafeVolatileGAS CMSCondMark
*/
package compiler.c2.aarch64;
diff --git a/test/hotspot/jtreg/compiler/c2/aarch64/TestVolatilesG1.java b/test/hotspot/jtreg/compiler/c2/aarch64/TestVolatilesG1.java
index 658e5ad9d39..88d747e44d9 100644
--- a/test/hotspot/jtreg/compiler/c2/aarch64/TestVolatilesG1.java
+++ b/test/hotspot/jtreg/compiler/c2/aarch64/TestVolatilesG1.java
@@ -38,6 +38,10 @@
* compiler.c2.aarch64.TestVolatileStore
* compiler.c2.aarch64.TestUnsafeVolatileStore
* compiler.c2.aarch64.TestUnsafeVolatileCAS
+ * compiler.c2.aarch64.TestUnsafeVolatileWeakCAS
+ * compiler.c2.aarch64.TestUnsafeVolatileCAE
+ * compiler.c2.aarch64.TestUnsafeVolatileGAS
+ * compiler.c2.aarch64.TestUnsafeVolatileGAA
*
* @run driver compiler.c2.aarch64.TestVolatilesG1
* TestVolatileLoad G1
@@ -53,8 +57,21 @@
*
* @run driver compiler.c2.aarch64.TestVolatilesG1
* TestUnsafeVolatileCAS G1
+ *
+ * @run driver compiler.c2.aarch64.TestVolatilesG1
+ * TestUnsafeVolatileWeakCAS G1
+ *
+ * @run driver compiler.c2.aarch64.TestVolatilesG1
+ * TestUnsafeVolatileCAE G1
+ *
+ * @run driver compiler.c2.aarch64.TestVolatilesG1
+ * TestUnsafeVolatileGAS G1
+ *
+ * @run driver compiler.c2.aarch64.TestVolatilesG1
+ * TestUnsafeVolatileGAA G1
*/
+
package compiler.c2.aarch64;
public class TestVolatilesG1 {
diff --git a/test/hotspot/jtreg/compiler/c2/aarch64/TestVolatilesParallel.java b/test/hotspot/jtreg/compiler/c2/aarch64/TestVolatilesParallel.java
index 8f6a78efcf2..c3203c0b276 100644
--- a/test/hotspot/jtreg/compiler/c2/aarch64/TestVolatilesParallel.java
+++ b/test/hotspot/jtreg/compiler/c2/aarch64/TestVolatilesParallel.java
@@ -38,6 +38,9 @@
* compiler.c2.aarch64.TestVolatileStore
* compiler.c2.aarch64.TestUnsafeVolatileStore
* compiler.c2.aarch64.TestUnsafeVolatileCAS
+ * compiler.c2.aarch64.TestUnsafeVolatileWeakCAS
+ * compiler.c2.aarch64.TestUnsafeVolatileCAE
+ * compiler.c2.aarch64.TestUnsafeVolatileGAS
*
* @run driver compiler.c2.aarch64.TestVolatilesParallel
* TestVolatileLoad Parallel
@@ -53,6 +56,15 @@
*
* @run driver compiler.c2.aarch64.TestVolatilesParallel
* TestUnsafeVolatileCAS Parallel
+ *
+ * @run driver compiler.c2.aarch64.TestVolatilesParallel
+ * TestUnsafeVolatileWeakCAS Parallel
+ *
+ * @run driver compiler.c2.aarch64.TestVolatilesParallel
+ * TestUnsafeVolatileCAE Parallel
+ *
+ * @run driver compiler.c2.aarch64.TestVolatilesParallel
+ * TestUnsafeVolatileGAS Parallel
*/
package compiler.c2.aarch64;
diff --git a/test/hotspot/jtreg/compiler/c2/aarch64/TestVolatilesSerial.java b/test/hotspot/jtreg/compiler/c2/aarch64/TestVolatilesSerial.java
index 470ae748e12..c04c3594497 100644
--- a/test/hotspot/jtreg/compiler/c2/aarch64/TestVolatilesSerial.java
+++ b/test/hotspot/jtreg/compiler/c2/aarch64/TestVolatilesSerial.java
@@ -38,6 +38,9 @@
* compiler.c2.aarch64.TestVolatileStore
* compiler.c2.aarch64.TestUnsafeVolatileStore
* compiler.c2.aarch64.TestUnsafeVolatileCAS
+ * compiler.c2.aarch64.TestUnsafeVolatileWeakCAS
+ * compiler.c2.aarch64.TestUnsafeVolatileCAE
+ * compiler.c2.aarch64.TestUnsafeVolatileGAS
*
* @run driver compiler.c2.aarch64.TestVolatilesSerial
* TestVolatileLoad Serial
@@ -53,6 +56,15 @@
*
* @run driver compiler.c2.aarch64.TestVolatilesSerial
* TestUnsafeVolatileCAS Serial
+ *
+ * @run driver compiler.c2.aarch64.TestVolatilesSerial
+ * TestUnsafeVolatileWeakCAS Serial
+ *
+ * @run driver compiler.c2.aarch64.TestVolatilesSerial
+ * TestUnsafeVolatileCAE Serial
+ *
+ * @run driver compiler.c2.aarch64.TestVolatilesSerial
+ * TestUnsafeVolatileGAS Serial
*/
package compiler.c2.aarch64;
diff --git a/test/hotspot/jtreg/compiler/gcbarriers/EqvUncastStepOverBarrier.java b/test/hotspot/jtreg/compiler/gcbarriers/EqvUncastStepOverBarrier.java
new file mode 100644
index 00000000000..532f490a112
--- /dev/null
+++ b/test/hotspot/jtreg/compiler/gcbarriers/EqvUncastStepOverBarrier.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2018, Red Hat, Inc. 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 8212673
+ * @summary Node::eqv_uncast() shouldn't step over load barriers unconditionally
+ * @library /test/lib /
+ * @modules java.base/jdk.internal.misc
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-UseOnStackReplacement -XX:-TieredCompilation -XX:-BackgroundCompilation EqvUncastStepOverBarrier
+ */
+
+import sun.hotspot.WhiteBox;
+import java.lang.reflect.Method;
+
+public class EqvUncastStepOverBarrier {
+ static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
+
+ private static Object field = new A();
+
+ public static void main(String[] args) throws Exception {
+ for (int i = 0; i < 20_000; i++) {
+ test();
+ test();
+ test_helper(null, 0);
+ }
+ Method m = EqvUncastStepOverBarrier.class.getDeclaredMethod("test");
+ WHITE_BOX.enqueueMethodForCompilation(m, 4);
+ if (!WHITE_BOX.isMethodCompiled(m, false)) {
+ throw new RuntimeException("Method compilation failed");
+ }
+ }
+
+ private static Object test() {
+ Object o = field;
+ if (o == null) {}
+ for (int i = 1; i < 100; i *= 2) {
+ int j = 0;
+ for (; j < 4; j++) ;
+ o = test_helper(o, j);
+ }
+ return o;
+ }
+
+ private static Object test_helper(Object o, int j) {
+ if (j == 4) {
+ A a = (A) o;
+ o = a;
+ } else {
+ o = new Object();
+ }
+ return o;
+ }
+
+ private static class A {
+ }
+}
diff --git a/test/hotspot/jtreg/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java b/test/hotspot/jtreg/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java
index e792ad170c9..a0979704f5f 100644
--- a/test/hotspot/jtreg/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java
+++ b/test/hotspot/jtreg/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -115,16 +115,15 @@ public class RedefineMethodUsedByMultipleMethodHandles {
mainAttrs.putValue("Can-Redefine-Classes", "true");
mainAttrs.putValue("Can-Retransform-Classes", "true");
- Path jar = Files.createTempFile("myagent", ".jar");
- try {
- JarOutputStream jarStream = new JarOutputStream(new FileOutputStream(jar.toFile()), manifest);
- add(jarStream, FooAgent.class);
- add(jarStream, FooTransformer.class);
- jarStream.close();
- runAgent(jar);
- } finally {
- Files.deleteIfExists(jar);
- }
+ // The jar file will be added to the system classloader search path. It is not safe
+ // to delete it while the JVM is running, so make sure to create it in the test
+ // directory so it will be cleaned up by the test harness.
+ Path jar = Files.createTempFile(Path.of(""), "myagent", ".jar");
+ JarOutputStream jarStream = new JarOutputStream(new FileOutputStream(jar.toFile()), manifest);
+ add(jarStream, FooAgent.class);
+ add(jarStream, FooTransformer.class);
+ jarStream.close();
+ runAgent(jar);
}
public static void runAgent(Path agent) throws Exception {
diff --git a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/ConstantPoolTestsHelper.java b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/ConstantPoolTestsHelper.java
index 0ac7f3d6a6f..fbde0524b88 100644
--- a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/ConstantPoolTestsHelper.java
+++ b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/ConstantPoolTestsHelper.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -28,7 +28,7 @@ import compiler.jvmci.common.testcases.MultipleImplementer2;
import compiler.jvmci.common.testcases.MultipleImplementersInterface;
import compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes;
import compiler.jvmci.compilerToVM.ConstantPoolTestCase.TestedCPEntry;
-import jdk.internal.misc.SharedSecrets;
+import jdk.internal.access.SharedSecrets;
import jdk.internal.org.objectweb.asm.Opcodes;
import jdk.internal.reflect.ConstantPool;
import jdk.internal.reflect.ConstantPool.Tag;
diff --git a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java
index 4b7e81e4b80..767e7722f8a 100644
--- a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java
+++ b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -28,7 +28,7 @@
* @summary Testing compiler.jvmci.CompilerToVM.lookupKlassInPool method
* @library /test/lib /
* @library ../common/patches
- * @modules java.base/jdk.internal.misc
+ * @modules java.base/jdk.internal.access
* java.base/jdk.internal.reflect
* java.base/jdk.internal.org.objectweb.asm
* java.base/jdk.internal.org.objectweb.asm.tree
diff --git a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java
index d952505718a..2d803646849 100644
--- a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java
+++ b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -27,7 +27,7 @@
* @requires vm.jvmci
* @library /test/lib /
* @library ../common/patches
- * @modules java.base/jdk.internal.misc
+ * @modules java.base/jdk.internal.access
* java.base/jdk.internal.reflect
* java.base/jdk.internal.org.objectweb.asm
* java.base/jdk.internal.org.objectweb.asm.tree
diff --git a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java
index 42bd66cd30f..47f1daf4c3b 100644
--- a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java
+++ b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java
@@ -27,7 +27,7 @@
* @requires vm.jvmci
* @library /test/lib /
* @library ../common/patches
- * @modules java.base/jdk.internal.misc
+ * @modules java.base/jdk.internal.access
* java.base/jdk.internal.reflect
* java.base/jdk.internal.org.objectweb.asm
* java.base/jdk.internal.org.objectweb.asm.tree
diff --git a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java
index e75a531b4e4..d693b42f5e3 100644
--- a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java
+++ b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -27,7 +27,7 @@
* @requires vm.jvmci
* @library /test/lib /
* @library ../common/patches
- * @modules java.base/jdk.internal.misc
+ * @modules java.base/jdk.internal.access
* java.base/jdk.internal.reflect
* java.base/jdk.internal.org.objectweb.asm
* java.base/jdk.internal.org.objectweb.asm.tree
diff --git a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java
index 91b7867d6a2..411c7936e77 100644
--- a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java
+++ b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -27,7 +27,7 @@
* @requires vm.jvmci
* @library /test/lib /
* @library ../common/patches
- * @modules java.base/jdk.internal.misc
+ * @modules java.base/jdk.internal.access
* java.base/jdk.internal.reflect
* java.base/jdk.internal.org.objectweb.asm
* java.base/jdk.internal.org.objectweb.asm.tree
diff --git a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java
index 0953363e67e..02ae68bcd25 100644
--- a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java
+++ b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -27,7 +27,7 @@
* @requires vm.jvmci
* @library /test/lib /
* @library ../common/patches
- * @modules java.base/jdk.internal.misc
+ * @modules java.base/jdk.internal.access
* java.base/jdk.internal.reflect
* java.base/jdk.internal.org.objectweb.asm
* java.base/jdk.internal.org.objectweb.asm.tree
diff --git a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/LookupTypeTest.java b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/LookupTypeTest.java
index 2b838bc0bd8..9297fb90249 100644
--- a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/LookupTypeTest.java
+++ b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/LookupTypeTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -27,7 +27,7 @@
* @requires vm.jvmci
* @library / /test/lib
* @library ../common/patches
- * @modules java.base/jdk.internal.misc
+ * @modules java.base/jdk.internal.access
* @modules jdk.internal.vm.ci/jdk.vm.ci.hotspot
* @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
diff --git a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java
index 68709ee2d67..8e99db5cc84 100644
--- a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java
+++ b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -27,7 +27,7 @@
* @requires vm.jvmci
* @library /test/lib /
* @library ../common/patches
- * @modules java.base/jdk.internal.misc
+ * @modules java.base/jdk.internal.access
* java.base/jdk.internal.reflect
* java.base/jdk.internal.org.objectweb.asm
* jdk.internal.vm.ci/jdk.vm.ci.hotspot
diff --git a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java
index 38e9ede8f7b..dd3a04f742d 100644
--- a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java
+++ b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -27,7 +27,8 @@
* @requires vm.jvmci
* @library /test/lib /
* @library ../common/patches
- * @modules java.base/jdk.internal.misc
+ * @modules java.base/jdk.internal.access
+ * java.base/jdk.internal.misc
* java.base/jdk.internal.reflect
* java.base/jdk.internal.org.objectweb.asm
* java.base/jdk.internal.org.objectweb.asm.tree
diff --git a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java
index 1aa57ca8cc5..f66edcc6a01 100644
--- a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java
+++ b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -27,7 +27,7 @@
* @requires vm.jvmci
* @library /test/lib /
* @library ../common/patches
- * @modules java.base/jdk.internal.misc
+ * @modules java.base/jdk.internal.access
* java.base/jdk.internal.reflect
* java.base/jdk.internal.org.objectweb.asm
* java.base/jdk.internal.org.objectweb.asm.tree
diff --git a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java
index 593ea7aa6e0..e75afcdc3f4 100644
--- a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java
+++ b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -28,7 +28,7 @@
* @summary Testing compiler.jvmci.CompilerToVM.resolveTypeInPool method
* @library /test/lib /
* @library ../common/patches
- * @modules java.base/jdk.internal.misc
+ * @modules java.base/jdk.internal.access
* java.base/jdk.internal.reflect
* java.base/jdk.internal.org.objectweb.asm
* jdk.internal.vm.ci/jdk.vm.ci.hotspot
diff --git a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java
index 195d0deec0e..21d46fd39f3 100644
--- a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java
+++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java
@@ -33,10 +33,15 @@
package jdk.vm.ci.runtime.test;
-import jdk.vm.ci.meta.ResolvedJavaField;
-import jdk.vm.ci.meta.ResolvedJavaMethod;
-import org.junit.Test;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
@@ -45,10 +50,13 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import org.junit.Assert;
+import org.junit.Test;
+
+import jdk.vm.ci.meta.ResolvedJavaField;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+import jdk.vm.ci.meta.ResolvedJavaType;
+import jdk.vm.ci.runtime.test.TestResolvedJavaField.TestClassLoader;
/**
* Tests for {@link ResolvedJavaField}.
@@ -134,4 +142,89 @@ public class TestResolvedJavaField extends FieldUniverse {
}
}
}
+ static class TestClassLoader extends ClassLoader {
+
+ @Override
+ protected Class> findClass(final String name) {
+ if (!name.equals(TypeWithUnresolvedFieldType.class.getName())) {
+ try {
+ return super.findClass(name);
+ } catch (ClassNotFoundException e) {
+ throw new AssertionError("unexpected: " + e);
+ }
+ }
+ // copy classfile to byte array
+ byte[] classData = null;
+ try {
+ String simpleName = TypeWithUnresolvedFieldType.class.getSimpleName();
+ InputStream is = TypeWithUnresolvedFieldType.class.getResourceAsStream(simpleName + ".class");
+ assert is != null;
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+ byte[] buf = new byte[1024];
+ int size;
+ while ((size = is.read(buf, 0, buf.length)) != -1) {
+ baos.write(buf, 0, size);
+ }
+ baos.flush();
+ classData = baos.toByteArray();
+ } catch (IOException e) {
+ Assert.fail("can't access class: " + name);
+ }
+
+ // replace all occurrences of "PrintStream" in classfile
+ int index = -1;
+
+ while ((index = indexOf(classData, index + 1, "PrintStream")) != -1) {
+ replace(classData, index, "XXXXXXXXXXX");
+ }
+
+ Class> c = defineClass(null, classData, 0, classData.length);
+ return c;
+ }
+
+ private static int indexOf(byte[] b, int index, String find) {
+ for (int i = index; i < b.length; i++) {
+ boolean match = true;
+ for (int j = i; j < i + find.length(); j++) {
+ if (b[j] != (byte) find.charAt(j - i)) {
+ match = false;
+ break;
+ }
+ }
+ if (match) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ private static void replace(byte[] b, int index, String replace) {
+ for (int i = index; i < index + replace.length(); i++) {
+ b[i] = (byte) replace.charAt(i - index);
+ }
+ }
+ }
+
+ /**
+ * Tests that calling {@link ResolvedJavaField#getType()} does not cause a linkage error if the
+ * type of the field is not resolvable.
+ */
+ @Test
+ public void testGetType() {
+ Class> c = new TestClassLoader().findClass(TypeWithUnresolvedFieldType.class.getName());
+ ResolvedJavaType type = metaAccess.lookupJavaType(c);
+ for (ResolvedJavaField field : type.getInstanceFields(false)) {
+ assertTrue(field.getName().equals("fieldWithUnresolvableType"));
+ field.getType();
+ field.toString();
+ }
+ }
+}
+
+class TypeWithUnresolvedFieldType {
+ /**
+ * {@link TestClassLoader} will rewrite the type of this field to "Ljava/io/XXXXXXXXXXX;".
+ */
+ PrintStream fieldWithUnresolvableType;
}
diff --git a/test/hotspot/jtreg/compiler/unsafe/CASandCAEwithNegExpected.java b/test/hotspot/jtreg/compiler/unsafe/CASandCAEwithNegExpected.java
new file mode 100644
index 00000000000..d1ad8a5f756
--- /dev/null
+++ b/test/hotspot/jtreg/compiler/unsafe/CASandCAEwithNegExpected.java
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2018, Red Hat, Inc. 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 8211320
+ * @summary Aarch64: unsafe.compareAndSetByte() and unsafe.compareAndSetShort() c2 intrinsics broken with negative expected value
+ *
+ * @modules java.base/jdk.internal.misc
+ * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation CASandCAEwithNegExpected
+ */
+
+import java.lang.reflect.Field;
+import jdk.internal.misc.Unsafe;
+
+public class CASandCAEwithNegExpected {
+ public volatile int f_int = -1;
+ public volatile long f_long = -1;
+ public volatile byte f_byte = -1;
+ public volatile short f_short = -1;
+
+ public static Unsafe unsafe = Unsafe.getUnsafe();
+ public static Field f_int_field;
+ public static Field f_long_field;
+ public static Field f_byte_field;
+ public static Field f_short_field;
+ public static long f_int_off;
+ public static long f_long_off;
+ public static long f_byte_off;
+ public static long f_short_off;
+
+ static {
+ try {
+ f_int_field = CASandCAEwithNegExpected.class.getField("f_int");
+ f_long_field = CASandCAEwithNegExpected.class.getField("f_long");
+ f_byte_field = CASandCAEwithNegExpected.class.getField("f_byte");
+ f_short_field = CASandCAEwithNegExpected.class.getField("f_short");
+ f_int_off = unsafe.objectFieldOffset(f_int_field);
+ f_long_off = unsafe.objectFieldOffset(f_long_field);
+ f_byte_off = unsafe.objectFieldOffset(f_byte_field);
+ f_short_off = unsafe.objectFieldOffset(f_short_field);
+ } catch (Exception e) {
+ System.out.println("reflection failed " + e);
+ e.printStackTrace();
+ }
+ }
+
+ static public void main(String[] args) {
+ CASandCAEwithNegExpected t = new CASandCAEwithNegExpected();
+ for (int i = 0; i < 20_000; i++) {
+ t.test();
+ }
+ }
+
+ // check proper handling of sign extension of expected value in comparison
+ void test() {
+ f_int = -1;
+ f_long = -1;
+ f_byte = -1;
+ f_short = -1;
+
+ unsafe.compareAndSetInt(this, f_int_off, -1, 42);
+ if (f_int != 42) {
+ throw new RuntimeException("CAS failed");
+ }
+ unsafe.compareAndSetLong(this, f_long_off, -1, 42);
+ if (f_long != 42) {
+ throw new RuntimeException("CAS failed");
+ }
+ unsafe.compareAndSetByte(this, f_byte_off, (byte)-1, (byte)42);
+ if (f_byte != 42) {
+ throw new RuntimeException("CAS failed");
+ }
+ unsafe.compareAndSetShort(this, f_short_off, (short)-1, (short)42);
+ if (f_short != 42) {
+ throw new RuntimeException("CAS failed");
+ }
+
+ f_int = -1;
+ f_long = -1;
+ f_byte = -1;
+ f_short = -1;
+
+ unsafe.compareAndExchangeInt(this, f_int_off, -1, 42);
+ if (f_int != 42) {
+ throw new RuntimeException("CAE failed");
+ }
+ unsafe.compareAndExchangeLong(this, f_long_off, -1, 42);
+ if (f_long != 42) {
+ throw new RuntimeException("CAE failed");
+ }
+ unsafe.compareAndExchangeByte(this, f_byte_off, (byte)-1, (byte)42);
+ if (f_byte != 42) {
+ throw new RuntimeException("CAE failed");
+ }
+ unsafe.compareAndExchangeShort(this, f_short_off, (short)-1, (short)42);
+ if (f_short != 42) {
+ throw new RuntimeException("CAE failed");
+ }
+
+ f_int = -1;
+ f_long = -1;
+ f_byte = -1;
+ f_short = -1;
+
+ if (unsafe.weakCompareAndSetInt(this, f_int_off, -1, 42) && f_int != 42) {
+ throw new RuntimeException("CAS failed");
+ }
+
+ if (unsafe.weakCompareAndSetLong(this, f_long_off, -1, 42) && f_long != 42) {
+ throw new RuntimeException("CAS failed");
+ }
+
+ if (unsafe.weakCompareAndSetByte(this, f_byte_off, (byte)-1, (byte)42) && f_byte != 42) {
+ throw new RuntimeException("CAS failed");
+ }
+
+ if (unsafe.weakCompareAndSetShort(this, f_short_off, (short)-1, (short)42) && f_short != 42) {
+ throw new RuntimeException("CAS failed");
+ }
+ }
+
+}
diff --git a/test/hotspot/jtreg/gc/TestAllocateHeapAtMultiple.java b/test/hotspot/jtreg/gc/TestAllocateHeapAtMultiple.java
index 0493b445404..9ba626c875c 100644
--- a/test/hotspot/jtreg/gc/TestAllocateHeapAtMultiple.java
+++ b/test/hotspot/jtreg/gc/TestAllocateHeapAtMultiple.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -27,6 +27,7 @@
* @library /test/lib
* @modules java.base/jdk.internal.misc
* @requires vm.bits == "64" & vm.gc != "Z" & os.family != "aix"
+ * @run main/timeout=360 TestAllocateHeapAtMultiple
*/
import jdk.test.lib.JDKToolFinder;
diff --git a/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java b/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java
index f20a3a3e3e3..2562e669052 100644
--- a/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java
+++ b/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java
@@ -44,7 +44,6 @@ public class VMDeprecatedOptions {
{"MaxRAMFraction", "8"},
{"MinRAMFraction", "2"},
{"InitialRAMFraction", "64"},
- {"UseMembar", "true"},
{"TLABStats", "false"},
// deprecated alias flags (see also aliased_jvm_flags):
@@ -103,6 +102,5 @@ public class VMDeprecatedOptions {
public static void main(String[] args) throws Throwable {
testDeprecated(DEPRECATED_OPTIONS); // Make sure that each deprecated option is mentioned in the output.
- testDeprecatedDiagnostic("IgnoreUnverifiableClassesDuringDump", "false");
}
}
diff --git a/test/hotspot/jtreg/runtime/CommandLine/VMOptionWarning.java b/test/hotspot/jtreg/runtime/CommandLine/VMOptionWarning.java
index 8cb2a422598..a9223d71473 100644
--- a/test/hotspot/jtreg/runtime/CommandLine/VMOptionWarning.java
+++ b/test/hotspot/jtreg/runtime/CommandLine/VMOptionWarning.java
@@ -53,8 +53,8 @@ public class VMOptionWarning {
output = new OutputAnalyzer(pb.start());
output.shouldContain("Error: VM option 'VerifyStack' is develop and is available only in debug version of VM.");
- pb = ProcessTools.createJavaProcessBuilder("-XX:+ExecuteInternalVMTests", "-version");
+ pb = ProcessTools.createJavaProcessBuilder("-XX:+CheckCompressedOops", "-version");
output = new OutputAnalyzer(pb.start());
- output.shouldContain("Error: VM option 'ExecuteInternalVMTests' is notproduct and is available only in debug version of VM.");
+ output.shouldContain("Error: VM option 'CheckCompressedOops' is notproduct and is available only in debug version of VM.");
}
}
diff --git a/test/hotspot/jtreg/runtime/JVMDoPrivileged/DoPrivRunAbstract.jasm b/test/hotspot/jtreg/runtime/JVMDoPrivileged/DoPrivRunAbstract.jasm
index f58fd6b8461..12422a947fa 100644
--- a/test/hotspot/jtreg/runtime/JVMDoPrivileged/DoPrivRunAbstract.jasm
+++ b/test/hotspot/jtreg/runtime/JVMDoPrivileged/DoPrivRunAbstract.jasm
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -23,7 +23,7 @@
/*
* @test
- * @summary Test that JVM_DoPrivilege throws java.lang.InternalError for an
+ * @summary Test that AccessController.doPrivileged throws java.lang.AbstractMethodError for an
* abstract run() method.
* @bug 8183962
* @compile DoPrivRunAbstract.jasm
@@ -56,8 +56,8 @@
// public static void main(String[] args) throws Exception {
// try {
// doPrivileged(() -> System.out.println(System.getProperty("java.home")));
-// throw new RuntimeException("Expected InternalError not throw");
-// } catch (java.lang.InternalError e) { }
+// throw new RuntimeException("Expected AbstractMethodError not throw");
+// } catch (java.lang.AbstractMethodError e) { }
// }
//}
@@ -82,13 +82,13 @@ super public class DoPrivRunAbstract version 51:0 {
invokestatic Method doPrivileged:"(LDoPrivRunAbstract$VoidPrivActRunAbstract;)V";
new class java/lang/RuntimeException;
dup;
- ldc String "Expected InternalError not throw";
+ ldc String "Expected AbstractMethodError not throw";
invokespecial Method java/lang/RuntimeException."":"(Ljava/lang/String;)V";
athrow;
endtry t0;
- catch t0 java/lang/InternalError;
+ catch t0 java/lang/AbstractMethodError;
stack_frame_type stack1;
- stack_map class java/lang/InternalError;
+ stack_map class java/lang/AbstractMethodError;
astore_1;
return;
}
diff --git a/test/hotspot/jtreg/runtime/JVMDoPrivileged/DoPrivileged.java b/test/hotspot/jtreg/runtime/JVMDoPrivileged/DoPrivileged.java
index 342a78f90a4..61e5894fc4b 100644
--- a/test/hotspot/jtreg/runtime/JVMDoPrivileged/DoPrivileged.java
+++ b/test/hotspot/jtreg/runtime/JVMDoPrivileged/DoPrivileged.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -23,7 +23,7 @@
/*
* @test
- * @summary Test that JVM_DoPrivilege() searches default methods when looking
+ * @summary Test that AccessController.doPrivileged() searches default methods when looking
* for the run() method.
* @bug 8183962
* @run main DoPrivileged
diff --git a/src/hotspot/share/utilities/internalVMTests.hpp b/test/hotspot/jtreg/runtime/LoaderConstraints/duplicateParentLE/ParentClassLoader.java
similarity index 70%
rename from src/hotspot/share/utilities/internalVMTests.hpp
rename to test/hotspot/jtreg/runtime/LoaderConstraints/duplicateParentLE/ParentClassLoader.java
index f12a1685802..3401759288a 100644
--- a/src/hotspot/share/utilities/internalVMTests.hpp
+++ b/test/hotspot/jtreg/runtime/LoaderConstraints/duplicateParentLE/ParentClassLoader.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -19,22 +19,13 @@
* 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.
- *
*/
-#ifndef SHARE_VM_UTILITIES_INTERNALVMTESTS_HPP
-#define SHARE_VM_UTILITIES_INTERNALVMTESTS_HPP
+import java.util.*;
+import java.io.*;
-#ifndef PRODUCT
-
-#include "memory/allocation.hpp"
-
-class InternalVMTests : public AllStatic {
- static void run_test(const char* name, void (*test)());
- public:
- static void run();
-};
-
-#endif
-
-#endif // SHARE_VM_UTILITIES_INTERNALVMTESTS_HPP
+// Delegating class loader which never defines a class.
+public class ParentClassLoader extends ClassLoader {
+ public ParentClassLoader() { super(); }
+ public ParentClassLoader(String name, ClassLoader l) { super(name, l); }
+}
diff --git a/test/hotspot/jtreg/runtime/LoaderConstraints/duplicateParentLE/PreemptingChildClassLoader.java b/test/hotspot/jtreg/runtime/LoaderConstraints/duplicateParentLE/PreemptingChildClassLoader.java
new file mode 100644
index 00000000000..32de366532e
--- /dev/null
+++ b/test/hotspot/jtreg/runtime/LoaderConstraints/duplicateParentLE/PreemptingChildClassLoader.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+
+import java.util.*;
+import java.io.*;
+
+public class PreemptingChildClassLoader extends ParentClassLoader {
+
+ private static ClassLoader p = new ParentClassLoader();
+ private final Set names = new HashSet<>();
+ boolean checkLoaded = true;
+
+ public PreemptingChildClassLoader(String... names) {
+ for (String n : names) this.names.add(n);
+ }
+
+ public PreemptingChildClassLoader(String name, String[] names) {
+ super(name, p);
+ for (String n : names) this.names.add(n);
+ }
+
+ public PreemptingChildClassLoader(String name, String[] names, boolean cL) {
+ super(name, p);
+ for (String n : names) this.names.add(n);
+ checkLoaded = cL;
+ }
+
+ protected Class> loadClass(String name, boolean resolve) throws ClassNotFoundException {
+ if (!names.contains(name)) return super.loadClass(name, resolve);
+ Class> result = checkLoaded ? findLoadedClass(name) : null;
+ if (result == null) {
+ String filename = name.replace('.', '/') + ".class";
+ try (InputStream data = getResourceAsStream(filename)) {
+ if (data == null) throw new ClassNotFoundException();
+ try (ByteArrayOutputStream buffer = new ByteArrayOutputStream()) {
+ int b;
+ do {
+ b = data.read();
+ if (b >= 0) buffer.write(b);
+ } while (b >= 0);
+ byte[] bytes = buffer.toByteArray();
+ result = defineClass(name, bytes, 0, bytes.length);
+ }
+ } catch (IOException e) {
+ throw new ClassNotFoundException("Error reading class file", e);
+ }
+ }
+ if (resolve) resolveClass(result);
+ return result;
+ }
+
+}
diff --git a/test/hotspot/jtreg/runtime/LoaderConstraints/duplicateParentLE/Test.java b/test/hotspot/jtreg/runtime/LoaderConstraints/duplicateParentLE/Test.java
new file mode 100644
index 00000000000..af8b8fcffc4
--- /dev/null
+++ b/test/hotspot/jtreg/runtime/LoaderConstraints/duplicateParentLE/Test.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2018, 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 8199852
+ * @summary Test exception messages of LinkageError with a parent class loader
+ * that is not known to the VM. A class loader loads
+ * twice the same class. Should trigger exception in
+ * SystemDictionary::check_constraints().
+ * @compile ../common/Foo.java
+ * @compile ../common/J.java
+ * @compile ParentClassLoader.java
+ * PreemptingChildClassLoader.java
+ * @run main/othervm Test
+ */
+
+public class Test {
+
+ // Check that all names have external formatting ('.' and not '/' in package names).
+ // Check for parent of class loader.
+ // Break expectedErrorMessage into 2 parts due to the class loader name containing
+ // the unique @ identity hash which cannot be compared against.
+
+ // Check that all names have external formatting ('.' and not '/' in package names).
+ // Check for name and parent of class loader. Type should be mentioned as 'class'.
+ static String expectedErrorMessage_part1 = "loader 'DuplicateParentLE_Test_Loader' @";
+ static String expectedErrorMessage_part2 = " attempted duplicate class definition for test.Foo. (test.Foo is in unnamed module of loader 'DuplicateParentLE_Test_Loader' @";
+ static String expectedErrorMessage_part3 = ", parent loader ParentClassLoader @";
+
+
+ // Test that the error message is correct when a loader constraint error is
+ // detected during vtable creation.
+ //
+ // In this test, during vtable creation for class Task, method "Task.m()LFoo;"
+ // overrides "J.m()LFoo;". But, Task's class Foo and super type J's class Foo
+ // are different. So, a LinkageError exception should be thrown because the
+ // loader constraint check will fail.
+ public static void test(String loaderName,
+ String testType) throws Exception {
+ String[] classNames = {testType};
+ ClassLoader l = new PreemptingChildClassLoader(loaderName, classNames, false);
+ l.loadClass(testType);
+ try {
+ l.loadClass(testType).newInstance();
+ throw new RuntimeException("Expected LinkageError exception not thrown");
+ } catch (LinkageError e) {
+ String errorMsg = e.getMessage();
+ if (!errorMsg.contains(expectedErrorMessage_part1) ||
+ !errorMsg.contains(expectedErrorMessage_part2) ||
+ !errorMsg.contains(expectedErrorMessage_part3)) {
+ System.out.println("Expected: " + expectedErrorMessage_part1 + "" + expectedErrorMessage_part2 + "\n" +
+ "but got: " + errorMsg);
+ throw new RuntimeException("Wrong LinkageError exception thrown: " + errorMsg);
+ }
+ System.out.println("Passed with message: " + errorMsg);
+ }
+ }
+
+ public static void main(String args[]) throws Exception {
+ test("DuplicateParentLE_Test_Loader", "test.Foo");
+ }
+}
diff --git a/test/hotspot/jtreg/runtime/ReservedStack/ReservedStackTest.java b/test/hotspot/jtreg/runtime/ReservedStack/ReservedStackTest.java
index e595fb80729..d5a9e6f0601 100644
--- a/test/hotspot/jtreg/runtime/ReservedStack/ReservedStackTest.java
+++ b/test/hotspot/jtreg/runtime/ReservedStack/ReservedStackTest.java
@@ -232,6 +232,19 @@ public class ReservedStackTest {
}
}
+ private static boolean isAlwaysSupportedPlatform() {
+ return Platform.isAix() ||
+ (Platform.isLinux() &&
+ (Platform.isPPC() || Platform.isS390x() || Platform.isX64() ||
+ Platform.isX86() || Platform.isAArch64())) ||
+ Platform.isOSX() ||
+ Platform.isSolaris();
+ }
+
+ private static boolean isNeverSupportedPlatform() {
+ return !isAlwaysSupportedPlatform();
+ }
+
private static boolean isSupportedPlatform;
private static void initIsSupportedPlatform() throws Exception {
@@ -256,11 +269,19 @@ public class ReservedStackTest {
// Do a sanity check. Some platforms we know are always supported. Make sure
// we didn't determine that one of those platforms is not supported.
- if (!isSupportedPlatform) {
+ if (!isSupportedPlatform && isAlwaysSupportedPlatform()) {
String msg = "This platform should be supported: " + Platform.getOsArch();
System.err.println("FAILED: " + msg);
throw new RuntimeException(msg);
}
+
+ // And some platforms we know are never supported. Make sure
+ // we didn't determine that one of those platforms is supported.
+ if (isSupportedPlatform && isNeverSupportedPlatform()) {
+ String msg = "This platform should not be supported: " + Platform.getOsArch();
+ System.err.println("FAILED: " + msg);
+ throw new RuntimeException(msg);
+ }
}
public static void main(String[] args) throws Exception {
diff --git a/test/hotspot/jtreg/runtime/appcds/CDSandJFR.java b/test/hotspot/jtreg/runtime/appcds/CDSandJFR.java
index ba870fbbaf8..53fec7ae3e4 100644
--- a/test/hotspot/jtreg/runtime/appcds/CDSandJFR.java
+++ b/test/hotspot/jtreg/runtime/appcds/CDSandJFR.java
@@ -30,7 +30,7 @@
* @modules jdk.jfr
* @build Hello GetFlightRecorder
* @run driver ClassFileInstaller -jar CDSandJFR.jar Hello GetFlightRecorder GetFlightRecorder$TestEvent GetFlightRecorder$SimpleEvent
- * @run driver CDSandJFR
+ * @run driver/timeout=500 CDSandJFR
*/
import jdk.test.lib.BuildHelper;
diff --git a/test/hotspot/jtreg/runtime/appcds/VerifierTest.java b/test/hotspot/jtreg/runtime/appcds/VerifierTest.java
index a915e42efc6..2898be97373 100644
--- a/test/hotspot/jtreg/runtime/appcds/VerifierTest.java
+++ b/test/hotspot/jtreg/runtime/appcds/VerifierTest.java
@@ -102,17 +102,17 @@ public class VerifierTest implements Opcodes {
}
static void testset_0(String jar, String[] noAppClasses, String[] appClasses) throws Exception {
- // Dumping should fail if the IgnoreUnverifiableClassesDuringDump
- // option is not enabled.
- OutputAnalyzer output = TestCommon.dump(jar, appClasses,
- CDS_LOGGING,
- "-XX:+UnlockDiagnosticVMOptions",
- "-XX:-IgnoreUnverifiableClassesDuringDump");
- output.shouldContain("Please remove the unverifiable classes");
- output.shouldHaveExitValue(1);
-
- // By default, bad classes should be ignored during dumping.
- TestCommon.testDump(jar, appClasses);
+ // Unverifiable classes won't be included in the CDS archive.
+ // Dumping should not fail.
+ OutputAnalyzer output = TestCommon.dump(jar, appClasses);
+ output.shouldHaveExitValue(0);
+ if (output.getStdout().contains("Loading clases to share")) {
+ // last entry in appClasses[] is a verifiable class
+ for (int i = 0; i < (appClasses.length - 1); i++) {
+ output.shouldContain("Verification failed for " + appClasses[i]);
+ output.shouldContain("Removed error class: " + appClasses[i]);
+ }
+ }
}
static void checkRuntimeOutput(OutputAnalyzer output, String expected) throws Exception {
diff --git a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/EmptyClassInBootClassPath.java b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/EmptyClassInBootClassPath.java
index 5ca6af9e64b..459be678495 100644
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/EmptyClassInBootClassPath.java
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/EmptyClassInBootClassPath.java
@@ -31,7 +31,7 @@
* "--limit-modules java.base" option is specified
* @requires vm.cds & !vm.graal.enabled
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
- * @modules java.base/jdk.internal.misc
+ * @modules java.base/jdk.internal.access
* java.management
* jdk.jartool/sun.tools.jar
* jdk.internal.jvmstat/sun.jvmstat.monitor
@@ -66,7 +66,7 @@ public class EmptyClassInBootClassPath {
List argsList = new ArrayList();
argsList.add(classPath);
argsList.add(bootclasspath);
- argsList.add("--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED");
+ argsList.add("--add-exports=java.base/jdk.internal.access=ALL-UNNAMED");
argsList.add("EmptyClassHelper");
// case 1: load class in bootclasspath using app loader
diff --git a/test/hotspot/jtreg/runtime/appcds/sharedStrings/ExerciseGC.java b/test/hotspot/jtreg/runtime/appcds/sharedStrings/ExerciseGC.java
index c4ac14a5e4b..f3508bcc394 100644
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/ExerciseGC.java
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/ExerciseGC.java
@@ -27,17 +27,16 @@
* @summary Exercise GC with shared strings
* @requires vm.cds.archived.java.heap
* @library /test/hotspot/jtreg/runtime/appcds /test/lib
- * @modules java.base/jdk.internal.misc
- * @modules java.management
- * jdk.jartool/sun.tools.jar
+ * @modules jdk.jartool/sun.tools.jar
* @build HelloStringGC sun.hotspot.WhiteBox
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
* @run driver ExerciseGC
- * @run main/othervm -XX:+UseStringDeduplication ExerciseGC
- * @run main/othervm -XX:-CompactStrings ExerciseGC
*/
public class ExerciseGC {
public static void main(String[] args) throws Exception {
+ SharedStringsUtils.run(args, ExerciseGC::test);
+ }
+ public static void test(String[] args) throws Exception {
SharedStringsUtils.buildJarAndWhiteBox("HelloStringGC");
SharedStringsUtils.dumpWithWhiteBox(TestCommon.list("HelloStringGC"),
diff --git a/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions.java b/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions.java
index fa8473ccc5e..00acbe2ba45 100644
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions.java
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions.java
@@ -22,6 +22,11 @@
*
*/
+// NOTE: the test takes a long time for each VM option combination, so we split
+// it into 3 @test parts, so that they can be executed in parallel. If you make a
+// change, please ensure all @test blocks are in sync.
+
+
/*
* @test
* @summary Test options that are incompatible with use of shared strings
@@ -36,9 +41,35 @@
* @build sun.hotspot.WhiteBox
* @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
* @build HelloString
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. IncompatibleOptions
+ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. IncompatibleOptions 0
*/
+
+/*
+ * @test
+ * @requires vm.cds.archived.java.heap
+ * @requires (vm.gc=="null")
+ * @library /test/lib /test/hotspot/jtreg/runtime/appcds
+ * @modules jdk.jartool/sun.tools.jar
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @build HelloString
+ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. IncompatibleOptions 1
+ */
+
+/*
+ * @test
+ * @requires vm.cds.archived.java.heap
+ * @requires (vm.gc=="null")
+ * @library /test/lib /test/hotspot/jtreg/runtime/appcds
+ * @modules jdk.jartool/sun.tools.jar
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @build HelloString
+ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. IncompatibleOptions 2
+ */
+
+
import jdk.test.lib.Asserts;
import jdk.test.lib.Platform;
import jdk.test.lib.process.OutputAnalyzer;
@@ -59,10 +90,17 @@ public class IncompatibleOptions {
"The shared archive file's CompactStrings setting .* does not equal the current CompactStrings setting";
static String appJar;
- static String[] globalVmOptions;
+ static String[] vmOptionsPrefix = {};
public static void main(String[] args) throws Exception {
- globalVmOptions = args; // specified by "@run main" in IncompatibleOptions_*.java
+ String[] noargs = {};
+ SharedStringsUtils.run(Integer.parseInt(args[0]), 3, noargs, IncompatibleOptions::test);
+ // Add a new @test block if you get an assert ----^ about this number. See
+ // SharedStringsUtils.java for details.
+ }
+
+ public static void test(String[] args_ignored) throws Exception {
+ vmOptionsPrefix = SharedStringsUtils.getChildVMOptionsPrefix();
appJar = JarBuilder.build("IncompatibleOptions", "HelloString");
// Uncompressed OOPs
@@ -118,7 +156,7 @@ public class IncompatibleOptions {
System.out.println("Testcase: " + testCaseNr);
OutputAnalyzer output = TestCommon.dump(appJar, TestCommon.list("Hello"),
- TestCommon.concat(globalVmOptions,
+ TestCommon.concat(vmOptionsPrefix,
"-XX:+UseCompressedOops",
collectorOption,
"-XX:SharedArchiveConfigFile=" + TestCommon.getSourceFile("SharedStringsBasic.txt"),
@@ -145,12 +183,12 @@ public class IncompatibleOptions {
// main class param, and fails with "Could not find or load main class"
if (!extraOption.isEmpty()) {
output = TestCommon.exec(appJar,
- TestCommon.concat(globalVmOptions,
+ TestCommon.concat(vmOptionsPrefix,
"-XX:+UseCompressedOops",
collectorOption, "-Xlog:cds", extraOption, "HelloString"));
} else {
output = TestCommon.exec(appJar,
- TestCommon.concat(globalVmOptions,
+ TestCommon.concat(vmOptionsPrefix,
"-XX:+UseCompressedOops",
collectorOption, "-Xlog:cds", "HelloString"));
}
diff --git a/test/hotspot/jtreg/runtime/appcds/sharedStrings/InternSharedString.java b/test/hotspot/jtreg/runtime/appcds/sharedStrings/InternSharedString.java
index 43cb3f30184..d825013b13b 100644
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/InternSharedString.java
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/InternSharedString.java
@@ -27,19 +27,19 @@
* @summary Test shared strings together with string intern operation
* @requires vm.cds.archived.java.heap
* @library /test/hotspot/jtreg/runtime/appcds /test/lib
- * @modules java.base/jdk.internal.misc
- * @modules java.management
- * jdk.jartool/sun.tools.jar
+ * @modules jdk.jartool/sun.tools.jar
* @compile InternStringTest.java
* @build sun.hotspot.WhiteBox
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
* @run driver InternSharedString
- * @run main/othervm -XX:+UseStringDeduplication InternSharedString
- * @run main/othervm -XX:-CompactStrings InternSharedString
*/
public class InternSharedString {
public static void main(String[] args) throws Exception {
+ SharedStringsUtils.run(args, InternSharedString::test);
+ }
+
+ public static void test(String[] args) throws Exception {
SharedStringsUtils.buildJarAndWhiteBox("InternStringTest");
SharedStringsUtils.dumpWithWhiteBox(TestCommon.list("InternStringTest"),
diff --git a/test/hotspot/jtreg/runtime/appcds/sharedStrings/InvalidFileFormat.java b/test/hotspot/jtreg/runtime/appcds/sharedStrings/InvalidFileFormat.java
index 17e5050a036..659bae0cb00 100644
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/InvalidFileFormat.java
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/InvalidFileFormat.java
@@ -27,13 +27,9 @@
* @summary Check most common errors in file format
* @requires vm.cds.archived.java.heap
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
- * @modules java.base/jdk.internal.misc
- * @modules java.management
- * jdk.jartool/sun.tools.jar
+ * @modules jdk.jartool/sun.tools.jar
* @build HelloString
* @run driver InvalidFileFormat
- * @run main/othervm -XX:+UseStringDeduplication InvalidFileFormat
- * @run main/othervm -XX:-CompactStrings InvalidFileFormat
*/
import java.io.File;
@@ -46,6 +42,10 @@ import jdk.test.lib.process.OutputAnalyzer;
// the previledge person in the server environment.
public class InvalidFileFormat {
public static void main(String[] args) throws Exception {
+ SharedStringsUtils.run(args, InvalidFileFormat::test);
+ }
+
+ public static void test(String[] args) throws Exception {
SharedStringsUtils.buildJar("HelloString");
test("NonExistentFile.txt", "Unable to get hashtable dump file size");
diff --git a/test/hotspot/jtreg/runtime/appcds/sharedStrings/LargePages.java b/test/hotspot/jtreg/runtime/appcds/sharedStrings/LargePages.java
index f862b18aac5..f4704be8879 100644
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/LargePages.java
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/LargePages.java
@@ -27,17 +27,18 @@
* @summary Basic shared string test with large pages
* @requires vm.cds.archived.java.heap
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
- * @modules java.base/jdk.internal.misc
- * @modules java.management
- * jdk.jartool/sun.tools.jar
+ * @modules jdk.jartool/sun.tools.jar
* @build HelloString
* @run driver LargePages
- * @run main/othervm -XX:+UseStringDeduplication LargePages
- * @run main/othervm -XX:-CompactStrings LargePages
*/
public class LargePages {
static final String CDS_LOGGING = "-Xlog:cds,cds+hashtables";
+
public static void main(String[] args) throws Exception {
+ SharedStringsUtils.run(args, LargePages::test);
+ }
+
+ public static void test(String[] args) throws Exception {
SharedStringsUtils.buildJar("HelloString");
SharedStringsUtils.dump(TestCommon.list("HelloString"),
diff --git a/test/hotspot/jtreg/runtime/appcds/sharedStrings/LockSharedStrings.java b/test/hotspot/jtreg/runtime/appcds/sharedStrings/LockSharedStrings.java
index 5de2d0f3a81..12ea54e113e 100644
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/LockSharedStrings.java
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/LockSharedStrings.java
@@ -27,19 +27,19 @@
* @summary Test locking on shared strings
* @requires vm.cds.archived.java.heap
* @library /test/hotspot/jtreg/runtime/appcds /test/lib
- * @modules java.base/jdk.internal.misc
- * @modules java.management
- * jdk.jartool/sun.tools.jar
+ * @modules jdk.jartool/sun.tools.jar
* @compile LockStringTest.java LockStringValueTest.java
* @build sun.hotspot.WhiteBox
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
* @run driver LockSharedStrings
- * @run main/othervm -XX:+UseStringDeduplication LockSharedStrings
- * @run main/othervm -XX:-CompactStrings LockSharedStrings
*/
public class LockSharedStrings {
public static void main(String[] args) throws Exception {
+ SharedStringsUtils.run(args, LockSharedStrings::test);
+ }
+
+ public static void test(String[] args) throws Exception {
SharedStringsUtils.buildJarAndWhiteBox("LockStringTest", "LockStringValueTest");
SharedStringsUtils.dumpWithWhiteBox(
diff --git a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasic.java b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasic.java
index 834e6180d52..a54765362c9 100644
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasic.java
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasic.java
@@ -27,44 +27,49 @@
* @summary Basic test for shared strings
* @requires vm.cds.archived.java.heap
* @library /test/hotspot/jtreg/runtime/appcds /test/lib
- * @modules java.base/jdk.internal.misc
- * @modules java.management
- * jdk.jartool/sun.tools.jar
+ * @modules jdk.jartool/sun.tools.jar
* @build HelloString
* @run driver SharedStringsBasic
- * @run main/othervm -XX:+UseStringDeduplication SharedStringsBasic
- * @run main/othervm -XX:-CompactStrings SharedStringsBasic
*/
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
-// This test does not use SharedStringsUtils intentionally:
+// This test does not use SharedStringsUtils.dumpXXX()
+// and SharedStringsUtils.runWithXXX() intentionally:
// - in order to demonstrate the basic use of the functionality
// - to provide sanity check and catch potential problems in the utils
public class SharedStringsBasic {
public static void main(String[] args) throws Exception {
+ SharedStringsUtils.run(args, SharedStringsBasic::test);
+ }
+
+ public static void test(String[] args) throws Exception {
+ String vmOptionsPrefix[] = SharedStringsUtils.getChildVMOptionsPrefix();
+
String appJar = JarBuilder.build("SharedStringsBasic", "HelloString");
String sharedArchiveConfigFile =
TestCommon.getSourceFile("SharedStringsBasic.txt").toString();
ProcessBuilder dumpPb = ProcessTools.createJavaProcessBuilder(true,
+ TestCommon.concat(vmOptionsPrefix,
"-cp", appJar,
"-XX:SharedArchiveConfigFile=" + sharedArchiveConfigFile,
"-XX:SharedArchiveFile=./SharedStringsBasic.jsa",
"-Xshare:dump",
- "-Xlog:cds,cds+hashtables");
+ "-Xlog:cds,cds+hashtables"));
TestCommon.executeAndLog(dumpPb, "dump")
.shouldContain("Shared string table stats")
.shouldHaveExitValue(0);
ProcessBuilder runPb = ProcessTools.createJavaProcessBuilder(true,
+ TestCommon.concat(vmOptionsPrefix,
"-cp", appJar,
"-XX:SharedArchiveFile=./SharedStringsBasic.jsa",
"-Xshare:auto",
"-showversion",
- "HelloString");
+ "HelloString"));
TestCommon.executeAndLog(runPb, "run").shouldHaveExitValue(0);
}
diff --git a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasicPlus.java b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasicPlus.java
index 88a2b2c5e56..979a4a47bef 100644
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasicPlus.java
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasicPlus.java
@@ -27,18 +27,18 @@
* @summary Basic plus test for shared strings
* @requires vm.cds.archived.java.heap
* @library /test/hotspot/jtreg/runtime/appcds /test/lib
- * @modules java.base/jdk.internal.misc
- * @modules java.management
- * jdk.jartool/sun.tools.jar
+ * @modules jdk.jartool/sun.tools.jar
* @build HelloStringPlus sun.hotspot.WhiteBox
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
* @run driver SharedStringsBasicPlus
- * @run main/othervm -XX:+UseStringDeduplication SharedStringsBasicPlus
- * @run main/othervm -XX:-CompactStrings SharedStringsBasicPlus
*/
public class SharedStringsBasicPlus {
public static void main(String[] args) throws Exception {
+ SharedStringsUtils.run(args, SharedStringsBasicPlus::test);
+ }
+
+ public static void test(String[] args) throws Exception {
SharedStringsUtils.buildJarAndWhiteBox("HelloStringPlus");
SharedStringsUtils.dumpWithWhiteBox( TestCommon.list("HelloStringPlus"),
diff --git a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsStress.java b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsStress.java
index dd9e4167758..f22be7e679a 100644
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsStress.java
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsStress.java
@@ -30,8 +30,6 @@
* @modules jdk.jartool/sun.tools.jar
* @build HelloString
* @run driver SharedStringsStress
- * @run main/othervm -XX:+UseStringDeduplication SharedStringsStress
- * @run main/othervm -XX:-CompactStrings SharedStringsStress
*/
import java.io.File;
import java.io.FileOutputStream;
@@ -42,6 +40,12 @@ import jdk.test.lib.process.ProcessTools;
public class SharedStringsStress {
public static void main(String[] args) throws Exception {
+ SharedStringsUtils.run(args, SharedStringsStress::test);
+ }
+
+ public static void test(String[] args) throws Exception {
+ String vmOptionsPrefix[] = SharedStringsUtils.getChildVMOptionsPrefix();
+
String appJar = JarBuilder.build("SharedStringsStress", "HelloString");
String sharedArchiveConfigFile = System.getProperty("user.dir") + File.separator + "SharedStringsStress_gen.txt";
@@ -58,9 +62,11 @@ public class SharedStringsStress {
}
OutputAnalyzer dumpOutput = TestCommon.dump(appJar, TestCommon.list("HelloString"),
- "-XX:SharedArchiveConfigFile=" + sharedArchiveConfigFile);
+ TestCommon.concat(vmOptionsPrefix,
+ "-XX:SharedArchiveConfigFile=" + sharedArchiveConfigFile));
TestCommon.checkDump(dumpOutput);
- OutputAnalyzer execOutput = TestCommon.exec(appJar, "HelloString");
+ OutputAnalyzer execOutput = TestCommon.exec(appJar,
+ TestCommon.concat(vmOptionsPrefix, "HelloString"));
TestCommon.checkExec(execOutput);
}
}
diff --git a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsUtils.java b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsUtils.java
index 5121ae5924e..5d987cd743e 100644
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsUtils.java
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -24,6 +24,7 @@
import jdk.test.lib.cds.CDSOptions;
import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.Asserts;
// A helper/utility class for testing shared strings
public class SharedStringsUtils {
@@ -31,6 +32,49 @@ public class SharedStringsUtils {
public static final String TEST_JAR_NAME_FULL = "test.jar";
public static final String WHITEBOX_JAR_NAME = "whitebox";
+ public static interface Test {
+ public void dotest(String args[]) throws Exception ;
+ }
+
+ private static String[][] vmOptionCombos = {
+ {},
+ {"-XX:+UseStringDeduplication"},
+ {"-XX:-CompactStrings"}
+ };
+
+ private static String childVMOptionsPrefix[] = {};
+
+ // SharedStringsUtils.run() is for running the main test body multiple times, each with a different
+ // set of extra VM options that are passed to the child processes.
+ //
+ // See ./ExerciseGC.java for an example.
+ public static void run(String args[], Test t) throws Exception {
+ int numSetOfChildVMOptions = vmOptionCombos.length;
+ for (int i=0; i< numSetOfChildVMOptions; i++) {
+ run(i, numSetOfChildVMOptions, args, t);
+ }
+ }
+
+ public static void run(int i, int numSetOfChildVMOptions, String args[], Test t) throws Exception {
+ // When you add a new set of options to vmOptionCombos, we make sure all
+ // callers of this method (i.e., IncompatibleOptions.java) knows about it and will
+ // add new @test blocks accordingly.
+ Asserts.assertEQ(numSetOfChildVMOptions, vmOptionCombos.length);
+ String opts[] = vmOptionCombos[i];
+
+ System.out.print("Running with extra VM option prefix for child processes [" + opts.length + "] =");
+ for (String o : opts) {
+ System.out.print(" " + o);
+ }
+ System.out.println();
+ childVMOptionsPrefix = opts;
+ t.dotest(args);
+ }
+
+ public static String[] getChildVMOptionsPrefix() {
+ return childVMOptionsPrefix;
+ }
+
public static String getWbParam() {
return "-Xbootclasspath/a:" + TestCommon.getTestJar(WHITEBOX_JAR_NAME + ".jar");
}
@@ -55,6 +99,7 @@ public class SharedStringsUtils {
TestCommon.concat(extraOptions, "-XX:+UseCompressedOops", "-XX:+UseG1GC",
"-XX:SharedArchiveConfigFile=" +
TestCommon.getSourceFile(sharedDataFile));
+ args = TestCommon.concat(childVMOptionsPrefix, args);
return TestCommon.dump(appJar, appClasses, args);
}
@@ -80,6 +125,7 @@ public class SharedStringsUtils {
String appJar = TestCommon.getTestJar(TEST_JAR_NAME_FULL);
String[] args = TestCommon.concat(extraOptions,
"-cp", appJar, "-XX:+UseCompressedOops", "-XX:+UseG1GC", className);
+ args = TestCommon.concat(childVMOptionsPrefix, args);
OutputAnalyzer output = TestCommon.execAuto(args);
checkExecAuto(output);
@@ -98,6 +144,7 @@ public class SharedStringsUtils {
String appJar = TestCommon.getTestJar(TEST_JAR_NAME_FULL);
String[] args = TestCommon.concat(extraOptions,
"-XX:+UseCompressedOops", "-XX:+UseG1GC", className);
+ args = TestCommon.concat(childVMOptionsPrefix, args);
OutputAnalyzer output = TestCommon.exec(appJar, args);
checkExec(output, extraMatches);
diff --git a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsWbTest.java b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsWbTest.java
index 305dda0e6f7..de4c811ad2a 100644
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsWbTest.java
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsWbTest.java
@@ -27,14 +27,10 @@
* @summary White box test for shared strings
* @requires vm.cds.archived.java.heap
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
- * @modules java.base/jdk.internal.misc
- * @modules java.management
- * jdk.jartool/sun.tools.jar
+ * @modules jdk.jartool/sun.tools.jar
* @build sun.hotspot.WhiteBox SharedStringsWb
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
* @run driver SharedStringsWbTest
- * @run main/othervm -XX:+UseStringDeduplication SharedStringsWbTest
- * @run main/othervm -XX:-CompactStrings SharedStringsWbTest
*/
import java.io.*;
@@ -42,6 +38,10 @@ import sun.hotspot.WhiteBox;
public class SharedStringsWbTest {
public static void main(String[] args) throws Exception {
+ SharedStringsUtils.run(args, SharedStringsWbTest::test);
+ }
+
+ public static void test(String[] args) throws Exception {
SharedStringsUtils.buildJarAndWhiteBox("SharedStringsWb");
SharedStringsUtils.dumpWithWhiteBox(TestCommon.list("SharedStringsWb"),
diff --git a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SysDictCrash.java b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SysDictCrash.java
index 3e726e1217b..c99086f3727 100644
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SysDictCrash.java
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SysDictCrash.java
@@ -27,12 +27,9 @@
* @summary Regression test for JDK-8098821
* @bug 8098821
* @requires vm.cds.archived.java.heap
+ * @modules jdk.jartool/sun.tools.jar
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
- * @modules java.base/jdk.internal.misc
- * @modules java.management
* @run driver SysDictCrash
- * @run main/othervm -XX:+UseStringDeduplication SysDictCrash
- * @run main/othervm -XX:-CompactStrings SysDictCrash
*/
import jdk.test.lib.process.OutputAnalyzer;
@@ -40,22 +37,30 @@ import jdk.test.lib.process.ProcessTools;
public class SysDictCrash {
public static void main(String[] args) throws Exception {
+ SharedStringsUtils.run(args, SysDictCrash::test);
+ }
+
+ public static void test(String[] args) throws Exception {
+ String vmOptionsPrefix[] = SharedStringsUtils.getChildVMOptionsPrefix();
+
// SharedBaseAddress=0 puts the archive at a very high address on solaris,
// which provokes the crash.
ProcessBuilder dumpPb = ProcessTools.createJavaProcessBuilder(true,
+ TestCommon.concat(vmOptionsPrefix,
"-XX:+UseG1GC", "-XX:MaxRAMPercentage=12.5",
"-cp", ".",
"-XX:SharedBaseAddress=0", "-XX:SharedArchiveFile=./SysDictCrash.jsa",
"-Xshare:dump",
- "-showversion", "-Xlog:cds,cds+hashtables");
+ "-showversion", "-Xlog:cds,cds+hashtables"));
TestCommon.checkDump(TestCommon.executeAndLog(dumpPb, "dump"));
ProcessBuilder runPb = ProcessTools.createJavaProcessBuilder(true,
+ TestCommon.concat(vmOptionsPrefix,
"-XX:+UseG1GC", "-XX:MaxRAMPercentage=12.5",
"-XX:SharedArchiveFile=./SysDictCrash.jsa",
"-Xshare:on",
- "-version");
+ "-version"));
TestCommon.checkExec(TestCommon.executeAndLog(runPb, "exec"));
}
diff --git a/test/hotspot/jtreg/runtime/appcds/test-classes/EmptyClassHelper.java b/test/hotspot/jtreg/runtime/appcds/test-classes/EmptyClassHelper.java
index 86805214617..a56e1593ff0 100644
--- a/test/hotspot/jtreg/runtime/appcds/test-classes/EmptyClassHelper.java
+++ b/test/hotspot/jtreg/runtime/appcds/test-classes/EmptyClassHelper.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -23,9 +23,10 @@
*/
import java.lang.*;
-import java.lang.reflect.*;
-import jdk.internal.misc.JavaLangAccess;
-import jdk.internal.misc.SharedSecrets;
+
+import java.lang.reflect.Method;
+import jdk.internal.access.JavaLangAccess;
+import jdk.internal.access.SharedSecrets;
class EmptyClassHelper {
static final JavaLangAccess jla = SharedSecrets.getJavaLangAccess();
diff --git a/test/hotspot/jtreg/serviceability/jvmti/GetLocalVariable/GetLocalVars.java b/test/hotspot/jtreg/serviceability/jvmti/GetLocalVariable/GetLocalVars.java
new file mode 100644
index 00000000000..64532abee25
--- /dev/null
+++ b/test/hotspot/jtreg/serviceability/jvmti/GetLocalVariable/GetLocalVars.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2018, 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 8080406
+ * @summary VM_GetOrSetLocal doesn't check local slot type against requested type
+ *
+ * @compile GetLocalVars.java
+ * @run main/othervm/native -Xcomp -agentlib:GetLocalVars GetLocalVars
+ */
+
+
+public class GetLocalVars {
+ private static final String agentLib = "GetLocalVars";
+
+ static native void testLocals(Thread thread);
+ static native int getStatus();
+
+ public static
+ void main(String[] args) throws Exception {
+ try {
+ System.loadLibrary(agentLib);
+ } catch (UnsatisfiedLinkError ex) {
+ System.err.println("Failed to load " + agentLib + " lib");
+ System.err.println("java.library.path: " + System.getProperty("java.library.path"));
+ throw ex;
+ }
+ run(args);
+ int status = getStatus();
+ if (status != 0) {
+ throw new RuntimeException("Test GetLocalVars failed with a bad status: " + status);
+ }
+ }
+
+ public static
+ void run(String argv[]) {
+ GetLocalVars testedObj = new GetLocalVars();
+ double pi = 3.14d;
+ byte sym = 'X';
+ int year = 2018;
+
+ staticMeth(sym, testedObj, pi, year);
+ }
+
+ public static synchronized
+ int staticMeth(byte byteArg, Object objArg, double dblArg, int intArg) {
+ testLocals(Thread.currentThread());
+ {
+ int intLoc = 9999;
+ intArg = intLoc;
+ }
+ return intArg;
+ }
+}
diff --git a/test/hotspot/jtreg/serviceability/jvmti/GetLocalVariable/libGetLocalVars.cpp b/test/hotspot/jtreg/serviceability/jvmti/GetLocalVariable/libGetLocalVars.cpp
new file mode 100644
index 00000000000..08b3439cb09
--- /dev/null
+++ b/test/hotspot/jtreg/serviceability/jvmti/GetLocalVariable/libGetLocalVars.cpp
@@ -0,0 +1,246 @@
+/*
+ * Copyright (c) 2003, 2018, 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.
+ */
+
+#include
+#include
+#include "jvmti.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define STATUS_PASSED 0
+#define STATUS_FAILED 2
+#define TranslateError(err) "JVMTI error"
+
+static jint result = STATUS_PASSED;
+static jvmtiEnv *jvmti = NULL;
+
+#define DECL_TEST_FUNC(type, Type) \
+static void \
+test_##type(jthread thr, int depth, int slot, const char* exp_type) { \
+ j##type val; \
+ jvmtiError err = jvmti->GetLocal##Type(thr, depth, slot, &val); \
+ \
+ printf(" GetLocal%s: %s (%d)\n", #Type, TranslateError(err), err); \
+ if (err != JVMTI_ERROR_NONE) { \
+ printf(" FAIL: GetLocal%s failed to get value from a local %s\n", #Type, exp_type); \
+ result = STATUS_FAILED; \
+ } else { \
+ printf(" GetLocal%s got value from a local %s as expected\n", #Type, exp_type); \
+ } \
+}
+
+#define DECL_TEST_INV_SLOT_FUNC(type, Type) \
+static void \
+test_##type##_inv_slot(jthread thr, int depth, int slot, const char* exp_type) { \
+ j##type val; \
+ jvmtiError err = jvmti->GetLocal##Type(thr, depth, slot, &val); \
+ \
+ printf(" GetLocal%s: %s (%d)\n", #Type, TranslateError(err), err); \
+ if (err != JVMTI_ERROR_INVALID_SLOT) { \
+ printf(" FAIL: GetLocal%s failed to return JVMTI_ERROR_INVALID_SLOT for local %s\n", #Type, exp_type); \
+ result = STATUS_FAILED; \
+ } else { \
+ printf(" GetLocal%s returned JVMTI_ERROR_INVALID_SLOT for local %s as expected\n", #Type, exp_type); \
+ } \
+}
+
+#define DECL_TEST_TYPE_MISMATCH_FUNC(type, Type) \
+static void \
+test_##type##_type_mismatch(jthread thr, int depth, int slot, const char* exp_type) { \
+ j##type val; \
+ jvmtiError err = jvmti->GetLocal##Type(thr, depth, slot, &val); \
+ \
+ printf(" GetLocal%s: %s (%d)\n", #Type, TranslateError(err), err); \
+ if (err != JVMTI_ERROR_TYPE_MISMATCH) { \
+ printf(" FAIL: GetLocal%s failed to return JVMTI_ERROR_TYPE_MISMATCH for local %s\n", #Type, exp_type); \
+ result = STATUS_FAILED; \
+ } else { \
+ printf(" GetLocal%s returned JVMTI_ERROR_TYPE_MISMATCH for local %s as expected\n", #Type, exp_type); \
+ } \
+}
+
+DECL_TEST_FUNC(int, Int);
+DECL_TEST_FUNC(float, Float);
+DECL_TEST_FUNC(long, Long);
+DECL_TEST_FUNC(double, Double);
+DECL_TEST_FUNC(object, Object);
+
+DECL_TEST_INV_SLOT_FUNC(int, Int);
+DECL_TEST_INV_SLOT_FUNC(float, Float);
+DECL_TEST_INV_SLOT_FUNC(long, Long);
+DECL_TEST_INV_SLOT_FUNC(double, Double);
+DECL_TEST_INV_SLOT_FUNC(object, Object);
+
+DECL_TEST_TYPE_MISMATCH_FUNC(int, Int);
+DECL_TEST_TYPE_MISMATCH_FUNC(float, Float);
+DECL_TEST_TYPE_MISMATCH_FUNC(long, Long);
+DECL_TEST_TYPE_MISMATCH_FUNC(double, Double);
+DECL_TEST_TYPE_MISMATCH_FUNC(object, Object);
+
+static void
+test_local_byte(jthread thr, int depth, int slot) {
+ printf("\n test_local_byte: BEGIN\n\n");
+
+ test_int(thr, depth, slot, "byte");
+ test_long_inv_slot(thr, depth, slot, "byte");
+ test_float(thr, depth, slot, "byte");
+ test_double_inv_slot(thr, depth, slot, "byte");
+ test_object_type_mismatch(thr, depth, slot, "byte");
+
+ printf("\n test_local_byte: END\n\n");
+}
+
+static void
+test_local_object(jthread thr, int depth, int slot) {
+ printf("\n test_local_object: BEGIN\n\n");
+
+ test_int_type_mismatch(thr, depth, slot, "object");
+ test_long_type_mismatch(thr, depth, slot, "object");
+ test_float_type_mismatch(thr, depth, slot, "object");
+ test_double_type_mismatch(thr, depth, slot, "object");
+ test_object(thr, depth, slot, "object");
+
+ printf("\n test_local_object: END\n\n");
+}
+
+static void
+test_local_double(jthread thr, int depth, int slot) {
+ printf("\n test_local_double: BEGIN\n\n");
+
+ test_int(thr, depth, slot, "double");
+ test_long(thr, depth, slot, "double");
+ test_float(thr, depth, slot, "double");
+ test_double(thr, depth, slot, "double");
+ test_object_type_mismatch(thr, depth, slot, "double");
+
+ printf("\n test_local_double: END\n\n");
+}
+
+static void
+test_local_integer(jthread thr, int depth, int slot) {
+ printf("\n test_local_integer: BEGIN\n\n");
+
+ test_int(thr, depth, slot, "int");
+ test_long_inv_slot(thr, depth, slot, "int");
+ test_float(thr, depth, slot, "int");
+ test_double_inv_slot(thr, depth, slot, "int");
+ test_object_type_mismatch(thr, depth, slot, "double");
+
+ printf("\n test_local_integer: END\n\n");
+}
+
+static void
+test_local_invalid(jthread thr, int depth, int slot) {
+ printf("\n test_local_invalid: BEGIN\n\n");
+
+ test_int_inv_slot(thr, depth, slot, "invalid");
+ test_long_inv_slot(thr, depth, slot, "invalid");
+ test_float_inv_slot(thr, depth, slot, "invalid");
+ test_double_inv_slot(thr, depth, slot, "invalid");
+ test_object_inv_slot(thr, depth, slot, "invalid");
+
+ printf("\n test_local_invalid: END\n\n");
+}
+
+jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
+ jint res;
+ jvmtiError err;
+ static jvmtiCapabilities caps;
+
+ res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9);
+ if (res != JNI_OK || jvmti == NULL) {
+ printf("Wrong result of a valid call to GetEnv!\n");
+ return JNI_ERR;
+ }
+ caps.can_access_local_variables = 1;
+
+ err = jvmti->AddCapabilities(&caps);
+ if (err != JVMTI_ERROR_NONE) {
+ printf("AddCapabilities: unexpected error: %s (%d)\n", TranslateError(err), err);
+ return JNI_ERR;
+ }
+ err = jvmti->GetCapabilities(&caps);
+ if (err != JVMTI_ERROR_NONE) {
+ printf("GetCapabilities: unexpected error: %s (%d)\n", TranslateError(err), err);
+ return JNI_ERR;
+ }
+ if (!caps.can_access_local_variables) {
+ printf("Warning: Access to local variables is not implemented\n");
+ return JNI_ERR;
+ }
+ return JNI_OK;
+}
+
+JNIEXPORT jint JNICALL
+Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
+ return Agent_Initialize(jvm, options, reserved);
+}
+
+JNIEXPORT jint JNICALL
+Agent_OnAttach(JavaVM *jvm, char *options, void *reserved) {
+ return Agent_Initialize(jvm, options, reserved);
+}
+
+JNIEXPORT void JNICALL
+Java_GetLocalVars_testLocals(JNIEnv *env, jclass cls, jobject thread) {
+ static const char* METHOD_NAME = "staticMeth";
+ static const char* METHOD_SIGN = "(BLjava/lang/Object;DI)I";
+ static const int Depth = 1;
+ static const int ByteSlot = 0;
+ static const int ObjSlot = 1;
+ static const int DblSlot = 2;
+ static const int IntSlot = 4;
+ static const int InvalidSlot = 5;
+
+ jmethodID mid = NULL;
+
+ if (jvmti == NULL) {
+ printf("JVMTI client was not properly loaded!\n");
+ result = STATUS_FAILED;
+ return;
+ }
+
+ mid = env->GetStaticMethodID(cls, METHOD_NAME, METHOD_SIGN);
+ if (mid == NULL) {
+ printf("Cannot find Method ID for %s%s\n", METHOD_NAME, METHOD_SIGN);
+ result = STATUS_FAILED;
+ return;
+ }
+
+ test_local_byte(thread, Depth, ByteSlot);
+ test_local_object(thread, Depth, ObjSlot);
+ test_local_double(thread, Depth, DblSlot);
+ test_local_integer(thread, Depth, IntSlot);
+ test_local_invalid(thread, Depth, InvalidSlot);
+}
+
+JNIEXPORT jint JNICALL
+Java_GetLocalVars_getStatus(JNIEnv *env, jclass cls) {
+ return result;
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java b/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java
index f5091c7df02..9a2489c84a8 100644
--- a/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java
+++ b/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -23,7 +23,7 @@
package sun.hotspot.tools.ctw;
-import jdk.internal.misc.SharedSecrets;
+import jdk.internal.access.SharedSecrets;
import jdk.internal.misc.Unsafe;
import jdk.internal.reflect.ConstantPool;
import sun.hotspot.WhiteBox;
diff --git a/test/hotspot/jtreg/testlibrary_tests/ctw/ClassesDirTest.java b/test/hotspot/jtreg/testlibrary_tests/ctw/ClassesDirTest.java
index e24461cdac9..b2c1bbb62c7 100644
--- a/test/hotspot/jtreg/testlibrary_tests/ctw/ClassesDirTest.java
+++ b/test/hotspot/jtreg/testlibrary_tests/ctw/ClassesDirTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -25,7 +25,8 @@
* @test
* @bug 8012447
* @library /test/lib /testlibrary/ctw/src
- * @modules java.base/jdk.internal.jimage
+ * @modules java.base/jdk.internal.access
+ * java.base/jdk.internal.jimage
* java.base/jdk.internal.misc
* java.base/jdk.internal.reflect
* java.management
diff --git a/test/hotspot/jtreg/testlibrary_tests/ctw/ClassesListTest.java b/test/hotspot/jtreg/testlibrary_tests/ctw/ClassesListTest.java
index 5ffe27ba0c6..79f01dbcd90 100644
--- a/test/hotspot/jtreg/testlibrary_tests/ctw/ClassesListTest.java
+++ b/test/hotspot/jtreg/testlibrary_tests/ctw/ClassesListTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -25,7 +25,8 @@
* @test
* @bug 8012447
* @library /test/lib /testlibrary/ctw/src
- * @modules java.base/jdk.internal.jimage
+ * @modules java.base/jdk.internal.access
+ * java.base/jdk.internal.jimage
* java.base/jdk.internal.misc
* java.base/jdk.internal.reflect
* java.management
diff --git a/test/hotspot/jtreg/testlibrary_tests/ctw/CtwTest.java b/test/hotspot/jtreg/testlibrary_tests/ctw/CtwTest.java
index 514df0e5cd0..88e34933de3 100644
--- a/test/hotspot/jtreg/testlibrary_tests/ctw/CtwTest.java
+++ b/test/hotspot/jtreg/testlibrary_tests/ctw/CtwTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -49,6 +49,7 @@ public abstract class CtwTest {
"-XX:+UnlockDiagnosticVMOptions",
"-XX:+WhiteBoxAPI",
"-Dsun.hotspot.tools.ctw.logfile=" + LOG_FILE,
+ "--add-exports", "java.base/jdk.internal.access=ALL-UNNAMED",
"--add-exports", "java.base/jdk.internal.jimage=ALL-UNNAMED",
"--add-exports", "java.base/jdk.internal.misc=ALL-UNNAMED",
"--add-exports", "java.base/jdk.internal.reflect=ALL-UNNAMED",
diff --git a/test/hotspot/jtreg/testlibrary_tests/ctw/JarDirTest.java b/test/hotspot/jtreg/testlibrary_tests/ctw/JarDirTest.java
index 18ce6347b81..b78ca9cb061 100644
--- a/test/hotspot/jtreg/testlibrary_tests/ctw/JarDirTest.java
+++ b/test/hotspot/jtreg/testlibrary_tests/ctw/JarDirTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -25,7 +25,8 @@
* @test
* @bug 8012447
* @library /test/lib /testlibrary/ctw/src
- * @modules java.base/jdk.internal.jimage
+ * @modules java.base/jdk.internal.access
+ * java.base/jdk.internal.jimage
* java.base/jdk.internal.misc
* java.base/jdk.internal.reflect
* java.compiler
diff --git a/test/hotspot/jtreg/testlibrary_tests/ctw/JarsTest.java b/test/hotspot/jtreg/testlibrary_tests/ctw/JarsTest.java
index cae3f7b7193..834171c94c2 100644
--- a/test/hotspot/jtreg/testlibrary_tests/ctw/JarsTest.java
+++ b/test/hotspot/jtreg/testlibrary_tests/ctw/JarsTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -25,7 +25,8 @@
* @test
* @bug 8012447
* @library /test/lib /testlibrary/ctw/src
- * @modules java.base/jdk.internal.jimage
+ * @modules java.base/jdk.internal.access
+ * java.base/jdk.internal.jimage
* java.base/jdk.internal.misc
* java.base/jdk.internal.reflect
* java.compiler
diff --git a/test/hotspot/jtreg/vmTestbase/metaspace/stressDictionary/StressDictionary.java b/test/hotspot/jtreg/vmTestbase/metaspace/stressDictionary/StressDictionary.java
index 71dd3069643..fd2e7a4687e 100644
--- a/test/hotspot/jtreg/vmTestbase/metaspace/stressDictionary/StressDictionary.java
+++ b/test/hotspot/jtreg/vmTestbase/metaspace/stressDictionary/StressDictionary.java
@@ -29,7 +29,7 @@
*
* @library /vmTestbase /test/lib
* @run driver jdk.test.lib.FileInstaller . .
- * @run main/othervm/timeout=300 metaspace.stressDictionary.StressDictionary -stressTime 30
+ * @run main/othervm/timeout=420 metaspace.stressDictionary.StressDictionary -stressTime 30
*/
package metaspace.stressDictionary;
diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t001/hs204t001.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t001/hs204t001.java
index 4419a914a4c..911c7f02fd2 100644
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t001/hs204t001.java
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t001/hs204t001.java
@@ -46,7 +46,8 @@
* @library /vmTestbase
* /test/lib
* @run driver jdk.test.lib.FileInstaller . .
- * @build nsk.jvmti.scenarios.hotswap.HS204.hs204t001.hs204t001
+ * @build ExecDriver
+ * nsk.jvmti.scenarios.hotswap.HS204.hs204t001.hs204t001
*
* @comment compile newclassXX to bin/newclassXX
* @run driver nsk.share.ExtraClassesBuilder
diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal003/getlocal003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal003/getlocal003.cpp
index e3c12123e1b..eeb22c83f0a 100644
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal003/getlocal003.cpp
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal003/getlocal003.cpp
@@ -21,9 +21,6 @@
* questions.
*/
-/*
- */
-
#include
#include
#include "jvmti.h"
@@ -34,13 +31,12 @@
extern "C" {
-#define PASSED 0
+#define STATUS_PASSED 0
#define STATUS_FAILED 2
static jvmtiEnv *jvmti = NULL;
-static jvmtiCapabilities caps;
static jvmtiEventCallbacks callbacks;
-static jint result = PASSED;
+static jint result = STATUS_PASSED;
static jboolean printdump = JNI_FALSE;
static jmethodID mid = NULL;
static jvmtiLocalVariableEntry *table = NULL;
@@ -54,71 +50,114 @@ void print_LocalVariableEntry(jvmtiLocalVariableEntry *lvt_elem) {
printf(", signature: %s\n", lvt_elem->signature);
}
-void JNICALL MethodExit(jvmtiEnv *jvmti_env, JNIEnv *env,
- jthread thr, jmethodID method,
- jboolean was_poped_by_exception, jvalue return_value) {
+static void
+test_locals(jvmtiEnv *jvmti, jthread thr, jlocation location) {
jvmtiError err;
- jint i;
- jmethodID frame_method;
- jlocation location;
jint intVal;
+ jlong longVal;
jfloat floatVal;
jdouble doubleVal;
jobject obj;
+ jint i;
- if (mid == method) {
+ for (i = 0; i < entryCount; i++) {
+ if (table[i].start_location > location ||
+ table[i].start_location + table[i].length < location) {
+ continue; /* The local variable is not visible */
+ }
+ print_LocalVariableEntry(&table[i]);
+ char sig = table[i].signature[0];
- err = jvmti_env->GetFrameLocation(thr, 0,
- &frame_method, &location);
- if (err != JVMTI_ERROR_NONE) {
- printf("\t failure: %s (%d)\n", TranslateError(err), err);
+ if (sig == 'Z' || sig == 'B' || sig == 'C' || sig == 'S') {
+ sig = 'I'; // covered by GetLocalInt
+ }
+ err = jvmti->GetLocalInt(thr, 0, table[i].slot, &intVal);
+ printf(" GetLocalInt: %s (%d)\n", TranslateError(err), err);
+ if (err != JVMTI_ERROR_NONE && sig == 'I') {
+ printf("FAIL: GetLocalInt failed to get value of int\n");
result = STATUS_FAILED;
- return;
- }
- if (frame_method != method) {
- printf("\t failure: GetFrameLocation returned wrong jmethodID\n");
+ } else if (err != JVMTI_ERROR_TYPE_MISMATCH && sig != 'I') {
+ printf("FAIL: GetLocalInt did not return JVMTI_ERROR_TYPE_MISMATCH for non-int\n");
result = STATUS_FAILED;
- return;
}
- printf("\n MethodExit: BEGIN %d, Current frame bci: %" LL "d\n\n",
- ++methodExitCnt, location);
- for (i = 0; i < entryCount; i++) {
- if (table[i].start_location > location ||
- table[i].start_location + table[i].length < location) {
- continue; /* The local variable is not visible */
- }
- print_LocalVariableEntry(&table[i]);
-
- err = jvmti->GetLocalInt(thr, 0, table[i].slot, &intVal);
- printf(" GetLocalInt: %s (%d)\n", TranslateError(err), err);
- if (err != JVMTI_ERROR_NONE && table[i].signature[0] == 'I') {
- result = STATUS_FAILED;
- }
-
- err = jvmti->GetLocalFloat(thr, 0, table[i].slot, &floatVal);
- printf(" GetLocalFloat: %s (%d)\n", TranslateError(err), err);
- if (err != JVMTI_ERROR_NONE && table[i].signature[0] == 'F') {
- result = STATUS_FAILED;
- }
-
- err = jvmti->GetLocalDouble(thr, 0, table[i].slot, &doubleVal);
- printf(" GetLocalDouble: %s (%d)\n", TranslateError(err), err);
- if (err != JVMTI_ERROR_NONE && table[i].signature[0] == 'D') {
- result = STATUS_FAILED;
- }
-
- err = jvmti->GetLocalObject(thr, 0, table[i].slot, &obj);
- printf(" GetLocalObject: %s (%d)\n", TranslateError(err), err);
- if (err != JVMTI_ERROR_NONE && table[i].signature[0] == 'L') {
- result = STATUS_FAILED;
- }
+ err = jvmti->GetLocalLong(thr, 0, table[i].slot, &longVal);
+ printf(" GetLocalLong: %s (%d)\n", TranslateError(err), err);
+ if (err != JVMTI_ERROR_NONE && sig == 'J') {
+ printf("FAIL: GetLocalLong failed to get value of long\n");
+ result = STATUS_FAILED;
+ } else if (err != JVMTI_ERROR_TYPE_MISMATCH && sig != 'J') {
+ printf("FAIL: GetLocalLong did not return JVMTI_ERROR_TYPE_MISMATCH for non-long\n");
+ result = STATUS_FAILED;
+ }
+
+ err = jvmti->GetLocalFloat(thr, 0, table[i].slot, &floatVal);
+ printf(" GetLocalFloat: %s (%d)\n", TranslateError(err), err);
+ if (err != JVMTI_ERROR_NONE && table[i].signature[0] == 'F') {
+ printf("FAIL: GetLocalFloat failed to get value of float\n");
+ result = STATUS_FAILED;
+ } else if (err != JVMTI_ERROR_TYPE_MISMATCH && table[i].signature[0] != 'F') {
+ printf("FAIL: GetLocalFloat did not return JVMTI_ERROR_TYPE_MISMATCH for non-float\n");
+ result = STATUS_FAILED;
+ }
+
+ err = jvmti->GetLocalDouble(thr, 0, table[i].slot, &doubleVal);
+ printf(" GetLocalDouble: %s (%d)\n", TranslateError(err), err);
+ if (err != JVMTI_ERROR_NONE && table[i].signature[0] == 'D') {
+ printf("FAIL: GetLocalDouble failed to get value of double\n");
+ result = STATUS_FAILED;
+ } else if (err != JVMTI_ERROR_TYPE_MISMATCH && table[i].signature[0] != 'D') {
+ printf("FAIL: GetLocalDouble did not return JVMTI_ERROR_TYPE_MISMATCH for non-double\n");
+ result = STATUS_FAILED;
+ }
+
+ err = jvmti->GetLocalObject(thr, 0, table[i].slot, &obj);
+ printf(" GetLocalObject: %s (%d)\n", TranslateError(err), err);
+ if (err != JVMTI_ERROR_NONE && table[i].signature[0] == 'L') {
+ printf("FAIL: GetLocalObject failed to get value of object\n");
+ result = STATUS_FAILED;
+ } else if (err != JVMTI_ERROR_TYPE_MISMATCH && table[i].signature[0] != 'L') {
+ printf("FAIL: GetLocalObject did not return JVMTI_ERROR_TYPE_MISMATCH for non-object\n");
+ result = STATUS_FAILED;
}
- printf("\n MethodExit: END %d\n\n", methodExitCnt);
- fflush(stdout);
}
}
+static void JNICALL
+MethodExit(jvmtiEnv *jvmti_env,
+ JNIEnv *env,
+ jthread thr,
+ jmethodID method,
+ jboolean was_poped_by_exception,
+ jvalue return_value) {
+
+ jvmtiError err;
+ jlocation location;
+ jmethodID frame_method = NULL;
+
+ if (mid != method) {
+ return;
+ }
+ err = jvmti->GetFrameLocation(thr, 0, &frame_method, &location);
+ if (err != JVMTI_ERROR_NONE) {
+ printf("\t failure: %s (%d)\n", TranslateError(err), err);
+ result = STATUS_FAILED;
+ return;
+ }
+ if (frame_method != method) {
+ printf("\t failure: GetFrameLocation returned wrong jmethodID\n");
+ result = STATUS_FAILED;
+ return;
+ }
+
+ printf("\n MethodExit: BEGIN %d\n", ++methodExitCnt);
+
+ test_locals(jvmti, thr, location);
+
+ printf("\n MethodExit: END %d\n\n", methodExitCnt);
+ fflush(stdout);
+}
+
#ifdef STATIC_BUILD
JNIEXPORT jint JNICALL Agent_OnLoad_getlocal003(JavaVM *jvm, char *options, void *reserved) {
return Agent_Initialize(jvm, options, reserved);
@@ -133,6 +172,7 @@ JNIEXPORT jint JNI_OnLoad_getlocal003(JavaVM *jvm, char *options, void *reserved
jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
jint res;
jvmtiError err;
+ static jvmtiCapabilities caps;
if (options != NULL && strcmp(options, "printdump") == 0) {
printdump = JNI_TRUE;
@@ -167,18 +207,19 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
if (!caps.can_access_local_variables) {
printf("Warning: Access to local variables is not implemented\n");
- } else if (caps.can_generate_method_exit_events) {
- callbacks.MethodExit = &MethodExit;
- err = jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks));
- if (err != JVMTI_ERROR_NONE) {
- printf("(SetEventCallbacks) unexpected error: %s (%d)\n",
- TranslateError(err), err);
- return JNI_ERR;
- }
- } else {
- printf("Warning: MethodExit event is not implemented\n");
+ return JNI_ERR;
+ }
+ if (!caps.can_generate_method_exit_events) {
+ printf("Warning: MethodExit event is not implemented\n");
+ return JNI_ERR;
+ }
+ callbacks.MethodExit = &MethodExit;
+ err = jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks));
+ if (err != JVMTI_ERROR_NONE) {
+ printf("(SetEventCallbacks) unexpected error: %s (%d)\n",
+ TranslateError(err), err);
+ return JNI_ERR;
}
-
return JNI_OK;
}
@@ -192,9 +233,6 @@ Java_nsk_jvmti_unit_GetLocalVariable_getlocal003_getMeth(JNIEnv *env, jclass cls
return;
}
- if (!caps.can_access_local_variables ||
- !caps.can_generate_method_exit_events) return;
-
mid = env->GetStaticMethodID(cls, "staticMeth", "(I)I");
if (mid == NULL) {
printf("Cannot find Method ID for staticMeth\n");
@@ -204,14 +242,13 @@ Java_nsk_jvmti_unit_GetLocalVariable_getlocal003_getMeth(JNIEnv *env, jclass cls
err = jvmti->GetLocalVariableTable(mid, &entryCount, &table);
if (err != JVMTI_ERROR_NONE) {
- printf("(GetLocalVariableTable) unexpected error: %s (%d)\n",
- TranslateError(err), err);
- result = STATUS_FAILED;
- return;
+ printf("(GetLocalVariableTable) unexpected error: %s (%d)\n",
+ TranslateError(err), err);
+ result = STATUS_FAILED;
+ return;
}
- err = jvmti->SetEventNotificationMode(JVMTI_ENABLE,
- JVMTI_EVENT_METHOD_EXIT, NULL);
+ err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, NULL);
if (err != JVMTI_ERROR_NONE) {
printf("Failed to enable metod exit event: %s (%d)\n",
TranslateError(err), err);
@@ -232,8 +269,11 @@ Java_nsk_jvmti_unit_GetLocalVariable_getlocal003_checkLoc(JNIEnv *env,
int overlap = 0;
if (jvmti == NULL) {
+ printf("JVMTI client was not properly loaded!\n");
+ result = STATUS_FAILED;
return;
}
+ printf("\n checkLoc: START\n");
mid = env->GetStaticMethodID(cls, "staticMeth", "(I)I");
if (mid == NULL) {
@@ -255,20 +295,22 @@ Java_nsk_jvmti_unit_GetLocalVariable_getlocal003_checkLoc(JNIEnv *env,
err = jvmti->GetLocalInt(thr, 1, table[i].slot, &locVar);
- printf(" GetLocalInt: %s (%d)\n", TranslateError(err), err);
if (strcmp(table[i].name, "intArg") == 0) {
if (err != JVMTI_ERROR_NONE) {
- printf(" failure: JVMTI_ERROR_NONE is expected\n");
- result = STATUS_FAILED;
+ printf(" GetLocalInt: %s (%d)\n", TranslateError(err), err);
+ printf(" failure: JVMTI_ERROR_NONE is expected\n");
+ result = STATUS_FAILED;
}
}
else if (strcmp(table[i].name, "pi") == 0) {
if (err != JVMTI_ERROR_TYPE_MISMATCH) {
- printf(" failure: JVMTI_ERROR_TYPE_MISMATCH is expected\n");
- result = STATUS_FAILED;
+ printf(" GetLocalInt: %s (%d)\n", TranslateError(err), err);
+ printf(" failure: JVMTI_ERROR_TYPE_MISMATCH is expected\n");
+ result = STATUS_FAILED;
}
} else {
if (err != JVMTI_ERROR_INVALID_SLOT) {
+ printf(" GetLocalInt: %s (%d)\n", TranslateError(err), err);
printf(" failure: JVMTI_ERROR_INVALID_SLOT is expected\n");
result = STATUS_FAILED;
}
@@ -290,7 +332,7 @@ Java_nsk_jvmti_unit_GetLocalVariable_getlocal003_checkLoc(JNIEnv *env,
continue; /* Everything is Ok */
}
- printf(" failure: locations of vars with slot #2 are overlaped:\n");
+ printf(" failure: locations of vars with slot #2 are overlapped:\n");
print_LocalVariableEntry(&table[i]);
print_LocalVariableEntry(&table[j]);
overlap++;
@@ -298,8 +340,9 @@ Java_nsk_jvmti_unit_GetLocalVariable_getlocal003_checkLoc(JNIEnv *env,
}
}
if (!overlap) {
- printf("\n Succes: locations of vars with slot #2 are NOT overlaped\n\n");
+ printf("\n Success: locations of vars with slot #2 are NOT overlapped\n");
}
+ printf("\n checkLoc: END\n\n");
fflush(stdout);
}
diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal004/getlocal004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal004/getlocal004.cpp
index c751aa6d3f5..c63875c7da5 100644
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal004/getlocal004.cpp
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal004/getlocal004.cpp
@@ -21,9 +21,6 @@
* questions.
*/
-/*
- */
-
#include
#include
#include "jvmti.h"
@@ -34,14 +31,12 @@
extern "C" {
-#define PASSED 0
+#define STATUS_PASSED 0
#define STATUS_FAILED 2
static jvmtiEnv *jvmti = NULL;
-static jvmtiCapabilities caps;
-static jint result = PASSED;
+static jint result = STATUS_PASSED;
static jboolean printdump = JNI_FALSE;
-static jmethodID mid = NULL;
void print_LocalVariableEntry(jvmtiLocalVariableEntry *lvt_elem) {
printf("\n Var name: %s, slot: %d", lvt_elem->name, lvt_elem->slot);
@@ -64,6 +59,7 @@ JNIEXPORT jint JNI_OnLoad_getlocal004(JavaVM *jvm, char *options, void *reserved
jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
jint res;
jvmtiError err;
+ static jvmtiCapabilities caps;
if (options != NULL && strcmp(options, "printdump") == 0) {
printdump = JNI_TRUE;
@@ -98,29 +94,31 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
if (!caps.can_access_local_variables) {
printf("Warning: Access to local variables is not implemented\n");
+ return JNI_ERR;
+ }
+ if (!caps.can_access_local_variables) {
+ printf("Warning: Access to local variables is not implemented\n");
+ return JNI_ERR;
}
-
return JNI_OK;
}
JNIEXPORT void JNICALL
Java_nsk_jvmti_unit_GetLocalVariable_getlocal004_getMeth(JNIEnv *env, jclass cls) {
+ jmethodID mid = NULL;
+
if (jvmti == NULL) {
printf("JVMTI client was not properly loaded!\n");
result = STATUS_FAILED;
return;
}
- if (!caps.can_access_local_variables ||
- !caps.can_generate_method_exit_events) return;
-
mid = env->GetStaticMethodID(cls, "staticMeth", "(I)I");
if (mid == NULL) {
printf("Cannot find Method ID for staticMeth\n");
result = STATUS_FAILED;
return;
}
-
fflush(stdout);
}
diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.cpp
index fce50a478b5..13a3db8b459 100644
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.cpp
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.cpp
@@ -163,7 +163,7 @@ void nsk_lvcomplain(const char file[], int line,
} else if (strlen(msg_buf2) != 0) {
msg_buf2[strlen(msg_buf2)-1] = '\n'; // Make sure we have a newline char at the end.
}
- (void) nsk_printf("The following fake exception stacktrace is for failuire analysis. \n");
+ (void) nsk_printf("The following fake exception stacktrace is for failure analysis. \n");
(void) nsk_printf("nsk.share.Fake_Exception_for_RULE_Creation: ");
if (file != NULL) {
(void) nsk_printf("(%s:%d) ", file_basename(file), line);
diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/except/except011.java b/test/hotspot/jtreg/vmTestbase/nsk/stress/except/except011.java
index bbcf78cfd79..f52564f4612 100644
--- a/test/hotspot/jtreg/vmTestbase/nsk/stress/except/except011.java
+++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/except/except011.java
@@ -123,7 +123,7 @@ public class except011 {
*/
private static int messages = 0;
- private static final String className = "nsk.stress.except.except011.except011oops";
+ private static final String className = "nsk.stress.except.except011oops";
/**
* Re-call to the method run(out)
(ignore args[]
),
diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack001.java b/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack001.java
index f9da23e3577..84c41014d32 100644
--- a/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack001.java
+++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack001.java
@@ -34,7 +34,7 @@
* COMMENTS
* Kestrel for Solaris_JDK_1.3-b10 crashes while trying to execute
* this test with Client HS VM.
- * See lots of bugs concerning similar failuires:
+ * See lots of bugs concerning similar failures:
* Evaluated:
* 4217960 [native stack overflow bug] reflection test causes crash
* Accepted:
diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SurrogatesTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SurrogatesTest.java
index e0dc44bf9bc..4af0c3df23a 100644
--- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SurrogatesTest.java
+++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SurrogatesTest.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt
index 53542e70450..8f5efd60398 100644
--- a/test/jdk/ProblemList.txt
+++ b/test/jdk/ProblemList.txt
@@ -878,14 +878,6 @@ javax/rmi/ssl/SSLSocketParametersTest.sh 8162906 generic-
############################################################################
-###########################################################################
-#
-# Java EE Module Removal
-#
-com/sun/jdi/RedefineCrossEvent.java 8194308 generic-all Java EE Module Removal
-
-############################################################################
-
# jdk_jfr
jdk/jfr/event/io/TestInstrumentation.java 8202142 generic-all
diff --git a/test/jdk/com/sun/jdi/RedefineCrossEvent.java b/test/jdk/com/sun/jdi/RedefineCrossEvent.java
index c61dd3cb92f..f1dded0b42e 100644
--- a/test/jdk/com/sun/jdi/RedefineCrossEvent.java
+++ b/test/jdk/com/sun/jdi/RedefineCrossEvent.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2018, 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
@@ -27,9 +27,6 @@
* @summary Test class redefinition at each event cross tested with other tests
* @author Robert Field
*
- * @modules java.corba
- * jdk.jdi
- *
* @run build TestScaffold VMConnection TargetAdapter TargetListener
* @run compile -g AccessSpecifierTest.java
* @run compile -g AfterThreadDeathTest.java
diff --git a/test/jdk/com/sun/jdi/SetLocalWhileThreadInNative.java b/test/jdk/com/sun/jdi/SetLocalWhileThreadInNative.java
new file mode 100644
index 00000000000..32dbc382004
--- /dev/null
+++ b/test/jdk/com/sun/jdi/SetLocalWhileThreadInNative.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2018 SAP SE. 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 8212928
+ * @summary With NeedsDeoptSuspend == true the assertion in compiledVFrame::update_deferred_value() fails, because the frame is not deoptimized.
+ * @author Richard Reingruber richard DOT reingruber AT sap DOT com
+ *
+ * @library /test/lib
+ *
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run main jdk.test.lib.FileInstaller compilerDirectives.json compilerDirectives.json
+ * @run compile -g SetLocalWhileThreadInNative.java
+ * @run driver SetLocalWhileThreadInNative -Xbatch -XX:-TieredCompilation -XX:CICompilerCount=1 -XX:+UnlockDiagnosticVMOptions -XX:CompilerDirectivesFile=compilerDirectives.json -XX:+PrintCompilation -XX:+PrintInlining
+ */
+
+import java.io.FileDescriptor;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.List;
+
+import com.sun.jdi.*;
+import com.sun.jdi.event.*;
+
+import jdk.test.lib.Asserts;
+
+/********** target program **********/
+
+class SetLocalWhileThreadInNativeTarget {
+
+ public static final String name = SetLocalWhileThreadInNativeTarget.class.getName();
+ public static FileInputStream fis;
+ public static int count;
+ public static int bytesRead;
+
+
+ // Let D (debugger) be a JVMTI agent that updates a local of a compiled frame F owned by
+ // thread T. In this test F corresponds to dontinline_testMethod.
+ //
+ // Issue: The VM thread executes an VM op on behalf of D to set the local in F. Doing so it
+ // requests the deoptimization of F and then calls compiledVFrame::update_deferred_value(),
+ // where frame::is_deoptimized_frame() returns false causing an assertion failure on SPARC where
+ // NeedsDeoptSuspend is true.
+ //
+ // Analysis: The deoptimization of F is requested, while T is in the native method
+ // java.io.FileInputStream::read0() and F is the direct caller of read0(). This is a special
+ // case with NeedsDeoptSuspend in frame::deoptimize(). Effectively the deoptimization is not
+ // done synchronously, instead T deoptimizes F at a later point upon return from the native
+ // method.
+ public static int dontinline_testMethod() {
+ int zero = 0;
+ int val = 0;
+ try {
+ val = fis.read(); // Will be inlined. Calls native method java.io.FileInputStream::read0()
+ count++;
+ } catch (IOException e) { /* ignored */ }
+ return val + zero;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(name + " is up and running.");
+ fis = new FileInputStream(FileDescriptor.in);
+ bytesRead=0;
+ while (true) {
+ int val = dontinline_testMethod();
+ if (val == SetLocalWhileThreadInNative.STOP) {
+ System.out.println("Debuggee: received STOP message");
+ System.exit(0);
+ }
+ bytesRead++;
+ if ((bytesRead & ((1L << 14)-1)) == 0) {
+ System.out.println("Called test method " + bytesRead + " times");
+ }
+ }
+ }
+}
+
+ /********** test program **********/
+
+public class SetLocalWhileThreadInNative extends TestScaffold {
+ public static final int MESSAGE_COUNT = 10000;
+ public static final String MESSAGE = "0123456789";
+ public static final int MESSAGE_SIZE = MESSAGE.length();
+ public static final int TOTAL_BYTES = MESSAGE_COUNT * MESSAGE_SIZE;
+ public static final int STOP = 255;
+
+ ReferenceType mainClass;
+ ThreadReference mainThread;
+
+ SetLocalWhileThreadInNative (String args[]) {
+ super(args);
+ }
+
+ public static void main(String[] args)
+ throws Exception
+ {
+ new SetLocalWhileThreadInNative (args).startTests();
+ }
+
+ /********** test core **********/
+
+ protected void runTests()
+ throws Exception
+ {
+ String targetProgName = SetLocalWhileThreadInNativeTarget.class.getName();
+ String testName = getClass().getSimpleName();
+
+ // Start debuggee and obtain reference to main thread an main class
+ BreakpointEvent bpe = startToMain(targetProgName);
+ mainClass = bpe.location().declaringType();
+ mainThread = bpe.thread();
+
+ // Resume debuggee send some bytes
+ vm().resume();
+ OutputStream os = vm().process().getOutputStream();
+ byte[] ba = MESSAGE.getBytes();
+ for (int i = 0; i < MESSAGE_COUNT; i++) {
+ os.write(ba);
+ }
+ os.flush();
+
+ // Wait for the debugee to read all the bytes.
+ int bytesRead = 0;
+ Field bytesReadField = mainClass.fieldByName("bytesRead");
+ do {
+ bytesRead = ((PrimitiveValue)mainClass.getValue(bytesReadField)).intValue();
+ System.out.println("debugee has read " + bytesRead + " of " + TOTAL_BYTES);
+ Thread.sleep(500);
+ } while (bytesRead < TOTAL_BYTES);
+
+ // By now dontinline_testMethod() will be compiled. The debugee will be blocked in java.io.FileInputStream::read0().
+ // Now set local variable in dontinline_testMethod().
+ vm().suspend();
+ System.out.println("Debuggee Stack:");
+ List stack_frames = mainThread.frames();
+ int i = 0;
+ for (StackFrame ff : stack_frames) {
+ System.out.println("frame[" + i++ +"]: " + ff.location().method());
+ }
+ StackFrame frame = mainThread.frame(2);
+ Asserts.assertEQ(frame.location().method().toString(), "SetLocalWhileThreadInNativeTarget.dontinline_testMethod()");
+ List localVars = frame.visibleVariables();
+ boolean changedLocal = false;
+ for (LocalVariable lv : localVars) {
+ if (lv.name().equals("zero")) {
+ frame.setValue(lv, vm().mirrorOf(0)); // triggers deoptimization!
+ changedLocal = true;
+ }
+ }
+ Asserts.assertTrue(changedLocal);
+
+ // signal stop
+ os.write(STOP);
+ os.flush();
+
+
+ // resume the target listening for events
+ listenUntilVMDisconnect();
+
+
+ // deal with results of test if anything has called failure("foo")
+ // testFailed will be true
+ if (!testFailed) {
+ println(testName + ": passed");
+ } else {
+ throw new Exception(testName + ": failed");
+ }
+ }
+}
diff --git a/test/jdk/com/sun/jdi/TestScaffold.java b/test/jdk/com/sun/jdi/TestScaffold.java
index 2561c5b5ba6..fc7749cd7cb 100644
--- a/test/jdk/com/sun/jdi/TestScaffold.java
+++ b/test/jdk/com/sun/jdi/TestScaffold.java
@@ -542,7 +542,9 @@ abstract public class TestScaffold extends TargetAdapter {
redefine(mainStartClass);
}
} else {
- redefine(rt);
+ if (!name.startsWith("jdk.")) {
+ redefine(rt);
+ }
}
}
}
diff --git a/test/hotspot/jtreg/sanity/ExecuteInternalVMTests.java b/test/jdk/com/sun/jdi/compilerDirectives.json
similarity index 54%
rename from test/hotspot/jtreg/sanity/ExecuteInternalVMTests.java
rename to test/jdk/com/sun/jdi/compilerDirectives.json
index a672b9cdc4f..c4c58613274 100644
--- a/test/hotspot/jtreg/sanity/ExecuteInternalVMTests.java
+++ b/test/jdk/com/sun/jdi/compilerDirectives.json
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018 SAP SE. 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,19 +21,20 @@
* questions.
*/
-/* @test ExecuteInternalVMTests
- * @bug 8004691
- * @summary Add a jtreg test that exercises the ExecuteInternalVMTests flag
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+ExecuteInternalVMTests ExecuteInternalVMTests
- */
-public class ExecuteInternalVMTests {
- public static void main(String[] args) throws Exception {
- // The tests that are run are the HotSpot internal tests which are
- // executed only when the flag -XX:+ExecuteInternalVMTests is used.
+[
+ {
+ match: "*.*",
+
+ c1: {
+ // control inlining of method
+ // + force inline, - dont inline
+ inline : "-*.dontinline_*",
+ },
- // The flag -XX:+ExecuteInternalVMTests can only be used for
- // non-product builds of HotSpot. Therefore, the flag
- // -XX:+IgnoreUnrecognizedVMOptions is also used, which means that this
- // test will do nothing on a product build.
- }
-}
+ c2: {
+ // control inlining of method
+ // + force inline, - dont inline
+ inline : "-*.dontinline_*",
+ }
+ },
+]
diff --git a/test/jdk/java/io/Serializable/serialFilter/CheckArrayTest.java b/test/jdk/java/io/Serializable/serialFilter/CheckArrayTest.java
index a58b9644238..d00c670bd15 100644
--- a/test/jdk/java/io/Serializable/serialFilter/CheckArrayTest.java
+++ b/test/jdk/java/io/Serializable/serialFilter/CheckArrayTest.java
@@ -28,11 +28,8 @@ import java.io.ObjectInputFilter;
import java.io.ObjectInputStream;
import java.io.InvalidClassException;
-import java.util.Hashtable;
+import jdk.internal.access.SharedSecrets;
-import jdk.internal.misc.SharedSecrets;
-
-import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.testng.Assert;
@@ -40,7 +37,7 @@ import org.testng.Assert;
/* @test
* @build CheckArrayTest SerialFilterTest
* @bug 8203368
- * @modules java.base/jdk.internal.misc
+ * @modules java.base/jdk.internal.access
* @run testng CheckArrayTest
*
* @summary Test the SharedSecret access to ObjectInputStream.checkArray works
diff --git a/test/jdk/java/lang/Class/GenericStringTest.java b/test/jdk/java/lang/Class/GenericStringTest.java
index bb002591c32..f117a44b446 100644
--- a/test/jdk/java/lang/Class/GenericStringTest.java
+++ b/test/jdk/java/lang/Class/GenericStringTest.java
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6298888 6992705 8161500
+ * @bug 6298888 6992705 8161500 6304578
* @summary Check Class.toGenericString()
* @author Joseph D. Darcy
*/
@@ -43,12 +43,20 @@ public class GenericStringTest {
String[][] nested = {{""}};
int[][] intArray = {{1}};
- failures += checkToGenericString(int.class, "int");
- failures += checkToGenericString(void.class, "void");
- failures += checkToGenericString(args.getClass(), "java.lang.String[]");
- failures += checkToGenericString(nested.getClass(), "java.lang.String[][]");
- failures += checkToGenericString(intArray.getClass(), "int[][]");
- failures += checkToGenericString(java.util.Map.class, "public abstract interface java.util.Map");
+ Map, String> testCases =
+ Map.of(int.class, "int",
+ void.class, "void",
+ args.getClass(), "java.lang.String[]",
+ nested.getClass(), "java.lang.String[][]",
+ intArray.getClass(), "int[][]",
+ java.lang.Enum.class, "public abstract class java.lang.Enum>",
+ java.util.Map.class, "public abstract interface java.util.Map",
+ java.util.EnumMap.class, "public class java.util.EnumMap,V>",
+ java.util.EventListenerProxy.class, "public abstract class java.util.EventListenerProxy");
+
+ for (Map.Entry, String> testCase : testCases.entrySet()) {
+ failures += checkToGenericString(testCase.getKey(), testCase.getValue());
+ }
Field f = GenericStringTest.class.getDeclaredField("mixed");
// The expected value includes "" rather than
@@ -74,7 +82,7 @@ public class GenericStringTest {
private static int checkToGenericString(Class> clazz, String expected) {
String genericString = clazz.toGenericString();
if (!genericString.equals(expected)) {
- System.err.printf("Unexpected Class.toGenericString output; expected '%s', got '%s'.%n",
+ System.err.printf("Unexpected Class.toGenericString output; expected %n\t'%s',%n got %n\t'%s'.%n",
expected,
genericString);
return 1;
diff --git a/test/jdk/java/lang/ModuleLayer/BasicLayerTest.java b/test/jdk/java/lang/ModuleLayer/BasicLayerTest.java
index e697b285ef9..7d7634a02fa 100644
--- a/test/jdk/java/lang/ModuleLayer/BasicLayerTest.java
+++ b/test/jdk/java/lang/ModuleLayer/BasicLayerTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -24,7 +24,7 @@
/**
* @test
* @library /test/lib
- * @modules java.base/jdk.internal.misc
+ * @modules java.base/jdk.internal.access
* @build BasicLayerTest
* jdk.test.lib.util.ModuleUtils
* @compile layertest/Test.java
@@ -38,13 +38,12 @@ import java.lang.module.ModuleDescriptor.Requires;
import java.lang.module.ModuleFinder;
import java.util.HashMap;
import java.util.Map;
-import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import jdk.test.lib.util.ModuleUtils;
-import jdk.internal.misc.SharedSecrets;
+import jdk.internal.access.SharedSecrets;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
diff --git a/test/jdk/java/lang/ProcessBuilder/Basic.java b/test/jdk/java/lang/ProcessBuilder/Basic.java
index b402b24629a..1a835bb7fa9 100644
--- a/test/jdk/java/lang/ProcessBuilder/Basic.java
+++ b/test/jdk/java/lang/ProcessBuilder/Basic.java
@@ -36,6 +36,13 @@
* @author Martin Buchholz
*/
+/*
+ * @test
+ * @modules java.base/java.lang:open
+ * @requires (os.family == "linux")
+ * @run main/othervm/timeout=300 -Djdk.lang.Process.launchMechanism=posix_spawn Basic
+ */
+
import java.lang.ProcessBuilder.Redirect;
import java.lang.ProcessHandle;
import static java.lang.ProcessBuilder.Redirect.*;
diff --git a/test/jdk/java/lang/StackWalker/VerifyStackTrace.java b/test/jdk/java/lang/StackWalker/VerifyStackTrace.java
index 3cac56b6aba..1cc6f349d8b 100644
--- a/test/jdk/java/lang/StackWalker/VerifyStackTrace.java
+++ b/test/jdk/java/lang/StackWalker/VerifyStackTrace.java
@@ -71,7 +71,7 @@ public class VerifyStackTrace {
"3: VerifyStackTrace$Handle.run(VerifyStackTrace.java:158)\n" +
"4: VerifyStackTrace.invoke(VerifyStackTrace.java:188)\n" +
"5: VerifyStackTrace$1.run(VerifyStackTrace.java:218)\n" +
- "6: java.base/java.security.AccessController.doPrivileged(Native Method)\n" +
+ "6: java.base/java.security.AccessController.doPrivileged(AccessController.java:310)\n" +
"7: VerifyStackTrace.test(VerifyStackTrace.java:227)\n" +
"8: VerifyStackTrace.main(VerifyStackTrace.java:182)\n";
@@ -105,7 +105,7 @@ public class VerifyStackTrace {
"7: java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n" +
"8: java.base/java.lang.reflect.Method.invoke(Method.java:520)\n" +
"9: VerifyStackTrace$1.run(VerifyStackTrace.java:220)\n" +
- "10: java.base/java.security.AccessController.doPrivileged(Native Method)\n" +
+ "10: java.base/java.security.AccessController.doPrivileged(AccessController.java:310)\n" +
"11: VerifyStackTrace.test(VerifyStackTrace.java:229)\n" +
"12: VerifyStackTrace.main(VerifyStackTrace.java:185)\n";
@@ -142,9 +142,10 @@ public class VerifyStackTrace {
"10: java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n" +
"11: java.base/java.lang.reflect.Method.invoke(Method.java:520)\n" +
"12: VerifyStackTrace$1.run(VerifyStackTrace.java:222)\n" +
- "13: java.base/java.security.AccessController.doPrivileged(Native Method)\n" +
- "14: VerifyStackTrace.test(VerifyStackTrace.java:231)\n" +
- "15: VerifyStackTrace.main(VerifyStackTrace.java:188)\n";
+ "13: java.base/java.security.AccessController.executePrivileged(AccessController.java:759)\n" +
+ "14: java.base/java.security.AccessController.doPrivileged(AccessController.java:310)\n" +
+ "15: VerifyStackTrace.test(VerifyStackTrace.java:231)\n" +
+ "16: VerifyStackTrace.main(VerifyStackTrace.java:188)\n";
@Override public StackWalker walker() { return walker;}
@Override public String description() { return description;}
diff --git a/test/jdk/java/lang/System/LoggerFinder/internal/SystemLoggerInPlatformLoader/SystemLoggerInPlatformLoader.java b/test/jdk/java/lang/System/LoggerFinder/internal/SystemLoggerInPlatformLoader/SystemLoggerInPlatformLoader.java
index f391e65e293..5d2cec876a1 100644
--- a/test/jdk/java/lang/System/LoggerFinder/internal/SystemLoggerInPlatformLoader/SystemLoggerInPlatformLoader.java
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/SystemLoggerInPlatformLoader/SystemLoggerInPlatformLoader.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/lang/System/LoggerFinder/internal/SystemLoggerInPlatformLoader/systempkg/log/SystemLoggerAccessor.java b/test/jdk/java/lang/System/LoggerFinder/internal/SystemLoggerInPlatformLoader/systempkg/log/SystemLoggerAccessor.java
index 8defec1a205..35c2ad761e1 100644
--- a/test/jdk/java/lang/System/LoggerFinder/internal/SystemLoggerInPlatformLoader/systempkg/log/SystemLoggerAccessor.java
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/SystemLoggerInPlatformLoader/systempkg/log/SystemLoggerAccessor.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/lang/System/LoggerFinder/modules/Base.java b/test/jdk/java/lang/System/LoggerFinder/modules/Base.java
index 80206bffb5b..5befbd62789 100644
--- a/test/jdk/java/lang/System/LoggerFinder/modules/Base.java
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/Base.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/lang/System/LoggerFinder/modules/JDKLoggerForImageTest.java b/test/jdk/java/lang/System/LoggerFinder/modules/JDKLoggerForImageTest.java
index 9588e46131f..b155ba994a6 100644
--- a/test/jdk/java/lang/System/LoggerFinder/modules/JDKLoggerForImageTest.java
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/JDKLoggerForImageTest.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/lang/System/LoggerFinder/modules/JDKLoggerForJDKTest.java b/test/jdk/java/lang/System/LoggerFinder/modules/JDKLoggerForJDKTest.java
index 6a0543eca9e..68bc6fd839b 100644
--- a/test/jdk/java/lang/System/LoggerFinder/modules/JDKLoggerForJDKTest.java
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/JDKLoggerForJDKTest.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/lang/System/LoggerFinder/modules/LoggerInImageTest.java b/test/jdk/java/lang/System/LoggerFinder/modules/LoggerInImageTest.java
index 1a617e33395..d3c3ace5a65 100644
--- a/test/jdk/java/lang/System/LoggerFinder/modules/LoggerInImageTest.java
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/LoggerInImageTest.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/lang/System/LoggerFinder/modules/NamedLoggerForImageTest.java b/test/jdk/java/lang/System/LoggerFinder/modules/NamedLoggerForImageTest.java
index ff0b15abdb5..2e621597935 100644
--- a/test/jdk/java/lang/System/LoggerFinder/modules/NamedLoggerForImageTest.java
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/NamedLoggerForImageTest.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/lang/System/LoggerFinder/modules/NamedLoggerForJDKTest.java b/test/jdk/java/lang/System/LoggerFinder/modules/NamedLoggerForJDKTest.java
index 46facf7e7cb..6abf98c5227 100644
--- a/test/jdk/java/lang/System/LoggerFinder/modules/NamedLoggerForJDKTest.java
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/NamedLoggerForJDKTest.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/lang/System/LoggerFinder/modules/UnnamedLoggerForImageTest.java b/test/jdk/java/lang/System/LoggerFinder/modules/UnnamedLoggerForImageTest.java
index a1ea6bb8eba..038c96697cb 100644
--- a/test/jdk/java/lang/System/LoggerFinder/modules/UnnamedLoggerForImageTest.java
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/UnnamedLoggerForImageTest.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/lang/System/LoggerFinder/modules/UnnamedLoggerForJDKTest.java b/test/jdk/java/lang/System/LoggerFinder/modules/UnnamedLoggerForJDKTest.java
index ee93b560365..b239483b0b7 100644
--- a/test/jdk/java/lang/System/LoggerFinder/modules/UnnamedLoggerForJDKTest.java
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/UnnamedLoggerForJDKTest.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/lang/System/LoggerFinder/modules/boot_client/BootClient.java b/test/jdk/java/lang/System/LoggerFinder/modules/boot_client/BootClient.java
index b4cc85f4dfa..dde084bb2de 100644
--- a/test/jdk/java/lang/System/LoggerFinder/modules/boot_client/BootClient.java
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/boot_client/BootClient.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/lang/System/LoggerFinder/modules/boot_usage/BootUsage.java b/test/jdk/java/lang/System/LoggerFinder/modules/boot_usage/BootUsage.java
index c526cd9e9e9..4aa55948f5a 100644
--- a/test/jdk/java/lang/System/LoggerFinder/modules/boot_usage/BootUsage.java
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/boot_usage/BootUsage.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/lang/System/LoggerFinder/modules/named_client/m.t.a/module-info.java b/test/jdk/java/lang/System/LoggerFinder/modules/named_client/m.t.a/module-info.java
index 2e87616f268..4a6e6130482 100644
--- a/test/jdk/java/lang/System/LoggerFinder/modules/named_client/m.t.a/module-info.java
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/named_client/m.t.a/module-info.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/lang/System/LoggerFinder/modules/named_client/m.t.a/pkg/a/t/TestA.java b/test/jdk/java/lang/System/LoggerFinder/modules/named_client/m.t.a/pkg/a/t/TestA.java
index 4e6e0d7b9c9..4937f6fcdb7 100644
--- a/test/jdk/java/lang/System/LoggerFinder/modules/named_client/m.t.a/pkg/a/t/TestA.java
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/named_client/m.t.a/pkg/a/t/TestA.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/lang/System/LoggerFinder/modules/named_logger/m.l.a/module-info.java b/test/jdk/java/lang/System/LoggerFinder/modules/named_logger/m.l.a/module-info.java
index bd4a54c4647..3258b7634bc 100644
--- a/test/jdk/java/lang/System/LoggerFinder/modules/named_logger/m.l.a/module-info.java
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/named_logger/m.l.a/module-info.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/lang/System/LoggerFinder/modules/named_logger/m.l.a/pkg/a/l/LoggerA.java b/test/jdk/java/lang/System/LoggerFinder/modules/named_logger/m.l.a/pkg/a/l/LoggerA.java
index 8ab0f5318fa..6dbb458be66 100644
--- a/test/jdk/java/lang/System/LoggerFinder/modules/named_logger/m.l.a/pkg/a/l/LoggerA.java
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/named_logger/m.l.a/pkg/a/l/LoggerA.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/lang/System/LoggerFinder/modules/named_logger/m.l.a/pkg/a/p/LoggerFinderA.java b/test/jdk/java/lang/System/LoggerFinder/modules/named_logger/m.l.a/pkg/a/p/LoggerFinderA.java
index ddb3637f410..729be170eef 100644
--- a/test/jdk/java/lang/System/LoggerFinder/modules/named_logger/m.l.a/pkg/a/p/LoggerFinderA.java
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/named_logger/m.l.a/pkg/a/p/LoggerFinderA.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/lang/System/LoggerFinder/modules/patched_client/PatchedClient.java b/test/jdk/java/lang/System/LoggerFinder/modules/patched_client/PatchedClient.java
index 922a2a8c036..b8a1a5bdf82 100644
--- a/test/jdk/java/lang/System/LoggerFinder/modules/patched_client/PatchedClient.java
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/patched_client/PatchedClient.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/lang/System/LoggerFinder/modules/patched_usage/java.base/java/lang/PatchedUsage.java b/test/jdk/java/lang/System/LoggerFinder/modules/patched_usage/java.base/java/lang/PatchedUsage.java
index 69bf3daae2d..ede55f3ab82 100644
--- a/test/jdk/java/lang/System/LoggerFinder/modules/patched_usage/java.base/java/lang/PatchedUsage.java
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/patched_usage/java.base/java/lang/PatchedUsage.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/lang/System/LoggerFinder/modules/unnamed_client/pkg/b/t/TestB.java b/test/jdk/java/lang/System/LoggerFinder/modules/unnamed_client/pkg/b/t/TestB.java
index 8e5f0a6d6ed..38737b567c7 100644
--- a/test/jdk/java/lang/System/LoggerFinder/modules/unnamed_client/pkg/b/t/TestB.java
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/unnamed_client/pkg/b/t/TestB.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/lang/System/LoggerFinder/modules/unnamed_logger/pkg/b/l/LoggerB.java b/test/jdk/java/lang/System/LoggerFinder/modules/unnamed_logger/pkg/b/l/LoggerB.java
index be299867485..e2fc7c3bb6c 100644
--- a/test/jdk/java/lang/System/LoggerFinder/modules/unnamed_logger/pkg/b/l/LoggerB.java
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/unnamed_logger/pkg/b/l/LoggerB.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/lang/System/LoggerFinder/modules/unnamed_logger/pkg/b/p/LoggerFinderB.java b/test/jdk/java/lang/System/LoggerFinder/modules/unnamed_logger/pkg/b/p/LoggerFinderB.java
index 376bb64ea1d..ef7df60805f 100644
--- a/test/jdk/java/lang/System/LoggerFinder/modules/unnamed_logger/pkg/b/p/LoggerFinderB.java
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/unnamed_logger/pkg/b/p/LoggerFinderB.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/lang/System/PropertyTest.java b/test/jdk/java/lang/System/PropertyTest.java
new file mode 100644
index 00000000000..6fbd447e0ca
--- /dev/null
+++ b/test/jdk/java/lang/System/PropertyTest.java
@@ -0,0 +1,260 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+
+import java.lang.System;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+import java.util.Properties;
+import java.util.stream.Collectors;
+
+import org.testng.Assert;
+import org.testng.IMethodInstance;
+import org.testng.IMethodInterceptor;
+import org.testng.TestListenerAdapter;
+import org.testng.TestNG;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+
+/*
+ * @test
+ * @bug 4463345 4244670 8030781
+ * @summary Simple test of System getProperty, setProperty, clearProperty,
+ * getProperties, and setProperties
+ * @run testng/othervm PropertyTest
+ */
+
+@Test
+public class PropertyTest {
+
+ @DataProvider(name = "requiredProperties")
+ static Object[][] requiredProperties() {
+ return new Object[][]{
+ {"java.version"},
+ {"java.version.date"},
+ {"java.vendor"},
+ {"java.vendor.url"},
+ {"java.home"},
+ {"java.vm.specification.version"},
+ {"java.vm.specification.vendor"},
+ {"java.vm.specification.name"},
+ {"java.vm.version"},
+ {"java.vm.vendor"},
+ {"java.vm.name"},
+ {"java.specification.version"},
+ {"java.specification.vendor"},
+ {"java.specification.name"},
+ {"java.class.version"},
+ {"java.class.path"},
+ {"java.library.path"},
+ {"java.io.tmpdir"},
+ {"os.arch"},
+ {"os.version"},
+ {"file.separator"},
+ {"path.separator"},
+ {"line.separator"},
+ {"user.name"},
+ {"user.home"},
+ {"user.dir"},
+ {"java.runtime.version"},
+ {"java.runtime.name"},
+ };
+ }
+
+ @Test
+ static void getTest() {
+ System.setProperty("blah", "blech");
+ Assert.assertEquals(System.getProperty("blah"), "blech");
+
+ try {
+ System.getProperty(null);
+ Assert.fail("Failed: expected NullPointerException");
+ } catch (NullPointerException npe) {
+ // Correct result
+ }
+ try {
+ System.getProperty("");
+ Assert.fail("Failed: expected IllegalArgumentException");
+ } catch (IllegalArgumentException iae) {
+ // Correct result
+ }
+ }
+
+ @Test
+ static void clearTest() {
+ System.setProperty("blah", "blech");
+ Assert.assertEquals(System.getProperty("blah"), "blech");
+
+ System.clearProperty("blah");
+ Assert.assertNull(System.getProperty("blah"));
+
+ try {
+ System.clearProperty(null);
+ Assert.fail("Failed: expected NullPointerException");
+ } catch (NullPointerException npe) {
+ // Correct result
+ }
+ try {
+ System.clearProperty("");
+ Assert.fail("Failed: expected IllegalArgumentException");
+ } catch (IllegalArgumentException iae) {
+ // Correct result
+ }
+ }
+
+ @Test
+ static void setTest() {
+ System.setProperty("blah", "blech");
+ Assert.assertEquals(System.getProperty("blah"), "blech");
+
+ System.setProperty("blah", "");
+ Assert.assertEquals(System.getProperty("blah"), "");
+
+ try {
+ System.setProperty(null, null);
+ Assert.fail("Failed: expected NullPointerException");
+ } catch (NullPointerException npe) {
+ // Correct result
+ }
+
+ try {
+ System.setProperty("blah", null);
+ Assert.fail("Failed: expected NullPointerException");
+ } catch (NullPointerException npe) {
+ // Correct result
+ }
+
+ try {
+ System.setProperty(null, "blech");
+ Assert.fail("Failed: expected NullPointerException");
+ } catch (NullPointerException npe) {
+ // Correct result
+ }
+
+ try {
+ System.setProperty("", "blech");
+ Assert.fail("Failed: expected IllegalArgumentException");
+ } catch (IllegalArgumentException iae) {
+ // Correct result
+ }
+ try {
+ System.setProperty("", "");
+ Assert.fail("Failed: expected IllegalArgumentException");
+ } catch (IllegalArgumentException iae) {
+ // Correct result
+ }
+ }
+
+ @Test
+ static void replaceSetProperties() {
+ Properties oldProps = System.getProperties();
+ Properties newProps = new Properties();
+ oldProps.forEach( (k,v) -> newProps.put(k,v));
+ System.setProperties(newProps);
+
+ Assert.assertSame(System.getProperties(), newProps,
+ "getProperties not the same as setProperties");
+
+ final String KEY = "blah";
+ final String VALUE = "blech";
+
+ // Set via Property instance; get via System methods
+ newProps.setProperty(KEY, VALUE);
+ Assert.assertEquals(System.getProperty(KEY), VALUE, KEY);
+
+ String s = (String)newProps.remove(KEY);
+ Assert.assertEquals(s, VALUE);
+ Assert.assertNull(System.getProperty(KEY), KEY);
+
+ // Set via System methods; Get via Property instance;
+ System.setProperty(KEY, VALUE);
+ Assert.assertEquals(newProps.getProperty(KEY), VALUE);
+
+ String t = System.clearProperty(KEY);
+ Assert.assertEquals(t, VALUE, KEY);
+ Assert.assertNull(newProps.getProperty(KEY), KEY);
+ }
+
+ @Test
+ static void setNullProperties() {
+ Properties oldProps = System.getProperties();
+ Properties savedProps = new Properties();
+ oldProps.forEach((k,v) -> {
+ if (v == null) {
+ throw new RuntimeException("null value, key: " + k);
+ }
+ savedProps.put(k,v);
+ });
+
+ // Re-initialize properties
+ System.setProperties(null);
+
+ Properties newProps = System.getProperties();
+ Object[][] propnames = requiredProperties();
+ for (Object[] p : propnames) {
+ String name = (String)p[0];
+ Assert.assertEquals(System.getProperty(name), savedProps.getProperty(name), name);
+
+ Assert.assertEquals(newProps.getProperty(name), savedProps.getProperty(name), name);
+ }
+ }
+
+ // Verify all the required properties have values from System.getProperty and
+ // System.getProperties()
+ @Test(dataProvider = "requiredProperties")
+ static void checkRequiredProperties(String name) {
+ Assert.assertNotNull(System.getProperty(name), name);
+
+ Properties props = System.getProperties();
+ Assert.assertNotNull(props.getProperty(name), name);
+ }
+
+ @SuppressWarnings("raw_types")
+ @Test(enabled=false)
+ public static void main(String[] args) {
+ TestListenerAdapter tla = new TestListenerAdapter();
+
+ Class>[] testclass = {PropertyTest.class};
+ TestNG testng = new TestNG();
+ testng.setTestClasses(testclass);
+ testng.addListener(tla);
+ if (args.length > 0) {
+ IMethodInterceptor intercept = (m, c) -> {
+ List x = m.stream()
+ .filter(m1 -> m1.getMethod().getMethodName().contains(args[0]))
+ .collect(Collectors.toList());
+ return x;
+ };
+ testng.setMethodInterceptor(intercept);
+ }
+ testng.run();
+ tla.getPassedTests()
+ .stream().forEach(t -> System.out.printf("Passed: %s%s%n", t.getName(),
+ List.of(t.getParameters())));
+ tla.getFailedTests()
+ .stream().forEach(t -> System.out.printf("Failed: %s%s%n", t.getName(),
+ List.of(t.getParameters())));
+ }
+}
diff --git a/test/jdk/java/lang/module/ConfigurationTest.java b/test/jdk/java/lang/module/ConfigurationTest.java
index e1264acdd0a..8e7854770de 100644
--- a/test/jdk/java/lang/module/ConfigurationTest.java
+++ b/test/jdk/java/lang/module/ConfigurationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -24,7 +24,7 @@
/**
* @test
* @library /test/lib
- * @modules java.base/jdk.internal.misc
+ * @modules java.base/jdk.internal.access
* java.base/jdk.internal.module
* @build ConfigurationTest
* jdk.test.lib.util.ModuleUtils
@@ -45,12 +45,11 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
-import java.util.Optional;
import java.util.Set;
import jdk.test.lib.util.ModuleUtils;
-import jdk.internal.misc.SharedSecrets;
+import jdk.internal.access.SharedSecrets;
import jdk.internal.module.ModuleInfoWriter;
import jdk.internal.module.ModuleTarget;
import org.testng.annotations.DataProvider;
diff --git a/test/jdk/java/lang/module/ModuleDescriptorTest.java b/test/jdk/java/lang/module/ModuleDescriptorTest.java
index 839b51cf193..93c40ac51b6 100644
--- a/test/jdk/java/lang/module/ModuleDescriptorTest.java
+++ b/test/jdk/java/lang/module/ModuleDescriptorTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -23,8 +23,8 @@
/**
* @test
- * @modules java.base/jdk.internal.module
- * java.base/jdk.internal.misc
+ * @modules java.base/jdk.internal.access
+ * java.base/jdk.internal.module
* @run testng ModuleDescriptorTest
* @summary Basic test for java.lang.module.ModuleDescriptor and its builder
*/
@@ -49,14 +49,13 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
-import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import static java.lang.module.ModuleDescriptor.Requires.Modifier.*;
-import jdk.internal.misc.JavaLangModuleAccess;
-import jdk.internal.misc.SharedSecrets;
+import jdk.internal.access.JavaLangModuleAccess;
+import jdk.internal.access.SharedSecrets;
import jdk.internal.module.ModuleInfoWriter;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
diff --git a/test/jdk/java/lang/module/ModuleNamesTest.java b/test/jdk/java/lang/module/ModuleNamesTest.java
index afeadacec86..141f453b4f1 100644
--- a/test/jdk/java/lang/module/ModuleNamesTest.java
+++ b/test/jdk/java/lang/module/ModuleNamesTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -23,7 +23,7 @@
/**
* @test
- * @modules java.base/jdk.internal.misc
+ * @modules java.base/jdk.internal.access
* java.base/jdk.internal.module
* @run testng ModuleNamesTest
* @summary Basic test of reading a module-info.class with module names that
@@ -41,7 +41,7 @@ import java.nio.ByteBuffer;
import java.util.Optional;
import java.util.Set;
-import jdk.internal.misc.SharedSecrets;
+import jdk.internal.access.SharedSecrets;
import jdk.internal.module.ModuleInfoWriter;
import org.testng.annotations.DataProvider;
diff --git a/test/jdk/java/lang/reflect/Constructor/GenericStringTest.java b/test/jdk/java/lang/reflect/Constructor/GenericStringTest.java
index 8edef1c2883..56a781fce18 100644
--- a/test/jdk/java/lang/reflect/Constructor/GenericStringTest.java
+++ b/test/jdk/java/lang/reflect/Constructor/GenericStringTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2018, 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
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 5033583 6316717 6470106 8161500 8162539
+ * @bug 5033583 6316717 6470106 8161500 8162539 6304578
* @summary Check toGenericString() and toString() methods
* @author Joseph D. Darcy
*/
@@ -87,7 +87,13 @@ class TestClass1 {
protected TestClass1(S s, T t) throws Exception{}
@ExpectedGenericString(
- " TestClass1() throws E")
+ "protected TestClass1(V)")
+ @ExpectedString(
+ "protected TestClass1(java.lang.Number)")
+ protected TestClass1(V v){}
+
+ @ExpectedGenericString(
+ " TestClass1() throws E")
@ExpectedString(
"TestClass1() throws java.lang.Exception")
TestClass1() throws E {}
diff --git a/test/jdk/java/lang/reflect/Method/GenericStringTest.java b/test/jdk/java/lang/reflect/Method/GenericStringTest.java
index d98d6c2bc6e..a75a4e67f94 100644
--- a/test/jdk/java/lang/reflect/Method/GenericStringTest.java
+++ b/test/jdk/java/lang/reflect/Method/GenericStringTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2018, 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
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 5033583 6316717 6470106 8004979 8161500 8162539
+ * @bug 5033583 6316717 6470106 8004979 8161500 8162539 6304578
* @summary Check toGenericString() and toString() methods
* @author Joseph D. Darcy
*/
@@ -103,6 +103,10 @@ class TestClass1 {
@ExpectedGenericString(
"protected S TestClass1.method4(S,T) throws java.lang.Exception")
protected S method4(S s, T t) throws Exception {return null;}
+
+ @ExpectedGenericString(
+ "public static T TestClass1.max(java.util.Collection extends T>,java.util.Comparator super T>)")
+ public static T max(Collection extends T> coll, Comparator super T> comp) {return null;}
}
class TestClass2 {
@@ -139,6 +143,10 @@ class TestClass2 {
@ExpectedGenericString(
"public java.util.Map TestClass2.method8()")
public Map method8() {return null;}
+
+ @ExpectedGenericString(
+ "public java.util.Set TestClass2.method9(V)")
+ public Set method9(V v) {return null;}
}
class Roebling implements Comparable {
diff --git a/test/jdk/java/math/BigInteger/PrimeTest.java b/test/jdk/java/math/BigInteger/PrimeTest.java
index 74b777239ca..0024d791700 100644
--- a/test/jdk/java/math/BigInteger/PrimeTest.java
+++ b/test/jdk/java/math/BigInteger/PrimeTest.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPSetAuthenticatorTest.java b/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPSetAuthenticatorTest.java
index c916b13db43..9de7f5b531f 100644
--- a/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPSetAuthenticatorTest.java
+++ b/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPSetAuthenticatorTest.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPTest.java b/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPTest.java
index 9a6cd93dd00..b6d4f46b589 100644
--- a/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPTest.java
+++ b/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPTest.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPTestClient.java b/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPTestClient.java
index 3da0a7ae2d9..4d1f5c52a78 100644
--- a/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPTestClient.java
+++ b/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPTestClient.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPTestServer.java b/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPTestServer.java
index 1e1a77e30c1..528dd11ffbc 100644
--- a/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPTestServer.java
+++ b/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPTestServer.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/net/Inet6Address/serialize/Inet6AddressSerTest.java b/test/jdk/java/net/Inet6Address/serialize/Inet6AddressSerTest.java
index e96ba935fc7..16df725bfa7 100644
--- a/test/jdk/java/net/Inet6Address/serialize/Inet6AddressSerTest.java
+++ b/test/jdk/java/net/Inet6Address/serialize/Inet6AddressSerTest.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/net/InetAddress/getOriginalHostName.java b/test/jdk/java/net/InetAddress/getOriginalHostName.java
index bf00b61f2ec..9f1e6e965d1 100644
--- a/test/jdk/java/net/InetAddress/getOriginalHostName.java
+++ b/test/jdk/java/net/InetAddress/getOriginalHostName.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -25,14 +25,13 @@
* @test
* @bug 8133196
* @summary test functionality of getOriginalHostName(InetAddress)
- * @modules java.base/jdk.internal.misc
+ * @modules java.base/jdk.internal.access
*/
-import java.io.*;
import java.net.InetAddress;
-import jdk.internal.misc.JavaNetInetAddressAccess;
-import jdk.internal.misc.SharedSecrets;
+import jdk.internal.access.JavaNetInetAddressAccess;
+import jdk.internal.access.SharedSecrets;
public class getOriginalHostName {
diff --git a/test/jdk/java/net/MulticastSocket/NetworkInterfaceEmptyGetInetAddressesTest.java b/test/jdk/java/net/MulticastSocket/NetworkInterfaceEmptyGetInetAddressesTest.java
index 5eb3bdf51ab..2b0e4de1ac0 100644
--- a/test/jdk/java/net/MulticastSocket/NetworkInterfaceEmptyGetInetAddressesTest.java
+++ b/test/jdk/java/net/MulticastSocket/NetworkInterfaceEmptyGetInetAddressesTest.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/net/SocketImpl/ImplSupportedOptions.java b/test/jdk/java/net/SocketImpl/ImplSupportedOptions.java
new file mode 100644
index 00000000000..51d523dce82
--- /dev/null
+++ b/test/jdk/java/net/SocketImpl/ImplSupportedOptions.java
@@ -0,0 +1,189 @@
+/*
+ * Copyright (c) 2018, 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 8213418
+ * @summary Ensure correct impl supported socket options
+ * @run testng ImplSupportedOptions
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.InetAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.SocketAddress;
+import java.net.SocketException;
+import java.net.SocketImpl;
+import java.net.SocketOption;
+import java.net.StandardSocketOptions;
+import java.util.Set;
+import org.testng.annotations.Test;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+public class ImplSupportedOptions {
+
+ @Test
+ public void socketSupportedOptions() throws Exception {
+ Socket s = new Socket();
+ Set> standardOptions = s.supportedOptions();
+ assertTrue(standardOptions.contains(StandardSocketOptions.SO_LINGER),
+ "Expected SO_LINGER, in:" + standardOptions);
+ assertEquals(standardOptions, s.supportedOptions());
+ assertEquals(standardOptions, s.supportedOptions());
+
+ s = new DummySocket();
+ Set> dummyOptions = s.supportedOptions();
+ assertEquals(dummyOptions.size(), 1);
+ assertTrue(dummyOptions.contains(DummySocketImpl.SOCKET_OPT));
+ assertEquals(dummyOptions, s.supportedOptions());
+ assertEquals(dummyOptions, s.supportedOptions());
+
+ s = new Socket();
+ standardOptions = s.supportedOptions();
+ assertTrue(standardOptions.contains(StandardSocketOptions.SO_LINGER),
+ "Expected SO_LINGER, in:" + standardOptions);
+ assertEquals(standardOptions, s.supportedOptions());
+ assertEquals(standardOptions, s.supportedOptions());
+
+ s = new DummySocket();
+ dummyOptions = s.supportedOptions();
+ assertEquals(dummyOptions.size(), 1);
+ assertTrue(dummyOptions.contains(DummySocketImpl.SOCKET_OPT));
+ assertEquals(dummyOptions, s.supportedOptions());
+ assertEquals(dummyOptions, s.supportedOptions());
+ }
+
+ @Test
+ public void serverSocketSupportedOptions() throws Exception {
+ ServerSocket s = new ServerSocket();
+ Set> standardOptions = s.supportedOptions();
+ assertTrue(standardOptions.contains(StandardSocketOptions.SO_REUSEADDR),
+ "Expected SO_REUSEADDR, in:" + standardOptions);
+ assertEquals(standardOptions, s.supportedOptions());
+ assertEquals(standardOptions, s.supportedOptions());
+
+ s = new DummyServerSocket();
+ Set> dummyOptions = s.supportedOptions();
+ assertEquals(dummyOptions.size(), 1);
+ assertTrue(dummyOptions.contains(DummySocketImpl.SOCKET_OPT));
+ assertEquals(dummyOptions, s.supportedOptions());
+ assertEquals(dummyOptions, s.supportedOptions());
+
+ s = new ServerSocket();
+ standardOptions = s.supportedOptions();
+ assertTrue(standardOptions.contains(StandardSocketOptions.SO_REUSEADDR),
+ "Expected SO_REUSEADDR, in:" + standardOptions);
+ assertEquals(standardOptions, s.supportedOptions());
+ assertEquals(standardOptions, s.supportedOptions());
+
+ s = new DummyServerSocket();
+ dummyOptions = s.supportedOptions();
+ assertEquals(dummyOptions.size(), 1);
+ assertTrue(dummyOptions.contains(DummySocketImpl.SOCKET_OPT));
+ assertEquals(dummyOptions, s.supportedOptions());
+ assertEquals(dummyOptions, s.supportedOptions());
+ }
+
+ static class DummySocket extends Socket {
+ DummySocket() throws IOException {
+ super(new DummySocketImpl());
+ }
+ }
+
+ static class DummyServerSocket extends ServerSocket {
+ DummyServerSocket() throws IOException {
+ super(new DummySocketImpl());
+ }
+ }
+
+ static class DummySocketImpl extends SocketImpl {
+
+ public static final SocketOption SOCKET_OPT =
+ new ImplSocketOption<>("SOCKET_OPT", String.class);
+
+ private static class ImplSocketOption implements SocketOption {
+ private final String name;
+ private final Class type;
+ ImplSocketOption(String name, Class type) {
+ this.name = name;
+ this.type = type;
+ }
+ @Override public String name() { return name; }
+ @Override public Class type() { return type; }
+ @Override public String toString() { return name; }
+ }
+
+ private final Set> SO = Set.of(SOCKET_OPT);
+
+ @Override
+ public Set> supportedOptions() { return SO; }
+
+ // ---
+
+ @Override
+ protected void create(boolean stream) throws IOException { }
+
+ @Override
+ protected void connect(String host, int port) throws IOException { }
+
+ @Override
+ protected void connect(InetAddress address, int port) throws IOException { }
+
+ @Override
+ protected void connect(SocketAddress address, int timeout) throws IOException { }
+
+ @Override
+ protected void bind(InetAddress host, int port) throws IOException { }
+
+ @Override
+ protected void listen(int backlog) throws IOException { }
+
+ @Override
+ protected void accept(SocketImpl s) throws IOException { }
+
+ @Override
+ protected InputStream getInputStream() throws IOException { return null; }
+
+ @Override
+ protected OutputStream getOutputStream() throws IOException { return null; }
+
+ @Override
+ protected int available() throws IOException { return 0; }
+
+ @Override
+ protected void close() throws IOException { }
+
+ @Override
+ protected void sendUrgentData(int data) throws IOException { }
+
+ @Override
+ public void setOption(int optID, Object value) throws SocketException { }
+
+ @Override
+ public Object getOption(int optID) throws SocketException { return null; }
+ }
+}
diff --git a/test/jdk/java/net/URLConnection/ContentHandlers/plain.template b/test/jdk/java/net/URLConnection/ContentHandlers/plain.template
index 775b6d43dbc..0340dccb201 100644
--- a/test/jdk/java/net/URLConnection/ContentHandlers/plain.template
+++ b/test/jdk/java/net/URLConnection/ContentHandlers/plain.template
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/net/httpclient/DigestEchoServer.java b/test/jdk/java/net/httpclient/DigestEchoServer.java
index 95fefa887ec..21b90aa5065 100644
--- a/test/jdk/java/net/httpclient/DigestEchoServer.java
+++ b/test/jdk/java/net/httpclient/DigestEchoServer.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/net/httpclient/ProxyAuthTest.java b/test/jdk/java/net/httpclient/ProxyAuthTest.java
index fb16ba2e2c1..1b26166f329 100644
--- a/test/jdk/java/net/httpclient/ProxyAuthTest.java
+++ b/test/jdk/java/net/httpclient/ProxyAuthTest.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/net/httpclient/http2/server/Queue.java b/test/jdk/java/net/httpclient/http2/server/Queue.java
index b663643f08a..66b931b4b7c 100644
--- a/test/jdk/java/net/httpclient/http2/server/Queue.java
+++ b/test/jdk/java/net/httpclient/http2/server/Queue.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/nio/channels/SelectionKey/AtomicUpdates.java b/test/jdk/java/nio/channels/SelectionKey/AtomicUpdates.java
index aa986c1d976..8e5bee51b71 100644
--- a/test/jdk/java/nio/channels/SelectionKey/AtomicUpdates.java
+++ b/test/jdk/java/nio/channels/SelectionKey/AtomicUpdates.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/nio/channels/SocketChannel/AsyncCloseChannel.java b/test/jdk/java/nio/channels/SocketChannel/AsyncCloseChannel.java
index 4f62466ec23..a087d45b17d 100644
--- a/test/jdk/java/nio/channels/SocketChannel/AsyncCloseChannel.java
+++ b/test/jdk/java/nio/channels/SocketChannel/AsyncCloseChannel.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2018, 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
@@ -24,13 +24,16 @@
/* @test
* @bug 6285901 6501089
* @summary Check no data is written to wrong socket channel during async closing.
- * @author Xueming Shen
+ * @run main/othervm AsyncCloseChannel
*/
-import java.io.*;
-import java.nio.*;
-import java.nio.channels.*;
-import java.net.*;
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.nio.ByteBuffer;
+import java.nio.channels.ClosedChannelException;
+import java.nio.channels.SocketChannel;
public class AsyncCloseChannel {
static volatile boolean failed = false;
diff --git a/test/jdk/java/nio/file/Files/Mismatch.java b/test/jdk/java/nio/file/Files/Mismatch.java
new file mode 100644
index 00000000000..8746f448ad0
--- /dev/null
+++ b/test/jdk/java/nio/file/Files/Mismatch.java
@@ -0,0 +1,414 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.FileSystem;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.spi.FileSystemProvider;
+import java.util.Map;
+
+import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
+
+/* @test
+ * @bug 8202285
+ * @build Mismatch
+ * @run testng Mismatch
+ * @summary Unit test for the Files.mismatch method.
+ */
+public class Mismatch {
+ // the standard buffer size
+ final static int BUFFER_SIZE = 8192;
+
+ private static final int MISMATCH_NO = -1;
+
+ // Map to be used for creating a ZIP archive
+ private static final Map ZIPFS_MAP = Map.of("create", "true");
+
+ // temporary test directory where all test files will be created
+ Path testDir;
+
+ @BeforeClass
+ void setup() throws IOException {
+ testDir = Files.createTempDirectory("testMismatch");
+ }
+
+ @AfterClass
+ void cleanup() throws IOException {
+ // clean up files created under the test directory
+ Files.walk(testDir).map(Path::toFile).forEach(File::delete);
+ Files.deleteIfExists(testDir);
+ }
+
+ /*
+ * DataProvider for mismatch test. Provides the following fields:
+ * path1 -- the path to a file
+ * path2 -- the path to another file
+ * expected -- expected result of the mismatch method
+ * note -- a note about the test
+ */
+ @DataProvider(name = "testMismatch")
+ public Object[][] getDataForMismatch() throws IOException {
+ // an non-existent file
+ Path foo = Paths.get("nonexistentfile");
+
+ /**
+ * File path naming convention:
+ * "test" + file size + [abm] [+ position of a modified char] + [ab]
+ * where:
+ * a or b -- is used to differentiate two files of the same size.
+ * m -- indicates the file is modified at the position specified after it
+ */
+
+ // create empty files
+ int size = 0;
+ Path test0a = createASCIIFile(testDir, "test0a", 0, -1, ' ');
+ Path test0b = createASCIIFile(testDir, "test0b", 0, -1, ' ');
+
+ /**
+ * Since the Impl uses a standard buffer of 8192, the test files are created
+ * with sizes <= and > 8192, either multiples of the buffer size, or random.
+ * The files are then altered at the begining (0), end (size), and a random
+ * position.
+ */
+ size = 147;
+ Path test147a = createASCIIFile(testDir, "test147a", size, -1, ' ');
+ Path test147b = createASCIIFile(testDir, "test147b", size, -1, ' ');
+ Path test147m0 = createASCIIFile(testDir, "test147m0", size, 0, '!');
+ Path test147m70 = createASCIIFile(testDir, "test147m70", size, 70, '@');
+ Path test147m146 = createASCIIFile(testDir, "test147m146", size, size - 1, '$');
+
+ size = 1024;
+ Path test1024a = createASCIIFile(testDir, "test1024a", size, -1, ' ');
+ Path test1024b = createASCIIFile(testDir, "test1024b", size, -1, ' ');
+ Path test1024m512 = createASCIIFile(testDir, "test1024m512", size, size >> 1, '@');
+ Path test1024m1023 = createASCIIFile(testDir, "test1024m1023", size, size - 1, '$');
+
+ size = BUFFER_SIZE;
+ Path test8192a = createASCIIFile(testDir, "test8192a", size, -1, ' ');
+ Path test8192b = createASCIIFile(testDir, "test8192b", size, -1, ' ');
+ Path test8192m4096 = createASCIIFile(testDir, "test8192m4096", size, size >> 1, '%');
+ Path test8192m8191 = createASCIIFile(testDir, "test8192m8191", size, size - 1, '$');
+
+
+ // create files with size several times > BUFFER_SIZE to be used for tests that verify
+ // the situations where they are read into full buffers a few times
+ size = BUFFER_SIZE << 3;
+ Path test65536a = createASCIIFile(testDir, "test65536a", size, -1, ' ');
+ Path test65536b = createASCIIFile(testDir, "test65536b", size, -1, ' ');
+ Path test65536m0 = createASCIIFile(testDir, "test65536m0", size, 0, '!');
+ Path test65536m32768 = createASCIIFile(testDir, "test65536m32768", size, size >> 1, '%');
+ Path test65536m65535 = createASCIIFile(testDir, "test65536m65535", size, size - 1, '$');
+
+ // create files with sizes that will be iterated several times with full buffers, and
+ // then a partial one at the last
+ size = 70025;
+ Path test70025a = createASCIIFile(testDir, "test70025a", size, -1, ' ');
+ Path test70025b = createASCIIFile(testDir, "test70025b", size, -1, ' ');
+ Path test70025m8400 = createASCIIFile(testDir, "test70025m8400", size, 8400, '@');
+ Path test70025m35000 = createASCIIFile(testDir, "test70025m35000", size, 35000, '%');
+ Path test70025m70024 = createASCIIFile(testDir, "test70025m70024", size, 70024, '$');
+
+ // create larger files with >= 1048576. The mismatching will be similar. These are just
+ // tests to exercise the process with larger files
+ size = 1048576;
+ Path test1048576a = createASCIIFile(testDir, "test1048576a", size, -1, ' ');
+
+ size = 1065000;
+ Path test1065000m532500 = createASCIIFile(testDir, "test1065000m532500", size, size >> 1, '%');
+ Path test1065000m1064999 = createASCIIFile(testDir, "test1065000m1064999", size, 1064999, '$');
+
+ return new Object[][]{
+ // Spec Case 1: the two paths locate the same file , even if one does not exist
+ {foo, foo, MISMATCH_NO, "Same file, no mismatch"},
+ {test1024a, test1024a, MISMATCH_NO, "Same file, no mismatch"},
+
+ // Spec Case 2: The two files are the same size, and every byte in the first file
+ // is identical to the corresponding byte in the second file.
+ {test0a, test0b, MISMATCH_NO, "Sizes == 0, no mismatch"},
+ {test147a, test147b, MISMATCH_NO, "size = 147 < buffer = 8192, no mismatch"},
+ {test1024a, test1024b, MISMATCH_NO, "size = 1024 < buffer = 8192, no mismatch"},
+ {test8192a, test8192b, MISMATCH_NO, "size = 8192 = buffer = 8192, no mismatch"},
+ {test65536a, test65536b, MISMATCH_NO, "read 8 * full buffer, no mismatch"},
+ {test70025a, test70025b, MISMATCH_NO, "read 8 * full buffer plus a partial buffer, no mismatch"},
+
+
+ /**
+ * Spec Case 3: the value returned is the position of the first mismatched byte
+ * Impl: the impl uses a buffer 8192. The testcases below covers a range of files
+ * with sizes <= and > the buffer size. The last buffer is either full or partially full.
+ */
+
+ // edge case, one of the file sizes is zero
+ // also covers Spec Case 4 and 6
+ {test147a, test147m0, 0, "mismatch = 0 (at the beginning)"},
+ {test65536m0, test65536a, 0, "mismatch = 0 (at the beginning)"},
+
+ /**
+ * Compares files of equal sizes
+ */
+ // small files
+ {test147a, test147m70, 70, "read one partial buffer, mismatch = 70"},
+ {test147a, test147m146, 146, "read one partial buffer, mismatch = 146 (end)"},
+ {test1024a, test1024m512, 512, "read one partial buffer, mismatch = 512"},
+ {test1024a, test1024m1023, 1023, "read one partial buffer, mismatch = 1023 (end)"},
+
+ // file size >= Impl's Buffer Size
+ {test8192a, test8192m4096, 4096, "read one buffer, mismatch = 4096 "},
+ {test8192a, test8192m8191, 8191, "read one buffer, mismatch = 8191 (at the end)"},
+
+ // file size = n * Impl's Buffer Size
+ {test65536a, test65536m32768, 32768, "read through half of the file, mismatch = 32768"},
+ {test65536a, test65536m65535, 65535, "read through the whole file, mismatch = 65535 (at the end)"},
+
+ // file size = n * Impl's Buffer Size + x
+ {test70025a, test70025m8400, 8400, "mismatch in the 2nd buffer, mismatch = 8400"},
+ {test70025a, test70025m35000, 35000, "read about half of the file, mismatch = 35000"},
+ {test70025a, test70025m70024, 70024, "read through the whole file, mismatch = 70024 (at the end)"},
+
+ /**
+ * Compares files of unequal sizes
+ */
+ {test8192m8191, test70025m35000, 8191, "mismatch at the end of the 1st file/buffer, mismatch = 8191"},
+ {test65536m32768, test70025m8400, 8400, "mismatch in the 2nd buffer, mismatch = 8400"},
+ {test70025m70024, test1065000m532500, 70024, "mismatch at the end of the 1st file, mismatch = 70024"},
+
+ /**
+ * Spec Case 4: returns the size of the smaller file (in bytes) when the files are
+ * different sizes and every byte of the smaller file is identical to the corresponding
+ * byte of the larger file.
+ * Impl: similar to case 3, covers a range of file sizes
+ */
+ {test147a, test1024a, 147, "mismatch is the length of the smaller file: 147"},
+ {test1024a, test8192a, 1024, "mismatch is the length of the smaller file: 1024"},
+ {test1024a, test65536a, 1024, "mismatch is the length of the smaller file: 1024"},
+ {test8192a, test65536a, 8192, "mismatch is the length of the smaller file: 8192"},
+ {test70025a, test65536a, 65536, "mismatch is the length of the smaller file: 65536"},
+ {test1048576a, test1065000m1064999, 1048576, "mismatch is the length of the smaller file: 1048576"},
+
+ // Spec Case 5: This method is always reflexive (for Path f , mismatch(f,f) returns -1L)
+ // See tests for Spec Case 1.
+
+ // Spec Case 6: If the file system and files remain static, then this method is symmetric
+ // (for two Paths f and g, mismatch(f,g) will return the same value as mismatch(g,f)).
+ // The following tests are selected from tests for Spec Case 3 with the order of
+ // file paths switched, the returned values are the same as those for Case 3:
+ {test147m70, test147a, 70, "read one partial buffer, mismatch = 70"},
+ {test147m146, test147a, 146, "read one partial buffer, mismatch = 146 (end)"},
+ {test1024m512, test1024a, 512, "read one partial buffer, mismatch = 512"},
+ {test1024m1023, test1024a, 1023, "read one partial buffer, mismatch = 1023 (end)"},
+
+ {test70025m35000, test8192m8191, 8191, "mismatch at the end of the 1st file/buffer, mismatch = 8191"},
+ {test70025m8400, test65536m32768, 8400, "mismatch in the 2nd buffer, mismatch = 8400"},
+ {test1065000m532500, test70025m70024, 70024, "mismatch at the end of the 1st file, mismatch = 70024"},
+ };
+ }
+
+ /*
+ * DataProvider for mismatch tests involving ZipFS using a few test cases selected
+ * from those of the original mismatch tests.
+ */
+ @DataProvider(name = "testMismatchZipfs")
+ public Object[][] getDataForMismatchZipfs() throws IOException {
+ Path test1200 = createASCIIFile(testDir, "test1200", 1200, -1, ' ');
+ Path test9500 = createASCIIFile(testDir, "test9500", 9500, -1, ' ');
+ Path test9500m4200 = createASCIIFile(testDir, "test9500m4200", 9500, 4200, '!');
+ Path test80025 = createASCIIFile(testDir, "test80025", 80025, -1, ' ');
+ Path test1028500 = createASCIIFile(testDir, "test1028500", 1028500, -1, ' ');
+ return new Object[][]{
+ {test1200, test1200, MISMATCH_NO, "Compares the file and its copy in zip, no mismatch"},
+ {test9500, test9500m4200, 4200,
+ "Compares a copy of test9500m4200 in zip with test9500, shall return 4200"},
+ {test80025, test1028500, 80025, "mismatch is the length of the smaller file: 80025"},
+ };
+ }
+
+ /*
+ * DataProvider for verifying null handling.
+ */
+ @DataProvider(name = "testFileNull")
+ public Object[][] getDataForNull() throws IOException {
+ Path test = createASCIIFile(testDir, "testNonNull", 2200, -1, ' ');
+ return new Object[][]{
+ {(Path)null, (Path)null},
+ {(Path)null, test},
+ {test, (Path)null},
+ };
+ }
+
+ /*
+ * DataProvider for verifying how the mismatch method handles the situation
+ * when one or both files do not exist.
+ */
+ @DataProvider(name = "testFileNotExist")
+ public Object[][] getDataForFileNotExist() throws IOException {
+ Path test = createASCIIFile(testDir, "testFileNotExist", 3200, -1, ' ');
+ return new Object[][]{
+ {Paths.get("foo"), Paths.get("bar")},
+ {Paths.get("foo"), test},
+ {test, Paths.get("bar")},
+ };
+ }
+
+ /**
+ * Tests the mismatch method. Refer to the dataProvider testMismatch for more
+ * details about the cases.
+ * @param path the path to a file
+ * @param path2 the path to another file
+ * @param expected the expected result
+ * @param msg the message about the test
+ * @throws IOException if the test fails
+ */
+ @Test(dataProvider = "testMismatch", priority = 0)
+ public void testMismatch(Path path, Path path2, long expected, String msg)
+ throws IOException {
+ Assert.assertEquals(Files.mismatch(path, path2), expected, msg);
+ }
+
+ /**
+ * Tests the mismatch method by comparing files with those in a ZIP file.
+ * @param path the path to a file
+ * @param path2 the path to another file to be added into a ZIP file
+ * @param expected the expected result
+ * @param msg the message about the test
+ * @throws IOException if the test fails
+ */
+ @Test(dataProvider = "testMismatchZipfs", priority = 1)
+ public void testMismatchZipfs(Path path, Path path2, long expected, String msg)
+ throws IOException {
+ Path zipPath = Paths.get(testDir.toString(), "TestWithFSZip.zip");
+ try (FileSystem fs = getZipFSProvider().newFileSystem(zipPath, ZIPFS_MAP)) {
+ Path copy = fs.getPath(path.getFileName().toString());
+ Files.copy(path, copy, REPLACE_EXISTING);
+
+ if (path2 == null) {
+ Assert.assertEquals(Files.mismatch(copy, path), expected, msg);
+ } else {
+ Assert.assertEquals(Files.mismatch(copy, path2), expected, msg);
+ }
+ }
+ }
+
+ /**
+ * Verifies that NullPointerException is thrown when one or both files are null.
+ * @param path the path to a file
+ * @param path2 the path to another file
+ * @throws NullPointerException as expected
+ */
+ @Test(dataProvider = "testFileNull", priority = 2, expectedExceptions = NullPointerException.class)
+ public void testMismatchNull(Path path, Path path2) throws Exception {
+ long result = Files.mismatch(path, path2);
+ }
+
+ /**
+ * Verifies that IOException is thrown when one or both files do not exist.
+ * @param path the path to a file
+ * @param path2 the path to another file
+ * @throws IOException as expected
+ */
+ @Test(dataProvider = "testFileNotExist", priority = 2, expectedExceptions = IOException.class)
+ public void testMismatchNotExist(Path path, Path path2) throws IOException {
+ long result = Files.mismatch(path, path2);
+ }
+
+ /**
+ * Creates a file with ASCII content with one character altered
+ * at the specified position.
+ *
+ * Note: Files.mismatch method does a byte-by-byte comparison. ASCII files
+ * are sufficient for verifying the feature.
+ *
+ * @param dir the directory in which the file is to be created
+ * @param purpose the purpose of the file
+ * @param size the size of the file
+ * @param pos the position where the alternative char is to be added. If it
+ * is smaller than zero, no alternation shall be made.
+ * @param c the character
+ * @return path of the created file
+ * @throws IOException
+ */
+ private static Path createASCIIFile(Path dir, String purpose, int size, int pos,
+ char c) throws IOException {
+ Path path = Files.createFile(Paths.get(dir.toString(), purpose + ".txt"));
+ if (size > 0) {
+ writeASCIIFile(path, size, pos, c);
+ }
+ return path;
+ }
+
+ private static void writeASCIIFile(Path path, int size, int pos, char c)
+ throws IOException {
+ byte[] a = createASCIIArray(size);
+ if (pos >= 0) a[pos] = (byte)(c & 0xFF); // US_ASCII char only, may cast directly
+ Files.write(path, a);
+ }
+
+ private static byte[] createASCIIArray(int length) {
+ byte[] bytes = "ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789 \n"
+ .getBytes(StandardCharsets.US_ASCII);
+ byte[] a = new byte[length];
+ fillArray(bytes, a);
+ return a;
+ }
+
+ private static FileSystemProvider getZipFSProvider() {
+ for (FileSystemProvider provider : FileSystemProvider.installedProviders()) {
+ if ("jar".equals(provider.getScheme())) {
+ return provider;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Fills the destination array by copying the source array repeatedly until
+ * it is completely filled.
+ *
+ * @param src the source array
+ * @param dest the destination array
+ */
+ public static void fillArray(byte[] src, byte[] dest) {
+ int bLen = src.length;
+ int space = dest.length;
+ int iteration = 0;
+
+ while (space > 0) {
+ if (space >= bLen) {
+ System.arraycopy(src, 0, dest, iteration++ * bLen, bLen);
+ space -= bLen;
+ } else {
+ System.arraycopy(src, 0, dest, iteration++ * bLen, space);
+ break;
+ }
+ }
+ }
+}
diff --git a/test/jdk/java/security/ProtectionDomain/PreserveCombinerTest.java b/test/jdk/java/security/ProtectionDomain/PreserveCombinerTest.java
index 5a3f7c4e989..bd27b84dad1 100644
--- a/test/jdk/java/security/ProtectionDomain/PreserveCombinerTest.java
+++ b/test/jdk/java/security/ProtectionDomain/PreserveCombinerTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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 @@ import java.security.AccessController;
import java.security.DomainCombiner;
import java.security.PrivilegedAction;
import java.security.ProtectionDomain;
-import jdk.internal.misc.SharedSecrets;
+import jdk.internal.access.SharedSecrets;
/*
* @test
@@ -34,7 +34,7 @@ import jdk.internal.misc.SharedSecrets;
* @summary Make sure that JavaSecurityAccess.doIntersectionPrivilege()
* is not dropping the information about the domain combiner of
* the stack ACC
- * @modules java.base/jdk.internal.misc
+ * @modules java.base/jdk.internal.access
*/
public class PreserveCombinerTest {
diff --git a/test/jdk/java/util/Formatter/spi/NoGroupingUsed.java b/test/jdk/java/util/Formatter/spi/NoGroupingUsed.java
index 05c8b9ae567..774bdaea88b 100644
--- a/test/jdk/java/util/Formatter/spi/NoGroupingUsed.java
+++ b/test/jdk/java/util/Formatter/spi/NoGroupingUsed.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/util/Locale/Bug8179071.java b/test/jdk/java/util/Locale/Bug8179071.java
index b0093c6e4a2..1a77b5a95a3 100644
--- a/test/jdk/java/util/Locale/Bug8179071.java
+++ b/test/jdk/java/util/Locale/Bug8179071.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/util/Locale/LocaleCmdOverrides.java b/test/jdk/java/util/Locale/LocaleCmdOverrides.java
index 07f1a66f4f7..2f68a8ad85f 100644
--- a/test/jdk/java/util/Locale/LocaleCmdOverrides.java
+++ b/test/jdk/java/util/Locale/LocaleCmdOverrides.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/util/Locale/SoftKeys.java b/test/jdk/java/util/Locale/SoftKeys.java
index 9f968d55f8d..a3e7166a3ea 100644
--- a/test/jdk/java/util/Locale/SoftKeys.java
+++ b/test/jdk/java/util/Locale/SoftKeys.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/util/TimeZone/Bug8066652.sh b/test/jdk/java/util/TimeZone/Bug8066652.sh
deleted file mode 100644
index be57a9fc56c..00000000000
--- a/test/jdk/java/util/TimeZone/Bug8066652.sh
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/bin/sh
-
-# 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 8066652
-# @requires os.family == "mac"
-# @summary tests thread safe native function localtime_r is accessed by multiple threads at same time and
-# zone id should not be “GMT+00:00” if default timezone is “GMT” and user specifies a fake timezone.
-# @build Bug8066652
-# @run shell/timeout=600 Bug8066652.sh
-
-
-if [ "${TESTSRC}" = "" ]
-then
- echo "TESTSRC not set. Test cannot execute. Failed."
- exit 1
-fi
-echo "TESTSRC=${TESTSRC}"
-if [ "${TESTJAVA}" = "" ]
-then
- echo "TESTJAVA not set. Test cannot execute. Failed."
- exit 1
-fi
-echo "TESTJAVA=${TESTJAVA}"
-if [ "${TESTCLASSES}" = "" ]
-then
- echo "TESTCLASSES not set. Test cannot execute. Failed."
- exit 1
-fi
-echo "TESTCLASSES=${TESTCLASSES}"
-echo "CLASSPATH=${CLASSPATH}"
-
-
-# set system TimeZone to GMT using environment variable TZ
-export TZ="GMT"
-
-# Setting invalid TimeZone using VM option
-${TESTJAVA}/bin/java -Duser.timezone=Foo/Bar ${TESTVMOPTS} -cp ${TESTCLASSES} Bug8066652
-
-status=$?
-if [ $status -eq 0 ]
-then
- echo "Success, Test Passed";
-else
- echo "Test Failed";
-fi
-
-exit $status
diff --git a/test/jdk/java/util/TimeZone/Bug8066652Run.java b/test/jdk/java/util/TimeZone/Bug8066652Run.java
new file mode 100644
index 00000000000..af9ba4d41af
--- /dev/null
+++ b/test/jdk/java/util/TimeZone/Bug8066652Run.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2016, 2018, 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 8066652
+ * @requires os.family == "mac"
+ * @summary tests thread safe native function localtime_r is accessed by multiple
+ * threads at same time and zone id should not be "GMT+00:00"
+ * if default timezone is "GMT" and user specifies a fake timezone.
+ * @library /test/lib
+ * @build Bug8066652
+ * @run main Bug8066652Run
+ */
+
+import java.util.Map;
+
+import jdk.test.lib.JDKToolLauncher;
+import jdk.test.lib.Utils;
+import jdk.test.lib.process.ProcessTools;
+
+public class Bug8066652Run {
+ private static String cp = Utils.TEST_CLASSES;
+ private static ProcessBuilder pb = new ProcessBuilder();
+
+ public static void main(String[] args) throws Throwable {
+ //set system TimeZone to GMT using environment variable TZ
+ Map env = pb.environment();
+ env.put("TZ", "GMT");
+ System.out.println("Current TimeZone:" + pb.environment().get("TZ"));
+ JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("java");
+ //Setting invalid TimeZone using VM option
+ launcher.addToolArg("-Duser.timezone=Foo/Bar")
+ .addToolArg("-cp")
+ .addToolArg(cp)
+ .addToolArg("Bug8066652");
+
+ pb.command(launcher.getCommand());
+ int exitCode = ProcessTools.executeCommand(pb)
+ .getExitValue();
+ if (exitCode != 0) {
+ throw new RuntimeException("Unexpected exit code: " + exitCode);
+ }
+ }
+}
+
diff --git a/test/jdk/java/util/TimeZone/OldIDMappingTest.java b/test/jdk/java/util/TimeZone/OldIDMappingTest.java
index 9d27f43bca9..8436080b041 100644
--- a/test/jdk/java/util/TimeZone/OldIDMappingTest.java
+++ b/test/jdk/java/util/TimeZone/OldIDMappingTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2018, 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
@@ -22,11 +22,31 @@
*/
/*
- * See OldMappingTest.sh
+ * @test
+ * @bug 6466476
+ * @summary Compatibility test for the old JDK ID mapping and Olson IDs
+ * @comment Expecting the new (Olson compatible) mapping (default)
+ * @run main/othervm -Dsun.timezone.ids.oldmapping=null OldIDMappingTest -new
+ * @run main/othervm -Dsun.timezone.ids.oldmapping="" OldIDMappingTest -new
+ * @run main/othervm -Dsun.timezone.ids.oldmapping=no OldIDMappingTest -new
+ * @run main/othervm -Dsun.timezone.ids.oldmapping=No OldIDMappingTest -new
+ * @run main/othervm -Dsun.timezone.ids.oldmapping=NO OldIDMappingTest -new
+ * @run main/othervm -Dsun.timezone.ids.oldmapping=false OldIDMappingTest -new
+ * @run main/othervm -Dsun.timezone.ids.oldmapping=False OldIDMappingTest -new
+ * @run main/othervm -Dsun.timezone.ids.oldmapping=FALSE OldIDMappingTest -new
+ * @run main/othervm -Dsun.timezone.ids.oldmapping=Hello OldIDMappingTest -new
+ * @comment Expecting the old mapping
+ * @run main/othervm -Dsun.timezone.ids.oldmapping=true OldIDMappingTest -old
+ * @run main/othervm -Dsun.timezone.ids.oldmapping=True OldIDMappingTest -old
+ * @run main/othervm -Dsun.timezone.ids.oldmapping=TRUE OldIDMappingTest -old
+ * @run main/othervm -Dsun.timezone.ids.oldmapping=yes OldIDMappingTest -old
+ * @run main/othervm -Dsun.timezone.ids.oldmapping=Yes OldIDMappingTest -old
+ * @run main/othervm -Dsun.timezone.ids.oldmapping=YES OldIDMappingTest -old
*/
-import java.lang.reflect.*;
-import java.util.*;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.TimeZone;
public class OldIDMappingTest {
private static final String MAPPING_PROPERTY_NAME = "sun.timezone.ids.oldmapping";
@@ -62,8 +82,9 @@ public class OldIDMappingTest {
TimeZone tz = TimeZone.getTimeZone(oldmap.get(id));
if (useOldMapping) {
if (!tzAlias.hasSameRules(tz)) {
- throw new RuntimeException("OLDMAP: " + MAPPING_PROPERTY_NAME + "=" + prop + ": "
- + id + " isn't an alias of " + oldmap.get(id));
+ throw new RuntimeException("OLDMAP: " + MAPPING_PROPERTY_NAME
+ + "=" + prop + ": " + id
+ + " isn't an alias of " + oldmap.get(id));
}
if (count == 0) {
System.out.println(" " + id + " => " + oldmap.get(id));
@@ -79,13 +100,15 @@ public class OldIDMappingTest {
continue;
}
if (tzAlias.hasSameRules(tz)) {
- throw new RuntimeException("NEWMAP: " + MAPPING_PROPERTY_NAME + "=" + prop + ": "
- + id + " is an alias of " + oldmap.get(id));
+ throw new RuntimeException("NEWMAP: " + MAPPING_PROPERTY_NAME
+ + "=" + prop + ": " + id
+ + " is an alias of " + oldmap.get(id));
}
tz = TimeZone.getTimeZone(newmap.get(id));
if (!tzAlias.hasSameRules(tz)) {
- throw new RuntimeException("NEWMAP: " + MAPPING_PROPERTY_NAME + "=" + prop + ": "
- + id + " isn't an alias of " + newmap.get(id));
+ throw new RuntimeException("NEWMAP: " + MAPPING_PROPERTY_NAME
+ + "=" + prop + ": " + id
+ + " isn't an alias of " + newmap.get(id));
}
if (count == 0) {
System.out.println(" " + id + " => " + newmap.get(id));
diff --git a/test/jdk/java/util/TimeZone/OldIDMappingTest.sh b/test/jdk/java/util/TimeZone/OldIDMappingTest.sh
deleted file mode 100644
index 96b55104779..00000000000
--- a/test/jdk/java/util/TimeZone/OldIDMappingTest.sh
+++ /dev/null
@@ -1,57 +0,0 @@
-# Copyright (c) 2003, 2013, 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 6466476
-# @summary Compatibility test for the old JDK ID mapping and Olson IDs
-# @build OldIDMappingTest
-# @run shell OldIDMappingTest.sh
-
-: ${TESTJAVA:=${JAVA_HOME}}
-: ${TESTCLASSES:="`pwd`"}
-
-JAVA="${TESTJAVA}/bin/java"
-
-STATUS=0
-
-# Expecting the new (Olson compatible) mapping (default)
-for I in "" " " no No NO false False FALSE Hello
-do
- if [ x"$I" != x ]; then
- D="-Dsun.timezone.ids.oldmapping=${I}"
- fi
- if ! ${JAVA} ${D} ${TESTVMOPTS} -cp ${TESTCLASSES} OldIDMappingTest -new; then
- STATUS=1
- fi
-done
-
-# Expecting the old mapping
-for I in true True TRUE yes Yes YES
-do
- if [ "x$I" != x ]; then
- D="-Dsun.timezone.ids.oldmapping=${I}"
- fi
- if ! ${JAVA} ${D} ${TESTVMOPTS} -cp ${TESTCLASSES} OldIDMappingTest -old; then
- STATUS=1
- fi
-done
-
-exit ${STATUS}
diff --git a/test/jdk/java/util/TimeZone/TimeZoneDatePermissionCheck.sh b/test/jdk/java/util/TimeZone/TimeZoneDatePermissionCheck.sh
deleted file mode 100644
index 44207ab351b..00000000000
--- a/test/jdk/java/util/TimeZone/TimeZoneDatePermissionCheck.sh
+++ /dev/null
@@ -1,63 +0,0 @@
-# Testcase for PR381 Stackoverflow error with security manager, signed jars
-# and -Djava.security.debug set.
-#
-# Copyright (c) 2009, Red Hat Inc.
-#
-# This code is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# 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 for more details.
-#
-# 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.
-#
-# @test
-# @bug 6584033
-# @summary Stackoverflow error with security manager, signed jars and debug.
-# @build TimeZoneDatePermissionCheck
-# @run shell TimeZoneDatePermissionCheck.sh
-
-# Set default if not run under jtreg from test dir itself
-if [ "${TESTCLASSES}" = "" ] ; then
- TESTCLASSES="."
-fi
-if [ "${TESTJAVA}" = "" ] ; then
- TESTJAVA=/usr
-fi
-if [ "${COMPILEJAVA}" = "" ]; then
- COMPILEJAVA="${TESTJAVA}"
-fi
-
-# create a test keystore and dummy cert. Note that we use the COMPILEJAVA
-# as this test is a TimeZone test, it doesn't test keytool
-rm -f ${TESTCLASSES}/timezonedatetest.store
-${COMPILEJAVA}/bin/keytool ${TESTTOOLVMOPTS} -genkeypair -alias testcert \
- -keystore ${TESTCLASSES}/timezonedatetest.store \
- -storepass testpass -validity 360 \
- -keyalg rsa \
- -dname "cn=Mark Wildebeest, ou=FreeSoft, o=Red Hat, c=NL" \
- -keypass testpass
-
-# create a jar file to sign with the test class in it.
-rm -f ${TESTCLASSES}/timezonedatetest.jar
-${COMPILEJAVA}/bin/jar ${TESTTOOLVMOPTS} cf \
- ${TESTCLASSES}/timezonedatetest.jar \
- -C ${TESTCLASSES} TimeZoneDatePermissionCheck.class
-
-# sign it
-${COMPILEJAVA}/bin/jarsigner ${TESTTOOLVMOPTS} \
- -keystore ${TESTCLASSES}/timezonedatetest.store \
- -storepass testpass ${TESTCLASSES}/timezonedatetest.jar testcert
-
-# run it with the security manager on, plus accesscontroller debugging
-# will go into infinite recursion trying to get enough permissions for
-# printing Date of failing certificate unless fix is applied.
-${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.security.manager \
- -Djava.security.debug=access,failure,policy \
- -cp ${TESTCLASSES}/timezonedatetest.jar TimeZoneDatePermissionCheck
diff --git a/test/jdk/java/util/TimeZone/TimeZoneDatePermissionCheckRun.java b/test/jdk/java/util/TimeZone/TimeZoneDatePermissionCheckRun.java
new file mode 100644
index 00000000000..fe052a31a13
--- /dev/null
+++ b/test/jdk/java/util/TimeZone/TimeZoneDatePermissionCheckRun.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2009, 2018, 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 6584033
+ * @summary Stackoverflow error with security manager, signed jars and debug.
+ * @library /test/lib
+ * @build TimeZoneDatePermissionCheck
+ * @run main TimeZoneDatePermissionCheckRun
+ */
+
+import java.io.File;
+import java.util.List;
+
+import jdk.test.lib.JDKToolLauncher;
+import jdk.test.lib.Utils;
+import jdk.test.lib.process.ProcessTools;
+
+public class TimeZoneDatePermissionCheckRun {
+ private static String storePath = Utils.TEST_CLASSES + File.separator
+ + "timezonedatetest.store";
+ private static String jarPath = Utils.TEST_CLASSES + File.separator
+ + "timezonedatetest.jar";
+
+ public static void main(String[] args) throws Throwable {
+ try {
+ //create a test keystore and dummy cert. Note that we use the COMPILEJAVA
+ //as this test is a TimeZone test, it doesn't test keytool
+ runJavaCmd("keytool",
+ List.of("-genkeypair", "-alias", "testcert", "-keystore",
+ storePath, "-storepass", "testpass", "-validity",
+ "360", "-keyalg", "rsa", "-dname",
+ "cn=Mark Wildebeest, ou=FreeSoft, o=Red Hat, c=NL",
+ "-keypass", "testpass"));
+
+ //create a jar file to sign with the test class in it.
+ runJavaCmd("jar", List.of("cf", jarPath, "-C", Utils.TEST_CLASSES,
+ "TimeZoneDatePermissionCheck.class"));
+
+ //sign it
+ runJavaCmd("jarsigner",
+ List.of("-keystore", storePath, "-storepass", "testpass",
+ jarPath, "testcert"));
+
+ //run it with the security manager on, plus accesscontroller debugging
+ //will go into infinite recursion trying to get enough permissions for
+ //printing Date of failing certificate unless fix is applied.
+ JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("java");
+ launcher.addToolArg("-Djava.security.manager")
+ .addToolArg("-Djava.security.debug=access,failure,policy")
+ .addToolArg("-cp")
+ .addToolArg(jarPath)
+ .addToolArg("TimeZoneDatePermissionCheck");
+
+ int exitCode = ProcessTools.executeCommand(launcher.getCommand())
+ .getExitValue();
+ if (exitCode != 0) {
+ throw new RuntimeException("Unexpected exit code: " + exitCode);
+ }
+ } finally {
+ //clean up the test files
+ File storeFile = new File(storePath);
+ if (storeFile.exists()) {
+ storeFile.delete();
+ }
+ File jarFile = new File(jarPath);
+ if (jarFile.exists()) {
+ jarFile.delete();
+ }
+ }
+ }
+
+ private static void runJavaCmd(String cmd, List javaParam)
+ throws Throwable{
+ JDKToolLauncher launcher = JDKToolLauncher.create(cmd);
+ for (String para: javaParam) {
+ launcher.addToolArg(para);
+ }
+
+ System.out.println(launcher.getCommand());
+ int exitCode = ProcessTools.executeCommand(launcher.getCommand())
+ .getExitValue();
+ if (exitCode != 0) {
+ throw new RuntimeException("Unexpected exit code: " + exitCode);
+ }
+ }
+}
diff --git a/test/jdk/java/util/concurrent/atomic/VMSupportsCS8.java b/test/jdk/java/util/concurrent/atomic/VMSupportsCS8.java
index e50becd2c3d..f25cc2f311f 100644
--- a/test/jdk/java/util/concurrent/atomic/VMSupportsCS8.java
+++ b/test/jdk/java/util/concurrent/atomic/VMSupportsCS8.java
@@ -33,7 +33,8 @@ import java.lang.reflect.Field;
public class VMSupportsCS8 {
public static void main(String[] args) throws Exception {
- if (System.getProperty("sun.cpu.isalist").matches
+ String isalist = System.getProperty("sun.cpu.isalist");
+ if (isalist != null && isalist.matches
(".*\\b(sparcv9|pentium_pro|ia64|amd64).*")
||
System.getProperty("os.arch").matches
diff --git a/test/jdk/java/util/logging/LogManager/LinkageErrorTest.java b/test/jdk/java/util/logging/LogManager/LinkageErrorTest.java
index 98e56b0ba6b..011d63598d8 100644
--- a/test/jdk/java/util/logging/LogManager/LinkageErrorTest.java
+++ b/test/jdk/java/util/logging/LogManager/LinkageErrorTest.java
@@ -4,9 +4,7 @@
*
* 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.
+ * 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
diff --git a/test/jdk/java/util/logging/LogManagerAppContextDeadlock.java b/test/jdk/java/util/logging/LogManagerAppContextDeadlock.java
index f54eb2a7a5c..a4a16883890 100644
--- a/test/jdk/java/util/logging/LogManagerAppContextDeadlock.java
+++ b/test/jdk/java/util/logging/LogManagerAppContextDeadlock.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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,15 +35,15 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.LogManager;
import java.util.logging.Logger;
-import jdk.internal.misc.JavaAWTAccess;
-import jdk.internal.misc.SharedSecrets;
+import jdk.internal.access.JavaAWTAccess;
+import jdk.internal.access.SharedSecrets;
/**
* @test
* @bug 8065991
* @summary check that when LogManager is initialized, a deadlock similar
* to that described in 8065709 will not occur.
- * @modules java.base/jdk.internal.misc
+ * @modules java.base/jdk.internal.access
* java.logging
* java.management
* @run main/othervm LogManagerAppContextDeadlock UNSECURE
@@ -349,7 +349,7 @@ public class LogManagerAppContextDeadlock {
// FileHandlers because we're passing invalid parameters
// which will make the creation fail...
permissions = new Permissions();
- permissions.add(new RuntimePermission("accessClassInPackage.jdk.internal.misc"));
+ permissions.add(new RuntimePermission("accessClassInPackage.jdk.internal.access"));
// these are used for configuring the test itself...
allPermissions = new Permissions();
diff --git a/test/jdk/java/util/logging/RootLogger/RootLevelInConfigFile.java b/test/jdk/java/util/logging/RootLogger/RootLevelInConfigFile.java
index 04590871544..c2de8de3fc0 100644
--- a/test/jdk/java/util/logging/RootLogger/RootLevelInConfigFile.java
+++ b/test/jdk/java/util/logging/RootLogger/RootLevelInConfigFile.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -34,15 +34,15 @@ import java.util.logging.Level;
import java.util.logging.LogManager;
import java.util.logging.Logger;
import java.util.logging.LoggingPermission;
-import jdk.internal.misc.JavaAWTAccess;
-import jdk.internal.misc.SharedSecrets;
+import jdk.internal.access.JavaAWTAccess;
+import jdk.internal.access.SharedSecrets;
/**
* @test
* @bug 8030850
* @summary Tests that setting .level=FINEST for the root logger in logging
* configuration file does work.
- * @modules java.base/jdk.internal.misc
+ * @modules java.base/jdk.internal.access
* java.logging
* @run main/othervm RootLevelInConfigFile
*
@@ -182,7 +182,7 @@ public class RootLevelInConfigFile {
perms.add(new PropertyPermission("java.util.logging.config.class","read"));
perms.add(new PropertyPermission("java.util.logging.config.file","read"));
perms.add(new FilePermission(configFile, "read"));
- perms.add(new RuntimePermission("accessClassInPackage.jdk.internal.misc"));
+ perms.add(new RuntimePermission("accessClassInPackage.jdk.internal.access"));
}
@Override
diff --git a/test/jdk/java/util/logging/TestAppletLoggerContext.java b/test/jdk/java/util/logging/TestAppletLoggerContext.java
index 23e38bf2817..846f093d7b0 100644
--- a/test/jdk/java/util/logging/TestAppletLoggerContext.java
+++ b/test/jdk/java/util/logging/TestAppletLoggerContext.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -33,8 +33,8 @@ import java.util.Map;
import java.util.logging.LogManager;
import java.util.logging.Logger;
import java.util.logging.LoggingPermission;
-import jdk.internal.misc.JavaAWTAccess;
-import jdk.internal.misc.SharedSecrets;
+import jdk.internal.access.JavaAWTAccess;
+import jdk.internal.access.SharedSecrets;
/*
* @test
@@ -42,7 +42,7 @@ import jdk.internal.misc.SharedSecrets;
* @summary NPE when using Logger.getAnonymousLogger or
* LogManager.getLogManager().getLogger
*
- * @modules java.base/jdk.internal.misc
+ * @modules java.base/jdk.internal.access
* java.logging
* @run main/othervm -Dtest.security=off TestAppletLoggerContext LoadingApplet
* @run main/othervm -Dtest.security=on TestAppletLoggerContext LoadingApplet
diff --git a/test/jdk/java/util/logging/TestGetLoggerNPE.java b/test/jdk/java/util/logging/TestGetLoggerNPE.java
index 6b84d1c3122..cde2c458a5f 100644
--- a/test/jdk/java/util/logging/TestGetLoggerNPE.java
+++ b/test/jdk/java/util/logging/TestGetLoggerNPE.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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,8 +26,8 @@ import java.security.Policy;
import java.security.ProtectionDomain;
import java.util.logging.LogManager;
import java.util.logging.Logger;
-import jdk.internal.misc.JavaAWTAccess;
-import jdk.internal.misc.SharedSecrets;
+import jdk.internal.access.JavaAWTAccess;
+import jdk.internal.access.SharedSecrets;
/*
* @test
@@ -35,7 +35,7 @@ import jdk.internal.misc.SharedSecrets;
*
* @summary NPE with logging while launching webstart
*
- * @modules java.base/jdk.internal.misc
+ * @modules java.base/jdk.internal.access
* java.logging
* @build TestGetLoggerNPE
* @run main/othervm TestGetLoggerNPE getLogger
diff --git a/test/jdk/java/util/spi/ResourceBundleControlProvider/com/foo/XmlRB.xml b/test/jdk/java/util/spi/ResourceBundleControlProvider/com/foo/XmlRB.xml
index 5382313ad99..cae776ebe4d 100644
--- a/test/jdk/java/util/spi/ResourceBundleControlProvider/com/foo/XmlRB.xml
+++ b/test/jdk/java/util/spi/ResourceBundleControlProvider/com/foo/XmlRB.xml
@@ -1,13 +1,11 @@