mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-02 12:10:14 +00:00
Merge
This commit is contained in:
commit
ae1273fa3a
1
.hgtags
1
.hgtags
@ -373,3 +373,4 @@ d53037a90c441cb528dc41c30827985de0e67c62 jdk-9+123
|
||||
5bf88dce615f6804f9e101a96ffa7c9dfb4fbbbe jdk-9+128
|
||||
e8373543a3f0f60589b7d72b1f9b172721124caf jdk-9+129
|
||||
e613affb88d178dc7c589f1679db113d589bddb4 jdk-9+130
|
||||
4d2a15091124488080d65848b704e25599b2aaeb jdk-9+131
|
||||
|
||||
@ -373,3 +373,4 @@ f80c841ae2545eaf9acd2724bccc305d98cefbe2 jdk-9+124
|
||||
b30ae794d974d7dd3eb4e84203f70021823fa6c6 jdk-9+128
|
||||
f5902d3841b82cac6e7716a20c24e8e916fb14a8 jdk-9+129
|
||||
d94d54a3192fea79234c3ac55cd0b4052d45e954 jdk-9+130
|
||||
8728756c2f70a79a90188f4019cfd6b9a275765c jdk-9+131
|
||||
|
||||
@ -305,7 +305,7 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK],
|
||||
BOOT_JDK_SOURCETARGET="-source 8 -target 8"
|
||||
AC_SUBST(BOOT_JDK_SOURCETARGET)
|
||||
|
||||
ADD_JVM_ARG_IF_OK([-Xpatch:foo=bar], dummy, [$JAVA])
|
||||
ADD_JVM_ARG_IF_OK([--patch-module foo=bar], dummy, [$JAVA])
|
||||
AC_MSG_CHECKING([if Boot JDK supports modules])
|
||||
if test "x$JVM_ARG_OK" = "xtrue"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
|
||||
@ -5095,7 +5095,7 @@ VS_SDK_PLATFORM_NAME_2013=
|
||||
#CUSTOM_AUTOCONF_INCLUDE
|
||||
|
||||
# Do not change or remove the following line, it is needed for consistency checks:
|
||||
DATE_WHEN_GENERATED=1470415803
|
||||
DATE_WHEN_GENERATED=1470863189
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
@ -30596,13 +30596,13 @@ $as_echo "$tool_specified" >&6; }
|
||||
|
||||
|
||||
|
||||
$ECHO "Check if jvm arg is ok: -Xpatch:foo=bar" >&5
|
||||
$ECHO "Command: $JAVA -Xpatch:foo=bar -version" >&5
|
||||
OUTPUT=`$JAVA -Xpatch:foo=bar -version 2>&1`
|
||||
$ECHO "Check if jvm arg is ok: --patch-module foo=bar" >&5
|
||||
$ECHO "Command: $JAVA --patch-module foo=bar -version" >&5
|
||||
OUTPUT=`$JAVA --patch-module foo=bar -version 2>&1`
|
||||
FOUND_WARN=`$ECHO "$OUTPUT" | $GREP -i warn`
|
||||
FOUND_VERSION=`$ECHO $OUTPUT | $GREP " version \""`
|
||||
if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
|
||||
dummy="$dummy -Xpatch:foo=bar"
|
||||
dummy="$dummy --patch-module foo=bar"
|
||||
JVM_ARG_OK=true
|
||||
else
|
||||
$ECHO "Arg failed:" >&5
|
||||
|
||||
@ -585,7 +585,7 @@ INTERIM_OVERRIDE_MODULES := java.compiler jdk.compiler \
|
||||
jdk.jdeps jdk.javadoc jdk.rmic
|
||||
ifeq ($(BOOT_JDK_MODULAR), true)
|
||||
INTERIM_OVERRIDE_MODULES_ARGS = $(foreach m, $(INTERIM_OVERRIDE_MODULES), \
|
||||
-Xpatch:$m=$(BUILDTOOLS_OUTPUTDIR)/override_modules/$m)
|
||||
--patch-module $m=$(BUILDTOOLS_OUTPUTDIR)/override_modules/$m)
|
||||
INTERIM_LANGTOOLS_ARGS = $(INTERIM_OVERRIDE_MODULES_ARGS)
|
||||
JAVAC_MAIN_CLASS = -m jdk.compiler/com.sun.tools.javac.Main
|
||||
JAVADOC_MAIN_CLASS = -m jdk.javadoc/jdk.javadoc.internal.tool.Main
|
||||
|
||||
@ -417,7 +417,7 @@ var getJibProfilesDependencies = function (input, common) {
|
||||
jtreg: {
|
||||
server: "javare",
|
||||
revision: "4.2",
|
||||
build_number: "b02",
|
||||
build_number: "b03",
|
||||
checksum_file: "MD5_VALUES",
|
||||
file: "jtreg_bin-4.2.zip",
|
||||
environment_name: "JT_HOME"
|
||||
|
||||
@ -373,3 +373,4 @@ c7f5ba08fcd4b8416e62c21229f9a07c95498919 jdk-9+126
|
||||
1f093d3f8cd99cd37c3b0af4cf5c3bffaa9c8b98 jdk-9+128
|
||||
c3e83ccab3bb1733ae903d681879a33f85ed465c jdk-9+129
|
||||
77f9692d5976ae155773dd3e07533616bb95bae1 jdk-9+130
|
||||
f7e1d5337c2e550fe553df7a3886bbed80292ecd jdk-9+131
|
||||
|
||||
@ -533,3 +533,4 @@ adc8c84b7cf8c540d920182f78a2bc982366432a jdk-9+126
|
||||
22bf6db9767b1b3a1994cbf32eb3331f31ae2093 jdk-9+128
|
||||
e96b34b76d863ed1fa04e0eeb3f297ac17b490fd jdk-9+129
|
||||
7d54c7056328b6a2bf4877458b8f4d8cd870f93b jdk-9+130
|
||||
943bf73b49c33c2d7cbd796f6a4ae3c7a00ae932 jdk-9+131
|
||||
|
||||
@ -109,6 +109,9 @@ public class HotSpotMethodHandleAccessProvider implements MethodHandleAccessProv
|
||||
if (!s.getReturnType(CLASS).equals(resultType)) {
|
||||
return false;
|
||||
}
|
||||
if (s.getParameterCount(false) != parameterTypes.length) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < s.getParameterCount(false); ++i) {
|
||||
if (!s.getParameterType(i, CLASS).equals(parameterTypes[i])) {
|
||||
return false;
|
||||
|
||||
@ -57,7 +57,7 @@ public final class Services {
|
||||
if (jvmci != requestorModule) {
|
||||
for (String pkg : jvmci.getPackages()) {
|
||||
// Export all JVMCI packages dynamically instead
|
||||
// of requiring a long list of -XaddExports
|
||||
// of requiring a long list of --add-exports
|
||||
// options on the JVM command line.
|
||||
if (!jvmci.isExported(pkg, requestorModule)) {
|
||||
jvmci.addExports(pkg, requestorModule);
|
||||
|
||||
@ -140,7 +140,7 @@ PerfCounter* ClassLoader::_unsafe_defineClassCallCounter = NULL;
|
||||
PerfCounter* ClassLoader::_isUnsyncloadClass = NULL;
|
||||
PerfCounter* ClassLoader::_load_instance_class_failCounter = NULL;
|
||||
|
||||
GrowableArray<ModuleClassPathList*>* ClassLoader::_xpatch_entries = NULL;
|
||||
GrowableArray<ModuleClassPathList*>* ClassLoader::_patch_mod_entries = NULL;
|
||||
GrowableArray<ModuleClassPathList*>* ClassLoader::_exploded_entries = NULL;
|
||||
ClassPathEntry* ClassLoader::_jrt_entry = NULL;
|
||||
ClassPathEntry* ClassLoader::_first_append_entry = NULL;
|
||||
@ -685,27 +685,27 @@ bool ClassLoader::check_shared_paths_misc_info(void *buf, int size) {
|
||||
}
|
||||
#endif
|
||||
|
||||
// Construct the array of module/path pairs as specified to -Xpatch
|
||||
// Construct the array of module/path pairs as specified to --patch-module
|
||||
// for the boot loader to search ahead of the jimage, if the class being
|
||||
// loaded is defined to a module that has been specified to -Xpatch.
|
||||
void ClassLoader::setup_xpatch_entries() {
|
||||
// loaded is defined to a module that has been specified to --patch-module.
|
||||
void ClassLoader::setup_patch_mod_entries() {
|
||||
Thread* THREAD = Thread::current();
|
||||
GrowableArray<ModuleXPatchPath*>* xpatch_args = Arguments::get_xpatchprefix();
|
||||
int num_of_entries = xpatch_args->length();
|
||||
GrowableArray<ModulePatchPath*>* patch_mod_args = Arguments::get_patch_mod_prefix();
|
||||
int num_of_entries = patch_mod_args->length();
|
||||
|
||||
assert(!DumpSharedSpaces, "DumpSharedSpaces not supported with -Xpatch");
|
||||
assert(!UseSharedSpaces, "UseSharedSpaces not supported with -Xpatch");
|
||||
assert(!DumpSharedSpaces, "DumpSharedSpaces not supported with --patch-module");
|
||||
assert(!UseSharedSpaces, "UseSharedSpaces not supported with --patch-module");
|
||||
|
||||
// Set up the boot loader's _xpatch_entries list
|
||||
_xpatch_entries = new (ResourceObj::C_HEAP, mtModule) GrowableArray<ModuleClassPathList*>(num_of_entries, true);
|
||||
// Set up the boot loader's _patch_mod_entries list
|
||||
_patch_mod_entries = new (ResourceObj::C_HEAP, mtModule) GrowableArray<ModuleClassPathList*>(num_of_entries, true);
|
||||
|
||||
for (int i = 0; i < num_of_entries; i++) {
|
||||
const char* module_name = (xpatch_args->at(i))->module_name();
|
||||
const char* module_name = (patch_mod_args->at(i))->module_name();
|
||||
Symbol* const module_sym = SymbolTable::lookup(module_name, (int)strlen(module_name), CHECK);
|
||||
assert(module_sym != NULL, "Failed to obtain Symbol for module name");
|
||||
ModuleClassPathList* module_cpl = new ModuleClassPathList(module_sym);
|
||||
|
||||
char* class_path = (xpatch_args->at(i))->path_string();
|
||||
char* class_path = (patch_mod_args->at(i))->path_string();
|
||||
int len = (int)strlen(class_path);
|
||||
int end = 0;
|
||||
// Iterate over the module's class path entries
|
||||
@ -735,10 +735,10 @@ void ClassLoader::setup_xpatch_entries() {
|
||||
}
|
||||
}
|
||||
|
||||
// Record the module into the list of -Xpatch entries only if
|
||||
// Record the module into the list of --patch-module entries only if
|
||||
// valid ClassPathEntrys have been created
|
||||
if (module_cpl->module_first_entry() != NULL) {
|
||||
_xpatch_entries->push(module_cpl);
|
||||
_patch_mod_entries->push(module_cpl);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1020,9 +1020,9 @@ void ClassLoader::print_bootclasspath() {
|
||||
ClassPathEntry* e;
|
||||
tty->print("[bootclasspath= ");
|
||||
|
||||
// Print -Xpatch module/path specifications first
|
||||
if (_xpatch_entries != NULL) {
|
||||
print_module_entry_table(_xpatch_entries);
|
||||
// Print --patch-module module/path specifications first
|
||||
if (_patch_mod_entries != NULL) {
|
||||
print_module_entry_table(_patch_mod_entries);
|
||||
}
|
||||
|
||||
// [jimage | exploded modules build]
|
||||
@ -1341,7 +1341,7 @@ const char* ClassLoader::file_name_for_class_name(const char* class_name,
|
||||
return file_name;
|
||||
}
|
||||
|
||||
// Search either the xpatch or exploded build entries for class
|
||||
// Search either the patch-module or exploded build entries for class
|
||||
ClassFileStream* ClassLoader::search_module_entries(const GrowableArray<ModuleClassPathList*>* const module_list,
|
||||
const char* const class_name, const char* const file_name, TRAPS) {
|
||||
ClassFileStream* stream = NULL;
|
||||
@ -1366,7 +1366,7 @@ ClassFileStream* ClassLoader::search_module_entries(const GrowableArray<ModuleCl
|
||||
int num_of_entries = module_list->length();
|
||||
const Symbol* class_module_name = mod_entry->name();
|
||||
|
||||
// Loop through all the modules in either the xpatch or exploded entries looking for module
|
||||
// Loop through all the modules in either the patch-module or exploded entries looking for module
|
||||
for (int i = 0; i < num_of_entries; i++) {
|
||||
ModuleClassPathList* module_cpl = module_list->at(i);
|
||||
Symbol* module_cpl_name = module_cpl->module_name();
|
||||
@ -1378,7 +1378,7 @@ ClassFileStream* ClassLoader::search_module_entries(const GrowableArray<ModuleCl
|
||||
while (e != NULL) {
|
||||
stream = e->open_stream(file_name, CHECK_NULL);
|
||||
// No context.check is required since CDS is not supported
|
||||
// for an exploded modules build or if -Xpatch is specified.
|
||||
// for an exploded modules build or if --patch-module is specified.
|
||||
if (NULL != stream) {
|
||||
return stream;
|
||||
}
|
||||
@ -1420,32 +1420,32 @@ instanceKlassHandle ClassLoader::load_class(Symbol* name, bool search_append_onl
|
||||
|
||||
// If DumpSharedSpaces is true boot loader visibility boundaries are set to:
|
||||
// - [jimage] + [_first_append_entry to _last_append_entry] (all path entries).
|
||||
// No -Xpatch entries or exploded module builds are included since CDS
|
||||
// is not supported if -Xpatch or exploded module builds are used.
|
||||
// No --patch-module entries or exploded module builds are included since CDS
|
||||
// is not supported if --patch-module or exploded module builds are used.
|
||||
//
|
||||
// If search_append_only is true, boot loader visibility boundaries are
|
||||
// set to be _first_append_entry to the end. This includes:
|
||||
// [-Xbootclasspath/a]; [jvmti appended entries]
|
||||
//
|
||||
// If both DumpSharedSpaces and search_append_only are false, boot loader
|
||||
// visibility boundaries are set to be the -Xpatch entries plus the base piece.
|
||||
// visibility boundaries are set to be the --patch-module entries plus the base piece.
|
||||
// This would include:
|
||||
// [-Xpatch:<module>=<file>(<pathsep><file>)*]; [jimage | exploded module build]
|
||||
// [--patch-module=<module>=<file>(<pathsep><file>)*]; [jimage | exploded module build]
|
||||
//
|
||||
// DumpSharedSpaces and search_append_only are mutually exclusive and cannot
|
||||
// be true at the same time.
|
||||
assert(!(DumpSharedSpaces && search_append_only), "DumpSharedSpaces and search_append_only are both true");
|
||||
|
||||
// Load Attempt #1: -Xpatch
|
||||
// Determine the class' defining module. If it appears in the _xpatch_entries,
|
||||
// Load Attempt #1: --patch-module
|
||||
// Determine the class' defining module. If it appears in the _patch_mod_entries,
|
||||
// attempt to load the class from those locations specific to the module.
|
||||
// Specifications to -Xpatch can contain a partial number of classes
|
||||
// Specifications to --patch-module can contain a partial number of classes
|
||||
// that are part of the overall module definition. So if a particular class is not
|
||||
// found within its module specification, the search should continue to Load Attempt #2.
|
||||
// Note: The -Xpatch entries are never searched if the boot loader's
|
||||
// Note: The --patch-module entries are never searched if the boot loader's
|
||||
// visibility boundary is limited to only searching the append entries.
|
||||
if (_xpatch_entries != NULL && !search_append_only && !DumpSharedSpaces) {
|
||||
stream = search_module_entries(_xpatch_entries, class_name, file_name, CHECK_NULL);
|
||||
if (_patch_mod_entries != NULL && !search_append_only && !DumpSharedSpaces) {
|
||||
stream = search_module_entries(_patch_mod_entries, class_name, file_name, CHECK_NULL);
|
||||
}
|
||||
|
||||
// Load Attempt #2: [jimage | exploded build]
|
||||
@ -1650,11 +1650,11 @@ void ClassLoader::classLoader_init2(TRAPS) {
|
||||
// Create the moduleEntry for java.base
|
||||
create_javabase();
|
||||
|
||||
// Setup the list of module/path pairs for -Xpatch processing
|
||||
// Setup the list of module/path pairs for --patch-module processing
|
||||
// This must be done after the SymbolTable is created in order
|
||||
// to use fast_compare on module names instead of a string compare.
|
||||
if (Arguments::get_xpatchprefix() != NULL) {
|
||||
setup_xpatch_entries();
|
||||
if (Arguments::get_patch_mod_prefix() != NULL) {
|
||||
setup_patch_mod_entries();
|
||||
}
|
||||
|
||||
// Setup the initial java.base/path pair for the exploded build entries.
|
||||
|
||||
@ -150,7 +150,7 @@ public:
|
||||
|
||||
// ModuleClassPathList contains a linked list of ClassPathEntry's
|
||||
// that have been specified for a specific module. Currently,
|
||||
// the only way to specify a module/path pair is via the -Xpatch
|
||||
// the only way to specify a module/path pair is via the --patch-module
|
||||
// command line option.
|
||||
class ModuleClassPathList : public CHeapObj<mtClass> {
|
||||
private:
|
||||
@ -213,8 +213,8 @@ class ClassLoader: AllStatic {
|
||||
static PerfCounter* _load_instance_class_failCounter;
|
||||
|
||||
// The boot class path consists of 3 ordered pieces:
|
||||
// 1. the module/path pairs specified to -Xpatch
|
||||
// -Xpatch:<module>=<file>(<pathsep><file>)*
|
||||
// 1. the module/path pairs specified to --patch-module
|
||||
// --patch-module=<module>=<file>(<pathsep><file>)*
|
||||
// 2. the base piece
|
||||
// [jimage | build with exploded modules]
|
||||
// 3. boot loader append path
|
||||
@ -223,8 +223,8 @@ class ClassLoader: AllStatic {
|
||||
// The boot loader must obey this order when attempting
|
||||
// to load a class.
|
||||
|
||||
// 1. Contains the module/path pairs specified to -Xpatch
|
||||
static GrowableArray<ModuleClassPathList*>* _xpatch_entries;
|
||||
// 1. Contains the module/path pairs specified to --patch-module
|
||||
static GrowableArray<ModuleClassPathList*>* _patch_mod_entries;
|
||||
|
||||
// 2. the base piece
|
||||
// Contains the ClassPathEntry of the modular java runtime image.
|
||||
@ -256,11 +256,11 @@ class ClassLoader: AllStatic {
|
||||
|
||||
// Initialization:
|
||||
// - setup the boot loader's system class path
|
||||
// - setup the boot loader's xpatch entries, if present
|
||||
// - setup the boot loader's patch mod entries, if present
|
||||
// - create the ModuleEntry for java.base
|
||||
static void setup_bootstrap_search_path();
|
||||
static void setup_search_path(const char *class_path, bool setting_bootstrap);
|
||||
static void setup_xpatch_entries();
|
||||
static void setup_patch_mod_entries();
|
||||
static void create_javabase();
|
||||
|
||||
static void load_zip_library();
|
||||
@ -363,7 +363,7 @@ class ClassLoader: AllStatic {
|
||||
// Add a module's exploded directory to the boot loader's exploded module build list
|
||||
static void add_to_exploded_build_list(Symbol* module_name, TRAPS);
|
||||
|
||||
// Attempt load of individual class from either the xpatch or exploded modules build lists
|
||||
// Attempt load of individual class from either the patched or exploded modules build lists
|
||||
static ClassFileStream* search_module_entries(const GrowableArray<ModuleClassPathList*>* const module_list,
|
||||
const char* const class_name,
|
||||
const char* const file_name, TRAPS);
|
||||
|
||||
@ -911,8 +911,8 @@ bool FileMapInfo::FileMapHeader::validate() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Arguments::get_xpatchprefix() != NULL) {
|
||||
FileMapInfo::fail_continue("The shared archive file cannot be used with -Xpatch.");
|
||||
if (Arguments::get_patch_mod_prefix() != NULL) {
|
||||
FileMapInfo::fail_continue("The shared archive file cannot be used with --patch-module.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -24,6 +24,8 @@
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "classfile/classLoaderExt.hpp"
|
||||
#include "classfile/javaClasses.inline.hpp"
|
||||
#include "classfile/stringTable.hpp"
|
||||
#include "classfile/modules.hpp"
|
||||
#include "classfile/systemDictionary.hpp"
|
||||
#include "classfile/vmSymbols.hpp"
|
||||
@ -224,6 +226,7 @@ JvmtiEnv::GetNamedModule(jobject class_loader, const char* package_name, jobject
|
||||
return JVMTI_ERROR_NONE;
|
||||
} /* end GetNamedModule */
|
||||
|
||||
|
||||
//
|
||||
// Class functions
|
||||
//
|
||||
@ -3465,28 +3468,35 @@ jvmtiError
|
||||
JvmtiEnv::GetSystemProperties(jint* count_ptr, char*** property_ptr) {
|
||||
jvmtiError err = JVMTI_ERROR_NONE;
|
||||
|
||||
*count_ptr = Arguments::PropertyList_count(Arguments::system_properties());
|
||||
// Get the number of readable properties.
|
||||
*count_ptr = Arguments::PropertyList_readable_count(Arguments::system_properties());
|
||||
|
||||
// Allocate memory to hold the exact number of readable properties.
|
||||
err = allocate(*count_ptr * sizeof(char *), (unsigned char **)property_ptr);
|
||||
if (err != JVMTI_ERROR_NONE) {
|
||||
return err;
|
||||
}
|
||||
int i = 0 ;
|
||||
for (SystemProperty* p = Arguments::system_properties(); p != NULL && i < *count_ptr; p = p->next(), i++) {
|
||||
const char *key = p->key();
|
||||
char **tmp_value = *property_ptr+i;
|
||||
err = allocate((strlen(key)+1) * sizeof(char), (unsigned char**)tmp_value);
|
||||
if (err == JVMTI_ERROR_NONE) {
|
||||
strcpy(*tmp_value, key);
|
||||
} else {
|
||||
// clean up previously allocated memory.
|
||||
for (int j=0; j<i; j++) {
|
||||
Deallocate((unsigned char*)*property_ptr+j);
|
||||
int readable_count = 0;
|
||||
// Loop through the system properties until all the readable properties are found.
|
||||
for (SystemProperty* p = Arguments::system_properties(); p != NULL && readable_count < *count_ptr; p = p->next()) {
|
||||
if (p->is_readable()) {
|
||||
const char *key = p->key();
|
||||
char **tmp_value = *property_ptr+readable_count;
|
||||
readable_count++;
|
||||
err = allocate((strlen(key)+1) * sizeof(char), (unsigned char**)tmp_value);
|
||||
if (err == JVMTI_ERROR_NONE) {
|
||||
strcpy(*tmp_value, key);
|
||||
} else {
|
||||
// clean up previously allocated memory.
|
||||
for (int j=0; j<readable_count; j++) {
|
||||
Deallocate((unsigned char*)*property_ptr+j);
|
||||
}
|
||||
Deallocate((unsigned char*)property_ptr);
|
||||
break;
|
||||
}
|
||||
Deallocate((unsigned char*)property_ptr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
assert(err != JVMTI_ERROR_NONE || readable_count == *count_ptr, "Bad readable property count");
|
||||
return err;
|
||||
} /* end GetSystemProperties */
|
||||
|
||||
@ -3498,7 +3508,8 @@ JvmtiEnv::GetSystemProperty(const char* property, char** value_ptr) {
|
||||
jvmtiError err = JVMTI_ERROR_NONE;
|
||||
const char *value;
|
||||
|
||||
value = Arguments::PropertyList_get_value(Arguments::system_properties(), property);
|
||||
// Return JVMTI_ERROR_NOT_AVAILABLE if property is not readable or doesn't exist.
|
||||
value = Arguments::PropertyList_get_readable_value(Arguments::system_properties(), property);
|
||||
if (value == NULL) {
|
||||
err = JVMTI_ERROR_NOT_AVAILABLE;
|
||||
} else {
|
||||
|
||||
@ -110,7 +110,7 @@ SystemProperty *Arguments::_java_home = NULL;
|
||||
SystemProperty *Arguments::_java_class_path = NULL;
|
||||
SystemProperty *Arguments::_jdk_boot_class_path_append = NULL;
|
||||
|
||||
GrowableArray<ModuleXPatchPath*> *Arguments::_xpatchprefix = NULL;
|
||||
GrowableArray<ModulePatchPath*> *Arguments::_patch_mod_prefix = NULL;
|
||||
PathString *Arguments::_system_boot_class_path = NULL;
|
||||
bool Arguments::_has_jimage = false;
|
||||
|
||||
@ -161,6 +161,30 @@ static void logOption(const char* opt) {
|
||||
}
|
||||
}
|
||||
|
||||
bool needs_module_property_warning = false;
|
||||
|
||||
#define MODULE_PROPERTY_PREFIX "jdk.module"
|
||||
#define MODULE_PROPERTY_PREFIX_LEN 10
|
||||
#define MODULE_MAIN_PROPERTY "jdk.module.main"
|
||||
#define MODULE_MAIN_PROPERTY_LEN 15
|
||||
|
||||
// Return TRUE if option matches property, or property=, or property..
|
||||
static bool matches_property_prefix(const char* option, const char* property, size_t len) {
|
||||
return (strncmp(option, property, len) == 0) &&
|
||||
(option[len] == '=' || option[len] == '.' || option[len] == '\0');
|
||||
}
|
||||
|
||||
// Return true if the property is either "jdk.module" or starts with "jdk.module.",
|
||||
// but does not start with "jdk.module.main".
|
||||
// Return false if jdk.module.main because jdk.module.main and jdk.module.main.class
|
||||
// are valid non-internal system properties.
|
||||
// "property" should be passed without the leading "-D".
|
||||
bool Arguments::is_internal_module_property(const char* property) {
|
||||
assert((strncmp(property, "-D", 2) != 0), "Unexpected leading -D");
|
||||
return (matches_property_prefix(property, MODULE_PROPERTY_PREFIX, MODULE_PROPERTY_PREFIX_LEN) &&
|
||||
!matches_property_prefix(property, MODULE_MAIN_PROPERTY, MODULE_MAIN_PROPERTY_LEN));
|
||||
}
|
||||
|
||||
// Process java launcher properties.
|
||||
void Arguments::process_sun_java_launcher_properties(JavaVMInitArgs* args) {
|
||||
// See if sun.java.launcher, sun.java.launcher.is_altjvm or
|
||||
@ -197,7 +221,7 @@ void Arguments::init_system_properties() {
|
||||
_system_boot_class_path = new PathString(NULL);
|
||||
|
||||
PropertyList_add(&_system_properties, new SystemProperty("java.vm.specification.name",
|
||||
"Java Virtual Machine Specification", false));
|
||||
"Java Virtual Machine Specification", false));
|
||||
PropertyList_add(&_system_properties, new SystemProperty("java.vm.version", VM_Version::vm_release(), false));
|
||||
PropertyList_add(&_system_properties, new SystemProperty("java.vm.name", VM_Version::vm_name(), false));
|
||||
PropertyList_add(&_system_properties, new SystemProperty("java.vm.info", VM_Version::vm_info_string(), true));
|
||||
@ -1198,7 +1222,7 @@ const char* Arguments::get_property(const char* key) {
|
||||
return PropertyList_get_value(system_properties(), key);
|
||||
}
|
||||
|
||||
bool Arguments::add_property(const char* prop) {
|
||||
bool Arguments::add_property(const char* prop, PropertyWriteable writeable, PropertyInternal internal) {
|
||||
const char* eq = strchr(prop, '=');
|
||||
const char* key;
|
||||
const char* value = "";
|
||||
@ -1228,7 +1252,9 @@ bool Arguments::add_property(const char* prop) {
|
||||
// private and are processed in process_sun_java_launcher_properties();
|
||||
// the sun.java.launcher property is passed on to the java application
|
||||
} else if (strcmp(key, "sun.boot.library.path") == 0) {
|
||||
PropertyList_unique_add(&_system_properties, key, value, true);
|
||||
// append is true, writable is true, internal is false
|
||||
PropertyList_unique_add(&_system_properties, key, value, AppendProperty,
|
||||
WriteableProperty, ExternalProperty);
|
||||
} else {
|
||||
if (strcmp(key, "sun.java.command") == 0) {
|
||||
char *old_java_command = _java_command;
|
||||
@ -1248,7 +1274,7 @@ bool Arguments::add_property(const char* prop) {
|
||||
}
|
||||
|
||||
// Create new property and add at the end of the list
|
||||
PropertyList_unique_add(&_system_properties, key, value);
|
||||
PropertyList_unique_add(&_system_properties, key, value, AddProperty, writeable, internal);
|
||||
}
|
||||
|
||||
if (key != prop) {
|
||||
@ -1260,9 +1286,9 @@ bool Arguments::add_property(const char* prop) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// sets or adds a module name to the jdk.launcher.addmods property
|
||||
// sets or adds a module name to the jdk.module.addmods property
|
||||
bool Arguments::append_to_addmods_property(const char* module_name) {
|
||||
const char* key = "jdk.launcher.addmods";
|
||||
const char* key = "jdk.module.addmods";
|
||||
const char* old_value = Arguments::get_property(key);
|
||||
size_t buf_len = strlen(key) + strlen(module_name) + 2;
|
||||
if (old_value != NULL) {
|
||||
@ -1277,7 +1303,7 @@ bool Arguments::append_to_addmods_property(const char* module_name) {
|
||||
} else {
|
||||
jio_snprintf(new_value, buf_len, "%s=%s,%s", key, old_value, module_name);
|
||||
}
|
||||
bool added = add_property(new_value);
|
||||
bool added = add_property(new_value, UnwriteableProperty, InternalProperty);
|
||||
FreeHeap(new_value);
|
||||
return added;
|
||||
}
|
||||
@ -1287,14 +1313,14 @@ void Arguments::check_unsupported_dumping_properties() {
|
||||
assert(DumpSharedSpaces, "this function is only used with -Xshare:dump");
|
||||
const char* unsupported_properties[5] = { "jdk.module.main",
|
||||
"jdk.module.path",
|
||||
"jdk.upgrade.module.path",
|
||||
"jdk.launcher.addmods",
|
||||
"jdk.launcher.limitmods" };
|
||||
"jdk.module.upgrade.path",
|
||||
"jdk.module.addmods",
|
||||
"jdk.module.limitmods" };
|
||||
const char* unsupported_options[5] = { "-m",
|
||||
"-modulepath",
|
||||
"-upgrademodulepath",
|
||||
"-addmods",
|
||||
"-limitmods" };
|
||||
"--module-path",
|
||||
"--upgrade-module-path",
|
||||
"--add-modules",
|
||||
"--limit-modules" };
|
||||
SystemProperty* sp = system_properties();
|
||||
while (sp != NULL) {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
@ -1326,7 +1352,7 @@ void Arguments::set_mode_flags(Mode mode) {
|
||||
// Ensure Agent_OnLoad has the correct initial values.
|
||||
// This may not be the final mode; mode may change later in onload phase.
|
||||
PropertyList_unique_add(&_system_properties, "java.vm.info",
|
||||
VM_Version::vm_info_string(), false);
|
||||
VM_Version::vm_info_string(), AddProperty, UnwriteableProperty, ExternalProperty);
|
||||
|
||||
UseInterpreter = true;
|
||||
UseCompiler = true;
|
||||
@ -2516,6 +2542,41 @@ bool Arguments::parse_uintx(const char* value,
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned int addreads_count = 0;
|
||||
unsigned int addexports_count = 0;
|
||||
unsigned int patch_mod_count = 0;
|
||||
const char* add_modules_value = NULL;
|
||||
|
||||
bool Arguments::create_property(const char* prop_name, const char* prop_value, PropertyInternal internal) {
|
||||
size_t prop_len = strlen(prop_name) + strlen(prop_value) + 2;
|
||||
char* property = AllocateHeap(prop_len, mtArguments);
|
||||
int ret = jio_snprintf(property, prop_len, "%s=%s", prop_name, prop_value);
|
||||
if (ret < 0 || ret >= (int)prop_len) {
|
||||
FreeHeap(property);
|
||||
return false;
|
||||
}
|
||||
bool added = add_property(property, UnwriteableProperty, internal);
|
||||
FreeHeap(property);
|
||||
return added;
|
||||
}
|
||||
|
||||
bool Arguments::create_numbered_property(const char* prop_base_name, const char* prop_value, unsigned int count) {
|
||||
// Make sure count is < 1,000. Otherwise, memory allocation will be too small.
|
||||
if (count < 1000) {
|
||||
size_t prop_len = strlen(prop_base_name) + strlen(prop_value) + 5;
|
||||
char* property = AllocateHeap(prop_len, mtArguments);
|
||||
int ret = jio_snprintf(property, prop_len, "%s.%d=%s", prop_base_name, count, prop_value);
|
||||
if (ret < 0 || ret >= (int)prop_len) {
|
||||
FreeHeap(property);
|
||||
return false;
|
||||
}
|
||||
bool added = add_property(property, UnwriteableProperty, InternalProperty);
|
||||
FreeHeap(property);
|
||||
return added;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Arguments::ArgsRange Arguments::parse_memory_size(const char* s,
|
||||
julong* long_arg,
|
||||
julong min_size) {
|
||||
@ -2528,7 +2589,7 @@ Arguments::ArgsRange Arguments::parse_memory_size(const char* s,
|
||||
jint Arguments::parse_vm_init_args(const JavaVMInitArgs *java_tool_options_args,
|
||||
const JavaVMInitArgs *java_options_args,
|
||||
const JavaVMInitArgs *cmd_line_args) {
|
||||
bool xpatch_javabase = false;
|
||||
bool patch_mod_javabase = false;
|
||||
|
||||
// Save default settings for some mode flags
|
||||
Arguments::_AlwaysCompileLoopMethods = AlwaysCompileLoopMethods;
|
||||
@ -2545,20 +2606,20 @@ jint Arguments::parse_vm_init_args(const JavaVMInitArgs *java_tool_options_args,
|
||||
|
||||
// Parse args structure generated from JAVA_TOOL_OPTIONS environment
|
||||
// variable (if present).
|
||||
jint result = parse_each_vm_init_arg(java_tool_options_args, &xpatch_javabase, Flag::ENVIRON_VAR);
|
||||
jint result = parse_each_vm_init_arg(java_tool_options_args, &patch_mod_javabase, Flag::ENVIRON_VAR);
|
||||
if (result != JNI_OK) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// Parse args structure generated from the command line flags.
|
||||
result = parse_each_vm_init_arg(cmd_line_args, &xpatch_javabase, Flag::COMMAND_LINE);
|
||||
result = parse_each_vm_init_arg(cmd_line_args, &patch_mod_javabase, Flag::COMMAND_LINE);
|
||||
if (result != JNI_OK) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// Parse args structure generated from the _JAVA_OPTIONS environment
|
||||
// variable (if present) (mimics classic VM)
|
||||
result = parse_each_vm_init_arg(java_options_args, &xpatch_javabase, Flag::ENVIRON_VAR);
|
||||
result = parse_each_vm_init_arg(java_options_args, &patch_mod_javabase, Flag::ENVIRON_VAR);
|
||||
if (result != JNI_OK) {
|
||||
return result;
|
||||
}
|
||||
@ -2617,7 +2678,35 @@ bool valid_jdwp_agent(char *name, bool is_path) {
|
||||
return false;
|
||||
}
|
||||
|
||||
jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* xpatch_javabase, Flag::Flags origin) {
|
||||
int Arguments::process_patch_mod_option(const char* patch_mod_tail, bool* patch_mod_javabase) {
|
||||
// --patch-module=<module>=<file>(<pathsep><file>)*
|
||||
assert(patch_mod_tail != NULL, "Unexpected NULL patch-module value");
|
||||
// Find the equal sign between the module name and the path specification
|
||||
const char* module_equal = strchr(patch_mod_tail, '=');
|
||||
if (module_equal == NULL) {
|
||||
jio_fprintf(defaultStream::output_stream(), "Missing '=' in --patch-module specification\n");
|
||||
return JNI_ERR;
|
||||
} else {
|
||||
// Pick out the module name
|
||||
size_t module_len = module_equal - patch_mod_tail;
|
||||
char* module_name = NEW_C_HEAP_ARRAY_RETURN_NULL(char, module_len+1, mtArguments);
|
||||
if (module_name != NULL) {
|
||||
memcpy(module_name, patch_mod_tail, module_len);
|
||||
*(module_name + module_len) = '\0';
|
||||
// The path piece begins one past the module_equal sign
|
||||
add_patch_mod_prefix(module_name, module_equal + 1, patch_mod_javabase);
|
||||
FREE_C_HEAP_ARRAY(char, module_name);
|
||||
if (!create_numbered_property("jdk.module.patch", patch_mod_tail, patch_mod_count++)) {
|
||||
return JNI_ENOMEM;
|
||||
}
|
||||
} else {
|
||||
return JNI_ENOMEM;
|
||||
}
|
||||
}
|
||||
return JNI_OK;
|
||||
}
|
||||
|
||||
jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_mod_javabase, Flag::Flags origin) {
|
||||
// For match_option to return remaining or value part of option string
|
||||
const char* tail;
|
||||
|
||||
@ -2701,6 +2790,34 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* xpatch_
|
||||
#endif // !INCLUDE_JVMTI
|
||||
add_init_library(name, options);
|
||||
}
|
||||
} else if (match_option(option, "--add-reads=", &tail)) {
|
||||
if (!create_numbered_property("jdk.module.addreads", tail, addreads_count++)) {
|
||||
return JNI_ENOMEM;
|
||||
}
|
||||
} else if (match_option(option, "--add-exports=", &tail)) {
|
||||
if (!create_numbered_property("jdk.module.addexports", tail, addexports_count++)) {
|
||||
return JNI_ENOMEM;
|
||||
}
|
||||
} else if (match_option(option, "--add-modules=", &tail)) {
|
||||
add_modules_value = tail;
|
||||
} else if (match_option(option, "--limit-modules=", &tail)) {
|
||||
if (!create_property("jdk.module.limitmods", tail, InternalProperty)) {
|
||||
return JNI_ENOMEM;
|
||||
}
|
||||
} else if (match_option(option, "--module-path=", &tail)) {
|
||||
if (!create_property("jdk.module.path", tail, ExternalProperty)) {
|
||||
return JNI_ENOMEM;
|
||||
}
|
||||
} else if (match_option(option, "--upgrade-module-path=", &tail)) {
|
||||
if (!create_property("jdk.module.upgrade.path", tail, ExternalProperty)) {
|
||||
return JNI_ENOMEM;
|
||||
}
|
||||
} else if (match_option(option, "--patch-module=", &tail)) {
|
||||
// --patch-module=<module>=<file>(<pathsep><file>)*
|
||||
int res = process_patch_mod_option(tail, patch_mod_javabase);
|
||||
if (res != JNI_OK) {
|
||||
return res;
|
||||
}
|
||||
// -agentlib and -agentpath
|
||||
} else if (match_option(option, "-agentlib:", &tail) ||
|
||||
(is_absolute_path = match_option(option, "-agentpath:", &tail))) {
|
||||
@ -2992,6 +3109,13 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* xpatch_
|
||||
"-Djava.ext.dirs=%s is not supported. Use -classpath instead.\n", value);
|
||||
return JNI_EINVAL;
|
||||
}
|
||||
// Check for module related properties. They must be set using the modules
|
||||
// options. For example: use "--add-modules=java.sql", not
|
||||
// "-Djdk.module.addmods=java.sql"
|
||||
if (is_internal_module_property(option->optionString + 2)) {
|
||||
needs_module_property_warning = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!add_property(tail)) {
|
||||
return JNI_ENOMEM;
|
||||
@ -3012,33 +3136,6 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* xpatch_
|
||||
return JNI_ERR;
|
||||
#endif
|
||||
}
|
||||
if (match_option(option, "-Djdk.launcher.patch.", &tail)) {
|
||||
// -Djdk.launcher.patch.#=<module>=<file>(<pathsep><file>)*
|
||||
// The number, #, specified will be increasing with each -Xpatch
|
||||
// specified on the command line.
|
||||
// Pick up module name, following the -D property's equal sign.
|
||||
const char* property_equal = strchr(tail, '=');
|
||||
if (property_equal == NULL) {
|
||||
jio_fprintf(defaultStream::output_stream(), "Missing '=' in -Xpatch specification\n");
|
||||
return JNI_ERR;
|
||||
} else {
|
||||
// Find the equal sign between the module name and the path specification
|
||||
const char* module_equal = strchr(property_equal + 1, '=');
|
||||
if (module_equal == NULL) {
|
||||
jio_fprintf(defaultStream::output_stream(), "Bad value for -Xpatch, no module name specified\n");
|
||||
return JNI_ERR;
|
||||
} else {
|
||||
// Pick out the module name, in between the two equal signs
|
||||
size_t module_len = module_equal - property_equal - 1;
|
||||
char* module_name = NEW_C_HEAP_ARRAY(char, module_len+1, mtArguments);
|
||||
memcpy(module_name, property_equal + 1, module_len);
|
||||
*(module_name + module_len) = '\0';
|
||||
// The path piece begins one past the module_equal sign
|
||||
Arguments::add_xpatchprefix(module_name, module_equal + 1, xpatch_javabase);
|
||||
FREE_C_HEAP_ARRAY(char, module_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
// -Xint
|
||||
} else if (match_option(option, "-Xint")) {
|
||||
set_mode_flags(_int);
|
||||
@ -3298,25 +3395,25 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* xpatch_
|
||||
return JNI_OK;
|
||||
}
|
||||
|
||||
void Arguments::add_xpatchprefix(const char* module_name, const char* path, bool* xpatch_javabase) {
|
||||
// For java.base check for duplicate -Xpatch options being specified on the command line.
|
||||
void Arguments::add_patch_mod_prefix(const char* module_name, const char* path, bool* patch_mod_javabase) {
|
||||
// For java.base check for duplicate --patch-module options being specified on the command line.
|
||||
// This check is only required for java.base, all other duplicate module specifications
|
||||
// will be checked during module system initialization. The module system initialization
|
||||
// will throw an ExceptionInInitializerError if this situation occurs.
|
||||
if (strcmp(module_name, "java.base") == 0) {
|
||||
if (*xpatch_javabase) {
|
||||
vm_exit_during_initialization("Cannot specify java.base more than once to -Xpatch");
|
||||
if (*patch_mod_javabase) {
|
||||
vm_exit_during_initialization("Cannot specify java.base more than once to --patch-module");
|
||||
} else {
|
||||
*xpatch_javabase = true;
|
||||
*patch_mod_javabase = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Create GrowableArray lazily, only if -Xpatch has been specified
|
||||
if (_xpatchprefix == NULL) {
|
||||
_xpatchprefix = new (ResourceObj::C_HEAP, mtArguments) GrowableArray<ModuleXPatchPath*>(10, true);
|
||||
// Create GrowableArray lazily, only if --patch-module has been specified
|
||||
if (_patch_mod_prefix == NULL) {
|
||||
_patch_mod_prefix = new (ResourceObj::C_HEAP, mtArguments) GrowableArray<ModulePatchPath*>(10, true);
|
||||
}
|
||||
|
||||
_xpatchprefix->push(new ModuleXPatchPath(module_name, path));
|
||||
_patch_mod_prefix->push(new ModulePatchPath(module_name, path));
|
||||
}
|
||||
|
||||
// Remove all empty paths from the app classpath (if IgnoreEmptyClassPaths is enabled)
|
||||
@ -3441,6 +3538,15 @@ jint Arguments::finalize_vm_init_args() {
|
||||
return JNI_ERR;
|
||||
}
|
||||
|
||||
// Append the value of the last --add-modules option specified on the command line.
|
||||
// This needs to be done here, to prevent overwriting possible values written
|
||||
// to the jdk.module.addmods property by -javaagent and other options.
|
||||
if (add_modules_value != NULL) {
|
||||
if (!append_to_addmods_property(add_modules_value)) {
|
||||
return JNI_ENOMEM;
|
||||
}
|
||||
}
|
||||
|
||||
// This must be done after all arguments have been processed.
|
||||
// java_compiler() true means set to "NONE" or empty.
|
||||
if (java_compiler() && !xdebug_mode()) {
|
||||
@ -3795,9 +3901,9 @@ jint Arguments::parse_options_buffer(const char* name, char* buffer, const size_
|
||||
|
||||
void Arguments::set_shared_spaces_flags() {
|
||||
if (DumpSharedSpaces) {
|
||||
if (Arguments::get_xpatchprefix() != NULL) {
|
||||
if (Arguments::get_patch_mod_prefix() != NULL) {
|
||||
vm_exit_during_initialization(
|
||||
"Cannot use the following option when dumping the shared archive", "-Xpatch");
|
||||
"Cannot use the following option when dumping the shared archive: --patch-module");
|
||||
}
|
||||
|
||||
if (RequireSharedSpaces) {
|
||||
@ -4180,6 +4286,11 @@ jint Arguments::parse(const JavaVMInitArgs* initial_cmd_args) {
|
||||
hotspotrc, hotspotrc);
|
||||
}
|
||||
|
||||
if (needs_module_property_warning) {
|
||||
warning("Ignoring system property options whose names start with '-Djdk.module'."
|
||||
" They are reserved for internal use.");
|
||||
}
|
||||
|
||||
#if defined(_ALLBSD_SOURCE) || defined(AIX) // UseLargePages is not yet supported on BSD and AIX.
|
||||
UNSUPPORTED_OPTION(UseLargePages);
|
||||
#endif
|
||||
@ -4404,6 +4515,18 @@ int Arguments::PropertyList_count(SystemProperty* pl) {
|
||||
return count;
|
||||
}
|
||||
|
||||
// Return the number of readable properties.
|
||||
int Arguments::PropertyList_readable_count(SystemProperty* pl) {
|
||||
int count = 0;
|
||||
while(pl != NULL) {
|
||||
if (pl->is_readable()) {
|
||||
count++;
|
||||
}
|
||||
pl = pl->next();
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
const char* Arguments::PropertyList_get_value(SystemProperty *pl, const char* key) {
|
||||
assert(key != NULL, "just checking");
|
||||
SystemProperty* prop;
|
||||
@ -4413,6 +4536,27 @@ const char* Arguments::PropertyList_get_value(SystemProperty *pl, const char* ke
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Return the value of the requested property provided that it is a readable property.
|
||||
const char* Arguments::PropertyList_get_readable_value(SystemProperty *pl, const char* key) {
|
||||
assert(key != NULL, "just checking");
|
||||
SystemProperty* prop;
|
||||
// Return the property value if the keys match and the property is not internal or
|
||||
// it's the special internal property "jdk.boot.class.path.append".
|
||||
for (prop = pl; prop != NULL; prop = prop->next()) {
|
||||
if (strcmp(key, prop->key()) == 0) {
|
||||
if (!prop->internal()) {
|
||||
return prop->value();
|
||||
} else if (strcmp(key, "jdk.boot.class.path.append") == 0) {
|
||||
return prop->value();
|
||||
} else {
|
||||
// Property is internal and not jdk.boot.class.path.append so return NULL.
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* Arguments::PropertyList_get_key_at(SystemProperty *pl, int index) {
|
||||
int count = 0;
|
||||
const char* ret_val = NULL;
|
||||
@ -4457,11 +4601,12 @@ void Arguments::PropertyList_add(SystemProperty** plist, SystemProperty *new_p)
|
||||
}
|
||||
}
|
||||
|
||||
void Arguments::PropertyList_add(SystemProperty** plist, const char* k, const char* v) {
|
||||
void Arguments::PropertyList_add(SystemProperty** plist, const char* k, const char* v,
|
||||
bool writeable, bool internal) {
|
||||
if (plist == NULL)
|
||||
return;
|
||||
|
||||
SystemProperty* new_p = new SystemProperty(k, v, true);
|
||||
SystemProperty* new_p = new SystemProperty(k, v, writeable, internal);
|
||||
PropertyList_add(plist, new_p);
|
||||
}
|
||||
|
||||
@ -4470,7 +4615,9 @@ void Arguments::PropertyList_add(SystemProperty *element) {
|
||||
}
|
||||
|
||||
// This add maintains unique property key in the list.
|
||||
void Arguments::PropertyList_unique_add(SystemProperty** plist, const char* k, const char* v, jboolean append) {
|
||||
void Arguments::PropertyList_unique_add(SystemProperty** plist, const char* k, const char* v,
|
||||
PropertyAppendable append, PropertyWriteable writeable,
|
||||
PropertyInternal internal) {
|
||||
if (plist == NULL)
|
||||
return;
|
||||
|
||||
@ -4478,16 +4625,16 @@ void Arguments::PropertyList_unique_add(SystemProperty** plist, const char* k, c
|
||||
SystemProperty* prop;
|
||||
for (prop = *plist; prop != NULL; prop = prop->next()) {
|
||||
if (strcmp(k, prop->key()) == 0) {
|
||||
if (append) {
|
||||
if (append == AppendProperty) {
|
||||
prop->append_value(v);
|
||||
} else {
|
||||
prop->set_writeable_value(v);
|
||||
prop->set_value(v);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
PropertyList_add(plist, k, v);
|
||||
PropertyList_add(plist, k, v, writeable == WriteableProperty, internal == InternalProperty);
|
||||
}
|
||||
|
||||
// Copies src into buf, replacing "%%" with "%" and "%p" with pid
|
||||
|
||||
@ -43,7 +43,7 @@ extern "C" {
|
||||
|
||||
// PathString is used as:
|
||||
// - the underlying value for a SystemProperty
|
||||
// - the path portion of an -Xpatch module/path pair
|
||||
// - the path portion of an --patch-module module/path pair
|
||||
// - the string that represents the system boot class path, Arguments::_system_boot_class_path.
|
||||
class PathString : public CHeapObj<mtArguments> {
|
||||
protected:
|
||||
@ -107,13 +107,13 @@ class PathString : public CHeapObj<mtArguments> {
|
||||
}
|
||||
};
|
||||
|
||||
// ModuleXPatchPath records the module/path pair as specified to -Xpatch.
|
||||
class ModuleXPatchPath : public CHeapObj<mtInternal> {
|
||||
// ModulePatchPath records the module/path pair as specified to --patch-module.
|
||||
class ModulePatchPath : public CHeapObj<mtInternal> {
|
||||
private:
|
||||
char* _module_name;
|
||||
PathString* _path;
|
||||
public:
|
||||
ModuleXPatchPath(const char* module_name, const char* path) {
|
||||
ModulePatchPath(const char* module_name, const char* path) {
|
||||
assert(module_name != NULL && path != NULL, "Invalid module name or path value");
|
||||
size_t len = strlen(module_name) + 1;
|
||||
_module_name = AllocateHeap(len, mtInternal);
|
||||
@ -121,7 +121,7 @@ public:
|
||||
_path = new PathString(path);
|
||||
}
|
||||
|
||||
~ModuleXPatchPath() {
|
||||
~ModulePatchPath() {
|
||||
if (_module_name != NULL) {
|
||||
FreeHeap(_module_name);
|
||||
_module_name = NULL;
|
||||
@ -158,6 +158,10 @@ class SystemProperty : public PathString {
|
||||
SystemProperty* next() const { return _next; }
|
||||
void set_next(SystemProperty* next) { _next = next; }
|
||||
|
||||
bool is_readable() const {
|
||||
return !_internal || strcmp(_key, "jdk.boot.class.path.append") == 0;
|
||||
}
|
||||
|
||||
// A system property should only have its value set
|
||||
// via an external interface if it is a writeable property.
|
||||
// The internal, non-writeable property jdk.boot.class.path.append
|
||||
@ -325,6 +329,21 @@ class Arguments : AllStatic {
|
||||
arg_in_range = 0
|
||||
};
|
||||
|
||||
enum PropertyAppendable {
|
||||
AppendProperty,
|
||||
AddProperty
|
||||
};
|
||||
|
||||
enum PropertyWriteable {
|
||||
WriteableProperty,
|
||||
UnwriteableProperty
|
||||
};
|
||||
|
||||
enum PropertyInternal {
|
||||
InternalProperty,
|
||||
ExternalProperty
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
// a pointer to the flags file name if it is specified
|
||||
@ -348,18 +367,18 @@ class Arguments : AllStatic {
|
||||
static SystemProperty *_java_class_path;
|
||||
static SystemProperty *_jdk_boot_class_path_append;
|
||||
|
||||
// -Xpatch:module=<file>(<pathsep><file>)*
|
||||
// --patch-module=module=<file>(<pathsep><file>)*
|
||||
// Each element contains the associated module name, path
|
||||
// string pair as specified to -Xpatch.
|
||||
static GrowableArray<ModuleXPatchPath*>* _xpatchprefix;
|
||||
// string pair as specified to --patch-module.
|
||||
static GrowableArray<ModulePatchPath*>* _patch_mod_prefix;
|
||||
|
||||
// The constructed value of the system class path after
|
||||
// argument processing and JVMTI OnLoad additions via
|
||||
// calls to AddToBootstrapClassLoaderSearch. This is the
|
||||
// final form before ClassLoader::setup_bootstrap_search().
|
||||
// Note: since -Xpatch is a module name/path pair, the system
|
||||
// boot class path string no longer contains the "prefix" to
|
||||
// the boot class path base piece as it did when
|
||||
// Note: since --patch-module is a module name/path pair, the
|
||||
// system boot class path string no longer contains the "prefix"
|
||||
// to the boot class path base piece as it did when
|
||||
// -Xbootclasspath/p was supported.
|
||||
static PathString *_system_boot_class_path;
|
||||
|
||||
@ -462,7 +481,13 @@ class Arguments : AllStatic {
|
||||
static vfprintf_hook_t _vfprintf_hook;
|
||||
|
||||
// System properties
|
||||
static bool add_property(const char* prop);
|
||||
static bool add_property(const char* prop, PropertyWriteable writeable=WriteableProperty,
|
||||
PropertyInternal internal=ExternalProperty);
|
||||
|
||||
static bool create_property(const char* prop_name, const char* prop_value, PropertyInternal internal);
|
||||
static bool create_numbered_property(const char* prop_base_name, const char* prop_value, unsigned int count);
|
||||
|
||||
static int process_patch_mod_option(const char* patch_mod_tail, bool* patch_mod_javabase);
|
||||
|
||||
// Miscellaneous system property setter
|
||||
static bool append_to_addmods_property(const char* module_name);
|
||||
@ -500,7 +525,7 @@ class Arguments : AllStatic {
|
||||
static jint parse_vm_init_args(const JavaVMInitArgs *java_tool_options_args,
|
||||
const JavaVMInitArgs *java_options_args,
|
||||
const JavaVMInitArgs *cmd_line_args);
|
||||
static jint parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* xpatch_javabase, Flag::Flags origin);
|
||||
static jint parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_mod_javabase, Flag::Flags origin);
|
||||
static jint finalize_vm_init_args();
|
||||
static bool is_bad_option(const JavaVMOption* option, jboolean ignore, const char* option_type);
|
||||
|
||||
@ -708,16 +733,20 @@ class Arguments : AllStatic {
|
||||
// Property List manipulation
|
||||
static void PropertyList_add(SystemProperty *element);
|
||||
static void PropertyList_add(SystemProperty** plist, SystemProperty *element);
|
||||
static void PropertyList_add(SystemProperty** plist, const char* k, const char* v);
|
||||
static void PropertyList_unique_add(SystemProperty** plist, const char* k, const char* v) {
|
||||
PropertyList_unique_add(plist, k, v, false);
|
||||
}
|
||||
static void PropertyList_unique_add(SystemProperty** plist, const char* k, const char* v, jboolean append);
|
||||
static void PropertyList_add(SystemProperty** plist, const char* k, const char* v, bool writeable, bool internal);
|
||||
|
||||
static void PropertyList_unique_add(SystemProperty** plist, const char* k, const char* v,
|
||||
PropertyAppendable append, PropertyWriteable writeable,
|
||||
PropertyInternal internal);
|
||||
static const char* PropertyList_get_value(SystemProperty* plist, const char* key);
|
||||
static const char* PropertyList_get_readable_value(SystemProperty* plist, const char* key);
|
||||
static int PropertyList_count(SystemProperty* pl);
|
||||
static int PropertyList_readable_count(SystemProperty* pl);
|
||||
static const char* PropertyList_get_key_at(SystemProperty* pl,int index);
|
||||
static char* PropertyList_get_value_at(SystemProperty* pl,int index);
|
||||
|
||||
static bool is_internal_module_property(const char* option);
|
||||
|
||||
// Miscellaneous System property value getter and setters.
|
||||
static void set_dll_dir(const char *value) { _sun_boot_library_path->set_value(value); }
|
||||
static void set_java_home(const char *value) { _java_home->set_value(value); }
|
||||
@ -725,7 +754,7 @@ class Arguments : AllStatic {
|
||||
static void set_ext_dirs(char *value) { _ext_dirs = os::strdup_check_oom(value); }
|
||||
|
||||
// Set up the underlying pieces of the system boot class path
|
||||
static void add_xpatchprefix(const char *module_name, const char *path, bool* xpatch_javabase);
|
||||
static void add_patch_mod_prefix(const char *module_name, const char *path, bool* patch_mod_javabase);
|
||||
static void set_sysclasspath(const char *value, bool has_jimage) {
|
||||
// During start up, set by os::set_boot_path()
|
||||
assert(get_sysclasspath() == NULL, "System boot class path previously set");
|
||||
@ -737,7 +766,7 @@ class Arguments : AllStatic {
|
||||
_jdk_boot_class_path_append->append_value(value);
|
||||
}
|
||||
|
||||
static GrowableArray<ModuleXPatchPath*>* get_xpatchprefix() { return _xpatchprefix; }
|
||||
static GrowableArray<ModulePatchPath*>* get_patch_mod_prefix() { return _patch_mod_prefix; }
|
||||
static char* get_sysclasspath() { return _system_boot_class_path->value(); }
|
||||
static char* get_jdk_boot_class_path_append() { return _jdk_boot_class_path_append->value(); }
|
||||
static bool has_jimage() { return _has_jimage; }
|
||||
|
||||
@ -703,13 +703,15 @@ void defaultStream::start_log() {
|
||||
// System properties don't generally contain newlines, so don't bother with unparsing.
|
||||
outputStream *text = xs->text();
|
||||
for (SystemProperty* p = Arguments::system_properties(); p != NULL; p = p->next()) {
|
||||
// Print in two stages to avoid problems with long
|
||||
// keys/values.
|
||||
assert(p->key() != NULL, "p->key() is NULL");
|
||||
text->print_raw(p->key());
|
||||
text->put('=');
|
||||
assert(p->value() != NULL, "p->value() is NULL");
|
||||
text->print_raw_cr(p->value());
|
||||
if (p->is_readable()) {
|
||||
// Print in two stages to avoid problems with long
|
||||
// keys/values.
|
||||
text->print_raw(p->key());
|
||||
text->put('=');
|
||||
assert(p->value() != NULL, "p->value() is NULL");
|
||||
text->print_raw_cr(p->value());
|
||||
}
|
||||
}
|
||||
xs->tail("properties");
|
||||
}
|
||||
|
||||
@ -46,12 +46,12 @@ requires.properties= \
|
||||
vm.gc.Parallel \
|
||||
vm.gc.ConcMarkSweep
|
||||
|
||||
# Tests using jtreg 4.2 b02 features
|
||||
requiredVersion=4.2 b02
|
||||
# Tests using jtreg 4.2 b03 features
|
||||
requiredVersion=4.2 b03
|
||||
|
||||
# Path to libraries in the topmost test directory. This is needed so @library
|
||||
# does not need ../../ notation to reach them
|
||||
external.lib.roots = ../../
|
||||
|
||||
# Use new form of -Xpatch
|
||||
useNewXpatch=true
|
||||
# Use new module options
|
||||
useNewOptions=true
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
* -XX:CompileCommand=dontinline,compiler.unsafe.UnsafeGetConstantField::checkGetAddress
|
||||
* -XX:CompileCommand=dontinline,*::test*
|
||||
* -XX:+UseUnalignedAccesses
|
||||
* -XaddReads:java.base=ALL-UNNAMED
|
||||
* --add-reads=java.base=ALL-UNNAMED
|
||||
* compiler.unsafe.UnsafeGetConstantField
|
||||
*
|
||||
* @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions
|
||||
@ -50,7 +50,7 @@
|
||||
* -XX:CompileCommand=dontinline,*::test*
|
||||
* -XX:CompileCommand=inline,*Unsafe::get*
|
||||
* -XX:-UseUnalignedAccesses
|
||||
* -XaddReads:java.base=ALL-UNNAMED
|
||||
* --add-reads=java.base=ALL-UNNAMED
|
||||
* compiler.unsafe.UnsafeGetConstantField
|
||||
*/
|
||||
|
||||
|
||||
@ -88,7 +88,7 @@ public class TestMaxMinHeapFreeRatioFlags {
|
||||
(useXmaxf ? "-Xmaxf" + maxRatio / 100.0 : "-XX:MaxHeapFreeRatio=" + maxRatio),
|
||||
"-Xmx" + MAX_HEAP_SIZE,
|
||||
"-Xms" + HEAP_SIZE,
|
||||
"-XaddExports:java.base/jdk.internal.misc=ALL-UNNAMED",
|
||||
"--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED",
|
||||
"-XX:NewSize=" + NEW_SIZE,
|
||||
"-XX:MaxNewSize=" + MAX_NEW_SIZE,
|
||||
"-XX:" + (shrinkHeapInSteps ? '+' : '-') + "ShrinkHeapInSteps",
|
||||
@ -120,7 +120,7 @@ public class TestMaxMinHeapFreeRatioFlags {
|
||||
Collections.addAll(vmOptions,
|
||||
(useXminf ? "-Xminf" + minRatio / 100.0 : "-XX:MinHeapFreeRatio=" + minRatio),
|
||||
(useXmaxf ? "-Xmaxf" + maxRatio / 100.0 : "-XX:MaxHeapFreeRatio=" + maxRatio),
|
||||
"-XaddExports:java.base/jdk.internal.misc=ALL-UNNAMED",
|
||||
"--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED",
|
||||
"-version"
|
||||
);
|
||||
ProcessBuilder procBuilder = ProcessTools.createJavaProcessBuilder(vmOptions.toArray(new String[vmOptions.size()]));
|
||||
|
||||
@ -74,7 +74,7 @@ public class TestSurvivorRatioFlag {
|
||||
|
||||
Collections.addAll(vmOptions,
|
||||
"-Xbootclasspath/a:.",
|
||||
"-XaddExports:java.base/jdk.internal.misc=ALL-UNNAMED",
|
||||
"--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED",
|
||||
"-XX:+UnlockDiagnosticVMOptions",
|
||||
"-XX:+WhiteBoxAPI",
|
||||
"-XX:GCLockerEdenExpansionPercent=0",
|
||||
|
||||
@ -132,7 +132,7 @@ public class TestTargetSurvivorRatioFlag {
|
||||
LinkedList<String> vmOptions = new LinkedList<>(options);
|
||||
Collections.addAll(vmOptions,
|
||||
"-Xbootclasspath/a:.",
|
||||
"-XaddExports:java.base/jdk.internal.misc=ALL-UNNAMED",
|
||||
"--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED",
|
||||
"-XX:+UnlockDiagnosticVMOptions",
|
||||
"-XX:+WhiteBoxAPI",
|
||||
"-XX:+UseAdaptiveSizePolicy",
|
||||
|
||||
@ -53,7 +53,7 @@ public class TestShrinkAuxiliaryData {
|
||||
"-Xlog:gc=debug",
|
||||
"-XX:+UnlockDiagnosticVMOptions",
|
||||
"-XX:+WhiteBoxAPI",
|
||||
"-XaddExports:java.base/jdk.internal.misc=ALL-UNNAMED",
|
||||
"--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED",
|
||||
"-Xbootclasspath/a:.",
|
||||
};
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ public class BootstrapRedefine {
|
||||
"-Xmodule:java.base"),
|
||||
"mods/java.base");
|
||||
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xpatch:java.base=mods/java.base", "-version");
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("--patch-module=java.base=mods/java.base", "-version");
|
||||
new OutputAnalyzer(pb.start())
|
||||
.shouldContain("Incompatible definition of java.lang.Object")
|
||||
.shouldHaveExitValue(1);
|
||||
|
||||
@ -27,7 +27,7 @@ import java.io.File;
|
||||
* @test
|
||||
* @build BootClassPathAppendProp
|
||||
* @run main/othervm -Xbootclasspath/a:/usr/lib -showversion -Xbootclasspath/a:/i/dont/exist BootClassPathAppendProp
|
||||
* @run main/othervm -Xpatch:/not/here -Xbootclasspath/a:/i/may/exist BootClassPathAppendProp
|
||||
* @run main/othervm --patch-module=no_module=/not/here -Xbootclasspath/a:/i/may/exist BootClassPathAppendProp
|
||||
* @run main/othervm -Djdk.boot.class.path.append=newdir BootClassPathAppendProp
|
||||
* @run main/othervm BootClassPathAppendProp
|
||||
*/
|
||||
|
||||
@ -56,7 +56,7 @@ public class CreateCoredumpOnCrash {
|
||||
public static OutputAnalyzer runTest(String option) throws Exception {
|
||||
return new OutputAnalyzer(
|
||||
ProcessTools.createJavaProcessBuilder(
|
||||
"-Xmx64m", "-XX:-TransmitErrorReport", "-XaddExports:java.base/jdk.internal.misc=ALL-UNNAMED", option, Crasher.class.getName())
|
||||
"-Xmx64m", "-XX:-TransmitErrorReport", "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED", option, Crasher.class.getName())
|
||||
.start());
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ public class ProblematicFrameTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-Xmx64m", "-XX:-TransmitErrorReport", "-XaddExports:java.base/jdk.internal.misc=ALL-UNNAMED", "-XX:-CreateCoredumpOnCrash", Crasher.class.getName());
|
||||
"-Xmx64m", "-XX:-TransmitErrorReport", "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED", "-XX:-CreateCoredumpOnCrash", Crasher.class.getName());
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldNotContain("Exception in thread");
|
||||
output.shouldNotMatch("error occurred during error reporting \\(printing problematic frame\\)");
|
||||
|
||||
@ -160,10 +160,10 @@ public class BootAppendTests {
|
||||
|
||||
// Test #3: If a class on -Xbootclasspath/a is from a package defined in boot modules,
|
||||
// the class can be loaded from -Xbootclasspath/a when the module is excluded
|
||||
// using -limitmods. Verify the behavior is the same at runtime when CDS is
|
||||
// enabled.
|
||||
// using --limit-modules. Verify the behavior is the same at runtime when CDS
|
||||
// is enabled.
|
||||
//
|
||||
// The java.desktop module is excluded using -limitmods at runtime,
|
||||
// The java.desktop module is excluded using --limit-modules at runtime,
|
||||
// javax.sound.sampled.MyClass is archived from -Xbootclasspath/a. It can be
|
||||
// loaded from the archive at runtime.
|
||||
public static void testBootAppendExcludedModuleClass() throws Exception {
|
||||
@ -174,7 +174,7 @@ public class BootAppendTests {
|
||||
"-XX:+TraceClassLoading",
|
||||
"-cp", appJar,
|
||||
"-Xbootclasspath/a:" + bootAppendJar,
|
||||
"-limitmods", "java.base",
|
||||
"--limit-modules=java.base",
|
||||
"-Xshare:" + mode,
|
||||
APP_CLASS,
|
||||
BOOT_APPEND_MODULE_CLASS_NAME);
|
||||
@ -191,8 +191,8 @@ public class BootAppendTests {
|
||||
// Test #4: If a class on -Xbootclasspath/a has the same fully qualified
|
||||
// name as a class defined in boot modules, the class is loaded
|
||||
// from -Xbootclasspath/a when the boot module is excluded using
|
||||
// -limitmods. Verify the behavior is the same at runtime when CDS is
|
||||
// enabled.
|
||||
// --limit-modules. Verify the behavior is the same at runtime
|
||||
// when CDS is enabled.
|
||||
//
|
||||
// The org.omg.CORBA.Context is a boot module class. The class
|
||||
// on -Xbootclasspath/a that has the same fully-qualified name
|
||||
@ -206,7 +206,7 @@ public class BootAppendTests {
|
||||
"-XX:+TraceClassLoading",
|
||||
"-cp", appJar,
|
||||
"-Xbootclasspath/a:" + bootAppendJar,
|
||||
"-limitmods", "java.base",
|
||||
"--limit-modules=java.base",
|
||||
"-Xshare:" + mode,
|
||||
APP_CLASS,
|
||||
BOOT_APPEND_DUPLICATE_MODULE_CLASS_NAME);
|
||||
|
||||
@ -89,10 +89,11 @@ public class SASymbolTableTest {
|
||||
long pid = p.getPid();
|
||||
System.out.println("Attaching agent " + pid);
|
||||
ProcessBuilder tool = ProcessTools.createJavaProcessBuilder(
|
||||
"-XaddExports:jdk.hotspot.agent/sun.jvm.hotspot.oops=ALL-UNNAMED",
|
||||
"-XaddExports:jdk.hotspot.agent/sun.jvm.hotspot.memory=ALL-UNNAMED",
|
||||
"-XaddExports:jdk.hotspot.agent/sun.jvm.hotspot.runtime=ALL-UNNAMED",
|
||||
"-XaddExports:jdk.hotspot.agent/sun.jvm.hotspot.tools=ALL-UNNAMED",
|
||||
"--add-modules=jdk.hotspot.agent",
|
||||
"--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.oops=ALL-UNNAMED",
|
||||
"--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.memory=ALL-UNNAMED",
|
||||
"--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.runtime=ALL-UNNAMED",
|
||||
"--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.tools=ALL-UNNAMED",
|
||||
"SASymbolTableTestAgent",
|
||||
Long.toString(pid));
|
||||
OutputAnalyzer output = ProcessTools.executeProcess(tool);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 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
|
||||
@ -44,7 +44,7 @@ public class RangeCheck {
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||
true,
|
||||
"-Xmx32m",
|
||||
"-XaddExports:java.base/jdk.internal.misc=ALL-UNNAMED",
|
||||
"--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED",
|
||||
"-XX:-TransmitErrorReport",
|
||||
"-XX:-CreateCoredumpOnCrash",
|
||||
"-XX:-InlineUnsafeOps", // The compiler intrinsics doesn't have the assert
|
||||
|
||||
@ -98,7 +98,7 @@ public class GetSysPkgTest {
|
||||
ClassFileInstaller.writeClassToDisk("GetSysPkg_package/GetSysClass", klassbuf);
|
||||
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xbootclasspath/a:bl_dir",
|
||||
"-XaddExports:java.base/jdk.internal.loader=ALL-UNNAMED", "-cp", "." + File.pathSeparator +
|
||||
"--add-exports=java.base/jdk.internal.loader=ALL-UNNAMED", "-cp", "." + File.pathSeparator +
|
||||
System.getProperty("test.classes"), "GetSysPkgTest", "do_tests");
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldHaveExitValue(0);
|
||||
|
||||
75
hotspot/test/runtime/modules/IgnoreModulePropertiesTest.java
Normal file
75
hotspot/test/runtime/modules/IgnoreModulePropertiesTest.java
Normal file
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* 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 8136930
|
||||
* @summary Test that the VM ignores explicitly specified module internal properties.
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @library /testlibrary
|
||||
*/
|
||||
|
||||
import jdk.test.lib.*;
|
||||
|
||||
// Test that the VM ignores module related properties such as "jdk.module.addmods"
|
||||
// and jdk.module.addreads.0" that can only be set using module options.
|
||||
public class IgnoreModulePropertiesTest {
|
||||
|
||||
// Test that the specified property and its value are ignored. If the VM accepted
|
||||
// the property and value then an exception would be thrown because the value is
|
||||
// bogus for that property. But, since the property is ignored no exception is
|
||||
// thrown.
|
||||
public static void testProperty(String prop, String value) throws Exception {
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-D" + prop + "=" + value, "-version");
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldContain("java version ");
|
||||
output.shouldHaveExitValue(0);
|
||||
|
||||
// Ensure that the property and its value aren't available.
|
||||
if (System.getProperty(prop) != null) {
|
||||
throw new RuntimeException(
|
||||
"Unexpected non-null value for property " + prop);
|
||||
}
|
||||
}
|
||||
|
||||
// For options of the form "option=value", check that an exception gets thrown for
|
||||
// the illegal value and then check that its corresponding property is handled
|
||||
// correctly.
|
||||
public static void testOption(String option, String value,
|
||||
String prop, String result) throws Exception {
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||
option + "=" + value, "-version");
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldContain(result);
|
||||
testProperty(prop, value);
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
testOption("--add-modules", "java.sqlx", "jdk.module.addmods", "java.lang.module.ResolutionException");
|
||||
testOption("--limit-modules", "java.sqlx", "jdk.module.limitmods", "java.lang.module.ResolutionException");
|
||||
testOption("--add-reads", "xyzz=yyzd", "jdk.module.addreads.0", "java.lang.RuntimeException");
|
||||
testOption("--add-exports", "java.base/xyzz=yyzd", "jdk.module.addexports.0", "java.lang.RuntimeException");
|
||||
testOption("--patch-module", "=d", "jdk.module.patch.0", "IllegalArgumentException");
|
||||
}
|
||||
}
|
||||
54
hotspot/test/runtime/modules/ModuleOptionsTest.java
Normal file
54
hotspot/test/runtime/modules/ModuleOptionsTest.java
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* 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 8136930
|
||||
* @summary Test that the VM only recognizes the last specified --add-modules
|
||||
* and --list-modules options
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @library /testlibrary
|
||||
*/
|
||||
|
||||
import jdk.test.lib.*;
|
||||
|
||||
// Test that the VM behaves correctly when processing module related options.
|
||||
public class ModuleOptionsTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
// Test that last --add-modules is the only one recognized. No exception
|
||||
// should be thrown.
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||
"--add-modules=i_dont_exist", "--add-modules=java.base", "-version");
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldHaveExitValue(0);
|
||||
|
||||
// Test that last --limit-modules is the only one recognized. No exception
|
||||
// should be thrown.
|
||||
pb = ProcessTools.createJavaProcessBuilder(
|
||||
"--limit-modules=i_dont_exist", "--limit-modules=java.base", "-version");
|
||||
output = new OutputAnalyzer(pb.start());
|
||||
output.shouldHaveExitValue(0);
|
||||
}
|
||||
}
|
||||
60
hotspot/test/runtime/modules/ModuleOptionsWarn.java
Normal file
60
hotspot/test/runtime/modules/ModuleOptionsWarn.java
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* 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 8162415
|
||||
* @summary Test warnings for ignored properties.
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @library /testlibrary
|
||||
*/
|
||||
|
||||
import jdk.test.lib.*;
|
||||
|
||||
// Test that the VM behaves correctly when processing command line module system properties.
|
||||
public class ModuleOptionsWarn {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
// Test that a warning is issued for module related properties that get ignored.
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-XX:+PrintWarnings", "-Djdk.module.ignored", "-version");
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldContain("Ignoring system property option");
|
||||
output.shouldHaveExitValue(0);
|
||||
|
||||
// Test that a warning can be suppressed for module related properties that get ignored.
|
||||
pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-Djdk.module.ignored", "-XX:-PrintWarnings", "-version");
|
||||
output = new OutputAnalyzer(pb.start());
|
||||
output.shouldNotContain("Ignoring system property option");
|
||||
output.shouldHaveExitValue(0);
|
||||
|
||||
// Test that a warning is not issued for properties of the form "jdk.module.main"
|
||||
pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-XX:+PrintWarnings", "-Djdk.module.main.ignored", "-version");
|
||||
output = new OutputAnalyzer(pb.start());
|
||||
output.shouldNotContain("Ignoring system property option");
|
||||
output.shouldHaveExitValue(0);
|
||||
}
|
||||
}
|
||||
@ -62,8 +62,8 @@ public class ExportModuleStressTest {
|
||||
compiled = CompilerUtils.compile(
|
||||
SRC_DIR.resolve("jdk.translet"),
|
||||
MODS_DIR.resolve("jdk.translet"),
|
||||
"-XaddExports:jdk.test/test=jdk.translet",
|
||||
"-mp", MODS_DIR.toString());
|
||||
"--add-exports=jdk.test/test=jdk.translet",
|
||||
"-p", MODS_DIR.toString());
|
||||
if (!compiled) {
|
||||
throw new RuntimeException("Test failed to compile module jdk.translet");
|
||||
}
|
||||
@ -71,7 +71,7 @@ public class ExportModuleStressTest {
|
||||
// Sanity check that the test, jdk.test/test/Main.java
|
||||
// runs without error.
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-mp", MODS_DIR.toString(),
|
||||
"-p", MODS_DIR.toString(),
|
||||
"-m", "jdk.test/test.Main");
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldContain("failed: 0")
|
||||
|
||||
@ -62,8 +62,8 @@ public class ModuleStressGC {
|
||||
compiled = CompilerUtils.compile(
|
||||
SRC_DIR.resolve("jdk.translet"),
|
||||
MODS_DIR.resolve("jdk.translet"),
|
||||
"-XaddExports:jdk.test/test=jdk.translet",
|
||||
"-mp", MODS_DIR.toString());
|
||||
"--add-exports=jdk.test/test=jdk.translet",
|
||||
"-p", MODS_DIR.toString());
|
||||
if (!compiled) {
|
||||
throw new RuntimeException("Test failed to compile module jdk.translet");
|
||||
}
|
||||
@ -74,7 +74,7 @@ public class ModuleStressGC {
|
||||
// GC safepoints.
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-Xlog:modules=trace",
|
||||
"-mp", MODS_DIR.toString(),
|
||||
"-p", MODS_DIR.toString(),
|
||||
"-m", "jdk.test/test.MainGC");
|
||||
OutputAnalyzer oa = new OutputAnalyzer(pb.start());
|
||||
oa.shouldContain("package test defined in module jdk.test, exports list being walked")
|
||||
|
||||
@ -23,17 +23,17 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary Make sure -Xpatch works with multiple directories.
|
||||
* @summary Make sure --patch-module works with multiple directories.
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @library /testlibrary
|
||||
* @compile Xpatch2DirsMain.java
|
||||
* @run main Xpatch2Dirs
|
||||
* @compile PatchModule2DirsMain.java
|
||||
* @run main PatchModule2Dirs
|
||||
*/
|
||||
|
||||
import jdk.test.lib.*;
|
||||
import java.io.File;
|
||||
|
||||
public class Xpatch2Dirs {
|
||||
public class PatchModule2Dirs {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
String source1 = "package javax.naming.spi; " +
|
||||
@ -58,9 +58,9 @@ public class Xpatch2Dirs {
|
||||
"mods2/java.desktop");
|
||||
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-Xpatch:java.naming=mods/java.naming",
|
||||
"-Xpatch:java.desktop=mods2/java.desktop",
|
||||
"Xpatch2DirsMain", "javax.naming.spi.NamingManager", "java.beans.Encoder");
|
||||
"--patch-module=java.naming=mods/java.naming",
|
||||
"--patch-module=java.desktop=mods2/java.desktop",
|
||||
"PatchModule2DirsMain", "javax.naming.spi.NamingManager", "java.beans.Encoder");
|
||||
|
||||
OutputAnalyzer oa = new OutputAnalyzer(pb.start());
|
||||
oa.shouldContain("I pass one!");
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -21,9 +21,9 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
// This loads the class affected by the -Xpatch option. For the test to pass
|
||||
// it must load both classes from the -Xpatch directory, not the jimage file.
|
||||
public class Xpatch2DirsMain {
|
||||
// This loads the class affected by the --patch-module option. For the test to pass
|
||||
// it must load both classes from the --patch-module directory, not the jimage file.
|
||||
public class PatchModule2DirsMain {
|
||||
public static void main(String[] args) throws Exception {
|
||||
Class.forName(args[0]);
|
||||
Class.forName(args[1]);
|
||||
@ -25,22 +25,22 @@
|
||||
* @test
|
||||
* @library /testlibrary
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @run main XpatchCDS
|
||||
* @run main PatchModuleCDS
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import jdk.test.lib.*;
|
||||
|
||||
public class XpatchCDS {
|
||||
public class PatchModuleCDS {
|
||||
|
||||
public static void main(String args[]) throws Throwable {
|
||||
System.out.println("Test that -Xpatch and -Xshare:dump are incompatibable");
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xpatch:java.naming=mods/java.naming", "-Xshare:dump");
|
||||
System.out.println("Test that --patch-module and -Xshare:dump are incompatibable");
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("--patch-module=java.naming=mods/java.naming", "-Xshare:dump");
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldContain("Cannot use the following option when dumping the shared archive: -Xpatch");
|
||||
output.shouldContain("Cannot use the following option when dumping the shared archive: --patch-module");
|
||||
|
||||
System.out.println("Test that -Xpatch and -Xshare:on are incompatibable");
|
||||
String filename = "Xpatch.jsa";
|
||||
System.out.println("Test that --patch-module and -Xshare:on are incompatibable");
|
||||
String filename = "patch_module.jsa";
|
||||
pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-XX:+UnlockDiagnosticVMOptions",
|
||||
"-XX:SharedArchiveFile=" + filename,
|
||||
@ -52,10 +52,10 @@ public class XpatchCDS {
|
||||
"-XX:+UnlockDiagnosticVMOptions",
|
||||
"-XX:SharedArchiveFile=" + filename,
|
||||
"-Xshare:on",
|
||||
"-Xpatch:java.naming=mods/java.naming",
|
||||
"--patch-module=java.naming=mods/java.naming",
|
||||
"-version");
|
||||
output = new OutputAnalyzer(pb.start());
|
||||
output.shouldContain("The shared archive file cannot be used with -Xpatch");
|
||||
output.shouldContain("The shared archive file cannot be used with --patch-module");
|
||||
|
||||
output.shouldHaveExitValue(1);
|
||||
}
|
||||
@ -23,23 +23,23 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary VM exit initialization results if java.base is specificed more than once to Xpatch.
|
||||
* @summary VM exit initialization results if java.base is specificed more than once to --patch-module.
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @library /testlibrary
|
||||
*/
|
||||
|
||||
import jdk.test.lib.*;
|
||||
|
||||
public class XpatchDupJavaBase {
|
||||
public class PatchModuleDupJavaBase {
|
||||
// The VM should exit initialization if java.base is specified
|
||||
// more than once to -Xpatch.
|
||||
// more than once to --patch-module.
|
||||
public static void main(String args[]) throws Exception {
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-Xpatch:java.base=javabase_dir",
|
||||
"-Xpatch:java.base=javabase_dir",
|
||||
"--patch-module=java.base=javabase_dir",
|
||||
"--patch-module=java.base=javabase_dir",
|
||||
"-version");
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldContain("Cannot specify java.base more than once to -Xpatch");
|
||||
output.shouldContain("Cannot specify java.base more than once to --patch-module");
|
||||
output.shouldHaveExitValue(1);
|
||||
}
|
||||
}
|
||||
@ -23,26 +23,25 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary Module system initialization exception results if a module is specificed twice to Xpatch.
|
||||
* @summary Module system initialization exception results if a module is specificed twice to --patch-module.
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @library /testlibrary
|
||||
*/
|
||||
|
||||
import jdk.test.lib.*;
|
||||
|
||||
public class XpatchDupModule {
|
||||
public class PatchModuleDupModule {
|
||||
|
||||
// The module system initialization should generate an ExceptionInInitializerError
|
||||
// if -Xpatch is specified with the same module more than once.
|
||||
// if --patch-module is specified with the same module more than once.
|
||||
|
||||
public static void main(String args[]) throws Exception {
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-Xpatch:module1=module1_dir",
|
||||
"-Xpatch:module1=module1_dir",
|
||||
"--patch-module=module1=module1_dir",
|
||||
"--patch-module=module1=module1_dir",
|
||||
"-version");
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldContain("java.lang.ExceptionInInitializerError");
|
||||
output.shouldHaveExitValue(1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,16 +24,16 @@
|
||||
/*
|
||||
* @test
|
||||
* @bug 8130399
|
||||
* @summary Make sure -Xpatch works for java.base.
|
||||
* @summary Make sure --patch-module works for java.base.
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @library /testlibrary
|
||||
* @compile XpatchMain.java
|
||||
* @run main XpatchJavaBase
|
||||
* @compile PatchModuleMain.java
|
||||
* @run main PatchModuleJavaBase
|
||||
*/
|
||||
|
||||
import jdk.test.lib.*;
|
||||
|
||||
public class XpatchJavaBase {
|
||||
public class PatchModuleJavaBase {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
String source = "package java.lang; " +
|
||||
@ -47,8 +47,8 @@ public class XpatchJavaBase {
|
||||
InMemoryJavaCompiler.compile("java.lang.NewClass", source, "-Xmodule:java.base"),
|
||||
"mods/java.base");
|
||||
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xpatch:java.base=mods/java.base",
|
||||
"XpatchMain", "java.lang.NewClass");
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("--patch-module=java.base=mods/java.base",
|
||||
"PatchModuleMain", "java.lang.NewClass");
|
||||
|
||||
new OutputAnalyzer(pb.start())
|
||||
.shouldContain("I pass!")
|
||||
@ -21,9 +21,9 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
// This loads the class affected by the -Xpatch option. For the test to pass
|
||||
// it must load the class from the -Xpatch directory, not the jimage file.
|
||||
public class XpatchMain {
|
||||
// This loads the class affected by the --patch-module option. For the test to pass
|
||||
// it must load the class from the --patch-module directory, not the jimage file.
|
||||
public class PatchModuleMain {
|
||||
public static void main(String[] args) throws Exception {
|
||||
Class.forName(args[0]);
|
||||
}
|
||||
@ -24,16 +24,16 @@
|
||||
/*
|
||||
* @test
|
||||
* @bug 8130399
|
||||
* @summary Make sure -Xpatch works for modules besides java.base.
|
||||
* @summary Make sure --patch-module works for modules besides java.base.
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @library /testlibrary
|
||||
* @compile XpatchMain.java
|
||||
* @run main XpatchTest
|
||||
* @compile PatchModuleMain.java
|
||||
* @run main PatchModuleTest
|
||||
*/
|
||||
|
||||
import jdk.test.lib.*;
|
||||
|
||||
public class XpatchTest {
|
||||
public class PatchModuleTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
String source = "package javax.naming.spi; " +
|
||||
@ -47,8 +47,8 @@ public class XpatchTest {
|
||||
InMemoryJavaCompiler.compile("javax.naming.spi.NamingManager", source, "-Xmodule:java.naming"),
|
||||
"mods/java.naming");
|
||||
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xpatch:java.naming=mods/java.naming",
|
||||
"XpatchMain", "javax.naming.spi.NamingManager");
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("--patch-module=java.naming=mods/java.naming",
|
||||
"PatchModuleMain", "javax.naming.spi.NamingManager");
|
||||
|
||||
new OutputAnalyzer(pb.start())
|
||||
.shouldContain("I pass!")
|
||||
@ -23,18 +23,18 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary Make sure -Xpatch works when a jar file is specified for a module
|
||||
* @summary Make sure --patch-module works when a jar file is specified for a module
|
||||
* @library /testlibrary
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* jdk.jartool/sun.tools.jar
|
||||
* @build BasicJarBuilder
|
||||
* @compile XpatchMain.java
|
||||
* @run main XpatchTestJar
|
||||
* @compile PatchModuleMain.java
|
||||
* @run main PatchModuleTestJar
|
||||
*/
|
||||
|
||||
import jdk.test.lib.*;
|
||||
|
||||
public class XpatchTestJar {
|
||||
public class PatchModuleTestJar {
|
||||
private static String moduleJar;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
@ -72,9 +72,9 @@ public class XpatchTestJar {
|
||||
InMemoryJavaCompiler.compile("javax.naming.spi.NamingManager", source, "-Xmodule:java.naming"),
|
||||
System.getProperty("test.classes"));
|
||||
|
||||
// Supply -Xpatch with the name of the jar file for the module java.naming.
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xpatch:java.naming=" + moduleJar,
|
||||
"XpatchMain", "javax.naming.spi.NamingManager");
|
||||
// Supply --patch-module with the name of the jar file for the module java.naming.
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("--patch-module=java.naming=" + moduleJar,
|
||||
"PatchModuleMain", "javax.naming.spi.NamingManager");
|
||||
|
||||
new OutputAnalyzer(pb.start())
|
||||
.shouldContain("I pass!")
|
||||
@ -23,20 +23,20 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary Make sure -Xpatch works when a jar file and a directory is specified for a module
|
||||
* @summary Make sure --patch-module works when a jar file and a directory is specified for a module
|
||||
* @library /testlibrary
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* jdk.jartool/sun.tools.jar
|
||||
* @build BasicJarBuilder
|
||||
* @compile Xpatch2DirsMain.java
|
||||
* @run main XpatchTestJarDir
|
||||
* @compile PatchModule2DirsMain.java
|
||||
* @run main PatchModuleTestJarDir
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import jdk.test.lib.*;
|
||||
|
||||
public class XpatchTestJarDir {
|
||||
public class PatchModuleTestJarDir {
|
||||
private static String moduleJar;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
@ -88,12 +88,12 @@ public class XpatchTestJarDir {
|
||||
(System.getProperty("test.classes") + "/mods/java.naming"));
|
||||
|
||||
|
||||
// Supply -Xpatch with the name of the jar file for the module java.naming.
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xpatch:java.naming=" +
|
||||
// Supply --patch-module with the name of the jar file for the module java.naming.
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("--patch-module=java.naming=" +
|
||||
moduleJar +
|
||||
File.pathSeparator +
|
||||
System.getProperty("test.classes") + "/mods/java.naming",
|
||||
"Xpatch2DirsMain",
|
||||
"PatchModule2DirsMain",
|
||||
"javax.naming.spi.NamingManager1",
|
||||
"javax.naming.spi.NamingManager2");
|
||||
|
||||
@ -25,17 +25,17 @@
|
||||
* @test
|
||||
* @bug 8069469
|
||||
* @summary Make sure -Xlog:classload=info works properly with "modules" jimage,
|
||||
-Xpatch, and with -Xbootclasspath/a
|
||||
--patch-module, and with -Xbootclasspath/a
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @library /testlibrary
|
||||
* @compile XpatchMain.java
|
||||
* @run main XpatchTraceCL
|
||||
* @compile PatchModuleMain.java
|
||||
* @run main PatchModuleTraceCL
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import jdk.test.lib.*;
|
||||
|
||||
public class XpatchTraceCL {
|
||||
public class PatchModuleTraceCL {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
String source = "package javax.naming.spi; " +
|
||||
@ -45,39 +45,39 @@ public class XpatchTraceCL {
|
||||
" } " +
|
||||
"}";
|
||||
|
||||
// Test -Xlog:classload=info output for -Xpatch
|
||||
// Test -Xlog:classload=info output for --patch-module
|
||||
ClassFileInstaller.writeClassToDisk("javax/naming/spi/NamingManager",
|
||||
InMemoryJavaCompiler.compile("javax.naming.spi.NamingManager", source, "-Xmodule:java.naming"),
|
||||
"mods/java.naming");
|
||||
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xpatch:java.naming=mods/java.naming",
|
||||
"-Xlog:class+load=info", "XpatchMain", "javax.naming.spi.NamingManager");
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("--patch-module=java.naming=mods/java.naming",
|
||||
"-Xlog:class+load=info", "PatchModuleMain", "javax.naming.spi.NamingManager");
|
||||
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
// "modules" jimage case.
|
||||
output.shouldContain("[class,load] java.lang.Thread source: jrt:/java.base");
|
||||
// -Xpatch case.
|
||||
// --patch-module case.
|
||||
output.shouldContain("[class,load] javax.naming.spi.NamingManager source: mods/java.naming");
|
||||
// -cp case.
|
||||
output.shouldContain("[class,load] XpatchMain source: file");
|
||||
output.shouldContain("[class,load] PatchModuleMain source: file");
|
||||
|
||||
// Test -Xlog:classload=info output for -Xbootclasspath/a
|
||||
source = "package XpatchTraceCL_pkg; " +
|
||||
source = "package PatchModuleTraceCL_pkg; " +
|
||||
"public class ItIsI { " +
|
||||
" static { " +
|
||||
" System.out.println(\"I also pass!\"); " +
|
||||
" } " +
|
||||
"}";
|
||||
|
||||
ClassFileInstaller.writeClassToDisk("XpatchTraceCL_pkg/ItIsI",
|
||||
InMemoryJavaCompiler.compile("XpatchTraceCL_pkg.ItIsI", source),
|
||||
ClassFileInstaller.writeClassToDisk("PatchModuleTraceCL_pkg/ItIsI",
|
||||
InMemoryJavaCompiler.compile("PatchModuleTraceCL_pkg.ItIsI", source),
|
||||
"xbcp");
|
||||
|
||||
pb = ProcessTools.createJavaProcessBuilder("-Xbootclasspath/a:xbcp",
|
||||
"-Xlog:class+load=info", "XpatchMain", "XpatchTraceCL_pkg.ItIsI");
|
||||
"-Xlog:class+load=info", "PatchModuleMain", "PatchModuleTraceCL_pkg.ItIsI");
|
||||
output = new OutputAnalyzer(pb.start());
|
||||
// -Xbootclasspath/a case.
|
||||
output.shouldContain("[class,load] XpatchTraceCL_pkg.ItIsI source: xbcp");
|
||||
output.shouldContain("[class,load] PatchModuleTraceCL_pkg.ItIsI source: xbcp");
|
||||
output.shouldHaveExitValue(0);
|
||||
}
|
||||
}
|
||||
@ -23,13 +23,13 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary Ensure that a newly introduced java.base package placed within the -Xpatch directory
|
||||
* is considered part of the boot loader's visibility boundary
|
||||
* @summary Ensure that a newly introduced java.base package placed within the --patch-module
|
||||
* directory is considered part of the boot loader's visibility boundary
|
||||
* @requires !(os.family == "windows")
|
||||
* @library /testlibrary
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.management
|
||||
* @run main/othervm XpatchVisibility
|
||||
* @run main/othervm PatchModuleVisibility
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
@ -38,7 +38,7 @@ import java.nio.file.Paths;
|
||||
|
||||
import jdk.test.lib.*;
|
||||
|
||||
public class XpatchVisibility {
|
||||
public class PatchModuleVisibility {
|
||||
|
||||
public static void main(String[] args) throws Throwable {
|
||||
|
||||
@ -55,19 +55,19 @@ public class XpatchVisibility {
|
||||
"public class Vis2_A {" +
|
||||
" public static void main(String args[]) throws Exception {" +
|
||||
// Try loading a class within a newly introduced java.base
|
||||
// package. Make sure the class can be found via -Xpatch.
|
||||
// package. Make sure the class can be found via --patch-module.
|
||||
" try {" +
|
||||
" p2.Vis2_B b = new p2.Vis2_B();" +
|
||||
" if (b.getClass().getClassLoader() != null) {" +
|
||||
" throw new RuntimeException(\"XpatchVisibility FAILED - class B " +
|
||||
" throw new RuntimeException(\"PatchModuleVisibility FAILED - class B " +
|
||||
"should be loaded by boot class loader\\n\");" +
|
||||
" }" +
|
||||
" b.m();" +
|
||||
" } catch (Throwable e) {" +
|
||||
" throw new RuntimeException(\"XpatchVisibility FAILED - test " +
|
||||
" throw new RuntimeException(\"PatchModuleVisibility FAILED - test " +
|
||||
"should not throw an error or exception\\n\");" +
|
||||
" }" +
|
||||
" System.out.println(\"XpatchVisibility PASSED\\n\");" +
|
||||
" System.out.println(\"PatchModuleVisibility PASSED\\n\");" +
|
||||
" }" +
|
||||
"}";
|
||||
|
||||
@ -83,8 +83,8 @@ public class XpatchVisibility {
|
||||
"p2" + File.separator + "Vis2_B.class"));
|
||||
|
||||
new OutputAnalyzer(ProcessTools.createJavaProcessBuilder(
|
||||
"-Xpatch:java.base=mods2/java.base",
|
||||
"-XaddExports:java.base/p2=ALL-UNNAMED",
|
||||
"--patch-module=java.base=mods2/java.base",
|
||||
"--add-exports=java.base/p2=ALL-UNNAMED",
|
||||
"Vis2_A")
|
||||
.start()).shouldHaveExitValue(0);
|
||||
}
|
||||
@ -50,7 +50,7 @@ public class XbootcpNoVisibility {
|
||||
// Try loading a class within a named package in a module which has been defined
|
||||
// to the boot loader. In this situation, the class should only be attempted
|
||||
// to be loaded from the boot loader's module path which consists of:
|
||||
// [-Xpatch]; exploded build | "modules" jimage
|
||||
// [--patch-module]; exploded build | "modules" jimage
|
||||
//
|
||||
// Since the class is located on the boot loader's append path via
|
||||
// -Xbootclasspath/a specification, it should not be found.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -27,7 +27,7 @@ import java.lang.module.ModuleDescriptor;
|
||||
|
||||
/**
|
||||
* A helper class intended to be injected into java.lang.reflect using the
|
||||
* java -Xpatch option. The helper class provides access to package private
|
||||
* java --patch-module option. The helper class provides access to package private
|
||||
* methods in java.lang.reflect.Module.
|
||||
*/
|
||||
|
||||
|
||||
@ -113,9 +113,10 @@ public class TestInstanceKlassSize {
|
||||
};
|
||||
String[] toolArgs = {
|
||||
"-XX:+UnlockDiagnosticVMOptions",
|
||||
"-XaddExports:jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED",
|
||||
"-XaddExports:jdk.hotspot.agent/sun.jvm.hotspot.utilities=ALL-UNNAMED",
|
||||
"-XaddExports:jdk.hotspot.agent/sun.jvm.hotspot.oops=ALL-UNNAMED",
|
||||
"--add-modules=jdk.hotspot.agent",
|
||||
"--add-exports=jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED",
|
||||
"--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.utilities=ALL-UNNAMED",
|
||||
"--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.oops=ALL-UNNAMED",
|
||||
"TestInstanceKlassSize",
|
||||
Long.toString(app.getPid())
|
||||
};
|
||||
|
||||
@ -107,9 +107,10 @@ public class TestInstanceKlassSizeForInterface {
|
||||
// Grab the pid from the current java process and pass it
|
||||
String[] toolArgs = {
|
||||
"-XX:+UnlockDiagnosticVMOptions",
|
||||
"-XaddExports:jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED",
|
||||
"-XaddExports:jdk.hotspot.agent/sun.jvm.hotspot.utilities=ALL-UNNAMED",
|
||||
"-XaddExports:jdk.hotspot.agent/sun.jvm.hotspot.oops=ALL-UNNAMED",
|
||||
"--add-modules=jdk.hotspot.agent",
|
||||
"--add-exports=jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED",
|
||||
"--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.utilities=ALL-UNNAMED",
|
||||
"--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.oops=ALL-UNNAMED",
|
||||
"TestInstanceKlassSizeForInterface",
|
||||
Long.toString(ProcessTools.getProcessId())
|
||||
};
|
||||
|
||||
@ -87,7 +87,7 @@ public class JMapHProfLargeHeapTest {
|
||||
String expectedFormat) throws Exception, IOException,
|
||||
InterruptedException, FileNotFoundException {
|
||||
ProcessBuilder procBuilder = ProcessTools.createJavaProcessBuilder(
|
||||
"-XaddExports:java.management/sun.management=ALL-UNNAMED", vmArgs, "JMapHProfLargeHeapProc", String.valueOf(heapSize));
|
||||
"--add-exports=java.management/sun.management=ALL-UNNAMED", vmArgs, "JMapHProfLargeHeapProc", String.valueOf(heapSize));
|
||||
procBuilder.redirectError(ProcessBuilder.Redirect.INHERIT);
|
||||
Process largeHeapProc = procBuilder.start();
|
||||
|
||||
|
||||
@ -58,10 +58,10 @@ cleantmp:
|
||||
|
||||
ctw.jar: filelist wb.jar
|
||||
@mkdir -p $(OUTPUT_DIR)
|
||||
$(JAVAC) -XaddExports:java.base/jdk.internal.jimage=ALL-UNNAMED \
|
||||
-XaddExports:java.base/jdk.internal.misc=ALL-UNNAMED \
|
||||
-XaddExports:java.base/jdk.internal.reflect=ALL-UNNAMED \
|
||||
-sourcepath $(SRC_DIR) -d $(OUTPUT_DIR) -cp wb.jar @filelist
|
||||
$(JAVAC) --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 \
|
||||
-sourcepath $(SRC_DIR) -d $(OUTPUT_DIR) -cp wb.jar @filelist
|
||||
$(JAR) --create --file=$@ --main-class $(MAIN_CLASS) -C $(OUTPUT_DIR) .
|
||||
|
||||
wb.jar: wb_filelist
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
@ -95,10 +95,10 @@ manifest:
|
||||
@echo 'Main-Class: jdk.test.lib.jittester.Automatic' >> $(MANIFEST)
|
||||
|
||||
compile_testlib: INIT
|
||||
$(JAVAC) -XDignore.symbol.file -XaddExports:java.base/jdk.internal.misc=ALL-UNNAMED -XaddExports:java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED -Xlint $(TESTLIBRARY_SRC_FILES) -d $(CLASSES_DIR)
|
||||
$(JAVAC) -XDignore.symbol.file --add-exports=java.base/jdk.internal.misc=ALL-UNNAMED --add-exports=java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED -Xlint $(TESTLIBRARY_SRC_FILES) -d $(CLASSES_DIR)
|
||||
|
||||
COMPILE: INIT filelist compile_testlib
|
||||
$(JAVAC) -cp $(CLASSES_DIR) -XDignore.symbol.file -XaddExports:java.base/jdk.internal.misc=ALL-UNNAMED -XaddExports:java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED -Xlint -sourcepath $(SRC_DIR) -d $(CLASSES_DIR) @filelist
|
||||
$(JAVAC) -cp $(CLASSES_DIR) -XDignore.symbol.file --add-exports=java.base/jdk.internal.misc=ALL-UNNAMED --add-exports=java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED -Xlint -sourcepath $(SRC_DIR) -d $(CLASSES_DIR) @filelist
|
||||
|
||||
filelist: $(SRC_FILES)
|
||||
@rm -f $@
|
||||
@ -109,7 +109,7 @@ INIT: $(DIST_DIR)
|
||||
$(shell if [ ! -d $(CLASSES_DIR) ]; then mkdir -p $(CLASSES_DIR); fi)
|
||||
|
||||
install: clean_testbase testgroup testroot copytestlibrary JAR cleantmp
|
||||
$(JAVA) -XaddExports:java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED -ea -jar $(DIST_JAR) $(APPLICATION_ARGS)
|
||||
$(JAVA) --add-exports=java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED -ea -jar $(DIST_JAR) $(APPLICATION_ARGS)
|
||||
|
||||
clean_testbase:
|
||||
@rm -rf $(TESTBASE_DIR)
|
||||
|
||||
@ -373,3 +373,4 @@ bdc3c0b737efbf899709eb3121ce760dcfb51151 jdk-9+127
|
||||
8a7681a9d70640ac7fbf05c28f53c1d51d8d00a1 jdk-9+128
|
||||
74241304e87b0d463391a8ecab40979b5af86dc2 jdk-9+129
|
||||
e66cdc2de6b02443911d386fc9217b0d824d0686 jdk-9+130
|
||||
874082a9b565a7092a40bfa934a6e3e3c3455a60 jdk-9+131
|
||||
|
||||
@ -37,5 +37,3 @@ parser.quantifier.2=Invalid quantifier. Invalid quantity or a '}' is missing.
|
||||
parser.quantifier.3=Invalid quantifier. A digit or '}' is expected.
|
||||
parser.quantifier.4=Invalid quantifier. A min quantity must be <= a max quantity.
|
||||
parser.quantifier.5=Invalid quantifier. A quantity value overflow.
|
||||
null
|
||||
null
|
||||
|
||||
@ -23,4 +23,7 @@ modules=java.xml
|
||||
groups=TEST.groups
|
||||
|
||||
# Minimum jtreg version
|
||||
requiredVersion=4.2 b02
|
||||
requiredVersion=4.2 b03
|
||||
|
||||
# Use new module options
|
||||
useNewOptions=true
|
||||
|
||||
@ -37,7 +37,7 @@ public class BasePolicy implements ITestListener {
|
||||
try {
|
||||
JAXPPolicyManager.teardownPolicyManager();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Failed to teardonw the policy manager", e);
|
||||
throw new RuntimeException("Failed to teardown the policy manager", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -28,10 +28,8 @@ import static jaxp.library.JAXPTestUtilities.getSystemProperty;
|
||||
import static jaxp.library.JAXPTestUtilities.setSystemProperty;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.net.SocketTimeoutException;
|
||||
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import javax.xml.transform.URIResolver;
|
||||
@ -52,7 +50,7 @@ import org.xml.sax.SAXParseException;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8158084 8162438 8162442
|
||||
* @bug 8158084 8162438 8162442 8163535
|
||||
* @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
|
||||
* @run testng/othervm -DrunSecMngr=true catalog.CatalogSupport2
|
||||
* @run testng/othervm catalog.CatalogSupport2
|
||||
@ -97,7 +95,7 @@ public class CatalogSupport2 extends CatalogSupportBase {
|
||||
/*
|
||||
Verifies the Catalog support on SAXParser.
|
||||
*/
|
||||
@Test(dataProvider = "data_SAXC", expectedExceptions = FileNotFoundException.class)
|
||||
@Test(dataProvider = "data_SAXC", expectedExceptions = IOException.class)
|
||||
public void testSAXC(boolean setUseCatalog, boolean useCatalog, String catalog, String
|
||||
xml, MyHandler handler, String expected) throws Exception {
|
||||
testSAX(setUseCatalog, useCatalog, catalog, xml, handler, expected);
|
||||
@ -106,7 +104,7 @@ public class CatalogSupport2 extends CatalogSupportBase {
|
||||
/*
|
||||
Verifies the Catalog support on XMLReader.
|
||||
*/
|
||||
@Test(dataProvider = "data_SAXC", expectedExceptions = FileNotFoundException.class)
|
||||
@Test(dataProvider = "data_SAXC", expectedExceptions = IOException.class)
|
||||
public void testXMLReaderC(boolean setUseCatalog, boolean useCatalog, String catalog,
|
||||
String xml, MyHandler handler, String expected) throws Exception {
|
||||
testXMLReader(setUseCatalog, useCatalog, catalog, xml, handler, expected);
|
||||
@ -124,7 +122,7 @@ public class CatalogSupport2 extends CatalogSupportBase {
|
||||
/*
|
||||
Verifies the Catalog support on DOM parser.
|
||||
*/
|
||||
@Test(dataProvider = "data_DOMC", expectedExceptions = {FileNotFoundException.class, SocketTimeoutException.class})
|
||||
@Test(dataProvider = "data_DOMC", expectedExceptions = IOException.class)
|
||||
public void testDOMC(boolean setUseCatalog, boolean useCatalog, String catalog,
|
||||
String xml, MyHandler handler, String expected) throws Exception {
|
||||
testDOM(setUseCatalog, useCatalog, catalog, xml, handler, expected);
|
||||
@ -141,7 +139,7 @@ public class CatalogSupport2 extends CatalogSupportBase {
|
||||
testValidation(setUseCatalog, useCatalog, catalog, xsd, resolver) ;
|
||||
}
|
||||
|
||||
@Test(dataProvider = "data_ValidatorC", expectedExceptions = {SAXException.class, FileNotFoundException.class})
|
||||
@Test(dataProvider = "data_ValidatorC", expectedExceptions = {SAXException.class, IOException.class})
|
||||
public void testValidatorC(boolean setUseCatalog1, boolean setUseCatalog2, boolean useCatalog,
|
||||
Source source, LSResourceResolver resolver1, LSResourceResolver resolver2,
|
||||
String catalog1, String catalog2)
|
||||
|
||||
@ -27,10 +27,8 @@ import static jaxp.library.JAXPTestUtilities.getSystemProperty;
|
||||
import static jaxp.library.JAXPTestUtilities.setSystemProperty;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.net.SocketTimeoutException;
|
||||
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import javax.xml.transform.URIResolver;
|
||||
@ -51,7 +49,7 @@ import org.xml.sax.SAXParseException;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8158084 8162438 8162442
|
||||
* @bug 8158084 8162438 8162442 8163535
|
||||
* @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
|
||||
* @run testng/othervm -DrunSecMngr=true catalog.CatalogSupport3
|
||||
* @run testng/othervm catalog.CatalogSupport3
|
||||
@ -93,7 +91,7 @@ public class CatalogSupport3 extends CatalogSupportBase {
|
||||
/*
|
||||
Verifies the Catalog support on SAXParser.
|
||||
*/
|
||||
@Test(dataProvider = "data_SAXC", expectedExceptions = FileNotFoundException.class)
|
||||
@Test(dataProvider = "data_SAXC", expectedExceptions = IOException.class)
|
||||
public void testSAXC(boolean setUseCatalog, boolean useCatalog, String catalog,
|
||||
String xml, MyHandler handler, String expected) throws Exception {
|
||||
testSAX(setUseCatalog, useCatalog, catalog, xml, handler, expected);
|
||||
@ -102,7 +100,7 @@ public class CatalogSupport3 extends CatalogSupportBase {
|
||||
/*
|
||||
Verifies the Catalog support on XMLReader.
|
||||
*/
|
||||
@Test(dataProvider = "data_SAXC", expectedExceptions = FileNotFoundException.class)
|
||||
@Test(dataProvider = "data_SAXC", expectedExceptions = IOException.class)
|
||||
public void testXMLReaderC(boolean setUseCatalog, boolean useCatalog, String catalog,
|
||||
String xml, MyHandler handler, String expected) throws Exception {
|
||||
testXMLReader(setUseCatalog, useCatalog, catalog, xml, handler, expected);
|
||||
@ -120,7 +118,7 @@ public class CatalogSupport3 extends CatalogSupportBase {
|
||||
/*
|
||||
Verifies the Catalog support on DOM parser.
|
||||
*/
|
||||
@Test(dataProvider = "data_DOMC", expectedExceptions = {FileNotFoundException.class, SocketTimeoutException.class})
|
||||
@Test(dataProvider = "data_DOMC", expectedExceptions = IOException.class)
|
||||
public void testDOMC(boolean setUseCatalog, boolean useCatalog, String catalog,
|
||||
String xml, MyHandler handler, String expected) throws Exception {
|
||||
testDOM(setUseCatalog, useCatalog, catalog, xml, handler, expected);
|
||||
@ -141,7 +139,7 @@ public class CatalogSupport3 extends CatalogSupportBase {
|
||||
@bug 8158084 8162438 these tests also verifies the fix for 8162438
|
||||
Verifies the Catalog support on the Schema Validator.
|
||||
*/
|
||||
@Test(dataProvider = "data_ValidatorC", expectedExceptions = {SAXException.class, FileNotFoundException.class})
|
||||
@Test(dataProvider = "data_ValidatorC", expectedExceptions = {SAXException.class, IOException.class})
|
||||
public void testValidatorC(boolean setUseCatalog1, boolean setUseCatalog2, boolean useCatalog,
|
||||
Source source, LSResourceResolver resolver1, LSResourceResolver resolver2,
|
||||
String catalog1, String catalog2)
|
||||
|
||||
@ -32,11 +32,10 @@ import java.util.concurrent.BrokenBarrierException;
|
||||
import java.util.concurrent.CyclicBarrier;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
@ -69,6 +68,7 @@ public class Bug6773084Test {
|
||||
private static final ExecutorService EXEC = Executors.newCachedThreadPool();
|
||||
|
||||
private static final CyclicBarrier BARRIER = new CyclicBarrier(NTHREADS);
|
||||
private static final int TIMEOUT = 110;
|
||||
|
||||
public static final String IN_FOLDER = Bug6773084Test.class.getResource("Bug6773084In").getPath();
|
||||
public static final String XSD_PATH = Bug6773084Test.class.getResource("Bug6773084.xsd").getPath();
|
||||
@ -93,20 +93,23 @@ public class Bug6773084Test {
|
||||
}
|
||||
});
|
||||
|
||||
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||
dbf.setNamespaceAware(true);
|
||||
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
EXEC.execute(new XMLValiddator(files[i], i));
|
||||
EXEC.execute(new XMLValiddator(dbf.newDocumentBuilder().parse(files[i]), i));
|
||||
}
|
||||
runWithAllPerm(() -> EXEC.shutdown());
|
||||
|
||||
EXEC.awaitTermination(TIMEOUT, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
private static class XMLValiddator implements Runnable {
|
||||
|
||||
private File file;
|
||||
private Document document;
|
||||
private int index;
|
||||
|
||||
public XMLValiddator(File file, int index) {
|
||||
this.file = file;
|
||||
public XMLValiddator(Document document, int index) {
|
||||
this.document = document;
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
@ -117,23 +120,14 @@ public class Bug6773084Test {
|
||||
BARRIER.await();
|
||||
System.out.println("Validating....");
|
||||
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
factory.setNamespaceAware(true);
|
||||
|
||||
DocumentBuilder builder = factory.newDocumentBuilder();
|
||||
Document document = builder.parse(file);
|
||||
|
||||
Validator validator = schema.newValidator();
|
||||
validator.setErrorHandler(new ErrorHandlerImpl());
|
||||
validator.validate(new DOMSource(document));
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (SAXException e) {
|
||||
e.printStackTrace();
|
||||
Assert.fail("Test failed.");
|
||||
} catch (ParserConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
} catch (BrokenBarrierException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InterruptedException e) {
|
||||
|
||||
@ -376,3 +376,4 @@ c42decd28bbfa817347112ed6053b5fbd30517a2 jdk-9+123
|
||||
fe4e11bd2423635dc0f5f5cb9a64eb2f2cce7f4c jdk-9+128
|
||||
46a02f57218e4a8c334dbccf656fb048f823f163 jdk-9+129
|
||||
39c6293131d91aec7f2f5120395e070a937b8858 jdk-9+130
|
||||
783e7e2c587f2c7e1b9998a46d90ec196ab2a195 jdk-9+131
|
||||
|
||||
@ -140,7 +140,7 @@ public class SchemaGenerator {
|
||||
aptargs.add("-cp");
|
||||
aptargs.add(setClasspath(options.classpath)); // set original classpath + jaxb-api to be visible to annotation processor
|
||||
|
||||
aptargs.add("-addmods");
|
||||
aptargs.add("--add-modules");
|
||||
aptargs.add("java.xml.bind");
|
||||
|
||||
if(options.targetDir!=null) {
|
||||
|
||||
@ -162,7 +162,7 @@ public class WsgenTool {
|
||||
boolean bootCP = useBootClasspath(EndpointReference.class) || useBootClasspath(XmlSeeAlso.class);
|
||||
List<String> args = new ArrayList<String>(6 + (bootCP ? 1 : 0) + (options.nocompile ? 1 : 0)
|
||||
+ (options.encoding != null ? 2 : 0));
|
||||
args.add("-addmods");
|
||||
args.add("--add-modules");
|
||||
args.add("java.xml.ws");
|
||||
args.add("-d");
|
||||
args.add(options.destDir.getAbsolutePath());
|
||||
|
||||
@ -525,7 +525,7 @@ public class WsimportTool {
|
||||
String classpathString = createClasspathString();
|
||||
boolean bootCP = useBootClasspath(EndpointContext.class) || useBootClasspath(JAXBPermission.class);
|
||||
List<String> args = new ArrayList<String>();
|
||||
args.add("-addmods");
|
||||
args.add("--add-modules");
|
||||
args.add("java.xml.ws");
|
||||
args.add("-d");
|
||||
args.add(classDir);
|
||||
|
||||
@ -374,3 +374,4 @@ c40c8739bcdc88892ff58ebee3fd8a3f287be94d jdk-9+123
|
||||
47699aa2e69ec2702542dc73eb01de3bfb61aea0 jdk-9+129
|
||||
6c827500e34587061af97ad6fef0e859280255c5 jdk-9+130
|
||||
8c57f4c293bbc5609928308a6d91ba765760b5f9 jdk-9+131
|
||||
d5c70818cd8a82e76632c8c815bdb4f75f53aeaf jdk-9+132
|
||||
|
||||
@ -183,7 +183,7 @@ DEF_POLICY_DST := $(LIB_DST_DIR)/security/default.policy
|
||||
|
||||
DEF_POLICY_SRC_LIST := $(DEF_POLICY_SRC)
|
||||
|
||||
ifeq ($(OPENJDK_TARGET_OS), windows)
|
||||
ifneq ($(filter $(OPENJDK_TARGET_OS), windows solaris), )
|
||||
DEF_POLICY_SRC_LIST += $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/lib/security/default.policy
|
||||
endif
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -107,7 +107,7 @@ final class PBKDF2KeyImpl implements javax.crypto.interfaces.PBEKey {
|
||||
throw new InvalidKeySpecException("Key length is negative");
|
||||
}
|
||||
try {
|
||||
this.prf = Mac.getInstance(prfAlgo, SunJCE.getInstance());
|
||||
this.prf = Mac.getInstance(prfAlgo);
|
||||
} catch (NoSuchAlgorithmException nsae) {
|
||||
// not gonna happen; re-throw just in case
|
||||
InvalidKeySpecException ike = new InvalidKeySpecException();
|
||||
|
||||
@ -560,7 +560,7 @@ public class BufferedReader extends Reader {
|
||||
* @since 1.8
|
||||
*/
|
||||
public Stream<String> lines() {
|
||||
Iterator<String> iter = new Iterator<String>() {
|
||||
Iterator<String> iter = new Iterator<>() {
|
||||
String nextLine = null;
|
||||
|
||||
@Override
|
||||
|
||||
@ -187,7 +187,7 @@ public class ByteArrayOutputStream extends OutputStream {
|
||||
* @return the current contents of this output stream, as a byte array.
|
||||
* @see java.io.ByteArrayOutputStream#size()
|
||||
*/
|
||||
public synchronized byte toByteArray()[] {
|
||||
public synchronized byte[] toByteArray() {
|
||||
return Arrays.copyOf(buf, count);
|
||||
}
|
||||
|
||||
|
||||
@ -165,7 +165,7 @@ class CharArrayWriter extends Writer {
|
||||
*
|
||||
* @param csq
|
||||
* The character sequence to append. If {@code csq} is
|
||||
* {@code null}, then the four characters "{@code null}" are
|
||||
* {@code null}, then the four characters {@code "null"} are
|
||||
* appended to this writer.
|
||||
*
|
||||
* @return This writer
|
||||
@ -173,7 +173,7 @@ class CharArrayWriter extends Writer {
|
||||
* @since 1.5
|
||||
*/
|
||||
public CharArrayWriter append(CharSequence csq) {
|
||||
String s = (csq == null ? "null" : csq.toString());
|
||||
String s = String.valueOf(csq);
|
||||
write(s, 0, s.length());
|
||||
return this;
|
||||
}
|
||||
@ -193,7 +193,7 @@ class CharArrayWriter extends Writer {
|
||||
* The character sequence from which a subsequence will be
|
||||
* appended. If {@code csq} is {@code null}, then characters
|
||||
* will be appended as if {@code csq} contained the four
|
||||
* characters "{@code null}".
|
||||
* characters {@code "null"}.
|
||||
*
|
||||
* @param start
|
||||
* The index of the first character in the subsequence
|
||||
@ -212,9 +212,8 @@ class CharArrayWriter extends Writer {
|
||||
* @since 1.5
|
||||
*/
|
||||
public CharArrayWriter append(CharSequence csq, int start, int end) {
|
||||
String s = (csq == null ? "null" : csq).subSequence(start, end).toString();
|
||||
write(s, 0, s.length());
|
||||
return this;
|
||||
if (csq == null) csq = "null";
|
||||
return append(csq.subSequence(start, end));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -251,7 +250,7 @@ class CharArrayWriter extends Writer {
|
||||
*
|
||||
* @return an array of chars copied from the input data.
|
||||
*/
|
||||
public char toCharArray()[] {
|
||||
public char[] toCharArray() {
|
||||
synchronized (lock) {
|
||||
return Arrays.copyOf(buf, count);
|
||||
}
|
||||
|
||||
@ -228,13 +228,8 @@ abstract class FileSystem {
|
||||
static boolean useCanonPrefixCache = true;
|
||||
|
||||
private static boolean getBooleanProperty(String prop, boolean defaultVal) {
|
||||
String val = System.getProperty(prop);
|
||||
if (val == null) return defaultVal;
|
||||
if (val.equalsIgnoreCase("true")) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return Boolean.parseBoolean(System.getProperty(prop,
|
||||
String.valueOf(defaultVal)));
|
||||
}
|
||||
|
||||
static {
|
||||
|
||||
@ -1265,22 +1265,21 @@ public class ObjectInputStream
|
||||
WeakClassKey key = new WeakClassKey(cl, Caches.subclassAuditsQueue);
|
||||
Boolean result = Caches.subclassAudits.get(key);
|
||||
if (result == null) {
|
||||
result = Boolean.valueOf(auditSubclass(cl));
|
||||
result = auditSubclass(cl);
|
||||
Caches.subclassAudits.putIfAbsent(key, result);
|
||||
}
|
||||
if (result.booleanValue()) {
|
||||
return;
|
||||
if (!result) {
|
||||
sm.checkPermission(SUBCLASS_IMPLEMENTATION_PERMISSION);
|
||||
}
|
||||
sm.checkPermission(SUBCLASS_IMPLEMENTATION_PERMISSION);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs reflective checks on given subclass to verify that it doesn't
|
||||
* override security-sensitive non-final methods. Returns true if subclass
|
||||
* is "safe", false otherwise.
|
||||
* override security-sensitive non-final methods. Returns TRUE if subclass
|
||||
* is "safe", FALSE otherwise.
|
||||
*/
|
||||
private static boolean auditSubclass(final Class<?> subcl) {
|
||||
Boolean result = AccessController.doPrivileged(
|
||||
private static Boolean auditSubclass(Class<?> subcl) {
|
||||
return AccessController.doPrivileged(
|
||||
new PrivilegedAction<>() {
|
||||
public Boolean run() {
|
||||
for (Class<?> cl = subcl;
|
||||
@ -1303,7 +1302,6 @@ public class ObjectInputStream
|
||||
}
|
||||
}
|
||||
);
|
||||
return result.booleanValue();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1050,22 +1050,21 @@ public class ObjectOutputStream
|
||||
WeakClassKey key = new WeakClassKey(cl, Caches.subclassAuditsQueue);
|
||||
Boolean result = Caches.subclassAudits.get(key);
|
||||
if (result == null) {
|
||||
result = Boolean.valueOf(auditSubclass(cl));
|
||||
result = auditSubclass(cl);
|
||||
Caches.subclassAudits.putIfAbsent(key, result);
|
||||
}
|
||||
if (result.booleanValue()) {
|
||||
return;
|
||||
if (!result) {
|
||||
sm.checkPermission(SUBCLASS_IMPLEMENTATION_PERMISSION);
|
||||
}
|
||||
sm.checkPermission(SUBCLASS_IMPLEMENTATION_PERMISSION);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs reflective checks on given subclass to verify that it doesn't
|
||||
* override security-sensitive non-final methods. Returns true if subclass
|
||||
* is "safe", false otherwise.
|
||||
* override security-sensitive non-final methods. Returns TRUE if subclass
|
||||
* is "safe", FALSE otherwise.
|
||||
*/
|
||||
private static boolean auditSubclass(final Class<?> subcl) {
|
||||
Boolean result = AccessController.doPrivileged(
|
||||
private static Boolean auditSubclass(Class<?> subcl) {
|
||||
return AccessController.doPrivileged(
|
||||
new PrivilegedAction<>() {
|
||||
public Boolean run() {
|
||||
for (Class<?> cl = subcl;
|
||||
@ -1088,7 +1087,6 @@ public class ObjectOutputStream
|
||||
}
|
||||
}
|
||||
);
|
||||
return result.booleanValue();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1509,11 +1509,9 @@ public class ObjectStreamClass implements Serializable {
|
||||
private static String getPackageName(Class<?> cl) {
|
||||
String s = cl.getName();
|
||||
int i = s.lastIndexOf('[');
|
||||
if (i >= 0) {
|
||||
s = s.substring(i + 2);
|
||||
}
|
||||
i = s.lastIndexOf('.');
|
||||
return (i >= 0) ? s.substring(0, i) : "";
|
||||
i = (i < 0) ? 0 : i + 2;
|
||||
int j = s.lastIndexOf('.');
|
||||
return (i < j) ? s.substring(i, j) : "";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1535,14 +1533,14 @@ public class ObjectStreamClass implements Serializable {
|
||||
private static String getMethodSignature(Class<?>[] paramTypes,
|
||||
Class<?> retType)
|
||||
{
|
||||
StringBuilder sbuf = new StringBuilder();
|
||||
sbuf.append('(');
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append('(');
|
||||
for (int i = 0; i < paramTypes.length; i++) {
|
||||
appendClassSignature(sbuf, paramTypes[i]);
|
||||
appendClassSignature(sb, paramTypes[i]);
|
||||
}
|
||||
sbuf.append(')');
|
||||
appendClassSignature(sbuf, retType);
|
||||
return sbuf.toString();
|
||||
sb.append(')');
|
||||
appendClassSignature(sb, retType);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -233,22 +233,16 @@ public class OutputStreamWriter extends Writer {
|
||||
|
||||
@Override
|
||||
public Writer append(CharSequence csq, int start, int end) throws IOException {
|
||||
if (csq == null) {
|
||||
write("null".subSequence(start, end).toString());
|
||||
return this;
|
||||
} else {
|
||||
return append(csq.subSequence(start, end));
|
||||
}
|
||||
if (csq == null) csq = "null";
|
||||
return append(csq.subSequence(start, end));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Writer append(CharSequence csq) throws IOException {
|
||||
if (csq == null) {
|
||||
se.write("null");
|
||||
} else if (csq instanceof CharBuffer) {
|
||||
if (csq instanceof CharBuffer) {
|
||||
se.write((CharBuffer) csq);
|
||||
} else {
|
||||
se.write(csq.toString());
|
||||
se.write(String.valueOf(csq));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -568,7 +568,7 @@ public class PrintStream extends FilterOutputStream
|
||||
* @param b The {@code boolean} to be printed
|
||||
*/
|
||||
public void print(boolean b) {
|
||||
write(b ? "true" : "false");
|
||||
write(String.valueOf(b));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -663,10 +663,7 @@ public class PrintStream extends FilterOutputStream
|
||||
* @param s The {@code String} to be printed
|
||||
*/
|
||||
public void print(String s) {
|
||||
if (s == null) {
|
||||
s = "null";
|
||||
}
|
||||
write(s);
|
||||
write(String.valueOf(s));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1068,10 +1065,7 @@ public class PrintStream extends FilterOutputStream
|
||||
* @since 1.5
|
||||
*/
|
||||
public PrintStream append(CharSequence csq) {
|
||||
if (csq == null)
|
||||
print("null");
|
||||
else
|
||||
print(csq.toString());
|
||||
print(String.valueOf(csq));
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -1111,9 +1105,8 @@ public class PrintStream extends FilterOutputStream
|
||||
* @since 1.5
|
||||
*/
|
||||
public PrintStream append(CharSequence csq, int start, int end) {
|
||||
CharSequence cs = (csq == null ? "null" : csq);
|
||||
write(cs.subSequence(start, end).toString());
|
||||
return this;
|
||||
if (csq == null) csq = "null";
|
||||
return append(csq.subSequence(start, end));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -504,7 +504,7 @@ public class PrintWriter extends Writer {
|
||||
* @param b The {@code boolean} to be printed
|
||||
*/
|
||||
public void print(boolean b) {
|
||||
write(b ? "true" : "false");
|
||||
write(String.valueOf(b));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -599,10 +599,7 @@ public class PrintWriter extends Writer {
|
||||
* @param s The {@code String} to be printed
|
||||
*/
|
||||
public void print(String s) {
|
||||
if (s == null) {
|
||||
s = "null";
|
||||
}
|
||||
write(s);
|
||||
write(String.valueOf(s));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1005,10 +1002,7 @@ public class PrintWriter extends Writer {
|
||||
* @since 1.5
|
||||
*/
|
||||
public PrintWriter append(CharSequence csq) {
|
||||
if (csq == null)
|
||||
write("null");
|
||||
else
|
||||
write(csq.toString());
|
||||
write(String.valueOf(csq));
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -1047,9 +1041,8 @@ public class PrintWriter extends Writer {
|
||||
* @since 1.5
|
||||
*/
|
||||
public PrintWriter append(CharSequence csq, int start, int end) {
|
||||
CharSequence cs = (csq == null ? "null" : csq);
|
||||
write(cs.subSequence(start, end).toString());
|
||||
return this;
|
||||
if (csq == null) csq = "null";
|
||||
return append(csq.subSequence(start, end));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -65,12 +65,7 @@ class SequenceInputStream extends InputStream {
|
||||
*/
|
||||
public SequenceInputStream(Enumeration<? extends InputStream> e) {
|
||||
this.e = e;
|
||||
try {
|
||||
nextStream();
|
||||
} catch (IOException ex) {
|
||||
// This should never happen
|
||||
throw new Error("panic");
|
||||
}
|
||||
peekNextStream();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -86,16 +81,10 @@ class SequenceInputStream extends InputStream {
|
||||
*/
|
||||
public SequenceInputStream(InputStream s1, InputStream s2) {
|
||||
Vector<InputStream> v = new Vector<>(2);
|
||||
|
||||
v.addElement(s1);
|
||||
v.addElement(s2);
|
||||
e = v.elements();
|
||||
try {
|
||||
nextStream();
|
||||
} catch (IOException ex) {
|
||||
// This should never happen
|
||||
throw new Error("panic");
|
||||
}
|
||||
peekNextStream();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -105,14 +94,17 @@ class SequenceInputStream extends InputStream {
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
peekNextStream();
|
||||
}
|
||||
|
||||
private void peekNextStream() {
|
||||
if (e.hasMoreElements()) {
|
||||
in = (InputStream) e.nextElement();
|
||||
if (in == null)
|
||||
throw new NullPointerException();
|
||||
} else {
|
||||
in = null;
|
||||
}
|
||||
else in = null;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -108,6 +108,7 @@ class StringBufferInputStream extends InputStream {
|
||||
* <code>-1</code> if there is no more data because the end of
|
||||
* the stream has been reached.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public synchronized int read(byte b[], int off, int len) {
|
||||
if (b == null) {
|
||||
throw new NullPointerException();
|
||||
@ -126,12 +127,8 @@ class StringBufferInputStream extends InputStream {
|
||||
if (len <= 0) {
|
||||
return 0;
|
||||
}
|
||||
String s = buffer;
|
||||
int cnt = len;
|
||||
while (--cnt >= 0) {
|
||||
b[off++] = (byte)s.charAt(pos++);
|
||||
}
|
||||
|
||||
buffer.getBytes(pos, pos + len, b, off);
|
||||
pos += len;
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
@ -142,8 +142,8 @@ public class StringReader extends Reader {
|
||||
*/
|
||||
public boolean ready() throws IOException {
|
||||
synchronized (lock) {
|
||||
ensureOpen();
|
||||
return true;
|
||||
ensureOpen();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -139,7 +139,7 @@ public class StringWriter extends Writer {
|
||||
*
|
||||
* @param csq
|
||||
* The character sequence to append. If {@code csq} is
|
||||
* {@code null}, then the four characters "{@code null}" are
|
||||
* {@code null}, then the four characters {@code "null"} are
|
||||
* appended to this writer.
|
||||
*
|
||||
* @return This writer
|
||||
@ -147,10 +147,7 @@ public class StringWriter extends Writer {
|
||||
* @since 1.5
|
||||
*/
|
||||
public StringWriter append(CharSequence csq) {
|
||||
if (csq == null)
|
||||
write("null");
|
||||
else
|
||||
write(csq.toString());
|
||||
write(String.valueOf(csq));
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -170,7 +167,7 @@ public class StringWriter extends Writer {
|
||||
* The character sequence from which a subsequence will be
|
||||
* appended. If {@code csq} is {@code null}, then characters
|
||||
* will be appended as if {@code csq} contained the four
|
||||
* characters "{@code null}".
|
||||
* characters {@code "null"}.
|
||||
*
|
||||
* @param start
|
||||
* The index of the first character in the subsequence
|
||||
@ -189,9 +186,8 @@ public class StringWriter extends Writer {
|
||||
* @since 1.5
|
||||
*/
|
||||
public StringWriter append(CharSequence csq, int start, int end) {
|
||||
CharSequence cs = (csq == null ? "null" : csq);
|
||||
write(cs.subSequence(start, end).toString());
|
||||
return this;
|
||||
if (csq == null) csq = "null";
|
||||
return append(csq.subSequence(start, end));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -221,7 +221,7 @@ public abstract class Writer implements Appendable, Closeable, Flushable {
|
||||
*
|
||||
* @param csq
|
||||
* The character sequence to append. If {@code csq} is
|
||||
* {@code null}, then the four characters "{@code null}" are
|
||||
* {@code null}, then the four characters {@code "null"} are
|
||||
* appended to this writer.
|
||||
*
|
||||
* @return This writer
|
||||
@ -232,10 +232,7 @@ public abstract class Writer implements Appendable, Closeable, Flushable {
|
||||
* @since 1.5
|
||||
*/
|
||||
public Writer append(CharSequence csq) throws IOException {
|
||||
if (csq == null)
|
||||
write("null");
|
||||
else
|
||||
write(csq.toString());
|
||||
write(String.valueOf(csq));
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -256,7 +253,7 @@ public abstract class Writer implements Appendable, Closeable, Flushable {
|
||||
* The character sequence from which a subsequence will be
|
||||
* appended. If {@code csq} is {@code null}, then characters
|
||||
* will be appended as if {@code csq} contained the four
|
||||
* characters "{@code null}".
|
||||
* characters {@code "null"}.
|
||||
*
|
||||
* @param start
|
||||
* The index of the first character in the subsequence
|
||||
@ -278,9 +275,8 @@ public abstract class Writer implements Appendable, Closeable, Flushable {
|
||||
* @since 1.5
|
||||
*/
|
||||
public Writer append(CharSequence csq, int start, int end) throws IOException {
|
||||
CharSequence cs = (csq == null ? "null" : csq);
|
||||
write(cs.subSequence(start, end).toString());
|
||||
return this;
|
||||
if (csq == null) csq = "null";
|
||||
return append(csq.subSequence(start, end));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -36,7 +36,6 @@ import sun.invoke.util.Wrapper;
|
||||
import java.lang.invoke.LambdaForm.NamedFunction;
|
||||
import java.lang.invoke.MethodHandles.Lookup;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.function.Function;
|
||||
@ -308,7 +307,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
|
||||
/*non-public*/ char fieldTypeChar(int i) {
|
||||
return typeChars.charAt(i);
|
||||
}
|
||||
Object fieldSignature() {
|
||||
String fieldSignature() {
|
||||
return typeChars;
|
||||
}
|
||||
public Class<? extends BoundMethodHandle> fieldHolder() {
|
||||
|
||||
@ -27,6 +27,7 @@ package java.lang.invoke;
|
||||
|
||||
import java.util.Arrays;
|
||||
import static java.lang.invoke.LambdaForm.*;
|
||||
import static java.lang.invoke.LambdaForm.Kind.*;
|
||||
import static java.lang.invoke.MethodHandleStatics.*;
|
||||
|
||||
/**
|
||||
@ -96,14 +97,8 @@ abstract class DelegatingMethodHandle extends MethodHandle {
|
||||
int whichCache,
|
||||
Object constraint,
|
||||
NamedFunction getTargetFn) {
|
||||
String debugString;
|
||||
switch(whichCache) {
|
||||
case MethodTypeForm.LF_REBIND: debugString = "BMH.reinvoke"; break;
|
||||
case MethodTypeForm.LF_DELEGATE: debugString = "MH.delegate"; break;
|
||||
default: debugString = "MH.reinvoke"; break;
|
||||
}
|
||||
// No pre-action needed.
|
||||
return makeReinvokerForm(target, whichCache, constraint, debugString, true, getTargetFn, null);
|
||||
return makeReinvokerForm(target, whichCache, constraint, null, true, getTargetFn, null);
|
||||
}
|
||||
/** Create a LF which simply reinvokes a target of the given basic type. */
|
||||
static LambdaForm makeReinvokerForm(MethodHandle target,
|
||||
@ -114,6 +109,10 @@ abstract class DelegatingMethodHandle extends MethodHandle {
|
||||
NamedFunction getTargetFn,
|
||||
NamedFunction preActionFn) {
|
||||
MethodType mtype = target.type().basicType();
|
||||
Kind kind = whichKind(whichCache);
|
||||
if (debugString == null) {
|
||||
debugString = kind.defaultLambdaName;
|
||||
}
|
||||
boolean customized = (whichCache < 0 ||
|
||||
mtype.parameterSlotCount() > MethodType.MAX_MH_INVOKER_ARITY);
|
||||
boolean hasPreAction = (preActionFn != null);
|
||||
@ -145,13 +144,21 @@ abstract class DelegatingMethodHandle extends MethodHandle {
|
||||
targetArgs[0] = names[NEXT_MH]; // overwrite this MH with next MH
|
||||
names[REINVOKE] = new LambdaForm.Name(mtype, targetArgs);
|
||||
}
|
||||
form = new LambdaForm(debugString, ARG_LIMIT, names, forceInline);
|
||||
form = new LambdaForm(debugString, ARG_LIMIT, names, forceInline, kind);
|
||||
if (!customized) {
|
||||
form = mtype.form().setCachedLambdaForm(whichCache, form);
|
||||
}
|
||||
return form;
|
||||
}
|
||||
|
||||
private static Kind whichKind(int whichCache) {
|
||||
switch(whichCache) {
|
||||
case MethodTypeForm.LF_REBIND: return BOUND_REINVOKER;
|
||||
case MethodTypeForm.LF_DELEGATE: return DELEGATE;
|
||||
default: return REINVOKER;
|
||||
}
|
||||
}
|
||||
|
||||
static final NamedFunction NF_getTarget;
|
||||
static {
|
||||
try {
|
||||
@ -160,5 +167,13 @@ abstract class DelegatingMethodHandle extends MethodHandle {
|
||||
} catch (ReflectiveOperationException ex) {
|
||||
throw newInternalError(ex);
|
||||
}
|
||||
// The Holder class will contain pre-generated DelegatingMethodHandles resolved
|
||||
// speculatively using MemberName.getFactory().resolveOrNull. However, that
|
||||
// doesn't initialize the class, which subtly breaks inlining etc. By forcing
|
||||
// initialization of the Holder class we avoid these issues.
|
||||
UNSAFE.ensureClassInitialized(Holder.class);
|
||||
}
|
||||
|
||||
/* Placeholder class for DelegatingMethodHandles generated ahead of time */
|
||||
final class Holder {}
|
||||
}
|
||||
|
||||
@ -38,6 +38,7 @@ import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
import static java.lang.invoke.LambdaForm.*;
|
||||
import static java.lang.invoke.LambdaForm.Kind.*;
|
||||
import static java.lang.invoke.MethodHandleNatives.Constants.*;
|
||||
import static java.lang.invoke.MethodHandleStatics.UNSAFE;
|
||||
import static java.lang.invoke.MethodHandleStatics.newInternalError;
|
||||
@ -189,14 +190,15 @@ class DirectMethodHandle extends MethodHandle {
|
||||
static LambdaForm makePreparedLambdaForm(MethodType mtype, int which) {
|
||||
boolean needsInit = (which == LF_INVSTATIC_INIT);
|
||||
boolean doesAlloc = (which == LF_NEWINVSPECIAL);
|
||||
String linkerName, lambdaName;
|
||||
String linkerName;
|
||||
LambdaForm.Kind kind;
|
||||
switch (which) {
|
||||
case LF_INVVIRTUAL: linkerName = "linkToVirtual"; lambdaName = "DMH.invokeVirtual"; break;
|
||||
case LF_INVSTATIC: linkerName = "linkToStatic"; lambdaName = "DMH.invokeStatic"; break;
|
||||
case LF_INVSTATIC_INIT:linkerName = "linkToStatic"; lambdaName = "DMH.invokeStaticInit"; break;
|
||||
case LF_INVSPECIAL: linkerName = "linkToSpecial"; lambdaName = "DMH.invokeSpecial"; break;
|
||||
case LF_INVINTERFACE: linkerName = "linkToInterface"; lambdaName = "DMH.invokeInterface"; break;
|
||||
case LF_NEWINVSPECIAL: linkerName = "linkToSpecial"; lambdaName = "DMH.newInvokeSpecial"; break;
|
||||
case LF_INVVIRTUAL: linkerName = "linkToVirtual"; kind = DIRECT_INVOKE_VIRTUAL; break;
|
||||
case LF_INVSTATIC: linkerName = "linkToStatic"; kind = DIRECT_INVOKE_STATIC; break;
|
||||
case LF_INVSTATIC_INIT:linkerName = "linkToStatic"; kind = DIRECT_INVOKE_STATIC_INIT; break;
|
||||
case LF_INVSPECIAL: linkerName = "linkToSpecial"; kind = DIRECT_INVOKE_SPECIAL; break;
|
||||
case LF_INVINTERFACE: linkerName = "linkToInterface"; kind = DIRECT_INVOKE_INTERFACE; break;
|
||||
case LF_NEWINVSPECIAL: linkerName = "linkToSpecial"; kind = DIRECT_NEW_INVOKE_SPECIAL; break;
|
||||
default: throw new InternalError("which="+which);
|
||||
}
|
||||
|
||||
@ -240,11 +242,11 @@ class DirectMethodHandle extends MethodHandle {
|
||||
result = NEW_OBJ;
|
||||
}
|
||||
names[LINKER_CALL] = new Name(linker, outArgs);
|
||||
lambdaName += "_" + shortenSignature(basicTypeSignature(mtype));
|
||||
LambdaForm lform = new LambdaForm(lambdaName, ARG_LIMIT, names, result);
|
||||
String lambdaName = kind.defaultLambdaName + "_" + shortenSignature(basicTypeSignature(mtype));
|
||||
LambdaForm lform = new LambdaForm(lambdaName, ARG_LIMIT, names, result, kind);
|
||||
|
||||
// This is a tricky bit of code. Don't send it through the LF interpreter.
|
||||
lform.compileToBytecode(Holder.class);
|
||||
lform.compileToBytecode();
|
||||
return lform;
|
||||
}
|
||||
|
||||
@ -705,7 +707,7 @@ class DirectMethodHandle extends MethodHandle {
|
||||
}
|
||||
|
||||
static {
|
||||
// The DMH class will contain pre-generated DirectMethodHandles resolved
|
||||
// The Holder class will contain pre-generated DirectMethodHandles resolved
|
||||
// speculatively using MemberName.getFactory().resolveOrNull. However, that
|
||||
// doesn't initialize the class, which subtly breaks inlining etc. By forcing
|
||||
// initialization of the Holder class we avoid these issues.
|
||||
@ -713,5 +715,5 @@ class DirectMethodHandle extends MethodHandle {
|
||||
}
|
||||
|
||||
/* Placeholder class for DirectMethodHandles generated ahead of time */
|
||||
private final class Holder {}
|
||||
final class Holder {}
|
||||
}
|
||||
|
||||
@ -29,21 +29,56 @@ import java.util.Map;
|
||||
import jdk.internal.org.objectweb.asm.ClassWriter;
|
||||
import jdk.internal.org.objectweb.asm.Opcodes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* Helper class to assist the GenerateJLIClassesPlugin to get access to
|
||||
* generate classes ahead of time.
|
||||
*/
|
||||
class GenerateJLIClassesHelper {
|
||||
|
||||
static byte[] generateDMHClassBytes(String className,
|
||||
static byte[] generateDirectMethodHandleHolderClassBytes(String className,
|
||||
MethodType[] methodTypes, int[] types) {
|
||||
LambdaForm[] forms = new LambdaForm[methodTypes.length];
|
||||
String[] names = new String[methodTypes.length];
|
||||
for (int i = 0; i < forms.length; i++) {
|
||||
forms[i] = DirectMethodHandle.makePreparedLambdaForm(methodTypes[i],
|
||||
types[i]);
|
||||
methodTypes[i] = forms[i].methodType();
|
||||
names[i] = forms[i].kind.defaultLambdaName;
|
||||
}
|
||||
return generateCodeBytesForLFs(className, forms, methodTypes);
|
||||
return generateCodeBytesForLFs(className, names, forms);
|
||||
}
|
||||
|
||||
static byte[] generateDelegatingMethodHandleHolderClassBytes(String className,
|
||||
MethodType[] methodTypes) {
|
||||
|
||||
HashSet<MethodType> dedupSet = new HashSet<>();
|
||||
ArrayList<LambdaForm> forms = new ArrayList<>();
|
||||
ArrayList<String> names = new ArrayList<>();
|
||||
for (int i = 0; i < methodTypes.length; i++) {
|
||||
// generate methods representing the DelegatingMethodHandle
|
||||
if (dedupSet.add(methodTypes[i])) {
|
||||
// reinvokers are variant with the associated SpeciesData
|
||||
// and shape of the target LF, but we can easily pregenerate
|
||||
// the basic reinvokers associated with Species_L. Ultimately we
|
||||
// may want to consider pregenerating more of these, which will
|
||||
// require an even more complex naming scheme
|
||||
LambdaForm reinvoker = makeReinvokerFor(methodTypes[i]);
|
||||
forms.add(reinvoker);
|
||||
String speciesSig = BoundMethodHandle
|
||||
.speciesData(reinvoker).fieldSignature();
|
||||
assert(speciesSig.equals("L"));
|
||||
names.add(reinvoker.kind.defaultLambdaName + "_" + speciesSig);
|
||||
|
||||
LambdaForm delegate = makeDelegateFor(methodTypes[i]);
|
||||
forms.add(delegate);
|
||||
names.add(delegate.kind.defaultLambdaName);
|
||||
}
|
||||
}
|
||||
return generateCodeBytesForLFs(className,
|
||||
names.toArray(new String[0]),
|
||||
forms.toArray(new LambdaForm[0]));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -51,22 +86,45 @@ class GenerateJLIClassesHelper {
|
||||
* a class with a specified name.
|
||||
*/
|
||||
private static byte[] generateCodeBytesForLFs(String className,
|
||||
LambdaForm[] forms, MethodType[] types) {
|
||||
assert(forms.length == types.length);
|
||||
String[] names, LambdaForm[] forms) {
|
||||
|
||||
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS + ClassWriter.COMPUTE_FRAMES);
|
||||
cw.visit(Opcodes.V1_8, Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL + Opcodes.ACC_SUPER,
|
||||
className, null, InvokerBytecodeGenerator.INVOKER_SUPER_NAME, null);
|
||||
cw.visitSource(className.substring(className.lastIndexOf('/') + 1), null);
|
||||
|
||||
for (int i = 0; i < forms.length; i++) {
|
||||
InvokerBytecodeGenerator g
|
||||
= new InvokerBytecodeGenerator(className, forms[i], types[i]);
|
||||
g.setClassWriter(cw);
|
||||
g.addMethod();
|
||||
addMethod(className, names[i], forms[i],
|
||||
forms[i].methodType(), cw);
|
||||
}
|
||||
return cw.toByteArray();
|
||||
}
|
||||
|
||||
private static void addMethod(String className, String methodName, LambdaForm form,
|
||||
MethodType type, ClassWriter cw) {
|
||||
InvokerBytecodeGenerator g
|
||||
= new InvokerBytecodeGenerator(className, methodName, form, type);
|
||||
g.setClassWriter(cw);
|
||||
g.addMethod();
|
||||
}
|
||||
|
||||
private static LambdaForm makeReinvokerFor(MethodType type) {
|
||||
MethodHandle emptyHandle = MethodHandles.empty(type);
|
||||
return DelegatingMethodHandle.makeReinvokerForm(emptyHandle,
|
||||
MethodTypeForm.LF_REBIND,
|
||||
BoundMethodHandle.speciesData_L(),
|
||||
BoundMethodHandle.speciesData_L().getterFunction(0));
|
||||
}
|
||||
|
||||
private static LambdaForm makeDelegateFor(MethodType type) {
|
||||
MethodHandle handle = MethodHandles.empty(type);
|
||||
return DelegatingMethodHandle.makeReinvokerForm(
|
||||
handle,
|
||||
MethodTypeForm.LF_DELEGATE,
|
||||
DelegatingMethodHandle.class,
|
||||
DelegatingMethodHandle.NF_getTarget);
|
||||
}
|
||||
|
||||
static Map.Entry<String, byte[]> generateConcreteBMHClassBytes(
|
||||
final String types) {
|
||||
for (char c : types.toCharArray()) {
|
||||
|
||||
@ -46,6 +46,7 @@ import java.util.stream.Stream;
|
||||
|
||||
import static java.lang.invoke.LambdaForm.*;
|
||||
import static java.lang.invoke.LambdaForm.BasicType.*;
|
||||
import static java.lang.invoke.LambdaForm.Kind.*;
|
||||
import static java.lang.invoke.MethodHandleNatives.Constants.*;
|
||||
import static java.lang.invoke.MethodHandleStatics.*;
|
||||
|
||||
@ -125,9 +126,15 @@ class InvokerBytecodeGenerator {
|
||||
}
|
||||
|
||||
/** For generating customized code for a single LambdaForm. */
|
||||
InvokerBytecodeGenerator(String className, LambdaForm form, MethodType invokerType) {
|
||||
private InvokerBytecodeGenerator(String className, LambdaForm form, MethodType invokerType) {
|
||||
this(className, form.debugName, form, invokerType);
|
||||
}
|
||||
|
||||
/** For generating customized code for a single LambdaForm. */
|
||||
InvokerBytecodeGenerator(String className, String invokerName,
|
||||
LambdaForm form, MethodType invokerType) {
|
||||
this(form, form.names.length,
|
||||
className, form.debugName, invokerType);
|
||||
className, invokerName, invokerType);
|
||||
// Create an array to map name indexes to locals indexes.
|
||||
Name[] names = form.names;
|
||||
for (int i = 0, index = 0; i < localsMap.length; i++) {
|
||||
@ -597,10 +604,42 @@ class InvokerBytecodeGenerator {
|
||||
return c.getName().replace('.', '/');
|
||||
}
|
||||
|
||||
private static MemberName resolveFrom(String name, MethodType type, Class<?> holder) {
|
||||
MemberName member = new MemberName(holder, name, type, REF_invokeStatic);
|
||||
MemberName resolvedMember = MemberName.getFactory().resolveOrNull(REF_invokeStatic, member, holder);
|
||||
|
||||
return resolvedMember;
|
||||
}
|
||||
|
||||
private static MemberName lookupPregenerated(LambdaForm form) {
|
||||
if (form.customized != null) {
|
||||
// No pre-generated version for customized LF
|
||||
return null;
|
||||
}
|
||||
MethodType invokerType = form.methodType();
|
||||
String name = form.kind.methodName;
|
||||
switch (form.kind) {
|
||||
case BOUND_REINVOKER: {
|
||||
name = name + "_" + BoundMethodHandle.speciesData(form).fieldSignature();
|
||||
return resolveFrom(name, invokerType, DelegatingMethodHandle.Holder.class);
|
||||
}
|
||||
case DELEGATE: return resolveFrom(name, invokerType, DelegatingMethodHandle.Holder.class);
|
||||
case DIRECT_INVOKE_INTERFACE: // fall-through
|
||||
case DIRECT_INVOKE_SPECIAL: // fall-through
|
||||
case DIRECT_INVOKE_STATIC: // fall-through
|
||||
case DIRECT_INVOKE_STATIC_INIT: // fall-through
|
||||
case DIRECT_INVOKE_VIRTUAL: return resolveFrom(name, invokerType, DirectMethodHandle.Holder.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate customized bytecode for a given LambdaForm.
|
||||
*/
|
||||
static MemberName generateCustomizedCode(LambdaForm form, MethodType invokerType) {
|
||||
MemberName pregenerated = lookupPregenerated(form);
|
||||
if (pregenerated != null) return pregenerated; // pre-generated bytecode
|
||||
|
||||
InvokerBytecodeGenerator g = new InvokerBytecodeGenerator("MH", form, invokerType);
|
||||
return g.loadMethod(g.generateCustomizedCodeBytes());
|
||||
}
|
||||
|
||||
@ -41,6 +41,7 @@ import java.util.HashMap;
|
||||
import static java.lang.invoke.LambdaForm.BasicType.*;
|
||||
import static java.lang.invoke.MethodHandleNatives.Constants.REF_invokeStatic;
|
||||
import static java.lang.invoke.MethodHandleStatics.*;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* The symbolic, non-executable form of a method handle's invocation semantics.
|
||||
@ -127,6 +128,7 @@ class LambdaForm {
|
||||
final MethodHandle customized;
|
||||
@Stable final Name[] names;
|
||||
final String debugName;
|
||||
final Kind kind;
|
||||
MemberName vmentry; // low-level behavior, or null if not yet prepared
|
||||
private boolean isCompiled;
|
||||
|
||||
@ -266,12 +268,46 @@ class LambdaForm {
|
||||
}
|
||||
}
|
||||
|
||||
enum Kind {
|
||||
GENERIC(""),
|
||||
BOUND_REINVOKER("BMH.reinvoke"),
|
||||
REINVOKER("MH.reinvoke"),
|
||||
DELEGATE("MH.delegate"),
|
||||
DIRECT_INVOKE_VIRTUAL("DMH.invokeVirtual"),
|
||||
DIRECT_INVOKE_SPECIAL("DMH.invokeSpecial"),
|
||||
DIRECT_INVOKE_STATIC("DMH.invokeStatic"),
|
||||
DIRECT_NEW_INVOKE_SPECIAL("DMH.newInvokeSpecial"),
|
||||
DIRECT_INVOKE_INTERFACE("DMH.invokeInterface"),
|
||||
DIRECT_INVOKE_STATIC_INIT("DMH.invokeStaticInit");
|
||||
|
||||
final String defaultLambdaName;
|
||||
final String methodName;
|
||||
|
||||
private Kind(String defaultLambdaName) {
|
||||
this.defaultLambdaName = defaultLambdaName;
|
||||
int p = defaultLambdaName.indexOf('.');
|
||||
if (p > -1) {
|
||||
this.methodName = defaultLambdaName.substring(p + 1);
|
||||
} else {
|
||||
this.methodName = defaultLambdaName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LambdaForm(String debugName,
|
||||
int arity, Name[] names, int result) {
|
||||
this(debugName, arity, names, result, /*forceInline=*/true, /*customized=*/null);
|
||||
this(debugName, arity, names, result, /*forceInline=*/true, /*customized=*/null, Kind.GENERIC);
|
||||
}
|
||||
LambdaForm(String debugName,
|
||||
int arity, Name[] names, int result, Kind kind) {
|
||||
this(debugName, arity, names, result, /*forceInline=*/true, /*customized=*/null, kind);
|
||||
}
|
||||
LambdaForm(String debugName,
|
||||
int arity, Name[] names, int result, boolean forceInline, MethodHandle customized) {
|
||||
this(debugName, arity, names, result, forceInline, customized, Kind.GENERIC);
|
||||
}
|
||||
LambdaForm(String debugName,
|
||||
int arity, Name[] names, int result, boolean forceInline, MethodHandle customized, Kind kind) {
|
||||
assert(namesOK(arity, names));
|
||||
this.arity = arity;
|
||||
this.result = fixResult(result, names);
|
||||
@ -279,6 +315,7 @@ class LambdaForm {
|
||||
this.debugName = fixDebugName(debugName);
|
||||
this.forceInline = forceInline;
|
||||
this.customized = customized;
|
||||
this.kind = kind;
|
||||
int maxOutArity = normalize();
|
||||
if (maxOutArity > MethodType.MAX_MH_INVOKER_ARITY) {
|
||||
// Cannot use LF interpreter on very high arity expressions.
|
||||
@ -288,11 +325,15 @@ class LambdaForm {
|
||||
}
|
||||
LambdaForm(String debugName,
|
||||
int arity, Name[] names) {
|
||||
this(debugName, arity, names, LAST_RESULT, /*forceInline=*/true, /*customized=*/null);
|
||||
this(debugName, arity, names, LAST_RESULT, /*forceInline=*/true, /*customized=*/null, Kind.GENERIC);
|
||||
}
|
||||
LambdaForm(String debugName,
|
||||
int arity, Name[] names, boolean forceInline) {
|
||||
this(debugName, arity, names, LAST_RESULT, forceInline, /*customized=*/null);
|
||||
this(debugName, arity, names, LAST_RESULT, forceInline, /*customized=*/null, Kind.GENERIC);
|
||||
}
|
||||
LambdaForm(String debugName,
|
||||
int arity, Name[] names, boolean forceInline, Kind kind) {
|
||||
this(debugName, arity, names, LAST_RESULT, forceInline, /*customized=*/null, kind);
|
||||
}
|
||||
LambdaForm(String debugName,
|
||||
Name[] formals, Name[] temps, Name result) {
|
||||
@ -325,6 +366,7 @@ class LambdaForm {
|
||||
this.debugName = "LF.zero";
|
||||
this.forceInline = true;
|
||||
this.customized = null;
|
||||
this.kind = Kind.GENERIC;
|
||||
assert(nameRefsAreLegal());
|
||||
assert(isEmpty());
|
||||
String sig = null;
|
||||
@ -395,7 +437,7 @@ class LambdaForm {
|
||||
|
||||
/** Customize LambdaForm for a particular MethodHandle */
|
||||
LambdaForm customize(MethodHandle mh) {
|
||||
LambdaForm customForm = new LambdaForm(debugName, arity, names, result, forceInline, mh);
|
||||
LambdaForm customForm = new LambdaForm(debugName, arity, names, result, forceInline, mh, kind);
|
||||
if (COMPILE_THRESHOLD >= 0 && isCompiled) {
|
||||
// If shared LambdaForm has been compiled, compile customized version as well.
|
||||
customForm.compileToBytecode();
|
||||
@ -773,28 +815,6 @@ class LambdaForm {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate optimizable bytecode for this form after first looking for a
|
||||
* pregenerated version in a specified class.
|
||||
*/
|
||||
void compileToBytecode(Class<?> lookupClass) {
|
||||
if (vmentry != null && isCompiled) {
|
||||
return; // already compiled somehow
|
||||
}
|
||||
MethodType invokerType = methodType();
|
||||
assert(vmentry == null || vmentry.getMethodType().basicType().equals(invokerType));
|
||||
int dot = debugName.indexOf('.');
|
||||
String methodName = (dot > 0) ? debugName.substring(dot + 1) : debugName;
|
||||
MemberName member = new MemberName(lookupClass, methodName, invokerType, REF_invokeStatic);
|
||||
MemberName resolvedMember = MemberName.getFactory().resolveOrNull(REF_invokeStatic, member, lookupClass);
|
||||
if (resolvedMember != null) {
|
||||
vmentry = resolvedMember;
|
||||
isCompiled = true;
|
||||
} else {
|
||||
compileToBytecode();
|
||||
}
|
||||
}
|
||||
|
||||
private static void computeInitialPreparedForms() {
|
||||
// Find all predefined invokers and associate them with canonical empty lambda forms.
|
||||
for (MemberName m : MemberName.getFactory().getMethods(LambdaForm.class, false, null, null, null)) {
|
||||
|
||||
@ -1718,10 +1718,19 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] generateDMHClassBytes(String className,
|
||||
MethodType[] methodTypes, int[] types) {
|
||||
public byte[] generateDirectMethodHandleHolderClassBytes(
|
||||
String className, MethodType[] methodTypes, int[] types) {
|
||||
return GenerateJLIClassesHelper
|
||||
.generateDMHClassBytes(className, methodTypes, types);
|
||||
.generateDirectMethodHandleHolderClassBytes(
|
||||
className, methodTypes, types);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] generateDelegatingMethodHandleHolderClassBytes(
|
||||
String className, MethodType[] methodTypes) {
|
||||
return GenerateJLIClassesHelper
|
||||
.generateDelegatingMethodHandleHolderClassBytes(
|
||||
className, methodTypes);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -601,7 +601,7 @@ public abstract class Provider extends Properties {
|
||||
public synchronized Object compute(Object key, BiFunction<? super Object,
|
||||
? super Object, ? extends Object> remappingFunction) {
|
||||
check("putProviderProperty." + name);
|
||||
check("removeProviderProperty" + name);
|
||||
check("removeProviderProperty." + name);
|
||||
|
||||
if (debug != null) {
|
||||
debug.println("Compute " + name + " provider property " + key);
|
||||
@ -632,7 +632,7 @@ public abstract class Provider extends Properties {
|
||||
public synchronized Object computeIfAbsent(Object key, Function<? super Object,
|
||||
? extends Object> mappingFunction) {
|
||||
check("putProviderProperty." + name);
|
||||
check("removeProviderProperty" + name);
|
||||
check("removeProviderProperty." + name);
|
||||
|
||||
if (debug != null) {
|
||||
debug.println("ComputeIfAbsent " + name + " provider property " +
|
||||
@ -662,7 +662,7 @@ public abstract class Provider extends Properties {
|
||||
public synchronized Object computeIfPresent(Object key, BiFunction<? super Object,
|
||||
? super Object, ? extends Object> remappingFunction) {
|
||||
check("putProviderProperty." + name);
|
||||
check("removeProviderProperty" + name);
|
||||
check("removeProviderProperty." + name);
|
||||
|
||||
if (debug != null) {
|
||||
debug.println("ComputeIfPresent " + name + " provider property " +
|
||||
@ -695,7 +695,7 @@ public abstract class Provider extends Properties {
|
||||
public synchronized Object merge(Object key, Object value, BiFunction<? super Object,
|
||||
? super Object, ? extends Object> remappingFunction) {
|
||||
check("putProviderProperty." + name);
|
||||
check("removeProviderProperty" + name);
|
||||
check("removeProviderProperty." + name);
|
||||
|
||||
if (debug != null) {
|
||||
debug.println("Merge " + name + " provider property " + key);
|
||||
@ -904,8 +904,8 @@ public abstract class Provider extends Properties {
|
||||
if (!checkLegacy(key)) {
|
||||
return null;
|
||||
}
|
||||
legacyStrings.computeIfAbsent((String) key,
|
||||
(Function<? super String, ? extends String>) remappingFunction);
|
||||
legacyStrings.compute((String) key,
|
||||
(BiFunction<? super String,? super String, ? extends String>) remappingFunction);
|
||||
}
|
||||
return super.compute(key, remappingFunction);
|
||||
}
|
||||
|
||||
@ -399,7 +399,10 @@ public class DateFormatSymbols implements Serializable, Cloneable {
|
||||
* Calendar Elements in the Unicode Locale Data Markup Language
|
||||
* (LDML) specification</a> for more details.
|
||||
*
|
||||
* @return the month strings.
|
||||
* @return the month strings. Use
|
||||
* {@link java.util.Calendar#JANUARY Calendar.JANUARY},
|
||||
* {@link java.util.Calendar#FEBRUARY Calendar.FEBRUARY},
|
||||
* etc. to index the result array.
|
||||
*/
|
||||
public String[] getMonths() {
|
||||
return Arrays.copyOf(months, months.length);
|
||||
@ -407,7 +410,9 @@ public class DateFormatSymbols implements Serializable, Cloneable {
|
||||
|
||||
/**
|
||||
* Sets month strings. For example: "January", "February", etc.
|
||||
* @param newMonths the new month strings.
|
||||
* @param newMonths the new month strings. The array should
|
||||
* be indexed by {@link java.util.Calendar#JANUARY Calendar.JANUARY},
|
||||
* {@link java.util.Calendar#FEBRUARY Calendar.FEBRUARY}, etc.
|
||||
*/
|
||||
public void setMonths(String[] newMonths) {
|
||||
months = Arrays.copyOf(newMonths, newMonths.length);
|
||||
@ -427,7 +432,10 @@ public class DateFormatSymbols implements Serializable, Cloneable {
|
||||
* Calendar Elements in the Unicode Locale Data Markup Language
|
||||
* (LDML) specification</a> for more details.
|
||||
*
|
||||
* @return the short month strings.
|
||||
* @return the short month strings. Use
|
||||
* {@link java.util.Calendar#JANUARY Calendar.JANUARY},
|
||||
* {@link java.util.Calendar#FEBRUARY Calendar.FEBRUARY},
|
||||
* etc. to index the result array.
|
||||
*/
|
||||
public String[] getShortMonths() {
|
||||
return Arrays.copyOf(shortMonths, shortMonths.length);
|
||||
@ -435,7 +443,9 @@ public class DateFormatSymbols implements Serializable, Cloneable {
|
||||
|
||||
/**
|
||||
* Sets short month strings. For example: "Jan", "Feb", etc.
|
||||
* @param newShortMonths the new short month strings.
|
||||
* @param newShortMonths the new short month strings. The array should
|
||||
* be indexed by {@link java.util.Calendar#JANUARY Calendar.JANUARY},
|
||||
* {@link java.util.Calendar#FEBRUARY Calendar.FEBRUARY}, etc.
|
||||
*/
|
||||
public void setShortMonths(String[] newShortMonths) {
|
||||
shortMonths = Arrays.copyOf(newShortMonths, newShortMonths.length);
|
||||
@ -444,8 +454,10 @@ public class DateFormatSymbols implements Serializable, Cloneable {
|
||||
|
||||
/**
|
||||
* Gets weekday strings. For example: "Sunday", "Monday", etc.
|
||||
* @return the weekday strings. Use <code>Calendar.SUNDAY</code>,
|
||||
* <code>Calendar.MONDAY</code>, etc. to index the result array.
|
||||
* @return the weekday strings. Use
|
||||
* {@link java.util.Calendar#SUNDAY Calendar.SUNDAY},
|
||||
* {@link java.util.Calendar#MONDAY Calendar.MONDAY}, etc. to index
|
||||
* the result array.
|
||||
*/
|
||||
public String[] getWeekdays() {
|
||||
return Arrays.copyOf(weekdays, weekdays.length);
|
||||
@ -454,8 +466,8 @@ public class DateFormatSymbols implements Serializable, Cloneable {
|
||||
/**
|
||||
* Sets weekday strings. For example: "Sunday", "Monday", etc.
|
||||
* @param newWeekdays the new weekday strings. The array should
|
||||
* be indexed by <code>Calendar.SUNDAY</code>,
|
||||
* <code>Calendar.MONDAY</code>, etc.
|
||||
* be indexed by {@link java.util.Calendar#SUNDAY Calendar.SUNDAY},
|
||||
* {@link java.util.Calendar#MONDAY Calendar.MONDAY}, etc.
|
||||
*/
|
||||
public void setWeekdays(String[] newWeekdays) {
|
||||
weekdays = Arrays.copyOf(newWeekdays, newWeekdays.length);
|
||||
@ -464,8 +476,10 @@ public class DateFormatSymbols implements Serializable, Cloneable {
|
||||
|
||||
/**
|
||||
* Gets short weekday strings. For example: "Sun", "Mon", etc.
|
||||
* @return the short weekday strings. Use <code>Calendar.SUNDAY</code>,
|
||||
* <code>Calendar.MONDAY</code>, etc. to index the result array.
|
||||
* @return the short weekday strings. Use
|
||||
* {@link java.util.Calendar#SUNDAY Calendar.SUNDAY},
|
||||
* {@link java.util.Calendar#MONDAY Calendar.MONDAY}, etc. to index
|
||||
* the result array.
|
||||
*/
|
||||
public String[] getShortWeekdays() {
|
||||
return Arrays.copyOf(shortWeekdays, shortWeekdays.length);
|
||||
@ -474,8 +488,8 @@ public class DateFormatSymbols implements Serializable, Cloneable {
|
||||
/**
|
||||
* Sets short weekday strings. For example: "Sun", "Mon", etc.
|
||||
* @param newShortWeekdays the new short weekday strings. The array should
|
||||
* be indexed by <code>Calendar.SUNDAY</code>,
|
||||
* <code>Calendar.MONDAY</code>, etc.
|
||||
* be indexed by {@link java.util.Calendar#SUNDAY Calendar.SUNDAY},
|
||||
* {@link java.util.Calendar#MONDAY Calendar.MONDAY}, etc.
|
||||
*/
|
||||
public void setShortWeekdays(String[] newShortWeekdays) {
|
||||
shortWeekdays = Arrays.copyOf(newShortWeekdays, newShortWeekdays.length);
|
||||
|
||||
@ -147,11 +147,7 @@ public class AtomicBoolean implements java.io.Serializable {
|
||||
* @return the previous value
|
||||
*/
|
||||
public final boolean getAndSet(boolean newValue) {
|
||||
boolean prev;
|
||||
do {
|
||||
prev = get();
|
||||
} while (!compareAndSet(prev, newValue));
|
||||
return prev;
|
||||
return (int)VALUE.getAndSet(this, (newValue ? 1 : 0)) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -263,6 +263,47 @@ public class StampedLock implements java.io.Serializable {
|
||||
* is theoretically possible, so we additionally add a
|
||||
* storeStoreFence after lock acquisition CAS.
|
||||
*
|
||||
* ----------------------------------------------------------------
|
||||
* Here's an informal proof that plain reads by _successful_
|
||||
* readers see plain writes from preceding but not following
|
||||
* writers (following Boehm and the C++ standard [atomics.fences]):
|
||||
*
|
||||
* Because of the total synchronization order of accesses to
|
||||
* volatile long state containing the sequence number, writers and
|
||||
* _successful_ readers can be globally sequenced.
|
||||
*
|
||||
* int x, y;
|
||||
*
|
||||
* Writer 1:
|
||||
* inc sequence (odd - "locked")
|
||||
* storeStoreFence();
|
||||
* x = 1; y = 2;
|
||||
* inc sequence (even - "unlocked")
|
||||
*
|
||||
* Successful Reader:
|
||||
* read sequence (even)
|
||||
* // must see writes from Writer 1 but not Writer 2
|
||||
* r1 = x; r2 = y;
|
||||
* acquireFence();
|
||||
* read sequence (even - validated unchanged)
|
||||
* // use r1 and r2
|
||||
*
|
||||
* Writer 2:
|
||||
* inc sequence (odd - "locked")
|
||||
* storeStoreFence();
|
||||
* x = 3; y = 4;
|
||||
* inc sequence (even - "unlocked")
|
||||
*
|
||||
* Visibility of writer 1's stores is normal - reader's initial
|
||||
* read of state synchronizes with writer 1's final write to state.
|
||||
* Lack of visibility of writer 2's plain writes is less obvious.
|
||||
* If reader's read of x or y saw writer 2's write, then (assuming
|
||||
* semantics of C++ fences) the storeStoreFence would "synchronize"
|
||||
* with reader's acquireFence and reader's validation read must see
|
||||
* writer 2's initial write to state and so validation must fail.
|
||||
* But making this "proof" formal and rigorous is an open problem!
|
||||
* ----------------------------------------------------------------
|
||||
*
|
||||
* The memory layout keeps lock state and queue pointers together
|
||||
* (normally on the same cache line). This usually works well for
|
||||
* read-mostly loads. In most other cases, the natural tendency of
|
||||
@ -276,14 +317,14 @@ public class StampedLock implements java.io.Serializable {
|
||||
/** Number of processors, for spin control */
|
||||
private static final int NCPU = Runtime.getRuntime().availableProcessors();
|
||||
|
||||
/** Maximum number of retries before enqueuing on acquisition */
|
||||
private static final int SPINS = (NCPU > 1) ? 1 << 6 : 0;
|
||||
/** Maximum number of retries before enqueuing on acquisition; at least 1 */
|
||||
private static final int SPINS = (NCPU > 1) ? 1 << 6 : 1;
|
||||
|
||||
/** Maximum number of retries before blocking at head on acquisition */
|
||||
private static final int HEAD_SPINS = (NCPU > 1) ? 1 << 10 : 0;
|
||||
/** Maximum number of tries before blocking at head on acquisition */
|
||||
private static final int HEAD_SPINS = (NCPU > 1) ? 1 << 10 : 1;
|
||||
|
||||
/** Maximum number of retries before re-blocking */
|
||||
private static final int MAX_HEAD_SPINS = (NCPU > 1) ? 1 << 16 : 0;
|
||||
private static final int MAX_HEAD_SPINS = (NCPU > 1) ? 1 << 16 : 1;
|
||||
|
||||
/** The period for yielding when waiting for overflow spinlock */
|
||||
private static final int OVERFLOW_YIELD_RATE = 7; // must be power 2 - 1
|
||||
@ -1228,6 +1269,11 @@ public class StampedLock implements java.io.Serializable {
|
||||
WCOWAIT.compareAndSet(h, c, c.cowait) &&
|
||||
(w = c.thread) != null) // help release
|
||||
LockSupport.unpark(w);
|
||||
if (Thread.interrupted()) {
|
||||
if (interruptible)
|
||||
return cancelWaiter(node, p, true);
|
||||
wasInterrupted = true;
|
||||
}
|
||||
if (h == (pp = p.prev) || h == p || pp == null) {
|
||||
long m, s, ns;
|
||||
do {
|
||||
@ -1264,11 +1310,6 @@ public class StampedLock implements java.io.Serializable {
|
||||
LockSupport.parkNanos(this, time);
|
||||
}
|
||||
node.thread = null;
|
||||
if (Thread.interrupted()) {
|
||||
if (interruptible)
|
||||
return cancelWaiter(node, p, true);
|
||||
wasInterrupted = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -861,6 +861,13 @@ public abstract class SSLEngine {
|
||||
* be enabled by default, since this list may include cipher suites which
|
||||
* do not meet quality of service requirements for those defaults. Such
|
||||
* cipher suites might be useful in specialized applications.
|
||||
* <P>
|
||||
* The returned array includes cipher suites from the list of standard
|
||||
* cipher suite names in the <a href=
|
||||
* "{@docRoot}/../technotes/guides/security/StandardNames.html#ciphersuites">
|
||||
* JSSE Cipher Suite Names</a> section of the Java Cryptography
|
||||
* Architecture Standard Algorithm Name Documentation, and may also
|
||||
* include other cipher suites that the provider supports.
|
||||
*
|
||||
* @return an array of cipher suite names
|
||||
* @see #getEnabledCipherSuites()
|
||||
@ -880,6 +887,13 @@ public abstract class SSLEngine {
|
||||
* or the requisite certificates (and private keys) for the suite are
|
||||
* not available, or an anonymous suite is enabled but authentication
|
||||
* is required.
|
||||
* <P>
|
||||
* The returned array includes cipher suites from the list of standard
|
||||
* cipher suite names in the <a href=
|
||||
* "{@docRoot}/../technotes/guides/security/StandardNames.html#ciphersuites">
|
||||
* JSSE Cipher Suite Names</a> section of the Java Cryptography
|
||||
* Architecture Standard Algorithm Name Documentation, and may also
|
||||
* include other cipher suites that the provider supports.
|
||||
*
|
||||
* @return an array of cipher suite names
|
||||
* @see #getSupportedCipherSuites()
|
||||
@ -896,6 +910,14 @@ public abstract class SSLEngine {
|
||||
* fail. Following a successful call to this method, only suites
|
||||
* listed in the {@code suites} parameter are enabled for use.
|
||||
* <P>
|
||||
* Note that the standard list of cipher suite names may be found in the
|
||||
* <a href=
|
||||
* "{@docRoot}/../technotes/guides/security/StandardNames.html#ciphersuites">
|
||||
* JSSE Cipher Suite Names</a> section of the Java Cryptography
|
||||
* Architecture Standard Algorithm Name Documentation. Providers
|
||||
* may support cipher suite names not found in this list or might not
|
||||
* use the recommended name for a certain cipher suite.
|
||||
* <P>
|
||||
* See {@link #getEnabledCipherSuites()} for more information
|
||||
* on why a specific cipher suite may never be used on a engine.
|
||||
*
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -108,7 +108,12 @@ public class SSLParameters {
|
||||
* <p>
|
||||
* Calling this constructor is equivalent to calling the no-args
|
||||
* constructor followed by
|
||||
* {@code setCipherSuites(cipherSuites);}.
|
||||
* {@code setCipherSuites(cipherSuites);}. Note that the
|
||||
* standard list of cipher suite names may be found in the <a href=
|
||||
* "{@docRoot}/../technotes/guides/security/StandardNames.html#ciphersuites">
|
||||
* JSSE Cipher Suite Names</a> section of the Java Cryptography
|
||||
* Architecture Standard Algorithm Name Documentation. Providers
|
||||
* may support cipher suite names not found in this list.
|
||||
*
|
||||
* @param cipherSuites the array of ciphersuites (or null)
|
||||
*/
|
||||
@ -123,6 +128,12 @@ public class SSLParameters {
|
||||
* Calling this constructor is equivalent to calling the no-args
|
||||
* constructor followed by
|
||||
* {@code setCipherSuites(cipherSuites); setProtocols(protocols);}.
|
||||
* Note that the standard list of cipher suite names may be found in the
|
||||
* <a href=
|
||||
* "{@docRoot}/../technotes/guides/security/StandardNames.html#ciphersuites">
|
||||
* JSSE Cipher Suite Names</a> section of the Java Cryptography
|
||||
* Architecture Standard Algorithm Name Documentation. Providers
|
||||
* may support cipher suite names not found in this list.
|
||||
*
|
||||
* @param cipherSuites the array of ciphersuites (or null)
|
||||
* @param protocols the array of protocols (or null)
|
||||
@ -139,6 +150,13 @@ public class SSLParameters {
|
||||
/**
|
||||
* Returns a copy of the array of ciphersuites or null if none
|
||||
* have been set.
|
||||
* <P>
|
||||
* The returned array includes cipher suites from the list of standard
|
||||
* cipher suite names in the <a href=
|
||||
* "{@docRoot}/../technotes/guides/security/StandardNames.html#ciphersuites">
|
||||
* JSSE Cipher Suite Names</a> section of the Java Cryptography
|
||||
* Architecture Standard Algorithm Name Documentation, and may also
|
||||
* include other cipher suites that the provider supports.
|
||||
*
|
||||
* @return a copy of the array of ciphersuites or null if none
|
||||
* have been set.
|
||||
@ -150,7 +168,13 @@ public class SSLParameters {
|
||||
/**
|
||||
* Sets the array of ciphersuites.
|
||||
*
|
||||
* @param cipherSuites the array of ciphersuites (or null)
|
||||
* @param cipherSuites the array of ciphersuites (or null). Note that the
|
||||
* standard list of cipher suite names may be found in the <a href=
|
||||
* "{@docRoot}/../technotes/guides/security/StandardNames.html#ciphersuites">
|
||||
* JSSE Cipher Suite Names</a> section of the Java Cryptography
|
||||
* Architecture Standard Algorithm Name Documentation. Providers
|
||||
* may support cipher suite names not found in this list or might not
|
||||
* use the recommended name for a certain cipher suite.
|
||||
*/
|
||||
public void setCipherSuites(String[] cipherSuites) {
|
||||
this.cipherSuites = clone(cipherSuites);
|
||||
|
||||
@ -195,6 +195,13 @@ public abstract class SSLServerSocket extends ServerSocket {
|
||||
* or the requisite certificates (and private keys) for the suite are
|
||||
* not available, or an anonymous suite is enabled but authentication
|
||||
* is required.
|
||||
* <P>
|
||||
* The returned array includes cipher suites from the list of standard
|
||||
* cipher suite names in the <a href=
|
||||
* "{@docRoot}/../technotes/guides/security/StandardNames.html#ciphersuites">
|
||||
* JSSE Cipher Suite Names</a> section of the Java Cryptography
|
||||
* Architecture Standard Algorithm Name Documentation, and may also
|
||||
* include other cipher suites that the provider supports.
|
||||
*
|
||||
* @return an array of cipher suites enabled
|
||||
* @see #getSupportedCipherSuites()
|
||||
@ -215,6 +222,14 @@ public abstract class SSLServerSocket extends ServerSocket {
|
||||
* in this ServerSocket's authentication context will not be used
|
||||
* in any case, even if they are enabled.
|
||||
* <P>
|
||||
* Note that the standard list of cipher suite names may be found in the
|
||||
* <a href=
|
||||
* "{@docRoot}/../technotes/guides/security/StandardNames.html#ciphersuites">
|
||||
* JSSE Cipher Suite Names</a> section of the Java Cryptography
|
||||
* Architecture Standard Algorithm Name Documentation. Providers
|
||||
* may support cipher suite names not found in this list or might not
|
||||
* use the recommended name for a certain cipher suite.
|
||||
* <P>
|
||||
* <code>SSLSocket</code>s returned from <code>accept()</code>
|
||||
* inherit this setting.
|
||||
*
|
||||
@ -236,6 +251,13 @@ public abstract class SSLServerSocket extends ServerSocket {
|
||||
* be enabled by default, since this list may include cipher suites which
|
||||
* do not meet quality of service requirements for those defaults. Such
|
||||
* cipher suites are useful in specialized applications.
|
||||
* <P>
|
||||
* The returned array includes cipher suites from the list of standard
|
||||
* cipher suite names in the <a href=
|
||||
* "{@docRoot}/../technotes/guides/security/StandardNames.html#ciphersuites">
|
||||
* JSSE Cipher Suite Names</a> section of the Java Cryptography
|
||||
* Architecture Standard Algorithm Name Documentation, and may also
|
||||
* include other cipher suites that the provider supports.
|
||||
*
|
||||
* @return an array of cipher suite names
|
||||
* @see #getEnabledCipherSuites()
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -123,6 +123,13 @@ public abstract class SSLServerSocketFactory extends ServerSocketFactory
|
||||
* will use one of these cipher suites. The minimum quality of service
|
||||
* for these defaults requires confidentiality protection and server
|
||||
* authentication (that is, no anonymous cipher suites).
|
||||
* <P>
|
||||
* The returned array includes cipher suites from the list of standard
|
||||
* cipher suite names in the <a href=
|
||||
* "{@docRoot}/../technotes/guides/security/StandardNames.html#ciphersuites">
|
||||
* JSSE Cipher Suite Names</a> section of the Java Cryptography
|
||||
* Architecture Standard Algorithm Name Documentation, and may also
|
||||
* include other cipher suites that the provider supports.
|
||||
*
|
||||
* @see #getSupportedCipherSuites()
|
||||
* @return array of the cipher suites enabled by default
|
||||
@ -137,6 +144,13 @@ public abstract class SSLServerSocketFactory extends ServerSocketFactory
|
||||
* be enabled by default, since this list may include cipher suites which
|
||||
* do not meet quality of service requirements for those defaults. Such
|
||||
* cipher suites are useful in specialized applications.
|
||||
* <P>
|
||||
* The returned array includes cipher suites from the list of standard
|
||||
* cipher suite names in the <a href=
|
||||
* "{@docRoot}/../technotes/guides/security/StandardNames.html#ciphersuites">
|
||||
* JSSE Cipher Suite Names</a> section of the Java Cryptography
|
||||
* Architecture Standard Algorithm Name Documentation, and may also
|
||||
* include other cipher suites that the provider supports.
|
||||
*
|
||||
* @return an array of cipher suite names
|
||||
* @see #getDefaultCipherSuites()
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user