--- a/.hgtags Thu Jan 18 09:01:00 2018 -0800
+++ b/.hgtags Thu Jan 18 18:58:46 2018 +0000
@@ -460,7 +460,8 @@
bbd692ad4fa300ecca7939ffbe3b1d5e52a28cc6 jdk-10+33
89deac44e51517841491ba86ff44aa82a5ca96b3 jdk-10+34
d8c634b016c628622c9abbdc6bf50509e5dedbec jdk-10+35
-cb54a299aa91419cb7caef3992592e7b22488163 jdk-10+36
+0ee20aad71c4f33c426372b4c8bcc1235ce2ec08 jdk-11+0
+959f2f7cbaa6d2ee45d50029744efb219721576c jdk-10+36
4f830b447edf04fb4a52151a5ad44d9bb60723cd jdk-10+37
e569e83139fdfbecfeb3cd9014d560917787f158 jdk-10+38
5b834ec962366e00d4445352a999a3ac14e26f64 jdk-10+39
--- a/make/Main.gmk Thu Jan 18 09:01:00 2018 -0800
+++ b/make/Main.gmk Thu Jan 18 18:58:46 2018 +0000
@@ -637,7 +637,7 @@
# Declare dependencies between hotspot-<variant>* targets
$(foreach v, $(JVM_VARIANTS), \
$(eval hotspot-$v: hotspot-$v-gensrc hotspot-$v-libs) \
- $(eval hotspot-$v-libs: hotspot-$v-gensrc) \
+ $(eval hotspot-$v-libs: hotspot-$v-gensrc java.base-copy) \
)
hotspot-ide-project: hotspot exploded-image
@@ -691,8 +691,9 @@
jdk.jdwp.agent-libs: jdk.jdwp.agent-gensrc
# The swing beans need to have java base properly generated to avoid errors
- # in javadoc.
- java.desktop-gensrc-src: java.base-gensrc
+ # in javadoc. The X11 wrappers need the java.base include files to have been
+ # copied and processed.
+ java.desktop-gensrc-src: java.base-gensrc java.base-copy
# The annotation processing for jdk.internal.vm.ci and jdk.internal.vm.compiler
# needs classes from the current JDK.
--- a/make/autoconf/buildjdk-spec.gmk.in Thu Jan 18 09:01:00 2018 -0800
+++ b/make/autoconf/buildjdk-spec.gmk.in Thu Jan 18 18:58:46 2018 +0000
@@ -55,6 +55,7 @@
OPENJDK_TARGET_CPU_BITS := @OPENJDK_BUILD_CPU_BITS@
OPENJDK_TARGET_CPU_ENDIAN := @OPENJDK_BUILD_CPU_ENDIAN@
OPENJDK_TARGET_CPU_LEGACY := @OPENJDK_BUILD_CPU_LEGACY@
+OPENJDK_TARGET_OS_INCLUDE_SUBDIR := @OPENJDK_BUILD_OS_INCLUDE_SUBDIR@
HOTSPOT_TARGET_OS := @HOTSPOT_BUILD_OS@
HOTSPOT_TARGET_OS_TYPE := @HOTSPOT_BUILD_OS_TYPE@
--- a/make/autoconf/flags.m4 Thu Jan 18 09:01:00 2018 -0800
+++ b/make/autoconf/flags.m4 Thu Jan 18 18:58:46 2018 +0000
@@ -1162,9 +1162,7 @@
# Setup some hard coded includes
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK \
-I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
- -I${TOPDIR}/src/java.base/share/native/include \
- -I${TOPDIR}/src/java.base/$OPENJDK_$1_OS/native/include \
- -I${TOPDIR}/src/java.base/$OPENJDK_$1_OS_TYPE/native/include \
+ -I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base/\$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \
-I${TOPDIR}/src/java.base/share/native/libjava \
-I${TOPDIR}/src/java.base/$OPENJDK_$1_OS_TYPE/native/libjava \
-I${TOPDIR}/src/hotspot/share/include \
--- a/make/autoconf/generated-configure.sh Thu Jan 18 09:01:00 2018 -0800
+++ b/make/autoconf/generated-configure.sh Thu Jan 18 18:58:46 2018 +0000
@@ -886,6 +886,8 @@
BOOT_JDK
JAVA_CHECK
JAVAC_CHECK
+VERSION_CLASSFILE_MINOR
+VERSION_CLASSFILE_MAJOR
VENDOR_VERSION_STRING
VERSION_DATE
VERSION_IS_GA
@@ -970,6 +972,7 @@
USERNAME
TOPDIR
PATH_SEP
+OPENJDK_BUILD_OS_INCLUDE_SUBDIR
HOTSPOT_BUILD_CPU_DEFINE
HOTSPOT_BUILD_CPU_ARCH
HOTSPOT_BUILD_CPU
@@ -980,6 +983,7 @@
OPENJDK_BUILD_CPU_ISADIR
OPENJDK_BUILD_CPU_LEGACY_LIB
OPENJDK_BUILD_CPU_LEGACY
+OPENJDK_TARGET_OS_INCLUDE_SUBDIR
HOTSPOT_TARGET_CPU_DEFINE
HOTSPOT_TARGET_CPU_ARCH
HOTSPOT_TARGET_CPU
@@ -16318,6 +16322,14 @@
fi
+ # For historical reasons, the OS include directories have odd names.
+ OPENJDK_TARGET_OS_INCLUDE_SUBDIR="$OPENJDK_TARGET_OS"
+ if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
+ OPENJDK_TARGET_OS_INCLUDE_SUBDIR="win32"
+ elif test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
+ OPENJDK_TARGET_OS_INCLUDE_SUBDIR="darwin"
+ fi
+
# Also store the legacy naming of the cpu.
@@ -16469,6 +16481,14 @@
fi
+ # For historical reasons, the OS include directories have odd names.
+ OPENJDK_BUILD_OS_INCLUDE_SUBDIR="$OPENJDK_TARGET_OS"
+ if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
+ OPENJDK_BUILD_OS_INCLUDE_SUBDIR="win32"
+ elif test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
+ OPENJDK_BUILD_OS_INCLUDE_SUBDIR="darwin"
+ fi
+
@@ -25524,6 +25544,10 @@
VENDOR_VERSION_STRING="$with_vendor_version_string"
fi
+ # We could define --with flags for these, if really needed
+ VERSION_CLASSFILE_MAJOR="$DEFAULT_VERSION_CLASSFILE_MAJOR"
+ VERSION_CLASSFILE_MINOR="$DEFAULT_VERSION_CLASSFILE_MINOR"
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for version string" >&5
$as_echo_n "checking for version string... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $VERSION_STRING" >&5
@@ -25545,6 +25569,9 @@
+
+
+
###############################################################################
#
# Setup BootJDK, used to bootstrap the build.
@@ -52817,9 +52844,7 @@
# Setup some hard coded includes
COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK \
-I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
- -I${TOPDIR}/src/java.base/share/native/include \
- -I${TOPDIR}/src/java.base/$OPENJDK_TARGET_OS/native/include \
- -I${TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_TYPE/native/include \
+ -I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base/\$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \
-I${TOPDIR}/src/java.base/share/native/libjava \
-I${TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_TYPE/native/libjava \
-I${TOPDIR}/src/hotspot/share/include \
@@ -53700,9 +53725,7 @@
# Setup some hard coded includes
OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK="$OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK \
-I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
- -I${TOPDIR}/src/java.base/share/native/include \
- -I${TOPDIR}/src/java.base/$OPENJDK_BUILD_OS/native/include \
- -I${TOPDIR}/src/java.base/$OPENJDK_BUILD_OS_TYPE/native/include \
+ -I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base/\$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \
-I${TOPDIR}/src/java.base/share/native/libjava \
-I${TOPDIR}/src/java.base/$OPENJDK_BUILD_OS_TYPE/native/libjava \
-I${TOPDIR}/src/hotspot/share/include \
--- a/make/autoconf/jdk-version.m4 Thu Jan 18 09:01:00 2018 -0800
+++ b/make/autoconf/jdk-version.m4 Thu Jan 18 18:58:46 2018 +0000
@@ -381,6 +381,10 @@
VENDOR_VERSION_STRING="$with_vendor_version_string"
fi
+ # We could define --with flags for these, if really needed
+ VERSION_CLASSFILE_MAJOR="$DEFAULT_VERSION_CLASSFILE_MAJOR"
+ VERSION_CLASSFILE_MINOR="$DEFAULT_VERSION_CLASSFILE_MINOR"
+
AC_MSG_CHECKING([for version string])
AC_MSG_RESULT([$VERSION_STRING])
@@ -398,4 +402,7 @@
AC_SUBST(VERSION_IS_GA)
AC_SUBST(VERSION_DATE)
AC_SUBST(VENDOR_VERSION_STRING)
+ AC_SUBST(VERSION_CLASSFILE_MAJOR)
+ AC_SUBST(VERSION_CLASSFILE_MINOR)
+
])
--- a/make/autoconf/platform.m4 Thu Jan 18 09:01:00 2018 -0800
+++ b/make/autoconf/platform.m4 Thu Jan 18 18:58:46 2018 +0000
@@ -478,6 +478,14 @@
fi
AC_SUBST(HOTSPOT_$1_CPU_DEFINE)
+ # For historical reasons, the OS include directories have odd names.
+ OPENJDK_$1_OS_INCLUDE_SUBDIR="$OPENJDK_TARGET_OS"
+ if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
+ OPENJDK_$1_OS_INCLUDE_SUBDIR="win32"
+ elif test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
+ OPENJDK_$1_OS_INCLUDE_SUBDIR="darwin"
+ fi
+ AC_SUBST(OPENJDK_$1_OS_INCLUDE_SUBDIR)
])
AC_DEFUN([PLATFORM_SET_RELEASE_FILE_OS_VALUES],
--- a/make/autoconf/spec.gmk.in Thu Jan 18 09:01:00 2018 -0800
+++ b/make/autoconf/spec.gmk.in Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -78,6 +78,7 @@
OPENJDK_TARGET_CPU_LEGACY:=@OPENJDK_TARGET_CPU_LEGACY@
OPENJDK_TARGET_CPU_LEGACY_LIB:=@OPENJDK_TARGET_CPU_LEGACY_LIB@
OPENJDK_TARGET_CPU_OSARCH:=@OPENJDK_TARGET_CPU_OSARCH@
+OPENJDK_TARGET_OS_INCLUDE_SUBIDR:=@OPENJDK_TARGET_OS_INCLUDE_SUBDIR@
HOTSPOT_TARGET_OS := @HOTSPOT_TARGET_OS@
HOTSPOT_TARGET_OS_TYPE := @HOTSPOT_TARGET_OS_TYPE@
@@ -100,6 +101,8 @@
OPENJDK_BUILD_CPU_BITS:=@OPENJDK_BUILD_CPU_BITS@
OPENJDK_BUILD_CPU_ENDIAN:=@OPENJDK_BUILD_CPU_ENDIAN@
+OPENJDK_BUILD_OS_INCLUDE_SUBIDR:=@OPENJDK_TARGET_OS_INCLUDE_SUBDIR@
+
# Target platform value in ModuleTarget class file attribute.
OPENJDK_MODULE_TARGET_PLATFORM:=@OPENJDK_MODULE_TARGET_PLATFORM@
@@ -189,6 +192,10 @@
# Vendor version string
VENDOR_VERSION_STRING := @VENDOR_VERSION_STRING@
+# Class-file version
+VERSION_CLASSFILE_MAJOR := @VERSION_CLASSFILE_MAJOR@
+VERSION_CLASSFILE_MINOR := @VERSION_CLASSFILE_MINOR@
+
# Convenience CFLAGS settings for passing version information into native programs.
VERSION_CFLAGS := \
-DVERSION_FEATURE=$(VERSION_FEATURE) \
@@ -204,6 +211,8 @@
-DVERSION_SPECIFICATION='"$(VERSION_SPECIFICATION)"' \
-DVERSION_DATE='"$(VERSION_DATE)"' \
-DVENDOR_VERSION_STRING='"$(VENDOR_VERSION_STRING)"' \
+ -DVERSION_CLASSFILE_MAJOR=$(VERSION_CLASSFILE_MAJOR) \
+ -DVERSION_CLASSFILE_MINOR=$(VERSION_CLASSFILE_MINOR) \
#
ifneq ($(COMPANY_NAME),)
@@ -604,6 +613,8 @@
INTERIM_LANGTOOLS_MODULES := $(addsuffix .interim, $(INTERIM_LANGTOOLS_BASE_MODULES))
INTERIM_LANGTOOLS_ADD_EXPORTS := \
--add-exports java.base/sun.reflect.annotation=jdk.compiler.interim \
+ --add-exports java.base/jdk.internal.jmod=jdk.compiler.interim \
+ --add-exports java.base/jdk.internal.misc=jdk.compiler.interim \
#
INTERIM_LANGTOOLS_MODULES_COMMA := $(strip $(subst $(SPACE),$(COMMA),$(strip \
$(INTERIM_LANGTOOLS_MODULES))))
--- a/make/autoconf/version-numbers Thu Jan 18 09:01:00 2018 -0800
+++ b/make/autoconf/version-numbers Thu Jan 18 18:58:46 2018 +0000
@@ -30,6 +30,8 @@
DEFAULT_VERSION_UPDATE=0
DEFAULT_VERSION_PATCH=0
DEFAULT_VERSION_DATE=2018-03-20
+DEFAULT_VERSION_CLASSFILE_MAJOR=55 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`"
+DEFAULT_VERSION_CLASSFILE_MINOR=0
LAUNCHER_NAME=openjdk
PRODUCT_NAME=OpenJDK
--- a/make/common/SetupJavaCompilers.gmk Thu Jan 18 09:01:00 2018 -0800
+++ b/make/common/SetupJavaCompilers.gmk Thu Jan 18 18:58:46 2018 +0000
@@ -69,7 +69,7 @@
$(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE, \
JVM := $(JAVA_JAVAC), \
JAVAC := $(NEW_JAVAC), \
- FLAGS := -source 10 -target 10 --doclint-format html5 \
+ FLAGS := -source 11 -target 11 --doclint-format html5 \
-encoding ascii -XDignore.symbol.file=true $(JAVAC_WARNINGS), \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
@@ -79,7 +79,7 @@
$(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE_NOWARNINGS, \
JVM := $(JAVA_JAVAC), \
JAVAC := $(NEW_JAVAC), \
- FLAGS := -source 10 -target 10 \
+ FLAGS := -source 11 -target 11 \
-encoding ascii -XDignore.symbol.file=true $(DISABLE_WARNINGS), \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
--- a/make/conf/jib-profiles.js Thu Jan 18 09:01:00 2018 -0800
+++ b/make/conf/jib-profiles.js Thu Jan 18 18:58:46 2018 +0000
@@ -829,7 +829,7 @@
jtreg: {
server: "javare",
revision: "4.2",
- build_number: "b10",
+ build_number: "b11",
checksum_file: "MD5_VALUES",
file: "jtreg_bin-4.2.zip",
environment_name: "JT_HOME",
--- a/make/copy/Copy-java.base.gmk Thu Jan 18 09:01:00 2018 -0800
+++ b/make/copy/Copy-java.base.gmk Thu Jan 18 18:58:46 2018 +0000
@@ -24,6 +24,7 @@
#
include CopyCommon.gmk
+include TextFileProcessing.gmk
$(eval $(call IncludeCustomExtension, copy/Copy-java.base.gmk))
@@ -244,3 +245,16 @@
endif
################################################################################
+# Generate classfile_constants.h
+
+$(eval $(call SetupTextFileProcessing, CREATE_CLASSFILE_CONSTANTS_H, \
+ SOURCE_FILES := $(TOPDIR)/src/java.base/share/native/include/classfile_constants.h.template, \
+ OUTPUT_FILE := $(SUPPORT_OUTPUTDIR)/modules_include/java.base/classfile_constants.h, \
+ REPLACEMENTS := \
+ @@VERSION_CLASSFILE_MAJOR@@ => $(VERSION_CLASSFILE_MAJOR) ; \
+ @@VERSION_CLASSFILE_MINOR@@ => $(VERSION_CLASSFILE_MINOR) ; , \
+))
+
+TARGETS += $(CREATE_CLASSFILE_CONSTANTS_H)
+
+################################################################################
--- a/make/copy/CopyCommon.gmk Thu Jan 18 09:01:00 2018 -0800
+++ b/make/copy/CopyCommon.gmk Thu Jan 18 18:58:46 2018 +0000
@@ -39,20 +39,12 @@
$(eval $(call SetupCopyFiles, COPY_EXPORTED_INCLUDE, \
SRC := $(INCLUDE_SOURCE_DIR), \
DEST := $(INCLUDE_TARGET_DIR), \
- FILES := $(shell $(FIND) $(INCLUDE_SOURCE_DIR) -type f), \
+ FILES := $(filter %.h, $(call CacheFind, $(INCLUDE_SOURCE_DIR))), \
))
TARGETS += $(COPY_EXPORTED_INCLUDE)
endif
-# For historical reasons, the OS include directories have odd names.
-INCLUDE_TARGET_OS_SUBDIR := $(OPENJDK_TARGET_OS)
-ifeq ($(OPENJDK_TARGET_OS), windows)
- INCLUDE_TARGET_OS_SUBDIR := win32
-else ifeq ($(OPENJDK_TARGET_OS), macosx)
- INCLUDE_TARGET_OS_SUBDIR := darwin
-endif
-
# Use the most specific of OS and OS_TYPE.
INCLUDE_SOURCE_OS_DIR := $(TOPDIR)/src/$(MODULE)/$(OPENJDK_TARGET_OS)/native/include
ifeq ($(wildcard $(INCLUDE_SOURCE_OS_DIR)/*), )
@@ -62,8 +54,8 @@
ifneq ($(wildcard $(INCLUDE_SOURCE_OS_DIR)/*), )
$(eval $(call SetupCopyFiles, COPY_EXPORTED_INCLUDE_OS, \
SRC := $(INCLUDE_SOURCE_OS_DIR), \
- DEST := $(INCLUDE_TARGET_DIR)/$(INCLUDE_TARGET_OS_SUBDIR), \
- FILES := $(shell $(FIND) $(INCLUDE_SOURCE_OS_DIR) -type f), \
+ DEST := $(INCLUDE_TARGET_DIR)/$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR), \
+ FILES := $(filter %.h, $(call CacheFind, $(INCLUDE_SOURCE_OS_DIR))), \
))
TARGETS += $(COPY_EXPORTED_INCLUDE_OS)
--- a/make/gensrc/GensrcX11Wrappers.gmk Thu Jan 18 09:01:00 2018 -0800
+++ b/make/gensrc/GensrcX11Wrappers.gmk Thu Jan 18 18:58:46 2018 +0000
@@ -92,10 +92,10 @@
endif
SIZER_CFLAGS := \
- -I${TOPDIR}/src/hotspot/share/include \
- -I${TOPDIR}/src/hotspot/os/$(HOTSPOT_TARGET_OS_TYPE)/include \
- -I$(TOPDIR)/src/java.base/share/native/include \
- -I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/include \
+ -I$(TOPDIR)/src/hotspot/share/include \
+ -I$(TOPDIR)/src/hotspot/os/$(HOTSPOT_TARGET_OS_TYPE)/include \
+ -I$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
+ -I$(SUPPORT_OUTPUTDIR)/modules_include/java.base/$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \
-I$(TOPDIR)/src/java.base/share/native/libjava \
-I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
-I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
--- a/make/hotspot/lib/CompileJvm.gmk Thu Jan 18 09:01:00 2018 -0800
+++ b/make/hotspot/lib/CompileJvm.gmk Thu Jan 18 18:58:46 2018 +0000
@@ -59,8 +59,8 @@
-I$(TOPDIR)/src/hotspot/share/precompiled \
-I$(TOPDIR)/src/hotspot/share/include \
-I$(TOPDIR)/src/hotspot/os/$(HOTSPOT_TARGET_OS_TYPE)/include \
- -I$(TOPDIR)/src/java.base/share/native/include \
- -I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/include \
+ -I$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
+ -I$(SUPPORT_OUTPUTDIR)/modules_include/java.base/$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \
-I$(TOPDIR)/src/java.base/share/native/libjimage \
#
--- a/make/mapfiles/libjava/mapfile-vers Thu Jan 18 09:01:00 2018 -0800
+++ b/make/mapfiles/libjava/mapfile-vers Thu Jan 18 18:58:46 2018 +0000
@@ -258,7 +258,6 @@
Java_jdk_internal_reflect_NativeConstructorAccessorImpl_newInstance0;
Java_jdk_internal_reflect_NativeMethodAccessorImpl_invoke0;
Java_jdk_internal_reflect_Reflection_getCallerClass__;
- Java_jdk_internal_reflect_Reflection_getCallerClass__I;
Java_jdk_internal_reflect_Reflection_getClassAccessFlags;
Java_jdk_internal_misc_VM_latestUserDefinedLoader0;
Java_jdk_internal_misc_VM_getuid;
--- a/make/mapfiles/libjava/reorder-sparc Thu Jan 18 09:01:00 2018 -0800
+++ b/make/mapfiles/libjava/reorder-sparc Thu Jan 18 18:58:46 2018 +0000
@@ -27,7 +27,6 @@
text: .text%Java_java_io_FileOutputStream_initIDs;
text: .text%Java_java_lang_System_setIn0;
text: .text%Java_sun_reflect_Reflection_getCallerClass__;
-text: .text%Java_sun_reflect_Reflection_getCallerClass__I;
text: .text%Java_java_lang_Class_forName0;
text: .text%Java_java_lang_Object_getClass;
text: .text%Java_sun_reflect_Reflection_getClassAccessFlags;
--- a/make/mapfiles/libjava/reorder-sparcv9 Thu Jan 18 09:01:00 2018 -0800
+++ b/make/mapfiles/libjava/reorder-sparcv9 Thu Jan 18 18:58:46 2018 +0000
@@ -26,7 +26,6 @@
text: .text%Java_java_io_FileOutputStream_initIDs;
text: .text%Java_java_lang_System_setIn0;
text: .text%Java_sun_reflect_Reflection_getCallerClass__;
-text: .text%Java_sun_reflect_Reflection_getCallerClass__I;
text: .text%Java_java_lang_Class_forName0;
text: .text%Java_java_lang_String_intern;
text: .text%Java_java_lang_StringUTF16_isBigEndian;
--- a/make/mapfiles/libjava/reorder-x86 Thu Jan 18 09:01:00 2018 -0800
+++ b/make/mapfiles/libjava/reorder-x86 Thu Jan 18 18:58:46 2018 +0000
@@ -27,7 +27,6 @@
text: .text%Java_java_io_FileOutputStream_initIDs;
text: .text%Java_java_lang_System_setIn0;
text: .text%Java_sun_reflect_Reflection_getCallerClass__;
-text: .text%Java_sun_reflect_Reflection_getCallerClass__I;
text: .text%Java_java_lang_Class_forName0;
text: .text%Java_java_lang_String_intern;
text: .text%Java_java_lang_StringUTF16_isBigEndian;
--- a/src/hotspot/cpu/aarch64/aarch64.ad Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/cpu/aarch64/aarch64.ad Thu Jan 18 18:58:46 2018 +0000
@@ -5844,8 +5844,8 @@
operand immByteMapBase()
%{
// Get base of card map
- predicate((jbyte*)n->get_ptr() ==
- ((CardTableModRefBS*)(Universe::heap()->barrier_set()))->byte_map_base);
+ predicate(Universe::heap()->barrier_set()->is_a(BarrierSet::CardTableModRef) &&
+ (jbyte*)n->get_ptr() == ((CardTableModRefBS*)(Universe::heap()->barrier_set()))->byte_map_base);
match(ConP);
op_cost(0);
--- a/src/hotspot/cpu/aarch64/assembler_aarch64.hpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/cpu/aarch64/assembler_aarch64.hpp Thu Jan 18 18:58:46 2018 +0000
@@ -848,7 +848,7 @@
// architecture. In debug mode we shrink it in order to test
// trampolines, but not so small that branches in the interpreter
// are out of range.
- static const unsigned long branch_range = INCLUDE_JVMCI ? 128 * M : NOT_DEBUG(128 * M) DEBUG_ONLY(2 * M);
+ static const unsigned long branch_range = NOT_DEBUG(128 * M) DEBUG_ONLY(2 * M);
static bool reachable_from_branch_at(address branch, address target) {
return uabs(target - branch) < branch_range;
--- a/src/hotspot/cpu/aarch64/compiledIC_aarch64.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/cpu/aarch64/compiledIC_aarch64.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -71,6 +71,13 @@
return 7 * NativeInstruction::instruction_size;
}
+int CompiledStaticCall::to_trampoline_stub_size() {
+ // Somewhat pessimistically, we count 3 instructions here (although
+ // there are only two) because we sometimes emit an alignment nop.
+ // Trampoline stubs are always word aligned.
+ return 3 * NativeInstruction::instruction_size + wordSize;
+}
+
// Relocation entries for call stub, compiled java to interpreter.
int CompiledStaticCall::reloc_to_interp_stub() {
return 4; // 3 in emit_to_interp_stub + 1 in emit_call
--- a/src/hotspot/cpu/aarch64/jvmciCodeInstaller_aarch64.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/cpu/aarch64/jvmciCodeInstaller_aarch64.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -109,7 +109,7 @@
TRACE_jvmci_3("relocating (foreign call) at " PTR_FORMAT, p2i(inst));
}
-void CodeInstaller::pd_relocate_JavaMethod(Handle hotspot_method, jint pc_offset, TRAPS) {
+void CodeInstaller::pd_relocate_JavaMethod(CodeBuffer &cbuf, Handle hotspot_method, jint pc_offset, TRAPS) {
#ifdef ASSERT
Method* method = NULL;
// we need to check, this might also be an unresolved method
@@ -124,22 +124,22 @@
case INVOKEINTERFACE: {
assert(method == NULL || !method->is_static(), "cannot call static method with invokeinterface");
NativeCall* call = nativeCall_at(_instructions->start() + pc_offset);
- call->set_destination(SharedRuntime::get_resolve_virtual_call_stub());
_instructions->relocate(call->instruction_address(), virtual_call_Relocation::spec(_invoke_mark_pc));
+ call->trampoline_jump(cbuf, SharedRuntime::get_resolve_virtual_call_stub());
break;
}
case INVOKESTATIC: {
assert(method == NULL || method->is_static(), "cannot call non-static method with invokestatic");
NativeCall* call = nativeCall_at(_instructions->start() + pc_offset);
- call->set_destination(SharedRuntime::get_resolve_static_call_stub());
_instructions->relocate(call->instruction_address(), relocInfo::static_call_type);
+ call->trampoline_jump(cbuf, SharedRuntime::get_resolve_static_call_stub());
break;
}
case INVOKESPECIAL: {
assert(method == NULL || !method->is_static(), "cannot call static method with invokespecial");
NativeCall* call = nativeCall_at(_instructions->start() + pc_offset);
- call->set_destination(SharedRuntime::get_resolve_opt_virtual_call_stub());
_instructions->relocate(call->instruction_address(), relocInfo::opt_virtual_call_type);
+ call->trampoline_jump(cbuf, SharedRuntime::get_resolve_opt_virtual_call_stub());
break;
}
default:
--- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -801,7 +801,7 @@
assert(is_NativeCallTrampolineStub_at(stub_start_addr), "doesn't look like a trampoline");
end_a_stub();
- return stub;
+ return stub_start_addr;
}
address MacroAssembler::ic_call(address entry, jint method_index) {
--- a/src/hotspot/cpu/aarch64/nativeInst_aarch64.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/cpu/aarch64/nativeInst_aarch64.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -367,3 +367,24 @@
set_ptr_at(data_offset, new_destination);
OrderAccess::release();
}
+
+// Generate a trampoline for a branch to dest. If there's no need for a
+// trampoline, simply patch the call directly to dest.
+address NativeCall::trampoline_jump(CodeBuffer &cbuf, address dest) {
+ MacroAssembler a(&cbuf);
+ address stub = NULL;
+
+ if (a.far_branches()
+ && ! is_NativeCallTrampolineStub_at(instruction_address() + displacement())) {
+ stub = a.emit_trampoline_stub(instruction_address() - cbuf.insts()->start(), dest);
+ }
+
+ if (stub == NULL) {
+ // If we generated no stub, patch this call directly to dest.
+ // This will happen if we don't need far branches or if there
+ // already was a trampoline.
+ set_destination(dest);
+ }
+
+ return stub;
+}
--- a/src/hotspot/cpu/aarch64/nativeInst_aarch64.hpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/cpu/aarch64/nativeInst_aarch64.hpp Thu Jan 18 18:58:46 2018 +0000
@@ -61,7 +61,7 @@
return uint_at(0);
}
- bool is_blr() const { return (encoding() & 0xfffffc1f) == 0xd63f0000; }
+ bool is_blr() const { return (encoding() & 0xff9ffc1f) == 0xd61f0000; } // blr(register) or br(register)
bool is_adr_aligned() const { return (encoding() & 0xff000000) == 0x10000000; } // adr Xn, <label>, where label is aligned to 4 bytes (address of instruction).
inline bool is_nop();
@@ -143,8 +143,9 @@
}
inline NativeCall* nativeCall_at(address address);
-// The NativeCall is an abstraction for accessing/manipulating native call imm32/rel32off
-// instructions (used to manipulate inline caches, primitive & dll calls, etc.).
+// The NativeCall is an abstraction for accessing/manipulating native
+// call instructions (used to manipulate inline caches, primitive &
+// DSO calls, etc.).
class NativeCall: public NativeInstruction {
public:
@@ -155,7 +156,6 @@
return_address_offset = 4
};
- enum { cache_line_size = BytesPerWord }; // conservative estimate!
address instruction_address() const { return addr_at(instruction_offset); }
address next_instruction_address() const { return addr_at(return_address_offset); }
int displacement() const { return (int_at(displacement_offset) << 6) >> 4; }
@@ -206,6 +206,7 @@
void set_destination_mt_safe(address dest, bool assert_lock = true);
address get_trampoline();
+ address trampoline_jump(CodeBuffer &cbuf, address dest);
};
inline NativeCall* nativeCall_at(address address) {
--- a/src/hotspot/cpu/aarch64/relocInfo_aarch64.hpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/cpu/aarch64/relocInfo_aarch64.hpp Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -35,4 +35,10 @@
format_width = 0
};
+ public:
+
+ // This platform has no oops in the code that are not also
+ // listed in the oop section.
+ static bool mustIterateImmediateOopsInCode() { return false; }
+
#endif // CPU_AARCH64_VM_RELOCINFO_AARCH64_HPP
--- a/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -3404,7 +3404,6 @@
Label done;
Label initialize_header;
Label initialize_object; // including clearing the fields
- Label allocate_shared;
__ get_cpool_and_tags(r4, r0);
// Make sure the class we're about to instantiate has been resolved.
@@ -3433,18 +3432,24 @@
// test to see if it has a finalizer or is malformed in some way
__ tbnz(r3, exact_log2(Klass::_lh_instance_slow_path_bit), slow_case);
- // Allocate the instance
- // 1) Try to allocate in the TLAB
- // 2) if fail and the object is large allocate in the shared Eden
- // 3) if the above fails (or is not applicable), go to a slow case
- // (creates a new TLAB, etc.)
-
+ // Allocate the instance:
+ // If TLAB is enabled:
+ // Try to allocate in the TLAB.
+ // If fails, go to the slow path.
+ // Else If inline contiguous allocations are enabled:
+ // Try to allocate in eden.
+ // If fails due to heap end, go to slow path.
+ //
+ // If TLAB is enabled OR inline contiguous is enabled:
+ // Initialize the allocation.
+ // Exit.
+ //
+ // Go to slow path.
const bool allow_shared_alloc =
Universe::heap()->supports_inline_contig_alloc();
if (UseTLAB) {
- __ tlab_allocate(r0, r3, 0, noreg, r1,
- allow_shared_alloc ? allocate_shared : slow_case);
+ __ tlab_allocate(r0, r3, 0, noreg, r1, slow_case);
if (ZeroTLAB) {
// the fields have been already cleared
@@ -3453,19 +3458,19 @@
// initialize both the header and fields
__ b(initialize_object);
}
+ } else {
+ // Allocation in the shared Eden, if allowed.
+ //
+ // r3: instance size in bytes
+ if (allow_shared_alloc) {
+ __ eden_allocate(r0, r3, 0, r10, slow_case);
+ __ incr_allocated_bytes(rthread, r3, 0, rscratch1);
+ }
}
- // Allocation in the shared Eden, if allowed.
- //
- // r3: instance size in bytes
- if (allow_shared_alloc) {
- __ bind(allocate_shared);
-
- __ eden_allocate(r0, r3, 0, r10, slow_case);
- __ incr_allocated_bytes(rthread, r3, 0, rscratch1);
- }
-
- if (UseTLAB || Universe::heap()->supports_inline_contig_alloc()) {
+ // If UseTLAB or allow_shared_alloc are true, the object is created above and
+ // there is an initialize need. Otherwise, skip and go to the slow path.
+ if (UseTLAB || allow_shared_alloc) {
// The object is initialized before the header. If the object size is
// zero, go directly to the header initialization.
__ bind(initialize_object);
--- a/src/hotspot/cpu/arm/relocInfo_arm.hpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/cpu/arm/relocInfo_arm.hpp Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,4 +32,10 @@
format_width = 0
};
+ public:
+
+ // This platform has no oops in the code that are not also
+ // listed in the oop section.
+ static bool mustIterateImmediateOopsInCode() { return false; }
+
#endif // CPU_ARM_VM_RELOCINFO_ARM_HPP
--- a/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -5604,12 +5604,17 @@
#endif // !PRODUCT
-SkipIfEqualZero::SkipIfEqualZero(MacroAssembler* masm, Register temp, const bool* flag_addr) : _masm(masm), _label() {
+void SkipIfEqualZero::skip_to_label_if_equal_zero(MacroAssembler* masm, Register temp,
+ const bool* flag_addr, Label& label) {
int simm16_offset = masm->load_const_optimized(temp, (address)flag_addr, R0, true);
assert(sizeof(bool) == 1, "PowerPC ABI");
masm->lbz(temp, simm16_offset, temp);
masm->cmpwi(CCR0, temp, 0);
- masm->beq(CCR0, _label);
+ masm->beq(CCR0, label);
+}
+
+SkipIfEqualZero::SkipIfEqualZero(MacroAssembler* masm, Register temp, const bool* flag_addr) : _masm(masm), _label() {
+ skip_to_label_if_equal_zero(masm, temp, flag_addr, _label);
}
SkipIfEqualZero::~SkipIfEqualZero() {
--- a/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp Thu Jan 18 18:58:46 2018 +0000
@@ -980,6 +980,8 @@
public:
// 'Temp' is a temp register that this object can use (and trash).
explicit SkipIfEqualZero(MacroAssembler*, Register temp, const bool* flag_addr);
+ static void skip_to_label_if_equal_zero(MacroAssembler*, Register temp,
+ const bool* flag_addr, Label& label);
~SkipIfEqualZero();
};
--- a/src/hotspot/cpu/ppc/relocInfo_ppc.hpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/cpu/ppc/relocInfo_ppc.hpp Thu Jan 18 18:58:46 2018 +0000
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2013 SAP SE. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -43,4 +43,10 @@
#endif
};
+ public:
+
+ // This platform has no oops in the code that are not also
+ // listed in the oop section.
+ static bool mustIterateImmediateOopsInCode() { return false; }
+
#endif // CPU_PPC_VM_RELOCINFO_PPC_HPP
--- a/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -3637,10 +3637,7 @@
transition(vtos, atos);
Label Lslow_case,
- Ldone,
- Linitialize_header,
- Lallocate_shared,
- Linitialize_object; // Including clearing the fields.
+ Ldone;
const Register RallocatedObject = R17_tos,
RinstanceKlass = R9_ARG7,
@@ -3651,8 +3648,6 @@
Rtags = R3_ARG1,
Rindex = R5_ARG3;
- const bool allow_shared_alloc = Universe::heap()->supports_inline_contig_alloc();
-
// --------------------------------------------------------------------------
// Check if fast case is possible.
@@ -3661,6 +3656,8 @@
// Load index of constant pool entry.
__ get_2_byte_integer_at_bcp(1, Rindex, InterpreterMacroAssembler::Unsigned);
+ // Note: compared to other architectures, PPC's implementation always goes
+ // to the slow path if TLAB is used and fails.
if (UseTLAB) {
// Make sure the class we're about to instantiate has been resolved
// This is done before loading instanceKlass to be consistent with the order
@@ -3690,8 +3687,7 @@
// Fast case:
// Allocate the instance.
// 1) Try to allocate in the TLAB.
- // 2) If fail, and the TLAB is not full enough to discard, allocate in the shared Eden.
- // 3) If the above fails (or is not applicable), go to a slow case (creates a new TLAB, etc.).
+ // 2) If the above fails (or is not applicable), go to a slow case (creates a new TLAB, etc.).
Register RoldTopValue = RallocatedObject; // Object will be allocated here if it fits.
Register RnewTopValue = R6_ARG4;
@@ -3705,53 +3701,13 @@
// If there is enough space, we do not CAS and do not clear.
__ cmpld(CCR0, RnewTopValue, RendValue);
- __ bgt(CCR0, allow_shared_alloc ? Lallocate_shared : Lslow_case);
+ __ bgt(CCR0, Lslow_case);
__ std(RnewTopValue, in_bytes(JavaThread::tlab_top_offset()), R16_thread);
- if (ZeroTLAB) {
- // The fields have already been cleared.
- __ b(Linitialize_header);
- } else {
- // Initialize both the header and fields.
- __ b(Linitialize_object);
- }
-
- // Fall through: TLAB was too small.
- if (allow_shared_alloc) {
- Register RtlabWasteLimitValue = R10_ARG8;
- Register RfreeValue = RnewTopValue;
-
- __ bind(Lallocate_shared);
- // Check if tlab should be discarded (refill_waste_limit >= free).
- __ ld(RtlabWasteLimitValue, in_bytes(JavaThread::tlab_refill_waste_limit_offset()), R16_thread);
- __ subf(RfreeValue, RoldTopValue, RendValue);
- __ srdi(RfreeValue, RfreeValue, LogHeapWordSize); // in dwords
- __ cmpld(CCR0, RtlabWasteLimitValue, RfreeValue);
- __ bge(CCR0, Lslow_case);
-
- // Increment waste limit to prevent getting stuck on this slow path.
- __ add_const_optimized(RtlabWasteLimitValue, RtlabWasteLimitValue, ThreadLocalAllocBuffer::refill_waste_limit_increment());
- __ std(RtlabWasteLimitValue, in_bytes(JavaThread::tlab_refill_waste_limit_offset()), R16_thread);
- }
- // else: No allocation in the shared eden. // fallthru: __ b(Lslow_case);
- }
- // else: Always go the slow path.
-
- // --------------------------------------------------------------------------
- // slow case
- __ bind(Lslow_case);
- call_VM(R17_tos, CAST_FROM_FN_PTR(address, InterpreterRuntime::_new), Rcpool, Rindex);
-
- if (UseTLAB) {
- __ b(Ldone);
- // --------------------------------------------------------------------------
- // Init1: Zero out newly allocated memory.
-
- if (!ZeroTLAB || allow_shared_alloc) {
- // Clear object fields.
- __ bind(Linitialize_object);
-
+ if (!ZeroTLAB) {
+ // --------------------------------------------------------------------------
+ // Init1: Zero out newly allocated memory.
// Initialize remaining object fields.
Register Rbase = Rtags;
__ addi(Rinstance_size, Rinstance_size, 7 - (int)sizeof(oopDesc));
@@ -3760,13 +3716,10 @@
// Clear out object skipping header. Takes also care of the zero length case.
__ clear_memory_doubleword(Rbase, Rinstance_size);
- // fallthru: __ b(Linitialize_header);
}
// --------------------------------------------------------------------------
// Init2: Initialize the header: mark, klass
- __ bind(Linitialize_header);
-
// Init mark.
if (UseBiasedLocking) {
__ ld(Rscratch, in_bytes(Klass::prototype_header_offset()), RinstanceKlass);
@@ -3780,14 +3733,19 @@
__ store_klass(RallocatedObject, RinstanceKlass, Rscratch); // klass (last for cms)
// Check and trigger dtrace event.
- {
- SkipIfEqualZero skip_if(_masm, Rscratch, &DTraceAllocProbes);
- __ push(atos);
- __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_object_alloc));
- __ pop(atos);
- }
+ SkipIfEqualZero::skip_to_label_if_equal_zero(_masm, Rscratch, &DTraceAllocProbes, Ldone);
+ __ push(atos);
+ __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_object_alloc));
+ __ pop(atos);
+
+ __ b(Ldone);
}
+ // --------------------------------------------------------------------------
+ // slow case
+ __ bind(Lslow_case);
+ call_VM(R17_tos, CAST_FROM_FN_PTR(address, InterpreterRuntime::_new), Rcpool, Rindex);
+
// continue
__ bind(Ldone);
--- a/src/hotspot/cpu/s390/relocInfo_s390.hpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/cpu/s390/relocInfo_s390.hpp Thu Jan 18 18:58:46 2018 +0000
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2016 SAP SE. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -110,6 +110,10 @@
pcrel_data_format = 3 // Relocation is for the target data of a pc-relative instruction.
};
+ // This platform has no oops in the code that are not also
+ // listed in the oop section.
+ static bool mustIterateImmediateOopsInCode() { return false; }
+
// Store the new target address into an oop_Relocation cell, if any.
// Return indication if update happened.
static bool update_oop_pool(address begin, address end, address newTarget, CodeBlob* cb);
--- a/src/hotspot/cpu/sparc/compiledIC_sparc.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/cpu/sparc/compiledIC_sparc.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -73,6 +73,11 @@
}
#undef __
+int CompiledStaticCall::to_trampoline_stub_size() {
+ // SPARC doesn't use trampolines.
+ return 0;
+}
+
int CompiledStaticCall::to_interp_stub_size() {
// This doesn't need to be accurate but it must be larger or equal to
// the real size of the stub.
--- a/src/hotspot/cpu/sparc/jvmciCodeInstaller_sparc.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/cpu/sparc/jvmciCodeInstaller_sparc.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -115,7 +115,7 @@
TRACE_jvmci_3("relocating (foreign call) at " PTR_FORMAT, p2i(inst));
}
-void CodeInstaller::pd_relocate_JavaMethod(Handle hotspot_method, jint pc_offset, TRAPS) {
+void CodeInstaller::pd_relocate_JavaMethod(CodeBuffer &, Handle hotspot_method, jint pc_offset, TRAPS) {
#ifdef ASSERT
Method* method = NULL;
// we need to check, this might also be an unresolved method
--- a/src/hotspot/cpu/sparc/relocInfo_sparc.hpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/cpu/sparc/relocInfo_sparc.hpp Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,6 +38,11 @@
format_width = 1
};
+ public:
+
+ // This platform has no oops in the code that are not also
+ // listed in the oop section.
+ static bool mustIterateImmediateOopsInCode() { return false; }
//Reconciliation History
// 1.3 97/10/15 15:38:36 relocInfo_i486.hpp
--- a/src/hotspot/cpu/sparc/templateTable_sparc.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/cpu/sparc/templateTable_sparc.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -3259,11 +3259,19 @@
__ br(Assembler::notZero, false, Assembler::pn, slow_case);
__ delayed()->nop();
- // allocate the instance
- // 1) Try to allocate in the TLAB
- // 2) if fail, and the TLAB is not full enough to discard, allocate in the shared Eden
- // 3) if the above fails (or is not applicable), go to a slow case
- // (creates a new TLAB, etc.)
+ // Allocate the instance:
+ // If TLAB is enabled:
+ // Try to allocate in the TLAB.
+ // If fails, go to the slow path.
+ // Else If inline contiguous allocations are enabled:
+ // Try to allocate in eden.
+ // If fails due to heap end, go to slow path.
+ //
+ // If TLAB is enabled OR inline contiguous is enabled:
+ // Initialize the allocation.
+ // Exit.
+ //
+ // Go to slow path.
const bool allow_shared_alloc =
Universe::heap()->supports_inline_contig_alloc();
@@ -3291,61 +3299,43 @@
}
__ delayed()->st_ptr(RnewTopValue, G2_thread, in_bytes(JavaThread::tlab_top_offset()));
+ // Allocation does not fit in the TLAB.
+ __ ba_short(slow_case);
+ } else {
+ // Allocation in the shared Eden
if (allow_shared_alloc) {
- // Check if tlab should be discarded (refill_waste_limit >= free)
- __ ld_ptr(G2_thread, in_bytes(JavaThread::tlab_refill_waste_limit_offset()), RtlabWasteLimitValue);
- __ sub(RendValue, RoldTopValue, RfreeValue);
- __ srlx(RfreeValue, LogHeapWordSize, RfreeValue);
- __ cmp_and_brx_short(RtlabWasteLimitValue, RfreeValue, Assembler::greaterEqualUnsigned, Assembler::pt, slow_case); // tlab waste is small
-
- // increment waste limit to prevent getting stuck on this slow path
- if (Assembler::is_simm13(ThreadLocalAllocBuffer::refill_waste_limit_increment())) {
- __ add(RtlabWasteLimitValue, ThreadLocalAllocBuffer::refill_waste_limit_increment(), RtlabWasteLimitValue);
- } else {
- // set64 does not use the temp register if the given constant is 32 bit. So
- // we can just use any register; using G0 results in ignoring of the upper 32 bit
- // of that value.
- __ set64(ThreadLocalAllocBuffer::refill_waste_limit_increment(), G4_scratch, G0);
- __ add(RtlabWasteLimitValue, G4_scratch, RtlabWasteLimitValue);
- }
- __ st_ptr(RtlabWasteLimitValue, G2_thread, in_bytes(JavaThread::tlab_refill_waste_limit_offset()));
- } else {
- // No allocation in the shared eden.
- __ ba_short(slow_case);
+ Register RoldTopValue = G1_scratch;
+ Register RtopAddr = G3_scratch;
+ Register RnewTopValue = RallocatedObject;
+ Register RendValue = Rscratch;
+
+ __ set((intptr_t)Universe::heap()->top_addr(), RtopAddr);
+
+ Label retry;
+ __ bind(retry);
+ __ set((intptr_t)Universe::heap()->end_addr(), RendValue);
+ __ ld_ptr(RendValue, 0, RendValue);
+ __ ld_ptr(RtopAddr, 0, RoldTopValue);
+ __ add(RoldTopValue, Roffset, RnewTopValue);
+
+ // RnewTopValue contains the top address after the new object
+ // has been allocated.
+ __ cmp_and_brx_short(RnewTopValue, RendValue, Assembler::greaterUnsigned, Assembler::pn, slow_case);
+
+ __ cas_ptr(RtopAddr, RoldTopValue, RnewTopValue);
+
+ // if someone beat us on the allocation, try again, otherwise continue
+ __ cmp_and_brx_short(RoldTopValue, RnewTopValue, Assembler::notEqual, Assembler::pn, retry);
+
+ // bump total bytes allocated by this thread
+ // RoldTopValue and RtopAddr are dead, so can use G1 and G3
+ __ incr_allocated_bytes(Roffset, G1_scratch, G3_scratch);
}
}
- // Allocation in the shared Eden
- if (allow_shared_alloc) {
- Register RoldTopValue = G1_scratch;
- Register RtopAddr = G3_scratch;
- Register RnewTopValue = RallocatedObject;
- Register RendValue = Rscratch;
-
- __ set((intptr_t)Universe::heap()->top_addr(), RtopAddr);
-
- Label retry;
- __ bind(retry);
- __ set((intptr_t)Universe::heap()->end_addr(), RendValue);
- __ ld_ptr(RendValue, 0, RendValue);
- __ ld_ptr(RtopAddr, 0, RoldTopValue);
- __ add(RoldTopValue, Roffset, RnewTopValue);
-
- // RnewTopValue contains the top address after the new object
- // has been allocated.
- __ cmp_and_brx_short(RnewTopValue, RendValue, Assembler::greaterUnsigned, Assembler::pn, slow_case);
-
- __ cas_ptr(RtopAddr, RoldTopValue, RnewTopValue);
-
- // if someone beat us on the allocation, try again, otherwise continue
- __ cmp_and_brx_short(RoldTopValue, RnewTopValue, Assembler::notEqual, Assembler::pn, retry);
-
- // bump total bytes allocated by this thread
- // RoldTopValue and RtopAddr are dead, so can use G1 and G3
- __ incr_allocated_bytes(Roffset, G1_scratch, G3_scratch);
- }
-
- if (UseTLAB || Universe::heap()->supports_inline_contig_alloc()) {
+ // If UseTLAB or allow_shared_alloc are true, the object is created above and
+ // there is an initialize need. Otherwise, skip and go to the slow path.
+ if (UseTLAB || allow_shared_alloc) {
// clear object fields
__ bind(initialize_object);
__ deccc(Roffset, sizeof(oopDesc));
--- a/src/hotspot/cpu/x86/assembler_x86.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/cpu/x86/assembler_x86.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -3167,6 +3167,89 @@
return;
}
+ if (UseAddressNop && VM_Version::is_zx()) {
+ //
+ // Using multi-bytes nops "0x0F 0x1F [address]" for ZX
+ // 1: 0x90
+ // 2: 0x66 0x90
+ // 3: 0x66 0x66 0x90 (don't use "0x0F 0x1F 0x00" - need patching safe padding)
+ // 4: 0x0F 0x1F 0x40 0x00
+ // 5: 0x0F 0x1F 0x44 0x00 0x00
+ // 6: 0x66 0x0F 0x1F 0x44 0x00 0x00
+ // 7: 0x0F 0x1F 0x80 0x00 0x00 0x00 0x00
+ // 8: 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00
+ // 9: 0x66 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00
+ // 10: 0x66 0x66 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00
+ // 11: 0x66 0x66 0x66 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00
+
+ // The rest coding is ZX specific - don't use consecutive address nops
+
+ // 12: 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00 0x66 0x66 0x66 0x90
+ // 13: 0x66 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00 0x66 0x66 0x66 0x90
+ // 14: 0x66 0x66 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00 0x66 0x66 0x66 0x90
+ // 15: 0x66 0x66 0x66 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00 0x66 0x66 0x66 0x90
+
+ while (i >= 15) {
+ // For ZX don't generate consecutive addess nops (mix with regular nops)
+ i -= 15;
+ emit_int8(0x66); // size prefix
+ emit_int8(0x66); // size prefix
+ emit_int8(0x66); // size prefix
+ addr_nop_8();
+ emit_int8(0x66); // size prefix
+ emit_int8(0x66); // size prefix
+ emit_int8(0x66); // size prefix
+ emit_int8((unsigned char)0x90);
+ // nop
+ }
+ switch (i) {
+ case 14:
+ emit_int8(0x66); // size prefix
+ case 13:
+ emit_int8(0x66); // size prefix
+ case 12:
+ addr_nop_8();
+ emit_int8(0x66); // size prefix
+ emit_int8(0x66); // size prefix
+ emit_int8(0x66); // size prefix
+ emit_int8((unsigned char)0x90);
+ // nop
+ break;
+ case 11:
+ emit_int8(0x66); // size prefix
+ case 10:
+ emit_int8(0x66); // size prefix
+ case 9:
+ emit_int8(0x66); // size prefix
+ case 8:
+ addr_nop_8();
+ break;
+ case 7:
+ addr_nop_7();
+ break;
+ case 6:
+ emit_int8(0x66); // size prefix
+ case 5:
+ addr_nop_5();
+ break;
+ case 4:
+ addr_nop_4();
+ break;
+ case 3:
+ // Don't use "0x0F 0x1F 0x00" - need patching safe padding
+ emit_int8(0x66); // size prefix
+ case 2:
+ emit_int8(0x66); // size prefix
+ case 1:
+ emit_int8((unsigned char)0x90);
+ // nop
+ break;
+ default:
+ assert(i == 0, " ");
+ }
+ return;
+ }
+
// Using nops with size prefixes "0x66 0x90".
// From AMD Optimization Guide:
// 1: 0x90
--- a/src/hotspot/cpu/x86/compiledIC_x86.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/cpu/x86/compiledIC_x86.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -73,6 +73,11 @@
LP64_ONLY(15); // movq (1+1+8); jmp (1+4)
}
+int CompiledStaticCall::to_trampoline_stub_size() {
+ // x86 doesn't use trampolines.
+ return 0;
+}
+
// Relocation entries for call stub, compiled java to interpreter.
int CompiledStaticCall::reloc_to_interp_stub() {
return 4; // 3 in emit_to_interp_stub + 1 in emit_call
--- a/src/hotspot/cpu/x86/jvmciCodeInstaller_x86.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/cpu/x86/jvmciCodeInstaller_x86.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -144,7 +144,7 @@
TRACE_jvmci_3("relocating (foreign call) at " PTR_FORMAT, p2i(inst));
}
-void CodeInstaller::pd_relocate_JavaMethod(Handle hotspot_method, jint pc_offset, TRAPS) {
+void CodeInstaller::pd_relocate_JavaMethod(CodeBuffer &, Handle hotspot_method, jint pc_offset, TRAPS) {
#ifdef ASSERT
Method* method = NULL;
// we need to check, this might also be an unresolved method
--- a/src/hotspot/cpu/x86/relocInfo_x86.hpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/cpu/x86/relocInfo_x86.hpp Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -40,4 +40,10 @@
#endif
};
+ public:
+
+ // Instruct loadConP of x86_64.ad places oops in code that are not also
+ // listed in the oop section.
+ static bool mustIterateImmediateOopsInCode() { return true; }
+
#endif // CPU_X86_VM_RELOCINFO_X86_HPP
--- a/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -433,7 +433,7 @@
//----------------------------------------------------------------------------------------------------
- // Support for jint Atomic::xchg(jint exchange_value, volatile jint* dest)
+ // Support for int32_t Atomic::xchg(int32_t exchange_value, volatile int32_t* dest)
//
// xchg exists as far back as 8086, lock needed for MP only
// Stack layout immediately after call:
--- a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -611,8 +611,8 @@
return start;
}
- // Support for jbyte atomic::atomic_cmpxchg(jbyte exchange_value, volatile jbyte* dest,
- // jbyte compare_value)
+ // Support for int8_t atomic::atomic_cmpxchg(int8_t exchange_value, volatile int8_t* dest,
+ // int8_t compare_value)
//
// Arguments :
// c_rarg0: exchange_value
@@ -637,9 +637,9 @@
return start;
}
- // Support for jlong atomic::atomic_cmpxchg(jlong exchange_value,
- // volatile jlong* dest,
- // jlong compare_value)
+ // Support for int64_t atomic::atomic_cmpxchg(int64_t exchange_value,
+ // volatile int64_t* dest,
+ // int64_t compare_value)
// Arguments :
// c_rarg0: exchange_value
// c_rarg1: dest
@@ -694,8 +694,8 @@
// Result:
// *dest += add_value
// return *dest;
- address generate_atomic_add_ptr() {
- StubCodeMark mark(this, "StubRoutines", "atomic_add_ptr");
+ address generate_atomic_add_long() {
+ StubCodeMark mark(this, "StubRoutines", "atomic_add_long");
address start = __ pc();
__ movptr(rax, c_rarg0); // Copy to eax we need a return value anyhow
@@ -5015,14 +5015,14 @@
StubRoutines::_catch_exception_entry = generate_catch_exception();
// atomic calls
- StubRoutines::_atomic_xchg_entry = generate_atomic_xchg();
- StubRoutines::_atomic_xchg_long_entry = generate_atomic_xchg_long();
- StubRoutines::_atomic_cmpxchg_entry = generate_atomic_cmpxchg();
- StubRoutines::_atomic_cmpxchg_byte_entry = generate_atomic_cmpxchg_byte();
- StubRoutines::_atomic_cmpxchg_long_entry = generate_atomic_cmpxchg_long();
- StubRoutines::_atomic_add_entry = generate_atomic_add();
- StubRoutines::_atomic_add_ptr_entry = generate_atomic_add_ptr();
- StubRoutines::_fence_entry = generate_orderaccess_fence();
+ StubRoutines::_atomic_xchg_entry = generate_atomic_xchg();
+ StubRoutines::_atomic_xchg_long_entry = generate_atomic_xchg_long();
+ StubRoutines::_atomic_cmpxchg_entry = generate_atomic_cmpxchg();
+ StubRoutines::_atomic_cmpxchg_byte_entry = generate_atomic_cmpxchg_byte();
+ StubRoutines::_atomic_cmpxchg_long_entry = generate_atomic_cmpxchg_long();
+ StubRoutines::_atomic_add_entry = generate_atomic_add();
+ StubRoutines::_atomic_add_long_entry = generate_atomic_add_long();
+ StubRoutines::_fence_entry = generate_orderaccess_fence();
// platform dependent
StubRoutines::x86::_get_previous_fp_entry = generate_get_previous_fp();
--- a/src/hotspot/cpu/x86/templateTable_x86.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/cpu/x86/templateTable_x86.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -3869,7 +3869,6 @@
Label done;
Label initialize_header;
Label initialize_object; // including clearing the fields
- Label allocate_shared;
__ get_cpool_and_tags(rcx, rax);
@@ -3895,12 +3894,19 @@
__ testl(rdx, Klass::_lh_instance_slow_path_bit);
__ jcc(Assembler::notZero, slow_case);
+ // Allocate the instance:
+ // If TLAB is enabled:
+ // Try to allocate in the TLAB.
+ // If fails, go to the slow path.
+ // Else If inline contiguous allocations are enabled:
+ // Try to allocate in eden.
+ // If fails due to heap end, go to slow path.
//
- // Allocate the instance
- // 1) Try to allocate in the TLAB
- // 2) if fail and the object is large allocate in the shared Eden
- // 3) if the above fails (or is not applicable), go to a slow case
- // (creates a new TLAB, etc.)
+ // If TLAB is enabled OR inline contiguous is enabled:
+ // Initialize the allocation.
+ // Exit.
+ //
+ // Go to slow path.
const bool allow_shared_alloc =
Universe::heap()->supports_inline_contig_alloc();
@@ -3916,7 +3922,7 @@
__ movptr(rax, Address(thread, in_bytes(JavaThread::tlab_top_offset())));
__ lea(rbx, Address(rax, rdx, Address::times_1));
__ cmpptr(rbx, Address(thread, in_bytes(JavaThread::tlab_end_offset())));
- __ jcc(Assembler::above, allow_shared_alloc ? allocate_shared : slow_case);
+ __ jcc(Assembler::above, slow_case);
__ movptr(Address(thread, in_bytes(JavaThread::tlab_top_offset())), rbx);
if (ZeroTLAB) {
// the fields have been already cleared
@@ -3925,40 +3931,40 @@
// initialize both the header and fields
__ jmp(initialize_object);
}
+ } else {
+ // Allocation in the shared Eden, if allowed.
+ //
+ // rdx: instance size in bytes
+ if (allow_shared_alloc) {
+ ExternalAddress heap_top((address)Universe::heap()->top_addr());
+ ExternalAddress heap_end((address)Universe::heap()->end_addr());
+
+ Label retry;
+ __ bind(retry);
+ __ movptr(rax, heap_top);
+ __ lea(rbx, Address(rax, rdx, Address::times_1));
+ __ cmpptr(rbx, heap_end);
+ __ jcc(Assembler::above, slow_case);
+
+ // Compare rax, with the top addr, and if still equal, store the new
+ // top addr in rbx, at the address of the top addr pointer. Sets ZF if was
+ // equal, and clears it otherwise. Use lock prefix for atomicity on MPs.
+ //
+ // rax,: object begin
+ // rbx,: object end
+ // rdx: instance size in bytes
+ __ locked_cmpxchgptr(rbx, heap_top);
+
+ // if someone beat us on the allocation, try again, otherwise continue
+ __ jcc(Assembler::notEqual, retry);
+
+ __ incr_allocated_bytes(thread, rdx, 0);
+ }
}
- // Allocation in the shared Eden, if allowed.
- //
- // rdx: instance size in bytes
- if (allow_shared_alloc) {
- __ bind(allocate_shared);
-
- ExternalAddress heap_top((address)Universe::heap()->top_addr());
- ExternalAddress heap_end((address)Universe::heap()->end_addr());
-
- Label retry;
- __ bind(retry);
- __ movptr(rax, heap_top);
- __ lea(rbx, Address(rax, rdx, Address::times_1));
- __ cmpptr(rbx, heap_end);
- __ jcc(Assembler::above, slow_case);
-
- // Compare rax, with the top addr, and if still equal, store the new
- // top addr in rbx, at the address of the top addr pointer. Sets ZF if was
- // equal, and clears it otherwise. Use lock prefix for atomicity on MPs.
- //
- // rax,: object begin
- // rbx,: object end
- // rdx: instance size in bytes
- __ locked_cmpxchgptr(rbx, heap_top);
-
- // if someone beat us on the allocation, try again, otherwise continue
- __ jcc(Assembler::notEqual, retry);
-
- __ incr_allocated_bytes(thread, rdx, 0);
- }
-
- if (UseTLAB || Universe::heap()->supports_inline_contig_alloc()) {
+ // If UseTLAB or allow_shared_alloc are true, the object is created above and
+ // there is an initialize need. Otherwise, skip and go to the slow path.
+ if (UseTLAB || allow_shared_alloc) {
// The object is initialized before the header. If the object size is
// zero, go directly to the header initialization.
__ bind(initialize_object);
--- a/src/hotspot/cpu/x86/vm_version_x86.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/cpu/x86/vm_version_x86.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -628,6 +628,11 @@
if (UseSSE < 1)
_features &= ~CPU_SSE;
+ //since AVX instructions is slower than SSE in some ZX cpus, force USEAVX=0.
+ if (is_zx() && ((cpu_family() == 6) || (cpu_family() == 7))) {
+ UseAVX = 0;
+ }
+
// first try initial setting and detect what we can support
int use_avx_limit = 0;
if (UseAVX > 0) {
@@ -1078,6 +1083,66 @@
// UseXmmRegToRegMoveAll == true --> movaps(xmm, xmm), movapd(xmm, xmm).
// UseXmmRegToRegMoveAll == false --> movss(xmm, xmm), movsd(xmm, xmm).
+
+ if (is_zx()) { // ZX cpus specific settings
+ if (FLAG_IS_DEFAULT(UseStoreImmI16)) {
+ UseStoreImmI16 = false; // don't use it on ZX cpus
+ }
+ if ((cpu_family() == 6) || (cpu_family() == 7)) {
+ if (FLAG_IS_DEFAULT(UseAddressNop)) {
+ // Use it on all ZX cpus
+ UseAddressNop = true;
+ }
+ }
+ if (FLAG_IS_DEFAULT(UseXmmLoadAndClearUpper)) {
+ UseXmmLoadAndClearUpper = true; // use movsd on all ZX cpus
+ }
+ if (FLAG_IS_DEFAULT(UseXmmRegToRegMoveAll)) {
+ if (supports_sse3()) {
+ UseXmmRegToRegMoveAll = true; // use movaps, movapd on new ZX cpus
+ } else {
+ UseXmmRegToRegMoveAll = false;
+ }
+ }
+ if (((cpu_family() == 6) || (cpu_family() == 7)) && supports_sse3()) { // new ZX cpus
+#ifdef COMPILER2
+ if (FLAG_IS_DEFAULT(MaxLoopPad)) {
+ // For new ZX cpus do the next optimization:
+ // don't align the beginning of a loop if there are enough instructions
+ // left (NumberOfLoopInstrToAlign defined in c2_globals.hpp)
+ // in current fetch line (OptoLoopAlignment) or the padding
+ // is big (> MaxLoopPad).
+ // Set MaxLoopPad to 11 for new ZX cpus to reduce number of
+ // generated NOP instructions. 11 is the largest size of one
+ // address NOP instruction '0F 1F' (see Assembler::nop(i)).
+ MaxLoopPad = 11;
+ }
+#endif // COMPILER2
+ if (FLAG_IS_DEFAULT(UseXMMForArrayCopy)) {
+ UseXMMForArrayCopy = true; // use SSE2 movq on new ZX cpus
+ }
+ if (supports_sse4_2()) { // new ZX cpus
+ if (FLAG_IS_DEFAULT(UseUnalignedLoadStores)) {
+ UseUnalignedLoadStores = true; // use movdqu on newest ZX cpus
+ }
+ }
+ if (supports_sse4_2()) {
+ if (FLAG_IS_DEFAULT(UseSSE42Intrinsics)) {
+ FLAG_SET_DEFAULT(UseSSE42Intrinsics, true);
+ }
+ } else {
+ if (UseSSE42Intrinsics && !FLAG_IS_DEFAULT(UseAESIntrinsics)) {
+ warning("SSE4.2 intrinsics require SSE4.2 instructions or higher. Intrinsics will be disabled.");
+ }
+ FLAG_SET_DEFAULT(UseSSE42Intrinsics, false);
+ }
+ }
+
+ if (FLAG_IS_DEFAULT(AllocatePrefetchInstr) && supports_3dnow_prefetch()) {
+ FLAG_SET_DEFAULT(AllocatePrefetchInstr, 3);
+ }
+ }
+
if( is_amd() ) { // AMD cpus specific settings
if( supports_sse2() && FLAG_IS_DEFAULT(UseAddressNop) ) {
// Use it on new AMD cpus starting from Opteron.
@@ -1374,6 +1439,14 @@
#endif
}
+ if (is_zx() && ((cpu_family() == 6) || (cpu_family() == 7)) && supports_sse4_2()) {
+#ifdef COMPILER2
+ if (FLAG_IS_DEFAULT(UseFPUForSpilling)) {
+ FLAG_SET_DEFAULT(UseFPUForSpilling, true);
+ }
+#endif
+ }
+
#ifdef _LP64
// Prefetch settings
--- a/src/hotspot/cpu/x86/vm_version_x86.hpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/cpu/x86/vm_version_x86.hpp Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -305,6 +305,9 @@
enum Extended_Family {
// AMD
CPU_FAMILY_AMD_11H = 0x11,
+ // ZX
+ CPU_FAMILY_ZX_CORE_F6 = 6,
+ CPU_FAMILY_ZX_CORE_F7 = 7,
// Intel
CPU_FAMILY_INTEL_CORE = 6,
CPU_MODEL_NEHALEM = 0x1e,
@@ -549,6 +552,16 @@
}
}
+ // ZX features.
+ if (is_zx()) {
+ if (_cpuid_info.ext_cpuid1_ecx.bits.lzcnt_intel != 0)
+ result |= CPU_LZCNT;
+ // for ZX, ecx.bits.misalignsse bit (bit 8) indicates support for prefetchw
+ if (_cpuid_info.ext_cpuid1_ecx.bits.misalignsse != 0) {
+ result |= CPU_3DNOW_PREFETCH;
+ }
+ }
+
return result;
}
@@ -657,6 +670,7 @@
static bool is_P6() { return cpu_family() >= 6; }
static bool is_amd() { assert_is_initialized(); return _cpuid_info.std_vendor_name_0 == 0x68747541; } // 'htuA'
static bool is_intel() { assert_is_initialized(); return _cpuid_info.std_vendor_name_0 == 0x756e6547; } // 'uneG'
+ static bool is_zx() { assert_is_initialized(); return (_cpuid_info.std_vendor_name_0 == 0x746e6543) || (_cpuid_info.std_vendor_name_0 == 0x68532020); } // 'tneC'||'hS '
static bool is_atom_family() { return ((cpu_family() == 0x06) && ((extended_cpu_model() == 0x36) || (extended_cpu_model() == 0x37) || (extended_cpu_model() == 0x4D))); } //Silvermont and Centerton
static bool is_knights_family() { return ((cpu_family() == 0x06) && ((extended_cpu_model() == 0x57) || (extended_cpu_model() == 0x85))); } // Xeon Phi 3200/5200/7200 and Future Xeon Phi
@@ -680,6 +694,15 @@
}
} else if (is_amd()) {
result = (_cpuid_info.ext_cpuid8_ecx.bits.cores_per_cpu + 1);
+ } else if (is_zx()) {
+ bool supports_topology = supports_processor_topology();
+ if (supports_topology) {
+ result = _cpuid_info.tpl_cpuidB1_ebx.bits.logical_cpus /
+ _cpuid_info.tpl_cpuidB0_ebx.bits.logical_cpus;
+ }
+ if (!supports_topology || result == 0) {
+ result = (_cpuid_info.dcp_cpuid4_eax.bits.cores_per_cpu + 1);
+ }
}
return result;
}
@@ -688,6 +711,8 @@
uint result = 1;
if (is_intel() && supports_processor_topology()) {
result = _cpuid_info.tpl_cpuidB0_ebx.bits.logical_cpus;
+ } else if (is_zx() && supports_processor_topology()) {
+ result = _cpuid_info.tpl_cpuidB0_ebx.bits.logical_cpus;
} else if (_cpuid_info.std_cpuid1_edx.bits.ht != 0) {
if (cpu_family() >= 0x17) {
result = _cpuid_info.ext_cpuid1E_ebx.bits.threads_per_core + 1;
@@ -705,6 +730,8 @@
result = (_cpuid_info.dcp_cpuid4_ebx.bits.L1_line_size + 1);
} else if (is_amd()) {
result = _cpuid_info.ext_cpuid5_ecx.bits.L1_line_size;
+ } else if (is_zx()) {
+ result = (_cpuid_info.dcp_cpuid4_ebx.bits.L1_line_size + 1);
}
if (result < 32) // not defined ?
result = 32; // 32 bytes by default on x86 and other x64
--- a/src/hotspot/cpu/zero/relocInfo_zero.hpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/cpu/zero/relocInfo_zero.hpp Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright 2007 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -34,4 +34,8 @@
format_width = 1
};
+ public:
+
+ static bool mustIterateImmediateOopsInCode() { return true; }
+
#endif // CPU_ZERO_VM_RELOCINFO_ZERO_HPP
--- a/src/hotspot/cpu/zero/stubGenerator_zero.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/cpu/zero/stubGenerator_zero.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -258,7 +258,7 @@
StubRoutines::_atomic_cmpxchg_byte_entry = ShouldNotCallThisStub();
StubRoutines::_atomic_cmpxchg_long_entry = ShouldNotCallThisStub();
StubRoutines::_atomic_add_entry = ShouldNotCallThisStub();
- StubRoutines::_atomic_add_ptr_entry = ShouldNotCallThisStub();
+ StubRoutines::_atomic_add_long_entry = ShouldNotCallThisStub();
StubRoutines::_fence_entry = ShouldNotCallThisStub();
}
--- a/src/hotspot/os_cpu/bsd_x86/atomic_bsd_x86.hpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/os_cpu/bsd_x86/atomic_bsd_x86.hpp Thu Jan 18 18:58:46 2018 +0000
@@ -132,8 +132,8 @@
extern "C" {
// defined in bsd_x86.s
- jlong _Atomic_cmpxchg_long(jlong, volatile jlong*, jlong, bool);
- void _Atomic_move_long(const volatile jlong* src, volatile jlong* dst);
+ int64_t _Atomic_cmpxchg_long(int64_t, volatile int64_t*, int64_t, bool);
+ void _Atomic_move_long(const volatile int64_t* src, volatile int64_t* dst);
}
template<>
@@ -143,15 +143,15 @@
T compare_value,
cmpxchg_memory_order order) const {
STATIC_ASSERT(8 == sizeof(T));
- return cmpxchg_using_helper<jlong>(_Atomic_cmpxchg_long, exchange_value, dest, compare_value);
+ return cmpxchg_using_helper<int64_t>(_Atomic_cmpxchg_long, exchange_value, dest, compare_value);
}
template<>
template<typename T>
inline T Atomic::PlatformLoad<8>::operator()(T const volatile* src) const {
STATIC_ASSERT(8 == sizeof(T));
- volatile jlong dest;
- _Atomic_move_long(reinterpret_cast<const volatile jlong*>(src), reinterpret_cast<volatile jlong*>(&dest));
+ volatile int64_t dest;
+ _Atomic_move_long(reinterpret_cast<const volatile int64_t*>(src), reinterpret_cast<volatile int64_t*>(&dest));
return PrimitiveConversions::cast<T>(dest);
}
@@ -160,7 +160,7 @@
inline void Atomic::PlatformStore<8>::operator()(T store_value,
T volatile* dest) const {
STATIC_ASSERT(8 == sizeof(T));
- _Atomic_move_long(reinterpret_cast<const volatile jlong*>(&store_value), reinterpret_cast<volatile jlong*>(dest));
+ _Atomic_move_long(reinterpret_cast<const volatile int64_t*>(&store_value), reinterpret_cast<volatile int64_t*>(dest));
}
#endif // AMD64
--- a/src/hotspot/os_cpu/bsd_x86/bsd_x86_32.s Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/os_cpu/bsd_x86/bsd_x86_32.s Thu Jan 18 18:58:46 2018 +0000
@@ -633,10 +633,10 @@
ret
- # Support for jlong Atomic::cmpxchg(jlong exchange_value,
- # volatile jlong* dest,
- # jlong compare_value,
- # bool is_MP)
+ # Support for int64_t Atomic::cmpxchg(int64_t exchange_value,
+ # volatile int64_t* dest,
+ # int64_t compare_value,
+ # bool is_MP)
#
.p2align 4,,15
ELF_TYPE(_Atomic_cmpxchg_long,@function)
@@ -658,8 +658,8 @@
ret
- # Support for jlong Atomic::load and Atomic::store.
- # void _Atomic_move_long(const volatile jlong* src, volatile jlong* dst)
+ # Support for int64_t Atomic::load and Atomic::store.
+ # void _Atomic_move_long(const volatile int64_t* src, volatile int64_t* dst)
.p2align 4,,15
ELF_TYPE(_Atomic_move_long,@function)
SYMBOL(_Atomic_move_long):
--- a/src/hotspot/os_cpu/bsd_zero/atomic_bsd_zero.hpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/os_cpu/bsd_zero/atomic_bsd_zero.hpp Thu Jan 18 18:58:46 2018 +0000
@@ -265,8 +265,8 @@
template<typename T>
inline T Atomic::PlatformLoad<8>::operator()(T const volatile* src) const {
STATIC_ASSERT(8 == sizeof(T));
- volatile jlong dest;
- os::atomic_copy64(reinterpret_cast<const volatile jlong*>(src), reinterpret_cast<volatile jlong*>(&dest));
+ volatile int64_t dest;
+ os::atomic_copy64(reinterpret_cast<const volatile int64_t*>(src), reinterpret_cast<volatile int64_t*>(&dest));
return PrimitiveConversions::cast<T>(dest);
}
@@ -275,7 +275,7 @@
inline void Atomic::PlatformStore<8>::operator()(T store_value,
T volatile* dest) const {
STATIC_ASSERT(8 == sizeof(T));
- os::atomic_copy64(reinterpret_cast<const volatile jlong*>(&store_value), reinterpret_cast<volatile jlong*>(dest));
+ os::atomic_copy64(reinterpret_cast<const volatile int64_t*>(&store_value), reinterpret_cast<volatile int64_t*>(dest));
}
#endif // OS_CPU_BSD_ZERO_VM_ATOMIC_BSD_ZERO_HPP
--- a/src/hotspot/os_cpu/linux_arm/atomic_linux_arm.hpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/os_cpu/linux_arm/atomic_linux_arm.hpp Thu Jan 18 18:58:46 2018 +0000
@@ -50,7 +50,7 @@
inline T Atomic::PlatformLoad<8>::operator()(T const volatile* src) const {
STATIC_ASSERT(8 == sizeof(T));
return PrimitiveConversions::cast<T>(
- (*os::atomic_load_long_func)(reinterpret_cast<const volatile jlong*>(src)));
+ (*os::atomic_load_long_func)(reinterpret_cast<const volatile int64_t*>(src)));
}
template<>
@@ -59,7 +59,7 @@
T volatile* dest) const {
STATIC_ASSERT(8 == sizeof(T));
(*os::atomic_store_long_func)(
- PrimitiveConversions::cast<jlong>(store_value), reinterpret_cast<volatile jlong*>(dest));
+ PrimitiveConversions::cast<int64_t>(store_value), reinterpret_cast<volatile int64_t*>(dest));
}
#endif
@@ -103,7 +103,7 @@
: "memory");
return val;
#else
- return add_using_helper<jint>(os::atomic_add_func, add_value, dest);
+ return add_using_helper<int32_t>(os::atomic_add_func, add_value, dest);
#endif
}
@@ -146,7 +146,7 @@
: "memory");
return old_val;
#else
- return xchg_using_helper<jint>(os::atomic_xchg_func, exchange_value, dest);
+ return xchg_using_helper<int32_t>(os::atomic_xchg_func, exchange_value, dest);
#endif
}
@@ -178,17 +178,17 @@
#ifndef AARCH64
-inline jint reorder_cmpxchg_func(jint exchange_value,
- jint volatile* dest,
- jint compare_value) {
+inline int32_t reorder_cmpxchg_func(int32_t exchange_value,
+ int32_t volatile* dest,
+ int32_t compare_value) {
// Warning: Arguments are swapped to avoid moving them for kernel call
return (*os::atomic_cmpxchg_func)(compare_value, exchange_value, dest);
}
-inline jlong reorder_cmpxchg_long_func(jlong exchange_value,
- jlong volatile* dest,
- jlong compare_value) {
- assert(VM_Version::supports_cx8(), "Atomic compare and exchange jlong not supported on this architecture!");
+inline int64_t reorder_cmpxchg_long_func(int64_t exchange_value,
+ int64_t volatile* dest,
+ int64_t compare_value) {
+ assert(VM_Version::supports_cx8(), "Atomic compare and exchange int64_t not supported on this architecture!");
// Warning: Arguments are swapped to avoid moving them for kernel call
return (*os::atomic_cmpxchg_long_func)(compare_value, exchange_value, dest);
}
@@ -221,7 +221,7 @@
: "memory");
return rv;
#else
- return cmpxchg_using_helper<jint>(reorder_cmpxchg_func, exchange_value, dest, compare_value);
+ return cmpxchg_using_helper<int32_t>(reorder_cmpxchg_func, exchange_value, dest, compare_value);
#endif
}
@@ -251,7 +251,7 @@
: "memory");
return rv;
#else
- return cmpxchg_using_helper<jlong>(reorder_cmpxchg_long_func, exchange_value, dest, compare_value);
+ return cmpxchg_using_helper<int64_t>(reorder_cmpxchg_long_func, exchange_value, dest, compare_value);
#endif
}
--- a/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -598,11 +598,11 @@
#ifndef AARCH64
-typedef jlong cmpxchg_long_func_t(jlong, jlong, volatile jlong*);
+typedef int64_t cmpxchg_long_func_t(int64_t, int64_t, volatile int64_t*);
cmpxchg_long_func_t* os::atomic_cmpxchg_long_func = os::atomic_cmpxchg_long_bootstrap;
-jlong os::atomic_cmpxchg_long_bootstrap(jlong compare_value, jlong exchange_value, volatile jlong* dest) {
+int64_t os::atomic_cmpxchg_long_bootstrap(int64_t compare_value, int64_t exchange_value, volatile int64_t* dest) {
// try to use the stub:
cmpxchg_long_func_t* func = CAST_TO_FN_PTR(cmpxchg_long_func_t*, StubRoutines::atomic_cmpxchg_long_entry());
@@ -612,16 +612,16 @@
}
assert(Threads::number_of_threads() == 0, "for bootstrap only");
- jlong old_value = *dest;
+ int64_t old_value = *dest;
if (old_value == compare_value)
*dest = exchange_value;
return old_value;
}
-typedef jlong load_long_func_t(const volatile jlong*);
+typedef int64_t load_long_func_t(const volatile int64_t*);
load_long_func_t* os::atomic_load_long_func = os::atomic_load_long_bootstrap;
-jlong os::atomic_load_long_bootstrap(const volatile jlong* src) {
+int64_t os::atomic_load_long_bootstrap(const volatile int64_t* src) {
// try to use the stub:
load_long_func_t* func = CAST_TO_FN_PTR(load_long_func_t*, StubRoutines::atomic_load_long_entry());
@@ -631,15 +631,15 @@
}
assert(Threads::number_of_threads() == 0, "for bootstrap only");
- jlong old_value = *src;
+ int64_t old_value = *src;
return old_value;
}
-typedef void store_long_func_t(jlong, volatile jlong*);
+typedef void store_long_func_t(int64_t, volatile int64_t*);
store_long_func_t* os::atomic_store_long_func = os::atomic_store_long_bootstrap;
-void os::atomic_store_long_bootstrap(jlong val, volatile jlong* dest) {
+void os::atomic_store_long_bootstrap(int64_t val, volatile int64_t* dest) {
// try to use the stub:
store_long_func_t* func = CAST_TO_FN_PTR(store_long_func_t*, StubRoutines::atomic_store_long_entry());
@@ -652,11 +652,11 @@
*dest = val;
}
-typedef jint atomic_add_func_t(jint add_value, volatile jint *dest);
+typedef int32_t atomic_add_func_t(int32_t add_value, volatile int32_t *dest);
atomic_add_func_t * os::atomic_add_func = os::atomic_add_bootstrap;
-jint os::atomic_add_bootstrap(jint add_value, volatile jint *dest) {
+int32_t os::atomic_add_bootstrap(int32_t add_value, volatile int32_t *dest) {
atomic_add_func_t * func = CAST_TO_FN_PTR(atomic_add_func_t*,
StubRoutines::atomic_add_entry());
if (func != NULL) {
@@ -664,16 +664,16 @@
return (*func)(add_value, dest);
}
- jint old_value = *dest;
+ int32_t old_value = *dest;
*dest = old_value + add_value;
return (old_value + add_value);
}
-typedef jint atomic_xchg_func_t(jint exchange_value, volatile jint *dest);
+typedef int32_t atomic_xchg_func_t(int32_t exchange_value, volatile int32_t *dest);
atomic_xchg_func_t * os::atomic_xchg_func = os::atomic_xchg_bootstrap;
-jint os::atomic_xchg_bootstrap(jint exchange_value, volatile jint *dest) {
+int32_t os::atomic_xchg_bootstrap(int32_t exchange_value, volatile int32_t *dest) {
atomic_xchg_func_t * func = CAST_TO_FN_PTR(atomic_xchg_func_t*,
StubRoutines::atomic_xchg_entry());
if (func != NULL) {
@@ -681,16 +681,16 @@
return (*func)(exchange_value, dest);
}
- jint old_value = *dest;
+ int32_t old_value = *dest;
*dest = exchange_value;
return (old_value);
}
-typedef jint cmpxchg_func_t(jint, jint, volatile jint*);
+typedef int32_t cmpxchg_func_t(int32_t, int32_t, volatile int32_t*);
cmpxchg_func_t* os::atomic_cmpxchg_func = os::atomic_cmpxchg_bootstrap;
-jint os::atomic_cmpxchg_bootstrap(jint compare_value, jint exchange_value, volatile jint* dest) {
+int32_t os::atomic_cmpxchg_bootstrap(int32_t compare_value, int32_t exchange_value, volatile int32_t* dest) {
// try to use the stub:
cmpxchg_func_t* func = CAST_TO_FN_PTR(cmpxchg_func_t*, StubRoutines::atomic_cmpxchg_entry());
@@ -700,7 +700,7 @@
}
assert(Threads::number_of_threads() == 0, "for bootstrap only");
- jint old_value = *dest;
+ int32_t old_value = *dest;
if (old_value == compare_value)
*dest = exchange_value;
return old_value;
--- a/src/hotspot/os_cpu/linux_arm/os_linux_arm.hpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/os_cpu/linux_arm/os_linux_arm.hpp Thu Jan 18 18:58:46 2018 +0000
@@ -45,35 +45,35 @@
static bool register_code_area(char *low, char *high) { return true; }
#ifndef AARCH64
- static jlong (*atomic_cmpxchg_long_func)(jlong compare_value,
- jlong exchange_value,
- volatile jlong *dest);
+ static int64_t (*atomic_cmpxchg_long_func)(int64_t compare_value,
+ int64_t exchange_value,
+ volatile int64_t *dest);
- static jlong (*atomic_load_long_func)(const volatile jlong*);
+ static int64_t (*atomic_load_long_func)(const volatile int64_t*);
- static void (*atomic_store_long_func)(jlong, volatile jlong*);
+ static void (*atomic_store_long_func)(int64_t, volatile int64_t*);
- static jint (*atomic_add_func)(jint add_value, volatile jint *dest);
+ static int32_t (*atomic_add_func)(int32_t add_value, volatile int32_t *dest);
- static jint (*atomic_xchg_func)(jint exchange_value, volatile jint *dest);
+ static int32_t (*atomic_xchg_func)(int32_t exchange_value, volatile int32_t *dest);
- static jint (*atomic_cmpxchg_func)(jint compare_value,
- jint exchange_value,
- volatile jint *dest);
+ static int32_t (*atomic_cmpxchg_func)(int32_t compare_value,
+ int32_t exchange_value,
+ volatile int32_t *dest);
- static jlong atomic_cmpxchg_long_bootstrap(jlong, jlong, volatile jlong*);
+ static int64_t atomic_cmpxchg_long_bootstrap(int64_t, int64_t, volatile int64_t*);
- static jlong atomic_load_long_bootstrap(const volatile jlong*);
+ static int64_t atomic_load_long_bootstrap(const volatile int64_t*);
- static void atomic_store_long_bootstrap(jlong, volatile jlong*);
+ static void atomic_store_long_bootstrap(int64_t, volatile int64_t*);
- static jint atomic_add_bootstrap(jint add_value, volatile jint *dest);
+ static int32_t atomic_add_bootstrap(int32_t add_value, volatile int32_t *dest);
- static jint atomic_xchg_bootstrap(jint exchange_value, volatile jint *dest);
+ static int32_t atomic_xchg_bootstrap(int32_t exchange_value, volatile int32_t *dest);
- static jint atomic_cmpxchg_bootstrap(jint compare_value,
- jint exchange_value,
- volatile jint *dest);
+ static int32_t atomic_cmpxchg_bootstrap(int32_t compare_value,
+ int32_t exchange_value,
+ volatile int32_t *dest);
#endif // !AARCH64
#endif // OS_CPU_LINUX_ARM_VM_OS_LINUX_ARM_HPP
--- a/src/hotspot/os_cpu/linux_sparc/os_linux_sparc.hpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/os_cpu/linux_sparc/os_linux_sparc.hpp Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -28,15 +28,15 @@
//
// NOTE: we are back in class os here, not Linux
//
- static jint (*atomic_xchg_func) (jint, volatile jint*);
- static jint (*atomic_cmpxchg_func) (jint, volatile jint*, jint);
- static jlong (*atomic_cmpxchg_long_func)(jlong, volatile jlong*, jlong);
- static jint (*atomic_add_func) (jint, volatile jint*);
+ static int32_t (*atomic_xchg_func) (int32_t, volatile int32_t*);
+ static int32_t (*atomic_cmpxchg_func) (int32_t, volatile int32_t*, int32_t);
+ static int64_t (*atomic_cmpxchg_long_func)(int64_t, volatile int64_t*, int64_t);
+ static int32_t (*atomic_add_func) (int32_t, volatile int32_t*);
- static jint atomic_xchg_bootstrap (jint, volatile jint*);
- static jint atomic_cmpxchg_bootstrap (jint, volatile jint*, jint);
- static jlong atomic_cmpxchg_long_bootstrap(jlong, volatile jlong*, jlong);
- static jint atomic_add_bootstrap (jint, volatile jint*);
+ static int32_t atomic_xchg_bootstrap (int32_t, volatile int32_t*);
+ static int32_t atomic_cmpxchg_bootstrap (int32_t, volatile int32_t*, int32_t);
+ static int64_t atomic_cmpxchg_long_bootstrap(int64_t, volatile int64_t*, int64_t);
+ static int32_t atomic_add_bootstrap (int32_t, volatile int32_t*);
static void setup_fpu() {}
--- a/src/hotspot/os_cpu/linux_x86/atomic_linux_x86.hpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/os_cpu/linux_x86/atomic_linux_x86.hpp Thu Jan 18 18:58:46 2018 +0000
@@ -133,8 +133,8 @@
extern "C" {
// defined in linux_x86.s
- jlong _Atomic_cmpxchg_long(jlong, volatile jlong*, jlong);
- void _Atomic_move_long(const volatile jlong* src, volatile jlong* dst);
+ int64_t _Atomic_cmpxchg_long(int64_t, volatile int64_t*, int64_t);
+ void _Atomic_move_long(const volatile int64_t* src, volatile int64_t* dst);
}
template<>
@@ -144,15 +144,15 @@
T compare_value,
cmpxchg_memory_order order) const {
STATIC_ASSERT(8 == sizeof(T));
- return cmpxchg_using_helper<jlong>(_Atomic_cmpxchg_long, exchange_value, dest, compare_value);
+ return cmpxchg_using_helper<int64_t>(_Atomic_cmpxchg_long, exchange_value, dest, compare_value);
}
template<>
template<typename T>
inline T Atomic::PlatformLoad<8>::operator()(T const volatile* src) const {
STATIC_ASSERT(8 == sizeof(T));
- volatile jlong dest;
- _Atomic_move_long(reinterpret_cast<const volatile jlong*>(src), reinterpret_cast<volatile jlong*>(&dest));
+ volatile int64_t dest;
+ _Atomic_move_long(reinterpret_cast<const volatile int64_t*>(src), reinterpret_cast<volatile int64_t*>(&dest));
return PrimitiveConversions::cast<T>(dest);
}
@@ -161,7 +161,7 @@
inline void Atomic::PlatformStore<8>::operator()(T store_value,
T volatile* dest) const {
STATIC_ASSERT(8 == sizeof(T));
- _Atomic_move_long(reinterpret_cast<const volatile jlong*>(&store_value), reinterpret_cast<volatile jlong*>(dest));
+ _Atomic_move_long(reinterpret_cast<const volatile int64_t*>(&store_value), reinterpret_cast<volatile int64_t*>(dest));
}
#endif // AMD64
--- a/src/hotspot/os_cpu/linux_zero/atomic_linux_zero.hpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/os_cpu/linux_zero/atomic_linux_zero.hpp Thu Jan 18 18:58:46 2018 +0000
@@ -30,67 +30,6 @@
// Implementation of class atomic
-#ifdef ARM
-
-/*
- * __kernel_cmpxchg
- *
- * Atomically store newval in *ptr if *ptr is equal to oldval for user space.
- * Return zero if *ptr was changed or non-zero if no exchange happened.
- * The C flag is also set if *ptr was changed to allow for assembly
- * optimization in the calling code.
- *
- */
-
-typedef int (__kernel_cmpxchg_t)(int oldval, int newval, volatile int *ptr);
-#define __kernel_cmpxchg (*(__kernel_cmpxchg_t *) 0xffff0fc0)
-
-
-
-/* Perform an atomic compare and swap: if the current value of `*PTR'
- is OLDVAL, then write NEWVAL into `*PTR'. Return the contents of
- `*PTR' before the operation.*/
-static inline int arm_compare_and_swap(int newval,
- volatile int *ptr,
- int oldval) {
- for (;;) {
- int prev = *ptr;
- if (prev != oldval)
- return prev;
-
- if (__kernel_cmpxchg (prev, newval, ptr) == 0)
- // Success.
- return prev;
-
- // We failed even though prev == oldval. Try again.
- }
-}
-
-/* Atomically add an int to memory. */
-static inline int arm_add_and_fetch(int add_value, volatile int *ptr) {
- for (;;) {
- // Loop until a __kernel_cmpxchg succeeds.
-
- int prev = *ptr;
-
- if (__kernel_cmpxchg (prev, prev + add_value, ptr) == 0)
- return prev + add_value;
- }
-}
-
-/* Atomically write VALUE into `*PTR' and returns the previous
- contents of `*PTR'. */
-static inline int arm_lock_test_and_set(int newval, volatile int *ptr) {
- for (;;) {
- // Loop until a __kernel_cmpxchg succeeds.
- int prev = *ptr;
-
- if (__kernel_cmpxchg (prev, newval, ptr) == 0)
- return prev;
- }
-}
-#endif // ARM
-
template<size_t byte_size>
struct Atomic::PlatformAdd
: Atomic::AddAndFetch<Atomic::PlatformAdd<byte_size> >
@@ -105,11 +44,7 @@
STATIC_ASSERT(4 == sizeof(I));
STATIC_ASSERT(4 == sizeof(D));
-#ifdef ARM
- return add_using_helper<int>(arm_add_and_fetch, add_value, dest);
-#else
return __sync_add_and_fetch(dest, add_value);
-#endif // ARM
}
template<>
@@ -117,7 +52,6 @@
inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const {
STATIC_ASSERT(8 == sizeof(I));
STATIC_ASSERT(8 == sizeof(D));
-
return __sync_add_and_fetch(dest, add_value);
}
@@ -126,9 +60,6 @@
inline T Atomic::PlatformXchg<4>::operator()(T exchange_value,
T volatile* dest) const {
STATIC_ASSERT(4 == sizeof(T));
-#ifdef ARM
- return xchg_using_helper<int>(arm_lock_test_and_set, exchange_value, dest);
-#else
// __sync_lock_test_and_set is a bizarrely named atomic exchange
// operation. Note that some platforms only support this with the
// limitation that the only valid value to store is the immediate
@@ -140,7 +71,6 @@
// barrier.
__sync_synchronize();
return result;
-#endif // ARM
}
template<>
@@ -164,11 +94,7 @@
T compare_value,
cmpxchg_memory_order order) const {
STATIC_ASSERT(4 == sizeof(T));
-#ifdef ARM
- return cmpxchg_using_helper<int>(arm_compare_and_swap, exchange_value, dest, compare_value);
-#else
return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
-#endif // ARM
}
template<>
@@ -185,8 +111,8 @@
template<typename T>
inline T Atomic::PlatformLoad<8>::operator()(T const volatile* src) const {
STATIC_ASSERT(8 == sizeof(T));
- volatile jlong dest;
- os::atomic_copy64(reinterpret_cast<const volatile jlong*>(src), reinterpret_cast<volatile jlong*>(&dest));
+ volatile int64_t dest;
+ os::atomic_copy64(reinterpret_cast<const volatile int64_t*>(src), reinterpret_cast<volatile int64_t*>(&dest));
return PrimitiveConversions::cast<T>(dest);
}
@@ -195,7 +121,7 @@
inline void Atomic::PlatformStore<8>::operator()(T store_value,
T volatile* dest) const {
STATIC_ASSERT(8 == sizeof(T));
- os::atomic_copy64(reinterpret_cast<const volatile jlong*>(&store_value), reinterpret_cast<volatile jlong*>(dest));
+ os::atomic_copy64(reinterpret_cast<const volatile int64_t*>(&store_value), reinterpret_cast<volatile int64_t*>(dest));
}
#endif // OS_CPU_LINUX_ZERO_VM_ATOMIC_LINUX_ZERO_HPP
--- a/src/hotspot/os_cpu/solaris_sparc/os_solaris_sparc.hpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/os_cpu/solaris_sparc/os_solaris_sparc.hpp Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -28,15 +28,15 @@
//
// NOTE: we are back in class os here, not Solaris
//
- static jint (*atomic_xchg_func) (jint, volatile jint*);
- static jint (*atomic_cmpxchg_func) (jint, volatile jint*, jint);
- static jlong (*atomic_cmpxchg_long_func)(jlong, volatile jlong*, jlong);
- static jint (*atomic_add_func) (jint, volatile jint*);
+ static int32_t (*atomic_xchg_func) (int32_t, volatile int32_t*);
+ static int32_t (*atomic_cmpxchg_func) (int32_t, volatile int32_t*, int32_t);
+ static int64_t (*atomic_cmpxchg_long_func)(int64_t, volatile int64_t*, int64_t);
+ static int32_t (*atomic_add_func) (int32_t, volatile int32_t*);
- static jint atomic_xchg_bootstrap (jint, volatile jint*);
- static jint atomic_cmpxchg_bootstrap (jint, volatile jint*, jint);
- static jlong atomic_cmpxchg_long_bootstrap(jlong, volatile jlong*, jlong);
- static jint atomic_add_bootstrap (jint, volatile jint*);
+ static int32_t atomic_xchg_bootstrap (int32_t, volatile int32_t*);
+ static int32_t atomic_cmpxchg_bootstrap (int32_t, volatile int32_t*, int32_t);
+ static int64_t atomic_cmpxchg_long_bootstrap(int64_t, volatile int64_t*, int64_t);
+ static int32_t atomic_add_bootstrap (int32_t, volatile int32_t*);
static void setup_fpu() {}
--- a/src/hotspot/os_cpu/solaris_x86/atomic_solaris_x86.hpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/os_cpu/solaris_x86/atomic_solaris_x86.hpp Thu Jan 18 18:58:46 2018 +0000
@@ -28,16 +28,16 @@
// For Sun Studio - implementation is in solaris_x86_64.il.
extern "C" {
- jint _Atomic_add(jint add_value, volatile jint* dest);
- jlong _Atomic_add_long(jlong add_value, volatile jlong* dest);
+ int32_t _Atomic_add(int32_t add_value, volatile int32_t* dest);
+ int64_t _Atomic_add_long(int64_t add_value, volatile int64_t* dest);
- jint _Atomic_xchg(jint exchange_value, volatile jint* dest);
- jbyte _Atomic_cmpxchg_byte(jbyte exchange_value, volatile jbyte* dest,
- jbyte compare_value);
- jint _Atomic_cmpxchg(jint exchange_value, volatile jint* dest,
- jint compare_value);
- jlong _Atomic_cmpxchg_long(jlong exchange_value, volatile jlong* dest,
- jlong compare_value);
+ int32_t _Atomic_xchg(int32_t exchange_value, volatile int32_t* dest);
+ int8_t _Atomic_cmpxchg_byte(int8_t exchange_value, volatile int8_t* dest,
+ int8_t compare_value);
+ int32_t _Atomic_cmpxchg(int32_t exchange_value, volatile int32_t* dest,
+ int32_t compare_value);
+ int64_t _Atomic_cmpxchg_long(int64_t exchange_value, volatile int64_t* dest,
+ int64_t compare_value);
}
template<size_t byte_size>
@@ -55,8 +55,8 @@
STATIC_ASSERT(4 == sizeof(I));
STATIC_ASSERT(4 == sizeof(D));
return PrimitiveConversions::cast<D>(
- _Atomic_add(PrimitiveConversions::cast<jint>(add_value),
- reinterpret_cast<jint volatile*>(dest)));
+ _Atomic_add(PrimitiveConversions::cast<int32_t>(add_value),
+ reinterpret_cast<int32_t volatile*>(dest)));
}
// Not using add_using_helper; see comment for cmpxchg.
@@ -66,8 +66,8 @@
STATIC_ASSERT(8 == sizeof(I));
STATIC_ASSERT(8 == sizeof(D));
return PrimitiveConversions::cast<D>(
- _Atomic_add_long(PrimitiveConversions::cast<jlong>(add_value),
- reinterpret_cast<jlong volatile*>(dest)));
+ _Atomic_add_long(PrimitiveConversions::cast<int64_t>(add_value),
+ reinterpret_cast<int64_t volatile*>(dest)));
}
template<>
@@ -76,11 +76,11 @@
T volatile* dest) const {
STATIC_ASSERT(4 == sizeof(T));
return PrimitiveConversions::cast<T>(
- _Atomic_xchg(PrimitiveConversions::cast<jint>(exchange_value),
- reinterpret_cast<jint volatile*>(dest)));
+ _Atomic_xchg(PrimitiveConversions::cast<int32_t>(exchange_value),
+ reinterpret_cast<int32_t volatile*>(dest)));
}
-extern "C" jlong _Atomic_xchg_long(jlong exchange_value, volatile jlong* dest);
+extern "C" int64_t _Atomic_xchg_long(int64_t exchange_value, volatile int64_t* dest);
template<>
template<typename T>
@@ -88,8 +88,8 @@
T volatile* dest) const {
STATIC_ASSERT(8 == sizeof(T));
return PrimitiveConversions::cast<T>(
- _Atomic_xchg_long(PrimitiveConversions::cast<jlong>(exchange_value),
- reinterpret_cast<jlong volatile*>(dest)));
+ _Atomic_xchg_long(PrimitiveConversions::cast<int64_t>(exchange_value),
+ reinterpret_cast<int64_t volatile*>(dest)));
}
// Not using cmpxchg_using_helper here, because some configurations of
@@ -106,9 +106,9 @@
cmpxchg_memory_order order) const {
STATIC_ASSERT(1 == sizeof(T));
return PrimitiveConversions::cast<T>(
- _Atomic_cmpxchg_byte(PrimitiveConversions::cast<jbyte>(exchange_value),
- reinterpret_cast<jbyte volatile*>(dest),
- PrimitiveConversions::cast<jbyte>(compare_value)));
+ _Atomic_cmpxchg_byte(PrimitiveConversions::cast<int8_t>(exchange_value),
+ reinterpret_cast<int8_t volatile*>(dest),
+ PrimitiveConversions::cast<int8_t>(compare_value)));
}
template<>
@@ -119,9 +119,9 @@
cmpxchg_memory_order order) const {
STATIC_ASSERT(4 == sizeof(T));
return PrimitiveConversions::cast<T>(
- _Atomic_cmpxchg(PrimitiveConversions::cast<jint>(exchange_value),
- reinterpret_cast<jint volatile*>(dest),
- PrimitiveConversions::cast<jint>(compare_value)));
+ _Atomic_cmpxchg(PrimitiveConversions::cast<int32_t>(exchange_value),
+ reinterpret_cast<int32_t volatile*>(dest),
+ PrimitiveConversions::cast<int32_t>(compare_value)));
}
template<>
@@ -132,9 +132,9 @@
cmpxchg_memory_order order) const {
STATIC_ASSERT(8 == sizeof(T));
return PrimitiveConversions::cast<T>(
- _Atomic_cmpxchg_long(PrimitiveConversions::cast<jlong>(exchange_value),
- reinterpret_cast<jlong volatile*>(dest),
- PrimitiveConversions::cast<jlong>(compare_value)));
+ _Atomic_cmpxchg_long(PrimitiveConversions::cast<int64_t>(exchange_value),
+ reinterpret_cast<int64_t volatile*>(dest),
+ PrimitiveConversions::cast<int64_t>(compare_value)));
}
#endif // OS_CPU_SOLARIS_X86_VM_ATOMIC_SOLARIS_X86_HPP
--- a/src/hotspot/os_cpu/solaris_x86/os_solaris_x86.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/os_cpu/solaris_x86/os_solaris_x86.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -904,12 +904,12 @@
// until initialization is complete.
// TODO - replace with .il implementation when compiler supports it.
-typedef jint xchg_func_t (jint, volatile jint*);
-typedef jint cmpxchg_func_t (jint, volatile jint*, jint);
-typedef jlong cmpxchg_long_func_t(jlong, volatile jlong*, jlong);
-typedef jint add_func_t (jint, volatile jint*);
+typedef int32_t xchg_func_t (int32_t, volatile int32_t*);
+typedef int32_t cmpxchg_func_t (int32_t, volatile int32_t*, int32_t);
+typedef int64_t cmpxchg_long_func_t(int64_t, volatile int64_t*, int64_t);
+typedef int32_t add_func_t (int32_t, volatile int32_t*);
-jint os::atomic_xchg_bootstrap(jint exchange_value, volatile jint* dest) {
+int32_t os::atomic_xchg_bootstrap(int32_t exchange_value, volatile int32_t* dest) {
// try to use the stub:
xchg_func_t* func = CAST_TO_FN_PTR(xchg_func_t*, StubRoutines::atomic_xchg_entry());
@@ -919,12 +919,12 @@
}
assert(Threads::number_of_threads() == 0, "for bootstrap only");
- jint old_value = *dest;
+ int32_t old_value = *dest;
*dest = exchange_value;
return old_value;
}
-jint os::atomic_cmpxchg_bootstrap(jint exchange_value, volatile jint* dest, jint compare_value) {
+int32_t os::atomic_cmpxchg_bootstrap(int32_t exchange_value, volatile int32_t* dest, int32_t compare_value) {
// try to use the stub:
cmpxchg_func_t* func = CAST_TO_FN_PTR(cmpxchg_func_t*, StubRoutines::atomic_cmpxchg_entry());
@@ -934,13 +934,13 @@
}
assert(Threads::number_of_threads() == 0, "for bootstrap only");
- jint old_value = *dest;
+ int32_t old_value = *dest;
if (old_value == compare_value)
*dest = exchange_value;
return old_value;
}
-jlong os::atomic_cmpxchg_long_bootstrap(jlong exchange_value, volatile jlong* dest, jlong compare_value) {
+int64_t os::atomic_cmpxchg_long_bootstrap(int64_t exchange_value, volatile int64_t* dest, int64_t compare_value) {
// try to use the stub:
cmpxchg_long_func_t* func = CAST_TO_FN_PTR(cmpxchg_long_func_t*, StubRoutines::atomic_cmpxchg_long_entry());
@@ -950,13 +950,13 @@
}
assert(Threads::number_of_threads() == 0, "for bootstrap only");
- jlong old_value = *dest;
+ int64_t old_value = *dest;
if (old_value == compare_value)
*dest = exchange_value;
return old_value;
}
-jint os::atomic_add_bootstrap(jint add_value, volatile jint* dest) {
+int32_t os::atomic_add_bootstrap(int32_t add_value, volatile int32_t* dest) {
// try to use the stub:
add_func_t* func = CAST_TO_FN_PTR(add_func_t*, StubRoutines::atomic_add_entry());
--- a/src/hotspot/os_cpu/solaris_x86/os_solaris_x86.hpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/os_cpu/solaris_x86/os_solaris_x86.hpp Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,15 +31,15 @@
#ifdef AMD64
static void setup_fpu() {}
#else
- static jint (*atomic_xchg_func) (jint, volatile jint*);
- static jint (*atomic_cmpxchg_func) (jint, volatile jint*, jint);
- static jlong (*atomic_cmpxchg_long_func)(jlong, volatile jlong*, jlong);
- static jint (*atomic_add_func) (jint, volatile jint*);
+ static int32_t (*atomic_xchg_func) (int32_t, volatile int32_t*);
+ static int32_t (*atomic_cmpxchg_func) (int32_t, volatile int32_t*, int32_t);
+ static int64_t (*atomic_cmpxchg_long_func)(int64_t, volatile int64_t*, int64_t);
+ static int32_t (*atomic_add_func) (int32_t, volatile int32_t*);
- static jint atomic_xchg_bootstrap (jint, volatile jint*);
- static jint atomic_cmpxchg_bootstrap (jint, volatile jint*, jint);
- static jlong atomic_cmpxchg_long_bootstrap(jlong, volatile jlong*, jlong);
- static jint atomic_add_bootstrap (jint, volatile jint*);
+ static int32_t atomic_xchg_bootstrap (int32_t, volatile int32_t*);
+ static int32_t atomic_cmpxchg_bootstrap (int32_t, volatile int32_t*, int32_t);
+ static int64_t atomic_cmpxchg_long_bootstrap(int64_t, volatile int64_t*, int64_t);
+ static int32_t atomic_add_bootstrap (int32_t, volatile int32_t*);
static void setup_fpu();
#endif // AMD64
--- a/src/hotspot/os_cpu/windows_x86/atomic_windows_x86.hpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/os_cpu/windows_x86/atomic_windows_x86.hpp Thu Jan 18 18:58:46 2018 +0000
@@ -54,13 +54,13 @@
template<>
template<typename I, typename D>
inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) const {
- return add_using_helper<jint>(os::atomic_add_func, add_value, dest);
+ return add_using_helper<int32_t>(os::atomic_add_func, add_value, dest);
}
template<>
template<typename I, typename D>
inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const {
- return add_using_helper<intptr_t>(os::atomic_add_ptr_func, add_value, dest);
+ return add_using_helper<int64_t>(os::atomic_add_long_func, add_value, dest);
}
#define DEFINE_STUB_XCHG(ByteSize, StubType, StubName) \
@@ -72,8 +72,8 @@
return xchg_using_helper<StubType>(StubName, exchange_value, dest); \
}
-DEFINE_STUB_XCHG(4, jint, os::atomic_xchg_func)
-DEFINE_STUB_XCHG(8, jlong, os::atomic_xchg_long_func)
+DEFINE_STUB_XCHG(4, int32_t, os::atomic_xchg_func)
+DEFINE_STUB_XCHG(8, int64_t, os::atomic_xchg_long_func)
#undef DEFINE_STUB_XCHG
@@ -88,9 +88,9 @@
return cmpxchg_using_helper<StubType>(StubName, exchange_value, dest, compare_value); \
}
-DEFINE_STUB_CMPXCHG(1, jbyte, os::atomic_cmpxchg_byte_func)
-DEFINE_STUB_CMPXCHG(4, jint, os::atomic_cmpxchg_func)
-DEFINE_STUB_CMPXCHG(8, jlong, os::atomic_cmpxchg_long_func)
+DEFINE_STUB_CMPXCHG(1, int8_t, os::atomic_cmpxchg_byte_func)
+DEFINE_STUB_CMPXCHG(4, int32_t, os::atomic_cmpxchg_func)
+DEFINE_STUB_CMPXCHG(8, int64_t, os::atomic_cmpxchg_long_func)
#undef DEFINE_STUB_CMPXCHG
@@ -162,10 +162,10 @@
T compare_value,
cmpxchg_memory_order order) const {
STATIC_ASSERT(8 == sizeof(T));
- jint ex_lo = (jint)exchange_value;
- jint ex_hi = *( ((jint*)&exchange_value) + 1 );
- jint cmp_lo = (jint)compare_value;
- jint cmp_hi = *( ((jint*)&compare_value) + 1 );
+ int32_t ex_lo = (int32_t)exchange_value;
+ int32_t ex_hi = *( ((int32_t*)&exchange_value) + 1 );
+ int32_t cmp_lo = (int32_t)compare_value;
+ int32_t cmp_hi = *( ((int32_t*)&compare_value) + 1 );
__asm {
push ebx
push edi
--- a/src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -218,17 +218,17 @@
// Atomics and Stub Functions
-typedef jint xchg_func_t (jint, volatile jint*);
-typedef intptr_t xchg_long_func_t (jlong, volatile jlong*);
-typedef jint cmpxchg_func_t (jint, volatile jint*, jint);
-typedef jbyte cmpxchg_byte_func_t (jbyte, volatile jbyte*, jbyte);
-typedef jlong cmpxchg_long_func_t (jlong, volatile jlong*, jlong);
-typedef jint add_func_t (jint, volatile jint*);
-typedef intptr_t add_ptr_func_t (intptr_t, volatile intptr_t*);
+typedef int32_t xchg_func_t (int32_t, volatile int32_t*);
+typedef int64_t xchg_long_func_t (int64_t, volatile int64_t*);
+typedef int32_t cmpxchg_func_t (int32_t, volatile int32_t*, int32_t);
+typedef int8_t cmpxchg_byte_func_t (int8_t, volatile int8_t*, int8_t);
+typedef int64_t cmpxchg_long_func_t (int64_t, volatile int64_t*, int64_t);
+typedef int32_t add_func_t (int32_t, volatile int32_t*);
+typedef int64_t add_long_func_t (int64_t, volatile int64_t*);
#ifdef AMD64
-jint os::atomic_xchg_bootstrap(jint exchange_value, volatile jint* dest) {
+int32_t os::atomic_xchg_bootstrap(int32_t exchange_value, volatile int32_t* dest) {
// try to use the stub:
xchg_func_t* func = CAST_TO_FN_PTR(xchg_func_t*, StubRoutines::atomic_xchg_entry());
@@ -238,12 +238,12 @@
}
assert(Threads::number_of_threads() == 0, "for bootstrap only");
- jint old_value = *dest;
+ int32_t old_value = *dest;
*dest = exchange_value;
return old_value;
}
-intptr_t os::atomic_xchg_long_bootstrap(jlong exchange_value, volatile jlong* dest) {
+int64_t os::atomic_xchg_long_bootstrap(int64_t exchange_value, volatile int64_t* dest) {
// try to use the stub:
xchg_long_func_t* func = CAST_TO_FN_PTR(xchg_long_func_t*, StubRoutines::atomic_xchg_long_entry());
@@ -253,13 +253,13 @@
}
assert(Threads::number_of_threads() == 0, "for bootstrap only");
- intptr_t old_value = *dest;
+ int64_t old_value = *dest;
*dest = exchange_value;
return old_value;
}
-jint os::atomic_cmpxchg_bootstrap(jint exchange_value, volatile jint* dest, jint compare_value) {
+int32_t os::atomic_cmpxchg_bootstrap(int32_t exchange_value, volatile int32_t* dest, int32_t compare_value) {
// try to use the stub:
cmpxchg_func_t* func = CAST_TO_FN_PTR(cmpxchg_func_t*, StubRoutines::atomic_cmpxchg_entry());
@@ -269,13 +269,13 @@
}
assert(Threads::number_of_threads() == 0, "for bootstrap only");
- jint old_value = *dest;
+ int32_t old_value = *dest;
if (old_value == compare_value)
*dest = exchange_value;
return old_value;
}
-jbyte os::atomic_cmpxchg_byte_bootstrap(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) {
+int8_t os::atomic_cmpxchg_byte_bootstrap(int8_t exchange_value, volatile int8_t* dest, int8_t compare_value) {
// try to use the stub:
cmpxchg_byte_func_t* func = CAST_TO_FN_PTR(cmpxchg_byte_func_t*, StubRoutines::atomic_cmpxchg_byte_entry());
@@ -285,7 +285,7 @@
}
assert(Threads::number_of_threads() == 0, "for bootstrap only");
- jbyte old_value = *dest;
+ int8_t old_value = *dest;
if (old_value == compare_value)
*dest = exchange_value;
return old_value;
@@ -293,7 +293,7 @@
#endif // AMD64
-jlong os::atomic_cmpxchg_long_bootstrap(jlong exchange_value, volatile jlong* dest, jlong compare_value) {
+int64_t os::atomic_cmpxchg_long_bootstrap(int64_t exchange_value, volatile int64_t* dest, int64_t compare_value) {
// try to use the stub:
cmpxchg_long_func_t* func = CAST_TO_FN_PTR(cmpxchg_long_func_t*, StubRoutines::atomic_cmpxchg_long_entry());
@@ -303,7 +303,7 @@
}
assert(Threads::number_of_threads() == 0, "for bootstrap only");
- jlong old_value = *dest;
+ int64_t old_value = *dest;
if (old_value == compare_value)
*dest = exchange_value;
return old_value;
@@ -311,7 +311,7 @@
#ifdef AMD64
-jint os::atomic_add_bootstrap(jint add_value, volatile jint* dest) {
+int32_t os::atomic_add_bootstrap(int32_t add_value, volatile int32_t* dest) {
// try to use the stub:
add_func_t* func = CAST_TO_FN_PTR(add_func_t*, StubRoutines::atomic_add_entry());
@@ -324,12 +324,12 @@
return (*dest) += add_value;
}
-intptr_t os::atomic_add_ptr_bootstrap(intptr_t add_value, volatile intptr_t* dest) {
+int64_t os::atomic_add_long_bootstrap(int64_t add_value, volatile int64_t* dest) {
// try to use the stub:
- add_ptr_func_t* func = CAST_TO_FN_PTR(add_ptr_func_t*, StubRoutines::atomic_add_ptr_entry());
+ add_long_func_t* func = CAST_TO_FN_PTR(add_long_func_t*, StubRoutines::atomic_add_long_entry());
if (func != NULL) {
- os::atomic_add_ptr_func = func;
+ os::atomic_add_long_func = func;
return (*func)(add_value, dest);
}
assert(Threads::number_of_threads() == 0, "for bootstrap only");
@@ -342,7 +342,7 @@
cmpxchg_func_t* os::atomic_cmpxchg_func = os::atomic_cmpxchg_bootstrap;
cmpxchg_byte_func_t* os::atomic_cmpxchg_byte_func = os::atomic_cmpxchg_byte_bootstrap;
add_func_t* os::atomic_add_func = os::atomic_add_bootstrap;
-add_ptr_func_t* os::atomic_add_ptr_func = os::atomic_add_ptr_bootstrap;
+add_long_func_t* os::atomic_add_long_func = os::atomic_add_long_bootstrap;
#endif // AMD64
--- a/src/hotspot/os_cpu/windows_x86/os_windows_x86.hpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/os_cpu/windows_x86/os_windows_x86.hpp Thu Jan 18 18:58:46 2018 +0000
@@ -29,32 +29,32 @@
// NOTE: we are back in class os here, not win32
//
#ifdef AMD64
- static jint (*atomic_xchg_func) (jint, volatile jint*);
- static intptr_t (*atomic_xchg_long_func) (jlong, volatile jlong*);
+ static int32_t (*atomic_xchg_func) (int32_t, volatile int32_t*);
+ static int64_t (*atomic_xchg_long_func) (int64_t, volatile int64_t*);
- static jint (*atomic_cmpxchg_func) (jint, volatile jint*, jint);
- static jbyte (*atomic_cmpxchg_byte_func) (jbyte, volatile jbyte*, jbyte);
- static jlong (*atomic_cmpxchg_long_func) (jlong, volatile jlong*, jlong);
+ static int32_t (*atomic_cmpxchg_func) (int32_t, volatile int32_t*, int32_t);
+ static int8_t (*atomic_cmpxchg_byte_func) (int8_t, volatile int8_t*, int8_t);
+ static int64_t (*atomic_cmpxchg_long_func) (int64_t, volatile int64_t*, int64_t);
- static jint (*atomic_add_func) (jint, volatile jint*);
- static intptr_t (*atomic_add_ptr_func) (intptr_t, volatile intptr_t*);
+ static int32_t (*atomic_add_func) (int32_t, volatile int32_t*);
+ static int64_t (*atomic_add_long_func) (int64_t, volatile int64_t*);
- static jint atomic_xchg_bootstrap (jint, volatile jint*);
- static intptr_t atomic_xchg_long_bootstrap (jlong, volatile jlong*);
+ static int32_t atomic_xchg_bootstrap (int32_t, volatile int32_t*);
+ static int64_t atomic_xchg_long_bootstrap (int64_t, volatile int64_t*);
- static jint atomic_cmpxchg_bootstrap (jint, volatile jint*, jint);
- static jbyte atomic_cmpxchg_byte_bootstrap(jbyte, volatile jbyte*, jbyte);
+ static int32_t atomic_cmpxchg_bootstrap (int32_t, volatile int32_t*, int32_t);
+ static int8_t atomic_cmpxchg_byte_bootstrap(int8_t, volatile int8_t*, int8_t);
#else
- static jlong (*atomic_cmpxchg_long_func) (jlong, volatile jlong*, jlong);
+ static int64_t (*atomic_cmpxchg_long_func) (int64_t, volatile int64_t*, int64_t);
#endif // AMD64
- static jlong atomic_cmpxchg_long_bootstrap(jlong, volatile jlong*, jlong);
+ static int64_t atomic_cmpxchg_long_bootstrap(int64_t, volatile int64_t*, int64_t);
#ifdef AMD64
- static jint atomic_add_bootstrap (jint, volatile jint*);
- static intptr_t atomic_add_ptr_bootstrap (intptr_t, volatile intptr_t*);
+ static int32_t atomic_add_bootstrap (int32_t, volatile int32_t*);
+ static int64_t atomic_add_long_bootstrap (int64_t, volatile int64_t*);
#endif // AMD64
static void setup_fpu();
--- a/src/hotspot/share/classfile/classFileParser.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/share/classfile/classFileParser.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -86,8 +86,6 @@
#define JAVA_CLASSFILE_MAGIC 0xCAFEBABE
#define JAVA_MIN_SUPPORTED_VERSION 45
-#define JAVA_MAX_SUPPORTED_VERSION 54
-#define JAVA_MAX_SUPPORTED_MINOR_VERSION 0
// Used for two backward compatibility reasons:
// - to check for new additions to the class file format in JDK1.5
@@ -110,6 +108,8 @@
#define JAVA_10_VERSION 54
+#define JAVA_11_VERSION 55
+
void ClassFileParser::set_class_bad_constant_seen(short bad_constant) {
assert((bad_constant == 19 || bad_constant == 20) && _major_version >= JAVA_9_VERSION,
"Unexpected bad constant pool entry");
@@ -4642,11 +4642,11 @@
}
static bool is_supported_version(u2 major, u2 minor){
- const u2 max_version = JAVA_MAX_SUPPORTED_VERSION;
+ const u2 max_version = JVM_CLASSFILE_MAJOR_VERSION;
return (major >= JAVA_MIN_SUPPORTED_VERSION) &&
(major <= max_version) &&
((major != max_version) ||
- (minor <= JAVA_MAX_SUPPORTED_MINOR_VERSION));
+ (minor <= JVM_CLASSFILE_MINOR_VERSION));
}
void ClassFileParser::verify_legal_field_modifiers(jint flags,
@@ -5808,8 +5808,8 @@
_class_name->as_C_string(),
_major_version,
_minor_version,
- JAVA_MAX_SUPPORTED_VERSION,
- JAVA_MAX_SUPPORTED_MINOR_VERSION);
+ JVM_CLASSFILE_MAJOR_VERSION,
+ JVM_CLASSFILE_MINOR_VERSION);
return;
}
--- a/src/hotspot/share/classfile/classLoader.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/share/classfile/classLoader.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -802,6 +802,14 @@
int end = 0;
bool set_base_piece = true;
+#if INCLUDE_CDS
+ if (DumpSharedSpaces) {
+ if (!Arguments::has_jimage()) {
+ vm_exit_during_initialization("CDS is not supported in exploded JDK build", NULL);
+ }
+ }
+#endif
+
// Iterate over class path entries
for (int start = 0; start < len; start = end) {
while (class_path[end] && class_path[end] != os::path_separator()[0]) {
--- a/src/hotspot/share/classfile/defaultMethods.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/share/classfile/defaultMethods.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -26,6 +26,7 @@
#include "classfile/bytecodeAssembler.hpp"
#include "classfile/defaultMethods.hpp"
#include "classfile/symbolTable.hpp"
+#include "classfile/systemDictionary.hpp"
#include "logging/log.hpp"
#include "logging/logStream.hpp"
#include "memory/allocation.hpp"
@@ -683,10 +684,11 @@
Symbol* _method_name;
Symbol* _method_signature;
StatefulMethodFamily* _family;
+ bool _cur_class_is_interface;
public:
- FindMethodsByErasedSig(Symbol* name, Symbol* signature) :
- _method_name(name), _method_signature(signature),
+ FindMethodsByErasedSig(Symbol* name, Symbol* signature, bool is_interf) :
+ _method_name(name), _method_signature(signature), _cur_class_is_interface(is_interf),
_family(NULL) {}
void get_discovered_family(MethodFamily** family) {
@@ -709,14 +711,17 @@
InstanceKlass* iklass = current_class();
Method* m = iklass->find_method(_method_name, _method_signature);
- // private interface methods are not candidates for default methods
- // invokespecial to private interface methods doesn't use default method logic
- // private class methods are not candidates for default methods,
- // private methods do not override default methods, so need to perform
- // default method inheritance without including private methods
- // The overpasses are your supertypes' errors, we do not include them
- // future: take access controls into account for superclass methods
- if (m != NULL && !m->is_static() && !m->is_overpass() && !m->is_private()) {
+ // Private interface methods are not candidates for default methods.
+ // invokespecial to private interface methods doesn't use default method logic.
+ // Private class methods are not candidates for default methods.
+ // Private methods do not override default methods, so need to perform
+ // default method inheritance without including private methods.
+ // The overpasses are your supertypes' errors, we do not include them.
+ // Non-public methods in java.lang.Object are not candidates for default
+ // methods.
+ // Future: take access controls into account for superclass methods
+ if (m != NULL && !m->is_static() && !m->is_overpass() && !m->is_private() &&
+ (!_cur_class_is_interface || !SystemDictionary::is_nonpublic_Object_method(m))) {
if (_family == NULL) {
_family = new StatefulMethodFamily();
}
@@ -726,8 +731,8 @@
scope->add_mark(restorer);
} else {
// This is the rule that methods in classes "win" (bad word) over
- // methods in interfaces. This works because of single inheritance
- // private methods in classes do not "win", they will be found
+ // methods in interfaces. This works because of single inheritance.
+ // Private methods in classes do not "win", they will be found
// first on searching, but overriding for invokevirtual needs
// to find default method candidates for the same signature
_family->set_target_if_empty(m);
@@ -745,10 +750,10 @@
static void generate_erased_defaults(
InstanceKlass* klass, GrowableArray<EmptyVtableSlot*>* empty_slots,
- EmptyVtableSlot* slot, TRAPS) {
+ EmptyVtableSlot* slot, bool is_intf, TRAPS) {
// sets up a set of methods with the same exact erased signature
- FindMethodsByErasedSig visitor(slot->name(), slot->signature());
+ FindMethodsByErasedSig visitor(slot->name(), slot->signature(), is_intf);
visitor.run(klass);
MethodFamily* family;
@@ -817,7 +822,7 @@
slot->print_on(&ls);
ls.cr();
}
- generate_erased_defaults(klass, empty_slots, slot, CHECK);
+ generate_erased_defaults(klass, empty_slots, slot, klass->is_interface(), CHECK);
}
log_debug(defaultmethods)("Creating defaults and overpasses...");
create_defaults_and_exceptions(empty_slots, klass, CHECK);
--- a/src/hotspot/share/classfile/systemDictionary.hpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/share/classfile/systemDictionary.hpp Thu Jan 18 18:58:46 2018 +0000
@@ -654,6 +654,12 @@
static bool is_platform_class_loader(oop class_loader);
static void clear_invoke_method_table();
+ // Returns TRUE if the method is a non-public member of class java.lang.Object.
+ static bool is_nonpublic_Object_method(Method* m) {
+ assert(m != NULL, "Unexpected NULL Method*");
+ return !m->is_public() && m->method_holder() == SystemDictionary::Object_klass();
+ }
+
protected:
static InstanceKlass* find_shared_class(Symbol* class_name);
--- a/src/hotspot/share/classfile/vmSymbols.hpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/share/classfile/vmSymbols.hpp Thu Jan 18 18:58:46 2018 +0000
@@ -997,8 +997,8 @@
do_name( montgomerySquare_name, "implMontgomerySquare") \
do_signature(montgomerySquare_signature, "([I[IIJ[I)[I") \
\
- do_class(java_util_ArraysSupport, "java/util/ArraysSupport") \
- do_intrinsic(_vectorizedMismatch, java_util_ArraysSupport, vectorizedMismatch_name, vectorizedMismatch_signature, F_S)\
+ do_class(jdk_internal_util_ArraysSupport, "jdk/internal/util/ArraysSupport") \
+ do_intrinsic(_vectorizedMismatch, jdk_internal_util_ArraysSupport, vectorizedMismatch_name, vectorizedMismatch_signature, F_S)\
do_name(vectorizedMismatch_name, "vectorizedMismatch") \
do_signature(vectorizedMismatch_signature, "(Ljava/lang/Object;JLjava/lang/Object;JII)I") \
\
--- a/src/hotspot/share/code/compiledIC.hpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/share/code/compiledIC.hpp Thu Jan 18 18:58:46 2018 +0000
@@ -344,6 +344,7 @@
// Code
static address emit_to_interp_stub(CodeBuffer &cbuf, address mark = NULL);
static int to_interp_stub_size();
+ static int to_trampoline_stub_size();
static int reloc_to_interp_stub();
static void emit_to_aot_stub(CodeBuffer &cbuf, address mark = NULL);
static int to_aot_stub_size();
--- a/src/hotspot/share/code/nmethod.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/share/code/nmethod.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1485,16 +1485,18 @@
bool nmethod::do_unloading_oops(address low_boundary, BoolObjectClosure* is_alive, bool unloading_occurred) {
// Compiled code
- {
- RelocIterator iter(this, low_boundary);
- while (iter.next()) {
- if (iter.type() == relocInfo::oop_type) {
- if (unload_if_dead_at(&iter, is_alive, unloading_occurred)) {
- return true;
+
+ // Prevent extra code cache walk for platforms that don't have immediate oops.
+ if (relocInfo::mustIterateImmediateOopsInCode()) {
+ RelocIterator iter(this, low_boundary);
+ while (iter.next()) {
+ if (iter.type() == relocInfo::oop_type) {
+ if (unload_if_dead_at(&iter, is_alive, unloading_occurred)) {
+ return true;
+ }
}
}
}
- }
return do_unloading_scopes(is_alive, unloading_occurred);
}
@@ -1584,18 +1586,21 @@
// (See comment above.)
}
- RelocIterator iter(this, low_boundary);
+ // Prevent extra code cache walk for platforms that don't have immediate oops.
+ if (relocInfo::mustIterateImmediateOopsInCode()) {
+ RelocIterator iter(this, low_boundary);
- while (iter.next()) {
- if (iter.type() == relocInfo::oop_type ) {
- oop_Relocation* r = iter.oop_reloc();
- // In this loop, we must only follow those oops directly embedded in
- // the code. Other oops (oop_index>0) are seen as part of scopes_oops.
- assert(1 == (r->oop_is_immediate()) +
- (r->oop_addr() >= oops_begin() && r->oop_addr() < oops_end()),
- "oop must be found in exactly one place");
- if (r->oop_is_immediate() && r->oop_value() != NULL) {
- f->do_oop(r->oop_addr());
+ while (iter.next()) {
+ if (iter.type() == relocInfo::oop_type ) {
+ oop_Relocation* r = iter.oop_reloc();
+ // In this loop, we must only follow those oops directly embedded in
+ // the code. Other oops (oop_index>0) are seen as part of scopes_oops.
+ assert(1 == (r->oop_is_immediate()) +
+ (r->oop_addr() >= oops_begin() && r->oop_addr() < oops_end()),
+ "oop must be found in exactly one place");
+ if (r->oop_is_immediate() && r->oop_value() != NULL) {
+ f->do_oop(r->oop_addr());
+ }
}
}
}
@@ -1620,7 +1625,7 @@
assert(nmethod::oops_do_marking_is_active(), "oops_do_marking_prologue must be called");
if (_oops_do_mark_link == NULL) {
// Claim this nmethod for this thread to mark.
- if (Atomic::cmpxchg(NMETHOD_SENTINEL, &_oops_do_mark_link, (nmethod*)NULL) == NULL) {
+ if (Atomic::replace_if_null(NMETHOD_SENTINEL, &_oops_do_mark_link)) {
// Atomically append this nmethod (now claimed) to the head of the list:
nmethod* observed_mark_nmethods = _oops_do_mark_nmethods;
for (;;) {
--- a/src/hotspot/share/code/relocInfo.hpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/share/code/relocInfo.hpp Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -910,6 +910,10 @@
}
// an oop in the instruction stream
static RelocationHolder spec_for_immediate() {
+ // If no immediate oops are generated, we can skip some walks over nmethods.
+ // Assert that they don't get generated accidently!
+ assert(relocInfo::mustIterateImmediateOopsInCode(),
+ "Must return true so we will search for oops as roots etc. in the code.");
const int oop_index = 0;
const int offset = 0; // if you want an offset, use the oop pool
RelocationHolder rh = newHolder();
--- a/src/hotspot/share/gc/parallel/gcTaskThread.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/share/gc/parallel/gcTaskThread.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -77,7 +77,7 @@
if (_time_stamps == NULL) {
// We allocate the _time_stamps array lazily since logging can be enabled dynamically
GCTaskTimeStamp* time_stamps = NEW_C_HEAP_ARRAY(GCTaskTimeStamp, GCTaskTimeStampEntries, mtGC);
- if (Atomic::cmpxchg(time_stamps, &_time_stamps, (GCTaskTimeStamp*)NULL) != NULL) {
+ if (!Atomic::replace_if_null(time_stamps, &_time_stamps)) {
// Someone already setup the time stamps
FREE_C_HEAP_ARRAY(GCTaskTimeStamp, time_stamps);
}
--- a/src/hotspot/share/include/jvm.h Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/share/include/jvm.h Thu Jan 18 18:58:46 2018 +0000
@@ -317,23 +317,18 @@
JNIEXPORT jobject JNICALL
JVM_NewMultiArray(JNIEnv *env, jclass eltClass, jintArray dim);
-/*
- * java.lang.Class and java.lang.ClassLoader
- */
-
-#define JVM_CALLER_DEPTH -1
/*
* Returns the immediate caller class of the native method invoking
* JVM_GetCallerClass. The Method.invoke and other frames due to
* reflection machinery are skipped.
*
- * The depth parameter must be -1 (JVM_DEPTH). The caller is expected
- * to be marked with sun.reflect.CallerSensitive. The JVM will throw
- * an error if it is not marked propertly.
+ * The caller is expected to be marked with
+ * jdk.internal.reflect.CallerSensitive. The JVM will throw an
+ * error if it is not marked properly.
*/
JNIEXPORT jclass JNICALL
-JVM_GetCallerClass(JNIEnv *env, int depth);
+JVM_GetCallerClass(JNIEnv *env);
/*
--- a/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -699,6 +699,7 @@
// Estimate the number of static and aot call stubs that might be emitted.
int static_call_stubs = 0;
int aot_call_stubs = 0;
+ int trampoline_stubs = 0;
objArrayOop sites = this->sites();
for (int i = 0; i < sites->length(); i++) {
oop site = sites->obj_at(i);
@@ -710,8 +711,18 @@
JVMCI_ERROR_0("expected Integer id, got %s", id_obj->klass()->signature_name());
}
jint id = id_obj->int_field(java_lang_boxing_object::value_offset_in_bytes(T_INT));
- if (id == INVOKESTATIC || id == INVOKESPECIAL) {
+ switch (id) {
+ case INVOKEINTERFACE:
+ case INVOKEVIRTUAL:
+ trampoline_stubs++;
+ break;
+ case INVOKESTATIC:
+ case INVOKESPECIAL:
static_call_stubs++;
+ trampoline_stubs++;
+ break;
+ default:
+ break;
}
}
}
@@ -726,6 +737,7 @@
}
}
int size = static_call_stubs * CompiledStaticCall::to_interp_stub_size();
+ size += trampoline_stubs * CompiledStaticCall::to_trampoline_stub_size();
#if INCLUDE_AOT
size += aot_call_stubs * CompiledStaticCall::to_aot_stub_size();
#endif
@@ -1171,7 +1183,7 @@
}
TRACE_jvmci_3("method call");
- CodeInstaller::pd_relocate_JavaMethod(hotspot_method, pc_offset, CHECK);
+ CodeInstaller::pd_relocate_JavaMethod(buffer, hotspot_method, pc_offset, CHECK);
if (_next_call_type == INVOKESTATIC || _next_call_type == INVOKESPECIAL) {
// Need a static call stub for transitions from compiled to interpreted.
CompiledStaticCall::emit_to_interp_stub(buffer, _instructions->start() + pc_offset);
@@ -1282,4 +1294,3 @@
}
}
}
-
--- a/src/hotspot/share/jvmci/jvmciCodeInstaller.hpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/share/jvmci/jvmciCodeInstaller.hpp Thu Jan 18 18:58:46 2018 +0000
@@ -185,7 +185,7 @@
void pd_patch_MetaspaceConstant(int pc_offset, Handle constant, TRAPS);
void pd_patch_DataSectionReference(int pc_offset, int data_offset, TRAPS);
void pd_relocate_ForeignCall(NativeInstruction* inst, jlong foreign_call_destination, TRAPS);
- void pd_relocate_JavaMethod(Handle method, jint pc_offset, TRAPS);
+ void pd_relocate_JavaMethod(CodeBuffer &cbuf, Handle method, jint pc_offset, TRAPS);
void pd_relocate_poll(address pc, jint mark, TRAPS);
objArrayOop sites() { return (objArrayOop) JNIHandles::resolve(_sites_handle); }
--- a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -749,8 +749,13 @@
C2V_END
C2V_VMENTRY(jobject, getImplementor, (JNIEnv *, jobject, jobject jvmci_type))
- InstanceKlass* klass = (InstanceKlass*) CompilerToVM::asKlass(jvmci_type);
- oop implementor = CompilerToVM::get_jvmci_type(klass->implementor(), CHECK_NULL);
+ Klass* klass = CompilerToVM::asKlass(jvmci_type);
+ if (!klass->is_interface()) {
+ THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
+ err_msg("Expected interface type, got %s", klass->external_name()));
+ }
+ InstanceKlass* iklass = InstanceKlass::cast(klass);
+ oop implementor = CompilerToVM::get_jvmci_type(iklass->implementor(), CHECK_NULL);
return JNIHandles::make_local(THREAD, implementor);
C2V_END
@@ -989,8 +994,12 @@
C2V_END
C2V_VMENTRY(jobject, getClassInitializer, (JNIEnv *, jobject, jobject jvmci_type))
- InstanceKlass* klass = (InstanceKlass*) CompilerToVM::asKlass(jvmci_type);
- oop result = CompilerToVM::get_jvmci_method(klass->class_initializer(), CHECK_NULL);
+ Klass* klass = CompilerToVM::asKlass(jvmci_type);
+ if (!klass->is_instance_klass()) {
+ return NULL;
+ }
+ InstanceKlass* iklass = InstanceKlass::cast(klass);
+ oop result = CompilerToVM::get_jvmci_method(iklass->class_initializer(), CHECK_NULL);
return JNIHandles::make_local(THREAD, result);
C2V_END
--- a/src/hotspot/share/oops/cpCache.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/share/oops/cpCache.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -177,6 +177,7 @@
// instruction somehow links to a non-interface method (in Object).
// In that case, the method has no itable index and must be invoked as a virtual.
// Set a flag to keep track of this corner case.
+ assert(method->is_public(), "Calling non-public method in Object with invokeinterface");
change_to_virtual = true;
// ...and fall through as if we were handling invokevirtual:
--- a/src/hotspot/share/oops/klassVtable.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/share/oops/klassVtable.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -86,13 +86,14 @@
GrowableArray<Method*> new_mirandas(20);
// compute the number of mirandas methods that must be added to the end
- get_mirandas(&new_mirandas, all_mirandas, super, methods, NULL, local_interfaces);
+ get_mirandas(&new_mirandas, all_mirandas, super, methods, NULL, local_interfaces,
+ class_flags.is_interface());
*num_new_mirandas = new_mirandas.length();
// Interfaces do not need interface methods in their vtables
// This includes miranda methods and during later processing, default methods
if (!class_flags.is_interface()) {
- vtable_length += *num_new_mirandas * vtableEntry::size();
+ vtable_length += *num_new_mirandas * vtableEntry::size();
}
if (Universe::is_bootstrapping() && vtable_length == 0) {
@@ -454,8 +455,13 @@
} else {
super_method = method_at(i);
}
- // Check if method name matches
- if (super_method->name() == name && super_method->signature() == signature) {
+ // Check if method name matches. Ignore match if klass is an interface and the
+ // matching method is a non-public java.lang.Object method. (See JVMS 5.4.3.4)
+ // This is safe because the method at this slot should never get invoked.
+ // (TBD: put in a method to throw NoSuchMethodError if this slot is ever used.)
+ if (super_method->name() == name && super_method->signature() == signature &&
+ (!_klass->is_interface() ||
+ !SystemDictionary::is_nonpublic_Object_method(super_method))) {
// get super_klass for method_holder for the found method
InstanceKlass* super_klass = super_method->method_holder();
@@ -713,7 +719,7 @@
if (mhk->is_interface()) {
assert(m->is_public(), "should be public");
assert(ik()->implements_interface(method_holder) , "this class should implement the interface");
- if (is_miranda(m, ik()->methods(), ik()->default_methods(), ik()->super())) {
+ if (is_miranda(m, ik()->methods(), ik()->default_methods(), ik()->super(), klass()->is_interface())) {
return true;
}
}
@@ -738,7 +744,10 @@
// During the first run, the current instanceKlass has not yet been
// created, the superclasses and superinterfaces do have instanceKlasses
// but may not have vtables, the default_methods list is empty, no overpasses.
-// This is seen by default method creation.
+// Default method generation uses the all_mirandas array as the starter set for
+// maximally-specific default method calculation. So, for both classes and
+// interfaces, it is necessary that the first pass will find all non-private
+// interface instance methods, whether or not they are concrete.
//
// Pass 2: recalculated during vtable initialization: only include abstract methods.
// The goal of pass 2 is to walk through the superinterfaces to see if any of
@@ -772,7 +781,8 @@
// Part of the Miranda Rights in the US mean that if you do not have
// an attorney one will be appointed for you.
bool klassVtable::is_miranda(Method* m, Array<Method*>* class_methods,
- Array<Method*>* default_methods, const Klass* super) {
+ Array<Method*>* default_methods, const Klass* super,
+ bool is_interface) {
if (m->is_static() || m->is_private() || m->is_overpass()) {
return false;
}
@@ -800,8 +810,11 @@
for (const Klass* cursuper = super; cursuper != NULL; cursuper = cursuper->super())
{
- if (InstanceKlass::cast(cursuper)->find_local_method(name, signature,
- Klass::find_overpass, Klass::skip_static, Klass::skip_private) != NULL) {
+ Method* found_mth = InstanceKlass::cast(cursuper)->find_local_method(name, signature,
+ Klass::find_overpass, Klass::skip_static, Klass::skip_private);
+ // Ignore non-public methods in java.lang.Object if klass is an interface.
+ if (found_mth != NULL && (!is_interface ||
+ !SystemDictionary::is_nonpublic_Object_method(found_mth))) {
return false;
}
}
@@ -820,7 +833,7 @@
void klassVtable::add_new_mirandas_to_lists(
GrowableArray<Method*>* new_mirandas, GrowableArray<Method*>* all_mirandas,
Array<Method*>* current_interface_methods, Array<Method*>* class_methods,
- Array<Method*>* default_methods, const Klass* super) {
+ Array<Method*>* default_methods, const Klass* super, bool is_interface) {
// iterate thru the current interface's method to see if it a miranda
int num_methods = current_interface_methods->length();
@@ -839,7 +852,7 @@
}
if (!is_duplicate) { // we don't want duplicate miranda entries in the vtable
- if (is_miranda(im, class_methods, default_methods, super)) { // is it a miranda at all?
+ if (is_miranda(im, class_methods, default_methods, super, is_interface)) { // is it a miranda at all?
const InstanceKlass *sk = InstanceKlass::cast(super);
// check if it is a duplicate of a super's miranda
if (sk->lookup_method_in_all_interfaces(im->name(), im->signature(), Klass::find_defaults) == NULL) {
@@ -858,7 +871,8 @@
const Klass* super,
Array<Method*>* class_methods,
Array<Method*>* default_methods,
- Array<Klass*>* local_interfaces) {
+ Array<Klass*>* local_interfaces,
+ bool is_interface) {
assert((new_mirandas->length() == 0) , "current mirandas must be 0");
// iterate thru the local interfaces looking for a miranda
@@ -867,7 +881,7 @@
InstanceKlass *ik = InstanceKlass::cast(local_interfaces->at(i));
add_new_mirandas_to_lists(new_mirandas, all_mirandas,
ik->methods(), class_methods,
- default_methods, super);
+ default_methods, super, is_interface);
// iterate thru each local's super interfaces
Array<Klass*>* super_ifs = ik->transitive_interfaces();
int num_super_ifs = super_ifs->length();
@@ -875,7 +889,7 @@
InstanceKlass *sik = InstanceKlass::cast(super_ifs->at(j));
add_new_mirandas_to_lists(new_mirandas, all_mirandas,
sik->methods(), class_methods,
- default_methods, super);
+ default_methods, super, is_interface);
}
}
}
@@ -888,7 +902,8 @@
int klassVtable::fill_in_mirandas(int initialized) {
GrowableArray<Method*> mirandas(20);
get_mirandas(&mirandas, NULL, ik()->super(), ik()->methods(),
- ik()->default_methods(), ik()->local_interfaces());
+ ik()->default_methods(), ik()->local_interfaces(),
+ klass()->is_interface());
for (int i = 0; i < mirandas.length(); i++) {
if (log_develop_is_enabled(Trace, vtables)) {
Method* meth = mirandas.at(i);
--- a/src/hotspot/share/oops/klassVtable.hpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/share/oops/klassVtable.hpp Thu Jan 18 18:58:46 2018 +0000
@@ -144,21 +144,24 @@
bool is_miranda_entry_at(int i);
int fill_in_mirandas(int initialized);
static bool is_miranda(Method* m, Array<Method*>* class_methods,
- Array<Method*>* default_methods, const Klass* super);
+ Array<Method*>* default_methods, const Klass* super,
+ bool is_interface);
static void add_new_mirandas_to_lists(
GrowableArray<Method*>* new_mirandas,
GrowableArray<Method*>* all_mirandas,
Array<Method*>* current_interface_methods,
Array<Method*>* class_methods,
Array<Method*>* default_methods,
- const Klass* super);
+ const Klass* super,
+ bool is_interface);
static void get_mirandas(
GrowableArray<Method*>* new_mirandas,
GrowableArray<Method*>* all_mirandas,
const Klass* super,
Array<Method*>* class_methods,
Array<Method*>* default_methods,
- Array<Klass*>* local_interfaces);
+ Array<Klass*>* local_interfaces,
+ bool is_interface);
void verify_against(outputStream* st, klassVtable* vt, int index);
inline InstanceKlass* ik() const;
// When loading a class from CDS archive at run time, and no class redefintion
--- a/src/hotspot/share/oops/method.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/share/oops/method.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -446,7 +446,7 @@
bool Method::init_method_counters(MethodCounters* counters) {
// Try to install a pointer to MethodCounters, return true on success.
- return Atomic::cmpxchg(counters, &_method_counters, (MethodCounters*)NULL) == NULL;
+ return Atomic::replace_if_null(counters, &_method_counters);
}
void Method::cleanup_inline_caches() {
--- a/src/hotspot/share/prims/jvm.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/share/prims/jvm.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -678,17 +678,9 @@
// Misc. class handling ///////////////////////////////////////////////////////////
-JVM_ENTRY(jclass, JVM_GetCallerClass(JNIEnv* env, int depth))
+JVM_ENTRY(jclass, JVM_GetCallerClass(JNIEnv* env))
JVMWrapper("JVM_GetCallerClass");
- // Pre-JDK 8 and early builds of JDK 8 don't have a CallerSensitive annotation; or
- // sun.reflect.Reflection.getCallerClass with a depth parameter is provided
- // temporarily for existing code to use until a replacement API is defined.
- if (SystemDictionary::reflect_CallerSensitive_klass() == NULL || depth != JVM_CALLER_DEPTH) {
- Klass* k = thread->security_get_caller_class(depth);
- return (k == NULL) ? NULL : (jclass) JNIHandles::make_local(env, k->java_mirror());
- }
-
// Getting the class of the caller frame.
//
// The call stack at this point looks something like this:
--- a/src/hotspot/share/prims/jvmtiRawMonitor.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/share/prims/jvmtiRawMonitor.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -127,7 +127,7 @@
int JvmtiRawMonitor::SimpleEnter (Thread * Self) {
for (;;) {
- if (Atomic::cmpxchg(Self, &_owner, (void*)NULL) == NULL) {
+ if (Atomic::replace_if_null(Self, &_owner)) {
return OS_OK ;
}
@@ -139,7 +139,7 @@
Node._next = _EntryList ;
_EntryList = &Node ;
OrderAccess::fence() ;
- if (_owner == NULL && Atomic::cmpxchg(Self, &_owner, (void*)NULL) == NULL) {
+ if (_owner == NULL && Atomic::replace_if_null(Self, &_owner)) {
_EntryList = Node._next ;
RawMonitor_lock->unlock() ;
return OS_OK ;
--- a/src/hotspot/share/prims/whitebox.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/share/prims/whitebox.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -1727,10 +1727,16 @@
WB_ENTRY(jboolean, WB_IsCDSIncludedInVmBuild(JNIEnv* env))
#if INCLUDE_CDS
+# ifdef _LP64
+ if (!UseCompressedOops || !UseCompressedClassPointers) {
+ // On 64-bit VMs, CDS is supported only with compressed oops/pointers
+ return false;
+ }
+# endif // _LP64
return true;
#else
return false;
-#endif
+#endif // INCLUDE_CDS
WB_END
--- a/src/hotspot/share/runtime/arguments.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/share/runtime/arguments.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -204,7 +204,9 @@
_writeable = writeable;
}
-AgentLibrary::AgentLibrary(const char* name, const char* options, bool is_absolute_path, void* os_lib) {
+AgentLibrary::AgentLibrary(const char* name, const char* options,
+ bool is_absolute_path, void* os_lib,
+ bool instrument_lib) {
_name = AllocateHeap(strlen(name)+1, mtArguments);
strcpy(_name, name);
if (options == NULL) {
@@ -218,6 +220,7 @@
_next = NULL;
_state = agent_invalid;
_is_static_lib = false;
+ _is_instrument_lib = instrument_lib;
}
// Check if head of 'option' matches 'name', and sets 'tail' to the remaining
@@ -294,6 +297,10 @@
_agentList.add(new AgentLibrary(name, options, absolute_path, NULL));
}
+void Arguments::add_instrument_agent(const char* name, char* options, bool absolute_path) {
+ _agentList.add(new AgentLibrary(name, options, absolute_path, NULL, true));
+}
+
// Late-binding agents not started via arguments
void Arguments::add_loaded_agent(AgentLibrary *agentLib) {
_agentList.add(agentLib);
@@ -501,7 +508,7 @@
{ "MaxRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() },
{ "MinRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() },
{ "InitialRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() },
- { "UseMembar", JDK_Version::jdk(10), JDK_Version::jdk(11), JDK_Version::jdk(12) },
+ { "UseMembar", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() },
{ "FastTLABRefill", JDK_Version::jdk(10), JDK_Version::jdk(11), JDK_Version::jdk(12) },
{ "SafepointSpinBeforeYield", JDK_Version::jdk(10), JDK_Version::jdk(11), JDK_Version::jdk(12) },
{ "DeferThrSuspendLoopCount", JDK_Version::jdk(10), JDK_Version::jdk(11), JDK_Version::jdk(12) },
@@ -678,6 +685,14 @@
return false;
}
+// Verifies the correctness of the entries in the special_jvm_flags table.
+// If there is a semantic error (i.e. a bug in the table) such as the obsoletion
+// version being earlier than the deprecation version, then a warning is issued
+// and verification fails - by returning false. If it is detected that the table
+// is out of date, with respect to the current version, then a warning is issued
+// but verification does not fail. This allows the VM to operate when the version
+// is first updated, without needing to update all the impacted flags at the
+// same time.
static bool verify_special_jvm_flags() {
bool success = true;
for (size_t i = 0; special_jvm_flags[i].name != NULL; i++) {
@@ -714,7 +729,6 @@
if (!version_less_than(JDK_Version::current(), flag.obsolete_in)) {
if (Flag::find_flag(flag.name) != NULL) {
warning("Global variable for obsolete special flag entry \"%s\" should be removed", flag.name);
- success = false;
}
}
}
@@ -724,7 +738,6 @@
if (!version_less_than(JDK_Version::current(), flag.expired_in)) {
if (Flag::find_flag(flag.name) != NULL) {
warning("Global variable for expired flag entry \"%s\" should be removed", flag.name);
- success = false;
}
}
}
@@ -2795,7 +2808,7 @@
size_t length = strlen(tail) + 1;
char *options = NEW_C_HEAP_ARRAY(char, length, mtArguments);
jio_snprintf(options, length, "%s", tail);
- add_init_agent("instrument", options, false);
+ add_instrument_agent("instrument", options, false);
// java agents need module java.instrument
if (!create_numbered_property("jdk.module.addmods", "java.instrument", addmods_count++)) {
return JNI_ENOMEM;
--- a/src/hotspot/share/runtime/arguments.hpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/share/runtime/arguments.hpp Thu Jan 18 18:58:46 2018 +0000
@@ -142,6 +142,7 @@
void* _os_lib;
bool _is_absolute_path;
bool _is_static_lib;
+ bool _is_instrument_lib;
AgentState _state;
AgentLibrary* _next;
@@ -154,13 +155,15 @@
void set_os_lib(void* os_lib) { _os_lib = os_lib; }
AgentLibrary* next() const { return _next; }
bool is_static_lib() const { return _is_static_lib; }
+ bool is_instrument_lib() const { return _is_instrument_lib; }
void set_static_lib(bool is_static_lib) { _is_static_lib = is_static_lib; }
bool valid() { return (_state == agent_valid); }
void set_valid() { _state = agent_valid; }
void set_invalid() { _state = agent_invalid; }
// Constructor
- AgentLibrary(const char* name, const char* options, bool is_absolute_path, void* os_lib);
+ AgentLibrary(const char* name, const char* options, bool is_absolute_path,
+ void* os_lib, bool instrument_lib=false);
};
// maintain an order of entry list of AgentLibrary
@@ -337,6 +340,7 @@
// -agentlib and -agentpath arguments
static AgentLibraryList _agentList;
static void add_init_agent(const char* name, char* options, bool absolute_path);
+ static void add_instrument_agent(const char* name, char* options, bool absolute_path);
// Late-binding agents not started via arguments
static void add_loaded_agent(AgentLibrary *agentLib);
--- a/src/hotspot/share/runtime/atomic.hpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/share/runtime/atomic.hpp Thu Jan 18 18:58:46 2018 +0000
@@ -45,8 +45,8 @@
class Atomic : AllStatic {
public:
- // Atomic operations on jlong types are not available on all 32-bit
- // platforms. If atomic ops on jlongs are defined here they must only
+ // Atomic operations on int64 types are not available on all 32-bit
+ // platforms. If atomic ops on int64 are defined here they must only
// be used from code that verifies they are available at runtime and
// can provide an alternative action if not - see supports_cx8() for
// a means to test availability.
@@ -639,16 +639,16 @@
//
// Use the ATOMIC_SHORT_PAIR macro (see macros.hpp) to get the desired alignment.
template<>
-struct Atomic::AddImpl<jshort, jshort> VALUE_OBJ_CLASS_SPEC {
- jshort operator()(jshort add_value, jshort volatile* dest) const {
+struct Atomic::AddImpl<short, short> VALUE_OBJ_CLASS_SPEC {
+ short operator()(short add_value, short volatile* dest) const {
#ifdef VM_LITTLE_ENDIAN
assert((intx(dest) & 0x03) == 0x02, "wrong alignment");
- jint new_value = Atomic::add(add_value << 16, (volatile jint*)(dest-1));
+ int new_value = Atomic::add(add_value << 16, (volatile int*)(dest-1));
#else
assert((intx(dest) & 0x03) == 0x00, "wrong alignment");
- jint new_value = Atomic::add(add_value << 16, (volatile jint*)(dest));
+ int new_value = Atomic::add(add_value << 16, (volatile int*)(dest));
#endif
- return (jshort)(new_value >> 16); // preserves sign
+ return (short)(new_value >> 16); // preserves sign
}
};
@@ -807,7 +807,7 @@
do {
// value to swap in matches current value ...
uint32_t new_value = cur;
- // ... except for the one jbyte we want to update
+ // ... except for the one byte we want to update
reinterpret_cast<uint8_t*>(&new_value)[offset] = canon_exchange_value;
uint32_t res = cmpxchg(new_value, aligned_dest, cur, order);
--- a/src/hotspot/share/runtime/jniHandles.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/share/runtime/jniHandles.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -47,6 +47,7 @@
} else {
Thread* thread = Thread::current();
assert(Universe::heap()->is_in_reserved(obj), "sanity check");
+ assert(!current_thread_in_native(), "must not be in native");
return thread->active_handles()->allocate_handle(obj);
}
}
@@ -59,6 +60,8 @@
return NULL; // ignore null handles
} else {
assert(Universe::heap()->is_in_reserved(obj), "sanity check");
+ assert(thread->is_Java_thread(), "not a Java thread");
+ assert(!current_thread_in_native(), "must not be in native");
return thread->active_handles()->allocate_handle(obj);
}
}
@@ -70,6 +73,7 @@
} else {
JavaThread* thread = JavaThread::thread_from_jni_environment(env);
assert(Universe::heap()->is_in_reserved(obj), "sanity check");
+ assert(!current_thread_in_native(), "must not be in native");
return thread->active_handles()->allocate_handle(obj);
}
}
@@ -77,6 +81,7 @@
jobject JNIHandles::make_global(Handle obj) {
assert(!Universe::heap()->is_gc_active(), "can't extend the root set during GC");
+ assert(!current_thread_in_native(), "must not be in native");
jobject res = NULL;
if (!obj.is_null()) {
// ignore null handles
@@ -93,6 +98,7 @@
jobject JNIHandles::make_weak_global(Handle obj) {
assert(!Universe::heap()->is_gc_active(), "can't extend the root set during GC");
+ assert(!current_thread_in_native(), "must not be in native");
jobject res = NULL;
if (!obj.is_null()) {
// ignore null handles
@@ -265,6 +271,13 @@
weak_oops_do(&verify_handle);
}
+// This method is implemented here to avoid circular includes between
+// jniHandles.hpp and thread.hpp.
+bool JNIHandles::current_thread_in_native() {
+ Thread* thread = Thread::current();
+ return (thread->is_Java_thread() &&
+ JavaThread::current()->thread_state() == _thread_in_native);
+}
void jni_handles_init() {
--- a/src/hotspot/share/runtime/jniHandles.hpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/share/runtime/jniHandles.hpp Thu Jan 18 18:58:46 2018 +0000
@@ -48,6 +48,10 @@
template<bool external_guard> inline static oop resolve_impl(jobject handle);
template<bool external_guard> static oop resolve_jweak(jweak handle);
+ // This method is not inlined in order to avoid circular includes between
+ // this header file and thread.hpp.
+ static bool current_thread_in_native();
+
public:
// Low tag bit in jobject used to distinguish a jweak. jweak is
// type equivalent to jobject, but there are places where we need to
@@ -230,6 +234,7 @@
template<bool external_guard>
inline oop JNIHandles::resolve_impl(jobject handle) {
assert(handle != NULL, "precondition");
+ assert(!current_thread_in_native(), "must not be in native");
oop result;
if (is_jweak(handle)) { // Unlikely
result = resolve_jweak<external_guard>(handle);
--- a/src/hotspot/share/runtime/mutex.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/share/runtime/mutex.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -467,7 +467,7 @@
OrderAccess::fence();
// Optional optimization ... try barging on the inner lock
- if ((NativeMonitorFlags & 32) && Atomic::cmpxchg(ESelf, &_OnDeck, (ParkEvent*)NULL) == NULL) {
+ if ((NativeMonitorFlags & 32) && Atomic::replace_if_null(ESelf, &_OnDeck)) {
goto OnDeck_LOOP;
}
@@ -574,7 +574,7 @@
// Unlike a normal lock, however, the exiting thread "locks" OnDeck,
// picks a successor and marks that thread as OnDeck. That successor
// thread will then clear OnDeck once it eventually acquires the outer lock.
- if (Atomic::cmpxchg((ParkEvent*)_LBIT, &_OnDeck, (ParkEvent*)NULL) != NULL) {
+ if (!Atomic::replace_if_null((ParkEvent*)_LBIT, &_OnDeck)) {
return;
}
--- a/src/hotspot/share/runtime/objectMonitor.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/share/runtime/objectMonitor.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -421,7 +421,7 @@
int ObjectMonitor::TryLock(Thread * Self) {
void * own = _owner;
if (own != NULL) return 0;
- if (Atomic::cmpxchg(Self, &_owner, (void*)NULL) == NULL) {
+ if (Atomic::replace_if_null(Self, &_owner)) {
// Either guarantee _recursions == 0 or set _recursions = 0.
assert(_recursions == 0, "invariant");
assert(_owner == Self, "invariant");
@@ -529,7 +529,7 @@
if ((SyncFlags & 16) == 0 && nxt == NULL && _EntryList == NULL) {
// Try to assume the role of responsible thread for the monitor.
// CONSIDER: ST vs CAS vs { if (Responsible==null) Responsible=Self }
- Atomic::cmpxchg(Self, &_Responsible, (Thread*)NULL);
+ Atomic::replace_if_null(Self, &_Responsible);
}
// The lock might have been released while this thread was occupied queueing
@@ -553,7 +553,7 @@
assert(_owner != Self, "invariant");
if ((SyncFlags & 2) && _Responsible == NULL) {
- Atomic::cmpxchg(Self, &_Responsible, (Thread*)NULL);
+ Atomic::replace_if_null(Self, &_Responsible);
}
// park self
@@ -1007,7 +1007,7 @@
// to reacquire the lock the responsibility for ensuring succession
// falls to the new owner.
//
- if (Atomic::cmpxchg(THREAD, &_owner, (void*)NULL) != NULL) {
+ if (!Atomic::replace_if_null(THREAD, &_owner)) {
return;
}
TEVENT(Exit - Reacquired);
@@ -1032,7 +1032,7 @@
// B. If the elements forming the EntryList|cxq are TSM
// we could simply unpark() the lead thread and return
// without having set _succ.
- if (Atomic::cmpxchg(THREAD, &_owner, (void*)NULL) != NULL) {
+ if (!Atomic::replace_if_null(THREAD, &_owner)) {
TEVENT(Inflated exit - reacquired succeeded);
return;
}
@@ -1714,7 +1714,7 @@
ObjectWaiter * tail = _cxq;
if (tail == NULL) {
iterator->_next = NULL;
- if (Atomic::cmpxchg(iterator, &_cxq, (ObjectWaiter*)NULL) == NULL) {
+ if (Atomic::replace_if_null(iterator, &_cxq)) {
break;
}
} else {
--- a/src/hotspot/share/runtime/safepoint.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/share/runtime/safepoint.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -103,7 +103,7 @@
int nof_threads = Threads::number_of_threads();
- log_debug(safepoint)("Safepoint synchronization initiated. (%d)", nof_threads);
+ log_debug(safepoint)("Safepoint synchronization initiated. (%d threads)", nof_threads);
RuntimeService::record_safepoint_begin();
@@ -407,9 +407,7 @@
// Update the count of active JNI critical regions
GCLocker::set_jni_lock_count(_current_jni_active_count);
- if (log_is_enabled(Debug, safepoint)) {
- log_debug(safepoint)("Entering safepoint region: %s", VMThread::vm_safepoint_description());
- }
+ log_info(safepoint)("Entering safepoint region: %s", VMThread::vm_safepoint_description());
RuntimeService::record_safepoint_synchronized();
if (PrintSafepointStatistics) {
@@ -496,14 +494,14 @@
cur_state->restart(); // TSS _running
SafepointMechanism::disarm_local_poll(current); // release store, local state -> polling page
}
- log_debug(safepoint)("Leaving safepoint region");
+ log_info(safepoint)("Leaving safepoint region");
} else {
// Set to not synchronized, so the threads will not go into the signal_thread_blocked method
// when they get restarted.
_state = _not_synchronized;
OrderAccess::fence();
- log_debug(safepoint)("Leaving safepoint region");
+ log_info(safepoint)("Leaving safepoint region");
// Start suspended threads
jtiwh.rewind();
--- a/src/hotspot/share/runtime/stubRoutines.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/share/runtime/stubRoutines.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -62,12 +62,11 @@
address StubRoutines::_atomic_xchg_entry = NULL;
address StubRoutines::_atomic_xchg_long_entry = NULL;
address StubRoutines::_atomic_store_entry = NULL;
-address StubRoutines::_atomic_store_ptr_entry = NULL;
address StubRoutines::_atomic_cmpxchg_entry = NULL;
address StubRoutines::_atomic_cmpxchg_byte_entry = NULL;
address StubRoutines::_atomic_cmpxchg_long_entry = NULL;
address StubRoutines::_atomic_add_entry = NULL;
-address StubRoutines::_atomic_add_ptr_entry = NULL;
+address StubRoutines::_atomic_add_long_entry = NULL;
address StubRoutines::_fence_entry = NULL;
address StubRoutines::_d2i_wrapper = NULL;
address StubRoutines::_d2l_wrapper = NULL;
--- a/src/hotspot/share/runtime/stubRoutines.hpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/share/runtime/stubRoutines.hpp Thu Jan 18 18:58:46 2018 +0000
@@ -103,12 +103,11 @@
static address _atomic_xchg_entry;
static address _atomic_xchg_long_entry;
static address _atomic_store_entry;
- static address _atomic_store_ptr_entry;
static address _atomic_cmpxchg_entry;
static address _atomic_cmpxchg_byte_entry;
static address _atomic_cmpxchg_long_entry;
static address _atomic_add_entry;
- static address _atomic_add_ptr_entry;
+ static address _atomic_add_long_entry;
static address _fence_entry;
static address _d2i_wrapper;
static address _d2l_wrapper;
@@ -277,12 +276,11 @@
static address atomic_xchg_entry() { return _atomic_xchg_entry; }
static address atomic_xchg_long_entry() { return _atomic_xchg_long_entry; }
static address atomic_store_entry() { return _atomic_store_entry; }
- static address atomic_store_ptr_entry() { return _atomic_store_ptr_entry; }
static address atomic_cmpxchg_entry() { return _atomic_cmpxchg_entry; }
static address atomic_cmpxchg_byte_entry() { return _atomic_cmpxchg_byte_entry; }
static address atomic_cmpxchg_long_entry() { return _atomic_cmpxchg_long_entry; }
static address atomic_add_entry() { return _atomic_add_entry; }
- static address atomic_add_ptr_entry() { return _atomic_add_ptr_entry; }
+ static address atomic_add_long_entry() { return _atomic_add_long_entry; }
static address fence_entry() { return _fence_entry; }
static address d2i_wrapper() { return _d2i_wrapper; }
--- a/src/hotspot/share/runtime/synchronizer.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/share/runtime/synchronizer.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -238,8 +238,7 @@
// and last are the inflated Java Monitor (ObjectMonitor) checks.
lock->set_displaced_header(markOopDesc::unused_mark());
- if (owner == NULL &&
- Atomic::cmpxchg(Self, &(m->_owner), (void*)NULL) == NULL) {
+ if (owner == NULL && Atomic::replace_if_null(Self, &(m->_owner))) {
assert(m->_recursions == 0, "invariant");
assert(m->_owner == Self, "invariant");
return true;
--- a/src/hotspot/share/runtime/thread.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/share/runtime/thread.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -4039,9 +4039,16 @@
}
if (library == NULL) {
const char *sub_msg = " on the library path, with error: ";
- size_t len = strlen(msg) + strlen(name) + strlen(sub_msg) + strlen(ebuf) + 1;
+ const char *sub_msg2 = "\nModule java.instrument may be missing from runtime image.";
+
+ size_t len = strlen(msg) + strlen(name) + strlen(sub_msg) +
+ strlen(ebuf) + strlen(sub_msg2) + 1;
char *buf = NEW_C_HEAP_ARRAY(char, len, mtThread);
- jio_snprintf(buf, len, "%s%s%s%s", msg, name, sub_msg, ebuf);
+ if (!agent->is_instrument_lib()) {
+ jio_snprintf(buf, len, "%s%s%s%s", msg, name, sub_msg, ebuf);
+ } else {
+ jio_snprintf(buf, len, "%s%s%s%s%s", msg, name, sub_msg, ebuf, sub_msg2);
+ }
// If we can't find the agent, exit.
vm_exit_during_initialization(buf, NULL);
FREE_C_HEAP_ARRAY(char, buf);
--- a/src/hotspot/share/services/mallocSiteTable.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/share/services/mallocSiteTable.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -147,7 +147,7 @@
if (entry == NULL) return NULL;
// swap in the head
- if (Atomic::cmpxchg(entry, &_table[index], (MallocSiteHashtableEntry*)NULL) == NULL) {
+ if (Atomic::replace_if_null(entry, &_table[index])) {
return entry->data();
}
@@ -259,5 +259,5 @@
}
bool MallocSiteHashtableEntry::atomic_insert(MallocSiteHashtableEntry* entry) {
- return Atomic::cmpxchg(entry, &_next, (MallocSiteHashtableEntry*)NULL) == NULL;
+ return Atomic::replace_if_null(entry, &_next);
}
--- a/src/hotspot/share/utilities/bitMap.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/hotspot/share/utilities/bitMap.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -628,7 +628,7 @@
table[i] = num_set_bits(i);
}
- if (Atomic::cmpxchg(table, &_pop_count_table, (BitMap::idx_t*)NULL) != NULL) {
+ if (!Atomic::replace_if_null(table, &_pop_count_table)) {
guarantee(_pop_count_table != NULL, "invariant");
FREE_C_HEAP_ARRAY(idx_t, table);
}
--- a/src/java.base/linux/classes/sun/nio/fs/LinuxFileStore.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/linux/classes/sun/nio/fs/LinuxFileStore.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -66,6 +66,8 @@
}
// step 2: find mount point
+ List<UnixMountEntry> procMountsEntries =
+ fs.getMountEntries("/proc/mounts");
UnixPath parent = path.getParent();
while (parent != null) {
UnixFileAttributes attrs = null;
@@ -74,16 +76,23 @@
} catch (UnixException x) {
x.rethrowAsIOException(parent);
}
- if (attrs.dev() != dev())
- break;
+ if (attrs.dev() != dev()) {
+ // step 3: lookup mounted file systems (use /proc/mounts to
+ // ensure we find the file system even when not in /etc/mtab)
+ byte[] dir = path.asByteArray();
+ for (UnixMountEntry entry : procMountsEntries) {
+ if (Arrays.equals(dir, entry.dir()))
+ return entry;
+ }
+ }
path = parent;
parent = parent.getParent();
}
- // step 3: lookup mounted file systems (use /proc/mounts to ensure we
- // find the file system even when not in /etc/mtab)
+ // step 3: lookup mounted file systems (use /proc/mounts to
+ // ensure we find the file system even when not in /etc/mtab)
byte[] dir = path.asByteArray();
- for (UnixMountEntry entry: fs.getMountEntries("/proc/mounts")) {
+ for (UnixMountEntry entry : procMountsEntries) {
if (Arrays.equals(dir, entry.dir()))
return entry;
}
--- a/src/java.base/linux/classes/sun/nio/fs/LinuxFileSystem.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/linux/classes/sun/nio/fs/LinuxFileSystem.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -75,7 +75,7 @@
/**
* Returns object to iterate over the mount entries in the given fstab file.
*/
- Iterable<UnixMountEntry> getMountEntries(String fstab) {
+ List<UnixMountEntry> getMountEntries(String fstab) {
ArrayList<UnixMountEntry> entries = new ArrayList<>();
try {
long fp = setmntent(Util.toBytes(fstab), Util.toBytes("r"));
@@ -101,7 +101,7 @@
* Returns object to iterate over the mount entries in /etc/mtab
*/
@Override
- Iterable<UnixMountEntry> getMountEntries() {
+ List<UnixMountEntry> getMountEntries() {
return getMountEntries("/etc/mtab");
}
--- a/src/java.base/share/classes/com/sun/java/util/jar/pack/Constants.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/com/sun/java/util/jar/pack/Constants.java Thu Jan 18 18:58:46 2018 +0000
@@ -48,6 +48,7 @@
1.8 to 1.8.X 52,0
1.9 to 1.9.X 53,0
1.10 to 1.10.X 54,0
+ 1.11 to 1.11.X 55,0
*/
public static final Package.Version JAVA_MIN_CLASS_VERSION =
@@ -71,6 +72,9 @@
public static final Package.Version JAVA10_MAX_CLASS_VERSION =
Package.Version.of(54, 00);
+ public static final Package.Version JAVA11_MAX_CLASS_VERSION =
+ Package.Version.of(55, 00);
+
public static final int JAVA_PACKAGE_MAGIC = 0xCAFED00D;
public static final Package.Version JAVA5_PACKAGE_VERSION =
@@ -87,7 +91,7 @@
// upper limit, should point to the latest class version
public static final Package.Version JAVA_MAX_CLASS_VERSION =
- JAVA10_MAX_CLASS_VERSION;
+ JAVA11_MAX_CLASS_VERSION;
// upper limit should point to the latest package version, for version info!.
public static final Package.Version MAX_PACKAGE_VERSION =
--- a/src/java.base/share/classes/com/sun/java/util/jar/pack/Driver.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/com/sun/java/util/jar/pack/Driver.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -162,11 +162,12 @@
engProps.put((String) me.getKey(), (String) me.getValue());
}
} else if ("--version".equals(state)) {
- System.out.println(MessageFormat.format(RESOURCE.getString(DriverResource.VERSION), Driver.class.getName(), "1.31, 07/05/05"));
+ System.out.println(MessageFormat.format(RESOURCE.getString(DriverResource.VERSION),
+ Driver.class.getName(), "1.31, 07/05/05"));
return;
} else if ("--help".equals(state)) {
printUsage(doPack, true, System.out);
- System.exit(1);
+ System.exit(0);
return;
} else {
break;
--- a/src/java.base/share/classes/com/sun/java/util/jar/pack/DriverResource.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/com/sun/java/util/jar/pack/DriverResource.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -89,7 +89,7 @@
" -q, --quiet set verbosity to lowest level",
" -l{F}, --log-file={F} output to the given log file, ",
" or '-' for System.out",
- " -?, -h, --help print this message",
+ " -?, -h, --help print this help message",
" -V, --version print program version",
" -J{X} pass option X to underlying Java VM",
"",
@@ -118,7 +118,7 @@
" -q, --quiet set verbosity to lowest level",
" -l{F}, --log-file={F} output to the given log file, or",
" '-' for System.out",
- " -?, -h, --help print this message",
+ " -?, -h, --help print this help message",
" -V, --version print program version",
" -J{X} pass option X to underlying Java VM"
}
--- a/src/java.base/share/classes/java/io/ByteArrayOutputStream.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/io/ByteArrayOutputStream.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,6 +27,7 @@
import java.nio.charset.Charset;
import java.util.Arrays;
+import java.util.Objects;
/**
* This class implements an output stream in which the data is
@@ -147,10 +148,7 @@
* @param len the number of bytes to write.
*/
public synchronized void write(byte b[], int off, int len) {
- if ((off < 0) || (off > b.length) || (len < 0) ||
- ((off + len) - b.length > 0)) {
- throw new IndexOutOfBoundsException();
- }
+ Objects.checkFromIndexSize(off, len, b.length);
ensureCapacity(count + len);
System.arraycopy(b, off, buf, count, len);
count += len;
--- a/src/java.base/share/classes/java/io/File.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/io/File.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -2256,7 +2256,7 @@
private transient volatile Path filePath;
/**
- * Returns a {@link Path java.nio.file.Path} object constructed from the
+ * Returns a {@link Path java.nio.file.Path} object constructed from
* this abstract path. The resulting {@code Path} is associated with the
* {@link java.nio.file.FileSystems#getDefault default-filesystem}.
*
--- a/src/java.base/share/classes/java/io/InputStream.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/io/InputStream.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,9 @@
package java.io;
+import java.util.ArrayList;
import java.util.Arrays;
+import java.util.List;
import java.util.Objects;
/**
@@ -54,6 +56,93 @@
private static final int DEFAULT_BUFFER_SIZE = 8192;
/**
+ * Returns a new {@code InputStream} that reads no bytes. The returned
+ * stream is initially open. The stream is closed by calling the
+ * {@code close()} method. Subsequent calls to {@code close()} have no
+ * effect.
+ *
+ * <p> While the stream is open, the {@code available()}, {@code read()},
+ * {@code read(byte[])}, {@code read(byte[], int, int)},
+ * {@code readAllBytes()}, {@code readNBytes()}, {@code skip()}, and
+ * {@code transferTo()} methods all behave as if end of stream has been
+ * reached. After the stream has been closed, these methods all throw
+ * {@code IOException}.
+ *
+ * <p> The {@code markSupported()} method returns {@code false}. The
+ * {@code mark()} method does nothing, and the {@code reset()} method
+ * throws {@code IOException}.
+ *
+ * @return an {@code InputStream} which contains no bytes
+ *
+ * @since 11
+ */
+ public static InputStream nullInputStream() {
+ return new InputStream() {
+ private volatile boolean closed;
+
+ private void ensureOpen() throws IOException {
+ if (closed) {
+ throw new IOException("Stream closed");
+ }
+ }
+
+ @Override
+ public int available () throws IOException {
+ ensureOpen();
+ return 0;
+ }
+
+ @Override
+ public int read() throws IOException {
+ ensureOpen();
+ return -1;
+ }
+
+ @Override
+ public int read(byte[] b, int off, int len) throws IOException {
+ Objects.checkFromIndexSize(off, len, b.length);
+ if (len == 0) {
+ return 0;
+ }
+ ensureOpen();
+ return -1;
+ }
+
+ @Override
+ public byte[] readAllBytes() throws IOException {
+ ensureOpen();
+ return new byte[0];
+ }
+
+ @Override
+ public int readNBytes(byte[] b, int off, int len)
+ throws IOException {
+ Objects.checkFromIndexSize(off, len, b.length);
+ ensureOpen();
+ return 0;
+ }
+
+ @Override
+ public long skip(long n) throws IOException {
+ ensureOpen();
+ return 0L;
+ }
+
+ @Override
+ public long transferTo(OutputStream out) throws IOException {
+ Objects.requireNonNull(out);
+ ensureOpen();
+ return 0L;
+ }
+
+ @Override
+ public void close() throws IOException {
+ closed = true;
+ }
+ };
+ }
+
+ /**
* Reads the next byte of data from the input stream. The value byte is
* returned as an <code>int</code> in the range <code>0</code> to
* <code>255</code>. If no byte is available because the end of the stream
@@ -164,7 +253,6 @@
* @see java.io.InputStream#read()
*/
public int read(byte b[], int off, int len) throws IOException {
- Objects.requireNonNull(b);
Objects.checkFromIndexSize(off, len, b.length);
if (len == 0) {
return 0;
@@ -229,30 +317,55 @@
* @since 9
*/
public byte[] readAllBytes() throws IOException {
- byte[] buf = new byte[DEFAULT_BUFFER_SIZE];
- int capacity = buf.length;
- int nread = 0;
+ List<byte[]> bufs = null;
+ byte[] result = null;
+ int total = 0;
int n;
- for (;;) {
- // read to EOF which may read more or less than initial buffer size
- while ((n = read(buf, nread, capacity - nread)) > 0)
+ do {
+ byte[] buf = new byte[DEFAULT_BUFFER_SIZE];
+ int nread = 0;
+
+ // read to EOF which may read more or less than buffer size
+ while ((n = read(buf, nread, buf.length - nread)) > 0) {
nread += n;
+ }
- // if the last call to read returned -1, then we're done
- if (n < 0)
- break;
+ if (nread > 0) {
+ if (MAX_BUFFER_SIZE - total < nread) {
+ throw new OutOfMemoryError("Required array size too large");
+ }
+ total += nread;
+ if (result == null) {
+ result = buf;
+ } else {
+ if (bufs == null) {
+ bufs = new ArrayList<>();
+ bufs.add(result);
+ }
+ bufs.add(buf);
+ }
+ }
+ } while (n >= 0); // if the last call to read returned -1, then break
- // need to allocate a larger buffer
- if (capacity <= MAX_BUFFER_SIZE - capacity) {
- capacity = capacity << 1;
- } else {
- if (capacity == MAX_BUFFER_SIZE)
- throw new OutOfMemoryError("Required array size too large");
- capacity = MAX_BUFFER_SIZE;
+ if (bufs == null) {
+ if (result == null) {
+ return new byte[0];
}
- buf = Arrays.copyOf(buf, capacity);
+ return result.length == total ?
+ result : Arrays.copyOf(result, total);
}
- return (capacity == nread) ? buf : Arrays.copyOf(buf, nread);
+
+ result = new byte[total];
+ int offset = 0;
+ int remaining = total;
+ for (byte[] b : bufs) {
+ int len = Math.min(b.length, remaining);
+ System.arraycopy(b, 0, result, offset, len);
+ offset += len;
+ remaining -= len;
+ }
+
+ return result;
}
/**
@@ -299,7 +412,6 @@
* @since 9
*/
public int readNBytes(byte[] b, int off, int len) throws IOException {
- Objects.requireNonNull(b);
Objects.checkFromIndexSize(off, len, b.length);
int n = 0;
--- a/src/java.base/share/classes/java/io/ObjectInputStream.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/io/ObjectInputStream.java Thu Jan 18 18:58:46 2018 +0000
@@ -1296,7 +1296,6 @@
* @throws InvalidClassException if the filter rejects creation
*/
private void checkArray(Class<?> arrayType, int arrayLength) throws InvalidClassException {
- Objects.requireNonNull(arrayType);
if (! arrayType.isArray()) {
throw new IllegalArgumentException("not an array type");
}
--- a/src/java.base/share/classes/java/io/OutputStream.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/io/OutputStream.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -47,6 +47,51 @@
*/
public abstract class OutputStream implements Closeable, Flushable {
/**
+ * Returns a new {@code OutputStream} which discards all bytes. The
+ * returned stream is initially open. The stream is closed by calling
+ * the {@code close()} method. Subsequent calls to {@code close()} have
+ * no effect.
+ *
+ * <p> While the stream is open, the {@code write(int)}, {@code
+ * write(byte[])}, and {@code write(byte[], int, int)} methods do nothing.
+ * After the stream has been closed, these methods all throw {@code
+ * IOException}.
+ *
+ * <p> The {@code flush()} method does nothing.
+ *
+ * @return an {@code OutputStream} which discards all bytes
+ *
+ * @since 11
+ */
+ public static OutputStream nullOutputStream() {
+ return new OutputStream() {
+ private volatile boolean closed;
+
+ private void ensureOpen() throws IOException {
+ if (closed) {
+ throw new IOException("Stream closed");
+ }
+ }
+
+ @Override
+ public void write(int b) throws IOException {
+ ensureOpen();
+ }
+
+ @Override
+ public void write(byte b[], int off, int len) throws IOException {
+ Objects.checkFromIndexSize(off, len, b.length);
+ ensureOpen();
+ }
+
+ @Override
+ public void close() {
+ closed = true;
+ }
+ };
+ }
+
+ /**
* Writes the specified byte to this output stream. The general
* contract for <code>write</code> is that one byte is written
* to the output stream. The byte to be written is the eight
@@ -106,7 +151,6 @@
* stream is closed.
*/
public void write(byte b[], int off, int len) throws IOException {
- Objects.requireNonNull(b);
Objects.checkFromIndexSize(off, len, b.length);
// len == 0 condition implicitly handled by loop bounds
for (int i = 0 ; i < len ; i++) {
--- a/src/java.base/share/classes/java/lang/Runtime.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/lang/Runtime.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1099,16 +1099,23 @@
m.group(VersionPattern.OPT_GROUP));
// empty '+'
- if ((m.group(VersionPattern.PLUS_GROUP) != null)
- && !build.isPresent()) {
- if (optional.isPresent()) {
- if (pre.isPresent())
- throw new IllegalArgumentException("'+' found with"
- + " pre-release and optional components:'" + s
- + "'");
+ if (!build.isPresent()) {
+ if (m.group(VersionPattern.PLUS_GROUP) != null) {
+ if (optional.isPresent()) {
+ if (pre.isPresent())
+ throw new IllegalArgumentException("'+' found with"
+ + " pre-release and optional components:'" + s
+ + "'");
+ } else {
+ throw new IllegalArgumentException("'+' found with neither"
+ + " build or optional components: '" + s + "'");
+ }
} else {
- throw new IllegalArgumentException("'+' found with neither"
- + " build or optional components: '" + s + "'");
+ if (optional.isPresent() && !pre.isPresent()) {
+ throw new IllegalArgumentException("optional component"
+ + " must be preceeded by a pre-release component"
+ + " or '+': '" + s + "'");
+ }
}
}
return new Version(List.of(version), pre, build, optional);
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandle.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandle.java Thu Jan 18 18:58:46 2018 +0000
@@ -1667,6 +1667,7 @@
/** Craft a LambdaForm customized for this particular MethodHandle */
/*non-public*/
void customize() {
+ final LambdaForm form = this.form;
if (form.customized == null) {
LambdaForm newForm = form.customize(this);
updateForm(newForm);
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandles.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandles.java Thu Jan 18 18:58:46 2018 +0000
@@ -3766,6 +3766,7 @@
* specified in the elements of the {@code filters} array.
* The first element of the filter array corresponds to the {@code pos}
* argument of the target, and so on in sequence.
+ * The filter functions are invoked in left to right order.
* <p>
* Null arguments in the array are treated as identity functions,
* and the corresponding arguments left unchanged.
@@ -3836,11 +3837,12 @@
MethodHandle filterArguments(MethodHandle target, int pos, MethodHandle... filters) {
filterArgumentsCheckArity(target, pos, filters);
MethodHandle adapter = target;
- int curPos = pos-1; // pre-incremented
- for (MethodHandle filter : filters) {
- curPos += 1;
+ // process filters in reverse order so that the invocation of
+ // the resulting adapter will invoke the filters in left-to-right order
+ for (int i = filters.length - 1; i >= 0; --i) {
+ MethodHandle filter = filters[i];
if (filter == null) continue; // ignore null elements of filters
- adapter = filterArgument(adapter, curPos, filter);
+ adapter = filterArgument(adapter, pos + i, filter);
}
return adapter;
}
--- a/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java Thu Jan 18 18:58:46 2018 +0000
@@ -2521,7 +2521,7 @@
* the {@code packageFinder} throws an {@link UncheckedIOException} then
* {@link IOException} cause will be re-thrown. </p>
*
- * <p> The module descriptor is read from the buffer stating at index
+ * <p> The module descriptor is read from the buffer starting at index
* {@code p}, where {@code p} is the buffer's {@link ByteBuffer#position()
* position} when this method is invoked. Upon return the buffer's position
* will be equal to {@code p + n} where {@code n} is the number of bytes
--- a/src/java.base/share/classes/java/lang/ref/Reference.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/lang/ref/Reference.java Thu Jan 18 18:58:46 2018 +0000
@@ -141,14 +141,6 @@
}
/*
- * system property to disable clearing before enqueuing.
- */
- private static final class ClearBeforeEnqueue {
- static final boolean DISABLE =
- Boolean.getBoolean("jdk.lang.ref.disableClearBeforeEnqueue");
- }
-
- /*
* Atomically get and clear (set to null) the VM's pending list.
*/
private static native Reference<Object> getAndClearReferencePendingList();
@@ -299,8 +291,7 @@
* it was not registered with a queue when it was created
*/
public boolean enqueue() {
- if (!ClearBeforeEnqueue.DISABLE)
- this.referent = null;
+ this.referent = null;
return this.queue.enqueue(this);
}
--- a/src/java.base/share/classes/java/net/InetSocketAddress.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/net/InetSocketAddress.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -317,10 +317,9 @@
}
/**
- *
* Gets the {@code InetAddress}.
*
- * @return the InetAdress or {@code null} if it is unresolved.
+ * @return the InetAddress or {@code null} if it is unresolved.
*/
public final InetAddress getAddress() {
return holder.getAddress();
--- a/src/java.base/share/classes/java/nio/Bits.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/nio/Bits.java Thu Jan 18 18:58:46 2018 +0000
@@ -63,38 +63,38 @@
// -- Unsafe access --
- private static final Unsafe unsafe = Unsafe.getUnsafe();
+ private static final Unsafe UNSAFE = Unsafe.getUnsafe();
static Unsafe unsafe() {
- return unsafe;
+ return UNSAFE;
}
// -- Processor and memory-system properties --
- private static final ByteOrder byteOrder
- = unsafe.isBigEndian() ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN;
+ private static final ByteOrder BYTE_ORDER
+ = UNSAFE.isBigEndian() ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN;
static ByteOrder byteOrder() {
- return byteOrder;
+ return BYTE_ORDER;
}
- private static int pageSize = -1;
+ private static int PAGE_SIZE = -1;
static int pageSize() {
- if (pageSize == -1)
- pageSize = unsafe().pageSize();
- return pageSize;
+ if (PAGE_SIZE == -1)
+ PAGE_SIZE = unsafe().pageSize();
+ return PAGE_SIZE;
}
static int pageCount(long size) {
return (int)(size + (long)pageSize() - 1L) / pageSize();
}
- private static boolean unaligned = unsafe.unalignedAccess();
+ private static boolean UNALIGNED = UNSAFE.unalignedAccess();
static boolean unaligned() {
- return unaligned;
+ return UNALIGNED;
}
@@ -103,11 +103,11 @@
// A user-settable upper limit on the maximum amount of allocatable
// direct buffer memory. This value may be changed during VM
// initialization if it is launched with "-XX:MaxDirectMemorySize=<size>".
- private static volatile long maxMemory = VM.maxDirectMemory();
- private static final AtomicLong reservedMemory = new AtomicLong();
- private static final AtomicLong totalCapacity = new AtomicLong();
- private static final AtomicLong count = new AtomicLong();
- private static volatile boolean memoryLimitSet;
+ private static volatile long MAX_MEMORY = VM.maxDirectMemory();
+ private static final AtomicLong RESERVED_MEMORY = new AtomicLong();
+ private static final AtomicLong TOTAL_CAPACITY = new AtomicLong();
+ private static final AtomicLong COUNT = new AtomicLong();
+ private static volatile boolean MEMORY_LIMIT_SET;
// max. number of sleeps during try-reserving with exponentially
// increasing delay before throwing OutOfMemoryError:
@@ -120,9 +120,9 @@
// which a process may access. All sizes are specified in bytes.
static void reserveMemory(long size, int cap) {
- if (!memoryLimitSet && VM.initLevel() >= 1) {
- maxMemory = VM.maxDirectMemory();
- memoryLimitSet = true;
+ if (!MEMORY_LIMIT_SET && VM.initLevel() >= 1) {
+ MAX_MEMORY = VM.maxDirectMemory();
+ MEMORY_LIMIT_SET = true;
}
// optimist!
@@ -200,10 +200,10 @@
// actual memory usage, which will differ when buffers are page
// aligned.
long totalCap;
- while (cap <= maxMemory - (totalCap = totalCapacity.get())) {
- if (totalCapacity.compareAndSet(totalCap, totalCap + cap)) {
- reservedMemory.addAndGet(size);
- count.incrementAndGet();
+ while (cap <= MAX_MEMORY - (totalCap = TOTAL_CAPACITY.get())) {
+ if (TOTAL_CAPACITY.compareAndSet(totalCap, totalCap + cap)) {
+ RESERVED_MEMORY.addAndGet(size);
+ COUNT.incrementAndGet();
return true;
}
}
@@ -213,9 +213,9 @@
static void unreserveMemory(long size, int cap) {
- long cnt = count.decrementAndGet();
- long reservedMem = reservedMemory.addAndGet(-size);
- long totalCap = totalCapacity.addAndGet(-cap);
+ long cnt = COUNT.decrementAndGet();
+ long reservedMem = RESERVED_MEMORY.addAndGet(-size);
+ long totalCap = TOTAL_CAPACITY.addAndGet(-cap);
assert cnt >= 0 && reservedMem >= 0 && totalCap >= 0;
}
@@ -234,15 +234,15 @@
}
@Override
public long getCount() {
- return Bits.count.get();
+ return Bits.COUNT.get();
}
@Override
public long getTotalCapacity() {
- return Bits.totalCapacity.get();
+ return Bits.TOTAL_CAPACITY.get();
}
@Override
public long getMemoryUsed() {
- return Bits.reservedMemory.get();
+ return Bits.RESERVED_MEMORY.get();
}
};
}
--- a/src/java.base/share/classes/java/nio/Buffer.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/nio/Buffer.java Thu Jan 18 18:58:46 2018 +0000
@@ -26,6 +26,7 @@
package java.nio;
import jdk.internal.HotSpotIntrinsicCandidate;
+import jdk.internal.misc.Unsafe;
import java.util.Spliterator;
@@ -181,6 +182,8 @@
*/
public abstract class Buffer {
+ // Cached unsafe-access object
+ static final Unsafe UNSAFE = Bits.unsafe();
/**
* The characteristics of Spliterators that traverse and split elements
@@ -617,6 +620,14 @@
// -- Package-private methods for bounds checking, etc. --
/**
+ *
+ * @return the base reference, paired with the address
+ * field, which in combination can be used for unsafe access into a heap
+ * buffer or direct byte buffer (and views of).
+ */
+ abstract Object base();
+
+ /**
* Checks the current position against the limit, throwing a {@link
* BufferUnderflowException} if it is not smaller than the limit, and then
* increments the position.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/java/nio/BufferMismatch.java Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,198 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.nio;
+
+import jdk.internal.util.ArraysSupport;
+
+/**
+ * Mismatch methods for buffers
+ */
+final class BufferMismatch {
+
+ static int mismatch(ByteBuffer a, int aOff, ByteBuffer b, int bOff, int length) {
+ int i = 0;
+ if (length > 7) {
+ i = ArraysSupport.vectorizedMismatch(
+ a.base(), a.address + aOff,
+ b.base(), b.address + bOff,
+ length,
+ ArraysSupport.LOG2_ARRAY_BYTE_INDEX_SCALE);
+ if (i >= 0) return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a.get(aOff + i) != b.get(bOff + i))
+ return i;
+ }
+ return -1;
+ }
+
+ static int mismatch(CharBuffer a, int aOff, CharBuffer b, int bOff, int length) {
+ int i = 0;
+ // Ensure only heap or off-heap buffer instances use the
+ // vectorized mismatch. If either buffer is a StringCharBuffer
+ // (order is null) then the slow path is taken
+ if (length > 3 && a.charRegionOrder() == b.charRegionOrder()
+ && a.charRegionOrder() != null && b.charRegionOrder() != null) {
+ i = ArraysSupport.vectorizedMismatch(
+ a.base(), a.address + (aOff << ArraysSupport.LOG2_ARRAY_CHAR_INDEX_SCALE),
+ b.base(), b.address + (bOff << ArraysSupport.LOG2_ARRAY_CHAR_INDEX_SCALE),
+ length,
+ ArraysSupport.LOG2_ARRAY_CHAR_INDEX_SCALE);
+ if (i >= 0) return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a.get(aOff + i) != b.get(bOff + i))
+ return i;
+ }
+ return -1;
+ }
+
+ static int mismatch(ShortBuffer a, int aOff, ShortBuffer b, int bOff, int length) {
+ int i = 0;
+ if (length > 3 && a.order() == b.order()) {
+ i = ArraysSupport.vectorizedMismatch(
+ a.base(), a.address + (aOff << ArraysSupport.LOG2_ARRAY_SHORT_INDEX_SCALE),
+ b.base(), b.address + (bOff << ArraysSupport.LOG2_ARRAY_SHORT_INDEX_SCALE),
+ length,
+ ArraysSupport.LOG2_ARRAY_SHORT_INDEX_SCALE);
+ if (i >= 0) return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a.get(aOff + i) != b.get(bOff + i))
+ return i;
+ }
+ return -1;
+ }
+
+ static int mismatch(IntBuffer a, int aOff, IntBuffer b, int bOff, int length) {
+ int i = 0;
+ if (length > 1 && a.order() == b.order()) {
+ i = ArraysSupport.vectorizedMismatch(
+ a.base(), a.address + (aOff << ArraysSupport.LOG2_ARRAY_INT_INDEX_SCALE),
+ b.base(), b.address + (bOff << ArraysSupport.LOG2_ARRAY_INT_INDEX_SCALE),
+ length,
+ ArraysSupport.LOG2_ARRAY_INT_INDEX_SCALE);
+ if (i >= 0) return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a.get(aOff + i) != b.get(bOff + i))
+ return i;
+ }
+ return -1;
+ }
+
+ static int mismatch(FloatBuffer a, int aOff, FloatBuffer b, int bOff, int length) {
+ int i = 0;
+ if (length > 1 && a.order() == b.order()) {
+ i = ArraysSupport.vectorizedMismatch(
+ a.base(), a.address + (aOff << ArraysSupport.LOG2_ARRAY_FLOAT_INDEX_SCALE),
+ b.base(), b.address + (bOff << ArraysSupport.LOG2_ARRAY_FLOAT_INDEX_SCALE),
+ length,
+ ArraysSupport.LOG2_ARRAY_FLOAT_INDEX_SCALE);
+ // Mismatched
+ if (i >= 0) {
+ // Check if mismatch is not associated with two NaN values; and
+ // is not associated with +0 and -0
+ float av = a.get(aOff + i);
+ float bv = b.get(bOff + i);
+ if (av != bv && (!Float.isNaN(av) || !Float.isNaN(bv)))
+ return i;
+
+ // Fall back to slow mechanism
+ // ISSUE: Consider looping over vectorizedMismatch adjusting ranges
+ // However, requires that returned value be relative to input ranges
+ i++;
+ }
+ // Matched
+ else {
+ i = length - ~i;
+ }
+ }
+ for (; i < length; i++) {
+ float av = a.get(aOff + i);
+ float bv = b.get(bOff + i);
+ if (av != bv && (!Float.isNaN(av) || !Float.isNaN(bv)))
+ return i;
+ }
+ return -1;
+ }
+
+ static int mismatch(LongBuffer a, int aOff, LongBuffer b, int bOff, int length) {
+ int i = 0;
+ if (length > 0 && a.order() == b.order()) {
+ i = ArraysSupport.vectorizedMismatch(
+ a.base(), a.address + (aOff << ArraysSupport.LOG2_ARRAY_LONG_INDEX_SCALE),
+ b.base(), b.address + (bOff << ArraysSupport.LOG2_ARRAY_LONG_INDEX_SCALE),
+ length,
+ ArraysSupport.LOG2_ARRAY_LONG_INDEX_SCALE);
+ return i >= 0 ? i : -1;
+ }
+ for (; i < length; i++) {
+ if (a.get(aOff + i) != b.get(bOff + i))
+ return i;
+ }
+ return -1;
+ }
+
+ static int mismatch(DoubleBuffer a, int aOff, DoubleBuffer b, int bOff, int length) {
+ int i = 0;
+ if (length > 0 && a.order() == b.order()) {
+ i = ArraysSupport.vectorizedMismatch(
+ a.base(), a.address + (aOff << ArraysSupport.LOG2_ARRAY_DOUBLE_INDEX_SCALE),
+ b.base(), b.address + (bOff << ArraysSupport.LOG2_ARRAY_DOUBLE_INDEX_SCALE),
+ length,
+ ArraysSupport.LOG2_ARRAY_DOUBLE_INDEX_SCALE);
+ // Mismatched
+ if (i >= 0) {
+ // Check if mismatch is not associated with two NaN values; and
+ // is not associated with +0 and -0
+ double av = a.get(aOff + i);
+ double bv = b.get(bOff + i);
+ if (av != bv && (!Double.isNaN(av) || !Double.isNaN(bv)))
+ return i;
+
+ // Fall back to slow mechanism
+ // ISSUE: Consider looping over vectorizedMismatch adjusting ranges
+ // However, requires that returned value be relative to input ranges
+ i++;
+ }
+ // Matched
+ else {
+ return -1;
+ }
+ }
+ for (; i < length; i++) {
+ double av = a.get(aOff + i);
+ double bv = b.get(bOff + i);
+ if (av != bv && (!Double.isNaN(av) || !Double.isNaN(bv)))
+ return i;
+ }
+ return -1;
+ }
+}
--- a/src/java.base/share/classes/java/nio/ByteBufferAs-X-Buffer.java.template Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/nio/ByteBufferAs-X-Buffer.java.template Thu Jan 18 18:58:46 2018 +0000
@@ -36,9 +36,6 @@
#if[rw]
- // Cached unsafe-access object
- private static final Unsafe unsafe = Bits.unsafe();
-
protected final ByteBuffer bb;
#end[rw]
@@ -74,6 +71,11 @@
#end[rw]
}
+ @Override
+ Object base() {
+ return bb.hb;
+ }
+
public $Type$Buffer slice() {
int pos = this.position();
int lim = this.limit();
@@ -117,20 +119,20 @@
}
public $type$ get() {
- $memtype$ x = unsafe.get$Memtype$Unaligned(bb.hb, byteOffset(nextGetIndex()),
+ $memtype$ x = UNSAFE.get$Memtype$Unaligned(bb.hb, byteOffset(nextGetIndex()),
{#if[boB]?true:false});
return $fromBits$(x);
}
public $type$ get(int i) {
- $memtype$ x = unsafe.get$Memtype$Unaligned(bb.hb, byteOffset(checkIndex(i)),
+ $memtype$ x = UNSAFE.get$Memtype$Unaligned(bb.hb, byteOffset(checkIndex(i)),
{#if[boB]?true:false});
return $fromBits$(x);
}
#if[streamableType]
$type$ getUnchecked(int i) {
- $memtype$ x = unsafe.get$Memtype$Unaligned(bb.hb, byteOffset(i),
+ $memtype$ x = UNSAFE.get$Memtype$Unaligned(bb.hb, byteOffset(i),
{#if[boB]?true:false});
return $fromBits$(x);
}
@@ -141,7 +143,7 @@
public $Type$Buffer put($type$ x) {
#if[rw]
$memtype$ y = $toBits$(x);
- unsafe.put$Memtype$Unaligned(bb.hb, byteOffset(nextPutIndex()), y,
+ UNSAFE.put$Memtype$Unaligned(bb.hb, byteOffset(nextPutIndex()), y,
{#if[boB]?true:false});
return this;
#else[rw]
@@ -152,7 +154,7 @@
public $Type$Buffer put(int i, $type$ x) {
#if[rw]
$memtype$ y = $toBits$(x);
- unsafe.put$Memtype$Unaligned(bb.hb, byteOffset(checkIndex(i)), y,
+ UNSAFE.put$Memtype$Unaligned(bb.hb, byteOffset(checkIndex(i)), y,
{#if[boB]?true:false});
return this;
#else[rw]
@@ -241,4 +243,9 @@
#end[boL]
}
+#if[char]
+ ByteOrder charRegionOrder() {
+ return order();
+ }
+#end[char]
}
--- a/src/java.base/share/classes/java/nio/Direct-X-Buffer-bin.java.template Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/nio/Direct-X-Buffer-bin.java.template Thu Jan 18 18:58:46 2018 +0000
@@ -32,7 +32,7 @@
#if[rw]
private $type$ get$Type$(long a) {
- $memtype$ x = unsafe.get$Memtype$Unaligned(null, a, bigEndian);
+ $memtype$ x = UNSAFE.get$Memtype$Unaligned(null, a, bigEndian);
return $fromBits$(x);
}
@@ -49,7 +49,7 @@
private ByteBuffer put$Type$(long a, $type$ x) {
#if[rw]
$memtype$ y = $toBits$(x);
- unsafe.put$Memtype$Unaligned(null, a, y, bigEndian);
+ UNSAFE.put$Memtype$Unaligned(null, a, y, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -81,7 +81,7 @@
int rem = (off <= lim ? lim - off : 0);
int size = rem >> $LG_BYTES_PER_VALUE$;
- if (!unaligned && ((address + off) % $BYTES_PER_VALUE$ != 0)) {
+ if (!UNALIGNED && ((address + off) % $BYTES_PER_VALUE$ != 0)) {
return (bigEndian
? ($Type$Buffer)(new ByteBufferAs$Type$Buffer$RW$B(this,
-1,
--- a/src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template Thu Jan 18 18:58:46 2018 +0000
@@ -28,7 +28,6 @@
package java.nio;
import java.io.FileDescriptor;
-import jdk.internal.misc.Unsafe;
import jdk.internal.misc.VM;
import jdk.internal.ref.Cleaner;
import sun.nio.ch.DirectBuffer;
@@ -45,14 +44,11 @@
#if[rw]
- // Cached unsafe-access object
- protected static final Unsafe unsafe = Bits.unsafe();
-
// Cached array base offset
- private static final long arrayBaseOffset = (long)unsafe.arrayBaseOffset($type$[].class);
+ private static final long ARRAY_BASE_OFFSET = UNSAFE.arrayBaseOffset($type$[].class);
// Cached unaligned-access capability
- protected static final boolean unaligned = Bits.unaligned();
+ protected static final boolean UNALIGNED = Bits.unaligned();
// Base address, used in all indexing calculations
// NOTE: moved up to Buffer.java for speed in JNI GetDirectBufferAddress
@@ -73,8 +69,6 @@
implements Runnable
{
- private static Unsafe unsafe = Unsafe.getUnsafe();
-
private long address;
private long size;
private int capacity;
@@ -91,7 +85,7 @@
// Paranoia
return;
}
- unsafe.freeMemory(address);
+ UNSAFE.freeMemory(address);
address = 0;
Bits.unreserveMemory(size, capacity);
}
@@ -124,12 +118,12 @@
long base = 0;
try {
- base = unsafe.allocateMemory(size);
+ base = UNSAFE.allocateMemory(size);
} catch (OutOfMemoryError x) {
Bits.unreserveMemory(size, cap);
throw x;
}
- unsafe.setMemory(base, size, (byte) 0);
+ UNSAFE.setMemory(base, size, (byte) 0);
if (pa && (base % ps != 0)) {
// Round up to page boundary
address = base + ps - (base & (ps - 1));
@@ -206,6 +200,11 @@
#end[rw]
}
+ @Override
+ Object base() {
+ return null;
+ }
+
public $Type$Buffer slice() {
int pos = this.position();
int lim = this.limit();
@@ -258,16 +257,16 @@
}
public $type$ get() {
- return $fromBits$($swap$(unsafe.get$Swaptype$(ix(nextGetIndex()))));
+ return $fromBits$($swap$(UNSAFE.get$Swaptype$(ix(nextGetIndex()))));
}
public $type$ get(int i) {
- return $fromBits$($swap$(unsafe.get$Swaptype$(ix(checkIndex(i)))));
+ return $fromBits$($swap$(UNSAFE.get$Swaptype$(ix(checkIndex(i)))));
}
#if[streamableType]
$type$ getUnchecked(int i) {
- return $fromBits$($swap$(unsafe.get$Swaptype$(ix(i))));
+ return $fromBits$($swap$(UNSAFE.get$Swaptype$(ix(i))));
}
#end[streamableType]
@@ -282,10 +281,10 @@
if (length > rem)
throw new BufferUnderflowException();
- long dstOffset = arrayBaseOffset + ((long)offset << $LG_BYTES_PER_VALUE$);
+ long dstOffset = ARRAY_BASE_OFFSET + ((long)offset << $LG_BYTES_PER_VALUE$);
#if[!byte]
if (order() != ByteOrder.nativeOrder())
- unsafe.copySwapMemory(null,
+ UNSAFE.copySwapMemory(null,
ix(pos),
dst,
dstOffset,
@@ -293,7 +292,7 @@
(long)1 << $LG_BYTES_PER_VALUE$);
else
#end[!byte]
- unsafe.copyMemory(null,
+ UNSAFE.copyMemory(null,
ix(pos),
dst,
dstOffset,
@@ -312,7 +311,7 @@
public $Type$Buffer put($type$ x) {
#if[rw]
- unsafe.put$Swaptype$(ix(nextPutIndex()), $swap$($toBits$(x)));
+ UNSAFE.put$Swaptype$(ix(nextPutIndex()), $swap$($toBits$(x)));
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -321,7 +320,7 @@
public $Type$Buffer put(int i, $type$ x) {
#if[rw]
- unsafe.put$Swaptype$(ix(checkIndex(i)), $swap$($toBits$(x)));
+ UNSAFE.put$Swaptype$(ix(checkIndex(i)), $swap$($toBits$(x)));
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -347,7 +346,7 @@
if (srem > rem)
throw new BufferOverflowException();
- unsafe.copyMemory(sb.ix(spos), ix(pos), (long)srem << $LG_BYTES_PER_VALUE$);
+ UNSAFE.copyMemory(sb.ix(spos), ix(pos), (long)srem << $LG_BYTES_PER_VALUE$);
sb.position(spos + srem);
position(pos + srem);
} else if (src.hb != null) {
@@ -380,10 +379,10 @@
if (length > rem)
throw new BufferOverflowException();
- long srcOffset = arrayBaseOffset + ((long)offset << $LG_BYTES_PER_VALUE$);
+ long srcOffset = ARRAY_BASE_OFFSET + ((long)offset << $LG_BYTES_PER_VALUE$);
#if[!byte]
if (order() != ByteOrder.nativeOrder())
- unsafe.copySwapMemory(src,
+ UNSAFE.copySwapMemory(src,
srcOffset,
null,
ix(pos),
@@ -391,7 +390,7 @@
(long)1 << $LG_BYTES_PER_VALUE$);
else
#end[!byte]
- unsafe.copyMemory(src,
+ UNSAFE.copyMemory(src,
srcOffset,
null,
ix(pos),
@@ -413,7 +412,7 @@
assert (pos <= lim);
int rem = (pos <= lim ? lim - pos : 0);
- unsafe.copyMemory(ix(pos), ix(0), (long)rem << $LG_BYTES_PER_VALUE$);
+ UNSAFE.copyMemory(ix(pos), ix(0), (long)rem << $LG_BYTES_PER_VALUE$);
position(rem);
limit(capacity());
discardMark();
@@ -490,17 +489,22 @@
#end[!byte]
+#if[char]
+ ByteOrder charRegionOrder() {
+ return order();
+ }
+#end[char]
#if[byte]
byte _get(int i) { // package-private
- return unsafe.getByte(address + i);
+ return UNSAFE.getByte(address + i);
}
void _put(int i, byte b) { // package-private
#if[rw]
- unsafe.putByte(address + i, b);
+ UNSAFE.putByte(address + i, b);
#else[rw]
throw new ReadOnlyBufferException();
#end[rw]
--- a/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template Thu Jan 18 18:58:46 2018 +0000
@@ -27,8 +27,6 @@
package java.nio;
-import jdk.internal.misc.Unsafe;
-
/**
#if[rw]
* A read/write Heap$Type$Buffer.
@@ -43,6 +41,11 @@
class Heap$Type$Buffer$RW$
extends {#if[ro]?Heap}$Type$Buffer
{
+ // Cached array base offset
+ private static final long ARRAY_BASE_OFFSET = UNSAFE.arrayBaseOffset($type$[].class);
+
+ // Cached array base offset
+ private static final long ARRAY_INDEX_SCALE = UNSAFE.arrayIndexScale($type$[].class);
// For speed these fields are actually declared in X-Buffer;
// these declarations are here as documentation
@@ -53,16 +56,6 @@
#end[rw]
*/
-#if[byte]
-
- // Cached unsafe-access object
- private static final Unsafe unsafe = Bits.unsafe();
-
- // Cached array base offset
- private static final long arrayBaseOffset = unsafe.arrayBaseOffset($type$[].class);
-
-#end[byte]
-
Heap$Type$Buffer$RW$(int cap, int lim) { // package-private
#if[rw]
super(-1, 0, lim, cap, new $type$[cap], 0);
@@ -70,13 +63,11 @@
hb = new $type$[cap];
offset = 0;
*/
+ this.address = ARRAY_BASE_OFFSET;
#else[rw]
super(cap, lim);
this.isReadOnly = true;
#end[rw]
-#if[byte]
- this.address = arrayBaseOffset;
-#end[byte]
}
Heap$Type$Buffer$RW$($type$[] buf, int off, int len) { // package-private
@@ -86,13 +77,11 @@
hb = buf;
offset = 0;
*/
+ this.address = ARRAY_BASE_OFFSET;
#else[rw]
super(buf, off, len);
this.isReadOnly = true;
#end[rw]
-#if[byte]
- this.address = arrayBaseOffset;
-#end[byte]
}
protected Heap$Type$Buffer$RW$($type$[] buf,
@@ -105,13 +94,11 @@
hb = buf;
offset = off;
*/
+ this.address = ARRAY_BASE_OFFSET + off * ARRAY_INDEX_SCALE;
#else[rw]
super(buf, mark, pos, lim, cap, off);
this.isReadOnly = true;
#end[rw]
-#if[byte]
- this.address = arrayBaseOffset + off;
-#end[byte]
}
public $Type$Buffer slice() {
@@ -296,18 +283,18 @@
#if[rw]
public char getChar() {
- return unsafe.getCharUnaligned(hb, byteOffset(nextGetIndex(2)), bigEndian);
+ return UNSAFE.getCharUnaligned(hb, byteOffset(nextGetIndex(2)), bigEndian);
}
public char getChar(int i) {
- return unsafe.getCharUnaligned(hb, byteOffset(checkIndex(i, 2)), bigEndian);
+ return UNSAFE.getCharUnaligned(hb, byteOffset(checkIndex(i, 2)), bigEndian);
}
#end[rw]
public $Type$Buffer putChar(char x) {
#if[rw]
- unsafe.putCharUnaligned(hb, byteOffset(nextPutIndex(2)), x, bigEndian);
+ UNSAFE.putCharUnaligned(hb, byteOffset(nextPutIndex(2)), x, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -316,7 +303,7 @@
public $Type$Buffer putChar(int i, char x) {
#if[rw]
- unsafe.putCharUnaligned(hb, byteOffset(checkIndex(i, 2)), x, bigEndian);
+ UNSAFE.putCharUnaligned(hb, byteOffset(checkIndex(i, 2)), x, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -347,18 +334,18 @@
#if[rw]
public short getShort() {
- return unsafe.getShortUnaligned(hb, byteOffset(nextGetIndex(2)), bigEndian);
+ return UNSAFE.getShortUnaligned(hb, byteOffset(nextGetIndex(2)), bigEndian);
}
public short getShort(int i) {
- return unsafe.getShortUnaligned(hb, byteOffset(checkIndex(i, 2)), bigEndian);
+ return UNSAFE.getShortUnaligned(hb, byteOffset(checkIndex(i, 2)), bigEndian);
}
#end[rw]
public $Type$Buffer putShort(short x) {
#if[rw]
- unsafe.putShortUnaligned(hb, byteOffset(nextPutIndex(2)), x, bigEndian);
+ UNSAFE.putShortUnaligned(hb, byteOffset(nextPutIndex(2)), x, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -367,7 +354,7 @@
public $Type$Buffer putShort(int i, short x) {
#if[rw]
- unsafe.putShortUnaligned(hb, byteOffset(checkIndex(i, 2)), x, bigEndian);
+ UNSAFE.putShortUnaligned(hb, byteOffset(checkIndex(i, 2)), x, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -398,18 +385,18 @@
#if[rw]
public int getInt() {
- return unsafe.getIntUnaligned(hb, byteOffset(nextGetIndex(4)), bigEndian);
+ return UNSAFE.getIntUnaligned(hb, byteOffset(nextGetIndex(4)), bigEndian);
}
public int getInt(int i) {
- return unsafe.getIntUnaligned(hb, byteOffset(checkIndex(i, 4)), bigEndian);
+ return UNSAFE.getIntUnaligned(hb, byteOffset(checkIndex(i, 4)), bigEndian);
}
#end[rw]
public $Type$Buffer putInt(int x) {
#if[rw]
- unsafe.putIntUnaligned(hb, byteOffset(nextPutIndex(4)), x, bigEndian);
+ UNSAFE.putIntUnaligned(hb, byteOffset(nextPutIndex(4)), x, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -418,7 +405,7 @@
public $Type$Buffer putInt(int i, int x) {
#if[rw]
- unsafe.putIntUnaligned(hb, byteOffset(checkIndex(i, 4)), x, bigEndian);
+ UNSAFE.putIntUnaligned(hb, byteOffset(checkIndex(i, 4)), x, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -449,18 +436,18 @@
#if[rw]
public long getLong() {
- return unsafe.getLongUnaligned(hb, byteOffset(nextGetIndex(8)), bigEndian);
+ return UNSAFE.getLongUnaligned(hb, byteOffset(nextGetIndex(8)), bigEndian);
}
public long getLong(int i) {
- return unsafe.getLongUnaligned(hb, byteOffset(checkIndex(i, 8)), bigEndian);
+ return UNSAFE.getLongUnaligned(hb, byteOffset(checkIndex(i, 8)), bigEndian);
}
#end[rw]
public $Type$Buffer putLong(long x) {
#if[rw]
- unsafe.putLongUnaligned(hb, byteOffset(nextPutIndex(8)), x, bigEndian);
+ UNSAFE.putLongUnaligned(hb, byteOffset(nextPutIndex(8)), x, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -469,7 +456,7 @@
public $Type$Buffer putLong(int i, long x) {
#if[rw]
- unsafe.putLongUnaligned(hb, byteOffset(checkIndex(i, 8)), x, bigEndian);
+ UNSAFE.putLongUnaligned(hb, byteOffset(checkIndex(i, 8)), x, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -500,12 +487,12 @@
#if[rw]
public float getFloat() {
- int x = unsafe.getIntUnaligned(hb, byteOffset(nextGetIndex(4)), bigEndian);
+ int x = UNSAFE.getIntUnaligned(hb, byteOffset(nextGetIndex(4)), bigEndian);
return Float.intBitsToFloat(x);
}
public float getFloat(int i) {
- int x = unsafe.getIntUnaligned(hb, byteOffset(checkIndex(i, 4)), bigEndian);
+ int x = UNSAFE.getIntUnaligned(hb, byteOffset(checkIndex(i, 4)), bigEndian);
return Float.intBitsToFloat(x);
}
@@ -514,7 +501,7 @@
public $Type$Buffer putFloat(float x) {
#if[rw]
int y = Float.floatToRawIntBits(x);
- unsafe.putIntUnaligned(hb, byteOffset(nextPutIndex(4)), y, bigEndian);
+ UNSAFE.putIntUnaligned(hb, byteOffset(nextPutIndex(4)), y, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -524,7 +511,7 @@
public $Type$Buffer putFloat(int i, float x) {
#if[rw]
int y = Float.floatToRawIntBits(x);
- unsafe.putIntUnaligned(hb, byteOffset(checkIndex(i, 4)), y, bigEndian);
+ UNSAFE.putIntUnaligned(hb, byteOffset(checkIndex(i, 4)), y, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -555,12 +542,12 @@
#if[rw]
public double getDouble() {
- long x = unsafe.getLongUnaligned(hb, byteOffset(nextGetIndex(8)), bigEndian);
+ long x = UNSAFE.getLongUnaligned(hb, byteOffset(nextGetIndex(8)), bigEndian);
return Double.longBitsToDouble(x);
}
public double getDouble(int i) {
- long x = unsafe.getLongUnaligned(hb, byteOffset(checkIndex(i, 8)), bigEndian);
+ long x = UNSAFE.getLongUnaligned(hb, byteOffset(checkIndex(i, 8)), bigEndian);
return Double.longBitsToDouble(x);
}
@@ -569,7 +556,7 @@
public $Type$Buffer putDouble(double x) {
#if[rw]
long y = Double.doubleToRawLongBits(x);
- unsafe.putLongUnaligned(hb, byteOffset(nextPutIndex(8)), y, bigEndian);
+ UNSAFE.putLongUnaligned(hb, byteOffset(nextPutIndex(8)), y, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -579,7 +566,7 @@
public $Type$Buffer putDouble(int i, double x) {
#if[rw]
long y = Double.doubleToRawLongBits(x);
- unsafe.putLongUnaligned(hb, byteOffset(checkIndex(i, 8)), y, bigEndian);
+ UNSAFE.putLongUnaligned(hb, byteOffset(checkIndex(i, 8)), y, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -643,7 +630,11 @@
public ByteOrder order() {
return ByteOrder.nativeOrder();
}
+#end[!byte]
+#if[char]
-#end[!byte]
-
+ ByteOrder charRegionOrder() {
+ return order();
+ }
+#end[char]
}
--- a/src/java.base/share/classes/java/nio/StringCharBuffer.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/nio/StringCharBuffer.java Thu Jan 18 18:58:46 2018 +0000
@@ -127,4 +127,30 @@
return ByteOrder.nativeOrder();
}
+ ByteOrder charRegionOrder() {
+ return null;
+ }
+
+ public boolean equals(Object ob) {
+ if (this == ob)
+ return true;
+ if (!(ob instanceof CharBuffer))
+ return false;
+ CharBuffer that = (CharBuffer)ob;
+ if (this.remaining() != that.remaining())
+ return false;
+ return BufferMismatch.mismatch(this, this.position(),
+ that, that.position(),
+ this.remaining()) < 0;
+ }
+
+ public int compareTo(CharBuffer that) {
+ int i = BufferMismatch.mismatch(this, this.position(),
+ that, that.position(),
+ Math.min(this.remaining(), that.remaining()));
+ if (i >= 0) {
+ return Character.compare(this.get(this.position() + i), that.get(this.position() + i));
+ }
+ return this.remaining() - that.remaining();
+ }
}
--- a/src/java.base/share/classes/java/nio/X-Buffer.java.template Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/nio/X-Buffer.java.template Thu Jan 18 18:58:46 2018 +0000
@@ -36,6 +36,8 @@
import java.util.stream.$Streamtype$Stream;
#end[streamableType]
+import jdk.internal.util.ArraysSupport;
+
/**
* $A$ $type$ buffer.
*
@@ -287,6 +289,11 @@
this(mark, pos, lim, cap, null, 0);
}
+ @Override
+ Object base() {
+ return hb;
+ }
+
#if[byte]
/**
@@ -1297,19 +1304,9 @@
$Type$Buffer that = ($Type$Buffer)ob;
if (this.remaining() != that.remaining())
return false;
- int p = this.position();
- for (int i = this.limit() - 1, j = that.limit() - 1; i >= p; i--, j--)
- if (!equals(this.get(i), that.get(j)))
- return false;
- return true;
- }
-
- private static boolean equals($type$ x, $type$ y) {
-#if[floatingPointType]
- return (x == y) || ($Fulltype$.isNaN(x) && $Fulltype$.isNaN(y));
-#else[floatingPointType]
- return x == y;
-#end[floatingPointType]
+ return BufferMismatch.mismatch(this, this.position(),
+ that, that.position(),
+ this.remaining()) < 0;
}
/**
@@ -1336,11 +1333,11 @@
* is less than, equal to, or greater than the given buffer
*/
public int compareTo($Type$Buffer that) {
- int n = this.position() + Math.min(this.remaining(), that.remaining());
- for (int i = this.position(), j = that.position(); i < n; i++, j++) {
- int cmp = compare(this.get(i), that.get(j));
- if (cmp != 0)
- return cmp;
+ int i = BufferMismatch.mismatch(this, this.position(),
+ that, that.position(),
+ Math.min(this.remaining(), that.remaining()));
+ if (i >= 0) {
+ return compare(this.get(this.position() + i), that.get(this.position() + i));
}
return this.remaining() - that.remaining();
}
@@ -1571,6 +1568,12 @@
#end[!byte]
+#if[char]
+ // The order or null if the buffer does not cover a memory region,
+ // such as StringCharBuffer
+ abstract ByteOrder charRegionOrder();
+#end[char]
+
#if[byte]
boolean bigEndian // package-private
--- a/src/java.base/share/classes/java/nio/file/Files.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/nio/file/Files.java Thu Jan 18 18:58:46 2018 +0000
@@ -2955,22 +2955,6 @@
}
/**
- * Reads all bytes from an input stream and writes them to an output stream.
- */
- private static long copy(InputStream source, OutputStream sink)
- throws IOException
- {
- long nread = 0L;
- byte[] buf = new byte[BUFFER_SIZE];
- int n;
- while ((n = source.read(buf)) > 0) {
- sink.write(buf, 0, n);
- nread += n;
- }
- return nread;
- }
-
- /**
* Copies all bytes from an input stream to a file. On return, the input
* stream will be at end of stream.
*
@@ -3082,7 +3066,7 @@
// do the copy
try (OutputStream out = ostream) {
- return copy(in, out);
+ return in.transferTo(out);
}
}
@@ -3124,7 +3108,7 @@
Objects.requireNonNull(out);
try (InputStream in = newInputStream(source)) {
- return copy(in, out);
+ return in.transferTo(out);
}
}
--- a/src/java.base/share/classes/java/util/ArrayList.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/util/ArrayList.java Thu Jan 18 18:58:46 2018 +0000
@@ -1550,7 +1550,6 @@
setBit(deathRow, i - beg);
if (modCount != expectedModCount)
throw new ConcurrentModificationException();
- expectedModCount++;
modCount++;
int w = beg;
for (i = beg; i < end; i++)
--- a/src/java.base/share/classes/java/util/Arrays.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/util/Arrays.java Thu Jan 18 18:58:46 2018 +0000
@@ -26,6 +26,7 @@
package java.util;
import jdk.internal.HotSpotIntrinsicCandidate;
+import jdk.internal.util.ArraysSupport;
import java.lang.reflect.Array;
import java.util.concurrent.ForkJoinPool;
--- a/src/java.base/share/classes/java/util/ArraysSupport.java Thu Jan 18 09:01:00 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,545 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package java.util;
-
-import jdk.internal.HotSpotIntrinsicCandidate;
-import jdk.internal.misc.Unsafe;
-
-/**
- * Utility methods to find a mismatch between two primitive arrays.
- *
- * <p>Array equality and lexicographical comparison can be built on top of
- * array mismatch functionality.
- *
- * <p>The mismatch method implementation, {@link #vectorizedMismatch}, leverages
- * vector-based techniques to access and compare the contents of two arrays.
- * The Java implementation uses {@code Unsafe.getLongUnaligned} to access the
- * content of an array, thus access is supported on platforms that do not
- * support unaligned access. For a byte[] array, 8 bytes (64 bits) can be
- * accessed and compared as a unit rather than individually, which increases
- * the performance when the method is compiled by the HotSpot VM. On supported
- * platforms the mismatch implementation is intrinsified to leverage SIMD
- * instructions. So for a byte[] array, 16 bytes (128 bits), 32 bytes
- * (256 bits), and perhaps in the future even 64 bytes (512 bits), platform
- * permitting, can be accessed and compared as a unit, which further increases
- * the performance over the Java implementation.
- *
- * <p>None of the mismatch methods perform array bounds checks. It is the
- * responsibility of the caller (direct or otherwise) to perform such checks
- * before calling this method.
- */
-class ArraysSupport {
- static final Unsafe U = Unsafe.getUnsafe();
-
- private static final boolean BIG_ENDIAN = U.isBigEndian();
-
- private static final int LOG2_ARRAY_BOOLEAN_INDEX_SCALE = exactLog2(Unsafe.ARRAY_BOOLEAN_INDEX_SCALE);
- private static final int LOG2_ARRAY_BYTE_INDEX_SCALE = exactLog2(Unsafe.ARRAY_BYTE_INDEX_SCALE);
- private static final int LOG2_ARRAY_CHAR_INDEX_SCALE = exactLog2(Unsafe.ARRAY_CHAR_INDEX_SCALE);
- private static final int LOG2_ARRAY_SHORT_INDEX_SCALE = exactLog2(Unsafe.ARRAY_SHORT_INDEX_SCALE);
- private static final int LOG2_ARRAY_INT_INDEX_SCALE = exactLog2(Unsafe.ARRAY_INT_INDEX_SCALE);
- private static final int LOG2_ARRAY_LONG_INDEX_SCALE = exactLog2(Unsafe.ARRAY_LONG_INDEX_SCALE);
- private static final int LOG2_ARRAY_FLOAT_INDEX_SCALE = exactLog2(Unsafe.ARRAY_FLOAT_INDEX_SCALE);
- private static final int LOG2_ARRAY_DOUBLE_INDEX_SCALE = exactLog2(Unsafe.ARRAY_DOUBLE_INDEX_SCALE);
-
- private static final int LOG2_BYTE_BIT_SIZE = exactLog2(Byte.SIZE);
-
- private static int exactLog2(int scale) {
- if ((scale & (scale - 1)) != 0)
- throw new Error("data type scale not a power of two");
- return Integer.numberOfTrailingZeros(scale);
- }
-
- private ArraysSupport() {}
-
- /**
- * Find the relative index of the first mismatching pair of elements in two
- * primitive arrays of the same component type. Pairs of elements will be
- * tested in order relative to given offsets into both arrays.
- *
- * <p>This method does not perform type checks or bounds checks. It is the
- * responsibility of the caller to perform such checks before calling this
- * method.
- *
- * <p>The given offsets, in bytes, need not be aligned according to the
- * given log<sub>2</sub> size the array elements. More specifically, an
- * offset modulus the size need not be zero.
- *
- * @param a the first array to be tested for mismatch, or {@code null} for
- * direct memory access
- * @param aOffset the relative offset, in bytes, from the base address of
- * the first array to test from, otherwise if the first array is
- * {@code null}, an absolute address pointing to the first element to test.
- * @param b the second array to be tested for mismatch, or {@code null} for
- * direct memory access
- * @param bOffset the relative offset, in bytes, from the base address of
- * the second array to test from, otherwise if the second array is
- * {@code null}, an absolute address pointing to the first element to test.
- * @param length the number of array elements to test
- * @param log2ArrayIndexScale log<sub>2</sub> of the array index scale, that
- * corresponds to the size, in bytes, of an array element.
- * @return if a mismatch is found a relative index, between 0 (inclusive)
- * and {@code length} (exclusive), of the first mismatching pair of elements
- * in the two arrays. Otherwise, if a mismatch is not found the bitwise
- * compliment of the number of remaining pairs of elements to be checked in
- * the tail of the two arrays.
- */
- @HotSpotIntrinsicCandidate
- static int vectorizedMismatch(Object a, long aOffset,
- Object b, long bOffset,
- int length,
- int log2ArrayIndexScale) {
- // assert a.getClass().isArray();
- // assert b.getClass().isArray();
- // assert 0 <= length <= sizeOf(a)
- // assert 0 <= length <= sizeOf(b)
- // assert 0 <= log2ArrayIndexScale <= 3
-
- int log2ValuesPerWidth = LOG2_ARRAY_LONG_INDEX_SCALE - log2ArrayIndexScale;
- int wi = 0;
- for (; wi < length >> log2ValuesPerWidth; wi++) {
- long bi = ((long) wi) << LOG2_ARRAY_LONG_INDEX_SCALE;
- long av = U.getLongUnaligned(a, aOffset + bi);
- long bv = U.getLongUnaligned(b, bOffset + bi);
- if (av != bv) {
- long x = av ^ bv;
- int o = BIG_ENDIAN
- ? Long.numberOfLeadingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale)
- : Long.numberOfTrailingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale);
- return (wi << log2ValuesPerWidth) + o;
- }
- }
-
- // Calculate the tail of remaining elements to check
- int tail = length - (wi << log2ValuesPerWidth);
-
- if (log2ArrayIndexScale < LOG2_ARRAY_INT_INDEX_SCALE) {
- int wordTail = 1 << (LOG2_ARRAY_INT_INDEX_SCALE - log2ArrayIndexScale);
- // Handle 4 bytes or 2 chars in the tail using int width
- if (tail >= wordTail) {
- long bi = ((long) wi) << LOG2_ARRAY_LONG_INDEX_SCALE;
- int av = U.getIntUnaligned(a, aOffset + bi);
- int bv = U.getIntUnaligned(b, bOffset + bi);
- if (av != bv) {
- int x = av ^ bv;
- int o = BIG_ENDIAN
- ? Integer.numberOfLeadingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale)
- : Integer.numberOfTrailingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale);
- return (wi << log2ValuesPerWidth) + o;
- }
- tail -= wordTail;
- }
- return ~tail;
- }
- else {
- return ~tail;
- }
- }
-
- // Booleans
- // Each boolean element takes up one byte
-
- static int mismatch(boolean[] a,
- boolean[] b,
- int length) {
- int i = 0;
- if (length > 7) {
- i = vectorizedMismatch(
- a, Unsafe.ARRAY_BOOLEAN_BASE_OFFSET,
- b, Unsafe.ARRAY_BOOLEAN_BASE_OFFSET,
- length, LOG2_ARRAY_BOOLEAN_INDEX_SCALE);
- if (i >= 0)
- return i;
- i = length - ~i;
- }
- for (; i < length; i++) {
- if (a[i] != b[i])
- return i;
- }
- return -1;
- }
-
- static int mismatch(boolean[] a, int aFromIndex,
- boolean[] b, int bFromIndex,
- int length) {
- int i = 0;
- if (length > 7) {
- int aOffset = Unsafe.ARRAY_BOOLEAN_BASE_OFFSET + aFromIndex;
- int bOffset = Unsafe.ARRAY_BOOLEAN_BASE_OFFSET + bFromIndex;
- i = vectorizedMismatch(
- a, aOffset,
- b, bOffset,
- length, LOG2_ARRAY_BOOLEAN_INDEX_SCALE);
- if (i >= 0)
- return i;
- i = length - ~i;
- }
- for (; i < length; i++) {
- if (a[aFromIndex + i] != b[bFromIndex + i])
- return i;
- }
- return -1;
- }
-
-
- // Bytes
-
- /**
- * Find the index of a mismatch between two arrays.
- *
- * <p>This method does not perform bounds checks. It is the responsibility
- * of the caller to perform such bounds checks before calling this method.
- *
- * @param a the first array to be tested for a mismatch
- * @param b the second array to be tested for a mismatch
- * @param length the number of bytes from each array to check
- * @return the index of a mismatch between the two arrays, otherwise -1 if
- * no mismatch. The index will be within the range of (inclusive) 0 to
- * (exclusive) the smaller of the two array lengths.
- */
- static int mismatch(byte[] a,
- byte[] b,
- int length) {
- // ISSUE: defer to index receiving methods if performance is good
- // assert length <= a.length
- // assert length <= b.length
-
- int i = 0;
- if (length > 7) {
- i = vectorizedMismatch(
- a, Unsafe.ARRAY_BYTE_BASE_OFFSET,
- b, Unsafe.ARRAY_BYTE_BASE_OFFSET,
- length, LOG2_ARRAY_BYTE_INDEX_SCALE);
- if (i >= 0)
- return i;
- // Align to tail
- i = length - ~i;
-// assert i >= 0 && i <= 7;
- }
- // Tail < 8 bytes
- for (; i < length; i++) {
- if (a[i] != b[i])
- return i;
- }
- return -1;
- }
-
- /**
- * Find the relative index of a mismatch between two arrays starting from
- * given indexes.
- *
- * <p>This method does not perform bounds checks. It is the responsibility
- * of the caller to perform such bounds checks before calling this method.
- *
- * @param a the first array to be tested for a mismatch
- * @param aFromIndex the index of the first element (inclusive) in the first
- * array to be compared
- * @param b the second array to be tested for a mismatch
- * @param bFromIndex the index of the first element (inclusive) in the
- * second array to be compared
- * @param length the number of bytes from each array to check
- * @return the relative index of a mismatch between the two arrays,
- * otherwise -1 if no mismatch. The index will be within the range of
- * (inclusive) 0 to (exclusive) the smaller of the two array bounds.
- */
- static int mismatch(byte[] a, int aFromIndex,
- byte[] b, int bFromIndex,
- int length) {
- // assert 0 <= aFromIndex < a.length
- // assert 0 <= aFromIndex + length <= a.length
- // assert 0 <= bFromIndex < b.length
- // assert 0 <= bFromIndex + length <= b.length
- // assert length >= 0
-
- int i = 0;
- if (length > 7) {
- int aOffset = Unsafe.ARRAY_BYTE_BASE_OFFSET + aFromIndex;
- int bOffset = Unsafe.ARRAY_BYTE_BASE_OFFSET + bFromIndex;
- i = vectorizedMismatch(
- a, aOffset,
- b, bOffset,
- length, LOG2_ARRAY_BYTE_INDEX_SCALE);
- if (i >= 0)
- return i;
- i = length - ~i;
- }
- for (; i < length; i++) {
- if (a[aFromIndex + i] != b[bFromIndex + i])
- return i;
- }
- return -1;
- }
-
-
- // Chars
-
- static int mismatch(char[] a,
- char[] b,
- int length) {
- int i = 0;
- if (length > 3) {
- i = vectorizedMismatch(
- a, Unsafe.ARRAY_CHAR_BASE_OFFSET,
- b, Unsafe.ARRAY_CHAR_BASE_OFFSET,
- length, LOG2_ARRAY_CHAR_INDEX_SCALE);
- if (i >= 0)
- return i;
- i = length - ~i;
- }
- for (; i < length; i++) {
- if (a[i] != b[i])
- return i;
- }
- return -1;
- }
-
- static int mismatch(char[] a, int aFromIndex,
- char[] b, int bFromIndex,
- int length) {
- int i = 0;
- if (length > 3) {
- int aOffset = Unsafe.ARRAY_CHAR_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_CHAR_INDEX_SCALE);
- int bOffset = Unsafe.ARRAY_CHAR_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_CHAR_INDEX_SCALE);
- i = vectorizedMismatch(
- a, aOffset,
- b, bOffset,
- length, LOG2_ARRAY_CHAR_INDEX_SCALE);
- if (i >= 0)
- return i;
- i = length - ~i;
- }
- for (; i < length; i++) {
- if (a[aFromIndex + i] != b[bFromIndex + i])
- return i;
- }
- return -1;
- }
-
-
- // Shorts
-
- static int mismatch(short[] a,
- short[] b,
- int length) {
- int i = 0;
- if (length > 3) {
- i = vectorizedMismatch(
- a, Unsafe.ARRAY_SHORT_BASE_OFFSET,
- b, Unsafe.ARRAY_SHORT_BASE_OFFSET,
- length, LOG2_ARRAY_SHORT_INDEX_SCALE);
- if (i >= 0)
- return i;
- i = length - ~i;
- }
- for (; i < length; i++) {
- if (a[i] != b[i])
- return i;
- }
- return -1;
- }
-
- static int mismatch(short[] a, int aFromIndex,
- short[] b, int bFromIndex,
- int length) {
- int i = 0;
- if (length > 3) {
- int aOffset = Unsafe.ARRAY_SHORT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_SHORT_INDEX_SCALE);
- int bOffset = Unsafe.ARRAY_SHORT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_SHORT_INDEX_SCALE);
- i = vectorizedMismatch(
- a, aOffset,
- b, bOffset,
- length, LOG2_ARRAY_SHORT_INDEX_SCALE);
- if (i >= 0)
- return i;
- i = length - ~i;
- }
- for (; i < length; i++) {
- if (a[aFromIndex + i] != b[bFromIndex + i])
- return i;
- }
- return -1;
- }
-
-
- // Ints
-
- static int mismatch(int[] a,
- int[] b,
- int length) {
- int i = 0;
- if (length > 1) {
- i = vectorizedMismatch(
- a, Unsafe.ARRAY_INT_BASE_OFFSET,
- b, Unsafe.ARRAY_INT_BASE_OFFSET,
- length, LOG2_ARRAY_INT_INDEX_SCALE);
- if (i >= 0)
- return i;
- i = length - ~i;
- }
- for (; i < length; i++) {
- if (a[i] != b[i])
- return i;
- }
- return -1;
- }
-
- static int mismatch(int[] a, int aFromIndex,
- int[] b, int bFromIndex,
- int length) {
- int i = 0;
- if (length > 1) {
- int aOffset = Unsafe.ARRAY_INT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_INT_INDEX_SCALE);
- int bOffset = Unsafe.ARRAY_INT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_INT_INDEX_SCALE);
- i = vectorizedMismatch(
- a, aOffset,
- b, bOffset,
- length, LOG2_ARRAY_INT_INDEX_SCALE);
- if (i >= 0)
- return i;
- i = length - ~i;
- }
- for (; i < length; i++) {
- if (a[aFromIndex + i] != b[bFromIndex + i])
- return i;
- }
- return -1;
- }
-
-
- // Floats
-
- static int mismatch(float[] a,
- float[] b,
- int length) {
- return mismatch(a, 0, b, 0, length);
- }
-
- static int mismatch(float[] a, int aFromIndex,
- float[] b, int bFromIndex,
- int length) {
- int i = 0;
- if (length > 1) {
- int aOffset = Unsafe.ARRAY_FLOAT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_FLOAT_INDEX_SCALE);
- int bOffset = Unsafe.ARRAY_FLOAT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_FLOAT_INDEX_SCALE);
- i = vectorizedMismatch(
- a, aOffset,
- b, bOffset,
- length, LOG2_ARRAY_FLOAT_INDEX_SCALE);
- // Mismatched
- if (i >= 0) {
- // Check if mismatch is not associated with two NaN values
- if (!Float.isNaN(a[aFromIndex + i]) || !Float.isNaN(b[bFromIndex + i]))
- return i;
-
- // Mismatch on two different NaN values that are normalized to match
- // Fall back to slow mechanism
- // ISSUE: Consider looping over vectorizedMismatch adjusting ranges
- // However, requires that returned value be relative to input ranges
- i++;
- }
- // Matched
- else {
- i = length - ~i;
- }
- }
- for (; i < length; i++) {
- if (Float.floatToIntBits(a[aFromIndex + i]) != Float.floatToIntBits(b[bFromIndex + i]))
- return i;
- }
- return -1;
- }
-
- // 64 bit sizes
-
- // Long
-
- static int mismatch(long[] a,
- long[] b,
- int length) {
- if (length == 0) {
- return -1;
- }
- int i = vectorizedMismatch(
- a, Unsafe.ARRAY_LONG_BASE_OFFSET,
- b, Unsafe.ARRAY_LONG_BASE_OFFSET,
- length, LOG2_ARRAY_LONG_INDEX_SCALE);
- return i >= 0 ? i : -1;
- }
-
- static int mismatch(long[] a, int aFromIndex,
- long[] b, int bFromIndex,
- int length) {
- if (length == 0) {
- return -1;
- }
- int aOffset = Unsafe.ARRAY_LONG_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_LONG_INDEX_SCALE);
- int bOffset = Unsafe.ARRAY_LONG_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_LONG_INDEX_SCALE);
- int i = vectorizedMismatch(
- a, aOffset,
- b, bOffset,
- length, LOG2_ARRAY_LONG_INDEX_SCALE);
- return i >= 0 ? i : -1;
- }
-
-
- // Double
-
- static int mismatch(double[] a,
- double[] b,
- int length) {
- return mismatch(a, 0, b, 0, length);
- }
-
- static int mismatch(double[] a, int aFromIndex,
- double[] b, int bFromIndex,
- int length) {
- if (length == 0) {
- return -1;
- }
- int aOffset = Unsafe.ARRAY_DOUBLE_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_DOUBLE_INDEX_SCALE);
- int bOffset = Unsafe.ARRAY_DOUBLE_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_DOUBLE_INDEX_SCALE);
- int i = vectorizedMismatch(
- a, aOffset,
- b, bOffset,
- length, LOG2_ARRAY_DOUBLE_INDEX_SCALE);
- if (i >= 0) {
- // Check if mismatch is not associated with two NaN values
- if (!Double.isNaN(a[aFromIndex + i]) || !Double.isNaN(b[bFromIndex + i]))
- return i;
-
- // Mismatch on two different NaN values that are normalized to match
- // Fall back to slow mechanism
- // ISSUE: Consider looping over vectorizedMismatch adjusting ranges
- // However, requires that returned value be relative to input ranges
- i++;
- for (; i < length; i++) {
- if (Double.doubleToLongBits(a[aFromIndex + i]) != Double.doubleToLongBits(b[bFromIndex + i]))
- return i;
- }
- }
-
- return -1;
- }
-}
--- a/src/java.base/share/classes/java/util/Vector.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/util/Vector.java Thu Jan 18 18:58:46 2018 +0000
@@ -1023,7 +1023,6 @@
setBit(deathRow, i - beg);
if (modCount != expectedModCount)
throw new ConcurrentModificationException();
- expectedModCount++;
modCount++;
int w = beg;
for (i = beg; i < end; i++)
--- a/src/java.base/share/classes/java/util/concurrent/AbstractExecutorService.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/util/concurrent/AbstractExecutorService.java Thu Jan 18 18:58:46 2018 +0000
@@ -245,8 +245,7 @@
Future<T> f = futures.get(i);
if (!f.isDone()) {
try { f.get(); }
- catch (CancellationException ignore) {}
- catch (ExecutionException ignore) {}
+ catch (CancellationException | ExecutionException ignore) {}
}
}
return futures;
@@ -283,8 +282,7 @@
Future<T> f = futures.get(j);
if (!f.isDone()) {
try { f.get(deadline - System.nanoTime(), NANOSECONDS); }
- catch (CancellationException ignore) {}
- catch (ExecutionException ignore) {}
+ catch (CancellationException | ExecutionException ignore) {}
catch (TimeoutException timedOut) {
break timedOut;
}
--- a/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java Thu Jan 18 18:58:46 2018 +0000
@@ -717,12 +717,12 @@
*/
static Class<?> comparableClassFor(Object x) {
if (x instanceof Comparable) {
- Class<?> c; Type[] ts, as; Type t; ParameterizedType p;
+ Class<?> c; Type[] ts, as; ParameterizedType p;
if ((c = x.getClass()) == String.class) // bypass checks
return c;
if ((ts = c.getGenericInterfaces()) != null) {
- for (int i = 0; i < ts.length; ++i) {
- if (((t = ts[i]) instanceof ParameterizedType) &&
+ for (Type t : ts) {
+ if ((t instanceof ParameterizedType) &&
((p = (ParameterizedType)t).getRawType() ==
Comparable.class) &&
(as = p.getActualTypeArguments()) != null &&
@@ -2328,15 +2328,15 @@
* @param check if <0, don't check resize, if <= 1 only check if uncontended
*/
private final void addCount(long x, int check) {
- CounterCell[] as; long b, s;
- if ((as = counterCells) != null ||
+ CounterCell[] cs; long b, s;
+ if ((cs = counterCells) != null ||
!U.compareAndSetLong(this, BASECOUNT, b = baseCount, s = b + x)) {
- CounterCell a; long v; int m;
+ CounterCell c; long v; int m;
boolean uncontended = true;
- if (as == null || (m = as.length - 1) < 0 ||
- (a = as[ThreadLocalRandom.getProbe() & m]) == null ||
+ if (cs == null || (m = cs.length - 1) < 0 ||
+ (c = cs[ThreadLocalRandom.getProbe() & m]) == null ||
!(uncontended =
- U.compareAndSetLong(a, CELLVALUE, v = a.value, v + x))) {
+ U.compareAndSetLong(c, CELLVALUE, v = c.value, v + x))) {
fullAddCount(x, uncontended);
return;
}
@@ -2574,13 +2574,12 @@
}
final long sumCount() {
- CounterCell[] as = counterCells; CounterCell a;
+ CounterCell[] cs = counterCells;
long sum = baseCount;
- if (as != null) {
- for (int i = 0; i < as.length; ++i) {
- if ((a = as[i]) != null)
- sum += a.value;
- }
+ if (cs != null) {
+ for (CounterCell c : cs)
+ if (c != null)
+ sum += c.value;
}
return sum;
}
@@ -2595,9 +2594,9 @@
}
boolean collide = false; // True if last slot nonempty
for (;;) {
- CounterCell[] as; CounterCell a; int n; long v;
- if ((as = counterCells) != null && (n = as.length) > 0) {
- if ((a = as[(n - 1) & h]) == null) {
+ CounterCell[] cs; CounterCell c; int n; long v;
+ if ((cs = counterCells) != null && (n = cs.length) > 0) {
+ if ((c = cs[(n - 1) & h]) == null) {
if (cellsBusy == 0) { // Try to attach new Cell
CounterCell r = new CounterCell(x); // Optimistic create
if (cellsBusy == 0 &&
@@ -2623,21 +2622,17 @@
}
else if (!wasUncontended) // CAS already known to fail
wasUncontended = true; // Continue after rehash
- else if (U.compareAndSetLong(a, CELLVALUE, v = a.value, v + x))
+ else if (U.compareAndSetLong(c, CELLVALUE, v = c.value, v + x))
break;
- else if (counterCells != as || n >= NCPU)
+ else if (counterCells != cs || n >= NCPU)
collide = false; // At max size or stale
else if (!collide)
collide = true;
else if (cellsBusy == 0 &&
U.compareAndSetInt(this, CELLSBUSY, 0, 1)) {
try {
- if (counterCells == as) {// Expand table unless stale
- CounterCell[] rs = new CounterCell[n << 1];
- for (int i = 0; i < n; ++i)
- rs[i] = as[i];
- counterCells = rs;
- }
+ if (counterCells == cs) // Expand table unless stale
+ counterCells = Arrays.copyOf(cs, n << 1);
} finally {
cellsBusy = 0;
}
@@ -2646,11 +2641,11 @@
}
h = ThreadLocalRandom.advanceProbe(h);
}
- else if (cellsBusy == 0 && counterCells == as &&
+ else if (cellsBusy == 0 && counterCells == cs &&
U.compareAndSetInt(this, CELLSBUSY, 0, 1)) {
boolean init = false;
try { // Initialize table
- if (counterCells == as) {
+ if (counterCells == cs) {
CounterCell[] rs = new CounterCell[2];
rs[h & 1] = new CounterCell(x);
counterCells = rs;
--- a/src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListMap.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListMap.java Thu Jan 18 18:58:46 2018 +0000
@@ -2204,9 +2204,7 @@
Collection<?> c = (Collection<?>) o;
try {
return containsAll(c) && c.containsAll(this);
- } catch (ClassCastException unused) {
- return false;
- } catch (NullPointerException unused) {
+ } catch (ClassCastException | NullPointerException unused) {
return false;
}
}
@@ -2331,9 +2329,7 @@
Collection<?> c = (Collection<?>) o;
try {
return containsAll(c) && c.containsAll(this);
- } catch (ClassCastException unused) {
- return false;
- } catch (NullPointerException unused) {
+ } catch (ClassCastException | NullPointerException unused) {
return false;
}
}
@@ -2453,9 +2449,7 @@
if (k == null) // pass by markers and headers
return true;
int c = cpr(cmp, k, hi);
- if (c > 0 || (c == 0 && !hiInclusive))
- return false;
- return true;
+ return c < 0 || (c == 0 && hiInclusive);
}
/**
--- a/src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListSet.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListSet.java Thu Jan 18 18:58:46 2018 +0000
@@ -309,9 +309,7 @@
Collection<?> c = (Collection<?>) o;
try {
return containsAll(c) && c.containsAll(this);
- } catch (ClassCastException unused) {
- return false;
- } catch (NullPointerException unused) {
+ } catch (ClassCastException | NullPointerException unused) {
return false;
}
}
--- a/src/java.base/share/classes/java/util/concurrent/CopyOnWriteArrayList.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/util/concurrent/CopyOnWriteArrayList.java Thu Jan 18 18:58:46 2018 +0000
@@ -508,7 +508,7 @@
public boolean remove(Object o) {
Object[] snapshot = getArray();
int index = indexOf(o, snapshot, 0, snapshot.length);
- return (index < 0) ? false : remove(o, snapshot, index);
+ return index >= 0 && remove(o, snapshot, index);
}
/**
@@ -587,8 +587,8 @@
*/
public boolean addIfAbsent(E e) {
Object[] snapshot = getArray();
- return indexOf(e, snapshot, 0, snapshot.length) >= 0 ? false :
- addIfAbsent(e, snapshot);
+ return indexOf(e, snapshot, 0, snapshot.length) < 0
+ && addIfAbsent(e, snapshot);
}
/**
@@ -980,13 +980,10 @@
List<?> list = (List<?>)o;
Iterator<?> it = list.iterator();
- Object[] elements = getArray();
- for (int i = 0, len = elements.length; i < len; i++)
- if (!it.hasNext() || !Objects.equals(elements[i], it.next()))
+ for (Object element : getArray())
+ if (!it.hasNext() || !Objects.equals(element, it.next()))
return false;
- if (it.hasNext())
- return false;
- return true;
+ return !it.hasNext();
}
/**
--- a/src/java.base/share/classes/java/util/concurrent/LinkedBlockingDeque.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/util/concurrent/LinkedBlockingDeque.java Thu Jan 18 18:58:46 2018 +0000
@@ -1353,17 +1353,16 @@
@SuppressWarnings("unchecked")
private boolean bulkRemove(Predicate<? super E> filter) {
boolean removed = false;
+ final ReentrantLock lock = this.lock;
Node<E> p = null;
- final ReentrantLock lock = this.lock;
Node<E>[] nodes = null;
int n, len = 0;
do {
// 1. Extract batch of up to 64 elements while holding the lock.
- long deathRow = 0; // "bitset" of size 64
lock.lock();
try {
- if (nodes == null) {
- if (p == null) p = first;
+ if (nodes == null) { // first batch; initialize
+ p = first;
for (Node<E> q = p; q != null; q = succ(q))
if (q.item != null && ++len == 64)
break;
@@ -1376,6 +1375,7 @@
}
// 2. Run the filter on the elements while lock is free.
+ long deathRow = 0L; // "bitset" of size 64
for (int i = 0; i < n; i++) {
final E e;
if ((e = nodes[i].item) != null && filter.test(e))
@@ -1393,6 +1393,7 @@
unlink(q);
removed = true;
}
+ nodes[i] = null; // help GC
}
} finally {
lock.unlock();
--- a/src/java.base/share/classes/java/util/concurrent/LinkedBlockingQueue.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/util/concurrent/LinkedBlockingQueue.java Thu Jan 18 18:58:46 2018 +0000
@@ -1060,11 +1060,10 @@
int n, len = 0;
do {
// 1. Extract batch of up to 64 elements while holding the lock.
- long deathRow = 0; // "bitset" of size 64
fullyLock();
try {
- if (nodes == null) {
- if (p == null) p = head.next;
+ if (nodes == null) { // first batch; initialize
+ p = head.next;
for (Node<E> q = p; q != null; q = succ(q))
if (q.item != null && ++len == 64)
break;
@@ -1077,6 +1076,7 @@
}
// 2. Run the filter on the elements while lock is free.
+ long deathRow = 0L; // "bitset" of size 64
for (int i = 0; i < n; i++) {
final E e;
if ((e = nodes[i].item) != null && filter.test(e))
@@ -1095,6 +1095,7 @@
unlink(q, ancestor);
removed = true;
}
+ nodes[i] = null; // help GC
}
} finally {
fullyUnlock();
--- a/src/java.base/share/classes/java/util/concurrent/LinkedTransferQueue.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/util/concurrent/LinkedTransferQueue.java Thu Jan 18 18:58:46 2018 +0000
@@ -772,9 +772,8 @@
Node first = null;
restartFromHead: for (;;) {
Node h = head, p = h;
- for (; p != null;) {
- final Object item;
- if ((item = p.item) != null) {
+ while (p != null) {
+ if (p.item != null) {
if (p.isData) {
first = p;
break;
@@ -1602,8 +1601,7 @@
// Read in elements until trailing null sentinel found
Node h = null, t = null;
for (Object item; (item = s.readObject()) != null; ) {
- @SuppressWarnings("unchecked")
- Node newNode = new Node((E) item);
+ Node newNode = new Node(item);
if (h == null)
h = t = newNode;
else
--- a/src/java.base/share/classes/java/util/concurrent/PriorityBlockingQueue.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/util/concurrent/PriorityBlockingQueue.java Thu Jan 18 18:58:46 2018 +0000
@@ -269,8 +269,8 @@
if (a.getClass() != Object[].class)
a = Arrays.copyOf(a, n, Object[].class);
if (screen && (n == 1 || this.comparator != null)) {
- for (int i = 0; i < n; ++i)
- if (a[i] == null)
+ for (Object elt : a)
+ if (elt == null)
throw new NullPointerException();
}
this.queue = a;
--- a/src/java.base/share/classes/java/util/concurrent/SubmissionPublisher.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/util/concurrent/SubmissionPublisher.java Thu Jan 18 18:58:46 2018 +0000
@@ -753,8 +753,10 @@
else
pred.next = next;
}
- else
+ else {
subs.add(b.subscriber);
+ pred = b;
+ }
}
}
return subs;
--- a/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java Thu Jan 18 18:58:46 2018 +0000
@@ -67,7 +67,7 @@
* {@code ThreadLocalRandom.current().nextX(...)} (where
* {@code X} is {@code Int}, {@code Long}, etc).
* When all usages are of this form, it is never possible to
- * accidently share a {@code ThreadLocalRandom} across multiple threads.
+ * accidentally share a {@code ThreadLocalRandom} across multiple threads.
*
* <p>This class also provides additional commonly used bounded random
* generation methods.
--- a/src/java.base/share/classes/java/util/concurrent/ThreadPoolExecutor.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/util/concurrent/ThreadPoolExecutor.java Thu Jan 18 18:58:46 2018 +0000
@@ -264,13 +264,12 @@
* assist in storage reclamation when large numbers of queued tasks
* become cancelled.</dd>
*
- * <dt>Finalization</dt>
+ * <dt>Reclamation</dt>
*
* <dd>A pool that is no longer referenced in a program <em>AND</em>
- * has no remaining threads will be {@code shutdown} automatically. If
- * you would like to ensure that unreferenced pools are reclaimed even
- * if users forget to call {@link #shutdown}, then you must arrange
- * that unused threads eventually die, by setting appropriate
+ * has no remaining threads may be reclaimed (garbage collected)
+ * without being explicity shutdown. You can configure a pool to allow
+ * all unused threads to eventually die by setting appropriate
* keep-alive times, using a lower bound of zero core threads and/or
* setting {@link #allowCoreThreadTimeOut(boolean)}. </dd>
*
@@ -361,7 +360,7 @@
* time, but need not hit each state. The transitions are:
*
* RUNNING -> SHUTDOWN
- * On invocation of shutdown(), perhaps implicitly in finalize()
+ * On invocation of shutdown()
* (RUNNING or SHUTDOWN) -> STOP
* On invocation of shutdownNow()
* SHUTDOWN -> TIDYING
@@ -581,9 +580,6 @@
private static final RuntimePermission shutdownPerm =
new RuntimePermission("modifyThread");
- /** The context to be used when executing the finalizer, or null. */
- private final AccessControlContext acc;
-
/**
* Class Worker mainly maintains interrupt control state for
* threads running tasks, along with other minor bookkeeping.
@@ -1300,9 +1296,6 @@
throw new IllegalArgumentException();
if (workQueue == null || threadFactory == null || handler == null)
throw new NullPointerException();
- this.acc = (System.getSecurityManager() == null)
- ? null
- : AccessController.getContext();
this.corePoolSize = corePoolSize;
this.maximumPoolSize = maximumPoolSize;
this.workQueue = workQueue;
@@ -1470,33 +1463,6 @@
}
/**
- * Invokes {@code shutdown} when this executor is no longer
- * referenced and it has no threads.
- *
- * <p>This method is invoked with privileges that are restricted by
- * the security context of the caller that invokes the constructor.
- *
- * @deprecated The {@code finalize} method has been deprecated.
- * Subclasses that override {@code finalize} in order to perform cleanup
- * should be modified to use alternative cleanup mechanisms and
- * to remove the overriding {@code finalize} method.
- * When overriding the {@code finalize} method, its implementation must explicitly
- * ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
- * See the specification for {@link Object#finalize()} for further
- * information about migration options.
- */
- @Deprecated(since="9")
- protected void finalize() {
- SecurityManager sm = System.getSecurityManager();
- if (sm == null || acc == null) {
- shutdown();
- } else {
- PrivilegedAction<Void> pa = () -> { shutdown(); return null; };
- AccessController.doPrivileged(pa, acc);
- }
- }
-
- /**
* Sets the thread factory used to create new threads.
*
* @param threadFactory the new thread factory
--- a/src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java Thu Jan 18 18:58:46 2018 +0000
@@ -320,7 +320,9 @@
// predNext is the apparent node to unsplice. CASes below will
// fail if not, in which case, we lost race vs another cancel
- // or signal, so no further action is necessary.
+ // or signal, so no further action is necessary, although with
+ // a possibility that a cancelled node may transiently remain
+ // reachable.
Node predNext = pred.next;
// Can use unconditional write instead of CAS here.
@@ -912,13 +914,13 @@
* at any time, a {@code true} return does not guarantee that any
* other thread will ever acquire.
*
- * <p>In this implementation, this operation returns in
- * constant time.
- *
* @return {@code true} if there may be other threads waiting to acquire
*/
public final boolean hasQueuedThreads() {
- return head != tail;
+ for (Node p = tail, h = head; p != h && p != null; p = p.prev)
+ if (p.waitStatus <= 0)
+ return true;
+ return false;
}
/**
@@ -1067,17 +1069,21 @@
* @since 1.7
*/
public final boolean hasQueuedPredecessors() {
- // The correctness of this depends on head being initialized
- // before tail and on head.next being accurate if the current
- // thread is first in queue.
- Node t = tail; // Read fields in reverse initialization order
- Node h = head;
- Node s;
- return h != t &&
- ((s = h.next) == null || s.thread != Thread.currentThread());
+ Node h, s;
+ if ((h = head) != null) {
+ if ((s = h.next) == null || s.waitStatus > 0) {
+ s = null; // traverse in case of concurrent cancellation
+ for (Node p = tail; p != h && p != null; p = p.prev) {
+ if (p.waitStatus <= 0)
+ s = p;
+ }
+ }
+ if (s != null && s.thread != Thread.currentThread())
+ return true;
+ }
+ return false;
}
-
// Instrumentation and monitoring methods
/**
--- a/src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java Thu Jan 18 18:58:46 2018 +0000
@@ -800,7 +800,9 @@
// predNext is the apparent node to unsplice. CASes below will
// fail if not, in which case, we lost race vs another cancel
- // or signal, so no further action is necessary.
+ // or signal, so no further action is necessary, although with
+ // a possibility that a cancelled node may transiently remain
+ // reachable.
Node predNext = pred.next;
// Can use unconditional write instead of CAS here.
@@ -1392,13 +1394,13 @@
* at any time, a {@code true} return does not guarantee that any
* other thread will ever acquire.
*
- * <p>In this implementation, this operation returns in
- * constant time.
- *
* @return {@code true} if there may be other threads waiting to acquire
*/
public final boolean hasQueuedThreads() {
- return head != tail;
+ for (Node p = tail, h = head; p != h && p != null; p = p.prev)
+ if (p.waitStatus <= 0)
+ return true;
+ return false;
}
/**
@@ -1547,17 +1549,21 @@
* @since 1.7
*/
public final boolean hasQueuedPredecessors() {
- // The correctness of this depends on head being initialized
- // before tail and on head.next being accurate if the current
- // thread is first in queue.
- Node t = tail; // Read fields in reverse initialization order
- Node h = head;
- Node s;
- return h != t &&
- ((s = h.next) == null || s.thread != Thread.currentThread());
+ Node h, s;
+ if ((h = head) != null) {
+ if ((s = h.next) == null || s.waitStatus > 0) {
+ s = null; // traverse in case of concurrent cancellation
+ for (Node p = tail; p != h && p != null; p = p.prev) {
+ if (p.waitStatus <= 0)
+ s = p;
+ }
+ }
+ if (s != null && s.thread != Thread.currentThread())
+ return true;
+ }
+ return false;
}
-
// Instrumentation and monitoring methods
/**
--- a/src/java.base/share/classes/java/util/regex/Pattern.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/java/util/regex/Pattern.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -954,6 +954,12 @@
private int flags;
/**
+ * The temporary pattern flags used during compiling. The flags might be turn
+ * on and off by embedded flag.
+ */
+ private transient int flags0;
+
+ /**
* Boolean indicating this Pattern is compiled; this is necessary in order
* to lazily compile deserialized Patterns.
*/
@@ -1137,7 +1143,7 @@
* @return The match flags specified when this pattern was compiled
*/
public int flags() {
- return flags;
+ return flags0;
}
/**
@@ -1369,6 +1375,9 @@
// Read in all fields
s.defaultReadObject();
+ // reset the flags
+ flags0 = flags;
+
// Initialize counts
capturingGroupCount = 1;
localCount = 0;
@@ -1400,6 +1409,9 @@
if ((flags & UNICODE_CHARACTER_CLASS) != 0)
flags |= UNICODE_CASE;
+ // 'flags' for compiling
+ flags0 = flags;
+
// Reset group index count
capturingGroupCount = 1;
localCount = 0;
@@ -1841,7 +1853,7 @@
* Indicates whether a particular flag is set or not.
*/
private boolean has(int f) {
- return (flags & f) != 0;
+ return (flags0 & f) != 0;
}
/**
@@ -2718,7 +2730,7 @@
ch == 0x53 || ch == 0x73 || //S and s
ch == 0x4b || ch == 0x6b || //K and k
ch == 0xc5 || ch == 0xe5))) { //A+ring
- bits.add(ch, flags());
+ bits.add(ch, flags0);
return null;
}
return single(ch);
@@ -2931,7 +2943,7 @@
boolean capturingGroup = false;
Node head = null;
Node tail = null;
- int save = flags;
+ int save = flags0;
int saveTCNCount = topClosureNodes.size();
root = null;
int ch = next();
@@ -3032,7 +3044,7 @@
}
accept(')', "Unclosed group");
- flags = save;
+ flags0 = save;
// Check for quantifiers
Node node = closure(head);
@@ -3135,28 +3147,28 @@
for (;;) {
switch (ch) {
case 'i':
- flags |= CASE_INSENSITIVE;
+ flags0 |= CASE_INSENSITIVE;
break;
case 'm':
- flags |= MULTILINE;
+ flags0 |= MULTILINE;
break;
case 's':
- flags |= DOTALL;
+ flags0 |= DOTALL;
break;
case 'd':
- flags |= UNIX_LINES;
+ flags0 |= UNIX_LINES;
break;
case 'u':
- flags |= UNICODE_CASE;
+ flags0 |= UNICODE_CASE;
break;
case 'c':
- flags |= CANON_EQ;
+ flags0 |= CANON_EQ;
break;
case 'x':
- flags |= COMMENTS;
+ flags0 |= COMMENTS;
break;
case 'U':
- flags |= (UNICODE_CHARACTER_CLASS | UNICODE_CASE);
+ flags0 |= (UNICODE_CHARACTER_CLASS | UNICODE_CASE);
break;
case '-': // subFlag then fall through
ch = next();
@@ -3178,28 +3190,28 @@
for (;;) {
switch (ch) {
case 'i':
- flags &= ~CASE_INSENSITIVE;
+ flags0 &= ~CASE_INSENSITIVE;
break;
case 'm':
- flags &= ~MULTILINE;
+ flags0 &= ~MULTILINE;
break;
case 's':
- flags &= ~DOTALL;
+ flags0 &= ~DOTALL;
break;
case 'd':
- flags &= ~UNIX_LINES;
+ flags0 &= ~UNIX_LINES;
break;
case 'u':
- flags &= ~UNICODE_CASE;
+ flags0 &= ~UNICODE_CASE;
break;
case 'c':
- flags &= ~CANON_EQ;
+ flags0 &= ~CANON_EQ;
break;
case 'x':
- flags &= ~COMMENTS;
+ flags0 &= ~COMMENTS;
break;
case 'U':
- flags &= ~(UNICODE_CHARACTER_CLASS | UNICODE_CASE);
+ flags0 &= ~(UNICODE_CHARACTER_CLASS | UNICODE_CASE);
break;
default:
return;
--- a/src/java.base/share/classes/jdk/internal/module/ModuleInfo.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/jdk/internal/module/ModuleInfo.java Thu Jan 18 18:58:46 2018 +0000
@@ -64,7 +64,7 @@
public final class ModuleInfo {
private final int JAVA_MIN_SUPPORTED_VERSION = 53;
- private final int JAVA_MAX_SUPPORTED_VERSION = 54;
+ private final int JAVA_MAX_SUPPORTED_VERSION = 55;
private static final JavaLangModuleAccess JLMA
= SharedSecrets.getJavaLangModuleAccess();
--- a/src/java.base/share/classes/jdk/internal/org/objectweb/asm/ClassReader.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/jdk/internal/org/objectweb/asm/ClassReader.java Thu Jan 18 18:58:46 2018 +0000
@@ -185,7 +185,7 @@
public ClassReader(final byte[] b, final int off, final int len) {
this.b = b;
// checks the class version
- if (readShort(off + 6) > Opcodes.V10) {
+ if (readShort(off + 6) > Opcodes.V11) {
throw new IllegalArgumentException();
}
// parses the constant pool
--- a/src/java.base/share/classes/jdk/internal/org/objectweb/asm/Opcodes.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/jdk/internal/org/objectweb/asm/Opcodes.java Thu Jan 18 18:58:46 2018 +0000
@@ -90,6 +90,7 @@
int V1_8 = 0 << 16 | 52;
int V9 = 0 << 16 | 53;
int V10 = 0 << 16 | 54;
+ int V11 = 0 << 16 | 55;
// access flags
--- a/src/java.base/share/classes/jdk/internal/reflect/Reflection.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/jdk/internal/reflect/Reflection.java Thu Jan 18 18:58:46 2018 +0000
@@ -64,14 +64,6 @@
@HotSpotIntrinsicCandidate
public static native Class<?> getCallerClass();
- /**
- * @deprecated This method will be removed.
- * This method is a private JDK API and retained temporarily to
- * simplify the implementation of sun.misc.Reflection.getCallerClass.
- */
- @Deprecated(forRemoval=true)
- public static native Class<?> getCallerClass(int depth);
-
/** Retrieves the access flags written to the class file. For
inner classes these flags may differ from those returned by
Class.getModifiers(), which searches the InnerClasses
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/util/ArraysSupport.java Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,545 @@
+/*
+ * Copyright (c) 2015, 2017 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.internal.util;
+
+import jdk.internal.HotSpotIntrinsicCandidate;
+import jdk.internal.misc.Unsafe;
+
+/**
+ * Utility methods to find a mismatch between two primitive arrays.
+ *
+ * <p>Array equality and lexicographical comparison can be built on top of
+ * array mismatch functionality.
+ *
+ * <p>The mismatch method implementation, {@link #vectorizedMismatch}, leverages
+ * vector-based techniques to access and compare the contents of two arrays.
+ * The Java implementation uses {@code Unsafe.getLongUnaligned} to access the
+ * content of an array, thus access is supported on platforms that do not
+ * support unaligned access. For a byte[] array, 8 bytes (64 bits) can be
+ * accessed and compared as a unit rather than individually, which increases
+ * the performance when the method is compiled by the HotSpot VM. On supported
+ * platforms the mismatch implementation is intrinsified to leverage SIMD
+ * instructions. So for a byte[] array, 16 bytes (128 bits), 32 bytes
+ * (256 bits), and perhaps in the future even 64 bytes (512 bits), platform
+ * permitting, can be accessed and compared as a unit, which further increases
+ * the performance over the Java implementation.
+ *
+ * <p>None of the mismatch methods perform array bounds checks. It is the
+ * responsibility of the caller (direct or otherwise) to perform such checks
+ * before calling this method.
+ */
+public class ArraysSupport {
+ static final Unsafe U = Unsafe.getUnsafe();
+
+ private static final boolean BIG_ENDIAN = U.isBigEndian();
+
+ public static final int LOG2_ARRAY_BOOLEAN_INDEX_SCALE = exactLog2(Unsafe.ARRAY_BOOLEAN_INDEX_SCALE);
+ public static final int LOG2_ARRAY_BYTE_INDEX_SCALE = exactLog2(Unsafe.ARRAY_BYTE_INDEX_SCALE);
+ public static final int LOG2_ARRAY_CHAR_INDEX_SCALE = exactLog2(Unsafe.ARRAY_CHAR_INDEX_SCALE);
+ public static final int LOG2_ARRAY_SHORT_INDEX_SCALE = exactLog2(Unsafe.ARRAY_SHORT_INDEX_SCALE);
+ public static final int LOG2_ARRAY_INT_INDEX_SCALE = exactLog2(Unsafe.ARRAY_INT_INDEX_SCALE);
+ public static final int LOG2_ARRAY_LONG_INDEX_SCALE = exactLog2(Unsafe.ARRAY_LONG_INDEX_SCALE);
+ public static final int LOG2_ARRAY_FLOAT_INDEX_SCALE = exactLog2(Unsafe.ARRAY_FLOAT_INDEX_SCALE);
+ public static final int LOG2_ARRAY_DOUBLE_INDEX_SCALE = exactLog2(Unsafe.ARRAY_DOUBLE_INDEX_SCALE);
+
+ private static final int LOG2_BYTE_BIT_SIZE = exactLog2(Byte.SIZE);
+
+ private static int exactLog2(int scale) {
+ if ((scale & (scale - 1)) != 0)
+ throw new Error("data type scale not a power of two");
+ return Integer.numberOfTrailingZeros(scale);
+ }
+
+ private ArraysSupport() {}
+
+ /**
+ * Find the relative index of the first mismatching pair of elements in two
+ * primitive arrays of the same component type. Pairs of elements will be
+ * tested in order relative to given offsets into both arrays.
+ *
+ * <p>This method does not perform type checks or bounds checks. It is the
+ * responsibility of the caller to perform such checks before calling this
+ * method.
+ *
+ * <p>The given offsets, in bytes, need not be aligned according to the
+ * given log<sub>2</sub> size the array elements. More specifically, an
+ * offset modulus the size need not be zero.
+ *
+ * @param a the first array to be tested for mismatch, or {@code null} for
+ * direct memory access
+ * @param aOffset the relative offset, in bytes, from the base address of
+ * the first array to test from, otherwise if the first array is
+ * {@code null}, an absolute address pointing to the first element to test.
+ * @param b the second array to be tested for mismatch, or {@code null} for
+ * direct memory access
+ * @param bOffset the relative offset, in bytes, from the base address of
+ * the second array to test from, otherwise if the second array is
+ * {@code null}, an absolute address pointing to the first element to test.
+ * @param length the number of array elements to test
+ * @param log2ArrayIndexScale log<sub>2</sub> of the array index scale, that
+ * corresponds to the size, in bytes, of an array element.
+ * @return if a mismatch is found a relative index, between 0 (inclusive)
+ * and {@code length} (exclusive), of the first mismatching pair of elements
+ * in the two arrays. Otherwise, if a mismatch is not found the bitwise
+ * compliment of the number of remaining pairs of elements to be checked in
+ * the tail of the two arrays.
+ */
+ @HotSpotIntrinsicCandidate
+ public static int vectorizedMismatch(Object a, long aOffset,
+ Object b, long bOffset,
+ int length,
+ int log2ArrayIndexScale) {
+ // assert a.getClass().isArray();
+ // assert b.getClass().isArray();
+ // assert 0 <= length <= sizeOf(a)
+ // assert 0 <= length <= sizeOf(b)
+ // assert 0 <= log2ArrayIndexScale <= 3
+
+ int log2ValuesPerWidth = LOG2_ARRAY_LONG_INDEX_SCALE - log2ArrayIndexScale;
+ int wi = 0;
+ for (; wi < length >> log2ValuesPerWidth; wi++) {
+ long bi = ((long) wi) << LOG2_ARRAY_LONG_INDEX_SCALE;
+ long av = U.getLongUnaligned(a, aOffset + bi);
+ long bv = U.getLongUnaligned(b, bOffset + bi);
+ if (av != bv) {
+ long x = av ^ bv;
+ int o = BIG_ENDIAN
+ ? Long.numberOfLeadingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale)
+ : Long.numberOfTrailingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale);
+ return (wi << log2ValuesPerWidth) + o;
+ }
+ }
+
+ // Calculate the tail of remaining elements to check
+ int tail = length - (wi << log2ValuesPerWidth);
+
+ if (log2ArrayIndexScale < LOG2_ARRAY_INT_INDEX_SCALE) {
+ int wordTail = 1 << (LOG2_ARRAY_INT_INDEX_SCALE - log2ArrayIndexScale);
+ // Handle 4 bytes or 2 chars in the tail using int width
+ if (tail >= wordTail) {
+ long bi = ((long) wi) << LOG2_ARRAY_LONG_INDEX_SCALE;
+ int av = U.getIntUnaligned(a, aOffset + bi);
+ int bv = U.getIntUnaligned(b, bOffset + bi);
+ if (av != bv) {
+ int x = av ^ bv;
+ int o = BIG_ENDIAN
+ ? Integer.numberOfLeadingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale)
+ : Integer.numberOfTrailingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale);
+ return (wi << log2ValuesPerWidth) + o;
+ }
+ tail -= wordTail;
+ }
+ return ~tail;
+ }
+ else {
+ return ~tail;
+ }
+ }
+
+ // Booleans
+ // Each boolean element takes up one byte
+
+ public static int mismatch(boolean[] a,
+ boolean[] b,
+ int length) {
+ int i = 0;
+ if (length > 7) {
+ i = vectorizedMismatch(
+ a, Unsafe.ARRAY_BOOLEAN_BASE_OFFSET,
+ b, Unsafe.ARRAY_BOOLEAN_BASE_OFFSET,
+ length, LOG2_ARRAY_BOOLEAN_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[i] != b[i])
+ return i;
+ }
+ return -1;
+ }
+
+ public static int mismatch(boolean[] a, int aFromIndex,
+ boolean[] b, int bFromIndex,
+ int length) {
+ int i = 0;
+ if (length > 7) {
+ int aOffset = Unsafe.ARRAY_BOOLEAN_BASE_OFFSET + aFromIndex;
+ int bOffset = Unsafe.ARRAY_BOOLEAN_BASE_OFFSET + bFromIndex;
+ i = vectorizedMismatch(
+ a, aOffset,
+ b, bOffset,
+ length, LOG2_ARRAY_BOOLEAN_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[aFromIndex + i] != b[bFromIndex + i])
+ return i;
+ }
+ return -1;
+ }
+
+
+ // Bytes
+
+ /**
+ * Find the index of a mismatch between two arrays.
+ *
+ * <p>This method does not perform bounds checks. It is the responsibility
+ * of the caller to perform such bounds checks before calling this method.
+ *
+ * @param a the first array to be tested for a mismatch
+ * @param b the second array to be tested for a mismatch
+ * @param length the number of bytes from each array to check
+ * @return the index of a mismatch between the two arrays, otherwise -1 if
+ * no mismatch. The index will be within the range of (inclusive) 0 to
+ * (exclusive) the smaller of the two array lengths.
+ */
+ public static int mismatch(byte[] a,
+ byte[] b,
+ int length) {
+ // ISSUE: defer to index receiving methods if performance is good
+ // assert length <= a.length
+ // assert length <= b.length
+
+ int i = 0;
+ if (length > 7) {
+ i = vectorizedMismatch(
+ a, Unsafe.ARRAY_BYTE_BASE_OFFSET,
+ b, Unsafe.ARRAY_BYTE_BASE_OFFSET,
+ length, LOG2_ARRAY_BYTE_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ // Align to tail
+ i = length - ~i;
+// assert i >= 0 && i <= 7;
+ }
+ // Tail < 8 bytes
+ for (; i < length; i++) {
+ if (a[i] != b[i])
+ return i;
+ }
+ return -1;
+ }
+
+ /**
+ * Find the relative index of a mismatch between two arrays starting from
+ * given indexes.
+ *
+ * <p>This method does not perform bounds checks. It is the responsibility
+ * of the caller to perform such bounds checks before calling this method.
+ *
+ * @param a the first array to be tested for a mismatch
+ * @param aFromIndex the index of the first element (inclusive) in the first
+ * array to be compared
+ * @param b the second array to be tested for a mismatch
+ * @param bFromIndex the index of the first element (inclusive) in the
+ * second array to be compared
+ * @param length the number of bytes from each array to check
+ * @return the relative index of a mismatch between the two arrays,
+ * otherwise -1 if no mismatch. The index will be within the range of
+ * (inclusive) 0 to (exclusive) the smaller of the two array bounds.
+ */
+ public static int mismatch(byte[] a, int aFromIndex,
+ byte[] b, int bFromIndex,
+ int length) {
+ // assert 0 <= aFromIndex < a.length
+ // assert 0 <= aFromIndex + length <= a.length
+ // assert 0 <= bFromIndex < b.length
+ // assert 0 <= bFromIndex + length <= b.length
+ // assert length >= 0
+
+ int i = 0;
+ if (length > 7) {
+ int aOffset = Unsafe.ARRAY_BYTE_BASE_OFFSET + aFromIndex;
+ int bOffset = Unsafe.ARRAY_BYTE_BASE_OFFSET + bFromIndex;
+ i = vectorizedMismatch(
+ a, aOffset,
+ b, bOffset,
+ length, LOG2_ARRAY_BYTE_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[aFromIndex + i] != b[bFromIndex + i])
+ return i;
+ }
+ return -1;
+ }
+
+
+ // Chars
+
+ public static int mismatch(char[] a,
+ char[] b,
+ int length) {
+ int i = 0;
+ if (length > 3) {
+ i = vectorizedMismatch(
+ a, Unsafe.ARRAY_CHAR_BASE_OFFSET,
+ b, Unsafe.ARRAY_CHAR_BASE_OFFSET,
+ length, LOG2_ARRAY_CHAR_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[i] != b[i])
+ return i;
+ }
+ return -1;
+ }
+
+ public static int mismatch(char[] a, int aFromIndex,
+ char[] b, int bFromIndex,
+ int length) {
+ int i = 0;
+ if (length > 3) {
+ int aOffset = Unsafe.ARRAY_CHAR_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_CHAR_INDEX_SCALE);
+ int bOffset = Unsafe.ARRAY_CHAR_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_CHAR_INDEX_SCALE);
+ i = vectorizedMismatch(
+ a, aOffset,
+ b, bOffset,
+ length, LOG2_ARRAY_CHAR_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[aFromIndex + i] != b[bFromIndex + i])
+ return i;
+ }
+ return -1;
+ }
+
+
+ // Shorts
+
+ public static int mismatch(short[] a,
+ short[] b,
+ int length) {
+ int i = 0;
+ if (length > 3) {
+ i = vectorizedMismatch(
+ a, Unsafe.ARRAY_SHORT_BASE_OFFSET,
+ b, Unsafe.ARRAY_SHORT_BASE_OFFSET,
+ length, LOG2_ARRAY_SHORT_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[i] != b[i])
+ return i;
+ }
+ return -1;
+ }
+
+ public static int mismatch(short[] a, int aFromIndex,
+ short[] b, int bFromIndex,
+ int length) {
+ int i = 0;
+ if (length > 3) {
+ int aOffset = Unsafe.ARRAY_SHORT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_SHORT_INDEX_SCALE);
+ int bOffset = Unsafe.ARRAY_SHORT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_SHORT_INDEX_SCALE);
+ i = vectorizedMismatch(
+ a, aOffset,
+ b, bOffset,
+ length, LOG2_ARRAY_SHORT_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[aFromIndex + i] != b[bFromIndex + i])
+ return i;
+ }
+ return -1;
+ }
+
+
+ // Ints
+
+ public static int mismatch(int[] a,
+ int[] b,
+ int length) {
+ int i = 0;
+ if (length > 1) {
+ i = vectorizedMismatch(
+ a, Unsafe.ARRAY_INT_BASE_OFFSET,
+ b, Unsafe.ARRAY_INT_BASE_OFFSET,
+ length, LOG2_ARRAY_INT_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[i] != b[i])
+ return i;
+ }
+ return -1;
+ }
+
+ public static int mismatch(int[] a, int aFromIndex,
+ int[] b, int bFromIndex,
+ int length) {
+ int i = 0;
+ if (length > 1) {
+ int aOffset = Unsafe.ARRAY_INT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_INT_INDEX_SCALE);
+ int bOffset = Unsafe.ARRAY_INT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_INT_INDEX_SCALE);
+ i = vectorizedMismatch(
+ a, aOffset,
+ b, bOffset,
+ length, LOG2_ARRAY_INT_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[aFromIndex + i] != b[bFromIndex + i])
+ return i;
+ }
+ return -1;
+ }
+
+
+ // Floats
+
+ public static int mismatch(float[] a,
+ float[] b,
+ int length) {
+ return mismatch(a, 0, b, 0, length);
+ }
+
+ public static int mismatch(float[] a, int aFromIndex,
+ float[] b, int bFromIndex,
+ int length) {
+ int i = 0;
+ if (length > 1) {
+ int aOffset = Unsafe.ARRAY_FLOAT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_FLOAT_INDEX_SCALE);
+ int bOffset = Unsafe.ARRAY_FLOAT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_FLOAT_INDEX_SCALE);
+ i = vectorizedMismatch(
+ a, aOffset,
+ b, bOffset,
+ length, LOG2_ARRAY_FLOAT_INDEX_SCALE);
+ // Mismatched
+ if (i >= 0) {
+ // Check if mismatch is not associated with two NaN values
+ if (!Float.isNaN(a[aFromIndex + i]) || !Float.isNaN(b[bFromIndex + i]))
+ return i;
+
+ // Mismatch on two different NaN values that are normalized to match
+ // Fall back to slow mechanism
+ // ISSUE: Consider looping over vectorizedMismatch adjusting ranges
+ // However, requires that returned value be relative to input ranges
+ i++;
+ }
+ // Matched
+ else {
+ i = length - ~i;
+ }
+ }
+ for (; i < length; i++) {
+ if (Float.floatToIntBits(a[aFromIndex + i]) != Float.floatToIntBits(b[bFromIndex + i]))
+ return i;
+ }
+ return -1;
+ }
+
+ // 64 bit sizes
+
+ // Long
+
+ public static int mismatch(long[] a,
+ long[] b,
+ int length) {
+ if (length == 0) {
+ return -1;
+ }
+ int i = vectorizedMismatch(
+ a, Unsafe.ARRAY_LONG_BASE_OFFSET,
+ b, Unsafe.ARRAY_LONG_BASE_OFFSET,
+ length, LOG2_ARRAY_LONG_INDEX_SCALE);
+ return i >= 0 ? i : -1;
+ }
+
+ public static int mismatch(long[] a, int aFromIndex,
+ long[] b, int bFromIndex,
+ int length) {
+ if (length == 0) {
+ return -1;
+ }
+ int aOffset = Unsafe.ARRAY_LONG_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_LONG_INDEX_SCALE);
+ int bOffset = Unsafe.ARRAY_LONG_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_LONG_INDEX_SCALE);
+ int i = vectorizedMismatch(
+ a, aOffset,
+ b, bOffset,
+ length, LOG2_ARRAY_LONG_INDEX_SCALE);
+ return i >= 0 ? i : -1;
+ }
+
+
+ // Double
+
+ public static int mismatch(double[] a,
+ double[] b,
+ int length) {
+ return mismatch(a, 0, b, 0, length);
+ }
+
+ public static int mismatch(double[] a, int aFromIndex,
+ double[] b, int bFromIndex,
+ int length) {
+ if (length == 0) {
+ return -1;
+ }
+ int aOffset = Unsafe.ARRAY_DOUBLE_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_DOUBLE_INDEX_SCALE);
+ int bOffset = Unsafe.ARRAY_DOUBLE_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_DOUBLE_INDEX_SCALE);
+ int i = vectorizedMismatch(
+ a, aOffset,
+ b, bOffset,
+ length, LOG2_ARRAY_DOUBLE_INDEX_SCALE);
+ if (i >= 0) {
+ // Check if mismatch is not associated with two NaN values
+ if (!Double.isNaN(a[aFromIndex + i]) || !Double.isNaN(b[bFromIndex + i]))
+ return i;
+
+ // Mismatch on two different NaN values that are normalized to match
+ // Fall back to slow mechanism
+ // ISSUE: Consider looping over vectorizedMismatch adjusting ranges
+ // However, requires that returned value be relative to input ranges
+ i++;
+ for (; i < length; i++) {
+ if (Double.doubleToLongBits(a[aFromIndex + i]) != Double.doubleToLongBits(b[bFromIndex + i]))
+ return i;
+ }
+ }
+
+ return -1;
+ }
+}
--- a/src/java.base/share/classes/module-info.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/module-info.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -142,7 +142,7 @@
java.instrument,
java.logging;
exports jdk.internal.jmod to
- jdk.compiler, // reflective dependency
+ jdk.compiler,
jdk.jlink;
exports jdk.internal.logger to
java.logging;
@@ -172,7 +172,7 @@
java.xml,
jdk.attach,
jdk.charsets,
- jdk.compiler, // reflective dependency
+ jdk.compiler,
jdk.incubator.httpclient,
jdk.jdeps,
jdk.jlink,
--- a/src/java.base/share/classes/sun/security/tools/keytool/Main.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/sun/security/tools/keytool/Main.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -523,9 +523,11 @@
if (c != null) {
command = c;
- } else if (collator.compare(flags, "-help") == 0 ||
- collator.compare(flags, "-h") == 0 ||
- collator.compare(flags, "-?") == 0) {
+ } else if (collator.compare(flags, "--help") == 0 ||
+ collator.compare(flags, "-h") == 0 ||
+ collator.compare(flags, "-?") == 0 ||
+ // -help: legacy.
+ collator.compare(flags, "-help") == 0) {
help = true;
} else if (collator.compare(flags, "-conf") == 0) {
i++;
@@ -4609,6 +4611,8 @@
}
System.err.println();
System.err.println(rb.getString(
+ "Use.keytool.help.for.all.available.commands"));
+ System.err.println(rb.getString(
"Use.keytool.command.name.help.for.usage.of.command.name"));
}
}
--- a/src/java.base/share/classes/sun/security/tools/keytool/Resources.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/classes/sun/security/tools/keytool/Resources.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -45,12 +45,12 @@
{"option.1.set.twice", "The %s option is specified multiple times. All except the last one will be ignored."},
{"multiple.commands.1.2", "Only one command is allowed: both %1$s and %2$s were specified."},
{"Use.keytool.help.for.all.available.commands",
- "Use \"keytool -help\" for all available commands"},
+ "Use \"keytool -?, -h, or --help\" for this help message"},
{"Key.and.Certificate.Management.Tool",
"Key and Certificate Management Tool"},
{"Commands.", "Commands:"},
{"Use.keytool.command.name.help.for.usage.of.command.name",
- "Use \"keytool -command_name -help\" for usage of command_name.\n" +
+ "Use \"keytool -command_name --help\" for usage of command_name.\n" +
"Use the -conf <url> option to specify a pre-configured options file."},
// keytool: help: commands
{"Generates.a.certificate.request",
@@ -462,7 +462,7 @@
{"with.weak", "%s (weak)"},
{"key.bit", "%1$d-bit %2$s key"},
{"key.bit.weak", "%1$d-bit %2$s key (weak)"},
- {"unknown.size.1", "unknown size %s key"},
+ {"unknown.size.1", "%s key of unknown size"},
{".PATTERN.printX509Cert.with.weak",
"Owner: {0}\nIssuer: {1}\nSerial number: {2}\nValid from: {3} until: {4}\nCertificate fingerprints:\n\t SHA1: {5}\n\t SHA256: {6}\nSignature algorithm name: {7}\nSubject Public Key Algorithm: {8}\nVersion: {9}"},
{"PKCS.10.with.weak",
--- a/src/java.base/share/conf/security/java.security Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/conf/security/java.security Thu Jan 18 18:58:46 2018 +0000
@@ -812,14 +812,14 @@
# limited: These policy files contain more restricted cryptographic
# strengths
#
-# The default setting is determined by the value of the “crypto.policy”
+# The default setting is determined by the value of the "crypto.policy"
# Security property below. If your country or usage requires the
-# traditional restrictive policy, the “limited” Java cryptographic
+# traditional restrictive policy, the "limited" Java cryptographic
# policy is still available and may be appropriate for your environment.
#
# If you have restrictions that do not fit either use case mentioned
# above, Java provides the capability to customize these policy files.
-# The “crypto.policy” security property points to a subdirectory
+# The "crypto.policy" security property points to a subdirectory
# within <java-home>/conf/security/policy/ which can be customized.
# Please see the <java-home>/conf/security/policy/README.txt file or consult
# the Java Security Guide/JCA documentation for more information.
--- a/src/java.base/share/conf/security/policy/README.txt Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/conf/security/policy/README.txt Thu Jan 18 18:58:46 2018 +0000
@@ -8,7 +8,7 @@
Import and export control rules on cryptographic software vary from
country to country. The Java Cryptography Extension (JCE) architecture
allows flexible cryptographic key strength to be configured via the
-jurisdiction policy files which are referenced by the “crypto.policy”
+jurisdiction policy files which are referenced by the "crypto.policy"
security property in the <java-home>/conf/security/java.security file.
By default, Java provides two different sets of cryptographic policy
@@ -20,8 +20,8 @@
limited: These policy files contain more restricted cryptographic
strengths
-These files reside in <java-home>/conf/security/policy in the “unlimited”
-or “limited” subdirectories respectively.
+These files reside in <java-home>/conf/security/policy in the "unlimited"
+or "limited" subdirectories respectively.
Each subdirectory contains a complete policy configuration,
and subdirectories can be added/edited/removed to reflect your
--- a/src/java.base/share/native/include/classfile_constants.h Thu Jan 18 09:01:00 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,581 +0,0 @@
-/*
- * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#ifndef CLASSFILE_CONSTANTS_H
-#define CLASSFILE_CONSTANTS_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Classfile version number for this information */
-#define JVM_CLASSFILE_MAJOR_VERSION 54
-#define JVM_CLASSFILE_MINOR_VERSION 0
-
-/* Flags */
-
-enum {
- JVM_ACC_PUBLIC = 0x0001,
- JVM_ACC_PRIVATE = 0x0002,
- JVM_ACC_PROTECTED = 0x0004,
- JVM_ACC_STATIC = 0x0008,
- JVM_ACC_FINAL = 0x0010,
- JVM_ACC_SYNCHRONIZED = 0x0020,
- JVM_ACC_SUPER = 0x0020,
- JVM_ACC_VOLATILE = 0x0040,
- JVM_ACC_BRIDGE = 0x0040,
- JVM_ACC_TRANSIENT = 0x0080,
- JVM_ACC_VARARGS = 0x0080,
- JVM_ACC_NATIVE = 0x0100,
- JVM_ACC_INTERFACE = 0x0200,
- JVM_ACC_ABSTRACT = 0x0400,
- JVM_ACC_STRICT = 0x0800,
- JVM_ACC_SYNTHETIC = 0x1000,
- JVM_ACC_ANNOTATION = 0x2000,
- JVM_ACC_ENUM = 0x4000,
- JVM_ACC_MODULE = 0x8000
-};
-
-#define JVM_ACC_PUBLIC_BIT 0
-#define JVM_ACC_PRIVATE_BIT 1
-#define JVM_ACC_PROTECTED_BIT 2
-#define JVM_ACC_STATIC_BIT 3
-#define JVM_ACC_FINAL_BIT 4
-#define JVM_ACC_SYNCHRONIZED_BIT 5
-#define JVM_ACC_SUPER_BIT 5
-#define JVM_ACC_VOLATILE_BIT 6
-#define JVM_ACC_BRIDGE_BIT 6
-#define JVM_ACC_TRANSIENT_BIT 7
-#define JVM_ACC_VARARGS_BIT 7
-#define JVM_ACC_NATIVE_BIT 8
-#define JVM_ACC_INTERFACE_BIT 9
-#define JVM_ACC_ABSTRACT_BIT 10
-#define JVM_ACC_STRICT_BIT 11
-#define JVM_ACC_SYNTHETIC_BIT 12
-#define JVM_ACC_ANNOTATION_BIT 13
-#define JVM_ACC_ENUM_BIT 14
-
-/* Used in newarray instruction. */
-
-enum {
- JVM_T_BOOLEAN = 4,
- JVM_T_CHAR = 5,
- JVM_T_FLOAT = 6,
- JVM_T_DOUBLE = 7,
- JVM_T_BYTE = 8,
- JVM_T_SHORT = 9,
- JVM_T_INT = 10,
- JVM_T_LONG = 11
-};
-
-/* Constant Pool Entries */
-
-enum {
- JVM_CONSTANT_Utf8 = 1,
- JVM_CONSTANT_Unicode = 2, /* unused */
- JVM_CONSTANT_Integer = 3,
- JVM_CONSTANT_Float = 4,
- JVM_CONSTANT_Long = 5,
- JVM_CONSTANT_Double = 6,
- JVM_CONSTANT_Class = 7,
- JVM_CONSTANT_String = 8,
- JVM_CONSTANT_Fieldref = 9,
- JVM_CONSTANT_Methodref = 10,
- JVM_CONSTANT_InterfaceMethodref = 11,
- JVM_CONSTANT_NameAndType = 12,
- JVM_CONSTANT_MethodHandle = 15, // JSR 292
- JVM_CONSTANT_MethodType = 16, // JSR 292
- JVM_CONSTANT_InvokeDynamic = 18,
- JVM_CONSTANT_ExternalMax = 18
-};
-
-/* JVM_CONSTANT_MethodHandle subtypes */
-enum {
- JVM_REF_getField = 1,
- JVM_REF_getStatic = 2,
- JVM_REF_putField = 3,
- JVM_REF_putStatic = 4,
- JVM_REF_invokeVirtual = 5,
- JVM_REF_invokeStatic = 6,
- JVM_REF_invokeSpecial = 7,
- JVM_REF_newInvokeSpecial = 8,
- JVM_REF_invokeInterface = 9
-};
-
-/* StackMapTable type item numbers */
-
-enum {
- JVM_ITEM_Top = 0,
- JVM_ITEM_Integer = 1,
- JVM_ITEM_Float = 2,
- JVM_ITEM_Double = 3,
- JVM_ITEM_Long = 4,
- JVM_ITEM_Null = 5,
- JVM_ITEM_UninitializedThis = 6,
- JVM_ITEM_Object = 7,
- JVM_ITEM_Uninitialized = 8
-};
-
-/* Type signatures */
-
-enum {
- JVM_SIGNATURE_ARRAY = '[',
- JVM_SIGNATURE_BYTE = 'B',
- JVM_SIGNATURE_CHAR = 'C',
- JVM_SIGNATURE_CLASS = 'L',
- JVM_SIGNATURE_ENDCLASS = ';',
- JVM_SIGNATURE_ENUM = 'E',
- JVM_SIGNATURE_FLOAT = 'F',
- JVM_SIGNATURE_DOUBLE = 'D',
- JVM_SIGNATURE_FUNC = '(',
- JVM_SIGNATURE_ENDFUNC = ')',
- JVM_SIGNATURE_INT = 'I',
- JVM_SIGNATURE_LONG = 'J',
- JVM_SIGNATURE_SHORT = 'S',
- JVM_SIGNATURE_VOID = 'V',
- JVM_SIGNATURE_BOOLEAN = 'Z'
-};
-
-/* Opcodes */
-
-enum {
- JVM_OPC_nop = 0,
- JVM_OPC_aconst_null = 1,
- JVM_OPC_iconst_m1 = 2,
- JVM_OPC_iconst_0 = 3,
- JVM_OPC_iconst_1 = 4,
- JVM_OPC_iconst_2 = 5,
- JVM_OPC_iconst_3 = 6,
- JVM_OPC_iconst_4 = 7,
- JVM_OPC_iconst_5 = 8,
- JVM_OPC_lconst_0 = 9,
- JVM_OPC_lconst_1 = 10,
- JVM_OPC_fconst_0 = 11,
- JVM_OPC_fconst_1 = 12,
- JVM_OPC_fconst_2 = 13,
- JVM_OPC_dconst_0 = 14,
- JVM_OPC_dconst_1 = 15,
- JVM_OPC_bipush = 16,
- JVM_OPC_sipush = 17,
- JVM_OPC_ldc = 18,
- JVM_OPC_ldc_w = 19,
- JVM_OPC_ldc2_w = 20,
- JVM_OPC_iload = 21,
- JVM_OPC_lload = 22,
- JVM_OPC_fload = 23,
- JVM_OPC_dload = 24,
- JVM_OPC_aload = 25,
- JVM_OPC_iload_0 = 26,
- JVM_OPC_iload_1 = 27,
- JVM_OPC_iload_2 = 28,
- JVM_OPC_iload_3 = 29,
- JVM_OPC_lload_0 = 30,
- JVM_OPC_lload_1 = 31,
- JVM_OPC_lload_2 = 32,
- JVM_OPC_lload_3 = 33,
- JVM_OPC_fload_0 = 34,
- JVM_OPC_fload_1 = 35,
- JVM_OPC_fload_2 = 36,
- JVM_OPC_fload_3 = 37,
- JVM_OPC_dload_0 = 38,
- JVM_OPC_dload_1 = 39,
- JVM_OPC_dload_2 = 40,
- JVM_OPC_dload_3 = 41,
- JVM_OPC_aload_0 = 42,
- JVM_OPC_aload_1 = 43,
- JVM_OPC_aload_2 = 44,
- JVM_OPC_aload_3 = 45,
- JVM_OPC_iaload = 46,
- JVM_OPC_laload = 47,
- JVM_OPC_faload = 48,
- JVM_OPC_daload = 49,
- JVM_OPC_aaload = 50,
- JVM_OPC_baload = 51,
- JVM_OPC_caload = 52,
- JVM_OPC_saload = 53,
- JVM_OPC_istore = 54,
- JVM_OPC_lstore = 55,
- JVM_OPC_fstore = 56,
- JVM_OPC_dstore = 57,
- JVM_OPC_astore = 58,
- JVM_OPC_istore_0 = 59,
- JVM_OPC_istore_1 = 60,
- JVM_OPC_istore_2 = 61,
- JVM_OPC_istore_3 = 62,
- JVM_OPC_lstore_0 = 63,
- JVM_OPC_lstore_1 = 64,
- JVM_OPC_lstore_2 = 65,
- JVM_OPC_lstore_3 = 66,
- JVM_OPC_fstore_0 = 67,
- JVM_OPC_fstore_1 = 68,
- JVM_OPC_fstore_2 = 69,
- JVM_OPC_fstore_3 = 70,
- JVM_OPC_dstore_0 = 71,
- JVM_OPC_dstore_1 = 72,
- JVM_OPC_dstore_2 = 73,
- JVM_OPC_dstore_3 = 74,
- JVM_OPC_astore_0 = 75,
- JVM_OPC_astore_1 = 76,
- JVM_OPC_astore_2 = 77,
- JVM_OPC_astore_3 = 78,
- JVM_OPC_iastore = 79,
- JVM_OPC_lastore = 80,
- JVM_OPC_fastore = 81,
- JVM_OPC_dastore = 82,
- JVM_OPC_aastore = 83,
- JVM_OPC_bastore = 84,
- JVM_OPC_castore = 85,
- JVM_OPC_sastore = 86,
- JVM_OPC_pop = 87,
- JVM_OPC_pop2 = 88,
- JVM_OPC_dup = 89,
- JVM_OPC_dup_x1 = 90,
- JVM_OPC_dup_x2 = 91,
- JVM_OPC_dup2 = 92,
- JVM_OPC_dup2_x1 = 93,
- JVM_OPC_dup2_x2 = 94,
- JVM_OPC_swap = 95,
- JVM_OPC_iadd = 96,
- JVM_OPC_ladd = 97,
- JVM_OPC_fadd = 98,
- JVM_OPC_dadd = 99,
- JVM_OPC_isub = 100,
- JVM_OPC_lsub = 101,
- JVM_OPC_fsub = 102,
- JVM_OPC_dsub = 103,
- JVM_OPC_imul = 104,
- JVM_OPC_lmul = 105,
- JVM_OPC_fmul = 106,
- JVM_OPC_dmul = 107,
- JVM_OPC_idiv = 108,
- JVM_OPC_ldiv = 109,
- JVM_OPC_fdiv = 110,
- JVM_OPC_ddiv = 111,
- JVM_OPC_irem = 112,
- JVM_OPC_lrem = 113,
- JVM_OPC_frem = 114,
- JVM_OPC_drem = 115,
- JVM_OPC_ineg = 116,
- JVM_OPC_lneg = 117,
- JVM_OPC_fneg = 118,
- JVM_OPC_dneg = 119,
- JVM_OPC_ishl = 120,
- JVM_OPC_lshl = 121,
- JVM_OPC_ishr = 122,
- JVM_OPC_lshr = 123,
- JVM_OPC_iushr = 124,
- JVM_OPC_lushr = 125,
- JVM_OPC_iand = 126,
- JVM_OPC_land = 127,
- JVM_OPC_ior = 128,
- JVM_OPC_lor = 129,
- JVM_OPC_ixor = 130,
- JVM_OPC_lxor = 131,
- JVM_OPC_iinc = 132,
- JVM_OPC_i2l = 133,
- JVM_OPC_i2f = 134,
- JVM_OPC_i2d = 135,
- JVM_OPC_l2i = 136,
- JVM_OPC_l2f = 137,
- JVM_OPC_l2d = 138,
- JVM_OPC_f2i = 139,
- JVM_OPC_f2l = 140,
- JVM_OPC_f2d = 141,
- JVM_OPC_d2i = 142,
- JVM_OPC_d2l = 143,
- JVM_OPC_d2f = 144,
- JVM_OPC_i2b = 145,
- JVM_OPC_i2c = 146,
- JVM_OPC_i2s = 147,
- JVM_OPC_lcmp = 148,
- JVM_OPC_fcmpl = 149,
- JVM_OPC_fcmpg = 150,
- JVM_OPC_dcmpl = 151,
- JVM_OPC_dcmpg = 152,
- JVM_OPC_ifeq = 153,
- JVM_OPC_ifne = 154,
- JVM_OPC_iflt = 155,
- JVM_OPC_ifge = 156,
- JVM_OPC_ifgt = 157,
- JVM_OPC_ifle = 158,
- JVM_OPC_if_icmpeq = 159,
- JVM_OPC_if_icmpne = 160,
- JVM_OPC_if_icmplt = 161,
- JVM_OPC_if_icmpge = 162,
- JVM_OPC_if_icmpgt = 163,
- JVM_OPC_if_icmple = 164,
- JVM_OPC_if_acmpeq = 165,
- JVM_OPC_if_acmpne = 166,
- JVM_OPC_goto = 167,
- JVM_OPC_jsr = 168,
- JVM_OPC_ret = 169,
- JVM_OPC_tableswitch = 170,
- JVM_OPC_lookupswitch = 171,
- JVM_OPC_ireturn = 172,
- JVM_OPC_lreturn = 173,
- JVM_OPC_freturn = 174,
- JVM_OPC_dreturn = 175,
- JVM_OPC_areturn = 176,
- JVM_OPC_return = 177,
- JVM_OPC_getstatic = 178,
- JVM_OPC_putstatic = 179,
- JVM_OPC_getfield = 180,
- JVM_OPC_putfield = 181,
- JVM_OPC_invokevirtual = 182,
- JVM_OPC_invokespecial = 183,
- JVM_OPC_invokestatic = 184,
- JVM_OPC_invokeinterface = 185,
- JVM_OPC_invokedynamic = 186,
- JVM_OPC_new = 187,
- JVM_OPC_newarray = 188,
- JVM_OPC_anewarray = 189,
- JVM_OPC_arraylength = 190,
- JVM_OPC_athrow = 191,
- JVM_OPC_checkcast = 192,
- JVM_OPC_instanceof = 193,
- JVM_OPC_monitorenter = 194,
- JVM_OPC_monitorexit = 195,
- JVM_OPC_wide = 196,
- JVM_OPC_multianewarray = 197,
- JVM_OPC_ifnull = 198,
- JVM_OPC_ifnonnull = 199,
- JVM_OPC_goto_w = 200,
- JVM_OPC_jsr_w = 201,
- JVM_OPC_MAX = 201
-};
-
-/* Opcode length initializer, use with something like:
- * unsigned char opcode_length[JVM_OPC_MAX+1] = JVM_OPCODE_LENGTH_INITIALIZER;
- */
-#define JVM_OPCODE_LENGTH_INITIALIZER { \
- 1, /* nop */ \
- 1, /* aconst_null */ \
- 1, /* iconst_m1 */ \
- 1, /* iconst_0 */ \
- 1, /* iconst_1 */ \
- 1, /* iconst_2 */ \
- 1, /* iconst_3 */ \
- 1, /* iconst_4 */ \
- 1, /* iconst_5 */ \
- 1, /* lconst_0 */ \
- 1, /* lconst_1 */ \
- 1, /* fconst_0 */ \
- 1, /* fconst_1 */ \
- 1, /* fconst_2 */ \
- 1, /* dconst_0 */ \
- 1, /* dconst_1 */ \
- 2, /* bipush */ \
- 3, /* sipush */ \
- 2, /* ldc */ \
- 3, /* ldc_w */ \
- 3, /* ldc2_w */ \
- 2, /* iload */ \
- 2, /* lload */ \
- 2, /* fload */ \
- 2, /* dload */ \
- 2, /* aload */ \
- 1, /* iload_0 */ \
- 1, /* iload_1 */ \
- 1, /* iload_2 */ \
- 1, /* iload_3 */ \
- 1, /* lload_0 */ \
- 1, /* lload_1 */ \
- 1, /* lload_2 */ \
- 1, /* lload_3 */ \
- 1, /* fload_0 */ \
- 1, /* fload_1 */ \
- 1, /* fload_2 */ \
- 1, /* fload_3 */ \
- 1, /* dload_0 */ \
- 1, /* dload_1 */ \
- 1, /* dload_2 */ \
- 1, /* dload_3 */ \
- 1, /* aload_0 */ \
- 1, /* aload_1 */ \
- 1, /* aload_2 */ \
- 1, /* aload_3 */ \
- 1, /* iaload */ \
- 1, /* laload */ \
- 1, /* faload */ \
- 1, /* daload */ \
- 1, /* aaload */ \
- 1, /* baload */ \
- 1, /* caload */ \
- 1, /* saload */ \
- 2, /* istore */ \
- 2, /* lstore */ \
- 2, /* fstore */ \
- 2, /* dstore */ \
- 2, /* astore */ \
- 1, /* istore_0 */ \
- 1, /* istore_1 */ \
- 1, /* istore_2 */ \
- 1, /* istore_3 */ \
- 1, /* lstore_0 */ \
- 1, /* lstore_1 */ \
- 1, /* lstore_2 */ \
- 1, /* lstore_3 */ \
- 1, /* fstore_0 */ \
- 1, /* fstore_1 */ \
- 1, /* fstore_2 */ \
- 1, /* fstore_3 */ \
- 1, /* dstore_0 */ \
- 1, /* dstore_1 */ \
- 1, /* dstore_2 */ \
- 1, /* dstore_3 */ \
- 1, /* astore_0 */ \
- 1, /* astore_1 */ \
- 1, /* astore_2 */ \
- 1, /* astore_3 */ \
- 1, /* iastore */ \
- 1, /* lastore */ \
- 1, /* fastore */ \
- 1, /* dastore */ \
- 1, /* aastore */ \
- 1, /* bastore */ \
- 1, /* castore */ \
- 1, /* sastore */ \
- 1, /* pop */ \
- 1, /* pop2 */ \
- 1, /* dup */ \
- 1, /* dup_x1 */ \
- 1, /* dup_x2 */ \
- 1, /* dup2 */ \
- 1, /* dup2_x1 */ \
- 1, /* dup2_x2 */ \
- 1, /* swap */ \
- 1, /* iadd */ \
- 1, /* ladd */ \
- 1, /* fadd */ \
- 1, /* dadd */ \
- 1, /* isub */ \
- 1, /* lsub */ \
- 1, /* fsub */ \
- 1, /* dsub */ \
- 1, /* imul */ \
- 1, /* lmul */ \
- 1, /* fmul */ \
- 1, /* dmul */ \
- 1, /* idiv */ \
- 1, /* ldiv */ \
- 1, /* fdiv */ \
- 1, /* ddiv */ \
- 1, /* irem */ \
- 1, /* lrem */ \
- 1, /* frem */ \
- 1, /* drem */ \
- 1, /* ineg */ \
- 1, /* lneg */ \
- 1, /* fneg */ \
- 1, /* dneg */ \
- 1, /* ishl */ \
- 1, /* lshl */ \
- 1, /* ishr */ \
- 1, /* lshr */ \
- 1, /* iushr */ \
- 1, /* lushr */ \
- 1, /* iand */ \
- 1, /* land */ \
- 1, /* ior */ \
- 1, /* lor */ \
- 1, /* ixor */ \
- 1, /* lxor */ \
- 3, /* iinc */ \
- 1, /* i2l */ \
- 1, /* i2f */ \
- 1, /* i2d */ \
- 1, /* l2i */ \
- 1, /* l2f */ \
- 1, /* l2d */ \
- 1, /* f2i */ \
- 1, /* f2l */ \
- 1, /* f2d */ \
- 1, /* d2i */ \
- 1, /* d2l */ \
- 1, /* d2f */ \
- 1, /* i2b */ \
- 1, /* i2c */ \
- 1, /* i2s */ \
- 1, /* lcmp */ \
- 1, /* fcmpl */ \
- 1, /* fcmpg */ \
- 1, /* dcmpl */ \
- 1, /* dcmpg */ \
- 3, /* ifeq */ \
- 3, /* ifne */ \
- 3, /* iflt */ \
- 3, /* ifge */ \
- 3, /* ifgt */ \
- 3, /* ifle */ \
- 3, /* if_icmpeq */ \
- 3, /* if_icmpne */ \
- 3, /* if_icmplt */ \
- 3, /* if_icmpge */ \
- 3, /* if_icmpgt */ \
- 3, /* if_icmple */ \
- 3, /* if_acmpeq */ \
- 3, /* if_acmpne */ \
- 3, /* goto */ \
- 3, /* jsr */ \
- 2, /* ret */ \
- 99, /* tableswitch */ \
- 99, /* lookupswitch */ \
- 1, /* ireturn */ \
- 1, /* lreturn */ \
- 1, /* freturn */ \
- 1, /* dreturn */ \
- 1, /* areturn */ \
- 1, /* return */ \
- 3, /* getstatic */ \
- 3, /* putstatic */ \
- 3, /* getfield */ \
- 3, /* putfield */ \
- 3, /* invokevirtual */ \
- 3, /* invokespecial */ \
- 3, /* invokestatic */ \
- 5, /* invokeinterface */ \
- 5, /* invokedynamic */ \
- 3, /* new */ \
- 2, /* newarray */ \
- 3, /* anewarray */ \
- 1, /* arraylength */ \
- 1, /* athrow */ \
- 3, /* checkcast */ \
- 3, /* instanceof */ \
- 1, /* monitorenter */ \
- 1, /* monitorexit */ \
- 0, /* wide */ \
- 4, /* multianewarray */ \
- 3, /* ifnull */ \
- 3, /* ifnonnull */ \
- 5, /* goto_w */ \
- 5 /* jsr_w */ \
-}
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif /* __cplusplus */
-
-#endif /* CLASSFILE_CONSTANTS */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/native/include/classfile_constants.h.template Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,581 @@
+/*
+ * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#ifndef CLASSFILE_CONSTANTS_H
+#define CLASSFILE_CONSTANTS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Classfile version number for this information */
+#define JVM_CLASSFILE_MAJOR_VERSION @@VERSION_CLASSFILE_MAJOR@@
+#define JVM_CLASSFILE_MINOR_VERSION @@VERSION_CLASSFILE_MINOR@@
+
+/* Flags */
+
+enum {
+ JVM_ACC_PUBLIC = 0x0001,
+ JVM_ACC_PRIVATE = 0x0002,
+ JVM_ACC_PROTECTED = 0x0004,
+ JVM_ACC_STATIC = 0x0008,
+ JVM_ACC_FINAL = 0x0010,
+ JVM_ACC_SYNCHRONIZED = 0x0020,
+ JVM_ACC_SUPER = 0x0020,
+ JVM_ACC_VOLATILE = 0x0040,
+ JVM_ACC_BRIDGE = 0x0040,
+ JVM_ACC_TRANSIENT = 0x0080,
+ JVM_ACC_VARARGS = 0x0080,
+ JVM_ACC_NATIVE = 0x0100,
+ JVM_ACC_INTERFACE = 0x0200,
+ JVM_ACC_ABSTRACT = 0x0400,
+ JVM_ACC_STRICT = 0x0800,
+ JVM_ACC_SYNTHETIC = 0x1000,
+ JVM_ACC_ANNOTATION = 0x2000,
+ JVM_ACC_ENUM = 0x4000,
+ JVM_ACC_MODULE = 0x8000
+};
+
+#define JVM_ACC_PUBLIC_BIT 0
+#define JVM_ACC_PRIVATE_BIT 1
+#define JVM_ACC_PROTECTED_BIT 2
+#define JVM_ACC_STATIC_BIT 3
+#define JVM_ACC_FINAL_BIT 4
+#define JVM_ACC_SYNCHRONIZED_BIT 5
+#define JVM_ACC_SUPER_BIT 5
+#define JVM_ACC_VOLATILE_BIT 6
+#define JVM_ACC_BRIDGE_BIT 6
+#define JVM_ACC_TRANSIENT_BIT 7
+#define JVM_ACC_VARARGS_BIT 7
+#define JVM_ACC_NATIVE_BIT 8
+#define JVM_ACC_INTERFACE_BIT 9
+#define JVM_ACC_ABSTRACT_BIT 10
+#define JVM_ACC_STRICT_BIT 11
+#define JVM_ACC_SYNTHETIC_BIT 12
+#define JVM_ACC_ANNOTATION_BIT 13
+#define JVM_ACC_ENUM_BIT 14
+
+/* Used in newarray instruction. */
+
+enum {
+ JVM_T_BOOLEAN = 4,
+ JVM_T_CHAR = 5,
+ JVM_T_FLOAT = 6,
+ JVM_T_DOUBLE = 7,
+ JVM_T_BYTE = 8,
+ JVM_T_SHORT = 9,
+ JVM_T_INT = 10,
+ JVM_T_LONG = 11
+};
+
+/* Constant Pool Entries */
+
+enum {
+ JVM_CONSTANT_Utf8 = 1,
+ JVM_CONSTANT_Unicode = 2, /* unused */
+ JVM_CONSTANT_Integer = 3,
+ JVM_CONSTANT_Float = 4,
+ JVM_CONSTANT_Long = 5,
+ JVM_CONSTANT_Double = 6,
+ JVM_CONSTANT_Class = 7,
+ JVM_CONSTANT_String = 8,
+ JVM_CONSTANT_Fieldref = 9,
+ JVM_CONSTANT_Methodref = 10,
+ JVM_CONSTANT_InterfaceMethodref = 11,
+ JVM_CONSTANT_NameAndType = 12,
+ JVM_CONSTANT_MethodHandle = 15, // JSR 292
+ JVM_CONSTANT_MethodType = 16, // JSR 292
+ JVM_CONSTANT_InvokeDynamic = 18,
+ JVM_CONSTANT_ExternalMax = 18
+};
+
+/* JVM_CONSTANT_MethodHandle subtypes */
+enum {
+ JVM_REF_getField = 1,
+ JVM_REF_getStatic = 2,
+ JVM_REF_putField = 3,
+ JVM_REF_putStatic = 4,
+ JVM_REF_invokeVirtual = 5,
+ JVM_REF_invokeStatic = 6,
+ JVM_REF_invokeSpecial = 7,
+ JVM_REF_newInvokeSpecial = 8,
+ JVM_REF_invokeInterface = 9
+};
+
+/* StackMapTable type item numbers */
+
+enum {
+ JVM_ITEM_Top = 0,
+ JVM_ITEM_Integer = 1,
+ JVM_ITEM_Float = 2,
+ JVM_ITEM_Double = 3,
+ JVM_ITEM_Long = 4,
+ JVM_ITEM_Null = 5,
+ JVM_ITEM_UninitializedThis = 6,
+ JVM_ITEM_Object = 7,
+ JVM_ITEM_Uninitialized = 8
+};
+
+/* Type signatures */
+
+enum {
+ JVM_SIGNATURE_ARRAY = '[',
+ JVM_SIGNATURE_BYTE = 'B',
+ JVM_SIGNATURE_CHAR = 'C',
+ JVM_SIGNATURE_CLASS = 'L',
+ JVM_SIGNATURE_ENDCLASS = ';',
+ JVM_SIGNATURE_ENUM = 'E',
+ JVM_SIGNATURE_FLOAT = 'F',
+ JVM_SIGNATURE_DOUBLE = 'D',
+ JVM_SIGNATURE_FUNC = '(',
+ JVM_SIGNATURE_ENDFUNC = ')',
+ JVM_SIGNATURE_INT = 'I',
+ JVM_SIGNATURE_LONG = 'J',
+ JVM_SIGNATURE_SHORT = 'S',
+ JVM_SIGNATURE_VOID = 'V',
+ JVM_SIGNATURE_BOOLEAN = 'Z'
+};
+
+/* Opcodes */
+
+enum {
+ JVM_OPC_nop = 0,
+ JVM_OPC_aconst_null = 1,
+ JVM_OPC_iconst_m1 = 2,
+ JVM_OPC_iconst_0 = 3,
+ JVM_OPC_iconst_1 = 4,
+ JVM_OPC_iconst_2 = 5,
+ JVM_OPC_iconst_3 = 6,
+ JVM_OPC_iconst_4 = 7,
+ JVM_OPC_iconst_5 = 8,
+ JVM_OPC_lconst_0 = 9,
+ JVM_OPC_lconst_1 = 10,
+ JVM_OPC_fconst_0 = 11,
+ JVM_OPC_fconst_1 = 12,
+ JVM_OPC_fconst_2 = 13,
+ JVM_OPC_dconst_0 = 14,
+ JVM_OPC_dconst_1 = 15,
+ JVM_OPC_bipush = 16,
+ JVM_OPC_sipush = 17,
+ JVM_OPC_ldc = 18,
+ JVM_OPC_ldc_w = 19,
+ JVM_OPC_ldc2_w = 20,
+ JVM_OPC_iload = 21,
+ JVM_OPC_lload = 22,
+ JVM_OPC_fload = 23,
+ JVM_OPC_dload = 24,
+ JVM_OPC_aload = 25,
+ JVM_OPC_iload_0 = 26,
+ JVM_OPC_iload_1 = 27,
+ JVM_OPC_iload_2 = 28,
+ JVM_OPC_iload_3 = 29,
+ JVM_OPC_lload_0 = 30,
+ JVM_OPC_lload_1 = 31,
+ JVM_OPC_lload_2 = 32,
+ JVM_OPC_lload_3 = 33,
+ JVM_OPC_fload_0 = 34,
+ JVM_OPC_fload_1 = 35,
+ JVM_OPC_fload_2 = 36,
+ JVM_OPC_fload_3 = 37,
+ JVM_OPC_dload_0 = 38,
+ JVM_OPC_dload_1 = 39,
+ JVM_OPC_dload_2 = 40,
+ JVM_OPC_dload_3 = 41,
+ JVM_OPC_aload_0 = 42,
+ JVM_OPC_aload_1 = 43,
+ JVM_OPC_aload_2 = 44,
+ JVM_OPC_aload_3 = 45,
+ JVM_OPC_iaload = 46,
+ JVM_OPC_laload = 47,
+ JVM_OPC_faload = 48,
+ JVM_OPC_daload = 49,
+ JVM_OPC_aaload = 50,
+ JVM_OPC_baload = 51,
+ JVM_OPC_caload = 52,
+ JVM_OPC_saload = 53,
+ JVM_OPC_istore = 54,
+ JVM_OPC_lstore = 55,
+ JVM_OPC_fstore = 56,
+ JVM_OPC_dstore = 57,
+ JVM_OPC_astore = 58,
+ JVM_OPC_istore_0 = 59,
+ JVM_OPC_istore_1 = 60,
+ JVM_OPC_istore_2 = 61,
+ JVM_OPC_istore_3 = 62,
+ JVM_OPC_lstore_0 = 63,
+ JVM_OPC_lstore_1 = 64,
+ JVM_OPC_lstore_2 = 65,
+ JVM_OPC_lstore_3 = 66,
+ JVM_OPC_fstore_0 = 67,
+ JVM_OPC_fstore_1 = 68,
+ JVM_OPC_fstore_2 = 69,
+ JVM_OPC_fstore_3 = 70,
+ JVM_OPC_dstore_0 = 71,
+ JVM_OPC_dstore_1 = 72,
+ JVM_OPC_dstore_2 = 73,
+ JVM_OPC_dstore_3 = 74,
+ JVM_OPC_astore_0 = 75,
+ JVM_OPC_astore_1 = 76,
+ JVM_OPC_astore_2 = 77,
+ JVM_OPC_astore_3 = 78,
+ JVM_OPC_iastore = 79,
+ JVM_OPC_lastore = 80,
+ JVM_OPC_fastore = 81,
+ JVM_OPC_dastore = 82,
+ JVM_OPC_aastore = 83,
+ JVM_OPC_bastore = 84,
+ JVM_OPC_castore = 85,
+ JVM_OPC_sastore = 86,
+ JVM_OPC_pop = 87,
+ JVM_OPC_pop2 = 88,
+ JVM_OPC_dup = 89,
+ JVM_OPC_dup_x1 = 90,
+ JVM_OPC_dup_x2 = 91,
+ JVM_OPC_dup2 = 92,
+ JVM_OPC_dup2_x1 = 93,
+ JVM_OPC_dup2_x2 = 94,
+ JVM_OPC_swap = 95,
+ JVM_OPC_iadd = 96,
+ JVM_OPC_ladd = 97,
+ JVM_OPC_fadd = 98,
+ JVM_OPC_dadd = 99,
+ JVM_OPC_isub = 100,
+ JVM_OPC_lsub = 101,
+ JVM_OPC_fsub = 102,
+ JVM_OPC_dsub = 103,
+ JVM_OPC_imul = 104,
+ JVM_OPC_lmul = 105,
+ JVM_OPC_fmul = 106,
+ JVM_OPC_dmul = 107,
+ JVM_OPC_idiv = 108,
+ JVM_OPC_ldiv = 109,
+ JVM_OPC_fdiv = 110,
+ JVM_OPC_ddiv = 111,
+ JVM_OPC_irem = 112,
+ JVM_OPC_lrem = 113,
+ JVM_OPC_frem = 114,
+ JVM_OPC_drem = 115,
+ JVM_OPC_ineg = 116,
+ JVM_OPC_lneg = 117,
+ JVM_OPC_fneg = 118,
+ JVM_OPC_dneg = 119,
+ JVM_OPC_ishl = 120,
+ JVM_OPC_lshl = 121,
+ JVM_OPC_ishr = 122,
+ JVM_OPC_lshr = 123,
+ JVM_OPC_iushr = 124,
+ JVM_OPC_lushr = 125,
+ JVM_OPC_iand = 126,
+ JVM_OPC_land = 127,
+ JVM_OPC_ior = 128,
+ JVM_OPC_lor = 129,
+ JVM_OPC_ixor = 130,
+ JVM_OPC_lxor = 131,
+ JVM_OPC_iinc = 132,
+ JVM_OPC_i2l = 133,
+ JVM_OPC_i2f = 134,
+ JVM_OPC_i2d = 135,
+ JVM_OPC_l2i = 136,
+ JVM_OPC_l2f = 137,
+ JVM_OPC_l2d = 138,
+ JVM_OPC_f2i = 139,
+ JVM_OPC_f2l = 140,
+ JVM_OPC_f2d = 141,
+ JVM_OPC_d2i = 142,
+ JVM_OPC_d2l = 143,
+ JVM_OPC_d2f = 144,
+ JVM_OPC_i2b = 145,
+ JVM_OPC_i2c = 146,
+ JVM_OPC_i2s = 147,
+ JVM_OPC_lcmp = 148,
+ JVM_OPC_fcmpl = 149,
+ JVM_OPC_fcmpg = 150,
+ JVM_OPC_dcmpl = 151,
+ JVM_OPC_dcmpg = 152,
+ JVM_OPC_ifeq = 153,
+ JVM_OPC_ifne = 154,
+ JVM_OPC_iflt = 155,
+ JVM_OPC_ifge = 156,
+ JVM_OPC_ifgt = 157,
+ JVM_OPC_ifle = 158,
+ JVM_OPC_if_icmpeq = 159,
+ JVM_OPC_if_icmpne = 160,
+ JVM_OPC_if_icmplt = 161,
+ JVM_OPC_if_icmpge = 162,
+ JVM_OPC_if_icmpgt = 163,
+ JVM_OPC_if_icmple = 164,
+ JVM_OPC_if_acmpeq = 165,
+ JVM_OPC_if_acmpne = 166,
+ JVM_OPC_goto = 167,
+ JVM_OPC_jsr = 168,
+ JVM_OPC_ret = 169,
+ JVM_OPC_tableswitch = 170,
+ JVM_OPC_lookupswitch = 171,
+ JVM_OPC_ireturn = 172,
+ JVM_OPC_lreturn = 173,
+ JVM_OPC_freturn = 174,
+ JVM_OPC_dreturn = 175,
+ JVM_OPC_areturn = 176,
+ JVM_OPC_return = 177,
+ JVM_OPC_getstatic = 178,
+ JVM_OPC_putstatic = 179,
+ JVM_OPC_getfield = 180,
+ JVM_OPC_putfield = 181,
+ JVM_OPC_invokevirtual = 182,
+ JVM_OPC_invokespecial = 183,
+ JVM_OPC_invokestatic = 184,
+ JVM_OPC_invokeinterface = 185,
+ JVM_OPC_invokedynamic = 186,
+ JVM_OPC_new = 187,
+ JVM_OPC_newarray = 188,
+ JVM_OPC_anewarray = 189,
+ JVM_OPC_arraylength = 190,
+ JVM_OPC_athrow = 191,
+ JVM_OPC_checkcast = 192,
+ JVM_OPC_instanceof = 193,
+ JVM_OPC_monitorenter = 194,
+ JVM_OPC_monitorexit = 195,
+ JVM_OPC_wide = 196,
+ JVM_OPC_multianewarray = 197,
+ JVM_OPC_ifnull = 198,
+ JVM_OPC_ifnonnull = 199,
+ JVM_OPC_goto_w = 200,
+ JVM_OPC_jsr_w = 201,
+ JVM_OPC_MAX = 201
+};
+
+/* Opcode length initializer, use with something like:
+ * unsigned char opcode_length[JVM_OPC_MAX+1] = JVM_OPCODE_LENGTH_INITIALIZER;
+ */
+#define JVM_OPCODE_LENGTH_INITIALIZER { \
+ 1, /* nop */ \
+ 1, /* aconst_null */ \
+ 1, /* iconst_m1 */ \
+ 1, /* iconst_0 */ \
+ 1, /* iconst_1 */ \
+ 1, /* iconst_2 */ \
+ 1, /* iconst_3 */ \
+ 1, /* iconst_4 */ \
+ 1, /* iconst_5 */ \
+ 1, /* lconst_0 */ \
+ 1, /* lconst_1 */ \
+ 1, /* fconst_0 */ \
+ 1, /* fconst_1 */ \
+ 1, /* fconst_2 */ \
+ 1, /* dconst_0 */ \
+ 1, /* dconst_1 */ \
+ 2, /* bipush */ \
+ 3, /* sipush */ \
+ 2, /* ldc */ \
+ 3, /* ldc_w */ \
+ 3, /* ldc2_w */ \
+ 2, /* iload */ \
+ 2, /* lload */ \
+ 2, /* fload */ \
+ 2, /* dload */ \
+ 2, /* aload */ \
+ 1, /* iload_0 */ \
+ 1, /* iload_1 */ \
+ 1, /* iload_2 */ \
+ 1, /* iload_3 */ \
+ 1, /* lload_0 */ \
+ 1, /* lload_1 */ \
+ 1, /* lload_2 */ \
+ 1, /* lload_3 */ \
+ 1, /* fload_0 */ \
+ 1, /* fload_1 */ \
+ 1, /* fload_2 */ \
+ 1, /* fload_3 */ \
+ 1, /* dload_0 */ \
+ 1, /* dload_1 */ \
+ 1, /* dload_2 */ \
+ 1, /* dload_3 */ \
+ 1, /* aload_0 */ \
+ 1, /* aload_1 */ \
+ 1, /* aload_2 */ \
+ 1, /* aload_3 */ \
+ 1, /* iaload */ \
+ 1, /* laload */ \
+ 1, /* faload */ \
+ 1, /* daload */ \
+ 1, /* aaload */ \
+ 1, /* baload */ \
+ 1, /* caload */ \
+ 1, /* saload */ \
+ 2, /* istore */ \
+ 2, /* lstore */ \
+ 2, /* fstore */ \
+ 2, /* dstore */ \
+ 2, /* astore */ \
+ 1, /* istore_0 */ \
+ 1, /* istore_1 */ \
+ 1, /* istore_2 */ \
+ 1, /* istore_3 */ \
+ 1, /* lstore_0 */ \
+ 1, /* lstore_1 */ \
+ 1, /* lstore_2 */ \
+ 1, /* lstore_3 */ \
+ 1, /* fstore_0 */ \
+ 1, /* fstore_1 */ \
+ 1, /* fstore_2 */ \
+ 1, /* fstore_3 */ \
+ 1, /* dstore_0 */ \
+ 1, /* dstore_1 */ \
+ 1, /* dstore_2 */ \
+ 1, /* dstore_3 */ \
+ 1, /* astore_0 */ \
+ 1, /* astore_1 */ \
+ 1, /* astore_2 */ \
+ 1, /* astore_3 */ \
+ 1, /* iastore */ \
+ 1, /* lastore */ \
+ 1, /* fastore */ \
+ 1, /* dastore */ \
+ 1, /* aastore */ \
+ 1, /* bastore */ \
+ 1, /* castore */ \
+ 1, /* sastore */ \
+ 1, /* pop */ \
+ 1, /* pop2 */ \
+ 1, /* dup */ \
+ 1, /* dup_x1 */ \
+ 1, /* dup_x2 */ \
+ 1, /* dup2 */ \
+ 1, /* dup2_x1 */ \
+ 1, /* dup2_x2 */ \
+ 1, /* swap */ \
+ 1, /* iadd */ \
+ 1, /* ladd */ \
+ 1, /* fadd */ \
+ 1, /* dadd */ \
+ 1, /* isub */ \
+ 1, /* lsub */ \
+ 1, /* fsub */ \
+ 1, /* dsub */ \
+ 1, /* imul */ \
+ 1, /* lmul */ \
+ 1, /* fmul */ \
+ 1, /* dmul */ \
+ 1, /* idiv */ \
+ 1, /* ldiv */ \
+ 1, /* fdiv */ \
+ 1, /* ddiv */ \
+ 1, /* irem */ \
+ 1, /* lrem */ \
+ 1, /* frem */ \
+ 1, /* drem */ \
+ 1, /* ineg */ \
+ 1, /* lneg */ \
+ 1, /* fneg */ \
+ 1, /* dneg */ \
+ 1, /* ishl */ \
+ 1, /* lshl */ \
+ 1, /* ishr */ \
+ 1, /* lshr */ \
+ 1, /* iushr */ \
+ 1, /* lushr */ \
+ 1, /* iand */ \
+ 1, /* land */ \
+ 1, /* ior */ \
+ 1, /* lor */ \
+ 1, /* ixor */ \
+ 1, /* lxor */ \
+ 3, /* iinc */ \
+ 1, /* i2l */ \
+ 1, /* i2f */ \
+ 1, /* i2d */ \
+ 1, /* l2i */ \
+ 1, /* l2f */ \
+ 1, /* l2d */ \
+ 1, /* f2i */ \
+ 1, /* f2l */ \
+ 1, /* f2d */ \
+ 1, /* d2i */ \
+ 1, /* d2l */ \
+ 1, /* d2f */ \
+ 1, /* i2b */ \
+ 1, /* i2c */ \
+ 1, /* i2s */ \
+ 1, /* lcmp */ \
+ 1, /* fcmpl */ \
+ 1, /* fcmpg */ \
+ 1, /* dcmpl */ \
+ 1, /* dcmpg */ \
+ 3, /* ifeq */ \
+ 3, /* ifne */ \
+ 3, /* iflt */ \
+ 3, /* ifge */ \
+ 3, /* ifgt */ \
+ 3, /* ifle */ \
+ 3, /* if_icmpeq */ \
+ 3, /* if_icmpne */ \
+ 3, /* if_icmplt */ \
+ 3, /* if_icmpge */ \
+ 3, /* if_icmpgt */ \
+ 3, /* if_icmple */ \
+ 3, /* if_acmpeq */ \
+ 3, /* if_acmpne */ \
+ 3, /* goto */ \
+ 3, /* jsr */ \
+ 2, /* ret */ \
+ 99, /* tableswitch */ \
+ 99, /* lookupswitch */ \
+ 1, /* ireturn */ \
+ 1, /* lreturn */ \
+ 1, /* freturn */ \
+ 1, /* dreturn */ \
+ 1, /* areturn */ \
+ 1, /* return */ \
+ 3, /* getstatic */ \
+ 3, /* putstatic */ \
+ 3, /* getfield */ \
+ 3, /* putfield */ \
+ 3, /* invokevirtual */ \
+ 3, /* invokespecial */ \
+ 3, /* invokestatic */ \
+ 5, /* invokeinterface */ \
+ 5, /* invokedynamic */ \
+ 3, /* new */ \
+ 2, /* newarray */ \
+ 3, /* anewarray */ \
+ 1, /* arraylength */ \
+ 1, /* athrow */ \
+ 3, /* checkcast */ \
+ 3, /* instanceof */ \
+ 1, /* monitorenter */ \
+ 1, /* monitorexit */ \
+ 0, /* wide */ \
+ 4, /* multianewarray */ \
+ 3, /* ifnull */ \
+ 3, /* ifnonnull */ \
+ 5, /* goto_w */ \
+ 5 /* jsr_w */ \
+}
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* CLASSFILE_CONSTANTS */
--- a/src/java.base/share/native/libjava/Reflection.c Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/native/libjava/Reflection.c Thu Jan 18 18:58:46 2018 +0000
@@ -30,13 +30,7 @@
JNIEXPORT jclass JNICALL
Java_jdk_internal_reflect_Reflection_getCallerClass__(JNIEnv *env, jclass unused)
{
- return JVM_GetCallerClass(env, JVM_CALLER_DEPTH);
-}
-
-JNIEXPORT jclass JNICALL
-Java_jdk_internal_reflect_Reflection_getCallerClass__I(JNIEnv *env, jclass unused, jint depth)
-{
- return JVM_GetCallerClass(env, depth);
+ return JVM_GetCallerClass(env);
}
JNIEXPORT jint JNICALL
--- a/src/java.base/share/native/libjava/System.c Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.base/share/native/libjava/System.c Thu Jan 18 18:58:46 2018 +0000
@@ -119,9 +119,6 @@
#define VENDOR_URL_BUG "http://bugreport.java.com/bugreport/"
#endif
-#define JAVA_MAX_SUPPORTED_VERSION 54
-#define JAVA_MAX_SUPPORTED_MINOR_VERSION 0
-
#ifdef JAVA_SPECIFICATION_VENDOR /* Third party may NOT overwrite this. */
#error "ERROR: No override of JAVA_SPECIFICATION_VENDOR is allowed"
#else
@@ -227,8 +224,8 @@
PUTPROP(props, "java.vendor.url", VENDOR_URL);
PUTPROP(props, "java.vendor.url.bug", VENDOR_URL_BUG);
- jio_snprintf(buf, sizeof(buf), "%d.%d", JAVA_MAX_SUPPORTED_VERSION,
- JAVA_MAX_SUPPORTED_MINOR_VERSION);
+ jio_snprintf(buf, sizeof(buf), "%d.%d", JVM_CLASSFILE_MAJOR_VERSION,
+ JVM_CLASSFILE_MINOR_VERSION);
PUTPROP(props, "java.class.version", buf);
if (sprops->awt_toolkit) {
--- a/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java Thu Jan 18 18:58:46 2018 +0000
@@ -57,6 +57,7 @@
* 1.8: lambda expressions and default methods
* 9: modules, small cleanups to 1.7 and 1.8 changes
* 10: local-variable type inference (var)
+ * 11: to be determined changes
*/
/**
@@ -162,7 +163,15 @@
*
* @since 10
*/
- RELEASE_10;
+ RELEASE_10,
+
+ /**
+ * The version recognized by the Java Platform, Standard Edition
+ * 11.
+ *
+ * @since 11
+ */
+ RELEASE_11;
// Note that when adding constants for newer releases, the
// behavior of latest() and latestSupported() must be updated too.
@@ -173,7 +182,7 @@
* @return the latest source version that can be modeled
*/
public static SourceVersion latest() {
- return RELEASE_10;
+ return RELEASE_11;
}
private static final SourceVersion latestSupported = getLatestSupported();
@@ -183,6 +192,8 @@
String specVersion = System.getProperty("java.specification.version");
switch (specVersion) {
+ case "11":
+ return RELEASE_11;
case "10":
return RELEASE_10;
case "9":
--- a/src/java.compiler/share/classes/javax/tools/FileManagerUtils.java Thu Jan 18 09:01:00 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.tools;
-
-import java.io.File;
-import java.nio.file.Path;
-import java.util.Iterator;
-
-/**
- * Package-private utility methods to convert between files and paths.
- *
- * @since 9
- */
-class FileManagerUtils {
- private FileManagerUtils() { }
-
- static Iterable<Path> asPaths(final Iterable<? extends File> files) {
- return () -> new Iterator<Path>() {
- Iterator<? extends File> iter = files.iterator();
-
- @Override
- public boolean hasNext() {
- return iter.hasNext();
- }
-
- @Override
- public Path next() {
- return iter.next().toPath();
- }
- };
- }
-
- static Iterable<File> asFiles(final Iterable<? extends Path> paths) {
- return () -> new Iterator<File>() {
- Iterator<? extends Path> iter = paths.iterator();
-
- @Override
- public boolean hasNext() {
- return iter.hasNext();
- }
-
- @Override
- public File next() {
- Path p = iter.next();
- try {
- return p.toFile();
- } catch (UnsupportedOperationException e) {
- throw new IllegalArgumentException(p.toString(), e);
- }
- }
- };
- }
-}
--- a/src/java.compiler/share/classes/javax/tools/StandardJavaFileManager.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.compiler/share/classes/javax/tools/StandardJavaFileManager.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,8 +30,7 @@
import java.nio.file.Path;
import java.util.Arrays;
import java.util.Collection;
-
-import static javax.tools.FileManagerUtils.*;
+import java.util.Iterator;
/**
* File manager based on {@linkplain File java.io.File} and {@linkplain Path java.nio.file.Path}.
@@ -447,4 +446,42 @@
* @since 9
*/
default void setPathFactory(PathFactory f) { }
+
+
+ private static Iterable<Path> asPaths(final Iterable<? extends File> files) {
+ return () -> new Iterator<Path>() {
+ Iterator<? extends File> iter = files.iterator();
+
+ @Override
+ public boolean hasNext() {
+ return iter.hasNext();
+ }
+
+ @Override
+ public Path next() {
+ return iter.next().toPath();
+ }
+ };
+ }
+
+ private static Iterable<File> asFiles(final Iterable<? extends Path> paths) {
+ return () -> new Iterator<File>() {
+ Iterator<? extends Path> iter = paths.iterator();
+
+ @Override
+ public boolean hasNext() {
+ return iter.hasNext();
+ }
+
+ @Override
+ public File next() {
+ Path p = iter.next();
+ try {
+ return p.toFile();
+ } catch (UnsupportedOperationException e) {
+ throw new IllegalArgumentException(p.toString(), e);
+ }
+ }
+ };
+ }
}
--- a/src/java.desktop/share/classes/java/awt/Toolkit.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.desktop/share/classes/java/awt/Toolkit.java Thu Jan 18 18:58:46 2018 +0000
@@ -678,6 +678,11 @@
* If the connection to the specified URL requires
* either {@code URLPermission} or {@code SocketPermission},
* then {@code URLPermission} is used for security checks.
+ * For compatibility with pre-1.2 security managers, if the access
+ * is denied with {@code FilePermission} or {@code SocketPermission},
+ * the method throws the {@code SecurityException}
+ * if the corresponding 1.1-style SecurityManager.checkXXX method
+ * also denies permission.
* @param url the URL to use in fetching the pixel data.
* @return an image which gets its pixel data from
* the specified URL.
@@ -719,6 +724,11 @@
* If the connection to the specified URL requires
* either {@code URLPermission} or {@code SocketPermission},
* then {@code URLPermission} is used for security checks.
+ * For compatibility with pre-1.2 security managers, if the access
+ * is denied with {@code FilePermission} or {@code SocketPermission},
+ * the method throws {@code SecurityException}
+ * if the corresponding 1.1-style SecurityManager.checkXXX method
+ * also denies permission.
* @param url the URL to use in fetching the pixel data.
* @return an image which gets its pixel data from
* the specified URL.
--- a/src/java.rmi/share/classes/sun/rmi/server/resources/rmid.properties Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.rmi/share/classes/sun/rmi/server/resources/rmid.properties Thu Jan 18 18:58:46 2018 +0000
@@ -1,6 +1,6 @@
#
#
-# Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@
# {0} = the (string) illegal argument in question
rmid.syntax.illegal.option=\
- illegal option: {0}
+ invalid option: {0}
# {0} = the (string) reason text that came with a thrown exception
# "Activation.main" should not be translated, because it's a codepoint
--- a/src/java.scripting/share/classes/com/sun/tools/script/shell/Main.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.scripting/share/classes/com/sun/tools/script/shell/Main.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -122,7 +122,11 @@
}
}
continue;
- } else if (arg.equals("-?") || arg.equals("-help")) {
+ } else if (arg.equals("-?") ||
+ arg.equals("-h") ||
+ arg.equals("--help") ||
+ // -help: legacy.
+ arg.equals("-help")) {
usage(EXIT_SUCCESS);
} else if (arg.equals("-e")) {
seenScript = true;
--- a/src/java.scripting/share/classes/com/sun/tools/script/shell/messages.properties Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.scripting/share/classes/com/sun/tools/script/shell/messages.properties Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -55,8 +55,7 @@
\ \-f <script file> Evaluate given script file \n\
\ \-f - Interactive mode, read script from standard input \n\
\ \ If this is used, this should be the last -f option \n\
-\ \-help Print this usage message and exit \n\
-\ \-? Print this usage message and exit \n\
+\ \-? -h --help -help Print this help message and exit \n\
\ \-q List all scripting engines available and exit \n\
\ \n\
If [arguments..] are present and if no -e or -f option is used, then first\n\
--- a/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/KinitOptions.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/KinitOptions.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -137,7 +137,11 @@
lifetime = getTime(Config.duration(args[++i]));
} else if (args[i].equals("-r")) {
renewable_lifetime = getTime(Config.duration(args[++i]));
- } else if (args[i].equalsIgnoreCase("-help")) {
+ } else if (args[i].equalsIgnoreCase("-?") ||
+ args[i].equalsIgnoreCase("-h") ||
+ args[i].equalsIgnoreCase("--help") ||
+ // -help: legacy.
+ args[i].equalsIgnoreCase("-help")) {
printHelp();
System.exit(0);
} else if (p == null) { // Haven't yet processed a "principal"
--- a/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Klist.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Klist.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -133,6 +133,12 @@
void processArgs(String[] args) {
Character arg;
for (int i = 0; i < args.length; i++) {
+ if (args[i].equals("-?") ||
+ args[i].equals("-h") ||
+ args[i].equals("--help")) {
+ printHelp();
+ System.exit(0);
+ }
if ((args[i].length() >= 2) && (args[i].startsWith("-"))) {
arg = Character.valueOf(args[i].charAt(1));
switch (arg.charValue()) {
@@ -350,7 +356,5 @@
System.out.println("\t-t \t shows keytab entry timestamps");
System.out.println("\t-K \t shows keytab entry key value");
System.out.println("\t-e \t shows keytab entry key type");
- System.out.println("\nUsage: java sun.security.krb5.tools.Klist " +
- "-help for help.");
}
}
--- a/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Ktab.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Ktab.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -72,8 +72,14 @@
*/
public static void main(String[] args) {
Ktab ktab = new Ktab();
- if ((args.length == 1) && (args[0].equalsIgnoreCase("-help"))) {
+ if ((args.length == 1) &&
+ ((args[0].equalsIgnoreCase("-?")) ||
+ (args[0].equalsIgnoreCase("-h")) ||
+ (args[0].equalsIgnoreCase("--help")) ||
+ // -help: legacy.
+ (args[0].equalsIgnoreCase("-help")))) {
ktab.printHelp();
+ System.exit(0);
return;
} else if ((args == null) || (args.length == 0)) {
ktab.action = 'l';
--- a/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/Options.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/Options.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -227,7 +227,7 @@
task.options.verbose = true;
task.options.debug = true;
}
- }, new Option(" --help Print this usage message", false, "--help") {
+ }, new Option(" -? -h --help Print this help message", false, "--help", "-h", "-?") {
@Override
void process(Main task, String opt, String arg) {
task.options.help = true;
--- a/src/jdk.attach/aix/classes/sun/tools/attach/VirtualMachineImpl.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.attach/aix/classes/sun/tools/attach/VirtualMachineImpl.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -46,9 +46,7 @@
// will not be able to find all Hotspot processes.
// Any changes to this needs to be synchronized with HotSpot.
private static final String tmpdir = "/tmp";
-
- // The patch to the socket file created by the target VM
- String path;
+ String socket_path;
/**
* Attaches to the target VM
@@ -69,8 +67,9 @@
// Find the socket file. If not found then we attempt to start the
// attach mechanism in the target VM by sending it a QUIT signal.
// Then we attempt to find the socket file again.
- path = findSocketFile(pid);
- if (path == null) {
+ File socket_file = new File(tmpdir, ".java_pid" + pid);
+ socket_path = socket_file.getPath();
+ if (!socket_file.exists()) {
File f = createAttachFile(pid);
try {
sendQuitTo(pid);
@@ -86,19 +85,19 @@
try {
Thread.sleep(delay);
} catch (InterruptedException x) { }
- path = findSocketFile(pid);
time_spend += delay;
- if (time_spend > timeout/2 && path == null) {
+ if (time_spend > timeout/2 && !socket_file.exists()) {
// Send QUIT again to give target VM the last chance to react
sendQuitTo(pid);
}
- } while (time_spend <= timeout && path == null);
- if (path == null) {
+ } while (time_spend <= timeout && !socket_file.exists());
+ if (!socket_file.exists()) {
throw new AttachNotSupportedException(
String.format("Unable to open socket file %s: " +
"target process %d doesn't respond within %dms " +
- "or HotSpot VM not loaded", f.getPath(), pid, time_spend));
+ "or HotSpot VM not loaded", socket_path, pid,
+ time_spend));
}
} finally {
f.delete();
@@ -107,14 +106,14 @@
// Check that the file owner/permission to avoid attaching to
// bogus process
- checkPermissions(path);
+ checkPermissions(socket_path);
// Check that we can connect to the process
// - this ensures we throw the permission denied error now rather than
// later when we attempt to enqueue a command.
int s = socket();
try {
- connect(s, path);
+ connect(s, socket_path);
} finally {
close(s);
}
@@ -125,8 +124,8 @@
*/
public void detach() throws IOException {
synchronized (this) {
- if (this.path != null) {
- this.path = null;
+ if (socket_path != null) {
+ socket_path = null;
}
}
}
@@ -144,12 +143,10 @@
assert args.length <= 3; // includes null
// did we detach?
- String p;
synchronized (this) {
- if (this.path == null) {
+ if (socket_path == null) {
throw new IOException("Detached from target VM");
}
- p = this.path;
}
// create UNIX socket
@@ -157,7 +154,7 @@
// connect to target VM
try {
- connect(s, p);
+ connect(s, socket_path);
} catch (IOException x) {
close(s);
throw x;
@@ -264,15 +261,6 @@
}
}
- // Return the socket file for the given process.
- private String findSocketFile(int pid) {
- File f = new File(tmpdir, ".java_pid" + pid);
- if (!f.exists()) {
- return null;
- }
- return f.getPath();
- }
-
// On Solaris/Linux/Aix a simple handshake is used to start the attach mechanism
// if not already started. The client creates a .attach_pid<pid> file in the
// target VM's working directory (or temp directory), and the SIGQUIT handler
--- a/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java Thu Jan 18 18:58:46 2018 +0000
@@ -47,10 +47,7 @@
// will not be able to find all Hotspot processes.
// Any changes to this needs to be synchronized with HotSpot.
private static final String tmpdir = "/tmp";
-
- // The patch to the socket file created by the target VM
- String path;
-
+ String socket_path;
/**
* Attaches to the target VM
*/
@@ -73,8 +70,9 @@
// Find the socket file. If not found then we attempt to start the
// attach mechanism in the target VM by sending it a QUIT signal.
// Then we attempt to find the socket file again.
- path = findSocketFile(pid, ns_pid);
- if (path == null) {
+ File socket_file = findSocketFile(pid, ns_pid);
+ socket_path = socket_file.getPath();
+ if (!socket_file.exists()) {
File f = createAttachFile(pid, ns_pid);
try {
sendQuitTo(pid);
@@ -90,19 +88,19 @@
try {
Thread.sleep(delay);
} catch (InterruptedException x) { }
- path = findSocketFile(pid, ns_pid);
time_spend += delay;
- if (time_spend > timeout/2 && path == null) {
+ if (time_spend > timeout/2 && !socket_file.exists()) {
// Send QUIT again to give target VM the last chance to react
sendQuitTo(pid);
}
- } while (time_spend <= timeout && path == null);
- if (path == null) {
+ } while (time_spend <= timeout && !socket_file.exists());
+ if (!socket_file.exists()) {
throw new AttachNotSupportedException(
String.format("Unable to open socket file %s: " +
"target process %d doesn't respond within %dms " +
- "or HotSpot VM not loaded", f.getPath(), pid, time_spend));
+ "or HotSpot VM not loaded", socket_path, pid,
+ time_spend));
}
} finally {
f.delete();
@@ -111,14 +109,14 @@
// Check that the file owner/permission to avoid attaching to
// bogus process
- checkPermissions(path);
+ checkPermissions(socket_path);
// Check that we can connect to the process
// - this ensures we throw the permission denied error now rather than
// later when we attempt to enqueue a command.
int s = socket();
try {
- connect(s, path);
+ connect(s, socket_path);
} finally {
close(s);
}
@@ -129,8 +127,8 @@
*/
public void detach() throws IOException {
synchronized (this) {
- if (this.path != null) {
- this.path = null;
+ if (socket_path != null) {
+ socket_path = null;
}
}
}
@@ -148,12 +146,10 @@
assert args.length <= 3; // includes null
// did we detach?
- String p;
synchronized (this) {
- if (this.path == null) {
+ if (socket_path == null) {
throw new IOException("Detached from target VM");
}
- p = this.path;
}
// create UNIX socket
@@ -161,7 +157,7 @@
// connect to target VM
try {
- connect(s, p);
+ connect(s, socket_path);
} catch (IOException x) {
close(s);
throw x;
@@ -257,8 +253,9 @@
if ((off < 0) || (off > bs.length) || (len < 0) ||
((off + len) > bs.length) || ((off + len) < 0)) {
throw new IndexOutOfBoundsException();
- } else if (len == 0)
+ } else if (len == 0) {
return 0;
+ }
return VirtualMachineImpl.read(s, bs, off, len);
}
@@ -269,16 +266,12 @@
}
// Return the socket file for the given process.
- private String findSocketFile(int pid, int ns_pid) {
+ private File findSocketFile(int pid, int ns_pid) {
// A process may not exist in the same mount namespace as the caller.
// Instead, attach relative to the target root filesystem as exposed by
// procfs regardless of namespaces.
String root = "/proc/" + pid + "/root/" + tmpdir;
- File f = new File(root, ".java_pid" + ns_pid);
- if (!f.exists()) {
- return null;
- }
- return f.getPath();
+ return new File(root, ".java_pid" + ns_pid);
}
// On Solaris/Linux a simple handshake is used to start the attach mechanism
--- a/src/jdk.attach/macosx/classes/sun/tools/attach/VirtualMachineImpl.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.attach/macosx/classes/sun/tools/attach/VirtualMachineImpl.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, 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
@@ -45,9 +45,7 @@
// the latter can be changed by the user.
// Any changes to this needs to be synchronized with HotSpot.
private static final String tmpdir;
-
- // The patch to the socket file created by the target VM
- String path;
+ String socket_path;
/**
* Attaches to the target VM
@@ -68,8 +66,9 @@
// Find the socket file. If not found then we attempt to start the
// attach mechanism in the target VM by sending it a QUIT signal.
// Then we attempt to find the socket file again.
- path = findSocketFile(pid);
- if (path == null) {
+ File socket_file = new File(tmpdir, ".java_pid" + pid);
+ socket_path = socket_file.getPath();
+ if (!socket_file.exists()) {
File f = createAttachFile(pid);
try {
sendQuitTo(pid);
@@ -85,19 +84,19 @@
try {
Thread.sleep(delay);
} catch (InterruptedException x) { }
- path = findSocketFile(pid);
time_spend += delay;
- if (time_spend > timeout/2 && path == null) {
+ if (time_spend > timeout/2 && !socket_file.exists()) {
// Send QUIT again to give target VM the last chance to react
sendQuitTo(pid);
}
- } while (time_spend <= timeout && path == null);
- if (path == null) {
+ } while (time_spend <= timeout && !socket_file.exists());
+ if (!socket_file.exists()) {
throw new AttachNotSupportedException(
String.format("Unable to open socket file %s: " +
- "target process %d doesn't respond within %dms " +
- "or HotSpot VM not loaded", f.getPath(), pid, time_spend));
+ "target process %d doesn't respond within %dms " +
+ "or HotSpot VM not loaded", socket_path,
+ pid, time_spend));
}
} finally {
f.delete();
@@ -106,14 +105,14 @@
// Check that the file owner/permission to avoid attaching to
// bogus process
- checkPermissions(path);
+ checkPermissions(socket_path);
// Check that we can connect to the process
// - this ensures we throw the permission denied error now rather than
// later when we attempt to enqueue a command.
int s = socket();
try {
- connect(s, path);
+ connect(s, socket_path);
} finally {
close(s);
}
@@ -124,8 +123,8 @@
*/
public void detach() throws IOException {
synchronized (this) {
- if (this.path != null) {
- this.path = null;
+ if (socket_path != null) {
+ socket_path = null;
}
}
}
@@ -143,12 +142,10 @@
assert args.length <= 3; // includes null
// did we detach?
- String p;
synchronized (this) {
- if (this.path == null) {
+ if (socket_path == null) {
throw new IOException("Detached from target VM");
}
- p = this.path;
}
// create UNIX socket
@@ -156,7 +153,7 @@
// connect to target VM
try {
- connect(s, p);
+ connect(s, socket_path);
} catch (IOException x) {
close(s);
throw x;
@@ -264,14 +261,6 @@
}
}
- // Return the socket file for the given process.
- // Checks temp directory for .java_pid<pid>.
- private String findSocketFile(int pid) {
- String fn = ".java_pid" + pid;
- File f = new File(tmpdir, fn);
- return f.exists() ? f.getPath() : null;
- }
-
/*
* Write/sends the given to the target VM. String is transmitted in
* UTF-8 encoding.
@@ -282,7 +271,7 @@
try {
b = s.getBytes("UTF-8");
} catch (java.io.UnsupportedEncodingException x) {
- throw new InternalError();
+ throw new InternalError(x);
}
VirtualMachineImpl.write(fd, b, 0, b.length);
}
--- a/src/jdk.attach/solaris/classes/sun/tools/attach/VirtualMachineImpl.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.attach/solaris/classes/sun/tools/attach/VirtualMachineImpl.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -47,6 +47,7 @@
// door descriptor;
private int fd = -1;
+ String socket_path;
/**
* Attaches to the target VM
@@ -60,7 +61,7 @@
try {
pid = Integer.parseInt(vmid);
} catch (NumberFormatException x) {
- throw new AttachNotSupportedException("invalid process identifier");
+ throw new AttachNotSupportedException("Invalid process identifier");
}
// Opens the door file to the target VM. If the file is not
@@ -100,7 +101,7 @@
throw new AttachNotSupportedException(
String.format("Unable to open door %s: " +
"target process %d doesn't respond within %dms " +
- "or HotSpot VM not loaded", f.getPath(), pid, time_spend));
+ "or HotSpot VM not loaded", socket_path, pid, time_spend));
}
} finally {
f.delete();
@@ -210,13 +211,13 @@
// The door is attached to .java_pid<pid> in the temporary directory.
private int openDoor(int pid) throws IOException {
- String path = tmpdir + "/.java_pid" + pid;;
- fd = open(path);
+ socket_path = tmpdir + "/.java_pid" + pid;
+ fd = open(socket_path);
// Check that the file owner/permission to avoid attaching to
// bogus process
try {
- checkPermissions(path);
+ checkPermissions(socket_path);
} catch (IOException ioe) {
close(fd);
throw ioe;
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java Thu Jan 18 18:58:46 2018 +0000
@@ -78,8 +78,11 @@
/** 1.9 modularity. */
JDK9("9"),
- /** 1.10 covers the to be determined language features that will be added in JDK 10. */
- JDK10("10");
+ /** 1.10 local-variable type inference (var). */
+ JDK10("10"),
+
+ /** 1.11 covers the to be determined language features that will be added in JDK 11. */
+ JDK11("11");
private static final Context.Key<Source> sourceKey = new Context.Key<>();
@@ -108,6 +111,7 @@
tab.put("1.8", JDK8); // Make 8 an alias for 1.8
tab.put("1.9", JDK9); // Make 9 an alias for 1.9
tab.put("1.10", JDK10); // Make 10 an alias for 1.10
+ // Decline to make 1.11 an alias for 11.
}
private Source(String name) {
@@ -125,6 +129,7 @@
}
public Target requiredTarget() {
+ if (this.compareTo(JDK11) >= 0) return Target.JDK1_11;
if (this.compareTo(JDK10) >= 0) return Target.JDK1_10;
if (this.compareTo(JDK9) >= 0) return Target.JDK1_9;
if (this.compareTo(JDK8) >= 0) return Target.JDK1_8;
@@ -247,6 +252,8 @@
return RELEASE_9;
case JDK10:
return RELEASE_10;
+ case JDK11:
+ return RELEASE_11;
default:
return null;
}
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java Thu Jan 18 18:58:46 2018 +0000
@@ -1628,9 +1628,6 @@
/** The parameters of the method. */
public List<VarSymbol> params = null;
- /** The names of the parameters */
- public List<Name> savedParameterNames;
-
/** For an annotation type element, its default value if any.
* The value is null if none appeared in the method
* declaration.
@@ -1886,59 +1883,20 @@
public List<VarSymbol> params() {
owner.complete();
if (params == null) {
- // If ClassReader.saveParameterNames has been set true, then
- // savedParameterNames will be set to a list of names that
- // matches the types in type.getParameterTypes(). If any names
- // were not found in the class file, those names in the list will
- // be set to the empty name.
- // If ClassReader.saveParameterNames has been set false, then
- // savedParameterNames will be null.
- List<Name> paramNames = savedParameterNames;
- savedParameterNames = null;
- // discard the provided names if the list of names is the wrong size.
- if (paramNames == null || paramNames.size() != type.getParameterTypes().size()) {
- paramNames = List.nil();
- }
- ListBuffer<VarSymbol> buf = new ListBuffer<>();
- List<Name> remaining = paramNames;
- // assert: remaining and paramNames are both empty or both
- // have same cardinality as type.getParameterTypes()
+ ListBuffer<VarSymbol> newParams = new ListBuffer<>();
int i = 0;
for (Type t : type.getParameterTypes()) {
- Name paramName;
- if (remaining.isEmpty()) {
- // no names for any parameters available
- paramName = createArgName(i, paramNames);
- } else {
- paramName = remaining.head;
- remaining = remaining.tail;
- if (paramName.isEmpty()) {
- // no name for this specific parameter
- paramName = createArgName(i, paramNames);
- }
- }
- buf.append(new VarSymbol(PARAMETER, paramName, t, this));
- i++;
+ Name paramName = name.table.fromString("arg" + i);
+ VarSymbol param = new VarSymbol(PARAMETER, paramName, t, this);
+ newParams.append(param);
+
}
- params = buf.toList();
+ params = newParams.toList();
}
+ Assert.checkNonNull(params);
return params;
}
- // Create a name for the argument at position 'index' that is not in
- // the exclude list. In normal use, either no names will have been
- // provided, in which case the exclude list is empty, or all the names
- // will have been provided, in which case this method will not be called.
- private Name createArgName(int index, List<Name> exclude) {
- String prefix = "arg";
- while (true) {
- Name argName = name.table.fromString(prefix + index);
- if (!exclude.contains(argName))
- return argName;
- prefix += "$";
- }
- }
-
public Symbol asMemberOf(Type site, Types types) {
return new MethodSymbol(flags_field, name, types.memberType(site, this), owner);
}
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java Thu Jan 18 18:58:46 2018 +0000
@@ -366,7 +366,9 @@
@Override
Type speculativeType(Symbol msym, MethodResolutionPhase phase) {
- if (pertinentToApplicability) {
+ if (notPertinentToApplicability.contains(msym)) {
+ return super.speculativeType(msym, phase);
+ } else {
for (Map.Entry<ResultInfo, Type> _entry : speculativeTypes.entrySet()) {
DeferredAttrContext deferredAttrContext = _entry.getKey().checkContext.deferredAttrContext();
if (deferredAttrContext.phase == phase && deferredAttrContext.msym == msym) {
@@ -374,14 +376,14 @@
}
}
return Type.noType;
- } else {
- return super.speculativeType(msym, phase);
}
}
@Override
JCTree speculativeTree(DeferredAttrContext deferredAttrContext) {
- return pertinentToApplicability ? speculativeTree : super.speculativeTree(deferredAttrContext);
+ return notPertinentToApplicability.contains(deferredAttrContext.msym) ?
+ super.speculativeTree(deferredAttrContext) :
+ speculativeTree;
}
/**
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java Thu Jan 18 18:58:46 2018 +0000
@@ -1976,8 +1976,8 @@
types.covariantReturnType(rt2, rt1, types.noWarnings)) ||
checkCommonOverriderIn(s1,s2,site);
if (!compat) {
- log.error(pos, Errors.TypesIncompatibleDiffRet(t1, t2, s2.name +
- "(" + types.memberType(t2, s2).getParameterTypes() + ")"));
+ log.error(pos, Errors.TypesIncompatible(t1, t2,
+ Fragments.IncompatibleDiffRet(s2.name, types.memberType(t2, s2).getParameterTypes())));
return s2;
}
} else if (checkNameClash((ClassSymbol)site.tsym, s1, s2) &&
@@ -2563,20 +2563,22 @@
//strong semantics - issue an error if two sibling interfaces
//have two override-equivalent defaults - or if one is abstract
//and the other is default
- String errKey;
+ Fragment diagKey;
Symbol s1 = defaults.first();
Symbol s2;
if (defaults.size() > 1) {
- errKey = "types.incompatible.unrelated.defaults";
s2 = defaults.toList().tail.head;
+ diagKey = Fragments.IncompatibleUnrelatedDefaults(Kinds.kindName(site.tsym), site,
+ m.name, types.memberType(site, m).getParameterTypes(),
+ s1.location(), s2.location());
+
} else {
- errKey = "types.incompatible.abstract.default";
s2 = abstracts.first();
+ diagKey = Fragments.IncompatibleAbstractDefault(Kinds.kindName(site.tsym), site,
+ m.name, types.memberType(site, m).getParameterTypes(),
+ s1.location(), s2.location());
}
- log.error(pos, errKey,
- Kinds.kindName(site.tsym), site,
- m.name, types.memberType(site, m).getParameterTypes(),
- s1.location(), s2.location());
+ log.error(pos, Errors.TypesIncompatible(s1.location().type, s2.location().type, diagKey));
break;
}
}
@@ -3462,6 +3464,7 @@
types.hasSameArgs(sym.type, byName.type) ||
types.hasSameArgs(types.erasure(sym.type), types.erasure(byName.type)))) {
if ((sym.flags() & VARARGS) != (byName.flags() & VARARGS)) {
+ sym.flags_field |= CLASH;
varargsDuplicateError(pos, sym, byName);
return true;
} else if (sym.kind == MTH && !types.hasSameArgs(sym.type, byName.type, false)) {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java Thu Jan 18 18:58:46 2018 +0000
@@ -200,7 +200,7 @@
public JCExpression tree;
Env<AttrContext> env;
AttrMode mode;
- boolean pertinentToApplicability = true;
+ Set<Symbol> notPertinentToApplicability = new HashSet<>();
SpeculativeCache speculativeCache;
DeferredType(JCExpression tree, Env<AttrContext> env) {
@@ -319,7 +319,7 @@
resultInfo.checkContext.deferredAttrContext();
Assert.check(deferredAttrContext != emptyDeferredAttrContext);
if (deferredStuckPolicy.isStuck()) {
- pertinentToApplicability = false;
+ notPertinentToApplicability.add(deferredAttrContext.msym);
deferredAttrContext.addDeferredAttrNode(this, resultInfo, deferredStuckPolicy);
return Type.noType;
} else {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java Thu Jan 18 18:58:46 2018 +0000
@@ -1618,19 +1618,30 @@
if ((m1.flags() & BRIDGE) != (m2.flags() & BRIDGE))
return ((m1.flags() & BRIDGE) != 0) ? m2 : m1;
+ if (m1.baseSymbol() == m2.baseSymbol()) {
+ // this is the same imported symbol which has been cloned twice.
+ // Return the first one (either will do).
+ return m1;
+ }
+
// if one overrides or hides the other, use it
TypeSymbol m1Owner = (TypeSymbol)m1.owner;
TypeSymbol m2Owner = (TypeSymbol)m2.owner;
- if (types.asSuper(m1Owner.type, m2Owner) != null &&
- ((m1.owner.flags_field & INTERFACE) == 0 ||
- (m2.owner.flags_field & INTERFACE) != 0) &&
- m1.overrides(m2, m1Owner, types, false))
- return m1;
- if (types.asSuper(m2Owner.type, m1Owner) != null &&
- ((m2.owner.flags_field & INTERFACE) == 0 ||
- (m1.owner.flags_field & INTERFACE) != 0) &&
- m2.overrides(m1, m2Owner, types, false))
- return m2;
+ // the two owners can never be the same if the target methods are compiled from source,
+ // but we need to protect against cases where the methods are defined in some classfile
+ // and make sure we issue an ambiguity error accordingly (by skipping the logic below).
+ if (m1Owner != m2Owner) {
+ if (types.asSuper(m1Owner.type, m2Owner) != null &&
+ ((m1.owner.flags_field & INTERFACE) == 0 ||
+ (m2.owner.flags_field & INTERFACE) != 0) &&
+ m1.overrides(m2, m1Owner, types, false))
+ return m1;
+ if (types.asSuper(m2Owner.type, m1Owner) != null &&
+ ((m2.owner.flags_field & INTERFACE) == 0 ||
+ (m1.owner.flags_field & INTERFACE) != 0) &&
+ m2.overrides(m1, m2Owner, types, false))
+ return m2;
+ }
boolean m1Abstract = (m1.flags() & ABSTRACT) != 0;
boolean m2Abstract = (m2.flags() & ABSTRACT) != 0;
if (m1Abstract && !m2Abstract) return m2;
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
import java.io.File;
import java.io.IOException;
+import java.lang.module.Configuration;
+import java.lang.module.ModuleFinder;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
@@ -77,11 +79,6 @@
import com.sun.tools.javac.util.DefinedBy.Api;
import com.sun.tools.javac.util.List;
import com.sun.tools.javac.util.ListBuffer;
-import com.sun.tools.javac.util.JDK9Wrappers.Configuration;
-import com.sun.tools.javac.util.JDK9Wrappers.Layer;
-import com.sun.tools.javac.util.JDK9Wrappers.ModuleFinder;
-import com.sun.tools.javac.util.JDK9Wrappers.Module;
-import com.sun.tools.javac.util.JDK9Wrappers.ServiceLoaderHelper;
import static java.nio.file.FileVisitOption.FOLLOW_LINKS;
@@ -980,14 +977,14 @@
public <S> ServiceLoader<S> getServiceLoader(Location location, Class<S> service) throws IOException {
nullCheck(location);
nullCheck(service);
- Module.getModule(getClass()).addUses(service);
+ getClass().getModule().addUses(service);
if (location.isModuleOrientedLocation()) {
Collection<Path> paths = locations.getLocation(location);
ModuleFinder finder = ModuleFinder.of(paths.toArray(new Path[paths.size()]));
- Layer bootLayer = Layer.boot();
+ ModuleLayer bootLayer = ModuleLayer.boot();
Configuration cf = bootLayer.configuration().resolveAndBind(ModuleFinder.of(), finder, Collections.emptySet());
- Layer layer = bootLayer.defineModulesWithOneLoader(cf, ClassLoader.getSystemClassLoader());
- return ServiceLoaderHelper.load(layer, service);
+ ModuleLayer layer = bootLayer.defineModulesWithOneLoader(cf, ClassLoader.getSystemClassLoader());
+ return ServiceLoader.load(layer, service);
} else {
return ServiceLoader.load(service, getClassLoader(location));
}
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -77,6 +77,8 @@
import javax.tools.StandardJavaFileManager.PathFactory;
import javax.tools.StandardLocation;
+import jdk.internal.jmod.JmodFile;
+
import com.sun.tools.javac.code.Lint;
import com.sun.tools.javac.code.Lint.LintCategory;
import com.sun.tools.javac.main.Option;
@@ -84,7 +86,6 @@
import com.sun.tools.javac.resources.CompilerProperties.Warnings;
import com.sun.tools.javac.util.DefinedBy;
import com.sun.tools.javac.util.DefinedBy.Api;
-import com.sun.tools.javac.util.JDK9Wrappers;
import com.sun.tools.javac.util.ListBuffer;
import com.sun.tools.javac.util.Log;
import com.sun.tools.javac.jvm.ModuleNameReader;
@@ -1451,7 +1452,7 @@
if (p.getFileName().toString().endsWith(".jmod")) {
try {
// check if the JMOD file is valid
- JDK9Wrappers.JmodFile.checkMagic(p);
+ JmodFile.checkMagic(p);
// No JMOD file system. Use JarFileSystem to
// workaround for now
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassFile.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassFile.java Thu Jan 18 18:58:46 2018 +0000
@@ -111,7 +111,8 @@
V51(51, 0), // JDK 1.7
V52(52, 0), // JDK 1.8: lambda, type annos, param names
V53(53, 0), // JDK 1.9: modules, indy string concat
- V54(54, 0); // JDK 10
+ V54(54, 0), // JDK 10
+ V55(55, 0); // JDK 11: constant dynamic
Version(int major, int minor) {
this.major = major;
this.minor = minor;
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java Thu Jan 18 18:58:46 2018 +0000
@@ -193,6 +193,26 @@
int[] parameterNameIndices;
/**
+ * A table to hold annotations for method parameters.
+ */
+ ParameterAnnotations[] parameterAnnotations;
+
+ /**
+ * A holder for parameter annotations.
+ */
+ static class ParameterAnnotations {
+ List<CompoundAnnotationProxy> proxies;
+
+ void add(List<CompoundAnnotationProxy> newAnnotations) {
+ if (proxies == null) {
+ proxies = newAnnotations;
+ } else {
+ proxies = proxies.prependList(newAnnotations);
+ }
+ }
+ }
+
+ /**
* Whether or not any parameter names have been found.
*/
boolean haveParameterNameIndices;
@@ -1218,7 +1238,7 @@
new AttributeReader(names.RuntimeInvisibleParameterAnnotations, V49, CLASS_OR_MEMBER_ATTRIBUTE) {
protected void read(Symbol sym, int attrLen) {
- attachParameterAnnotations(sym);
+ readParameterAnnotations(sym);
}
},
@@ -1230,7 +1250,7 @@
new AttributeReader(names.RuntimeVisibleParameterAnnotations, V49, CLASS_OR_MEMBER_ATTRIBUTE) {
protected void read(Symbol sym, int attrLen) {
- attachParameterAnnotations(sym);
+ readParameterAnnotations(sym);
}
},
@@ -1288,10 +1308,14 @@
int numEntries = nextByte();
parameterNameIndices = new int[numEntries];
haveParameterNameIndices = true;
+ int index = 0;
for (int i = 0; i < numEntries; i++) {
int nameIndex = nextChar();
int flags = nextChar();
- parameterNameIndices[i] = nameIndex;
+ if ((flags & (Flags.MANDATED | Flags.SYNTHETIC)) != 0) {
+ continue;
+ }
+ parameterNameIndices[index++] = nameIndex;
}
}
bp = newbp;
@@ -1580,65 +1604,82 @@
* Reading Java-language annotations
***********************************************************************/
+ /**
+ * Save annotations.
+ */
+ List<CompoundAnnotationProxy> readAnnotations() {
+ int numAttributes = nextChar();
+ ListBuffer<CompoundAnnotationProxy> annotations = new ListBuffer<>();
+ for (int i = 0; i < numAttributes; i++) {
+ annotations.append(readCompoundAnnotation());
+ }
+ return annotations.toList();
+ }
+
/** Attach annotations.
*/
void attachAnnotations(final Symbol sym) {
- int numAttributes = nextChar();
- if (numAttributes != 0) {
- ListBuffer<CompoundAnnotationProxy> proxies = new ListBuffer<>();
- for (int i = 0; i<numAttributes; i++) {
- CompoundAnnotationProxy proxy = readCompoundAnnotation();
- if (proxy.type.tsym == syms.proprietaryType.tsym)
- sym.flags_field |= PROPRIETARY;
- else if (proxy.type.tsym == syms.profileType.tsym) {
- if (profile != Profile.DEFAULT) {
- for (Pair<Name,Attribute> v: proxy.values) {
- if (v.fst == names.value && v.snd instanceof Attribute.Constant) {
- Attribute.Constant c = (Attribute.Constant) v.snd;
- if (c.type == syms.intType && ((Integer) c.value) > profile.value) {
- sym.flags_field |= NOT_IN_PROFILE;
- }
+ attachAnnotations(sym, readAnnotations());
+ }
+
+ /**
+ * Attach annotations.
+ */
+ void attachAnnotations(final Symbol sym, List<CompoundAnnotationProxy> annotations) {
+ if (annotations.isEmpty()) {
+ return;
+ }
+ ListBuffer<CompoundAnnotationProxy> proxies = new ListBuffer<>();
+ for (CompoundAnnotationProxy proxy : annotations) {
+ if (proxy.type.tsym == syms.proprietaryType.tsym)
+ sym.flags_field |= PROPRIETARY;
+ else if (proxy.type.tsym == syms.profileType.tsym) {
+ if (profile != Profile.DEFAULT) {
+ for (Pair<Name, Attribute> v : proxy.values) {
+ if (v.fst == names.value && v.snd instanceof Attribute.Constant) {
+ Attribute.Constant c = (Attribute.Constant)v.snd;
+ if (c.type == syms.intType && ((Integer)c.value) > profile.value) {
+ sym.flags_field |= NOT_IN_PROFILE;
}
}
}
- } else {
- if (proxy.type.tsym == syms.annotationTargetType.tsym) {
- target = proxy;
- } else if (proxy.type.tsym == syms.repeatableType.tsym) {
- repeatable = proxy;
- } else if (proxy.type.tsym == syms.deprecatedType.tsym) {
- sym.flags_field |= (DEPRECATED | DEPRECATED_ANNOTATION);
- for (Pair<Name, Attribute> v : proxy.values) {
- if (v.fst == names.forRemoval && v.snd instanceof Attribute.Constant) {
- Attribute.Constant c = (Attribute.Constant) v.snd;
- if (c.type == syms.booleanType && ((Integer) c.value) != 0) {
- sym.flags_field |= DEPRECATED_REMOVAL;
- }
+ }
+ } else {
+ if (proxy.type.tsym == syms.annotationTargetType.tsym) {
+ target = proxy;
+ } else if (proxy.type.tsym == syms.repeatableType.tsym) {
+ repeatable = proxy;
+ } else if (proxy.type.tsym == syms.deprecatedType.tsym) {
+ sym.flags_field |= (DEPRECATED | DEPRECATED_ANNOTATION);
+ for (Pair<Name, Attribute> v : proxy.values) {
+ if (v.fst == names.forRemoval && v.snd instanceof Attribute.Constant) {
+ Attribute.Constant c = (Attribute.Constant)v.snd;
+ if (c.type == syms.booleanType && ((Integer)c.value) != 0) {
+ sym.flags_field |= DEPRECATED_REMOVAL;
}
}
}
-
- proxies.append(proxy);
}
+ proxies.append(proxy);
}
- annotate.normal(new AnnotationCompleter(sym, proxies.toList()));
}
+ annotate.normal(new AnnotationCompleter(sym, proxies.toList()));
}
- /** Attach parameter annotations.
+ /** Read parameter annotations.
*/
- void attachParameterAnnotations(final Symbol method) {
- final MethodSymbol meth = (MethodSymbol)method;
+ void readParameterAnnotations(Symbol meth) {
int numParameters = buf[bp++] & 0xFF;
- List<VarSymbol> parameters = meth.params();
- int pnum = 0;
- while (parameters.tail != null) {
- attachAnnotations(parameters.head);
- parameters = parameters.tail;
- pnum++;
+ if (parameterAnnotations == null) {
+ parameterAnnotations = new ParameterAnnotations[numParameters];
+ } else if (parameterAnnotations.length != numParameters) {
+ throw badClassFile("bad.runtime.invisible.param.annotations", meth);
}
- if (pnum != numParameters) {
- throw badClassFile("bad.runtime.invisible.param.annotations", meth);
+ for (int pnum = 0; pnum < numParameters; pnum++) {
+ if (parameterAnnotations[pnum] == null) {
+ parameterAnnotations[pnum] = new ParameterAnnotations();
+ }
+ parameterAnnotations[pnum].add(readAnnotations());
}
}
@@ -2403,8 +2444,7 @@
} finally {
currentOwner = prevOwner;
}
- if (saveParameterNames)
- setParameterNames(m, type);
+ setParameters(m, type);
if ((flags & VARARGS) != 0) {
final Type last = type.getParameterTypes().last();
@@ -2457,22 +2497,17 @@
}
/**
- * Set the parameter names for a symbol from the name index in the
- * parameterNameIndicies array. The type of the symbol may have changed
- * while reading the method attributes (see the Signature attribute).
- * This may be because of generic information or because anonymous
- * synthetic parameters were added. The original type (as read from
- * the method descriptor) is used to help guess the existence of
+ * Set the parameters for a method symbol, including any names and
+ * annotations that were read.
+ *
+ * <p>The type of the symbol may have changed while reading the
+ * method attributes (see the Signature attribute). This may be
+ * because of generic information or because anonymous synthetic
+ * parameters were added. The original type (as read from the
+ * method descriptor) is used to help guess the existence of
* anonymous synthetic parameters.
- * On completion, sym.savedParameter names will either be null (if
- * no parameter names were found in the class file) or will be set to a
- * list of names, one per entry in sym.type.getParameterTypes, with
- * any missing names represented by the empty name.
*/
- void setParameterNames(MethodSymbol sym, Type jvmType) {
- // if no names were found in the class file, there's nothing more to do
- if (!haveParameterNameIndices)
- return;
+ void setParameters(MethodSymbol sym, Type jvmType) {
// If we get parameter names from MethodParameters, then we
// don't need to skip.
int firstParam = 0;
@@ -2483,16 +2518,16 @@
// make a corresponding allowance here for the position of
// the first parameter. Note that this assumes the
// skipped parameter has a width of 1 -- i.e. it is not
- // a double width type (long or double.)
- if (sym.name == names.init && currentOwner.hasOuterInstance()) {
- // Sometimes anonymous classes don't have an outer
- // instance, however, there is no reliable way to tell so
- // we never strip this$n
- if (!currentOwner.name.isEmpty())
- firstParam += 1;
- }
+ // a double width type (long or double.)
+ if (sym.name == names.init && currentOwner.hasOuterInstance()) {
+ // Sometimes anonymous classes don't have an outer
+ // instance, however, there is no reliable way to tell so
+ // we never strip this$n
+ if (!currentOwner.name.isEmpty())
+ firstParam += 1;
+ }
- if (sym.type != jvmType) {
+ if (sym.type != jvmType) {
// reading the method attributes has caused the
// symbol's type to be changed. (i.e. the Signature
// attribute.) This may happen if there are hidden
@@ -2502,21 +2537,55 @@
// at the beginning, and so skip over them. The
// primary case for this is two hidden parameters
// passed into Enum constructors.
- int skip = Code.width(jvmType.getParameterTypes())
- - Code.width(sym.type.getParameterTypes());
- firstParam += skip;
- }
+ int skip = Code.width(jvmType.getParameterTypes())
+ - Code.width(sym.type.getParameterTypes());
+ firstParam += skip;
+ }
}
List<Name> paramNames = List.nil();
- int index = firstParam;
+ ListBuffer<VarSymbol> params = new ListBuffer<>();
+ int nameIndex = firstParam;
+ int annotationIndex = 0;
for (Type t: sym.type.getParameterTypes()) {
- int nameIdx = (index < parameterNameIndices.length
- ? parameterNameIndices[index] : 0);
- Name name = nameIdx == 0 ? names.empty : readName(nameIdx);
+ Name name = parameterName(nameIndex, paramNames);
paramNames = paramNames.prepend(name);
- index += sawMethodParameters ? 1 : Code.width(t);
+ VarSymbol param = new VarSymbol(PARAMETER, name, t, sym);
+ params.append(param);
+ if (parameterAnnotations != null) {
+ ParameterAnnotations annotations = parameterAnnotations[annotationIndex];
+ if (annotations != null && annotations.proxies != null
+ && !annotations.proxies.isEmpty()) {
+ annotate.normal(new AnnotationCompleter(param, annotations.proxies));
+ }
+ }
+ nameIndex += sawMethodParameters ? 1 : Code.width(t);
+ annotationIndex++;
+ }
+ if (parameterAnnotations != null && parameterAnnotations.length != annotationIndex) {
+ throw badClassFile("bad.runtime.invisible.param.annotations", sym);
}
- sym.savedParameterNames = paramNames.reverse();
+ Assert.checkNull(sym.params);
+ sym.params = params.toList();
+ parameterAnnotations = null;
+ parameterNameIndices = null;
+ }
+
+
+ // Returns the name for the parameter at position 'index', either using
+ // names read from the MethodParameters, or by synthesizing a name that
+ // is not on the 'exclude' list.
+ private Name parameterName(int index, List<Name> exclude) {
+ if (parameterNameIndices != null && index < parameterNameIndices.length
+ && parameterNameIndices[index] != 0) {
+ return readName(parameterNameIndices[index]);
+ }
+ String prefix = "arg";
+ while (true) {
+ Name argName = names.fromString(prefix + exclude.size());
+ if (!exclude.contains(argName))
+ return argName;
+ prefix += "$";
+ }
}
/**
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1678,7 +1678,7 @@
try {
writeClassFile(out, c);
if (verbose)
- log.printVerbose("wrote.file", outFile);
+ log.printVerbose("wrote.file", outFile.getName());
out.close();
out = null;
} finally {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Profile.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Profile.java Thu Jan 18 18:58:46 2018 +0000
@@ -40,9 +40,9 @@
* deletion without notice.</b>
*/
public enum Profile {
- COMPACT1("compact1", 1, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10),
- COMPACT2("compact2", 2, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10),
- COMPACT3("compact3", 3, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10),
+ COMPACT1("compact1", 1, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10, Target.JDK1_11),
+ COMPACT2("compact2", 2, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10, Target.JDK1_11),
+ COMPACT3("compact3", 3, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10, Target.JDK1_11),
DEFAULT {
@Override
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Target.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Target.java Thu Jan 18 18:58:46 2018 +0000
@@ -64,7 +64,10 @@
JDK1_9("1.9", 53, 0),
/** JDK 10. */
- JDK1_10("1.10", 54, 0);
+ JDK1_10("1.10", 54, 0),
+
+ /** JDK 11. */
+ JDK1_11("11", 55, 0);
private static final Context.Key<Target> targetKey = new Context.Key<>();
@@ -95,6 +98,7 @@
tab.put("8", JDK1_8);
tab.put("9", JDK1_9);
tab.put("10", JDK1_10);
+ tab.put("11", JDK1_11);
}
public final String name;
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
import java.io.FileWriter;
import java.io.PrintWriter;
+import java.lang.module.ModuleDescriptor;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -47,6 +48,8 @@
import javax.lang.model.SourceVersion;
+import jdk.internal.misc.VM;
+
import com.sun.tools.doclint.DocLint;
import com.sun.tools.javac.code.Lint;
import com.sun.tools.javac.code.Lint.LintCategory;
@@ -57,7 +60,6 @@
import com.sun.tools.javac.platform.PlatformProvider;
import com.sun.tools.javac.processing.JavacProcessingEnvironment;
import com.sun.tools.javac.util.Assert;
-import com.sun.tools.javac.util.JDK9Wrappers;
import com.sun.tools.javac.util.Log;
import com.sun.tools.javac.util.Log.PrefixKind;
import com.sun.tools.javac.util.Log.WriterKind;
@@ -360,7 +362,7 @@
},
// Note: -h is already taken for "native header output directory".
- HELP("--help -help", "opt.help", STANDARD, INFO) {
+ HELP("--help -help -?", "opt.help", STANDARD, INFO) {
@Override
public void process(OptionHelper helper, String option) throws InvalidValueException {
Log log = helper.getLog();
@@ -650,21 +652,11 @@
if (arg.isEmpty()) {
throw helper.newInvalidValueException("err.no.value.for.option", option);
} else {
+ // use official parser if available
try {
- Class.forName(JDK9Wrappers.ModuleDescriptor.Version.CLASSNAME);
- // use official parser if available
- try {
- JDK9Wrappers.ModuleDescriptor.Version.parse(arg);
- } catch (IllegalArgumentException e) {
- throw helper.newInvalidValueException("err.bad.value.for.option", option, arg);
- }
- } catch (ClassNotFoundException ex) {
- // fall-back to simplistic rules when running on older platform
- if (!(arg.charAt(0) >= '0' && arg.charAt(0) <= '9') ||
- arg.endsWith("-") ||
- arg.endsWith("+")) {
- throw helper.newInvalidValueException("err.bad.value.for.option", option, arg);
- }
+ ModuleDescriptor.Version.parse(arg);
+ } catch (IllegalArgumentException e) {
+ throw helper.newInvalidValueException("err.bad.value.for.option", option, arg);
}
}
super.process(helper, option, arg);
@@ -717,41 +709,36 @@
HIDDEN, BASIC) {
@Override
public void process(OptionHelper helper, String option) throws InvalidValueException {
- try {
- Class.forName(JDK9Wrappers.VMHelper.CLASSNAME);
- String[] runtimeArgs = JDK9Wrappers.VMHelper.getRuntimeArguments();
- for (String arg : runtimeArgs) {
- // Handle any supported runtime options; ignore all others.
- // The runtime arguments always use the single token form, e.g. "--name=value".
- for (Option o : getSupportedRuntimeOptions()) {
- if (o.matches(arg)) {
- switch (o) {
- case ADD_MODULES:
- int eq = arg.indexOf('=');
- Assert.check(eq > 0, () -> ("invalid runtime option:" + arg));
- // --add-modules=ALL-DEFAULT is not supported at compile-time
- // so remove it from list, and only process the rest
- // if the set is non-empty.
- // Note that --add-modules=ALL-DEFAULT is automatically added
- // by the standard javac launcher.
- String mods = Arrays.stream(arg.substring(eq + 1).split(","))
- .filter(s -> !s.isEmpty() && !s.equals("ALL-DEFAULT"))
- .collect(Collectors.joining(","));
- if (!mods.isEmpty()) {
- String updatedArg = arg.substring(0, eq + 1) + mods;
- o.handleOption(helper, updatedArg, Collections.emptyIterator());
- }
- break;
- default:
- o.handleOption(helper, arg, Collections.emptyIterator());
- break;
- }
- break;
+ String[] runtimeArgs = VM.getRuntimeArguments();
+ for (String arg : runtimeArgs) {
+ // Handle any supported runtime options; ignore all others.
+ // The runtime arguments always use the single token form, e.g. "--name=value".
+ for (Option o : getSupportedRuntimeOptions()) {
+ if (o.matches(arg)) {
+ switch (o) {
+ case ADD_MODULES:
+ int eq = arg.indexOf('=');
+ Assert.check(eq > 0, () -> ("invalid runtime option:" + arg));
+ // --add-modules=ALL-DEFAULT is not supported at compile-time
+ // so remove it from list, and only process the rest
+ // if the set is non-empty.
+ // Note that --add-modules=ALL-DEFAULT is automatically added
+ // by the standard javac launcher.
+ String mods = Arrays.stream(arg.substring(eq + 1).split(","))
+ .filter(s -> !s.isEmpty() && !s.equals("ALL-DEFAULT"))
+ .collect(Collectors.joining(","));
+ if (!mods.isEmpty()) {
+ String updatedArg = arg.substring(0, eq + 1) + mods;
+ o.handleOption(helper, updatedArg, Collections.emptyIterator());
+ }
+ break;
+ default:
+ o.handleOption(helper, arg, Collections.emptyIterator());
+ break;
}
+ break;
}
}
- } catch (ClassNotFoundException | SecurityException e) {
- throw helper.newInvalidValueException("err.cannot.access.runtime.env");
}
}
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacFiler.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacFiler.java Thu Jan 18 18:58:46 2018 +0000
@@ -712,20 +712,20 @@
}
private void checkNameAndExistence(ModuleSymbol mod, String typename, boolean allowUnnamedPackageInfo) throws FilerException {
- // TODO: Check if type already exists on source or class path?
- // If so, use warning message key proc.type.already.exists
checkName(typename, allowUnnamedPackageInfo);
- ClassSymbol existing;
+ ClassSymbol existing = elementUtils.getTypeElement(typename);
boolean alreadySeen = aggregateGeneratedSourceNames.contains(Pair.of(mod, typename)) ||
aggregateGeneratedClassNames.contains(Pair.of(mod, typename)) ||
initialClassNames.contains(typename) ||
- ((existing = elementUtils.getTypeElement(typename)) != null &&
- initialInputs.contains(existing.sourcefile));
+ (existing != null && initialInputs.contains(existing.sourcefile));
if (alreadySeen) {
if (lint)
log.warning(Warnings.ProcTypeRecreate(typename));
throw new FilerException("Attempt to recreate a file for type " + typename);
}
+ if (lint && existing != null) {
+ log.warning("proc.type.already.exists", typename);
+ }
if (!mod.isUnnamed() && !typename.contains(".")) {
throw new FilerException("Attempt to create a type in unnamed package of a named module: " + typename);
}
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -82,7 +82,6 @@
import com.sun.tools.javac.util.DefinedBy.Api;
import com.sun.tools.javac.util.Iterators;
import com.sun.tools.javac.util.JCDiagnostic;
-import com.sun.tools.javac.util.JDK9Wrappers.Module;
import com.sun.tools.javac.util.JavacMessages;
import com.sun.tools.javac.util.List;
import com.sun.tools.javac.util.Log;
@@ -267,7 +266,7 @@
: fileManager.getClassLoader(CLASS_PATH);
if (options.isSet("accessInternalAPI"))
- ModuleHelper.addExports(Module.getModule(getClass()), Module.getUnnamedModule(processorClassLoader));
+ ModuleHelper.addExports(getClass().getModule(), processorClassLoader.getUnnamedModule());
if (processorClassLoader != null && processorClassLoader instanceof Closeable) {
compiler.closeables = compiler.closeables.prepend((Closeable) processorClassLoader);
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java Thu Jan 18 18:58:46 2018 +0000
@@ -55,7 +55,7 @@
* deletion without notice.</b>
*/
@SupportedAnnotationTypes("*")
-@SupportedSourceVersion(SourceVersion.RELEASE_10)
+@SupportedSourceVersion(SourceVersion.RELEASE_11)
public class PrintingProcessor extends AbstractProcessor {
PrintWriter writer;
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties Thu Jan 18 18:58:46 2018 +0000
@@ -1144,16 +1144,21 @@
compiler.err.type.var.more.than.once.in.result=\
type variable {0} occurs more than once in type of {1}; cannot be left uninstantiated
-# 0: type, 1: type, 2: string
-compiler.err.types.incompatible.diff.ret=\
- types {0} and {1} are incompatible; both define {2}, but with unrelated return types
+# 0: type, 1: type, 2: fragment
+compiler.err.types.incompatible=\
+ types {0} and {1} are incompatible;\n\
+ {2}
+
+# 0: name, 1: list of type
+compiler.misc.incompatible.diff.ret=\
+ both define {0}({1}), but with unrelated return types
# 0: kind name, 1: type, 2: name, 3: list of type, 4: symbol, 5: symbol
-compiler.err.types.incompatible.unrelated.defaults=\
+compiler.misc.incompatible.unrelated.defaults=\
{0} {1} inherits unrelated defaults for {2}({3}) from types {4} and {5}
# 0: kind name, 1: type, 2: name, 3: list of type, 4: symbol, 5: symbol
-compiler.err.types.incompatible.abstract.default=\
+compiler.misc.incompatible.abstract.default=\
{0} {1} inherits abstract and default for {2}({3}) from types {4} and {5}
# 0: name, 1: kind name, 2: symbol
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -374,8 +374,6 @@
not a directory: {0}
javac.err.file.not.file=\
not a file: {0}
-javac.err.cannot.access.runtime.env=\
- cannot access runtime environment
javac.err.two.class.loaders.1=\
javac is split between multiple class loaders: check your configuration
javac.err.two.class.loaders.2=\
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JDK9Wrappers.java Thu Jan 18 09:01:00 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,460 +0,0 @@
-/*
- * 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.javac.util;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.nio.file.Path;
-import java.util.Collection;
-import java.util.ServiceLoader;
-
-/**
- * This class provides wrappers for classes and methods that are new in JDK 9, and which are not
- * available on older versions of the platform on which javac may be compiled and run.
- * In future releases, when javac is always compiled on JDK 9 or later, the use of these wrappers
- * can be replaced by use of the real underlying classes.
- *
- * <p>Wrapper classes provide a subset of the API of the wrapped classes, as needed for use
- * in javac. Wrapper objects contain an {@code Object} reference to the underlying runtime object,
- * and {@code Class} and {@code Method} objects for obtaining or using such instances via
- * runtime reflection. The {@code Class} and {@code Method} objects are set up on a per-class
- * basis, by an {@code init} method, which is called from static methods on the wrapper class,
- * or in the constructor, when instances are created.
- * <p>
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class JDK9Wrappers {
-
- /**
- * Helper class for new method in java.util.ServiceLoader.
- */
- public static final class ServiceLoaderHelper {
- @SuppressWarnings("unchecked")
- public static <S> ServiceLoader<S> load(Layer layer, Class<S> service) {
- try {
- init();
- Object result = loadMethod.invoke(null, layer.theRealLayer, service);
- return (ServiceLoader<S>)result;
- } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
- | SecurityException ex) {
- throw new Abort(ex);
- }
- }
-
- // -----------------------------------------------------------------------------------------
-
- private static Method loadMethod = null;
-
- private static void init() {
- if (loadMethod == null) {
- try {
- Class<?> layerClass = Layer.layerClass;
- loadMethod = ServiceLoader.class.getDeclaredMethod("load", layerClass, Class.class);
- } catch (NoSuchMethodException | SecurityException ex) {
- throw new Abort(ex);
- }
- }
- }
- }
-
- /**
- * Wrapper class for java.lang.module.ModuleDescriptor and ModuleDescriptor.Version.
- */
- public static class ModuleDescriptor {
- public static class Version {
- public static final String CLASSNAME = "java.lang.module.ModuleDescriptor$Version";
- private final Object theRealVersion;
-
- private Version(Object version) {
- this.theRealVersion = version;
- }
-
- public static Version parse(String v) {
- try {
- init();
- Object result = parseMethod.invoke(null, v);
- Version version = new Version(result);
- return version;
- } catch (InvocationTargetException ex) {
- if (ex.getCause() instanceof IllegalArgumentException) {
- throw (IllegalArgumentException) ex.getCause();
- } else {
- throw new Abort(ex);
- }
- } catch (IllegalAccessException | IllegalArgumentException | SecurityException ex) {
- throw new Abort(ex);
- }
- }
-
- @Override
- public String toString() {
- return theRealVersion.toString();
- }
-
- // -----------------------------------------------------------------------------------------
-
- private static Class<?> versionClass = null;
- private static Method parseMethod = null;
-
- private static void init() {
- if (versionClass == null) {
- try {
- versionClass = Class.forName(CLASSNAME, false, null);
- parseMethod = versionClass.getDeclaredMethod("parse", String.class);
- } catch (ClassNotFoundException | NoSuchMethodException | SecurityException ex) {
- throw new Abort(ex);
- }
- }
- }
- }
- }
-
- /**
- * Wrapper class for java.lang.module.ModuleFinder.
- */
- public static class ModuleFinder {
- private final Object theRealModuleFinder;
-
- private ModuleFinder(Object moduleFinder) {
- this.theRealModuleFinder = moduleFinder;
- init();
- }
-
- public static ModuleFinder of(Path... dirs) {
- try {
- init();
- Object result = ofMethod.invoke(null, (Object)dirs);
- ModuleFinder mFinder = new ModuleFinder(result);
- return mFinder;
- } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
- | SecurityException ex) {
- throw new Abort(ex);
- }
- }
-
- // -----------------------------------------------------------------------------------------
-
- private static Class<?> moduleFinderClass = null;
- private static Method ofMethod;
-
- static final Class<?> getModuleFinderClass() {
- init();
- return moduleFinderClass;
- }
-
- private static void init() {
- if (moduleFinderClass == null) {
- try {
- moduleFinderClass = Class.forName("java.lang.module.ModuleFinder", false, null);
- ofMethod = moduleFinderClass.getDeclaredMethod("of", Path[].class);
- } catch (ClassNotFoundException | NoSuchMethodException | SecurityException ex) {
- throw new Abort(ex);
- }
- }
- }
- }
-
- /**
- * Wrapper class for java.lang.Module. To materialize a handle use the static factory
- * methods Module#getModule(Class<?>) or Module#getUnnamedModule(ClassLoader).
- */
- public static class Module {
-
- private final Object theRealModule;
-
- private Module(Object module) {
- this.theRealModule = module;
- init();
- }
-
- public static Module getModule(Class<?> clazz) {
- try {
- init();
- Object result = getModuleMethod.invoke(clazz, new Object[0]);
- return new Module(result);
- } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
- | SecurityException ex) {
- throw new Abort(ex);
- }
- }
-
- public static Module getUnnamedModule(ClassLoader classLoader) {
- try {
- init();
- Object result = getUnnamedModuleMethod.invoke(classLoader, new Object[0]);
- return new Module(result);
- } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
- | SecurityException ex) {
- throw new Abort(ex);
- }
- }
-
- public Module addExports(String pn, Module other) {
- try {
- addExportsMethod.invoke(theRealModule, new Object[] { pn, other.theRealModule});
- } catch (IllegalAccessException | InvocationTargetException ex) {
- throw new Abort(ex);
- }
- return this;
- }
-
- public Module addUses(Class<?> st) {
- try {
- addUsesMethod.invoke(theRealModule, new Object[] { st });
- } catch (IllegalAccessException | InvocationTargetException ex) {
- throw new Abort(ex);
- }
- return this;
- }
-
- // -----------------------------------------------------------------------------------------
- // on java.lang.Module
- private static Method addExportsMethod = null;
- // on java.lang.Module
- private static Method addUsesMethod = null;
- // on java.lang.Class
- private static Method getModuleMethod;
- // on java.lang.ClassLoader
- private static Method getUnnamedModuleMethod;
-
- private static void init() {
- if (addExportsMethod == null) {
- try {
- Class<?> moduleClass = Class.forName("java.lang.Module", false, null);
- addUsesMethod = moduleClass.getDeclaredMethod("addUses", new Class<?>[] { Class.class });
- addExportsMethod = moduleClass.getDeclaredMethod("addExports",
- new Class<?>[] { String.class, moduleClass });
- getModuleMethod = Class.class.getDeclaredMethod("getModule", new Class<?>[0]);
- getUnnamedModuleMethod = ClassLoader.class.getDeclaredMethod("getUnnamedModule", new Class<?>[0]);
- } catch (ClassNotFoundException | NoSuchMethodException | SecurityException ex) {
- throw new Abort(ex);
- }
- }
- }
- }
-
- /**
- * Wrapper class for java.lang.module.Configuration.
- */
- public static final class Configuration {
- private final Object theRealConfiguration;
-
- private Configuration(Object configuration) {
- this.theRealConfiguration = configuration;
- init();
- }
-
- public Configuration resolveAndBind(
- ModuleFinder beforeFinder,
- ModuleFinder afterFinder,
- Collection<String> roots) {
- try {
- Object result = resolveAndBindMethod.invoke(theRealConfiguration,
- beforeFinder.theRealModuleFinder,
- afterFinder.theRealModuleFinder,
- roots
- );
- Configuration configuration = new Configuration(result);
- return configuration;
- } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
- | SecurityException ex) {
- throw new Abort(ex);
- }
- }
-
- // -----------------------------------------------------------------------------------------
-
- private static Class<?> configurationClass = null;
- private static Method resolveAndBindMethod;
-
- static final Class<?> getConfigurationClass() {
- init();
- return configurationClass;
- }
-
- private static void init() {
- if (configurationClass == null) {
- try {
- configurationClass = Class.forName("java.lang.module.Configuration", false, null);
- Class<?> moduleFinderInterface = ModuleFinder.getModuleFinderClass();
- resolveAndBindMethod = configurationClass.getDeclaredMethod("resolveAndBind",
- moduleFinderInterface,
- moduleFinderInterface,
- Collection.class
- );
- } catch (ClassNotFoundException | NoSuchMethodException | SecurityException ex) {
- throw new Abort(ex);
- }
- }
- }
- }
-
- /**
- * Wrapper class for java.lang.ModuleLayer.
- */
- public static final class Layer {
- private final Object theRealLayer;
-
- private Layer(Object layer) {
- this.theRealLayer = layer;
- }
-
- public static Layer boot() {
- try {
- init();
- Object result = bootMethod.invoke(null);
- Layer layer = new Layer(result);
- return layer;
- } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
- | SecurityException ex) {
- throw new Abort(ex);
- }
- }
-
- public Configuration configuration() {
- try {
- Object result = configurationMethod.invoke(theRealLayer);
- Configuration configuration = new Configuration(result);
- return configuration;
- } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
- | SecurityException ex) {
- throw new Abort(ex);
- }
- }
-
- public Layer defineModulesWithOneLoader(Configuration configuration, ClassLoader parentClassLoader) {
- try {
- Object result = defineModulesWithOneLoaderMethod.invoke(
- theRealLayer, configuration.theRealConfiguration, parentClassLoader);
- Layer layer = new Layer(result);
- return layer;
- } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
- | SecurityException ex) {
- throw new Abort(ex);
- }
- }
-
- // -----------------------------------------------------------------------------------------
-
- private static Class<?> layerClass = null;
- private static Method bootMethod;
- private static Method defineModulesWithOneLoaderMethod;
- private static Method configurationMethod;
-
- private static void init() {
- if (layerClass == null) {
- try {
- layerClass = Class.forName("java.lang.ModuleLayer", false, null);
- bootMethod = layerClass.getDeclaredMethod("boot");
- defineModulesWithOneLoaderMethod = layerClass.getDeclaredMethod("defineModulesWithOneLoader",
- Configuration.getConfigurationClass(),
- ClassLoader.class);
- configurationMethod = layerClass.getDeclaredMethod("configuration");
- } catch (ClassNotFoundException | NoSuchMethodException | SecurityException ex) {
- throw new Abort(ex);
- }
- }
- }
- }
-
-
- /**
- * Helper class for new method in jdk.internal.misc.VM.
- */
- public static final class VMHelper {
- public static final String CLASSNAME = "jdk.internal.misc.VM";
-
- @SuppressWarnings("unchecked")
- public static String[] getRuntimeArguments() {
- try {
- init();
- Object result = getRuntimeArgumentsMethod.invoke(null);
- return (String[])result;
- } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
- | SecurityException ex) {
- throw new Abort(ex);
- }
- }
-
- // -----------------------------------------------------------------------------------------
-
- private static Class<?> vmClass = null;
- private static Method getRuntimeArgumentsMethod = null;
-
- private static void init() {
- if (vmClass == null) {
- try {
- vmClass = Class.forName(CLASSNAME, false, null);
- getRuntimeArgumentsMethod = vmClass.getDeclaredMethod("getRuntimeArguments");
- } catch (ClassNotFoundException | NoSuchMethodException | SecurityException ex) {
- throw new Abort(ex);
- }
- }
- }
- }
-
- /**
- * Helper class for new method in jdk.internal.jmod.JmodFile
- */
- public static final class JmodFile {
- public static final String JMOD_FILE_CLASSNAME = "jdk.internal.jmod.JmodFile";
-
- public static void checkMagic(Path file) throws IOException {
- try {
- init();
- checkMagicMethod.invoke(null, file);
- } catch (InvocationTargetException ex) {
- if (ex.getCause() instanceof IOException) {
- throw IOException.class.cast(ex.getCause());
- }
- throw new Abort(ex);
- } catch (IllegalAccessException | IllegalArgumentException | SecurityException ex) {
- throw new Abort(ex);
- }
- }
-
- // -----------------------------------------------------------------------------------------
-
- private static Class<?> jmodFileClass = null;
- private static Method checkMagicMethod = null;
-
- private static void init() {
- if (jmodFileClass == null) {
- try {
- jmodFileClass = Class.forName(JMOD_FILE_CLASSNAME, false, null);
- checkMagicMethod = jmodFileClass.getDeclaredMethod("checkMagic", Path.class);
- } catch (ClassNotFoundException | NoSuchMethodException | SecurityException ex) {
- throw new Abort(ex);
- }
- }
- }
- }
-}
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/ModuleHelper.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/ModuleHelper.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,6 @@
package com.sun.tools.javac.util;
-import com.sun.tools.javac.util.JDK9Wrappers.Module;
-
public class ModuleHelper {
private static final String[] javacInternalPackages = new String[] {
--- a/src/jdk.dynalink/share/classes/jdk/dynalink/beans/BeanLinker.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.dynalink/share/classes/jdk/dynalink/beans/BeanLinker.java Thu Jan 18 18:58:46 2018 +0000
@@ -116,7 +116,7 @@
if(clazz.isArray()) {
// Some languages won't have a notion of manipulating collections. Exposing "length" on arrays as an
// explicit property is beneficial for them.
- setPropertyGetter("length", MethodHandles.arrayLength(clazz), ValidationType.EXACT_CLASS);
+ setPropertyGetter("length", GET_ARRAY_LENGTH, ValidationType.IS_ARRAY);
} else if(Collection.class.isAssignableFrom(clazz)) {
setPropertyGetter("length", GET_COLLECTION_LENGTH, ValidationType.INSTANCE_OF);
} else if(Map.class.isAssignableFrom(clazz)) {
@@ -546,6 +546,9 @@
private static final MethodHandle GET_MAP_LENGTH = Lookup.PUBLIC.findVirtual(Map.class, "size",
MethodType.methodType(int.class));
+ private static final MethodHandle GET_ARRAY_LENGTH = Lookup.PUBLIC.findStatic(Array.class, "getLength",
+ MethodType.methodType(int.class, Object.class));
+
private static void assertParameterCount(final CallSiteDescriptor descriptor, final int paramCount) {
if(descriptor.getMethodType().parameterCount() != paramCount) {
throw new BootstrapMethodError(descriptor.getOperation() + " must have exactly " + paramCount + " parameters.");
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java Thu Jan 18 18:58:46 2018 +0000
@@ -135,8 +135,9 @@
/**
* Gets the implementor for the interface class {@code type}.
*
- * @return the implementor if there is a single implementor, 0 if there is no implementor, or
- * {@code type} itself if there is more than one implementor
+ * @return the implementor if there is a single implementor, {@code null} if there is no
+ * implementor, or {@code type} itself if there is more than one implementor
+ * @throws IllegalArgumentException if type is not an interface type
*/
native HotSpotResolvedObjectTypeImpl getImplementor(HotSpotResolvedObjectTypeImpl type);
@@ -256,14 +257,13 @@
native void resolveInvokeHandleInPool(HotSpotConstantPool constantPool, int cpi);
/**
- * If {@code cpi} denotes an entry representing a resolved dynamic adapter
- * (see {@code resolveInvokeDynamicInPool} and {@code resolveInvokeHandleInPool}),
- * return the opcode of the instruction for which the resolution was performed
- * ({@code invokedynamic} or {@code invokevirtual}}, or {@code -1} otherwise.
+ * If {@code cpi} denotes an entry representing a resolved dynamic adapter (see
+ * {@code resolveInvokeDynamicInPool} and {@code resolveInvokeHandleInPool}), return the opcode
+ * of the instruction for which the resolution was performed ({@code invokedynamic} or
+ * {@code invokevirtual}}, or {@code -1} otherwise.
*/
native int isResolvedInvokeHandleInPool(HotSpotConstantPool constantPool, int cpi);
-
/**
* Gets the list of type names (in the format of {@link JavaType#getName()}) denoting the
* classes that define signature polymorphic methods.
@@ -388,7 +388,7 @@
/**
* Gets the static initializer of {@code type}.
*
- * @return 0 if {@code type} has no static initializer
+ * @return {@code null} if {@code type} has no static initializer
*/
native HotSpotResolvedJavaMethodImpl getClassInitializer(HotSpotResolvedObjectTypeImpl type);
@@ -468,7 +468,8 @@
native long getLocalVariableTableStart(HotSpotResolvedJavaMethodImpl method);
/**
- * Sets flags on {@code method} indicating that it should never be inlined or compiled by the VM.
+ * Sets flags on {@code method} indicating that it should never be inlined or compiled by the
+ * VM.
*/
native void setNotInlinableOrCompilable(HotSpotResolvedJavaMethodImpl method);
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java Thu Jan 18 18:58:46 2018 +0000
@@ -922,7 +922,10 @@
}
public ResolvedJavaMethod getClassInitializer() {
- return compilerToVM().getClassInitializer(this);
+ if (!isArray()) {
+ return compilerToVM().getClassInitializer(this);
+ }
+ return null;
}
@Override
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/classfile/Classfile.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/classfile/Classfile.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, 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
@@ -46,8 +46,8 @@
private final ResolvedJavaType type;
private final List<ClassfileBytecode> codeAttributes;
- private static final int MAJOR_VERSION_JAVA7 = 51;
- private static final int MAJOR_VERSION_JAVA10 = 54;
+ private static final int MAJOR_VERSION_JAVA_MIN = 51;
+ private static final int MAJOR_VERSION_JAVA_MAX = 55;
private static final int MAGIC = 0xCAFEBABE;
/**
@@ -65,7 +65,7 @@
int minor = stream.readUnsignedShort();
int major = stream.readUnsignedShort();
- if (major < MAJOR_VERSION_JAVA7 || major > MAJOR_VERSION_JAVA10) {
+ if (major < MAJOR_VERSION_JAVA_MIN || major > MAJOR_VERSION_JAVA_MAX) {
throw new UnsupportedClassVersionError("Unsupported class file version: " + major + "." + minor);
}
--- a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -457,9 +457,11 @@
showcerts = true;
} else if (collator.compare(flags, "-strict") ==0) {
strict = true;
- } else if (collator.compare(flags, "-h") == 0 ||
- collator.compare(flags, "-?") == 0 ||
- collator.compare(flags, "-help") == 0) {
+ } else if (collator.compare(flags, "-?") == 0 ||
+ collator.compare(flags, "-h") == 0 ||
+ collator.compare(flags, "--help") == 0 ||
+ // -help: legacy.
+ collator.compare(flags, "-help") == 0) {
fullusage();
} else {
System.err.println(
@@ -648,6 +650,9 @@
System.out.println(rb.getString
(".conf.url.specify.a.pre.configured.options.file"));
System.out.println();
+ System.out.println(rb.getString
+ (".print.this.help.message"));
+ System.out.println();
System.exit(0);
}
--- a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -118,8 +118,10 @@
"[-strict] treat warnings as errors"},
{".conf.url.specify.a.pre.configured.options.file",
"[-conf <url>] specify a pre-configured options file"},
+ {".print.this.help.message",
+ "[-? -h --help] Print this help message"},
{"Option.lacks.argument", "Option lacks argument"},
- {"Please.type.jarsigner.help.for.usage", "Please type jarsigner -help for usage"},
+ {"Please.type.jarsigner.help.for.usage", "Please type jarsigner --help for usage"},
{"Please.specify.jarfile.name", "Please specify jarfile name"},
{"Please.specify.alias.name", "Please specify alias name"},
{"Only.one.alias.can.be.specified", "Only one alias can be specified"},
--- a/src/jdk.jartool/share/classes/sun/tools/jar/GNUStyleOptions.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.jartool/share/classes/sun/tools/jar/GNUStyleOptions.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -200,7 +200,7 @@
},
// Other options
- new Option(true, true, OptionType.OTHER, "--help", "-h") {
+ new Option(true, true, OptionType.OTHER, "--help", "-h", "-?") {
void process(Main jartool, String opt, String arg) throws BadArgs {
if (jartool.info == null) {
if (arg == null) {
--- a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar.properties Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar.properties Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -286,7 +286,7 @@
main.help.opt.other=\
\ Other options:\n
main.help.opt.other.help=\
-\ -h, --help[:compat] Give this, or optionally the compatibility, help
+\ -?, -h, --help[:compat] Give this, or optionally the compatibility, help
main.help.opt.other.help-extra=\
\ --help-extra Give help on extra options
main.help.opt.other.version=\
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/resources/javadoc.properties Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/resources/javadoc.properties Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,7 @@
\ -protected Show protected/public classes and members (default)\n\
\ -package Show package/protected/public classes and members\n\
\ -private Show all classes and members\n\
-\ -help Display command line options and exit\n\
+\ --help Display command line options and exit\n\
\ -doclet <class> Generate output via alternate doclet\n\
\ -docletpath <path> Specify where to find doclet class files\n\
\ --module-source-path <path> Specify where to find input source files for multiple modules\n\
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolOption.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolOption.java Thu Jan 18 18:58:46 2018 +0000
@@ -346,7 +346,7 @@
// ----- help options -----
- HELP("--help -help", STANDARD) {
+ HELP("--help -help -? -h", STANDARD) {
@Override
public void process(Helper helper) throws OptionException {
throw new OptionException(OK, helper::usage);
--- a/src/jdk.jcmd/share/classes/sun/tools/jcmd/Arguments.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.jcmd/share/classes/sun/tools/jcmd/Arguments.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,11 @@
return;
}
- if (args[0].equals("-h") || args[0].equals("-help") ) {
+ if (args[0].equals("-?") ||
+ args[0].equals("-h") ||
+ args[0].equals("--help") ||
+ // -help: legacy.
+ args[0].equals("-help")) {
showUsage = true;
return;
}
@@ -116,6 +120,6 @@
System.out.println(" PerfCounter.print display the counters exposed by this process ");
System.out.println(" -f read and execute commands from the file ");
System.out.println(" -l list JVM processes on the local machine ");
- System.out.println(" -h this help ");
+ System.out.println(" -? -h --help print this help message ");
}
}
--- a/src/jdk.jcmd/share/classes/sun/tools/jcmd/JCmd.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.jcmd/share/classes/sun/tools/jcmd/JCmd.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -62,7 +62,7 @@
if (arg.isShowUsage()) {
Arguments.usage();
- System.exit(1);
+ System.exit(0);
}
ProcessArgumentMatcher ap = null;
--- a/src/jdk.jcmd/share/classes/sun/tools/jinfo/JInfo.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.jcmd/share/classes/sun/tools/jinfo/JInfo.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -63,7 +63,11 @@
optionCount++;
- if (arg.equals("-help") || arg.equals("-h")) {
+ if (arg.equals("-?") ||
+ arg.equals("-h") ||
+ arg.equals("--help") ||
+ // -help: legacy.
+ arg.equals("-help")) {
usage(0);
}
@@ -255,7 +259,7 @@
System.err.println(" -flags to print VM flags");
System.err.println(" -sysprops to print Java system properties");
System.err.println(" <no option> to print both VM flags and system properties");
- System.err.println(" -h | -help to print this help message");
+ System.err.println(" -? | -h | --help | -help to print this help message");
System.exit(exit);
}
}
--- a/src/jdk.jcmd/share/classes/sun/tools/jmap/JMap.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.jcmd/share/classes/sun/tools/jmap/JMap.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -64,7 +64,11 @@
if (!arg.startsWith("-")) {
break;
}
- if (arg.equals("-help") || arg.equals("-h")) {
+ if (arg.equals("-?") ||
+ arg.equals("-h") ||
+ arg.equals("--help") ||
+ // -help: legacy. Undocumented.
+ arg.equals("-help")) {
usage(0);
} else {
if (option != null) {
@@ -247,6 +251,8 @@
System.err.println(" if the \"live\" suboption is specified, only count live objects");
System.err.println(" jmap -dump:<dump-options> <pid>");
System.err.println(" to connect to running process and dump java heap");
+ System.err.println(" jmap -? -h --help");
+ System.err.println(" to print this help message");
System.err.println("");
System.err.println(" dump-options:");
System.err.println(" live dump only live objects; if not specified,");
--- a/src/jdk.jcmd/share/classes/sun/tools/jps/Arguments.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.jcmd/share/classes/sun/tools/jps/Arguments.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -52,11 +52,12 @@
private HostIdentifier hostId;
public static void printUsage(PrintStream ps) {
- ps.println("usage: jps [-help]");
+ ps.println("usage: jps [--help]");
ps.println(" jps [-q] [-mlvV] [<hostid>]");
ps.println();
ps.println("Definitions:");
ps.println(" <hostid>: <hostname>[:<port>]");
+ ps.println(" -? -h --help -help: Print this help message and exit.");
}
public Arguments(String[] args) throws IllegalArgumentException {
@@ -64,7 +65,10 @@
if (args.length == 1) {
if ((args[0].compareTo("-?") == 0)
- || (args[0].compareTo("-help")== 0)) {
+ || (args[0].compareTo("-h")== 0)
+ || (args[0].compareTo("--help")== 0)
+ // -help: legacy.
+ || (args[0].compareTo("-help")== 0)) {
help = true;
return;
}
--- a/src/jdk.jcmd/share/classes/sun/tools/jstack/JStack.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.jcmd/share/classes/sun/tools/jstack/JStack.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -56,7 +56,11 @@
if (!arg.startsWith("-")) {
break;
}
- if (arg.equals("-help") || arg.equals("-h")) {
+ if (arg.equals("-?") ||
+ arg.equals("-h") ||
+ arg.equals("--help") ||
+ // -help: legacy.
+ arg.equals("-help")) {
usage(0);
}
else {
@@ -171,7 +175,7 @@
System.err.println("");
System.err.println("Options:");
System.err.println(" -l long listing. Prints additional information about locks");
- System.err.println(" -h or -help to print this help message");
+ System.err.println(" -? -h --help -help to print this help message");
System.exit(exit);
}
}
--- a/src/jdk.jcmd/share/classes/sun/tools/jstat/Arguments.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.jcmd/share/classes/sun/tools/jstat/Arguments.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -73,7 +73,7 @@
private VmIdentifier vmId;
public static void printUsage(PrintStream ps) {
- ps.println("Usage: jstat -help|-options");
+ ps.println("Usage: jstat --help|-options");
ps.println(" jstat -<option> [-t] [-h<lines>] <vmid> [<interval> [<count>]]");
ps.println();
ps.println("Definitions:");
@@ -93,6 +93,8 @@
ps.println(" milliseconds(\"ms\") or seconds(\"s\"). The default units are \"ms\".");
ps.println(" <count> Number of samples to take before terminating.");
ps.println(" -J<flag> Pass <flag> directly to the runtime system.");
+ ps.println(" -? -h --help Prints this help message.");
+ ps.println(" -help Prints this help message.");
// undocumented options:
// -list [<vmid>] - list counter names
@@ -103,6 +105,7 @@
// -v - verbose output (-snap)
// -constants - output constants with -name output
// -strings - output strings with -name output
+ // -help - same as -? ...
}
private static int toMillis(String s) throws IllegalArgumentException {
@@ -147,6 +150,9 @@
}
if ((args[0].compareTo("-?") == 0)
+ || (args[0].compareTo("-h") == 0)
+ || (args[0].compareTo("--help") == 0)
+ // -help: legacy.
|| (args[0].compareTo("-help") == 0)) {
help = true;
return;
--- a/src/jdk.jdeps/share/classes/com/sun/tools/javap/JavapTask.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/javap/JavapTask.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -123,7 +123,7 @@
static final Option[] recognizedOptions = {
- new Option(false, "-help", "--help", "-?") {
+ new Option(false, "-help", "--help", "-?", "-h") {
@Override
void process(JavapTask task, String opt, String arg) {
task.options.help = true;
--- a/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap.properties Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap.properties Thu Jan 18 18:58:46 2018 +0000
@@ -24,7 +24,7 @@
main.usage.summary=\
Usage: {0} <options> <classes>\n\
-use -help for a list of possible options
+use --help for a list of possible options
warn.prefix=Warning:
warn.unexpected.class=File {0} does not contain class {1}
@@ -33,7 +33,7 @@
main.usage.summary=\
Usage: {0} <options> <classes>\n\
-use -help for a list of possible options
+use --help for a list of possible options
main.usage=\
Usage: {0} <options> <classes>\n\
@@ -41,7 +41,7 @@
main.opt.help=\
-\ -help --help -? Print this usage message
+\ -? -h --help -help Print this help message
main.opt.version=\
\ -version Version information
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/LoadProc.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/LoadProc.java Thu Jan 18 18:58:46 2018 +0000
@@ -50,7 +50,7 @@
import javax.tools.Diagnostic;
-import static javax.lang.model.SourceVersion.RELEASE_10;
+import static javax.lang.model.SourceVersion.RELEASE_11;
/**
* Annotation processor for the Deprecation Scanner tool.
@@ -58,7 +58,7 @@
*
*/
@SupportedAnnotationTypes("java.lang.Deprecated")
-@SupportedSourceVersion(RELEASE_10)
+@SupportedSourceVersion(RELEASE_11)
public class LoadProc extends AbstractProcessor {
Elements elements;
Messager messager;
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -106,7 +106,7 @@
// Keep these updated manually until there's a compiler API
// that allows querying of supported releases.
final Set<String> releasesWithoutForRemoval = Set.of("6", "7", "8");
- final Set<String> releasesWithForRemoval = Set.of("9", "10");
+ final Set<String> releasesWithForRemoval = Set.of("9", "10", "11");
final Set<String> validReleases;
{
@@ -358,14 +358,15 @@
* Process classes from a particular JDK release, using only information
* in this JDK.
*
- * @param release "6", "7", "8", "9", or "10"
+ * @param release "6", "7", "8", "9", "10", or "11"
* @param classes collection of classes to process, may be empty
* @return success value
*/
boolean processRelease(String release, Collection<String> classes) throws IOException {
options.addAll(List.of("--release", release));
- if (release.equals("9") || release.equals("10")) {
+ if (release.equals("9") || release.equals("10") ||
+ release.equals("11")) {
List<String> rootMods = List.of("java.se", "java.se.ee");
TraverseProc proc = new TraverseProc(rootMods);
JavaCompiler.CompilationTask task =
@@ -481,7 +482,7 @@
String dir = null;
String jar = null;
String jdkHome = null;
- String release = "10";
+ String release = "11";
List<String> loadClasses = new ArrayList<>();
String csvFile = null;
@@ -505,10 +506,11 @@
return false;
case "--help":
case "-h":
+ case "-?":
out.println(Messages.get("main.usage"));
out.println();
out.println(Messages.get("main.help"));
- return false;
+ return true;
case "-l":
case "--list":
require(scanMode == ScanMode.ARGS);
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/resources/jdeprscan.properties Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/resources/jdeprscan.properties Thu Jan 18 18:58:46 2018 +0000
@@ -2,14 +2,14 @@
Usage: jdeprscan [options] '{dir|jar|class}' ...\n\
\n\
options:\n\
-\ --class-path PATH\n\
-\ --for-removal\n\
-\ --full-version\n\
-\ -h --help\n\
-\ -l --list\n\
-\ --release 6|7|8|9|10\n\
-\ -v --verbose\n\
-\ --version
+\ --class-path PATH\n\
+\ --for-removal\n\
+\ --full-version\n\
+\ -? -h --help\n\
+\ -l --list\n\
+\ --release 6|7|8|9|10\n\
+\ -v --verbose\n\
+\ --version
main.help=\
Scans each argument for usages of deprecated APIs. An argument\n\
@@ -28,7 +28,7 @@
\n\
The --full-version option prints out the full version string of the tool.\n\
\n\
-The --help option prints out a full help message.\n\
+The --help (-? -h) option prints out a full help message.\n\
\n\
The --list (-l) option prints out the set of deprecated APIs. No scanning is done,\n\
so no directory, jar, or class arguments should be provided.\n\
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1144,7 +1144,7 @@
for (Option o : recognizedOptions) {
String name = o.aliases[0].substring(1); // there must always be at least one name
name = name.charAt(0) == '-' ? name.substring(1) : name;
- if (o.isHidden() || name.equals("h") || name.startsWith("filter:")) {
+ if (o.isHidden() || name.startsWith("filter:")) {
continue;
}
log.println(getMessage("main.opt." + name));
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/jdeps.properties Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/jdeps.properties Thu Jan 18 18:58:46 2018 +0000
@@ -1,6 +1,6 @@
main.usage.summary=\
Usage: {0} <options> <path ...>]\n\
-use -h, -?, -help, or --help for a list of possible options
+use --help for a list of possible options
main.usage=\
Usage: {0} <options> <path ...>]\n\
@@ -12,8 +12,7 @@
warn.prefix=Warning:
main.opt.h=\
-\ -h -? -help\n\
-\ --help Print this usage message
+\ -h -? --help Print this help message
main.opt.version=\
\ -version --version Version information
--- a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTY.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTY.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -791,7 +791,7 @@
private static void usage() {
MessageOutput.println("zz usage text", new Object [] {progname,
File.pathSeparator});
- System.exit(1);
+ System.exit(0);
}
static void usageError(String messageKey) {
@@ -1007,7 +1007,11 @@
return;
}
connectSpec = argv[++i];
- } else if (token.equals("-help")) {
+ } else if (token.equals("-?") ||
+ token.equals("-h") ||
+ token.equals("--help") ||
+ // -help: legacy.
+ token.equals("-help")) {
usage();
} else if (token.equals("-version")) {
Commands evaluator = new Commands();
--- a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -426,7 +426,7 @@
"Usage: {0} <options> <class> <arguments>\n" +
"\n" +
"where options include:\n" +
- " -help print out this message and exit\n" +
+ " -? -h --help -help print this help message and exit\n" +
" -sourcepath <directories separated by \"{1}\">\n" +
" directories in which to look for source files\n" +
" -attach <address>\n" +
--- a/src/jdk.jlink/share/classes/jdk/tools/jimage/JImageTask.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jimage/JImageTask.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -70,7 +70,7 @@
new Option<JImageTask>(false, (task, option, arg) -> {
task.options.help = true;
- }, "--help", "-h"),
+ }, "--help", "-h", "-?"),
new Option<JImageTask>(false, (task, option, arg) -> {
task.options.verbose = true;
--- a/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage.properties Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage.properties Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -60,23 +60,23 @@
warn.prefix=Warning:
main.opt.dir=\
-\ --dir Target directory for extract directive
+\ --dir Target directory for extract directive
main.opt.include=\
-\ --include <pattern-list> Pattern list for filtering entries.
+\ --include <pattern-list> Pattern list for filtering entries.
main.opt.full-version=\
-\ --full-version Print full version information
+\ --full-version Print full version information
main.opt.help=\
-\ -h, --help Print usage message
+\ -?, -h, --help Print this help message
main.opt.verbose=\
-\ --verbose Listing prints entry size and offset\n\
-\ attributes
+\ --verbose Listing prints entry size and offset\n\
+\ attributes
main.opt.version=\
-\ --version Print version information
+\ --version Print version information
main.command.files=\
\ @<filename> Read options from file
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -88,7 +88,7 @@
private static final Option<?>[] recognizedOptions = {
new Option<JlinkTask>(false, (task, opt, arg) -> {
task.options.help = true;
- }, "--help", "-h"),
+ }, "--help", "-h", "-?"),
new Option<JlinkTask>(true, (task, opt, arg) -> {
// if used multiple times, the last one wins!
// So, clear previous values, if any.
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -101,6 +101,7 @@
final boolean hidden;
final String name;
final String shortname;
+ final String shortname2;
final boolean terminalOption;
public Option(boolean hasArg,
@@ -108,6 +109,7 @@
boolean hidden,
String name,
String shortname,
+ String shortname2,
boolean isTerminal)
{
if (!name.startsWith("--")) {
@@ -122,19 +124,33 @@
this.hidden = hidden;
this.name = name;
this.shortname = shortname;
+ this.shortname2 = shortname2;
this.terminalOption = isTerminal;
}
+ public Option(boolean hasArg,
+ Processing<T> processing,
+ boolean hidden,
+ String name,
+ String shortname,
+ boolean isTerminal)
+ {
+ this(hasArg, processing, false, name, shortname, "", isTerminal);
+ }
public Option(boolean hasArg, Processing<T> processing, String name, String shortname, boolean isTerminal) {
- this(hasArg, processing, false, name, shortname, isTerminal);
+ this(hasArg, processing, false, name, shortname, "", isTerminal);
+ }
+
+ public Option(boolean hasArg, Processing<T> processing, String name, String shortname, String shortname2) {
+ this(hasArg, processing, false, name, shortname, shortname2, false);
}
public Option(boolean hasArg, Processing<T> processing, String name, String shortname) {
- this(hasArg, processing, false, name, shortname, false);
+ this(hasArg, processing, false, name, shortname, "", false);
}
public Option(boolean hasArg, Processing<T> processing, boolean hidden, String name) {
- this(hasArg, processing, hidden, name, "", false);
+ this(hasArg, processing, hidden, name, "", "", false);
}
public Option(boolean hasArg, Processing<T> processing, String name) {
@@ -152,6 +168,7 @@
public boolean matches(String opt) {
return opt.equals(name) ||
opt.equals(shortname) ||
+ opt.equals(shortname2) ||
hasArg && opt.startsWith("--") && opt.startsWith(name + "=");
}
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink.properties Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink.properties Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
\Possible options include:
main.opt.help=\
-\ -h, --help Print this help message
+\ -h, --help, -? Print this help message
main.opt.version=\
\ --version Version information
--- a/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1309,7 +1309,7 @@
.withValuesConvertedBy(new PatternConverter());
OptionSpec<Void> help
- = parser.acceptsAll(Set.of("h", "help"), getMessage("main.opt.help"))
+ = parser.acceptsAll(Set.of("h", "help", "?"), getMessage("main.opt.help"))
.forHelp();
OptionSpec<Void> helpExtra
--- a/src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod.properties Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod.properties Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -46,7 +46,7 @@
main.opt.mode.hash=\
\hash - Records hashes of tied modules.
-main.opt.help=Print this usage message
+main.opt.help=Print this help message
main.opt.help-extra=Print help on extra options
main.opt.version=Version information
main.opt.class-path=Application jar files|dir containing classes
--- a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -515,7 +515,7 @@
private final OptionSpecBuilder argV = parser.accepts("v");
private final OptionSpec<String> argR = parser.accepts("R").withRequiredArg();
private final OptionSpec<String> argC = parser.accepts("C").withRequiredArg();
- private final OptionSpecBuilder argHelp = parser.acceptsAll(asList("h", "help"));
+ private final OptionSpecBuilder argHelp = parser.acceptsAll(asList("?", "h", "help"));
private final OptionSpecBuilder argVersion = parser.accepts("version");
private final OptionSpecBuilder argFullVersion = parser.accepts("full-version");
private final OptionSpecBuilder argShowVersion = parser.accepts("show-version");
--- a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -216,7 +216,7 @@
\ Use one -C for each compiler flag or flag argument\n\
\ --version Print version information and exit\n\
\ --show-version Print version information and continue\n\
-\ --help Print this synopsis of standard options and exit\n\
+\ --help, -?, -h Print this synopsis of standard options and exit\n\
\ --help-extra, -X Print help on non-standard options and exit\n\
\n\
A file argument may be a file name, or one of the predefined file names: DEFAULT,\n\
--- a/src/jdk.jstatd/share/classes/sun/tools/jstatd/Jstatd.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.jstatd/share/classes/sun/tools/jstatd/Jstatd.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -47,7 +47,8 @@
private static boolean startRegistry = true;
private static void printUsage() {
- System.err.println("usage: jstatd [-nr] [-p port] [-n rminame]");
+ System.err.println("usage: jstatd [-nr] [-p port] [-n rminame]\n" +
+ " jstatd -?|-h|--help");
}
static void bind(String name, RemoteHostImpl remoteHost)
@@ -78,7 +79,12 @@
for ( ; (argc < args.length) && (args[argc].startsWith("-")); argc++) {
String arg = args[argc];
- if (arg.compareTo("-nr") == 0) {
+ if (arg.compareTo("-?") == 0 ||
+ arg.compareTo("-h") == 0 ||
+ arg.compareTo("--help") == 0) {
+ printUsage();
+ System.exit(0);
+ } else if (arg.compareTo("-nr") == 0) {
startRegistry = false;
} else if (arg.startsWith("-p")) {
if (arg.compareTo("-p") != 0) {
--- a/src/jdk.pack/share/native/unpack200/main.cpp Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.pack/share/native/unpack200/main.cpp Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -153,7 +153,7 @@
" -q, --quiet set verbosity to lowest level\n" \
" -l{F}, --log-file={F} output to the given log file,\n" \
" or '-' for standard output (default)\n" \
- " -?, -h, --help print this message\n" \
+ " -?, -h, --help print this help message\n" \
" -V, --version print program version\n" \
"\n" \
"Exit Status:\n" \
@@ -313,7 +313,7 @@
case 'h':
case '?':
usage(&u, argv[0], true);
- exit(1);
+ exit(0);
default:
const char* inenv = isenvarg? " in ${UNPACK200_FLAGS}": "";
--- a/src/jdk.rmic/share/classes/sun/tools/java/RuntimeConstants.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.rmic/share/classes/sun/tools/java/RuntimeConstants.java Thu Jan 18 18:58:46 2018 +0000
@@ -67,7 +67,7 @@
/* Class File Constants */
int JAVA_MAGIC = 0xcafebabe;
int JAVA_MIN_SUPPORTED_VERSION = 45;
- int JAVA_MAX_SUPPORTED_VERSION = 54;
+ int JAVA_MAX_SUPPORTED_VERSION = 55;
int JAVA_MAX_SUPPORTED_MINOR_VERSION = 0;
/* Generate class file version for 1.1 by default */
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java Thu Jan 18 18:58:46 2018 +0000
@@ -1083,7 +1083,7 @@
// Simply invoke super.finalize()
mv.visitVarInsn(ALOAD, 0);
- mv.checkcast(Type.getType(generatedClassName));
+ mv.checkcast(Type.getType('L' + generatedClassName + ';'));
mv.invokespecial(superClassName, "finalize", VOID_METHOD_DESCRIPTOR, false);
mv.visitInsn(RETURN);
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Options.properties Thu Jan 18 09:01:00 2018 -0800
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Options.properties Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -66,9 +66,9 @@
## At least short_name or name needs to be in place for an argument descriptor to be valid.
nashorn.option.help = { \
- name="-help", \
+ name="--help", \
short_name="-h", \
- desc="Print help for command line flags." \
+ desc="Print this help message." \
}
nashorn.option.xhelp = { \
--- a/src/jdk.unsupported/share/classes/sun/reflect/Reflection.java Thu Jan 18 09:01:00 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.reflect;
-
-public class Reflection {
-
- private Reflection() { }
-
- /**
- * @deprecated This method is an internal API and will be removed.
- * Use {@link StackWalker} to walk the stack and obtain the caller class
- * with {@link StackWalker.StackFrame#getDeclaringClass} instead.
- */
- @Deprecated(forRemoval=true)
- @SuppressWarnings("removal") // Reflection.getCallerClass
- public static Class<?> getCallerClass(int depth) {
- if (depth < 0)
- throw new InternalError("depth must be positive");
-
- // increase depth to account for delegation to the internal impl
- return jdk.internal.reflect.Reflection.getCallerClass(depth + 1);
- }
-}
--- a/test/hotspot/jtreg/ProblemList.txt Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/ProblemList.txt Thu Jan 18 18:58:46 2018 +0000
@@ -51,6 +51,7 @@
compiler/tiered/LevelTransitionTest.java 8067651 generic-all
compiler/types/correctness/CorrectnessTest.java 8066173 generic-all
compiler/types/correctness/OffTest.java 8066173 generic-all
+compiler/c2/Test8007294.java 8192992 generic-all
# aot test intermittently failing in jprt 8175791
compiler/aot/DeoptimizationTest.java 8175791 windows-all
--- a/test/hotspot/jtreg/TEST.ROOT Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/TEST.ROOT Thu Jan 18 18:58:46 2018 +0000
@@ -58,7 +58,7 @@
docker.support
# Minimum jtreg version
-requiredVersion=4.2 b08
+requiredVersion=4.2 b11
# Path to libraries in the topmost test directory. This is needed so @library
# does not need ../../../ notation to reach them
--- a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/GetImplementorTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/GetImplementorTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -103,6 +103,14 @@
HotSpotResolvedObjectType resolvedIface = CompilerToVMHelper
.lookupTypeHelper(Utils.toJVMTypeSignature(tcase.anInterface),
getClass(), /* resolve = */ true);
+ if (!resolvedIface.isInterface()) {
+ try {
+ CompilerToVMHelper.getImplementor(resolvedIface);
+ Asserts.fail("Expected " + IllegalArgumentException.class.getName());
+ } catch (IllegalArgumentException e) {
+ }
+ return;
+ }
HotSpotResolvedObjectType resolvedImplementer = CompilerToVMHelper
.getImplementor(resolvedIface);
HotSpotResolvedObjectType resolvedExpected = null;
--- a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java Thu Jan 18 18:58:46 2018 +0000
@@ -473,6 +473,20 @@
metaAccess.lookupJavaType(ConcreteTransitiveImplementor1.class);
metaAccess.lookupJavaType(ConcreteTransitiveImplementor2.class);
assertEquals(aSai2, iSai2.getSingleImplementor());
+
+ for (Class<?> c : classes) {
+ ResolvedJavaType type = metaAccess.lookupJavaType(c);
+ try {
+ type.getSingleImplementor();
+ if (!c.isInterface()) {
+ throw new AssertionError("Expected exception for calling getSingleImplmentor on " + c.getName());
+ }
+ } catch (JVMCIError e) {
+ if (c.isInterface()) {
+ throw new AssertionError("Unexpected exception", e);
+ }
+ }
+ }
}
@Test(expected = JVMCIError.class)
@@ -830,6 +844,10 @@
assertNull(metaAccess.lookupJavaType(C.class).getClassInitializer());
assertNull(metaAccess.lookupJavaType(int.class).getClassInitializer());
assertNull(metaAccess.lookupJavaType(void.class).getClassInitializer());
+ for (Class<?> c : classes) {
+ ResolvedJavaType type = metaAccess.lookupJavaType(c);
+ type.getClassInitializer();
+ }
}
@Test
--- a/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java Thu Jan 18 18:58:46 2018 +0000
@@ -47,10 +47,6 @@
{"InitialRAMFraction", "64"},
{"AssumeMP", "false"},
{"UseMembar", "true"},
- {"FastTLABRefill", "false"},
- {"DeferPollingPageLoopCount", "-1"},
- {"SafepointSpinBeforeYield", "2000"},
- {"DeferThrSuspendLoopCount", "4000"},
// deprecated alias flags (see also aliased_jvm_flags):
{"DefaultMaxRAMFraction", "4"},
@@ -110,6 +106,5 @@
testDeprecated(DEPRECATED_OPTIONS); // Make sure that each deprecated option is mentioned in the output.
testDeprecatedDiagnostic("UnsyncloadClass", "false");
testDeprecatedDiagnostic("IgnoreUnverifiableClassesDuringDump", "false");
- testDeprecatedExperimental("UseCGroupMemoryLimitForHeap", "true");
}
}
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/ArchiveDoesNotExist.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/ArchiveDoesNotExist.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,7 +28,7 @@
* attempting to use CDS archive. JVM should exit gracefully
* when sharing mode is ON, and continue w/o sharing if sharing
* mode is AUTO.
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/BootAppendTests.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/BootAppendTests.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,7 +25,7 @@
* @test
* @requires vm.cds & !vm.graal.enabled
* @summary Testing -Xbootclasspath/a support for CDS
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsDifferentCompactStrings.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsDifferentCompactStrings.java Thu Jan 18 18:58:46 2018 +0000
@@ -26,7 +26,7 @@
* @requires vm.cds
* @summary CDS (class data sharing) requires the same -XX:[+-]CompactStrings
* setting between archive creation time and load time.
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java Thu Jan 18 18:58:46 2018 +0000
@@ -29,7 +29,7 @@
* This is a negative test; using object alignment for loading that
* is different from object alignment for creating a CDS file
* should fail when loading.
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @bug 8025642
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsSameObjectAlignment.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsSameObjectAlignment.java Thu Jan 18 18:58:46 2018 +0000
@@ -26,7 +26,7 @@
* @requires vm.cds
* @summary Testing CDS (class data sharing) using varying object alignment.
* Using same object alignment for each dump/load pair
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/DefaultUseWithClient.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/DefaultUseWithClient.java Thu Jan 18 18:58:46 2018 +0000
@@ -24,7 +24,7 @@
/*
* @test DefaultUseWithClient
* @summary Test default behavior of sharing with -client
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/DumpSharedDictionary.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/DumpSharedDictionary.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,7 +28,7 @@
* Feature support: compressed oops/kptrs, 64-bit os, not on windows
* @requires vm.cds
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* @run main DumpSharedDictionary
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/NonBootLoaderClasses.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/NonBootLoaderClasses.java Thu Jan 18 18:58:46 2018 +0000
@@ -24,7 +24,7 @@
/*
* @test NonBootLoaderClasses
* @summary Test to ensure platform and app classes are not being archived
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/PrintSharedArchiveAndExit.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/PrintSharedArchiveAndExit.java Thu Jan 18 18:58:46 2018 +0000
@@ -26,7 +26,7 @@
* @requires vm.cds
* @bug 8066670
* @summary Testing -XX:+PrintSharedArchiveAndExit option
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SASymbolTableTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SASymbolTableTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,7 +25,7 @@
* @test SASymbolTableTest
* @requires vm.cds
* @summary Walk symbol table using SA, with and without CDS.
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* jdk.hotspot.agent/sun.jvm.hotspot.oops
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedArchiveFile.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedArchiveFile.java Thu Jan 18 18:58:46 2018 +0000
@@ -26,7 +26,7 @@
* @requires vm.cds
* @bug 8014138
* @summary Testing new -XX:SharedArchiveFile=<file-name> option
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedBaseAddress.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedBaseAddress.java Thu Jan 18 18:58:46 2018 +0000
@@ -26,7 +26,7 @@
* @requires vm.cds
* @summary Test variety of values for SharedBaseAddress, making sure
* VM handles normal values as well as edge values w/o a crash.
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStrings.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStrings.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,7 +28,7 @@
* are actually shared
* Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.gc.G1
* @library /test/lib
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStringsDedup.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStringsDedup.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,7 +27,7 @@
* @summary Test -Xshare:auto with shared strings and -XX:+UseStringDeduplication
* Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.gc.G1
* @library /test/lib
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStringsRunAuto.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStringsRunAuto.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,7 +27,7 @@
* @summary Test -Xshare:auto with shared strings.
* Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.gc.G1
* @library /test/lib
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedSymbolTableBucketSize.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedSymbolTableBucketSize.java Thu Jan 18 18:58:46 2018 +0000
@@ -26,7 +26,7 @@
* @requires vm.cds
* @bug 8059510
* @summary Test SharedSymbolTableBucketSize option
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SpaceUtilizationCheck.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SpaceUtilizationCheck.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,7 +25,7 @@
* @test SpaceUtilizationCheck
* @requires vm.cds
* @summary Check if the space utilization for shared spaces is adequate
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/TestInterpreterMethodEntries.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/TestInterpreterMethodEntries.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,7 +27,7 @@
* @bug 8169711
* @summary Test interpreter method entries for intrinsics with CDS (class data sharing)
* and different settings of the intrinsic flag during dump/use of the archive.
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformInterfaceAndImplementor.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformInterfaceAndImplementor.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,7 +27,7 @@
* @summary Exercise initial transformation (ClassFileLoadHook)
* with CDS with Interface/Implementor pair
* @library /test/lib /runtime/SharedArchiveFile /testlibrary/jvmti
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.flavor != "minimal"
* @modules java.base/jdk.internal.misc
* jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformSuperAndSubClasses.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformSuperAndSubClasses.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,7 +28,7 @@
* @summary Exercise initial transformation (ClassFileLoadHook)
* with CDS with SubClass and SuperClass
* @library /test/lib /runtime/SharedArchiveFile /testlibrary/jvmti
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.flavor != "minimal"
* @modules java.base/jdk.internal.misc
* jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformSuperSubTwoPckgs.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformSuperSubTwoPckgs.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,7 +28,7 @@
* @summary Exercise initial transformation (ClassFileLoadHook)
* with CDS with SubClass and SuperClass, each lives in own separate package
* @library /test/lib /runtime/SharedArchiveFile /testlibrary/jvmti
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.flavor != "minimal"
* @modules java.base/jdk.internal.misc
* jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/AppendClasspath.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/AppendClasspath.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary At run time, it is OK to append new elements to the classpath that was used at dump time.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/BootClassPathMismatch.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/BootClassPathMismatch.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary bootclasspath mismatch test.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/CaseSensitiveClassPath.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/CaseSensitiveClassPath.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,7 +27,7 @@
* @test
* @summary Test case sensitive aspect of comparing class paths
* between dump time and archive use time
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/ClassLoaderTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/ClassLoaderTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Initiating and defining classloader test.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/ClassPathAttr.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/ClassPathAttr.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Class-Path: attribute in MANIFEST file
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/CommandLineFlagCombo.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/CommandLineFlagCombo.java Thu Jan 18 18:58:46 2018 +0000
@@ -24,8 +24,8 @@
/*
* @test CommandLineFlagCombo
- * AppCDS does not support uncompressed oops
- * @requires (vm.gc=="null") & ((vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true))
+ * @requires vm.cds
+ * @requires (vm.gc=="null")
* @summary Test command line flag combinations that
* could likely affect the behaviour of AppCDS
* @library /test/lib
--- a/test/hotspot/jtreg/runtime/appcds/CommandLineFlagComboNegative.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/CommandLineFlagComboNegative.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,8 +28,7 @@
* the dump and execute steps, in such way that they cause errors
* E.g. use compressed oops for creating and archive, but then
* execute w/o compressed oops
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/DirClasspathTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/DirClasspathTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary AppCDS handling of directories in -cp
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @run main DirClasspathTest
*/
--- a/test/hotspot/jtreg/runtime/appcds/DumpClassList.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/DumpClassList.java Thu Jan 18 18:58:46 2018 +0000
@@ -26,7 +26,7 @@
* @test
* @summary DumpLoadedClassList should exclude generated classes, classes in bootclasspath/a and
* --patch-module.
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/ExtraSymbols.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/ExtraSymbols.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,7 +25,7 @@
/*
* @test
* @summary Adding extra symbols into CDS archive using -XX:SharedArchiveConfigFile
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/FieldAnnotationsTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/FieldAnnotationsTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,7 +25,7 @@
/*
* @test
* @summary Test for field annotations.
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/FreeUnusedMetadata.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/FreeUnusedMetadata.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,7 +25,7 @@
/*
* @test
* @summary Unused metadata created during dump time should be freed from the CDS archive.
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules jdk.jartool/sun.tools.jar
* @compile test-classes/MethodNoReturn.jasm test-classes/Hello.java
--- a/test/hotspot/jtreg/runtime/appcds/HelloExtTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/HelloExtTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary a simple test for loading a class using the ext class loader in AppCDS
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/HelloTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/HelloTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Hello World test for AppCDS
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
@@ -36,7 +35,6 @@
*/
public class HelloTest {
-
public static void main(String[] args) throws Exception {
TestCommon.test(JarBuilder.getOrCreateHelloJar(),
TestCommon.list("Hello"), "Hello");
--- a/test/hotspot/jtreg/runtime/appcds/IgnoreEmptyClassPaths.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/IgnoreEmptyClassPaths.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Test the -XX:+IgnoreEmptyClassPaths flag
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/JvmtiAddPath.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/JvmtiAddPath.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary JvmtiEnv::AddToBootstrapClassLoaderSearch and JvmtiEnv::AddToSystemClassLoaderSearch should disable AppCDS
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @bug 8060592
* @library /test/lib
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/MismatchedUseAppCDS.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/MismatchedUseAppCDS.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Try different combination of mismatched UseAppCDS between dump time and run time.
- * (Note: AppCDS does not support uncompressed oops.)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/MissingSuperTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/MissingSuperTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,8 @@
/*
* @test
* @summary When super class is missing during dumping, no crash should happen.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ *
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/MultiProcessSharing.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/MultiProcessSharing.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,8 @@
/*
* @test
* @summary Run multiple processes with the same archive, ensure they share
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ *
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/MultiReleaseJars.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/MultiReleaseJars.java Thu Jan 18 18:58:46 2018 +0000
@@ -26,8 +26,7 @@
* @test MultiReleaseJars
* @bug 8170105
* @summary Test multi-release jar with AppCDS.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/OldClassTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/OldClassTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary classes with major version < JDK_1.5 (48) should not be included in CDS
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.org.objectweb.asm
* java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/PackageSealing.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/PackageSealing.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary AppCDS handling of package.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/ParallelLoad2.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/ParallelLoad2.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Load app classes from CDS archive in parallel threads. Similar to ParallelLoad.java, but each class in its own JAR
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/ParallelLoadTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/ParallelLoadTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,9 +25,8 @@
/*
* @test
* @summary Load app classes from CDS archive in parallel threads
- * AppCDS does not support uncompressed oops
* @library /test/lib
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @modules java.base/jdk.internal.misc
* java.management
* jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/PrintSharedArchiveAndExit.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/PrintSharedArchiveAndExit.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary test the -XX:+PrintSharedArchiveAndExit flag
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/ProhibitedPackage.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/ProhibitedPackage.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary AppCDS handling of prohibited package.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/ProtectionDomain.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/ProtectionDomain.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary AppCDS handling of protection domain.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/RewriteBytecodesTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/RewriteBytecodesTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -26,8 +26,7 @@
* @test
* @summary Use ClassLoader.defineClass() to load a class with rewritten bytecode. Make sure
* the archived class with the same name is not loaded.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/SharedArchiveConsistency.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/SharedArchiveConsistency.java Thu Jan 18 18:58:46 2018 +0000
@@ -23,20 +23,19 @@
*/
/*
- * @test
- * @summary SharedArchiveConsistency
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
- * @library /test/lib
- * @modules java.base/jdk.internal.misc
- * java.compiler
- * java.management
- * jdk.jartool/sun.tools.jar
- * jdk.internal.jvmstat/sun.jvmstat.monitor
- * @build sun.hotspot.WhiteBox
- * @compile test-classes/Hello.java
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI SharedArchiveConsistency
+ * @test
+ * @summary SharedArchiveConsistency
+ * @requires vm.cds
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ * java.compiler
+ * java.management
+ * jdk.jartool/sun.tools.jar
+ * jdk.internal.jvmstat/sun.jvmstat.monitor
+ * @build sun.hotspot.WhiteBox
+ * @compile test-classes/Hello.java
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI SharedArchiveConsistency
*/
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Utils;
--- a/test/hotspot/jtreg/runtime/appcds/SharedArchiveFile.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/SharedArchiveFile.java Thu Jan 18 18:58:46 2018 +0000
@@ -24,8 +24,7 @@
/*
* @test
* @summary The diagnostic option, -XX:SharedArchiveFile can be unlocked using -XX:+UseAppCDS
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/SharedBaseAddress.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/SharedBaseAddress.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,8 +27,7 @@
* @summary Test variety of values for SharedBaseAddress, in AppCDS mode,
* making sure VM handles normal values as well as edge values
* w/o a crash.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/SharedPackages.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/SharedPackages.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary AppCDS handling of package.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/SignedJar.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/SignedJar.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary AppCDS handling of signed JAR.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/SpecifySysLoaderProp.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/SpecifySysLoaderProp.java Thu Jan 18 18:58:46 2018 +0000
@@ -23,17 +23,16 @@
*/
/*
- * @test
- * @summary If -Djava.system.class.loader=xxx is specified in command-line, disable UseAppCDS
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
- * @library /test/lib
- * @modules java.base/jdk.internal.misc
+ * @test
+ * @summary If -Djava.system.class.loader=xxx is specified in command-line, disable UseAppCDS
+ * @requires vm.cds
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
* jdk.jartool/sun.tools.jar
- * @compile test-classes/TestClassLoader.java
- * @compile test-classes/ReportMyLoader.java
- * @compile test-classes/TrySwitchMyLoader.java
- * @run main SpecifySysLoaderProp
+ * @compile test-classes/TestClassLoader.java
+ * @compile test-classes/ReportMyLoader.java
+ * @compile test-classes/TrySwitchMyLoader.java
+ * @run main SpecifySysLoaderProp
*/
import java.io.*;
--- a/test/hotspot/jtreg/runtime/appcds/TraceLongClasspath.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/TraceLongClasspath.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary ensure -XX:+TraceClassPaths showing entire expecting app classpath
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/UseAppCDS.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/UseAppCDS.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Testing use of UseAppCDS flag
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/VerifierTest_0.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/VerifierTest_0.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Unverfiable app classes should not be archived.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* @modules jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/VerifierTest_1A.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/VerifierTest_1A.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Unverfiable app classes should not be archived.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* @modules jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/VerifierTest_1B.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/VerifierTest_1B.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Unverfiable app classes should not be archived.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* @modules jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/VerifierTest_2.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/VerifierTest_2.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Unverfiable app classes should not be archived.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* @modules jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/WideIloadTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/WideIloadTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,7 +25,7 @@
/**
* @test
* @summary Test 'iload_w' bytecode in shared class
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/WrongClasspath.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/WrongClasspath.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary classpath mismatch between dump time and execution time
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/XShareAutoWithChangedJar.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/XShareAutoWithChangedJar.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Test -Xshare:auto for AppCDS
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/CheckCachedResolvedReferences.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/CheckCachedResolvedReferences.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,7 +25,7 @@
/*
* @test
* @summary Test resolved_references
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.cds.custom.loaders
* @requires (vm.gc=="null")
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/DumpTimeVerifyFailure.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/DumpTimeVerifyFailure.java Thu Jan 18 18:58:46 2018 +0000
@@ -26,7 +26,7 @@
* @test
* @summary Dump time should not crash if any class with shared strings fails verification due to missing dependencies.
* @bug 8186789
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
* @requires (vm.gc=="null")
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/GCStressTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/GCStressTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,7 +25,7 @@
/*
* @test
* @summary
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
* @requires (vm.gc=="null")
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/OpenArchiveRegion.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/OpenArchiveRegion.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,7 +25,7 @@
/*
* @test
* @summary Test open archive heap regions
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
* @requires (vm.gc=="null")
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/RangeNotWithinHeap.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/RangeNotWithinHeap.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,7 +28,7 @@
* mapped due to out of range, and -Xshare:on should not fail. Test on
* linux 64-bit only since the HeapBaseMinAddress value is platform specific.
* The value used in the test may cause different behavior on other platforms.
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires (os.family == "linux") & (os.arch == "amd64") & (sun.arch.data.model == "64")
* @requires (vm.gc=="null")
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/RedefineClassTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/RedefineClassTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -26,7 +26,7 @@
* @test
* @summary Redefine shared class. GC should not cause crash with cached resolved_references.
* @library /test/lib /test/hotspot/jtreg/runtime/appcds /test/hotspot/jtreg/runtime/appcds/test-classes /test/hotspot/jtreg/runtime/appcds/jvmti
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.gc.G1
* @requires vm.flavor != "minimal"
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatA.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatA.java Thu Jan 18 18:58:46 2018 +0000
@@ -26,8 +26,7 @@
* @test
* @summary Tests the format checking of class list format.
*
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.cds.custom.loaders
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatB.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatB.java Thu Jan 18 18:58:46 2018 +0000
@@ -26,8 +26,7 @@
* @test
* @summary Tests the format checking of hotspot/src/closed/share/vm/classfile/classListParser.cpp.
*
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.cds.custom.loaders
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatC.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatC.java Thu Jan 18 18:58:46 2018 +0000
@@ -26,8 +26,7 @@
* @test
* @summary Tests the format checking of hotspot/src/closed/share/vm/classfile/classListParser.cpp.
*
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.cds.custom.loaders
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatD.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatD.java Thu Jan 18 18:58:46 2018 +0000
@@ -26,8 +26,7 @@
* @test
* @summary Tests the format checking of hotspot/src/closed/share/vm/classfile/classListParser.cpp.
*
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.cds.custom.loaders
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatE.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatE.java Thu Jan 18 18:58:46 2018 +0000
@@ -26,8 +26,7 @@
* @test
* @summary Tests the format checking of hotspot/src/closed/share/vm/classfile/classListParser.cpp.
*
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.cds.custom.loaders
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/HelloCustom.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/HelloCustom.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Hello World test for AppCDS custom loader support
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.cds.custom.loaders
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/LoaderSegregationTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/LoaderSegregationTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -26,8 +26,7 @@
* @test
* @summary Check that during dumping, the classes for BOOT/EXT/APP loaders are segregated from the
* custom loader classes.
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.cds.custom.loaders
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ParallelTestMultiFP.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ParallelTestMultiFP.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Load classes from CDS archive into multiple custom loader using parallel threads
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.cds.custom.loaders
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ParallelTestSingleFP.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ParallelTestSingleFP.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Load classes from CDS archive into a single custom loader using parallel threads (finger print)
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.cds.custom.loaders
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ProhibitedPackageNamesTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ProhibitedPackageNamesTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Make sure prohibited packages cannot be stored into archive for custom loaders.
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.cds.custom.loaders
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ProtectionDomain.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ProtectionDomain.java Thu Jan 18 18:58:46 2018 +0000
@@ -26,8 +26,7 @@
* @test
* @summary AppCDS handling of protection domain in custom loaders.
*
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.cds.custom.loaders
*
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/SameNameInTwoLoadersTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/SameNameInTwoLoadersTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -26,8 +26,7 @@
* @test
* @summary Testing the loading of a class with the same name in two different class loaders.
*
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.cds.custom.loaders
*
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/UnintendedLoadersTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/UnintendedLoadersTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Make sure classes intended for custom loaders cannot be loaded by BOOT/EXT/APP loaders
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.cds.custom.loaders
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/UnloadUnregisteredLoaderTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/UnloadUnregisteredLoaderTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -26,8 +26,7 @@
* @test
* @summary Test the behavior when shared classes loaded by custom loaders are
* unloaded.
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.cds.custom.loaders
* @library /test/lib /test/hotspot/jtreg/runtime/appcds /test/hotspot/jtreg/runtime/testlibrary
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/UnsupportedPlatforms.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/UnsupportedPlatforms.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,6 @@
/*
* @test
* @summary Ensure that support for AppCDS custom class loaders are not enabled on unsupported platforms.
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
* @requires vm.cds
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/javaldr/ArrayTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/javaldr/ArrayTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary test the ability to archive array classes and load them from the archive
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules jdk.jartool/sun.tools.jar
* @compile ArrayTestHelper.java
--- a/test/hotspot/jtreg/runtime/appcds/javaldr/CheckAnonymousClass.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/javaldr/CheckAnonymousClass.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary ensure no anonymous class is being dumped into the CDS archive
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules jdk.jartool/sun.tools.jar
* @compile ../test-classes/Hello.java
--- a/test/hotspot/jtreg/runtime/appcds/javaldr/GCDuringDump.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/javaldr/GCDuringDump.java Thu Jan 18 18:58:46 2018 +0000
@@ -26,7 +26,7 @@
* @test
* @summary When dumping the CDS archive, try to cause garbage collection while classes are being loaded.
* @library /test/lib /test/hotspot/jtreg/runtime/appcds /test/hotspot/jtreg/runtime/appcds/test-classes
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.flavor != "minimal"
* @modules java.base/jdk.internal.misc
* jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/javaldr/GCSharedStringsDuringDump.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/javaldr/GCSharedStringsDuringDump.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,7 +28,7 @@
* option for testing the interaction with GC and shared strings.
* @library /test/lib /test/hotspot/jtreg/runtime/appcds /test/hotspot/jtreg/runtime/appcds/test-classes
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.flavor != "minimal"
* @requires vm.gc.G1
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/CheckUnsupportedDumpingOptions.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/CheckUnsupportedDumpingOptions.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Abort dumping if any of the new jigsaw vm options is specified.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib ..
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/JigsawOptionsCombo.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/JigsawOptionsCombo.java Thu Jan 18 18:58:46 2018 +0000
@@ -26,8 +26,7 @@
* @test
* @summary Test combinations of jigsaw options that affect the use of AppCDS
*
- * AppCDS does not support uncompressed oops
- * @requires ((vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)) & !vm.graal.enabled
+ * @requires vm.cds & !vm.graal.enabled
* @library /test/lib ..
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/AppClassInCP.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/AppClassInCP.java Thu Jan 18 18:58:46 2018 +0000
@@ -24,7 +24,7 @@
/*
* @test
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @summary a test to demonstrate that an application class in the -cp
* will be archived although --patch-module is specified. The class in
* the -cp has no dependencies on the class in the --patch-module.
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/CustomPackage.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/CustomPackage.java Thu Jan 18 18:58:46 2018 +0000
@@ -24,7 +24,7 @@
/*
* @test
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @summary if a class is defined to a package which is not defined to any
* module in the jimage, the class will not be found during dump
* time but it will be used during run time.
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/MismatchedPatchModule.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/MismatchedPatchModule.java Thu Jan 18 18:58:46 2018 +0000
@@ -24,7 +24,7 @@
/*
* @test
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @summary different settings of --patch-module at dump time and runtime are
* acceptable. The class found in runtime --patch-module entry should
* be used.
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/PatchDir.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/PatchDir.java Thu Jan 18 18:58:46 2018 +0000
@@ -24,7 +24,7 @@
/*
* @test
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @summary a simple test to ensure that a directory in the --patch-module
* option does not affect dump process
* @library ../..
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/PatchJavaBase.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/PatchJavaBase.java Thu Jan 18 18:58:46 2018 +0000
@@ -24,7 +24,7 @@
/*
* @test
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @summary sharing is disabled if java.base is patch at runtime
* @library ../..
* @library /test/hotspot/jtreg/testlibrary
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/Simple.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/Simple.java Thu Jan 18 18:58:46 2018 +0000
@@ -24,7 +24,7 @@
/*
* @test
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @summary a simple test to ensure that class is loaded from jar file in --patch-module at runtime
* @library ../..
* @library /test/hotspot/jtreg/testlibrary
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/SubClassOfPatchedClass.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/SubClassOfPatchedClass.java Thu Jan 18 18:58:46 2018 +0000
@@ -24,7 +24,7 @@
/*
* @test
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @summary the class in the -cp is a subclass of the class in --patch-module. The
* patched class should be used at runtime.
* @library ../..
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/TwoJars.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/TwoJars.java Thu Jan 18 18:58:46 2018 +0000
@@ -24,7 +24,7 @@
/*
* @test
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @summary a patched class found in --patch-module should be used at runtime
* @library ../..
* @library /test/hotspot/jtreg/testlibrary
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/BootAppendTests.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/BootAppendTests.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,7 +25,7 @@
/**
* @test
* @summary AppCDS tests for testing -Xbootclasspath/a
- * @requires ((vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)) & !vm.graal.enabled
+ * @requires vm.cds & !vm.graal.enabled
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/ClassPathTests.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/ClassPathTests.java Thu Jan 18 18:58:46 2018 +0000
@@ -24,7 +24,7 @@
/**
* @test
- * @requires ((vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)) & !vm.graal.enabled
+ * @requires vm.cds & !vm.graal.enabled
* @library ../..
* @library /test/lib
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/DummyClassesInBootClassPath.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/DummyClassesInBootClassPath.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Ensure that classes found in jimage takes precedence over classes found in -Xbootclasspath/a.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.activation
* jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/EmptyClassInBootClassPath.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/EmptyClassInBootClassPath.java Thu Jan 18 18:58:46 2018 +0000
@@ -29,7 +29,7 @@
* 2) app loader will load the class from the jimage by default;
* app loader will load the class from the bootclasspath if the
* "--limit-modules java.base" option is specified
- * @requires ((vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)) & !vm.graal.enabled
+ * @requires vm.cds & !vm.graal.enabled
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/limitmods/LimitModsTests.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/limitmods/LimitModsTests.java Thu Jan 18 18:58:46 2018 +0000
@@ -24,7 +24,7 @@
/**
* @test
- * @requires ((vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)) & !vm.graal.enabled
+ * @requires vm.cds & !vm.graal.enabled
* @library ../..
* @library /test/lib
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/OverrideTests.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/OverrideTests.java Thu Jan 18 18:58:46 2018 +0000
@@ -24,7 +24,7 @@
/**
* @test
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @modules java.base/jdk.internal.misc
* @library ../..
* @library /test/lib
--- a/test/hotspot/jtreg/runtime/appcds/jvmti/ClassFileLoadHookTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jvmti/ClassFileLoadHookTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -26,7 +26,7 @@
* @test
* @summary Test jvmti class file loader hook interaction with AppCDS
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @modules java.base/jdk.internal.misc
* jdk.jartool/sun.tools.jar
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/jvmti/InstrumentationTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jvmti/InstrumentationTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,7 +27,7 @@
* @summary Exercise the java.lang.instrument.Instrumentation APIs on classes archived
* using CDS/AppCDSv1/AppCDSv2.
* @library /test/lib /test/hotspot/jtreg/runtime/appcds /test/hotspot/jtreg/runtime/appcds/test-classes
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.flavor != "minimal"
* @modules java.base/jdk.internal.misc
* jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/jvmti/parallelLoad/ParallelLoadAndTransformTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jvmti/parallelLoad/ParallelLoadAndTransformTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -29,7 +29,7 @@
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* /test/hotspot/jtreg/runtime/appcds/test-classes /test/hotspot/jtreg/runtime/appcds/jvmti
* /test/hotspot/jtreg/testlibrary/jvmti
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @modules java.base/jdk.internal.misc
* java.management
* jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/jvmti/transformRelatedClasses/TransformInterfaceImplementorAppCDS.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jvmti/transformRelatedClasses/TransformInterfaceImplementorAppCDS.java Thu Jan 18 18:58:46 2018 +0000
@@ -32,7 +32,7 @@
* /test/hotspot/jtreg/runtime/SharedArchiveFile /test/hotspot/jtreg/testlibrary/jvmti
* /test/hotspot/jtreg/runtime/appcds/customLoader
* /test/hotspot/jtreg/runtime/appcds/customLoader/test-classes
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.flavor != "minimal"
* @modules java.base/jdk.internal.misc
* jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/jvmti/transformRelatedClasses/TransformSuperSubAppCDS.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jvmti/transformRelatedClasses/TransformSuperSubAppCDS.java Thu Jan 18 18:58:46 2018 +0000
@@ -32,7 +32,7 @@
* /test/hotspot/jtreg/runtime/SharedArchiveFile /test/hotspot/jtreg/testlibrary/jvmti
* /test/hotspot/jtreg/runtime/appcds/customLoader
* /test/hotspot/jtreg/runtime/appcds/customLoader/test-classes
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.flavor != "minimal"
* @modules java.base/jdk.internal.misc
* jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/redefineClass/RedefineBasicTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/redefineClass/RedefineBasicTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -26,8 +26,7 @@
* @test
* @summary Run /runtime/RedefineTests/RedefineRunningMethods in AppCDS mode to
* make sure class redefinition works with CDS.
- * (Note: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib /test/hotspot/jtreg/runtime/RedefineTests /test/hotspot/jtreg/runtime/appcds
* @modules java.compiler
* java.instrument
--- a/test/hotspot/jtreg/runtime/appcds/redefineClass/RedefineRunningMethods_Shared.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/redefineClass/RedefineRunningMethods_Shared.java Thu Jan 18 18:58:46 2018 +0000
@@ -26,8 +26,7 @@
* @test
* @summary Run /runtime/RedefineTests/RedefineRunningMethods in AppCDS mode to
* make sure class redefinition works with CDS.
- * (Note: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib /test/hotspot/jtreg/runtime/RedefineTests /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
* @modules java.compiler
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/ExerciseGC.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/ExerciseGC.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,7 +25,7 @@
/*
* @test
* @summary Exercise GC with shared strings
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.gc.G1
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
* @library /test/hotspot/jtreg/runtime/appcds /test/lib
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/FlagCombo.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/FlagCombo.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,7 +25,7 @@
/*
* @test
* @summary Test relevant combinations of command line flags with shared strings
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
* @requires (vm.gc=="null")
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,7 +28,7 @@
* Also test mismatch in oops encoding between dump time and run time
* Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires (vm.gc=="null")
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/InternSharedString.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/InternSharedString.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,7 +27,7 @@
* @summary Test shared strings together with string intern operation
* Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.gc.G1
* @library /test/hotspot/jtreg/runtime/appcds /test/lib
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/InvalidFileFormat.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/InvalidFileFormat.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,7 +27,7 @@
* @summary Check most common errors in file format
* Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.gc.G1
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/LargePages.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/LargePages.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,7 +27,7 @@
* @summary Basic shared string test with large pages
* Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.gc.G1
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/LockSharedStrings.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/LockSharedStrings.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,7 +27,7 @@
* @summary Test locking on shared strings
* Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.gc.G1
* @library /test/hotspot/jtreg/runtime/appcds /test/lib
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasic.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasic.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,7 +27,7 @@
* @summary Basic test for shared strings
* Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.gc.G1
* @library /test/hotspot/jtreg/runtime/appcds /test/lib
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasicPlus.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasicPlus.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,7 +27,7 @@
* @summary Basic plus test for shared strings
* Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.gc.G1
* @library /test/hotspot/jtreg/runtime/appcds /test/lib
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsStress.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsStress.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,7 +27,7 @@
* @summary Write a lots of shared strings.
* Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.gc.G1
* @library /test/hotspot/jtreg/runtime/appcds /test/lib
* @modules jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsWbTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsWbTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,7 +27,7 @@
* @summary White box test for shared strings
* Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.gc.G1
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SysDictCrash.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SysDictCrash.java Thu Jan 18 18:58:46 2018 +0000
@@ -26,7 +26,7 @@
* @test
* @summary Regression test for JDK-8098821
* @bug 8098821
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.gc.G1
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/classFileParserBug/Class55.jasm Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2017, 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 8173382
+ * @summary Check that the JVM accepts class files with version 55
+ * @run main Class55
+ */
+
+super public class Class55 version 55:0 {
+
+ public Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+ public static Method main:"([Ljava/lang/String;)V" stack 0 locals 1 {
+ return;
+ }
+
+} // end Class Class55
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/AbstractClone.java Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2017, 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 8154587
+ * @summary Check that invokeinterface of clone() works properly where clone() is
+ * an abstract method in a superinterface and also overridden locally.
+ * @run main AbstractClone
+ */
+
+public class AbstractClone {
+
+ interface I1 {
+ Object clone();
+ }
+
+ interface I2 extends I1 { }
+
+ static class C implements I2 {
+ public Object clone() {
+ return "In C's clone()";
+ }
+ }
+
+ static Object test(I2 i) { return i.clone(); }
+
+ public static void main(String[] args) {
+ String s = (String)test(new C());
+ if (!s.equals("In C's clone()")) {
+ throw new RuntimeException("Wrong clone() called");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/AbstractNoClones.jasm Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2017, 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 8154587
+ * @summary Check that invokeinterface of clone() works properly where clone() is
+ * an abstract method in a superinterface and not overridden locally.
+ * @compile AbstractNoClones.jasm
+ * @run main AbstractNoClones
+ */
+
+// The below .jasm code implements the following java code:
+//
+// public class AbstractNoClones {
+//
+// interface I1 {
+// Object clone();
+// }
+//
+// interface I2 extends I1 { }
+//
+// static class C implements I2 { }
+//
+// static Object test(I2 i) { return i.clone(); }
+//
+// public static void main(String[] args) {
+// try {
+// String s = (String)test(new C());
+// throw new RuntimeException("Expected IAE not thrown");
+// } catch (java.lang.IllegalAccessError e) {
+// if (!e.toString().contains("C.clone")) {
+// throw new RuntimeException("Wrong IllegalAccessError exception thrown");
+// }
+// }
+// }
+// }
+
+
+interface AbstractNoClones$I1 version 53:0 {
+
+ public abstract Method clone:"()Ljava/lang/Object;";
+
+ static abstract interface InnerClass I1=class AbstractNoClones$I1 of class AbstractNoClones;
+
+} // end Class AbstractNoClones$I1
+
+
+interface AbstractNoClones$I2 implements AbstractNoClones$I1 version 53:0 {
+
+ static abstract interface InnerClass I2=class AbstractNoClones$I2 of class AbstractNoClones;
+ static abstract interface InnerClass I1=class AbstractNoClones$I1 of class AbstractNoClones;
+
+} // end Class AbstractNoClones$I2
+
+
+super class AbstractNoClones$C implements AbstractNoClones$I2 version 53:0 {
+
+ Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+ static InnerClass C=class AbstractNoClones$C of class AbstractNoClones;
+ static abstract interface InnerClass I2=class AbstractNoClones$I2 of class AbstractNoClones;
+
+} // end Class AbstractNoClones$C
+
+
+super public class AbstractNoClones version 53:0 {
+
+ public Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+ static Method test:"(LAbstractNoClones$I2;)Ljava/lang/Object;" stack 1 locals 1 {
+ aload_0;
+ invokeinterface InterfaceMethod AbstractNoClones$I2.clone:"()Ljava/lang/Object;", 1;
+ areturn;
+ }
+
+ public static Method main:"([Ljava/lang/String;)V" stack 3 locals 2 {
+ try t0;
+ new class AbstractNoClones$C;
+ dup;
+ invokespecial Method AbstractNoClones$C."<init>":"()V";
+ invokestatic Method test:"(LAbstractNoClones$I2;)Ljava/lang/Object;";
+ checkcast class java/lang/String;
+ astore_1;
+ new class java/lang/RuntimeException;
+ dup;
+ ldc String "Expected IAE not thrown";
+ invokespecial Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+ athrow;
+ endtry t0;
+ catch t0 java/lang/IllegalAccessError;
+ stack_frame_type stack1;
+ stack_map class java/lang/IllegalAccessError;
+ astore_1;
+ aload_1;
+ invokevirtual Method java/lang/IllegalAccessError.toString:"()Ljava/lang/String;";
+ ldc String "C.clone";
+ invokevirtual Method java/lang/String.contains:"(Ljava/lang/CharSequence;)Z";
+ ifne L47;
+ new class java/lang/RuntimeException;
+ dup;
+ ldc String "Wrong IllegalAccessError exception thrown";
+ invokespecial Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+ athrow;
+ L47: stack_frame_type same;
+ return;
+ }
+
+ static InnerClass C=class AbstractNoClones$C of class AbstractNoClones;
+ static abstract interface InnerClass I2=class AbstractNoClones$I2 of class AbstractNoClones;
+ static abstract interface InnerClass I1=class AbstractNoClones$I1 of class AbstractNoClones;
+
+} // end Class AbstractNoClones
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/DefaultClone.jasm Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2017, 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 8154587
+ * @summary Check that a default method named clone() does not get masked by
+ * java.lang.Object.clone() during resolution.
+ * @compile DefaultClone.jasm
+ * @run main DefaultClone
+ */
+
+// The below .jasm code implements the following java code:
+//
+// public class DefaultClone {
+//
+// interface I1 {
+// default Object clone() {
+// return "In I1's clone()";
+// }
+// }
+//
+//
+// interface I2 extends I1 { }
+//
+//
+// static class C implements I2 {
+// public Object clone() {
+// return "In C's clone()";
+// }
+// }
+//
+//
+// static Object test(I2 i) { return i.clone(); }
+//
+// public static void main(String[] args) {
+// String s = (String)test(new C());
+// if (!s.equals("In C's clone()")) {
+// throw new RuntimeException("Wrong clone() called");
+// }
+// }
+// }
+
+
+interface DefaultClone$I1 version 53:0 {
+
+ public Method clone:"()Ljava/lang/Object;" stack 1 locals 1 {
+ ldc String "In I1\'s clone()";
+ areturn;
+ }
+
+ static abstract interface InnerClass I1=class DefaultClone$I1 of class DefaultClone;
+
+} // end Class DefaultClone$I1
+
+
+
+interface DefaultClone$I2 implements DefaultClone$I1 version 53:0 {
+
+ static abstract interface InnerClass I2=class DefaultClone$I2 of class DefaultClone;
+ static abstract interface InnerClass I1=class DefaultClone$I1 of class DefaultClone;
+
+} // end Class DefaultClone$I2
+
+
+super class DefaultClone$C implements DefaultClone$I2 version 53:0 {
+
+ Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+ public Method clone:"()Ljava/lang/Object;" stack 1 locals 1 {
+ ldc String "In C\'s clone()";
+ areturn;
+ }
+
+ static InnerClass C=class DefaultClone$C of class DefaultClone;
+ static abstract interface InnerClass I2=class DefaultClone$I2 of class DefaultClone;
+
+} // end Class DefaultClone$C
+
+
+super public class DefaultClone version 53:0 {
+
+ public Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+ static Method test:"(LDefaultClone$I2;)Ljava/lang/Object;" stack 1 locals 1 {
+ aload_0;
+ invokeinterface InterfaceMethod DefaultClone$I2.clone:"()Ljava/lang/Object;", 1;
+ areturn;
+ }
+
+ public static Method main:"([Ljava/lang/String;)V" stack 3 locals 2 {
+ new class DefaultClone$C;
+ dup;
+ invokespecial Method DefaultClone$C."<init>":"()V";
+ invokestatic Method test:"(LDefaultClone$I2;)Ljava/lang/Object;";
+ checkcast class java/lang/String;
+ astore_1;
+ aload_1;
+ ldc String "In C\'s clone()";
+ invokevirtual Method java/lang/String.equals:"(Ljava/lang/Object;)Z";
+ ifne L33;
+ new class java/lang/RuntimeException;
+ dup;
+ ldc String "Wrong clone() called";
+ invokespecial Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+ athrow;
+ L33: stack_frame_type append;
+ locals_map class java/lang/String;
+ return;
+ }
+
+ static InnerClass C=class DefaultClone$C of class DefaultClone;
+ static abstract interface InnerClass I2=class DefaultClone$I2 of class DefaultClone;
+ static abstract interface InnerClass I1=class DefaultClone$I1 of class DefaultClone;
+
+} // end Class DefaultClone
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/DefaultFinalize.jasm Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2017, 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 8154587
+ * @summary Check that a default method named finalize() does not get masked by
+ * java.lang.Object.finalize() during resolution.
+ * @compile DefaultFinalize.jasm
+ * @run main DefaultFinalize
+ */
+
+// The below .jasm code implements the following java code:
+//
+// public class DefaultFinalize {
+//
+// static String res;
+//
+// interface I1 {
+// default void finalize() {
+// res = "In I1's finalize()";
+// }
+// }
+//
+// interface I2 extends I1 { }
+//
+// static class C implements I2 {
+// public void finalize() {
+// res = "In C's finalize()";
+// }
+// }
+//
+// static void test(I2 i) { i.finalize(); }
+//
+// public static void main(String[] args) {
+// test(new C());
+// if (!res.equals("In C's finalize()")) {
+// throw new RuntimeException("Wrong finalize() method called");
+// }
+// }
+// }
+
+
+interface DefaultFinalize$I1 version 54:0 {
+
+ public Method finalize:"()V" stack 1 locals 1 {
+ ldc String "In I1\'s finalize()";
+ putstatic Field DefaultFinalize.res:"Ljava/lang/String;";
+ return;
+ }
+
+ static abstract interface InnerClass I1=class DefaultFinalize$I1 of class DefaultFinalize;
+
+} // end Class DefaultFinalize$I1
+
+
+interface DefaultFinalize$I2 implements DefaultFinalize$I1 version 54:0 {
+
+ static abstract interface InnerClass I2=class DefaultFinalize$I2 of class DefaultFinalize;
+ static abstract interface InnerClass I1=class DefaultFinalize$I1 of class DefaultFinalize;
+
+} // end Class DefaultFinalize$I2
+
+
+super class DefaultFinalize$C implements DefaultFinalize$I2 version 54:0 {
+
+ Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+ public Method finalize:"()V" stack 1 locals 1 {
+ ldc String "In C\'s finalize()";
+ putstatic Field DefaultFinalize.res:"Ljava/lang/String;";
+ return;
+ }
+
+ static InnerClass C=class DefaultFinalize$C of class DefaultFinalize;
+ static abstract interface InnerClass I2=class DefaultFinalize$I2 of class DefaultFinalize;
+
+} // end Class DefaultFinalize$C
+
+
+super public class DefaultFinalize version 54:0 {
+
+ static Field res:"Ljava/lang/String;";
+
+ public Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+ static Method test:"(LDefaultFinalize$I2;)V" stack 1 locals 1 {
+ aload_0;
+ invokeinterface InterfaceMethod DefaultFinalize$I2.finalize:"()V", 1;
+ return;
+ }
+
+ public static Method main:"([Ljava/lang/String;)V" stack 3 locals 1 {
+ new class DefaultFinalize$C;
+ dup;
+ invokespecial Method DefaultFinalize$C."<init>":"()V";
+ invokestatic Method test:"(LDefaultFinalize$I2;)V";
+ getstatic Field res:"Ljava/lang/String;";
+ ldc String "In C\'s finalize()";
+ invokevirtual Method java/lang/String.equals:"(Ljava/lang/Object;)Z";
+ ifne L31;
+ new class java/lang/RuntimeException;
+ dup;
+ ldc String "Wrong finalize() method called";
+ invokespecial Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+ athrow;
+ L31: stack_frame_type same;
+ return;
+ }
+
+ static InnerClass C=class DefaultFinalize$C of class DefaultFinalize;
+ static abstract interface InnerClass I2=class DefaultFinalize$I2 of class DefaultFinalize;
+ static abstract interface InnerClass I1=class DefaultFinalize$I1 of class DefaultFinalize;
+
+} // end Class DefaultFinalize
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/DefaultHashCode.jasm Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2017, 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 8154587
+ * @summary Check that invokeinterface calls the right hashCode() method when
+ * there is both a local method named hashCode() and a default method
+ * named hashCode().
+ * @compile DefaultHashCode.jasm
+ * @run main DefaultHashCode
+ */
+
+// The below .jasm code implements the following java code:
+//
+// public class DefaultHashCode {
+//
+// interface I2 {
+// default int hashCode() {
+// return 5;
+// }
+// }
+//
+// static class C implements I2 {
+// public int hashCode() {
+// return 4;
+// }
+// }
+//
+// static int test(I2 i) { return i.hashCode(); }
+//
+// public static void main(String[] args) {
+// if (test(new C()) != 4) {
+// throw new RuntimeException("Wrong hashCode() function called");
+// }
+// }
+// }
+
+
+interface DefaultHashCode$I2 version 53:0 {
+
+ public Method hashCode:"()I" stack 1 locals 1 {
+ iconst_5;
+ ireturn;
+ }
+
+ static abstract interface InnerClass I2=class DefaultHashCode$I2 of class DefaultHashCode;
+
+} // end Class DefaultHashCode$I2
+
+
+super class DefaultHashCode$C implements DefaultHashCode$I2 version 53:0 {
+
+ Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+ public Method hashCode:"()I" stack 1 locals 1 {
+ iconst_4;
+ ireturn;
+ }
+
+ static InnerClass C=class DefaultHashCode$C of class DefaultHashCode;
+ static abstract interface InnerClass I2=class DefaultHashCode$I2 of class DefaultHashCode;
+
+} // end Class DefaultHashCode$C
+
+
+super public class DefaultHashCode version 53:0 {
+
+ public Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+ static Method test:"(LDefaultHashCode$I2;)I" stack 1 locals 1 {
+ aload_0;
+ invokeinterface InterfaceMethod DefaultHashCode$I2.hashCode:"()I", 1;
+ ireturn;
+ }
+
+ public static Method main:"([Ljava/lang/String;)V" stack 3 locals 1 {
+ new class DefaultHashCode$C;
+ dup;
+ invokespecial Method DefaultHashCode$C."<init>":"()V";
+ invokestatic Method test:"(LDefaultHashCode$I2;)I";
+ iconst_4;
+ if_icmpeq L24;
+ new class java/lang/RuntimeException;
+ dup;
+ ldc String "Wrong hashCode() function called";
+ invokespecial Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+ athrow;
+ L24: stack_frame_type same;
+ return;
+ }
+
+ static InnerClass C=class DefaultHashCode$C of class DefaultHashCode;
+ static abstract interface InnerClass I2=class DefaultHashCode$I2 of class DefaultHashCode;
+
+} // end Class DefaultHashCode
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/DefaultNoCloneInC.jasm Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2017, 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 8154587
+ * @summary Check that calling clone() with an invokeinterface opcode throws an IAE
+ * even if there is a default method named clone() in a super interface.
+ * @compile DefaultNoCloneInC.jasm
+ * @run main DefaultNoCloneInC
+ */
+
+// The below .jasm code implements the following java code:
+//
+// public class DefaultNoCloneInC {
+//
+// interface I1 {
+// default Object clone() {
+// return "In I1's clone()";
+// }
+// }
+//
+//
+// interface I2 extends I1 { }
+//
+//
+// static class C implements I2 { }
+//
+//
+// static Object test(I2 i) { return i.clone(); }
+//
+// public static void main(String[] args) {
+// try {
+// String s = (String)test(new C());
+// throw new RuntimeException("Expected IAE not thrown");
+// } catch (java.lang.IllegalAccessError e) {
+// if (!e.toString().contains("C.clone")) {
+// throw new RuntimeException("Wrong IllegalAccessError exception thrown");
+// }
+// }
+// }
+// }
+
+
+interface DefaultNoCloneInC$I1 version 53:0 {
+
+ public Method clone:"()Ljava/lang/Object;" stack 1 locals 1 {
+ ldc String "In I1\'s clone()";
+ areturn;
+ }
+
+ static abstract interface InnerClass I1=class DefaultNoCloneInC$I1 of class DefaultNoCloneInC;
+
+} // end Class DefaultNoCloneInC$I1
+
+
+interface DefaultNoCloneInC$I2 implements DefaultNoCloneInC$I1 version 53:0 {
+
+ static abstract interface InnerClass I2=class DefaultNoCloneInC$I2 of class DefaultNoCloneInC;
+ static abstract interface InnerClass I1=class DefaultNoCloneInC$I1 of class DefaultNoCloneInC;
+
+} // end Class DefaultNoCloneInC$I2
+
+
+super class DefaultNoCloneInC$C implements DefaultNoCloneInC$I2 version 53:0 {
+
+
+ Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+ static InnerClass C=class DefaultNoCloneInC$C of class DefaultNoCloneInC;
+ static abstract interface InnerClass I2=class DefaultNoCloneInC$I2 of class DefaultNoCloneInC;
+
+} // end Class DefaultNoCloneInC$C
+
+
+super public class DefaultNoCloneInC version 53:0 {
+
+ public Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+ static Method test:"(LDefaultNoCloneInC$I2;)Ljava/lang/Object;" stack 1 locals 1 {
+ aload_0;
+ invokeinterface InterfaceMethod DefaultNoCloneInC$I2.clone:"()Ljava/lang/Object;", 1;
+ areturn;
+ }
+
+ public static Method main:"([Ljava/lang/String;)V" stack 3 locals 2 {
+ try t0;
+ new class DefaultNoCloneInC$C;
+ dup;
+ invokespecial Method DefaultNoCloneInC$C."<init>":"()V";
+ invokestatic Method test:"(LDefaultNoCloneInC$I2;)Ljava/lang/Object;";
+ checkcast class java/lang/String;
+ astore_1;
+ new class java/lang/RuntimeException;
+ dup;
+ ldc String "Expected IAE not thrown";
+ invokespecial Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+ athrow;
+ endtry t0;
+ catch t0 java/lang/IllegalAccessError;
+ stack_frame_type stack1;
+ stack_map class java/lang/IllegalAccessError;
+ astore_1;
+ aload_1;
+ invokevirtual Method java/lang/IllegalAccessError.toString:"()Ljava/lang/String;";
+ ldc String "C.clone";
+ invokevirtual Method java/lang/String.contains:"(Ljava/lang/CharSequence;)Z";
+ ifne L47;
+ new class java/lang/RuntimeException;
+ dup;
+ ldc String "Wrong IllegalAccessError exception thrown";
+ invokespecial Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+ athrow;
+ L47: stack_frame_type same;
+ return;
+ }
+
+ static InnerClass C=class DefaultNoCloneInC$C of class DefaultNoCloneInC;
+ static abstract interface InnerClass I2=class DefaultNoCloneInC$I2 of class DefaultNoCloneInC;
+ static abstract interface InnerClass I1=class DefaultNoCloneInC$I1 of class DefaultNoCloneInC;
+
+} // end Class DefaultNoCloneInC
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/LocalClone.jasm Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2017, 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 8154587
+ * @summary Check that method resolution for invokeinterface of clone() fails
+ * if it cannot find a public method named clone().
+ * @compile LocalClone.jasm
+ * @run main LocalClone
+ */
+
+// The below .jasm code implements the following java code:
+//
+// interface I1 { }
+//
+//
+// public class LocalClone {
+//
+// interface I2 extends I1 { }
+//
+//
+// static class C implements I2 {
+// public Object clone() {
+// return "In C's clone()";
+// }
+// }
+//
+// static Object test(I2 i) { return i.clone(); }
+//
+// public static void main(String[] args) {
+// try {
+// String s = (String)test(new C());
+// throw new RuntimeException("Expected NSME not thrown");
+// } catch (java.lang.NoSuchMethodError e) {
+// if (!e.toString().contains("I2.clone")) {
+// throw new RuntimeException("Wrong NoSuchMethodError exception thrown");
+// }
+// }
+// }
+// }
+
+
+interface I1 version 53:0 { } // end Class I1
+
+
+interface LocalClone$I2 implements I1 version 53:0 {
+
+ static abstract interface InnerClass I2=class LocalClone$I2 of class LocalClone;
+
+} // end Class LocalClone$I2
+
+
+super class LocalClone$C implements LocalClone$I2 version 53:0 {
+
+ Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+ public Method clone:"()Ljava/lang/Object;" stack 1 locals 1 {
+ ldc String "In C\'s clone()";
+ areturn;
+ }
+
+ static InnerClass C=class LocalClone$C of class LocalClone;
+ static abstract interface InnerClass I2=class LocalClone$I2 of class LocalClone;
+
+} // end Class LocalClone$C
+
+
+super public class LocalClone version 53:0 {
+
+ public Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+ static Method test:"(LLocalClone$I2;)Ljava/lang/Object;" stack 1 locals 1 {
+ aload_0;
+ invokeinterface InterfaceMethod LocalClone$I2.clone:"()Ljava/lang/Object;", 1;
+ areturn;
+ }
+
+ public static Method main:"([Ljava/lang/String;)V" stack 3 locals 2 {
+ try t0;
+ new class LocalClone$C;
+ dup;
+ invokespecial Method LocalClone$C."<init>":"()V";
+ invokestatic Method test:"(LLocalClone$I2;)Ljava/lang/Object;";
+ checkcast class java/lang/String;
+ astore_1;
+ new class java/lang/RuntimeException;
+ dup;
+ ldc String "Expected NSME not thrown";
+ invokespecial Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+ athrow;
+ endtry t0;
+ catch t0 java/lang/NoSuchMethodError;
+ stack_frame_type stack1;
+ stack_map class java/lang/NoSuchMethodError;
+ astore_1;
+ aload_1;
+ invokevirtual Method java/lang/NoSuchMethodError.toString:"()Ljava/lang/String;";
+ ldc String "I2.clone";
+ invokevirtual Method java/lang/String.contains:"(Ljava/lang/CharSequence;)Z";
+ ifne L47;
+ new class java/lang/RuntimeException;
+ dup;
+ ldc String "Wrong NoSuchMethodError exception thrown";
+ invokespecial Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+ athrow;
+ L47: stack_frame_type same;
+ return;
+ }
+
+ static InnerClass C=class LocalClone$C of class LocalClone;
+ static abstract interface InnerClass I2=class LocalClone$I2 of class LocalClone;
+
+} // end Class LocalClone
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/NoClones.jasm Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2017, 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 8154587
+ * @summary Check that a NoSuchMethodError exception gets thrown if invokeinterface
+ * calls clone() and there is no public implementation of clone().
+ * @compile NoClones.jasm
+ * @run main NoClones
+ */
+
+// The below .jasm code implements the following java code:
+//
+// interface I1 { }
+//
+//
+// public class NoClones {
+//
+// interface I2 extends I1 { }
+//
+// static class C implements I2 { }
+//
+// static Object test(I2 i) { return i.clone(); }
+//
+// public static void main(String[] args) {
+// try {
+// String s = (String)test(new C());
+// throw new RuntimeException("Expected NSME not thrown");
+// } catch (java.lang.NoSuchMethodError e) {
+// if (!e.toString().contains("I2.clone")) {
+// throw new RuntimeException("Wrong NoSuchMethodError exception thrown");
+// }
+// }
+// }
+// }
+
+
+interface I1 version 53:0 { } // end Class I1
+
+
+interface NoClones$I2 implements I1 version 53:0 {
+
+ static abstract interface InnerClass I2=class NoClones$I2 of class NoClones;
+
+} // end Class NoClones$I2
+
+
+super class NoClones$C implements NoClones$I2 version 53:0 {
+
+ Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+ static InnerClass C=class NoClones$C of class NoClones;
+ static abstract interface InnerClass I2=class NoClones$I2 of class NoClones;
+
+} // end Class NoClones$C
+
+
+super public class NoClones version 53:0 {
+
+ public Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+ static Method test:"(LNoClones$I2;)Ljava/lang/Object;" stack 1 locals 1 {
+ aload_0;
+ invokeinterface InterfaceMethod NoClones$I2.clone:"()Ljava/lang/Object;", 1;
+ areturn;
+ }
+
+ public static Method main:"([Ljava/lang/String;)V" stack 3 locals 2 {
+ try t0;
+ new class NoClones$C;
+ dup;
+ invokespecial Method NoClones$C."<init>":"()V";
+ invokestatic Method test:"(LNoClones$I2;)Ljava/lang/Object;";
+ checkcast class java/lang/String;
+ astore_1;
+ new class java/lang/RuntimeException;
+ dup;
+ ldc String "Expected NSME not thrown";
+ invokespecial Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+ athrow;
+ endtry t0;
+ catch t0 java/lang/NoSuchMethodError;
+ stack_frame_type stack1;
+ stack_map class java/lang/NoSuchMethodError;
+ astore_1;
+ aload_1;
+ invokevirtual Method java/lang/NoSuchMethodError.toString:"()Ljava/lang/String;";
+ ldc String "I2.clone";
+ invokevirtual Method java/lang/String.contains:"(Ljava/lang/CharSequence;)Z";
+ ifne L47;
+ new class java/lang/RuntimeException;
+ dup;
+ ldc String "Wrong NoSuchMethodError exception thrown";
+ invokespecial Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+ athrow;
+ L47: stack_frame_type same;
+ return;
+ }
+
+ static InnerClass C=class NoClones$C of class NoClones;
+ static abstract interface InnerClass I2=class NoClones$I2 of class NoClones;
+
+} // end Class NoClones
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/DefMethClone.jasm Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2017, 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.
+ *
+ */
+
+interface DefMethClone version 54:0 {
+
+ public Method clone:"()Ljava/lang/Object;" stack 1 locals 1 {
+ ldc String "In DefMethClone\'s clone()";
+ areturn;
+ }
+
+} // end Class DefMethClone
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/HasLocalClone.jasm Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2017, 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 8154587
+ * @summary Check that invokevirtual of clone() finds the clone() method that
+ * is local to the calling class.
+ * @compile DefMethClone.jasm SuperClass.jasm I1.java HasLocalClone.jasm
+ * @run main/othervm -noverify HasLocalClone
+ */
+
+// The below .jasm code implements the following java code:
+//
+// public class HasLocalClone extends SuperClass implements I1 {
+//
+// public Object clone() {
+// return "In HasLocalClone's clone()";
+// }
+//
+// static Object test(SuperClass a) { return a.clone(); }
+//
+// public static void main(String[] args) {
+// String s = (String)test(new HasLocalClone());
+// if (!s.equals("In HasLocalCloneC's clone()")) {
+// throw new RuntimeException("Wrong clone() called: " + s);
+// }
+// }
+// }
+
+
+super public class HasLocalClone extends SuperClass implements I1 version 54:0 {
+
+ public Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method SuperClass."<init>":"()V";
+ return;
+ }
+
+ public Method clone:"()Ljava/lang/Object;" stack 1 locals 1 {
+ ldc String "In HasLocalClone\'s clone()";
+ areturn;
+ }
+
+ static Method test:"(LSuperClass;)Ljava/lang/Object;" stack 1 locals 1 {
+ aload_0;
+ invokevirtual Method SuperClass.clone:"()Ljava/lang/Object;";
+ areturn;
+ }
+
+ public static Method main:"([Ljava/lang/String;)V" stack 3 locals 2 {
+ new class HasLocalClone;
+ dup;
+ invokespecial Method "<init>":"()V";
+ invokestatic Method test:"(LSuperClass;)Ljava/lang/Object;";
+ checkcast class java/lang/String;
+ astore_1;
+ aload_1;
+ ldc String "In HasLocalClone\'s clone()";
+ invokevirtual Method java/lang/String.equals:"(Ljava/lang/Object;)Z";
+ ifne L37;
+ new class java/lang/RuntimeException;
+ dup;
+ aload_1;
+ invokedynamic InvokeDynamic REF_invokeStatic:java/lang/invoke/StringConcatFactory.makeConcatWithConstants:"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;":makeConcatWithConstants:"(Ljava/lang/String;)Ljava/lang/String;" String "Wrong clone() called: ";
+ invokespecial Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+ athrow;
+ L37: stack_frame_type append;
+ locals_map class java/lang/String;
+ return;
+ }
+
+ public static final InnerClass Lookup=class java/lang/invoke/MethodHandles$Lookup of class java/lang/invoke/MethodHandles;
+
+} // end Class HasLocalClone
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/I1.java Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2017, 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.
+ *
+ */
+
+interface I1 extends DefMethClone { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/I1Abstr.java Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2017, 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.
+ *
+ */
+
+interface I1Abstr extends DefMethClone {
+ Object clone();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalClone.jasm Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2017, 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 8154587
+ * @summary Check that invokevirtual of clone() calls java.lang.Object.clone()
+ * even if a superinterface has a default method named clone().
+ * @compile DefMethClone.jasm SuperClass.jasm I1.java NoLocalClone.jasm
+ * @run main/othervm -noverify NoLocalClone
+ */
+
+// The below .jasm code implements the following java code:
+//
+// public class NoLocalClone extends SuperClass implements Cloneable,I1 {
+//
+// static Object test(SuperClass a) { return a.clone(); }
+//
+// public static void main(String[] args) {
+// Object obj = test(new NoLocalClone());
+// if (!(obj instanceof NoLocalClone)) {
+// throw new RuntimeException("Wrong clone() called.");
+// }
+// }
+// }
+
+super public class NoLocalClone extends SuperClass implements java/lang/Cloneable, I1 version 54:0 {
+
+ public Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method SuperClass."<init>":"()V";
+ return;
+ }
+
+ static Method test:"(LSuperClass;)Ljava/lang/Object;" stack 1 locals 1 {
+ aload_0;
+ invokevirtual Method SuperClass.clone:"()Ljava/lang/Object;";
+ areturn;
+ }
+
+ public static Method main:"([Ljava/lang/String;)V" stack 3 locals 2 {
+ new class NoLocalClone;
+ dup;
+ invokespecial Method "<init>":"()V";
+ invokestatic Method test:"(LSuperClass;)Ljava/lang/Object;";
+ astore_1;
+ aload_1;
+ instanceof class NoLocalClone;
+ ifne L31;
+ new class java/lang/RuntimeException;
+ dup;
+ ldc String "Wrong clone() called.";
+ invokespecial Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+ athrow;
+ L31: stack_frame_type append;
+ locals_map class java/lang/Object;
+ return;
+ }
+
+} // end Class NoLocalClone
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalCloneAbstr.jasm Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2017, 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 8154587
+ * @summary Check that invokevirtual of clone() calls java.lang.Object.clone()
+ * even if a superinterface has an abstract method named clone().
+ * @compile DefMethClone.jasm SuperClass.jasm I1Abstr.java NoLocalCloneAbstr.jasm
+ * @run main/othervm -noverify NoLocalCloneAbstr
+ */
+
+// The below .jasm code implements the following java code:
+//
+// public class NoLocalCloneAbstr extends SuperClass implements Cloneable,I1Abstr {
+//
+// static Object test(SuperClass a) { return a.clone(); }
+//
+// public static void main(String[] args) {
+// Object obj = test(new NoLocalCloneAbstr());
+// if (!(obj instanceof NoLocalCloneAbstr)) {
+// throw new RuntimeException("Wrong clone() called.");
+// }
+// }
+// }
+
+super public class NoLocalCloneAbstr extends SuperClass implements java/lang/Cloneable, I1Abstr version 54:0 {
+
+ public Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method SuperClass."<init>":"()V";
+ return;
+ }
+
+ static Method test:"(LSuperClass;)Ljava/lang/Object;" stack 1 locals 1 {
+ aload_0;
+ invokevirtual Method SuperClass.clone:"()Ljava/lang/Object;";
+ areturn;
+ }
+
+ public static Method main:"([Ljava/lang/String;)V" stack 3 locals 2 {
+ new class NoLocalCloneAbstr;
+ dup;
+ invokespecial Method "<init>":"()V";
+ invokestatic Method test:"(LSuperClass;)Ljava/lang/Object;";
+ astore_1;
+ aload_1;
+ instanceof class NoLocalCloneAbstr;
+ ifne L31;
+ new class java/lang/RuntimeException;
+ dup;
+ ldc String "Wrong clone() called.";
+ invokespecial Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+ athrow;
+ L31: stack_frame_type append;
+ locals_map class java/lang/Object;
+ return;
+ }
+
+} // end Class NoLocalCloneAbstr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/SuperClass.jasm Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2017, 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.
+ *
+ */
+
+super public class SuperClass implements DefMethClone version 54:0 {
+
+ public Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+} // end Class SuperClass
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/os/TestUseCpuAllocPath.java Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+
+/**
+ * @test
+ * @summary If #processors > 1024 os_linux.cpp uses special coding.
+ * Excercise this by forcing usage of this coding. If this fails, this
+ * VM was either compiled on a platform which does not define CPU_ALLOC,
+ * or it is executed on a platform that does not support it.
+ * @requires os.family == "linux"
+ * @modules java.base/jdk.internal.misc
+ * @library /test/lib
+ * @run driver TestUseCpuAllocPath
+ */
+public class TestUseCpuAllocPath {
+
+ static final String SUCCESS_STRING = "active_processor_count: using dynamic path (forced)";
+
+ public static void main(String[] args) throws Exception {
+ ProcessBuilder pb =
+ ProcessTools.createJavaProcessBuilder(false,
+ "-Xlog:os=trace",
+ "-XX:+UnlockDiagnosticVMOptions",
+ "-XX:+UseCpuAllocPath",
+ "-version");
+
+ OutputAnalyzer output = new OutputAnalyzer(pb.start());
+ output.shouldContain(SUCCESS_STRING);
+ }
+}
--- a/test/jaxp/TEST.ROOT Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jaxp/TEST.ROOT Thu Jan 18 18:58:46 2018 +0000
@@ -23,7 +23,7 @@
groups=TEST.groups
# Minimum jtreg version
-requiredVersion=4.2 b08
+requiredVersion=4.2 b11
# Path to libraries in the topmost test directory. This is needed so @library
# does not need ../../ notation to reach them
--- a/test/jdk/ProblemList.txt Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/ProblemList.txt Thu Jan 18 18:58:46 2018 +0000
@@ -217,6 +217,8 @@
java/net/DatagramSocket/SendDatagramToBadAddress.java 7143960 macosx-all
+java/net/httpclient/SplitResponseSSL.java 8194151 windows-all
+
############################################################################
# jdk_nio
@@ -252,7 +254,8 @@
# jdk_security
sun/security/pkcs11/ec/TestKeyFactory.java 8026976 generic-all
-sun/security/pkcs11/KeyStore/SecretKeysBasic.sh 8186098 linux-all
+sun/security/pkcs11/Secmod/AddTrustedCert.java 8180837 generic-all
+sun/security/pkcs11/tls/TestKeyMaterial.java 8180837 generic-all
sun/security/tools/keytool/ListKeychainStore.sh 8156889 macosx-all
@@ -348,8 +351,6 @@
# svc_tools
-sun/tools/jcmd/TestJcmdSanity.java 8031482 windows-all
-
sun/tools/jstat/jstatClassloadOutput1.sh 8173942 generic-all
sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java 8057732 generic-all
--- a/test/jdk/TEST.ROOT Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/TEST.ROOT Thu Jan 18 18:58:46 2018 +0000
@@ -40,7 +40,7 @@
vm.cds
# Minimum jtreg version
-requiredVersion=4.2 b09
+requiredVersion=4.2 b11
# Path to libraries in the topmost test directory. This is needed so @library
# does not need ../../ notation to reach them
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/io/InputStream/NullInputStream.java Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,200 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.IOException;
+import org.testng.annotations.AfterGroups;
+import org.testng.annotations.BeforeGroups;
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+/*
+ * @test
+ * @bug 4358774
+ * @run testng NullInputStream
+ * @summary Check for expected behavior of InputStream.nullInputStream().
+ */
+public class NullInputStream {
+ private static InputStream openStream;
+ private static InputStream closedStream;
+
+ @BeforeGroups(groups="open")
+ public static void openStream() {
+ openStream = InputStream.nullInputStream();
+ }
+
+ @BeforeGroups(groups="closed")
+ public static void openAndCloseStream() {
+ closedStream = InputStream.nullInputStream();
+ try {
+ closedStream.close();
+ } catch (IOException e) {
+ fail("Unexpected IOException");
+ }
+ }
+
+ @AfterGroups(groups="open")
+ public static void closeStream() {
+ try {
+ openStream.close();
+ } catch (IOException e) {
+ fail("Unexpected IOException");
+ }
+ }
+
+ @Test(groups = "open")
+ public static void testOpen() {
+ assertNotNull(openStream, "InputStream.nullInputStream() returned null");
+ }
+
+ @Test(groups = "open")
+ public static void testAvailable() {
+ try {
+ assertEquals(0, openStream.available(), "available() != 0");
+ } catch (IOException ioe) {
+ fail("Unexpected IOException");
+ }
+ }
+
+ @Test(groups = "open")
+ public static void testRead() {
+ try {
+ assertEquals(-1, openStream.read(), "read() != -1");
+ } catch (IOException ioe) {
+ fail("Unexpected IOException");
+ }
+ }
+
+ @Test(groups = "open")
+ public static void testReadBII() {
+ try {
+ assertEquals(-1, openStream.read(new byte[1], 0, 1),
+ "read(byte[],int,int) != -1");
+ } catch (IOException ioe) {
+ fail("Unexpected IOException");
+ }
+ }
+
+ @Test(groups = "open")
+ public static void testReadAllBytes() {
+ try {
+ assertEquals(0, openStream.readAllBytes().length,
+ "readAllBytes().length != 0");
+ } catch (IOException ioe) {
+ fail("Unexpected IOException");
+ }
+ }
+
+ @Test(groups = "open")
+ public static void testreadNBytes() {
+ try {
+ assertEquals(0, openStream.readNBytes(new byte[1], 0, 1),
+ "readNBytes(byte[],int,int) != 0");
+ } catch (IOException ioe) {
+ fail("Unexpected IOException");
+ }
+ }
+
+ @Test(groups = "open")
+ public static void testSkip() {
+ try {
+ assertEquals(0, openStream.skip(1), "skip() != 0");
+ } catch (IOException ioe) {
+ fail("Unexpected IOException");
+ }
+ }
+
+ @Test(groups = "open")
+ public static void testTransferTo() {
+ try {
+ assertEquals(0, openStream.transferTo(new ByteArrayOutputStream(7)),
+ "transferTo() != 0");
+ } catch (IOException ioe) {
+ fail("Unexpected IOException");
+ }
+ }
+
+ @Test(groups = "closed")
+ public static void testAvailableClosed() {
+ try {
+ closedStream.available();
+ fail("Expected IOException not thrown");
+ } catch (IOException e) {
+ }
+ }
+
+ @Test(groups = "closed")
+ public static void testReadClosed() {
+ try {
+ closedStream.read();
+ fail("Expected IOException not thrown");
+ } catch (IOException e) {
+ }
+ }
+
+ @Test(groups = "closed")
+ public static void testReadBIIClosed() {
+ try {
+ closedStream.read(new byte[1], 0, 1);
+ fail("Expected IOException not thrown");
+ } catch (IOException e) {
+ }
+ }
+
+ @Test(groups = "closed")
+ public static void testReadAllBytesClosed() {
+ try {
+ closedStream.readAllBytes();
+ fail("Expected IOException not thrown");
+ } catch (IOException e) {
+ }
+ }
+
+ @Test(groups = "closed")
+ public static void testReadNBytesClosed() {
+ try {
+ closedStream.readNBytes(new byte[1], 0, 1);
+ fail("Expected IOException not thrown");
+ } catch (IOException e) {
+ }
+ }
+
+ @Test(groups = "closed")
+ public static void testSkipClosed() {
+ try {
+ closedStream.skip(1);
+ fail("Expected IOException not thrown");
+ } catch (IOException e) {
+ }
+ }
+
+ @Test(groups = "closed")
+ public static void testTransferToClosed() {
+ try {
+ closedStream.transferTo(new ByteArrayOutputStream(7));
+ fail("Expected IOException not thrown");
+ } catch (IOException e) {
+ }
+ }
+}
--- a/test/jdk/java/io/InputStream/ReadAllBytes.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/io/InputStream/ReadAllBytes.java Thu Jan 18 18:58:46 2018 +0000
@@ -31,7 +31,7 @@
/*
* @test
- * @bug 8080835
+ * @bug 8080835 8193832
* @library /test/lib
* @build jdk.test.lib.RandomFactory
* @run main ReadAllBytes
@@ -47,15 +47,11 @@
test(new byte[]{});
test(new byte[]{1, 2, 3});
test(createRandomBytes(1024));
- test(createRandomBytes((1 << 13) - 1));
- test(createRandomBytes((1 << 13)));
- test(createRandomBytes((1 << 13) + 1));
- test(createRandomBytes((1 << 15) - 1));
- test(createRandomBytes((1 << 15)));
- test(createRandomBytes((1 << 15) + 1));
- test(createRandomBytes((1 << 17) - 1));
- test(createRandomBytes((1 << 17)));
- test(createRandomBytes((1 << 17) + 1));
+ for (int shift : new int[] {13, 14, 15, 17}) {
+ for (int offset : new int[] {-1, 0, 1}) {
+ test(createRandomBytes((1 << shift) + offset));
+ }
+ }
}
static void test(byte[] expectedBytes) throws IOException {
--- a/test/jdk/java/io/InputStream/ReadParams.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/io/InputStream/ReadParams.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4008296 4008293 4190090 4193729
+ * @bug 4008296 4008293 4190090 4193729 4358774
* @summary Check for correct handling of parameters to
* XXXXInputStream.read(b, off, len).
*
@@ -197,6 +197,11 @@
doTest1(ifs);
ifs.close();
+ InputStream nis = InputStream.nullInputStream();
+ doTest(nis);
+ doTest1(nis);
+ nis.close();
+
/* cleanup */
fn.delete();
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/io/OutputStream/NullOutputStream.java Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.IOException;
+import java.io.OutputStream;
+import org.testng.annotations.AfterGroups;
+import org.testng.annotations.BeforeGroups;
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+/*
+ * @test
+ * @bug 4358774
+ * @run testng NullOutputStream
+ * @summary Check for expected behavior of OutputStream.nullOutputStream().
+ */
+public class NullOutputStream {
+ private static OutputStream openStream;
+ private static OutputStream closedStream;
+
+ @BeforeGroups(groups="open")
+ public static void openStream() {
+ openStream = OutputStream.nullOutputStream();
+ }
+
+ @BeforeGroups(groups="closed")
+ public static void openAndCloseStream() {
+ closedStream = OutputStream.nullOutputStream();
+ try {
+ closedStream.close();
+ } catch (IOException e) {
+ fail("Unexpected IOException");
+ }
+ }
+
+ @AfterGroups(groups="open")
+ public static void closeStream() {
+ try {
+ openStream.close();
+ } catch (IOException e) {
+ fail("Unexpected IOException");
+ }
+ }
+
+ @Test(groups="open")
+ public static void testOpen() {
+ assertNotNull(openStream,
+ "OutputStream.nullOutputStream() returned null");
+ }
+
+ @Test(groups="open")
+ public static void testWrite() {
+ try {
+ openStream.write(62832);
+ } catch (IOException e) {
+ fail("Unexpected IOException");
+ }
+ }
+
+ @Test(groups="open")
+ public static void testWriteBII() {
+ try {
+ openStream.write(new byte[] {(byte)6}, 0, 1);
+ } catch (Exception e) {
+ fail("Unexpected IOException");
+ }
+ }
+
+ @Test(groups="closed")
+ public static void testWriteClosed() {
+ try {
+ closedStream.write(62832);
+ fail("Expected IOException not thrown");
+ } catch (IOException e) {
+ }
+ }
+
+ @Test(groups="closed")
+ public static void testWriteBIIClosed() {
+ try {
+ closedStream.write(new byte[] {(byte)6}, 0, 1);
+ fail("Expected IOException not thrown");
+ } catch (IOException e) {
+ }
+ }
+}
--- a/test/jdk/java/io/OutputStream/WriteParams.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/io/OutputStream/WriteParams.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 1267039 1267043 4193729
+ * @bug 1267039 1267043 4193729 4358774
* @summary Check for correct handling of parameters to
* XXXXOutputStream.write(b, off, len).
*
@@ -152,6 +152,11 @@
doTest1(dfos);
dfos.close();
+ OutputStream nos = OutputStream.nullOutputStream();
+ doTest(nos);
+ doTest1(nos);
+ nos.close();
+
/* cleanup */
fn.delete();
--- a/test/jdk/java/lang/Runtime/Version/Basic.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/lang/Runtime/Version/Basic.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
/*
* @test
* @summary Unit test for java.lang.Runtime.Version
- * @bug 8072379 8144062 8161236 8160956
+ * @bug 8072379 8144062 8161236 8160956 8194879
*/
import java.lang.Runtime.Version;
@@ -115,6 +115,7 @@
tryCatch("9-pre+-opt", IAE);
tryCatch("1.4142+-", IAE);
tryCatch("2.9979+-%", IAE);
+ tryCatch("10--ea", IAE);
//// Test for Runtime.version()
testVersion();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/invoke/FilterArgumentsTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8194554
+ * @run testng/othervm test.java.lang.invoke.FilterArgumentsTest
+ */
+
+package test.java.lang.invoke;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.util.ArrayList;
+import java.util.List;
+
+import static java.lang.invoke.MethodHandles.*;
+import static java.lang.invoke.MethodType.methodType;
+
+import org.testng.annotations.*;
+import static org.testng.Assert.*;
+
+public class FilterArgumentsTest {
+
+ @Test
+ public static void testFilterA_B_C() throws Throwable {
+ FilterTest test = new FilterTest(
+ filterArguments(MH_TEST, 0, MH_FILTER_A, MH_FILTER_B, MH_FILTER_C));
+ test.run(List.of("A", "B", "C"));
+ }
+
+ @Test
+ public static void testFilterA_B() throws Throwable {
+ FilterTest test = new FilterTest(
+ filterArguments(MH_TEST, 0, MH_FILTER_A, MH_FILTER_B));
+ test.run(List.of("A", "B"));
+ }
+
+ @Test
+ public static void testFilterB_C() throws Throwable {
+ FilterTest test = new FilterTest(
+ filterArguments(MH_TEST, 1, MH_FILTER_B, MH_FILTER_C));
+ test.run(List.of("B", "C"));
+ }
+
+ @Test
+ public static void testFilterB() throws Throwable {
+ FilterTest test = new FilterTest(filterArguments(MH_TEST, 1, MH_FILTER_B));
+ test.run(List.of("B"));
+ }
+
+ @Test
+ public static void testFilterC() throws Throwable {
+ FilterTest test = new FilterTest(filterArguments(MH_TEST, 2, MH_FILTER_C));
+ test.run(List.of("C"));
+ }
+
+ static class FilterTest {
+ static List<String> filters = new ArrayList<>();
+
+ final MethodHandle mh;
+ FilterTest(MethodHandle mh) {
+ this.mh = mh;
+ }
+
+ void run(List<String> expected) throws Throwable {
+ filters.clear();
+ assertEquals("x-0-z", (String)mh.invokeExact("x", 0, 'z'));
+ assertEquals(expected, filters);
+ }
+
+ static String filterA(String s) {
+ filters.add("A");
+ return s;
+ }
+
+ static int filterB(int value) {
+ filters.add("B");
+ return value;
+ }
+
+ static char filterC(char c) {
+ filters.add("C");
+ return c;
+ }
+
+ static String test(String s, int i, char c) {
+ return s + "-" + i + "-" + c;
+ }
+ }
+
+ static final MethodHandle MH_TEST;
+ static final MethodHandle MH_FILTER_A;
+ static final MethodHandle MH_FILTER_B;
+ static final MethodHandle MH_FILTER_C;
+ static final Lookup LOOKUP = MethodHandles.lookup();
+
+ static {
+ try {
+ MH_TEST = LOOKUP.findStatic(FilterTest.class, "test",
+ methodType(String.class, String.class, int.class, char.class));
+ MH_FILTER_A = LOOKUP.findStatic(FilterTest.class, "filterA",
+ methodType(String.class, String.class));
+ MH_FILTER_B = LOOKUP.findStatic(FilterTest.class, "filterB",
+ methodType(int.class, int.class));
+ MH_FILTER_C = LOOKUP.findStatic(FilterTest.class, "filterC",
+ methodType(char.class, char.class));
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
--- a/test/jdk/java/lang/module/ClassFileVersionsTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/lang/module/ClassFileVersionsTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -54,6 +54,8 @@
{ 53, 0, Set.of(STATIC, TRANSITIVE) },
{ 54, 0, Set.of() }, // JDK 10
+
+ { 55, 0, Set.of()}, // JDK 11
};
}
@@ -69,7 +71,11 @@
{ 54, 0, Set.of(TRANSITIVE) },
{ 54, 0, Set.of(STATIC, TRANSITIVE) },
- { 55, 0, Set.of()}, // JDK 11
+ { 55, 0, Set.of(STATIC) }, // JDK 11
+ { 55, 0, Set.of(TRANSITIVE) },
+ { 55, 0, Set.of(STATIC, TRANSITIVE) },
+
+ { 56, 0, Set.of()}, // JDK 12
};
}
--- a/test/jdk/java/lang/ref/ReferenceEnqueue.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/lang/ref/ReferenceEnqueue.java Thu Jan 18 18:58:46 2018 +0000
@@ -25,7 +25,6 @@
* @bug 4268317 8132306 8175797
* @summary Test if Reference.enqueue() works properly with GC
* @run main ReferenceEnqueue
- * @run main/othervm -Djdk.lang.ref.disableClearBeforeEnqueue=true ReferenceEnqueue
*/
import java.lang.ref.*;
@@ -87,8 +86,6 @@
final ReferenceQueue<Object> queue = new ReferenceQueue<>();
final List<Reference<Object>> refs = new ArrayList<>();
final int iterations = 1000;
- final boolean disableClearBeforeEnqueue =
- Boolean.getBoolean("jdk.lang.ref.disableClearBeforeEnqueue");
ExplicitEnqueue() {
this.refs.add(new SoftReference<>(new Object(), queue));
@@ -101,10 +98,7 @@
if (ref.enqueue() == false) {
throw new RuntimeException("Error: enqueue failed");
}
- if (disableClearBeforeEnqueue && ref.get() == null) {
- throw new RuntimeException("Error: clearing should be disabled");
- }
- if (!disableClearBeforeEnqueue && ref.get() != null) {
+ if (ref.get() != null) {
throw new RuntimeException("Error: referent must be cleared");
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/nio/Buffer/EqualsCompareTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,686 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import org.testng.Assert;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+import java.nio.Buffer;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.CharBuffer;
+import java.nio.DoubleBuffer;
+import java.nio.FloatBuffer;
+import java.nio.IntBuffer;
+import java.nio.LongBuffer;
+import java.nio.ShortBuffer;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.BiFunction;
+import java.util.function.LongFunction;
+import java.util.stream.IntStream;
+
+/*
+ * @test
+ * @bug 8193085
+ * @summary tests for buffer equals and compare
+ * @run testng EqualsCompareTest
+ */
+
+public class EqualsCompareTest {
+
+ // Maximum width in bits
+ static final int MAX_WIDTH = 512;
+
+ static final Map<Class, Integer> typeToWidth;
+
+ static {
+ typeToWidth = new HashMap<>();
+ typeToWidth.put(byte.class, Byte.SIZE);
+ typeToWidth.put(short.class, Short.SIZE);
+ typeToWidth.put(char.class, Character.SIZE);
+ typeToWidth.put(int.class, Integer.SIZE);
+ typeToWidth.put(long.class, Long.SIZE);
+ typeToWidth.put(float.class, Float.SIZE);
+ typeToWidth.put(double.class, Double.SIZE);
+ }
+
+ static int arraySizeFor(Class<?> type) {
+ assert type.isPrimitive();
+ return 4 * MAX_WIDTH / typeToWidth.get(type);
+ }
+
+ enum BufferKind {
+ HEAP,
+ HEAP_VIEW,
+ DIRECT;
+ }
+
+ static abstract class BufferType<T extends Buffer, E> {
+ final BufferKind k;
+ final Class<?> bufferType;
+ final Class<?> elementType;
+
+ final MethodHandle eq;
+ final MethodHandle cmp;
+
+ final MethodHandle getter;
+ final MethodHandle setter;
+
+ BufferType(BufferKind k, Class<T> bufferType, Class<?> elementType) {
+ this.k = k;
+ this.bufferType = bufferType;
+ this.elementType = elementType;
+
+ var lookup = MethodHandles.lookup();
+ try {
+ eq = lookup.findVirtual(bufferType, "equals", MethodType.methodType(boolean.class, Object.class));
+ cmp = lookup.findVirtual(bufferType, "compareTo", MethodType.methodType(int.class, bufferType));
+
+ getter = lookup.findVirtual(bufferType, "get", MethodType.methodType(elementType, int.class));
+ setter = lookup.findVirtual(bufferType, "put", MethodType.methodType(bufferType, int.class, elementType));
+ }
+ catch (Exception e) {
+ throw new AssertionError(e);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return bufferType.getName() + " " + k;
+ }
+
+ T construct(int length) {
+ return construct(length, ByteOrder.BIG_ENDIAN);
+ }
+
+ abstract T construct(int length, ByteOrder bo);
+
+ @SuppressWarnings("unchecked")
+ T slice(T a, int from, int to) {
+ return (T) a.position(from).limit(to).slice();
+ }
+
+ @SuppressWarnings("unchecked")
+ E get(T a, int i) {
+ try {
+ return (E) getter.invoke(a, i);
+ }
+ catch (RuntimeException | Error e) {
+ throw e;
+ }
+ catch (Throwable t) {
+ throw new Error(t);
+ }
+ }
+
+ void set(T a, int i, Object v) {
+ try {
+ setter.invoke(a, i, convert(v));
+ }
+ catch (RuntimeException | Error e) {
+ throw e;
+ }
+ catch (Throwable t) {
+ throw new Error(t);
+ }
+ }
+
+ abstract Object convert(Object o);
+
+ boolean equals(T a, T b) {
+ try {
+ return (boolean) eq.invoke(a, b);
+ }
+ catch (RuntimeException | Error e) {
+ throw e;
+ }
+ catch (Throwable t) {
+ throw new Error(t);
+ }
+ }
+
+ int compare(T a, T b) {
+ try {
+ return (int) cmp.invoke(a, b);
+ }
+ catch (RuntimeException | Error e) {
+ throw e;
+ }
+ catch (Throwable t) {
+ throw new Error(t);
+ }
+ }
+
+ boolean pairWiseEquals(T a, T b) {
+ if (a.remaining() != b.remaining())
+ return false;
+ int p = a.position();
+ for (int i = a.limit() - 1, j = b.limit() - 1; i >= p; i--, j--)
+ if (!get(a, i).equals(get(b, j)))
+ return false;
+ return true;
+ }
+
+ static class Bytes extends BufferType<ByteBuffer, Byte> {
+ Bytes(BufferKind k) {
+ super(k, ByteBuffer.class, byte.class);
+ }
+
+ @Override
+ ByteBuffer construct(int length, ByteOrder bo) {
+ switch (k) {
+ case DIRECT:
+ return ByteBuffer.allocateDirect(length).order(bo);
+ default:
+ case HEAP_VIEW:
+ case HEAP:
+ return ByteBuffer.allocate(length).order(bo);
+ }
+ }
+
+ @Override
+ Object convert(Object o) {
+ return o instanceof Integer
+ ? ((Integer) o).byteValue()
+ : o;
+ }
+ }
+
+ static class Chars extends BufferType<CharBuffer, Character> {
+ Chars(BufferKind k) {
+ super(k, CharBuffer.class, char.class);
+ }
+
+ @Override
+ CharBuffer construct(int length, ByteOrder bo) {
+ switch (k) {
+ case DIRECT:
+ return ByteBuffer.allocateDirect(length * Character.BYTES).
+ order(bo).
+ asCharBuffer();
+ case HEAP_VIEW:
+ return ByteBuffer.allocate(length * Character.BYTES).
+ order(bo).
+ asCharBuffer();
+ default:
+ case HEAP:
+ return CharBuffer.allocate(length);
+ }
+ }
+
+ @Override
+ Object convert(Object o) {
+ return o instanceof Integer
+ ? (char) ((Integer) o).intValue()
+ : o;
+ }
+
+ CharBuffer transformToStringBuffer(CharBuffer c) {
+ char[] chars = new char[c.remaining()];
+ c.get(chars);
+ return CharBuffer.wrap(new String(chars));
+ }
+ }
+
+ static class Shorts extends BufferType<ShortBuffer, Short> {
+ Shorts(BufferKind k) {
+ super(k, ShortBuffer.class, short.class);
+ }
+
+ @Override
+ ShortBuffer construct(int length, ByteOrder bo) {
+ switch (k) {
+ case DIRECT:
+ return ByteBuffer.allocateDirect(length * Short.BYTES).
+ order(bo).
+ asShortBuffer();
+ case HEAP_VIEW:
+ return ByteBuffer.allocate(length * Short.BYTES).
+ order(bo).
+ asShortBuffer();
+ default:
+ case HEAP:
+ return ShortBuffer.allocate(length);
+ }
+ }
+
+ @Override
+ Object convert(Object o) {
+ return o instanceof Integer
+ ? ((Integer) o).shortValue()
+ : o;
+ }
+ }
+
+ static class Ints extends BufferType<IntBuffer, Integer> {
+ Ints(BufferKind k) {
+ super(k, IntBuffer.class, int.class);
+ }
+
+ @Override
+ IntBuffer construct(int length, ByteOrder bo) {
+ switch (k) {
+ case DIRECT:
+ return ByteBuffer.allocateDirect(length * Integer.BYTES).
+ order(bo).
+ asIntBuffer();
+ case HEAP_VIEW:
+ return ByteBuffer.allocate(length * Integer.BYTES).
+ order(bo).
+ asIntBuffer();
+ default:
+ case HEAP:
+ return IntBuffer.allocate(length);
+ }
+ }
+
+ Object convert(Object o) {
+ return o;
+ }
+ }
+
+ static class Floats extends BufferType<FloatBuffer, Float> {
+ Floats(BufferKind k) {
+ super(k, FloatBuffer.class, float.class);
+ }
+
+ @Override
+ FloatBuffer construct(int length, ByteOrder bo) {
+ switch (k) {
+ case DIRECT:
+ return ByteBuffer.allocateDirect(length * Float.BYTES).
+ order(bo).
+ asFloatBuffer();
+ case HEAP_VIEW:
+ return ByteBuffer.allocate(length * Float.BYTES).
+ order(bo).
+ asFloatBuffer();
+ default:
+ case HEAP:
+ return FloatBuffer.allocate(length);
+ }
+ }
+
+ @Override
+ Object convert(Object o) {
+ return o instanceof Integer
+ ? ((Integer) o).floatValue()
+ : o;
+ }
+
+ @Override
+ boolean pairWiseEquals(FloatBuffer a, FloatBuffer b) {
+ if (a.remaining() != b.remaining())
+ return false;
+ int p = a.position();
+ for (int i = a.limit() - 1, j = b.limit() - 1; i >= p; i--, j--) {
+ float av = a.get(i);
+ float bv = b.get(j);
+ if (av != bv && (!Float.isNaN(av) || !Float.isNaN(bv)))
+ return false;
+ }
+ return true;
+ }
+ }
+
+ static class Longs extends BufferType<LongBuffer, Long> {
+ Longs(BufferKind k) {
+ super(k, LongBuffer.class, long.class);
+ }
+
+ @Override
+ LongBuffer construct(int length, ByteOrder bo) {
+ switch (k) {
+ case DIRECT:
+ return ByteBuffer.allocateDirect(length * Long.BYTES).
+ order(bo).
+ asLongBuffer();
+ case HEAP_VIEW:
+ return ByteBuffer.allocate(length * Long.BYTES).
+ order(bo).
+ asLongBuffer();
+ default:
+ case HEAP:
+ return LongBuffer.allocate(length);
+ }
+ }
+
+ @Override
+ Object convert(Object o) {
+ return o instanceof Integer
+ ? ((Integer) o).longValue()
+ : o;
+ }
+ }
+
+ static class Doubles extends BufferType<DoubleBuffer, Double> {
+ Doubles(BufferKind k) {
+ super(k, DoubleBuffer.class, double.class);
+ }
+
+ @Override
+ DoubleBuffer construct(int length, ByteOrder bo) {
+ switch (k) {
+ case DIRECT:
+ return ByteBuffer.allocateDirect(length * Double.BYTES).
+ order(bo).
+ asDoubleBuffer();
+ case HEAP_VIEW:
+ return ByteBuffer.allocate(length * Double.BYTES).
+ order(bo).
+ asDoubleBuffer();
+ default:
+ case HEAP:
+ return DoubleBuffer.allocate(length);
+ }
+ }
+
+ @Override
+ Object convert(Object o) {
+ return o instanceof Integer
+ ? ((Integer) o).doubleValue()
+ : o;
+ }
+
+ @Override
+ boolean pairWiseEquals(DoubleBuffer a, DoubleBuffer b) {
+ if (a.remaining() != b.remaining())
+ return false;
+ int p = a.position();
+ for (int i = a.limit() - 1, j = b.limit() - 1; i >= p; i--, j--) {
+ double av = a.get(i);
+ double bv = b.get(j);
+ if (av != bv && (!Double.isNaN(av) || !Double.isNaN(bv)))
+ return false;
+ }
+ return true;
+ }
+ }
+ }
+
+
+ static Object[][] bufferTypes;
+
+ @DataProvider
+ public static Object[][] bufferTypesProvider() {
+ if (bufferTypes == null) {
+ bufferTypes = new Object[][]{
+ {new BufferType.Bytes(BufferKind.HEAP)},
+ {new BufferType.Bytes(BufferKind.DIRECT)},
+ {new BufferType.Chars(BufferKind.HEAP)},
+ {new BufferType.Chars(BufferKind.HEAP_VIEW)},
+ {new BufferType.Chars(BufferKind.DIRECT)},
+ {new BufferType.Shorts(BufferKind.HEAP)},
+ {new BufferType.Shorts(BufferKind.HEAP_VIEW)},
+ {new BufferType.Shorts(BufferKind.DIRECT)},
+ {new BufferType.Ints(BufferKind.HEAP)},
+ {new BufferType.Ints(BufferKind.HEAP_VIEW)},
+ {new BufferType.Ints(BufferKind.DIRECT)},
+ {new BufferType.Floats(BufferKind.HEAP)},
+ {new BufferType.Floats(BufferKind.HEAP_VIEW)},
+ {new BufferType.Floats(BufferKind.DIRECT)},
+ {new BufferType.Longs(BufferKind.HEAP)},
+ {new BufferType.Longs(BufferKind.HEAP_VIEW)},
+ {new BufferType.Longs(BufferKind.DIRECT)},
+ {new BufferType.Doubles(BufferKind.HEAP)},
+ {new BufferType.Doubles(BufferKind.HEAP_VIEW)},
+ {new BufferType.Doubles(BufferKind.DIRECT)},
+ };
+ }
+ return bufferTypes;
+ }
+
+
+ static Object[][] floatbufferTypes;
+
+ @DataProvider
+ public static Object[][] floatBufferTypesProvider() {
+ if (floatbufferTypes == null) {
+ LongFunction<Object> bTof = rb -> Float.intBitsToFloat((int) rb);
+ LongFunction<Object> bToD = Double::longBitsToDouble;
+
+ floatbufferTypes = new Object[][]{
+ // canonical and non-canonical NaNs
+ // If conversion is a signalling NaN it may be subject to conversion to a
+ // quiet NaN on some processors, even if a copy is performed
+ // The tests assume that if conversion occurs it does not convert to the
+ // canonical NaN
+ new Object[]{new BufferType.Floats(BufferKind.HEAP), 0x7fc00000L, 0x7f800001L, bTof},
+ new Object[]{new BufferType.Floats(BufferKind.HEAP_VIEW), 0x7fc00000L, 0x7f800001L, bTof},
+ new Object[]{new BufferType.Floats(BufferKind.DIRECT), 0x7fc00000L, 0x7f800001L, bTof},
+ new Object[]{new BufferType.Doubles(BufferKind.HEAP), 0x7ff8000000000000L, 0x7ff0000000000001L, bToD},
+ new Object[]{new BufferType.Doubles(BufferKind.HEAP_VIEW), 0x7ff8000000000000L, 0x7ff0000000000001L, bToD},
+ new Object[]{new BufferType.Doubles(BufferKind.DIRECT), 0x7ff8000000000000L, 0x7ff0000000000001L, bToD},
+
+ // +0.0 and -0.0
+ new Object[]{new BufferType.Floats(BufferKind.HEAP), 0x0L, 0x80000000L, bTof},
+ new Object[]{new BufferType.Floats(BufferKind.HEAP_VIEW), 0x0L, 0x80000000L, bTof},
+ new Object[]{new BufferType.Floats(BufferKind.DIRECT), 0x0L, 0x80000000L, bTof},
+ new Object[]{new BufferType.Doubles(BufferKind.HEAP), 0x0L, 0x8000000000000000L, bToD},
+ new Object[]{new BufferType.Doubles(BufferKind.HEAP_VIEW), 0x0L, 0x8000000000000000L, bToD},
+ new Object[]{new BufferType.Doubles(BufferKind.DIRECT), 0x0L, 0x8000000000000000L, bToD},
+ };
+ }
+ return floatbufferTypes;
+ }
+
+
+ static Object[][] charBufferTypes;
+
+ @DataProvider
+ public static Object[][] charBufferTypesProvider() {
+ if (charBufferTypes == null) {
+ charBufferTypes = new Object[][]{
+ {new BufferType.Chars(BufferKind.HEAP)},
+ {new BufferType.Chars(BufferKind.HEAP_VIEW)},
+ {new BufferType.Chars(BufferKind.DIRECT)},
+ };
+ }
+ return charBufferTypes;
+ }
+
+
+ // Tests all primitive buffers
+ @Test(dataProvider = "bufferTypesProvider")
+ <E>
+ void testBuffers(BufferType<Buffer, E> bufferType) {
+ // Test with buffers of the same byte order (BE)
+ BiFunction<BufferType<Buffer, E>, Integer, Buffer> constructor = (at, s) -> {
+ Buffer a = at.construct(s);
+ for (int x = 0; x < s; x++) {
+ at.set(a, x, x % 8);
+ }
+ return a;
+ };
+
+ testBufferType(bufferType, constructor, constructor);
+
+ // Test with buffers of different byte order
+ if (bufferType.elementType != byte.class &&
+ (bufferType.k == BufferKind.HEAP_VIEW ||
+ bufferType.k == BufferKind.DIRECT)) {
+
+ BiFunction<BufferType<Buffer, E>, Integer, Buffer> leConstructor = (at, s) -> {
+ Buffer a = at.construct(s, ByteOrder.LITTLE_ENDIAN);
+ for (int x = 0; x < s; x++) {
+ at.set(a, x, x % 8);
+ }
+ return a;
+ };
+ testBufferType(bufferType, constructor, leConstructor);
+ }
+ }
+
+ // Tests float and double buffers with edge-case values (NaN, -0.0, +0.0)
+ @Test(dataProvider = "floatBufferTypesProvider")
+ public void testFloatBuffers(
+ BufferType<Buffer, Float> bufferType,
+ long rawBitsA, long rawBitsB,
+ LongFunction<Object> bitsToFloat) {
+ Object av = bitsToFloat.apply(rawBitsA);
+ Object bv = bitsToFloat.apply(rawBitsB);
+
+ BiFunction<BufferType<Buffer, Float>, Integer, Buffer> allAs = (at, s) -> {
+ Buffer b = at.construct(s);
+ for (int x = 0; x < s; x++) {
+ at.set(b, x, av);
+ }
+ return b;
+ };
+
+ BiFunction<BufferType<Buffer, Float>, Integer, Buffer> allBs = (at, s) -> {
+ Buffer b = at.construct(s);
+ for (int x = 0; x < s; x++) {
+ at.set(b, x, bv);
+ }
+ return b;
+ };
+
+ BiFunction<BufferType<Buffer, Float>, Integer, Buffer> halfBs = (at, s) -> {
+ Buffer b = at.construct(s);
+ for (int x = 0; x < s / 2; x++) {
+ at.set(b, x, bv);
+ }
+ for (int x = s / 2; x < s; x++) {
+ at.set(b, x, 1);
+ }
+ return b;
+ };
+
+ // Sanity check
+ int size = arraySizeFor(bufferType.elementType);
+ Assert.assertTrue(bufferType.pairWiseEquals(allAs.apply(bufferType, size),
+ allBs.apply(bufferType, size)));
+ Assert.assertTrue(bufferType.equals(allAs.apply(bufferType, size),
+ allBs.apply(bufferType, size)));
+
+ testBufferType(bufferType, allAs, allBs);
+ testBufferType(bufferType, allAs, halfBs);
+ }
+
+ // Tests CharBuffer for region sources and CharSequence sources
+ @Test(dataProvider = "charBufferTypesProvider")
+ public void testCharBuffers(BufferType.Chars charBufferType) {
+
+ BiFunction<BufferType.Chars, Integer, CharBuffer> constructor = (at, s) -> {
+ CharBuffer a = at.construct(s);
+ for (int x = 0; x < s; x++) {
+ at.set(a, x, x % 8);
+ }
+ return a;
+ };
+
+ BiFunction<BufferType.Chars, Integer, CharBuffer> constructorX = constructor.
+ andThen(charBufferType::transformToStringBuffer);
+
+ testBufferType(charBufferType, constructor, constructorX);
+ }
+
+
+ <B extends Buffer, E, BT extends BufferType<B, E>>
+ void testBufferType(BT bt,
+ BiFunction<BT, Integer, B> aConstructor,
+ BiFunction<BT, Integer, B> bConstructor) {
+ int n = arraySizeFor(bt.elementType);
+
+ for (int s : ranges(0, n)) {
+ B a = aConstructor.apply(bt, s);
+ B b = bConstructor.apply(bt, s);
+
+ for (int aFrom : ranges(0, s)) {
+ for (int aTo : ranges(aFrom, s)) {
+ int aLength = aTo - aFrom;
+
+ B as = aLength != s
+ ? bt.slice(a, aFrom, aTo)
+ : a;
+
+ for (int bFrom : ranges(0, s)) {
+ for (int bTo : ranges(bFrom, s)) {
+ int bLength = bTo - bFrom;
+
+ B bs = bLength != s
+ ? bt.slice(b, bFrom, bTo)
+ : b;
+
+ boolean eq = bt.pairWiseEquals(as, bs);
+ Assert.assertEquals(bt.equals(as, bs), eq);
+ Assert.assertEquals(bt.equals(bs, as), eq);
+ if (eq) {
+ Assert.assertEquals(bt.compare(as, bs), 0);
+ Assert.assertEquals(bt.compare(bs, as), 0);
+ }
+ else {
+ int aCb = bt.compare(as, bs);
+ int bCa = bt.compare(bs, as);
+ int v = Integer.signum(aCb) * Integer.signum(bCa);
+ Assert.assertTrue(v == -1);
+ }
+ }
+ }
+
+ if (aLength > 0 && !a.isReadOnly()) {
+ for (int i = aFrom; i < aTo; i++) {
+ B c = aConstructor.apply(bt, a.capacity());
+ B cs = aLength != s
+ ? bt.slice(c, aFrom, aTo)
+ : c;
+
+ // Create common prefix with a length of i - aFrom
+ bt.set(c, i, -1);
+
+ Assert.assertFalse(bt.equals(c, a));
+
+ int cCa = bt.compare(cs, as);
+ int aCc = bt.compare(as, cs);
+ int v = Integer.signum(cCa) * Integer.signum(aCc);
+ Assert.assertTrue(v == -1);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ static int[] ranges(int from, int to) {
+ int width = to - from;
+ switch (width) {
+ case 0:
+ return new int[]{};
+ case 1:
+ return new int[]{from, to};
+ case 2:
+ return new int[]{from, from + 1, to};
+ case 3:
+ return new int[]{from, from + 1, from + 2, to};
+ default:
+ return IntStream.of(from, from + 1, from + 2, to / 2 - 1, to / 2, to / 2 + 1, to - 2, to - 1, to)
+ .filter(i -> i >= from && i <= to)
+ .distinct().toArray();
+ }
+ }
+}
--- a/test/jdk/java/util/AbstractCollection/ToString.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/AbstractCollection/ToString.java Thu Jan 18 18:58:46 2018 +0000
@@ -29,8 +29,13 @@
* @author Josh Bloch, Martin Buchholz
*/
-import java.util.*;
-import java.util.concurrent.*;
+import java.util.AbstractCollection;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.Vector;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.CopyOnWriteArraySet;
public class ToString {
private static void realMain(String[] args) {
--- a/test/jdk/java/util/AbstractList/CheckForComodification.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/AbstractList/CheckForComodification.java Thu Jan 18 18:58:46 2018 +0000
@@ -30,7 +30,9 @@
* @ignore Bug fix temporarily removed as it uncovered other bugs (4992226)
*/
-import java.util.*;
+import java.util.ArrayList;
+import java.util.ConcurrentModificationException;
+import java.util.List;
public class CheckForComodification {
private static final int LENGTH = 10;
--- a/test/jdk/java/util/AbstractList/FailFastIterator.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/AbstractList/FailFastIterator.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,7 +28,10 @@
* *after* the set/add/remove operations were performed.
*/
-import java.util.*;
+import java.util.ArrayList;
+import java.util.ConcurrentModificationException;
+import java.util.List;
+import java.util.ListIterator;
public class FailFastIterator {
public static void main(String[] args) throws Exception {
--- a/test/jdk/java/util/AbstractList/HasNextAfterException.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/AbstractList/HasNextAfterException.java Thu Jan 18 18:58:46 2018 +0000
@@ -30,7 +30,10 @@
* @author Konstantin Kladko
*/
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.NoSuchElementException;
public class HasNextAfterException {
public static void main(String[] args) {
--- a/test/jdk/java/util/AbstractMap/AbstractMapClone.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/AbstractMap/AbstractMapClone.java Thu Jan 18 18:58:46 2018 +0000
@@ -30,7 +30,10 @@
* @author Konstantin Kladko
*/
-import java.util.*;
+import java.util.AbstractMap;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
public class AbstractMapClone extends AbstractMap implements Cloneable {
--- a/test/jdk/java/util/AbstractMap/Equals.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/AbstractMap/Equals.java Thu Jan 18 18:58:46 2018 +0000
@@ -21,7 +21,12 @@
* questions.
*/
-import java.util.*;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
/**
* @test
--- a/test/jdk/java/util/AbstractMap/SimpleEntries.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/AbstractMap/SimpleEntries.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,9 +28,10 @@
* @author Martin Buchholz
*/
-import java.util.*;
-import java.util.concurrent.*;
-import static java.util.AbstractMap.*;
+import java.util.Map;
+
+import static java.util.AbstractMap.SimpleEntry;
+import static java.util.AbstractMap.SimpleImmutableEntry;
public class SimpleEntries {
private static String k = "foo";
--- a/test/jdk/java/util/AbstractMap/ToString.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/AbstractMap/ToString.java Thu Jan 18 18:58:46 2018 +0000
@@ -29,7 +29,8 @@
* @author Josh Bloch
*/
-import java.util.*;
+import java.util.LinkedHashMap;
+import java.util.Map;
public class ToString {
public static void main(String[] args) {
--- a/test/jdk/java/util/AbstractSequentialList/AddAll.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/AbstractSequentialList/AddAll.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,7 +27,11 @@
* @summary AddAll(int, Collection) intersperses the Collection with this List.
*/
-import java.util.*;
+import java.util.AbstractSequentialList;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.ListIterator;
public class AddAll {
public static void main(String[] args) throws Exception {
--- a/test/jdk/java/util/ArrayList/AddAll.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/ArrayList/AddAll.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,7 +28,12 @@
* @author Josh Bloch
*/
-import java.util.*;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+import java.util.WeakHashMap;
public class AddAll {
public static void main(String[] args) {
--- a/test/jdk/java/util/ArrayList/Bug6533203.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/ArrayList/Bug6533203.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,7 +27,9 @@
* @summary AbstractList.ListItr.add might corrupt iterator state if enclosing add throws
*/
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
@SuppressWarnings({"serial","unchecked"})
public class Bug6533203 {
--- a/test/jdk/java/util/ArrayList/IteratorMicroBenchmark.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/ArrayList/IteratorMicroBenchmark.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,9 +27,12 @@
* @run main IteratorMicroBenchmark iterations=1 size=8 warmup=0
*/
+import static java.util.stream.Collectors.toList;
+
import java.lang.ref.WeakReference;
import java.util.ArrayDeque;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
@@ -165,16 +168,11 @@
}
private static Job[] filter(Pattern filter, Job[] jobs) {
- if (filter == null) return jobs;
- Job[] newJobs = new Job[jobs.length];
- int n = 0;
- for (Job job : jobs)
- if (filter.matcher(job.name()).find())
- newJobs[n++] = job;
- // Arrays.copyOf not available in JDK 5
- Job[] ret = new Job[n];
- System.arraycopy(newJobs, 0, ret, 0, n);
- return ret;
+ return (filter == null) ? jobs
+ : Arrays.stream(jobs)
+ .filter(job -> filter.matcher(job.name()).find())
+ .collect(toList())
+ .toArray(new Job[0]);
}
private static void deoptimize(int sum) {
--- a/test/jdk/java/util/ArrayList/RangeCheckMicroBenchmark.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/ArrayList/RangeCheckMicroBenchmark.java Thu Jan 18 18:58:46 2018 +0000
@@ -32,9 +32,14 @@
* @author Martin Buchholz
*/
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.CountDownLatch;
import java.util.regex.Pattern;
-import java.util.concurrent.CountDownLatch;
+
+import static java.util.stream.Collectors.toList;
public class RangeCheckMicroBenchmark {
abstract static class Job {
@@ -133,16 +138,11 @@
}
private static Job[] filter(Pattern filter, Job[] jobs) {
- if (filter == null) return jobs;
- Job[] newJobs = new Job[jobs.length];
- int n = 0;
- for (Job job : jobs)
- if (filter.matcher(job.name()).find())
- newJobs[n++] = job;
- // Arrays.copyOf not available in JDK 5
- Job[] ret = new Job[n];
- System.arraycopy(newJobs, 0, ret, 0, n);
- return ret;
+ return (filter == null) ? jobs
+ : Arrays.stream(jobs)
+ .filter(job -> filter.matcher(job.name()).find())
+ .collect(toList())
+ .toArray(new Job[0]);
}
private static void deoptimize(ArrayList<Integer> list) {
--- a/test/jdk/java/util/Collection/BiggernYours.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collection/BiggernYours.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,9 +28,27 @@
* @author Martin Buchholz
*/
-import java.io.*;
-import java.util.*;
-import java.util.concurrent.*;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Map;
+import java.util.NavigableMap;
+import java.util.NavigableSet;
+import java.util.Objects;
+import java.util.Random;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentLinkedDeque;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.ConcurrentSkipListMap;
+import java.util.concurrent.ConcurrentSkipListSet;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.CopyOnWriteArraySet;
+import java.util.concurrent.LinkedBlockingDeque;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.LinkedTransferQueue;
+import java.util.concurrent.PriorityBlockingQueue;
@SuppressWarnings("unchecked")
public class BiggernYours {
@@ -152,7 +170,7 @@
static int randomize(int size) { return rnd.nextInt(size + 2); }
@SuppressWarnings("serial")
- private static void realMain(String[] args) throws Throwable {
+ private static void realMain(String[] args) {
testNavigableMaps(
new ConcurrentSkipListMap(),
new ConcurrentSkipListMap() {
@@ -232,7 +250,7 @@
static void arrayEqual(Object[] x, Object[] y) {
if (x == null ? y == null : Arrays.equals(x, y)) pass();
else fail(Arrays.toString(x) + " not equal to " + Arrays.toString(y));}
- public static void main(String[] args) throws Throwable {
+ public static void main(String[] args) {
try {realMain(args);} catch (Throwable t) {unexpected(t);}
System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
if (failed > 0) throw new AssertionError("Some tests failed");}
--- a/test/jdk/java/util/Collection/HotPotatoes.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collection/HotPotatoes.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,9 +28,16 @@
* @author Martin Buchholz
*/
-import java.lang.reflect.*;
-import java.util.*;
-import java.util.concurrent.*;
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.PriorityQueue;
+import java.util.Vector;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.PriorityBlockingQueue;
@SuppressWarnings("unchecked")
public class HotPotatoes {
--- a/test/jdk/java/util/Collection/IteratorAtEnd.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collection/IteratorAtEnd.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,8 +28,34 @@
* @author Martin Buchholz
*/
-import java.util.*;
-import java.util.concurrent.*;
+import java.util.ArrayDeque;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.IdentityHashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.PriorityQueue;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.Vector;
+import java.util.WeakHashMap;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentLinkedDeque;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.ConcurrentSkipListMap;
+import java.util.concurrent.ConcurrentSkipListSet;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.CopyOnWriteArraySet;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.LinkedTransferQueue;
@SuppressWarnings("unchecked")
public class IteratorAtEnd {
--- a/test/jdk/java/util/Collection/IteratorMicroBenchmark.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collection/IteratorMicroBenchmark.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,10 +28,10 @@
*/
import static java.util.stream.Collectors.summingInt;
+import static java.util.stream.Collectors.toList;
import java.lang.ref.WeakReference;
import java.util.ArrayDeque;
-import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -205,12 +205,10 @@
}
private static List<Job> filter(Pattern filter, List<Job> jobs) {
- if (filter == null) return jobs;
- ArrayList<Job> newJobs = new ArrayList<>();
- for (Job job : jobs)
- if (filter.matcher(job.name()).find())
- newJobs.add(job);
- return newJobs;
+ return (filter == null) ? jobs
+ : jobs.stream()
+ .filter(job -> filter.matcher(job.name()).find())
+ .collect(toList());
}
private static void deoptimize(int sum) {
@@ -270,24 +268,24 @@
abq.add(abq.remove());
}
- ArrayList<Job> jobs = new ArrayList<>(Arrays.asList());
+ ArrayList<Job> jobs = new ArrayList<>();
- List.of(al, ad, abq,
- new LinkedList<>(al),
- new PriorityQueue<>(al),
- new Vector<>(al),
- new ConcurrentLinkedQueue<>(al),
- new ConcurrentLinkedDeque<>(al),
- new LinkedBlockingQueue<>(al),
- new LinkedBlockingDeque<>(al),
- new LinkedTransferQueue<>(al),
- new PriorityBlockingQueue<>(al))
- .stream()
- .forEach(x -> {
- jobs.addAll(collectionJobs(x));
- if (x instanceof Deque)
- jobs.addAll(dequeJobs((Deque<Integer>)x));
- });
+ List.<Collection<Integer>>of(
+ al, ad, abq,
+ new LinkedList<>(al),
+ new PriorityQueue<>(al),
+ new Vector<>(al),
+ new ConcurrentLinkedQueue<>(al),
+ new ConcurrentLinkedDeque<>(al),
+ new LinkedBlockingQueue<>(al),
+ new LinkedBlockingDeque<>(al),
+ new LinkedTransferQueue<>(al),
+ new PriorityBlockingQueue<>(al)).forEach(
+ x -> {
+ jobs.addAll(collectionJobs(x));
+ if (x instanceof Deque)
+ jobs.addAll(dequeJobs((Deque<Integer>)x));
+ });
if (reverse) Collections.reverse(jobs);
if (shuffle) Collections.shuffle(jobs);
--- a/test/jdk/java/util/Collection/RemoveMicroBenchmark.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collection/RemoveMicroBenchmark.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,6 +27,8 @@
* @run main RemoveMicroBenchmark iterations=1 size=8 warmup=0
*/
+import static java.util.stream.Collectors.toList;
+
import java.lang.ref.WeakReference;
import java.util.ArrayDeque;
import java.util.ArrayList;
@@ -202,12 +204,10 @@
}
private static List<Job> filter(Pattern filter, List<Job> jobs) {
- if (filter == null) return jobs;
- ArrayList<Job> newJobs = new ArrayList<>();
- for (Job job : jobs)
- if (filter.matcher(job.name()).find())
- newJobs.add(job);
- return newJobs;
+ return (filter == null) ? jobs
+ : jobs.stream()
+ .filter(job -> filter.matcher(job.name()).find())
+ .collect(toList());
}
private static void deoptimize(int sum) {
@@ -271,8 +271,7 @@
new LinkedBlockingQueue<>(),
new LinkedBlockingDeque<>(),
new LinkedTransferQueue<>(),
- new PriorityBlockingQueue<>())
- .stream().forEach(
+ new PriorityBlockingQueue<>()).forEach(
x -> {
String klazz = x.getClass().getSimpleName();
jobs.addAll(collectionJobs(klazz, () -> x, al));
--- a/test/jdk/java/util/Collections/AddAll.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collections/AddAll.java Thu Jan 18 18:58:46 2018 +0000
@@ -29,7 +29,15 @@
* @key randomness
*/
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Random;
public class AddAll {
static final int N = 100;
--- a/test/jdk/java/util/Collections/BigBinarySearch.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collections/BigBinarySearch.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,7 +28,13 @@
* @author Martin Buchholz
*/
-import java.util.*;
+import java.util.AbstractList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.RandomAccess;
public class BigBinarySearch {
--- a/test/jdk/java/util/Collections/BinarySearchNullComparator.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collections/BinarySearchNullComparator.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,7 +27,9 @@
* @summary Test Collections.binarySearch() with a null comparator
*/
-import java.util.*;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
public class BinarySearchNullComparator {
public static void main(String[] args) throws Exception {
--- a/test/jdk/java/util/Collections/CheckedIdentityMap.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collections/CheckedIdentityMap.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,14 +28,15 @@
* @summary Checked collections with underlying maps with identity comparisons
*/
-import java.util.*;
-import static java.util.Collections.*;
+import org.testng.annotations.Test;
+import java.util.IdentityHashMap;
+import java.util.Map;
+
+import static java.util.Collections.checkedMap;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotEquals;
-import org.testng.annotations.Test;
-
public class CheckedIdentityMap {
@Test
--- a/test/jdk/java/util/Collections/CheckedListBash.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collections/CheckedListBash.java Thu Jan 18 18:58:46 2018 +0000
@@ -29,7 +29,13 @@
* @key randomness
*/
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Random;
public class CheckedListBash {
static Random rnd = new Random();
--- a/test/jdk/java/util/Collections/CheckedMapBash.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collections/CheckedMapBash.java Thu Jan 18 18:58:46 2018 +0000
@@ -30,10 +30,20 @@
* @key randomness
*/
-import java.util.*;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Random;
+import java.util.Set;
+import java.util.TreeMap;
import java.util.function.Supplier;
-import org.testng.annotations.Test;
-import org.testng.annotations.DataProvider;
import static org.testng.Assert.fail;
--- a/test/jdk/java/util/Collections/CheckedNull.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collections/CheckedNull.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,8 +27,18 @@
* @summary Test behavior of nulls in checked collections
*/
-import java.util.*;
-import static java.util.Collections.*;
+import java.util.AbstractMap;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.TreeSet;
+
+import static java.util.Collections.singleton;
+import static java.util.Collections.singletonMap;
@SuppressWarnings({"unchecked","serial"})
public class CheckedNull {
--- a/test/jdk/java/util/Collections/CheckedSetBash.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collections/CheckedSetBash.java Thu Jan 18 18:58:46 2018 +0000
@@ -30,13 +30,23 @@
* @key randomness
*/
-import java.util.*;
-import java.util.function.Supplier;
+import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
-import org.testng.annotations.DataProvider;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Random;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.function.Supplier;
+
+import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
-import static org.testng.Assert.assertTrue;
public class CheckedSetBash {
static final int numItr = 100;
--- a/test/jdk/java/util/Collections/Disjoint.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collections/Disjoint.java Thu Jan 18 18:58:46 2018 +0000
@@ -29,7 +29,11 @@
* @key randomness
*/
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Random;
public class Disjoint {
static final int N = 20;
--- a/test/jdk/java/util/Collections/EmptyCollectionSerialization.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collections/EmptyCollectionSerialization.java Thu Jan 18 18:58:46 2018 +0000
@@ -29,14 +29,22 @@
* @run testng EmptyCollectionSerialization
*/
-import java.util.*;
-import java.util.function.Supplier;
-import java.io.*;
+import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
-import org.testng.annotations.DataProvider;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.function.Supplier;
+
+import static org.testng.Assert.assertSame;
import static org.testng.Assert.fail;
-import static org.testng.Assert.assertSame;
public class EmptyCollectionSerialization {
private static Object patheticDeepCopy(Object o) throws Exception {
--- a/test/jdk/java/util/Collections/EmptyIterator.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collections/EmptyIterator.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,10 +27,25 @@
* @summary Test empty iterators, enumerations, and collections
*/
-import static java.util.Collections.*;
-import java.util.*;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
import java.util.concurrent.SynchronousQueue;
+import static java.util.Collections.emptyEnumeration;
+import static java.util.Collections.emptyIterator;
+import static java.util.Collections.emptyList;
+import static java.util.Collections.emptyListIterator;
+import static java.util.Collections.emptyMap;
+import static java.util.Collections.emptySet;
+import static java.util.Collections.nCopies;
+import static java.util.Collections.unmodifiableMap;
+
public class EmptyIterator {
void test(String[] args) throws Throwable {
--- a/test/jdk/java/util/Collections/EmptyNavigableMap.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collections/EmptyNavigableMap.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,6 +27,12 @@
* @summary Unit test for Collections.emptyNavigableMap
* @run testng EmptyNavigableMap
*/
+
+import org.testng.Assert;
+import org.testng.Assert.ThrowingRunnable;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Collection;
@@ -37,13 +43,8 @@
import java.util.SortedMap;
import java.util.TreeMap;
-import org.testng.Assert;
-import org.testng.Assert.ThrowingRunnable;
-import org.testng.annotations.Test;
-import org.testng.annotations.DataProvider;
-
+import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.assertFalse;
public class EmptyNavigableMap {
@@ -124,10 +125,9 @@
*/
@Test(dataProvider = "NavigableMap<?,?>", dataProviderClass = EmptyNavigableMap.class)
public void testContainsRequiresComparable(String description, NavigableMap<?,?> navigableMap) {
- assertThrowsCCE(() -> {
- navigableMap.containsKey(new Object());
- },
- description + ": Compareable should be required");
+ assertThrowsCCE(
+ () -> navigableMap.containsKey(new Object()),
+ description + ": Comparable should be required");
}
/**
@@ -252,9 +252,7 @@
Object last = (BigInteger.ZERO == first) ? BigInteger.TEN : BigInteger.ZERO;
assertThrowsIAE(
- () -> {
- navigableMap.subMap(last, true, first, false);
- },
+ () -> navigableMap.subMap(last, true, first, false),
description + ": Must throw IllegalArgumentException when fromElement is not less than toElement.");
navigableMap.subMap(first, true, last, false);
@@ -273,9 +271,8 @@
// slightly smaller
NavigableMap ns = subMap.subMap(first, false, last, false);
// slight expansion
- assertThrowsIAE(() -> {
- ns.subMap(first, true, last, true);
- },
+ assertThrowsIAE(
+ () -> ns.subMap(first, true, last, true),
description + ": Expansion should not be allowed");
// much smaller
@@ -293,9 +290,8 @@
NavigableMap ns = subMap.headMap(BigInteger.ONE, false);
// slight expansion
- assertThrowsIAE(() -> {
- ns.headMap(BigInteger.ONE, true);
- },
+ assertThrowsIAE(
+ () -> ns.headMap(BigInteger.ONE, true),
description + ": Expansion should not be allowed");
// much smaller
@@ -313,9 +309,8 @@
NavigableMap ns = subMap.tailMap(BigInteger.ONE, false);
// slight expansion
- assertThrowsIAE(() -> {
- ns.tailMap(BigInteger.ONE, true);
- },
+ assertThrowsIAE(
+ () -> ns.tailMap(BigInteger.ONE, true),
description + ": Expansion should not be allowed");
// much smaller
@@ -327,14 +322,12 @@
*/
@Test(dataProvider = "NavigableMap<?,?>", dataProviderClass = EmptyNavigableMap.class)
public void testTailMap(String description, NavigableMap navigableMap) {
- assertThrowsNPE(() -> {
- navigableMap.tailMap(null);
- },
+ assertThrowsNPE(
+ () -> navigableMap.tailMap(null),
description + ": Must throw NullPointerException for null element");
- assertThrowsCCE(() -> {
- navigableMap.tailMap(new Object());
- },
+ assertThrowsCCE(
+ () -> navigableMap.tailMap(new Object()),
description);
NavigableMap ss = navigableMap.tailMap("1", true);
--- a/test/jdk/java/util/Collections/EmptyNavigableSet.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collections/EmptyNavigableSet.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,22 +27,23 @@
* @summary Unit test for Collections.emptyNavigableSet
* @run testng EmptyNavigableSet
*/
+
+import org.testng.Assert;
+import org.testng.Assert.ThrowingRunnable;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
+import java.util.NavigableSet;
import java.util.NoSuchElementException;
-import java.util.NavigableSet;
import java.util.SortedSet;
import java.util.TreeSet;
-import org.testng.Assert;
-import org.testng.Assert.ThrowingRunnable;
-import org.testng.annotations.Test;
-import org.testng.annotations.DataProvider;
-
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertSame;
import static org.testng.Assert.assertTrue;
@@ -130,10 +131,9 @@
*/
@Test(dataProvider = "NavigableSet<?>", dataProviderClass = EmptyNavigableSet.class)
public void testContainsRequiresComparable(String description, NavigableSet<?> navigableSet) {
- assertThrowsCCE(() -> {
- navigableSet.contains(new Object());
- },
- description + ": Compareable should be required");
+ assertThrowsCCE(
+ () -> navigableSet.contains(new Object()),
+ description + ": Comparable should be required");
}
/**
@@ -182,9 +182,7 @@
*/
@Test(dataProvider = "NavigableSet<?>", dataProviderClass = EmptyNavigableSet.class)
public void testFirst(String description, NavigableSet<?> navigableSet) {
- assertThrowsNSEE(() -> {
- navigableSet.first();
- }, description);
+ assertThrowsNSEE(navigableSet::first, description);
}
/**
@@ -210,9 +208,7 @@
*/
@Test(dataProvider = "NavigableSet<?>", dataProviderClass = EmptyNavigableSet.class)
public void testLast(String description, NavigableSet<?> navigableSet) {
- assertThrowsNSEE(() -> {
- navigableSet.last();
- }, description);
+ assertThrowsNSEE(navigableSet::last, description);
}
/**
@@ -277,9 +273,7 @@
Object last = (BigInteger.ZERO == first) ? BigInteger.TEN : BigInteger.ZERO;
assertThrowsIAE(
- () -> {
- navigableSet.subSet(last, true, first, false);
- },
+ () -> navigableSet.subSet(last, true, first, false),
description
+ ": Must throw IllegalArgumentException when fromElement is not less than toElement.");
@@ -299,9 +293,8 @@
// slightly smaller
NavigableSet ns = subSet.subSet(first, false, last, false);
// slight expansion
- assertThrowsIAE(() -> {
- ns.subSet(first, true, last, true);
- },
+ assertThrowsIAE(
+ () -> ns.subSet(first, true, last, true),
description + ": Expansion should not be allowed");
// much smaller
@@ -319,9 +312,8 @@
NavigableSet ns = subSet.headSet(BigInteger.ONE, false);
// slight expansion
- assertThrowsIAE(() -> {
- ns.headSet(BigInteger.ONE, true);
- },
+ assertThrowsIAE(
+ () -> ns.headSet(BigInteger.ONE, true),
description + ": Expansion should not be allowed");
// much smaller
@@ -339,9 +331,8 @@
NavigableSet ns = subSet.tailSet(BigInteger.ONE, false);
// slight expansion
- assertThrowsIAE(() -> {
- ns.tailSet(BigInteger.ONE, true);
- },
+ assertThrowsIAE(
+ () -> ns.tailSet(BigInteger.ONE, true),
description + ": Expansion should not be allowed");
// much smaller
@@ -353,14 +344,13 @@
*/
@Test(dataProvider = "NavigableSet<?>", dataProviderClass = EmptyNavigableSet.class)
public void testTailSet(String description, NavigableSet navigableSet) {
- assertThrowsNPE(() -> {
- navigableSet.tailSet(null);
- },
+ assertThrowsNPE(
+ () -> navigableSet.tailSet(null),
description + ": Must throw NullPointerException for null element");
- assertThrowsCCE(() -> {
- navigableSet.tailSet(new Object());
- }, description);
+ assertThrowsCCE(
+ () -> navigableSet.tailSet(new Object()),
+ description);
NavigableSet ss = navigableSet.tailSet("1", true);
--- a/test/jdk/java/util/Collections/Enum.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collections/Enum.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,7 +27,9 @@
* @summary Basic test for new Enumeration -> List converter
*/
-import java.util.*;
+import java.util.Collections;
+import java.util.List;
+import java.util.Vector;
public class Enum {
public static void main(String[] args) throws Exception {
--- a/test/jdk/java/util/Collections/FindSubList.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collections/FindSubList.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,7 +27,12 @@
* @summary Basic test for Collections.indexOfSubList/lastIndexOfSubList
*/
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Vector;
public class FindSubList {
public static void main(String[] args) throws Exception {
--- a/test/jdk/java/util/Collections/Frequency.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collections/Frequency.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,7 +28,10 @@
* @author Josh Bloch
*/
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
public class Frequency {
static final int N = 100;
--- a/test/jdk/java/util/Collections/MinMax.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collections/MinMax.java Thu Jan 18 18:58:46 2018 +0000
@@ -29,7 +29,9 @@
* @author Josh Bloch
*/
-import java.util.*;
+import java.util.Collections;
+import java.util.LinkedHashSet;
+import java.util.Set;
public class MinMax {
public static void main(String[] args) {
--- a/test/jdk/java/util/Collections/NCopies.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collections/NCopies.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,8 +28,8 @@
* @author Martin Buchholz
*/
-import java.util.*;
-import java.util.concurrent.*;
+import java.util.Collections;
+import java.util.List;
public class NCopies {
static volatile int passed = 0, failed = 0;
--- a/test/jdk/java/util/Collections/NullComparator.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collections/NullComparator.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,7 +27,10 @@
* @summary A null Comparator is now specified to indicate natural ordering.
*/
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
public class NullComparator {
public static void main(String[] args) throws Exception {
--- a/test/jdk/java/util/Collections/RacingCollections.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collections/RacingCollections.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,9 +28,46 @@
* @author Martin Buchholz
*/
-import static java.util.Collections.*;
-import java.util.*;
-import java.util.concurrent.*;
+import java.util.ArrayDeque;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Deque;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Queue;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.Vector;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentLinkedDeque;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.ConcurrentSkipListMap;
+import java.util.concurrent.ConcurrentSkipListSet;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.CopyOnWriteArraySet;
+import java.util.concurrent.LinkedBlockingDeque;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.LinkedTransferQueue;
+
+import static java.util.Collections.asLifoQueue;
+import static java.util.Collections.checkedList;
+import static java.util.Collections.checkedMap;
+import static java.util.Collections.checkedSet;
+import static java.util.Collections.newSetFromMap;
+import static java.util.Collections.synchronizedList;
+import static java.util.Collections.synchronizedMap;
+import static java.util.Collections.synchronizedSet;
+import static java.util.Collections.unmodifiableList;
+import static java.util.Collections.unmodifiableMap;
+import static java.util.Collections.unmodifiableSet;
public class RacingCollections {
/**
--- a/test/jdk/java/util/Collections/ReplaceAll.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collections/ReplaceAll.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,7 +27,11 @@
* @summary Basic test for new replaceAll algorithm
*/
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Vector;
public class ReplaceAll {
static final int SIZE = 20;
--- a/test/jdk/java/util/Collections/ReverseOrder.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collections/ReverseOrder.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,8 +28,14 @@
* @author Josh Bloch
*/
-import java.util.*;
-import java.io.*;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
public class ReverseOrder {
static byte[] serialBytes(Object o) {
--- a/test/jdk/java/util/Collections/ReverseOrder2.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collections/ReverseOrder2.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,8 +28,17 @@
* @author Josh Bloch, Martin Buchholz
*/
-import java.util.*;
-import java.io.*;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.LinkedList;
+import java.util.List;
public class ReverseOrder2 {
static final int N = 100;
--- a/test/jdk/java/util/Collections/Rotate.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collections/Rotate.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,7 +28,12 @@
* @key randomness
*/
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Random;
+import java.util.Vector;
public class Rotate {
// Should have lots of distinct factors and be > ROTATE_THRESHOLD
--- a/test/jdk/java/util/Collections/RotateEmpty.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collections/RotateEmpty.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,7 +27,9 @@
* @summary Collections.rotate(...) returns ArithmeticException
*/
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
public class RotateEmpty {
--- a/test/jdk/java/util/Collections/Ser.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collections/Ser.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,8 +28,13 @@
* nCopies and singleton were spec'd to be serializable, but weren't.
*/
-import java.io.*;
-import java.util.*;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
public class Ser {
public static void main(String[] args) throws Exception {
--- a/test/jdk/java/util/Collections/SetFromMap.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collections/SetFromMap.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,7 +28,10 @@
* @author Martin Buchholz
*/
-import java.util.*;
+import java.util.Collections;
+import java.util.IdentityHashMap;
+import java.util.Map;
+import java.util.Set;
public class SetFromMap {
static volatile int passed = 0, failed = 0;
--- a/test/jdk/java/util/Collections/Swap.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collections/Swap.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,7 +28,9 @@
* @author Josh Bloch
*/
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
public class Swap {
static final int SIZE = 100;
--- a/test/jdk/java/util/Collections/T5078378.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collections/T5078378.java Thu Jan 18 18:58:46 2018 +0000
@@ -21,7 +21,7 @@
* questions.
*/
-/**
+/*
* @test
* @bug 5078378
* @summary REGRESSION: Some calls to Collections.binarySearch no longer compile
@@ -30,7 +30,9 @@
* @compile T5078378.java
* @compile/fail -Xlint:unchecked -Werror T5078378.java
*/
-import java.util.*;
+
+import java.util.Collections;
+import java.util.List;
class T5078378 {
public static boolean contains(List l, Object o) {
--- a/test/jdk/java/util/Collections/T6433170.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collections/T6433170.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,8 +27,16 @@
* @summary CheckedCollection.addAll should be all-or-nothing
*/
-import java.util.*;
-import static java.util.Collections.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Vector;
+
+import static java.util.Collections.checkedCollection;
+import static java.util.Collections.checkedList;
+import static java.util.Collections.checkedSet;
@SuppressWarnings("unchecked")
public class T6433170 {
--- a/test/jdk/java/util/Collections/ViewSynch.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collections/ViewSynch.java Thu Jan 18 18:58:46 2018 +0000
@@ -29,7 +29,11 @@
* (Got that?)
*/
-import java.util.*;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.TreeMap;
public class ViewSynch {
static final Integer ZERO = new Integer(0);
--- a/test/jdk/java/util/Collections/WrappedNull.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Collections/WrappedNull.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,7 +28,16 @@
* rather than later
*/
-import java.util.*;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedMap;
+import java.util.SortedSet;
+import java.util.TreeMap;
+import java.util.TreeSet;
public class WrappedNull {
public static void main(String[] args) throws Exception {
--- a/test/jdk/java/util/HashMap/KeySetRemove.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/HashMap/KeySetRemove.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,7 +28,9 @@
* false if the Map previously mapped k to null.
*/
-import java.util.*;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.TreeMap;
public class KeySetRemove {
public static void main(String[] args) throws Exception {
--- a/test/jdk/java/util/HashMap/SetValue.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/HashMap/SetValue.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,7 +28,8 @@
* @author jbloch
*/
-import java.util.*;
+import java.util.HashMap;
+import java.util.Map;
public class SetValue {
static final String key = "key";
--- a/test/jdk/java/util/HashMap/ToString.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/HashMap/ToString.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,7 +28,8 @@
* contained null keys or values.
*/
-import java.util.*;
+import java.util.HashMap;
+import java.util.Map;
public class ToString {
public static void main(String[] args) throws Exception {
--- a/test/jdk/java/util/Hashtable/EqualsCast.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Hashtable/EqualsCast.java Thu Jan 18 18:58:46 2018 +0000
@@ -29,8 +29,8 @@
* unnecessarily. (java.security.Provider tickled this sensitivity.)
*/
-import java.util.*;
import java.security.Provider;
+import java.util.Map;
public class EqualsCast {
public static void main(String[] args) throws Exception {
--- a/test/jdk/java/util/Hashtable/HashCode.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Hashtable/HashCode.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,7 +28,8 @@
* @author Josh Bloch
*/
-import java.util.*;
+import java.util.Hashtable;
+import java.util.Map;
public class HashCode {
public static void main(String[] args) throws Exception {
--- a/test/jdk/java/util/Hashtable/IllegalLoadFactor.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Hashtable/IllegalLoadFactor.java Thu Jan 18 18:58:46 2018 +0000
@@ -26,7 +26,12 @@
@summary Test for an illegalargumentexception on loadFactor
*/
-import java.util.*;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Set;
+import java.util.WeakHashMap;
/**
* This class tests to see if creating a hash table with an
--- a/test/jdk/java/util/Hashtable/ReadObject.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Hashtable/ReadObject.java Thu Jan 18 18:58:46 2018 +0000
@@ -21,18 +21,18 @@
* questions.
*/
-/**
+/*
* @test
* @bug 4652911
* @summary test Hashtable readObject for invocation of overridable put method
*/
-import java.util.Hashtable;
+import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
-import java.io.ByteArrayInputStream;
-import java.io.ObjectInputStream;
import java.io.Serializable;
+import java.util.Hashtable;
/**
* Class that extends Hashtable to demonstrate bug when
@@ -52,7 +52,7 @@
Object getValue() {
return mValue;
}
- };
+ }
public Object get(Object key) {
ValueWrapper valueWrapper = (ValueWrapper)super.get(key);
--- a/test/jdk/java/util/Hashtable/SelfRef.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Hashtable/SelfRef.java Thu Jan 18 18:58:46 2018 +0000
@@ -29,8 +29,11 @@
* @author Josh Bloch, Martin Buchholz
*/
-import java.util.*;
-import java.util.concurrent.*;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
public class SelfRef {
public static void main(String[] args) {
--- a/test/jdk/java/util/IdentityHashMap/ToArray.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/IdentityHashMap/ToArray.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,7 +28,11 @@
* @author Josh Bloch, Martin Buchholz
*/
-import java.util.*;
+import java.util.ArrayList;
+import java.util.IdentityHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
public class ToArray {
public static void main(String[] args) {
--- a/test/jdk/java/util/IdentityHashMap/ToString.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/IdentityHashMap/ToString.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,7 +28,10 @@
* @author Josh Bloch
*/
-import java.util.*;
+import java.util.IdentityHashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
public class ToString {
public static void main(String[] args) {
--- a/test/jdk/java/util/LinkedHashMap/Basic.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/LinkedHashMap/Basic.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,9 +27,21 @@
* @summary Basic test for LinkedHashMap. (Based on MapBash)
*/
-import java.util.*;
-import java.util.function.*;
-import java.io.*;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Random;
+import java.util.Set;
+import java.util.function.BiFunction;
public class Basic {
static final Random rnd = new Random(666);
--- a/test/jdk/java/util/LinkedHashMap/Cache.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/LinkedHashMap/Cache.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,7 +27,8 @@
* @summary Basic test of removeEldestElement method.
*/
-import java.util.*;
+import java.util.LinkedHashMap;
+import java.util.Map;
public class Cache {
private static final int MAP_SIZE = 10;
--- a/test/jdk/java/util/LinkedHashMap/EmptyMapIterator.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/LinkedHashMap/EmptyMapIterator.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,12 +27,14 @@
* @summary iterators on collection views of empty map weren't fail-fast.
*/
-import java.util.*;
+import java.util.ConcurrentModificationException;
+import java.util.HashMap;
+import java.util.Iterator;
public class EmptyMapIterator {
public static void main(String[] args) throws Exception {
HashMap map = new HashMap();
- Iterator iter = iter = map.entrySet().iterator();
+ Iterator iter = map.entrySet().iterator();
map.put("key", "value");
try {
--- a/test/jdk/java/util/LinkedHashSet/Basic.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/LinkedHashSet/Basic.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,8 +27,15 @@
* @summary Basic test for LinkedHashSet. (Based on SetBash)
*/
-import java.util.*;
-import java.io.*;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Random;
+import java.util.Set;
public class Basic {
static Random rnd = new Random(666);
--- a/test/jdk/java/util/LinkedList/AddAll.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/LinkedList/AddAll.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,7 +27,10 @@
* @summary AddAll was prepending instead of appending!
*/
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
public class AddAll {
public static void main(String[] args) throws Exception {
--- a/test/jdk/java/util/LinkedList/Clone.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/LinkedList/Clone.java Thu Jan 18 18:58:46 2018 +0000
@@ -29,7 +29,9 @@
* TreeMap.
*/
-import java.util.*;
+import java.util.LinkedList;
+import java.util.TreeMap;
+import java.util.TreeSet;
public class Clone {
public static void main(String[] args) {
--- a/test/jdk/java/util/LinkedList/ComodifiedRemove.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/LinkedList/ComodifiedRemove.java Thu Jan 18 18:58:46 2018 +0000
@@ -29,9 +29,10 @@
* @author Konstantin Kladko
*/
-import java.util.*;
+import java.util.ConcurrentModificationException;
+import java.util.LinkedList;
+import java.util.List;
import java.util.ListIterator;
-import java.util.ConcurrentModificationException;
public class ComodifiedRemove {
public static
--- a/test/jdk/java/util/List/LockStep.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/List/LockStep.java Thu Jan 18 18:58:46 2018 +0000
@@ -29,10 +29,23 @@
* @key randomness
*/
-import java.io.*;
-import java.util.*;
-import java.util.concurrent.*;
-import static java.util.Collections.*;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.ConcurrentModificationException;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Random;
+import java.util.Vector;
@SuppressWarnings("unchecked")
public class LockStep {
--- a/test/jdk/java/util/Locale/bcp47u/FormatTests.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Locale/bcp47u/FormatTests.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
/*
*
* @test
- * @bug 8176841
+ * @bug 8176841 8194148
* @summary Tests *Format class deals with Unicode extensions
* correctly.
* @modules jdk.localedata
@@ -73,6 +73,7 @@
private static final String NUM_SINH = "\u0de7\u0de8,\u0de9\u0dea\u0deb.\u0dec\u0ded\u0dee\u0def";
private static final Date testDate = new Calendar.Builder()
+ .setCalendarType("gregory")
.setDate(2017, 7, 10)
.setTimeOfDay(15, 15, 0)
.setTimeZone(AMLA)
--- a/test/jdk/java/util/Locale/bcp47u/SymbolsTests.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Locale/bcp47u/SymbolsTests.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,11 +24,11 @@
/*
*
* @test
- * @bug 8176841
+ * @bug 8176841 8194148
* @summary Tests *FormatSymbols class deals with Unicode extensions
* correctly.
* @modules jdk.localedata
- * @run testng/othervm -Djava.locale.providers=CLDR FormatTests
+ * @run testng/othervm -Djava.locale.providers=CLDR SymbolsTests
*/
import static org.testng.Assert.assertEquals;
@@ -66,11 +66,11 @@
return new Object[][] {
// Locale, expected decimal separator, expected grouping separator
- {RG_AT, ",", "."},
- {Locale.US, ".", ","},
+ {RG_AT, ',', '.'},
+ {Locale.US, '.', ','},
// -nu & -rg mixed. -nu should win
- {Locale.forLanguageTag("ar-EG-u-nu-latn-rg-mazzzz"), ".", ","},
+ {Locale.forLanguageTag("ar-EG-u-nu-latn-rg-mazzzz"), '.', ','},
};
}
--- a/test/jdk/java/util/Map/Defaults.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Map/Defaults.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,6 +28,11 @@
* @author Mike Duigou
* @run testng Defaults
*/
+
+import org.testng.Assert.ThrowingRunnable;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
import java.util.AbstractMap;
import java.util.AbstractSet;
import java.util.ArrayList;
@@ -36,36 +41,31 @@
import java.util.Collections;
import java.util.EnumMap;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Hashtable;
-import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
+import java.util.Set;
import java.util.TreeMap;
-import java.util.Set;
import java.util.WeakHashMap;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Supplier;
-import org.testng.Assert.ThrowingRunnable;
-import org.testng.annotations.Test;
-import org.testng.annotations.DataProvider;
-
import static java.util.Objects.requireNonNull;
-
-import static org.testng.Assert.fail;
import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertSame;
import static org.testng.Assert.assertThrows;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
public class Defaults {
@@ -730,7 +730,7 @@
e90, e91, e92, e93, e94, e95, e96, e97, e98, e99,
EXTRA_KEY;
public static final int SIZE = values().length;
- };
+ }
private static final int TEST_SIZE = IntegerEnum.SIZE - 1;
/**
* Realized keys ensure that there is always a hard ref to all test objects.
--- a/test/jdk/java/util/Map/Get.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Map/Get.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,10 +28,18 @@
* @author Martin Buchholz
*/
-import java.io.*;
-import java.util.*;
-import java.util.concurrent.*;
-import java.util.concurrent.atomic.*;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.IdentityHashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.SortedMap;
+import java.util.TreeMap;
+import java.util.WeakHashMap;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ConcurrentSkipListMap;
public class Get {
--- a/test/jdk/java/util/Map/LockStep.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Map/LockStep.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,8 +28,20 @@
* @key randomness
*/
-import java.util.*;
-import java.util.concurrent.*;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.IdentityHashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.TreeMap;
+import java.util.WeakHashMap;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentSkipListMap;
/**
* Based on the strange scenario required to reproduce
--- a/test/jdk/java/util/NavigableMap/LockStep.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/NavigableMap/LockStep.java Thu Jan 18 18:58:46 2018 +0000
@@ -32,10 +32,35 @@
* @key randomness
*/
-import java.io.*;
-import java.util.*;
-import java.util.concurrent.*;
-import static java.util.Collections.*;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.NotSerializableException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.NavigableMap;
+import java.util.NavigableSet;
+import java.util.NoSuchElementException;
+import java.util.Random;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.concurrent.ConcurrentSkipListMap;
+import java.util.concurrent.ConcurrentSkipListSet;
+
+import static java.util.Collections.reverseOrder;
+import static java.util.Collections.singleton;
+import static java.util.Collections.singletonMap;
@SuppressWarnings("unchecked")
public class LockStep {
--- a/test/jdk/java/util/PriorityQueue/AddNonComparable.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/PriorityQueue/AddNonComparable.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,6 +27,8 @@
* @run testng AddNonComparable
*/
+import org.testng.annotations.Test;
+
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.SortedMap;
@@ -39,8 +41,8 @@
import java.util.function.BiConsumer;
import java.util.function.Supplier;
-import static org.testng.Assert.*;
-import org.testng.annotations.Test;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
public class AddNonComparable {
--- a/test/jdk/java/util/PriorityQueue/NoNulls.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/PriorityQueue/NoNulls.java Thu Jan 18 18:58:46 2018 +0000
@@ -38,8 +38,8 @@
*/
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Comparator;
-import java.util.Collection;
import java.util.PriorityQueue;
import java.util.SortedSet;
import java.util.TreeSet;
--- a/test/jdk/java/util/PriorityQueue/PriorityQueueSort.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/PriorityQueue/PriorityQueueSort.java Thu Jan 18 18:58:46 2018 +0000
@@ -42,18 +42,14 @@
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
+import java.util.PriorityQueue;
import java.util.Queue;
-import java.util.PriorityQueue;
public class PriorityQueueSort {
static class MyComparator implements Comparator<Integer> {
public int compare(Integer x, Integer y) {
- int i = x.intValue();
- int j = y.intValue();
- if (i < j) return -1;
- if (i > j) return 1;
- return 0;
+ return Integer.compare(x.intValue(), y.intValue());
}
}
--- a/test/jdk/java/util/PriorityQueue/RemoveContains.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/PriorityQueue/RemoveContains.java Thu Jan 18 18:58:46 2018 +0000
@@ -37,8 +37,8 @@
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.LinkedTransferQueue;
import java.util.concurrent.PriorityBlockingQueue;
-import java.util.concurrent.LinkedTransferQueue;
public class RemoveContains {
static volatile int passed = 0, failed = 0;
--- a/test/jdk/java/util/Random/NextBytes.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Random/NextBytes.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,7 +28,8 @@
* @author Martin Buchholz
*/
-import java.util.*;
+import java.util.Arrays;
+import java.util.Random;
public class NextBytes {
private static void realMain(String[] args) throws Throwable {
--- a/test/jdk/java/util/TimSort/SortPerf.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/TimSort/SortPerf.java Thu Jan 18 18:58:46 2018 +0000
@@ -21,8 +21,6 @@
* questions.
*/
-import java.util.Arrays;
-
public class SortPerf {
private static final int NUM_SETS = 5;
private static final int[] lengths = { 10, 100, 1000, 10000, 1000000 };
--- a/test/jdk/java/util/TreeMap/ContainsValue.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/TreeMap/ContainsValue.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,7 +27,8 @@
* @summary TreeMap.containsValue throws NullPointerExc for empty TreeMap
*/
-import java.util.*;
+import java.util.Map;
+import java.util.TreeMap;
public class ContainsValue {
public static void main(String[] args) {
--- a/test/jdk/java/util/TreeMap/HeadTailTypeError.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/TreeMap/HeadTailTypeError.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,7 +28,10 @@
* valid range in the backing array
*/
-import java.util.*;
+import java.util.SortedMap;
+import java.util.SortedSet;
+import java.util.TreeMap;
+import java.util.TreeSet;
public class HeadTailTypeError {
public static void main(String[] args) throws Exception {
--- a/test/jdk/java/util/TreeMap/NullAtEnd.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/TreeMap/NullAtEnd.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,8 +28,9 @@
* @author Martin Buchholz
*/
-import java.util.*;
-import java.util.concurrent.*;
+import java.util.Comparator;
+import java.util.SortedMap;
+import java.util.TreeMap;
public class NullAtEnd {
static volatile int passed = 0, failed = 0;
--- a/test/jdk/java/util/TreeMap/NullPermissiveComparator.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/TreeMap/NullPermissiveComparator.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,10 +28,9 @@
* @author Martin Buchholz
*/
-import java.util.*;
-import java.util.concurrent.*;
-import java.util.concurrent.atomic.*;
-import java.lang.reflect.*;
+import java.util.Comparator;
+import java.util.Map;
+import java.util.TreeMap;
@SuppressWarnings("unchecked")
public class NullPermissiveComparator {
--- a/test/jdk/java/util/TreeMap/SubMap.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/TreeMap/SubMap.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,7 +27,11 @@
* @summary The firstKey and lastKey
*/
-import java.util.*;
+import java.util.NoSuchElementException;
+import java.util.SortedMap;
+import java.util.SortedSet;
+import java.util.TreeMap;
+import java.util.TreeSet;
public class SubMap {
public static void main(String[] args) throws Exception {
--- a/test/jdk/java/util/TreeMap/SubMapClear.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/TreeMap/SubMapClear.java Thu Jan 18 18:58:46 2018 +0000
@@ -29,7 +29,9 @@
* @author Josh Bloch
*/
-import java.util.*;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
public class SubMapClear {
public static void main(String[] args) {
--- a/test/jdk/java/util/Vector/ComodifiedRemoveAllElements.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Vector/ComodifiedRemoveAllElements.java Thu Jan 18 18:58:46 2018 +0000
@@ -29,7 +29,9 @@
* @author Konstantin Kladko
*/
-import java.util.*;
+import java.util.ConcurrentModificationException;
+import java.util.Iterator;
+import java.util.Vector;
public class ComodifiedRemoveAllElements {
public static void main(String[] args) {
--- a/test/jdk/java/util/Vector/CopyInto.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Vector/CopyInto.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,10 +28,7 @@
* @author Martin Buchholz
*/
-import java.io.*;
-import java.util.*;
-import java.util.concurrent.*;
-import java.util.concurrent.atomic.*;
+import java.util.Vector;
public class CopyInto {
private static void realMain(String[] args) throws Throwable {
--- a/test/jdk/java/util/Vector/IllegalConstructorArgs.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Vector/IllegalConstructorArgs.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,7 +27,7 @@
* @summary Test for illegal argument exception
*/
-import java.util.*;
+import java.util.Vector;
/**
* This is a simple test class created to check for
--- a/test/jdk/java/util/Vector/LastIndexOf.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Vector/LastIndexOf.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,7 +28,7 @@
* valid range in the backing array
*/
-import java.util.*;
+import java.util.Vector;
public class LastIndexOf {
public static void main(String[] args) throws Exception {
--- a/test/jdk/java/util/Vector/SyncLastIndexOf.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/Vector/SyncLastIndexOf.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,7 +27,8 @@
* @summary Vector's lastIndexOf(Object) was lacking synchronization
* @author Konstantin Kladko
*/
-import java.util.*;
+
+import java.util.Vector;
public class SyncLastIndexOf {
--- a/test/jdk/java/util/WeakHashMap/GCDuringIteration.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/WeakHashMap/GCDuringIteration.java Thu Jan 18 18:58:46 2018 +0000
@@ -32,7 +32,7 @@
* @key randomness
*/
-import static java.util.concurrent.TimeUnit.SECONDS;
+import jdk.test.lib.RandomFactory;
import java.lang.ref.WeakReference;
import java.util.Arrays;
@@ -43,7 +43,8 @@
import java.util.WeakHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.function.BooleanSupplier;
-import jdk.test.lib.RandomFactory;
+
+import static java.util.concurrent.TimeUnit.SECONDS;
public class GCDuringIteration {
--- a/test/jdk/java/util/WeakHashMap/Iteration.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/WeakHashMap/Iteration.java Thu Jan 18 18:58:46 2018 +0000
@@ -28,7 +28,9 @@
* @author Josh Bloch
*/
-import java.util.*;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.WeakHashMap;
public class Iteration {
public static void main(String[] args) {
--- a/test/jdk/java/util/WeakHashMap/ZeroInitCap.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/WeakHashMap/ZeroInitCap.java Thu Jan 18 18:58:46 2018 +0000
@@ -21,7 +21,8 @@
* questions.
*/
-import java.util.*;
+import java.util.Map;
+import java.util.WeakHashMap;
/*
* @test
--- a/test/jdk/java/util/concurrent/ArrayBlockingQueue/WhiteBox.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/ArrayBlockingQueue/WhiteBox.java Thu Jan 18 18:58:46 2018 +0000
@@ -39,7 +39,7 @@
*/
import static org.testng.Assert.*;
-import org.testng.annotations.DataProvider;
+
import org.testng.annotations.Test;
import java.lang.ref.WeakReference;
--- a/test/jdk/java/util/concurrent/BlockingQueue/DrainToFails.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/BlockingQueue/DrainToFails.java Thu Jan 18 18:58:46 2018 +0000
@@ -78,9 +78,7 @@
pseudodelay = i;
}
public int compareTo(PDelay other) {
- int a = this.pseudodelay;
- int b = other.pseudodelay;
- return (a < b) ? -1 : (a > b) ? 1 : 0;
+ return Integer.compare(this.pseudodelay, other.pseudodelay);
}
public int compareTo(Delayed y) {
return compareTo((PDelay)y);
--- a/test/jdk/java/util/concurrent/BlockingQueue/LoopHelpers.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/BlockingQueue/LoopHelpers.java Thu Jan 18 18:58:46 2018 +0000
@@ -95,7 +95,7 @@
String num = Long.toString(n);
if (num.length() >= field.length())
return num;
- StringBuffer b = new StringBuffer(field);
+ StringBuilder b = new StringBuilder(field);
b.replace(b.length()-num.length(), b.length(), num);
return b.toString();
}
--- a/test/jdk/java/util/concurrent/BlockingQueue/OfferDrainToLoops.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/BlockingQueue/OfferDrainToLoops.java Thu Jan 18 18:58:46 2018 +0000
@@ -79,7 +79,7 @@
final long timeoutMillis = 10L * 1000L;
final SplittableRandom rnd = new SplittableRandom();
- /** Poor man's bounded buffer. */
+ // Poor man's bounded buffer.
final AtomicLong approximateCount = new AtomicLong(0L);
abstract class CheckedThread extends Thread {
--- a/test/jdk/java/util/concurrent/CompletableFuture/Basic.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/CompletableFuture/Basic.java Thu Jan 18 18:58:46 2018 +0000
@@ -151,11 +151,11 @@
// runAsync tests
//----------------------------------------------------------------
try {
- CompletableFuture<Void> cf = runAsync(() -> { });
+ CompletableFuture<Void> cf = runAsync(() -> {});
checkCompletedNormally(cf, cf.join());
- cf = runAsync(() -> { }, commonPool());
+ cf = runAsync(() -> {}, commonPool());
checkCompletedNormally(cf, cf.join());
- cf = runAsync(() -> { }, executor);
+ cf = runAsync(() -> {}, executor);
checkCompletedNormally(cf, cf.join());
cf = runAsync(() -> { throw new RuntimeException(); });
checkCompletedExceptionally(cf);
@@ -200,32 +200,32 @@
try {
CompletableFuture<Integer> cf2;
CompletableFuture<String> cf1 = supplyAsync(() -> "a test string");
- cf2 = cf1.thenApply((x) -> { if (x.equals("a test string")) return 1; else return 0; });
+ cf2 = cf1.thenApply(x -> x.equals("a test string") ? 1 : 0);
checkCompletedNormally(cf1, "a test string");
checkCompletedNormally(cf2, 1);
cf1 = supplyAsync(() -> "a test string");
- cf2 = cf1.thenApplyAsync((x) -> { if (x.equals("a test string")) return 1; else return 0; });
+ cf2 = cf1.thenApplyAsync(x -> x.equals("a test string") ? 1 : 0);
checkCompletedNormally(cf1, "a test string");
checkCompletedNormally(cf2, 1);
cf1 = supplyAsync(() -> "a test string");
- cf2 = cf1.thenApplyAsync((x) -> { if (x.equals("a test string")) return 1; else return 0; }, executor);
+ cf2 = cf1.thenApplyAsync(x -> x.equals("a test string") ? 1 : 0, executor);
checkCompletedNormally(cf1, "a test string");
checkCompletedNormally(cf2, 1);
cf1 = supplyAsync(() -> { throw new RuntimeException(); });
- cf2 = cf1.thenApply((x) -> { return 0; } );
+ cf2 = cf1.thenApply(x -> 0);
checkCompletedExceptionally(cf1);
checkCompletedExceptionally(cf2);
cf1 = supplyAsync(() -> { throw new RuntimeException(); });
- cf2 = cf1.thenApplyAsync((x) -> { return 0; } );
+ cf2 = cf1.thenApplyAsync(x -> 0);
checkCompletedExceptionally(cf1);
checkCompletedExceptionally(cf2);
cf1 = supplyAsync(() -> { throw new RuntimeException(); });
- cf2 = cf1.thenApplyAsync((x) -> { return 0; }, executor);
+ cf2 = cf1.thenApplyAsync(x -> 0, executor);
checkCompletedExceptionally(cf1);
checkCompletedExceptionally(cf2);
} catch (Throwable t) { unexpected(t); }
@@ -237,40 +237,40 @@
CompletableFuture<Void> cf2;
int before = atomicInt.get();
CompletableFuture<String> cf1 = supplyAsync(() -> "a test string");
- cf2 = cf1.thenAccept((x) -> { if (x.equals("a test string")) { atomicInt.incrementAndGet(); return; } throw new RuntimeException(); });
+ cf2 = cf1.thenAccept(x -> { if (x.equals("a test string")) { atomicInt.incrementAndGet(); return; } throw new RuntimeException(); });
checkCompletedNormally(cf1, "a test string");
checkCompletedNormally(cf2, null);
check(atomicInt.get() == (before + 1));
before = atomicInt.get();
cf1 = supplyAsync(() -> "a test string");
- cf2 = cf1.thenAcceptAsync((x) -> { if (x.equals("a test string")) { atomicInt.incrementAndGet(); return; } throw new RuntimeException(); });
+ cf2 = cf1.thenAcceptAsync(x -> { if (x.equals("a test string")) { atomicInt.incrementAndGet(); return; } throw new RuntimeException(); });
checkCompletedNormally(cf1, "a test string");
checkCompletedNormally(cf2, null);
check(atomicInt.get() == (before + 1));
before = atomicInt.get();
cf1 = supplyAsync(() -> "a test string");
- cf2 = cf1.thenAcceptAsync((x) -> { if (x.equals("a test string")) { atomicInt.incrementAndGet(); return; } throw new RuntimeException(); }, executor);
+ cf2 = cf1.thenAcceptAsync(x -> { if (x.equals("a test string")) { atomicInt.incrementAndGet(); return; } throw new RuntimeException(); }, executor);
checkCompletedNormally(cf1, "a test string");
checkCompletedNormally(cf2, null);
check(atomicInt.get() == (before + 1));
before = atomicInt.get();
cf1 = supplyAsync(() -> { throw new RuntimeException(); });
- cf2 = cf1.thenAccept((x) -> { atomicInt.incrementAndGet(); } );
+ cf2 = cf1.thenAccept(x -> atomicInt.incrementAndGet());
checkCompletedExceptionally(cf1);
checkCompletedExceptionally(cf2);
check(atomicInt.get() == before);
cf1 = supplyAsync(() -> { throw new RuntimeException(); });
- cf2 = cf1.thenAcceptAsync((x) -> { atomicInt.incrementAndGet(); } );
+ cf2 = cf1.thenAcceptAsync(x -> atomicInt.incrementAndGet());
checkCompletedExceptionally(cf1);
checkCompletedExceptionally(cf2);
check(atomicInt.get() == before);
cf1 = supplyAsync(() -> { throw new RuntimeException(); });
- cf2 = cf1.thenAcceptAsync((x) -> { atomicInt.incrementAndGet(); }, executor );
+ cf2 = cf1.thenAcceptAsync(x -> atomicInt.incrementAndGet(), executor );
checkCompletedExceptionally(cf1);
checkCompletedExceptionally(cf2);
check(atomicInt.get() == before);
@@ -283,40 +283,40 @@
CompletableFuture<Void> cf2;
int before = atomicInt.get();
CompletableFuture<String> cf1 = supplyAsync(() -> "a test string");
- cf2 = cf1.thenRun(() -> { atomicInt.incrementAndGet(); });
+ cf2 = cf1.thenRun(() -> atomicInt.incrementAndGet());
checkCompletedNormally(cf1, "a test string");
checkCompletedNormally(cf2, null);
check(atomicInt.get() == (before + 1));
before = atomicInt.get();
cf1 = supplyAsync(() -> "a test string");
- cf2 = cf1.thenRunAsync(() -> { atomicInt.incrementAndGet(); });
+ cf2 = cf1.thenRunAsync(() -> atomicInt.incrementAndGet());
checkCompletedNormally(cf1, "a test string");
checkCompletedNormally(cf2, null);
check(atomicInt.get() == (before + 1));
before = atomicInt.get();
cf1 = supplyAsync(() -> "a test string");
- cf2 = cf1.thenRunAsync(() -> { atomicInt.incrementAndGet(); }, executor);
+ cf2 = cf1.thenRunAsync(() -> atomicInt.incrementAndGet(), executor);
checkCompletedNormally(cf1, "a test string");
checkCompletedNormally(cf2, null);
check(atomicInt.get() == (before + 1));
before = atomicInt.get();
cf1 = supplyAsync(() -> { throw new RuntimeException(); });
- cf2 = cf1.thenRun(() -> { atomicInt.incrementAndGet(); });
+ cf2 = cf1.thenRun(() -> atomicInt.incrementAndGet());
checkCompletedExceptionally(cf1);
checkCompletedExceptionally(cf2);
check(atomicInt.get() == before);
cf1 = supplyAsync(() -> { throw new RuntimeException(); });
- cf2 = cf1.thenRunAsync(() -> { atomicInt.incrementAndGet(); });
+ cf2 = cf1.thenRunAsync(() -> atomicInt.incrementAndGet());
checkCompletedExceptionally(cf1);
checkCompletedExceptionally(cf2);
check(atomicInt.get() == before);
cf1 = supplyAsync(() -> { throw new RuntimeException(); });
- cf2 = cf1.thenRunAsync(() -> { atomicInt.incrementAndGet(); }, executor);
+ cf2 = cf1.thenRunAsync(() -> atomicInt.incrementAndGet(), executor);
checkCompletedExceptionally(cf1);
checkCompletedExceptionally(cf2);
check(atomicInt.get() == before);
@@ -329,42 +329,42 @@
CompletableFuture<Integer> cf3;
CompletableFuture<Integer> cf1 = supplyAsync(() -> 1);
CompletableFuture<Integer> cf2 = supplyAsync(() -> 1);
- cf3 = cf1.thenCombine(cf2, (x, y) -> { return x + y; });
+ cf3 = cf1.thenCombine(cf2, (x, y) -> x + y);
checkCompletedNormally(cf1, 1);
checkCompletedNormally(cf2, 1);
checkCompletedNormally(cf3, 2);
cf1 = supplyAsync(() -> 1);
cf2 = supplyAsync(() -> 1);
- cf3 = cf1.thenCombineAsync(cf2, (x, y) -> { return x + y; });
+ cf3 = cf1.thenCombineAsync(cf2, (x, y) -> x + y);
checkCompletedNormally(cf1, 1);
checkCompletedNormally(cf2, 1);
checkCompletedNormally(cf3, 2);
cf1 = supplyAsync(() -> 1);
cf2 = supplyAsync(() -> 1);
- cf3 = cf1.thenCombineAsync(cf2, (x, y) -> { return x + y; }, executor);
+ cf3 = cf1.thenCombineAsync(cf2, (x, y) -> x + y, executor);
checkCompletedNormally(cf1, 1);
checkCompletedNormally(cf2, 1);
checkCompletedNormally(cf3, 2);
cf1 = supplyAsync(() -> { throw new RuntimeException(); });
cf2 = supplyAsync(() -> 1);
- cf3 = cf1.thenCombine(cf2, (x, y) -> { return 0; });
+ cf3 = cf1.thenCombine(cf2, (x, y) -> 0);
checkCompletedExceptionally(cf1);
checkCompletedNormally(cf2, 1);
checkCompletedExceptionally(cf3);
cf1 = supplyAsync(() -> 1);
cf2 = supplyAsync(() -> { throw new RuntimeException(); });
- cf3 = cf1.thenCombineAsync(cf2, (x, y) -> { return 0; });
+ cf3 = cf1.thenCombineAsync(cf2, (x, y) -> 0);
checkCompletedNormally(cf1, 1);
checkCompletedExceptionally(cf2);
checkCompletedExceptionally(cf3);
cf1 = supplyAsync(() -> { throw new RuntimeException(); });
cf2 = supplyAsync(() -> { throw new RuntimeException(); });
- cf3 = cf1.thenCombineAsync(cf2, (x, y) -> { return 0; }, executor);
+ cf3 = cf1.thenCombineAsync(cf2, (x, y) -> 0, executor);
checkCompletedExceptionally(cf1);
checkCompletedExceptionally(cf2);
checkCompletedExceptionally(cf3);
@@ -405,7 +405,7 @@
before = atomicInt.get();
cf1 = supplyAsync(() -> { throw new RuntimeException(); });
cf2 = supplyAsync(() -> 1);
- cf3 = cf1.thenAcceptBoth(cf2, (x, y) -> { atomicInt.incrementAndGet(); });
+ cf3 = cf1.thenAcceptBoth(cf2, (x, y) -> atomicInt.incrementAndGet());
checkCompletedExceptionally(cf1);
checkCompletedNormally(cf2, 1);
checkCompletedExceptionally(cf3);
@@ -413,7 +413,7 @@
cf1 = supplyAsync(() -> 1);
cf2 = supplyAsync(() -> { throw new RuntimeException(); });
- cf3 = cf1.thenAcceptBothAsync(cf2, (x, y) -> { atomicInt.incrementAndGet(); });
+ cf3 = cf1.thenAcceptBothAsync(cf2, (x, y) -> atomicInt.incrementAndGet());
checkCompletedNormally(cf1, 1);
checkCompletedExceptionally(cf2);
checkCompletedExceptionally(cf3);
@@ -421,7 +421,7 @@
cf1 = supplyAsync(() -> { throw new RuntimeException(); });
cf2 = supplyAsync(() -> { throw new RuntimeException(); });
- cf3 = cf1.thenAcceptBothAsync(cf2, (x, y) -> { atomicInt.incrementAndGet(); }, executor);
+ cf3 = cf1.thenAcceptBothAsync(cf2, (x, y) -> atomicInt.incrementAndGet(), executor);
checkCompletedExceptionally(cf1);
checkCompletedExceptionally(cf2);
checkCompletedExceptionally(cf3);
@@ -463,7 +463,7 @@
before = atomicInt.get();
CompletableFuture<Integer> cf4 = supplyAsync(() -> { throw new RuntimeException(); });
CompletableFuture<Integer> cf5 = supplyAsync(() -> 1);
- cf3 = cf5.runAfterBothAsync(cf4, () -> { atomicInt.incrementAndGet(); }, executor);
+ cf3 = cf5.runAfterBothAsync(cf4, () -> atomicInt.incrementAndGet(), executor);
checkCompletedExceptionally(cf4);
checkCompletedNormally(cf5, 1);
checkCompletedExceptionally(cf3);
@@ -472,7 +472,7 @@
before = atomicInt.get();
cf4 = supplyAsync(() -> 1);
cf5 = supplyAsync(() -> { throw new RuntimeException(); });
- cf3 = cf5.runAfterBothAsync(cf4, () -> { atomicInt.incrementAndGet(); });
+ cf3 = cf5.runAfterBothAsync(cf4, () -> atomicInt.incrementAndGet());
checkCompletedNormally(cf4, 1);
checkCompletedExceptionally(cf5);
checkCompletedExceptionally(cf3);
@@ -481,7 +481,7 @@
before = atomicInt.get();
cf4 = supplyAsync(() -> { throw new RuntimeException(); });
cf5 = supplyAsync(() -> { throw new RuntimeException(); });
- cf3 = cf5.runAfterBoth(cf4, () -> { atomicInt.incrementAndGet(); });
+ cf3 = cf5.runAfterBoth(cf4, () -> atomicInt.incrementAndGet());
checkCompletedExceptionally(cf4);
checkCompletedExceptionally(cf5);
checkCompletedExceptionally(cf3);
@@ -495,46 +495,46 @@
CompletableFuture<Integer> cf3;
CompletableFuture<Integer> cf1 = supplyAsync(() -> 1);
CompletableFuture<Integer> cf2 = supplyAsync(() -> 2);
- cf3 = cf1.applyToEither(cf2, (x) -> { check(x == 1 || x == 2); return x; });
+ cf3 = cf1.applyToEither(cf2, x -> { check(x == 1 || x == 2); return x; });
checkCompletedNormally(cf3, new Object[] {1, 2});
check(cf1.isDone() || cf2.isDone());
cf1 = supplyAsync(() -> 1);
cf2 = supplyAsync(() -> 2);
- cf3 = cf1.applyToEitherAsync(cf2, (x) -> { check(x == 1 || x == 2); return x; });
+ cf3 = cf1.applyToEitherAsync(cf2, x -> { check(x == 1 || x == 2); return x; });
checkCompletedNormally(cf3, new Object[] {1, 2});
check(cf1.isDone() || cf2.isDone());
cf1 = supplyAsync(() -> 1);
cf2 = supplyAsync(() -> 2);
- cf3 = cf1.applyToEitherAsync(cf2, (x) -> { check(x == 1 || x == 2); return x; }, executor);
+ cf3 = cf1.applyToEitherAsync(cf2, x -> { check(x == 1 || x == 2); return x; }, executor);
checkCompletedNormally(cf3, new Object[] {1, 2});
check(cf1.isDone() || cf2.isDone());
cf1 = supplyAsync(() -> { throw new RuntimeException(); });
cf2 = supplyAsync(() -> 2);
- cf3 = cf1.applyToEither(cf2, (x) -> { check(x == 2); return x; });
+ cf3 = cf1.applyToEither(cf2, x -> { check(x == 2); return x; });
try { check(cf3.join() == 2); } catch (CompletionException x) { pass(); }
check(cf3.isDone());
check(cf1.isDone() || cf2.isDone());
cf1 = supplyAsync(() -> 1);
cf2 = supplyAsync(() -> { throw new RuntimeException(); });
- cf3 = cf1.applyToEitherAsync(cf2, (x) -> { check(x == 1); return x; });
+ cf3 = cf1.applyToEitherAsync(cf2, x -> { check(x == 1); return x; });
try { check(cf3.join() == 1); } catch (CompletionException x) { pass(); }
check(cf3.isDone());
check(cf1.isDone() || cf2.isDone());
cf1 = supplyAsync(() -> { throw new RuntimeException(); });
cf2 = supplyAsync(() -> { throw new RuntimeException(); });
- cf3 = cf1.applyToEitherAsync(cf2, (x) -> { fail(); return x; });
+ cf3 = cf1.applyToEitherAsync(cf2, x -> { fail(); return x; });
checkCompletedExceptionally(cf3);
check(cf1.isDone() || cf2.isDone());
final Phaser cf3Done = new Phaser(2);
cf1 = supplyAsync(() -> { cf3Done.arriveAndAwaitAdvance(); return 1; });
cf2 = supplyAsync(() -> 2);
- cf3 = cf1.applyToEither(cf2, (x) -> { check(x == 2); return x; });
+ cf3 = cf1.applyToEither(cf2, x -> { check(x == 2); return x; });
checkCompletedNormally(cf3, 2);
checkCompletedNormally(cf2, 2);
check(!cf1.isDone());
@@ -544,7 +544,7 @@
cf1 = supplyAsync(() -> 1);
cf2 = supplyAsync(() -> { cf3Done.arriveAndAwaitAdvance(); return 2; });
- cf3 = cf1.applyToEitherAsync(cf2, (x) -> { check(x == 1); return x; });
+ cf3 = cf1.applyToEitherAsync(cf2, x -> { check(x == 1); return x; });
checkCompletedNormally(cf3, 1);
checkCompletedNormally(cf1, 1);
check(!cf2.isDone());
@@ -561,7 +561,7 @@
int before = atomicInt.get();
CompletableFuture<Integer> cf1 = supplyAsync(() -> 1);
CompletableFuture<Integer> cf2 = supplyAsync(() -> 2);
- cf3 = cf1.acceptEither(cf2, (x) -> { check(x == 1 || x == 2); atomicInt.incrementAndGet(); });
+ cf3 = cf1.acceptEither(cf2, x -> { check(x == 1 || x == 2); atomicInt.incrementAndGet(); });
checkCompletedNormally(cf3, null);
check(cf1.isDone() || cf2.isDone());
check(atomicInt.get() == (before + 1));
@@ -569,7 +569,7 @@
before = atomicInt.get();
cf1 = supplyAsync(() -> 1);
cf2 = supplyAsync(() -> 2);
- cf3 = cf1.acceptEitherAsync(cf2, (x) -> { check(x == 1 || x == 2); atomicInt.incrementAndGet(); });
+ cf3 = cf1.acceptEitherAsync(cf2, x -> { check(x == 1 || x == 2); atomicInt.incrementAndGet(); });
checkCompletedNormally(cf3, null);
check(cf1.isDone() || cf2.isDone());
check(atomicInt.get() == (before + 1));
@@ -577,35 +577,35 @@
before = atomicInt.get();
cf1 = supplyAsync(() -> 1);
cf2 = supplyAsync(() -> 2);
- cf3 = cf2.acceptEitherAsync(cf1, (x) -> { check(x == 1 || x == 2); atomicInt.incrementAndGet(); }, executor);
+ cf3 = cf2.acceptEitherAsync(cf1, x -> { check(x == 1 || x == 2); atomicInt.incrementAndGet(); }, executor);
checkCompletedNormally(cf3, null);
check(cf1.isDone() || cf2.isDone());
check(atomicInt.get() == (before + 1));
cf1 = supplyAsync(() -> { throw new RuntimeException(); });
cf2 = supplyAsync(() -> 2);
- cf3 = cf2.acceptEitherAsync(cf1, (x) -> { check(x == 2); }, executor);
+ cf3 = cf2.acceptEitherAsync(cf1, x -> { check(x == 2); }, executor);
try { check(cf3.join() == null); } catch (CompletionException x) { pass(); }
check(cf3.isDone());
check(cf1.isDone() || cf2.isDone());
cf1 = supplyAsync(() -> 1);
cf2 = supplyAsync(() -> { throw new RuntimeException(); });
- cf3 = cf2.acceptEitherAsync(cf1, (x) -> { check(x == 1); });
+ cf3 = cf2.acceptEitherAsync(cf1, x -> { check(x == 1); });
try { check(cf3.join() == null); } catch (CompletionException x) { pass(); }
check(cf3.isDone());
check(cf1.isDone() || cf2.isDone());
cf1 = supplyAsync(() -> { throw new RuntimeException(); });
cf2 = supplyAsync(() -> { throw new RuntimeException(); });
- cf3 = cf2.acceptEitherAsync(cf1, (x) -> { fail(); });
+ cf3 = cf2.acceptEitherAsync(cf1, x -> { fail(); });
checkCompletedExceptionally(cf3);
check(cf1.isDone() || cf2.isDone());
final Phaser cf3Done = new Phaser(2);
cf1 = supplyAsync(() -> { cf3Done.arriveAndAwaitAdvance(); return 1; });
cf2 = supplyAsync(() -> 2);
- cf3 = cf1.acceptEither(cf2, (x) -> { check(x == 2); });
+ cf3 = cf1.acceptEither(cf2, x -> { check(x == 2); });
checkCompletedNormally(cf3, null);
checkCompletedNormally(cf2, 2);
check(!cf1.isDone());
@@ -615,7 +615,7 @@
cf1 = supplyAsync(() -> 1);
cf2 = supplyAsync(() -> { cf3Done.arriveAndAwaitAdvance(); return 2; });
- cf3 = cf1.acceptEitherAsync(cf2, (x) -> { check(x == 1); });
+ cf3 = cf1.acceptEitherAsync(cf2, x -> { check(x == 1); });
checkCompletedNormally(cf3, null);
checkCompletedNormally(cf1, 1);
check(!cf2.isDone());
@@ -630,33 +630,33 @@
try {
CompletableFuture<Void> cf3;
int before = atomicInt.get();
- CompletableFuture<Void> cf1 = runAsync(() -> { });
- CompletableFuture<Void> cf2 = runAsync(() -> { });
- cf3 = cf1.runAfterEither(cf2, () -> { atomicInt.incrementAndGet(); });
+ CompletableFuture<Void> cf1 = runAsync(() -> {});
+ CompletableFuture<Void> cf2 = runAsync(() -> {});
+ cf3 = cf1.runAfterEither(cf2, () -> atomicInt.incrementAndGet());
checkCompletedNormally(cf3, null);
check(cf1.isDone() || cf2.isDone());
check(atomicInt.get() == (before + 1));
before = atomicInt.get();
- cf1 = runAsync(() -> { });
- cf2 = runAsync(() -> { });
- cf3 = cf1.runAfterEitherAsync(cf2, () -> { atomicInt.incrementAndGet(); });
+ cf1 = runAsync(() -> {});
+ cf2 = runAsync(() -> {});
+ cf3 = cf1.runAfterEitherAsync(cf2, () -> atomicInt.incrementAndGet());
checkCompletedNormally(cf3, null);
check(cf1.isDone() || cf2.isDone());
check(atomicInt.get() == (before + 1));
before = atomicInt.get();
- cf1 = runAsync(() -> { });
- cf2 = runAsync(() -> { });
- cf3 = cf2.runAfterEitherAsync(cf1, () -> { atomicInt.incrementAndGet(); }, executor);
+ cf1 = runAsync(() -> {});
+ cf2 = runAsync(() -> {});
+ cf3 = cf2.runAfterEitherAsync(cf1, () -> atomicInt.incrementAndGet(), executor);
checkCompletedNormally(cf3, null);
check(cf1.isDone() || cf2.isDone());
check(atomicInt.get() == (before + 1));
before = atomicInt.get();
cf1 = runAsync(() -> { throw new RuntimeException(); });
- cf2 = runAsync(() -> { });
- cf3 = cf2.runAfterEither(cf1, () -> { atomicInt.incrementAndGet(); });
+ cf2 = runAsync(() -> {});
+ cf3 = cf2.runAfterEither(cf1, () -> atomicInt.incrementAndGet());
try {
check(cf3.join() == null);
check(atomicInt.get() == (before + 1));
@@ -665,9 +665,9 @@
check(cf1.isDone() || cf2.isDone());
before = atomicInt.get();
- cf1 = runAsync(() -> { });
+ cf1 = runAsync(() -> {});
cf2 = runAsync(() -> { throw new RuntimeException(); });
- cf3 = cf1.runAfterEitherAsync(cf2, () -> { atomicInt.incrementAndGet(); });
+ cf3 = cf1.runAfterEitherAsync(cf2, () -> atomicInt.incrementAndGet());
try {
check(cf3.join() == null);
check(atomicInt.get() == (before + 1));
@@ -678,16 +678,16 @@
before = atomicInt.get();
cf1 = runAsync(() -> { throw new RuntimeException(); });
cf2 = runAsync(() -> { throw new RuntimeException(); });
- cf3 = cf2.runAfterEitherAsync(cf1, () -> { atomicInt.incrementAndGet(); }, executor);
+ cf3 = cf2.runAfterEitherAsync(cf1, () -> atomicInt.incrementAndGet(), executor);
checkCompletedExceptionally(cf3);
check(cf1.isDone() || cf2.isDone());
check(atomicInt.get() == before);
final Phaser cf3Done = new Phaser(2);
before = atomicInt.get();
- cf1 = runAsync(() -> { cf3Done.arriveAndAwaitAdvance(); });
- cf2 = runAsync(() -> { });
- cf3 = cf1.runAfterEither(cf2, () -> { atomicInt.incrementAndGet(); });
+ cf1 = runAsync(() -> cf3Done.arriveAndAwaitAdvance());
+ cf2 = runAsync(() -> {});
+ cf3 = cf1.runAfterEither(cf2, () -> atomicInt.incrementAndGet());
checkCompletedNormally(cf3, null);
checkCompletedNormally(cf2, null);
check(!cf1.isDone());
@@ -697,9 +697,9 @@
checkCompletedNormally(cf3, null);
before = atomicInt.get();
- cf1 = runAsync(() -> { });
- cf2 = runAsync(() -> { cf3Done.arriveAndAwaitAdvance(); });
- cf3 = cf1.runAfterEitherAsync(cf2, () -> { atomicInt.incrementAndGet(); });
+ cf1 = runAsync(() -> {});
+ cf2 = runAsync(() -> cf3Done.arriveAndAwaitAdvance());
+ cf3 = cf1.runAfterEitherAsync(cf2, () -> atomicInt.incrementAndGet());
checkCompletedNormally(cf3, null);
checkCompletedNormally(cf1, null);
check(!cf2.isDone());
@@ -715,35 +715,35 @@
try {
CompletableFuture<Integer> cf2;
CompletableFuture<Integer> cf1 = supplyAsync(() -> 1);
- cf2 = cf1.thenCompose((x) -> { check(x ==1); return CompletableFuture.completedFuture(2); });
+ cf2 = cf1.thenCompose(x -> { check(x == 1); return CompletableFuture.completedFuture(2); });
checkCompletedNormally(cf1, 1);
checkCompletedNormally(cf2, 2);
cf1 = supplyAsync(() -> 1);
- cf2 = cf1.thenComposeAsync((x) -> { check(x ==1); return CompletableFuture.completedFuture(2); });
+ cf2 = cf1.thenComposeAsync(x -> { check(x == 1); return CompletableFuture.completedFuture(2); });
checkCompletedNormally(cf1, 1);
checkCompletedNormally(cf2, 2);
cf1 = supplyAsync(() -> 1);
- cf2 = cf1.thenComposeAsync((x) -> { check(x ==1); return CompletableFuture.completedFuture(2); }, executor);
+ cf2 = cf1.thenComposeAsync(x -> { check(x == 1); return CompletableFuture.completedFuture(2); }, executor);
checkCompletedNormally(cf1, 1);
checkCompletedNormally(cf2, 2);
int before = atomicInt.get();
cf1 = supplyAsync(() -> { throw new RuntimeException(); });
- cf2 = cf1.thenCompose((x) -> { atomicInt.incrementAndGet(); return CompletableFuture.completedFuture(2); });
+ cf2 = cf1.thenCompose(x -> { atomicInt.incrementAndGet(); return CompletableFuture.completedFuture(2); });
checkCompletedExceptionally(cf1);
checkCompletedExceptionally(cf2);
check(atomicInt.get() == before);
cf1 = supplyAsync(() -> { throw new RuntimeException(); });
- cf2 = cf1.thenComposeAsync((x) -> { atomicInt.incrementAndGet(); return CompletableFuture.completedFuture(2); });
+ cf2 = cf1.thenComposeAsync(x -> { atomicInt.incrementAndGet(); return CompletableFuture.completedFuture(2); });
checkCompletedExceptionally(cf1);
checkCompletedExceptionally(cf2);
check(atomicInt.get() == before);
cf1 = supplyAsync(() -> 1);
- cf2 = cf1.thenComposeAsync((x) -> { throw new RuntimeException(); }, executor);
+ cf2 = cf1.thenComposeAsync(x -> { throw new RuntimeException(); }, executor);
checkCompletedNormally(cf1, 1);
checkCompletedExceptionally(cf2);
} catch (Throwable t) { unexpected(t); }
@@ -787,13 +787,13 @@
try {
CompletableFuture<Integer> cf2;
CompletableFuture<Integer> cf1 = supplyAsync(() -> 1);
- cf2 = cf1.exceptionally((t) -> { fail("function should never be called"); return 2;});
+ cf2 = cf1.exceptionally(t -> { fail("function should never be called"); return 2;});
checkCompletedNormally(cf1, 1);
checkCompletedNormally(cf2, 1);
final RuntimeException t = new RuntimeException();
cf1 = supplyAsync(() -> { throw t; });
- cf2 = cf1.exceptionally((x) -> { check(x.getCause() == t); return 2;});
+ cf2 = cf1.exceptionally(x -> { check(x.getCause() == t); return 2;});
checkCompletedExceptionally(cf1);
checkCompletedNormally(cf2, 2);
} catch (Throwable t) { unexpected(t); }
--- a/test/jdk/java/util/concurrent/ConcurrentHashMap/LoopHelpers.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/ConcurrentHashMap/LoopHelpers.java Thu Jan 18 18:58:46 2018 +0000
@@ -95,7 +95,7 @@
String num = Long.toString(n);
if (num.length() >= field.length())
return num;
- StringBuffer b = new StringBuffer(field);
+ StringBuilder b = new StringBuilder(field);
b.replace(b.length()-num.length(), b.length(), num);
return b.toString();
}
--- a/test/jdk/java/util/concurrent/ConcurrentHashMap/MapCheck.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/ConcurrentHashMap/MapCheck.java Thu Jan 18 18:58:46 2018 +0000
@@ -109,14 +109,12 @@
static Map newMap(Class cl) {
try {
- Map m = (Map)cl.newInstance();
- return m;
+ return (Map)cl.newInstance();
} catch (Exception e) {
throw new RuntimeException("Can't instantiate " + cl + ": " + e);
}
}
-
static void runTest(Map s, Object[] key) {
shuffle(key);
int size = key.length;
@@ -137,7 +135,6 @@
// System.gc();
}
-
static void t1(String nm, int n, Map s, Object[] key, int expect) {
int sum = 0;
int iters = 4;
--- a/test/jdk/java/util/concurrent/ConcurrentLinkedQueue/WhiteBox.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/ConcurrentLinkedQueue/WhiteBox.java Thu Jan 18 18:58:46 2018 +0000
@@ -55,7 +55,6 @@
import java.util.concurrent.ThreadLocalRandom;
import static java.util.stream.Collectors.toList;
import java.util.function.Consumer;
-import java.util.function.Function;
@Test
public class WhiteBox {
--- a/test/jdk/java/util/concurrent/ConcurrentQueues/LoopHelpers.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/ConcurrentQueues/LoopHelpers.java Thu Jan 18 18:58:46 2018 +0000
@@ -95,7 +95,7 @@
String num = Long.toString(n);
if (num.length() >= field.length())
return num;
- StringBuffer b = new StringBuffer(field);
+ StringBuilder b = new StringBuilder(field);
b.replace(b.length()-num.length(), b.length(), num);
return b.toString();
}
--- a/test/jdk/java/util/concurrent/ConcurrentQueues/OfferRemoveLoops.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/ConcurrentQueues/OfferRemoveLoops.java Thu Jan 18 18:58:46 2018 +0000
@@ -81,7 +81,7 @@
final CountDownLatch done = new CountDownLatch(3);
final SplittableRandom rnd = new SplittableRandom();
- /** Poor man's bounded buffer; prevents unbounded queue expansion. */
+ // Poor man's bounded buffer; prevents unbounded queue expansion.
final Semaphore offers = new Semaphore(maxQueueSize);
abstract class CheckedThread extends Thread {
--- a/test/jdk/java/util/concurrent/Exchanger/LoopHelpers.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/Exchanger/LoopHelpers.java Thu Jan 18 18:58:46 2018 +0000
@@ -95,7 +95,7 @@
String num = Long.toString(n);
if (num.length() >= field.length())
return num;
- StringBuffer b = new StringBuffer(field);
+ StringBuilder b = new StringBuilder(field);
b.replace(b.length()-num.length(), b.length(), num);
return b.toString();
}
--- a/test/jdk/java/util/concurrent/ExecutorCompletionService/ExecutorCompletionServiceLoops.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/ExecutorCompletionService/ExecutorCompletionServiceLoops.java Thu Jan 18 18:58:46 2018 +0000
@@ -52,7 +52,7 @@
static final ExecutorService pool =
Executors.newFixedThreadPool(POOLSIZE);
static final ExecutorCompletionService<Integer> ecs =
- new ExecutorCompletionService<Integer>(pool);
+ new ExecutorCompletionService<>(pool);
static boolean print = false;
public static void main(String[] args) throws Exception {
--- a/test/jdk/java/util/concurrent/ExecutorCompletionService/LoopHelpers.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/ExecutorCompletionService/LoopHelpers.java Thu Jan 18 18:58:46 2018 +0000
@@ -95,7 +95,7 @@
String num = Long.toString(n);
if (num.length() >= field.length())
return num;
- StringBuffer b = new StringBuffer(field);
+ StringBuilder b = new StringBuilder(field);
b.replace(b.length()-num.length(), b.length(), num);
return b.toString();
}
--- a/test/jdk/java/util/concurrent/FutureTask/BlockingTaskExecutor.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/FutureTask/BlockingTaskExecutor.java Thu Jan 18 18:58:46 2018 +0000
@@ -26,21 +26,25 @@
* @bug 6431315
* @summary ExecutorService.invokeAll might hang
* @author Martin Buchholz
+ * @library /lib/testlibrary/
*/
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.RejectedExecutionException;
-import java.util.concurrent.TimeUnit;
+import jdk.testlibrary.Utils;
/**
* Adapted from Doug Lea, which was...
* adapted from a posting by Tom Sugden tom at epcc.ed.ac.uk
*/
public class BlockingTaskExecutor {
+ static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
static void realMain(String[] args) throws Throwable {
for (int i = 1; i <= 100; i++) {
@@ -75,15 +79,19 @@
// are blocked. This should cause the tasks to be
// interrupted.
executor.shutdownNow();
- if (! executor.awaitTermination(5L, TimeUnit.SECONDS))
- throw new Error("Executor stuck");
+ if (! executor.awaitTermination(LONG_DELAY_MS, MILLISECONDS))
+ throw new Error(
+ String.format("Executor termination timed out after %d ms",
+ LONG_DELAY_MS));
// Wait for the invocation thread to complete.
- thread.join(5000);
+ thread.join(LONG_DELAY_MS);
if (thread.isAlive()) {
thread.interrupt();
- thread.join(5000);
- throw new Error("invokeAll stuck");
+ thread.join(LONG_DELAY_MS);
+ throw new Error(
+ String.format("invokeAll timed out after %d ms",
+ LONG_DELAY_MS));
}
}
--- a/test/jdk/java/util/concurrent/FutureTask/ExplicitSet.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/FutureTask/ExplicitSet.java Thu Jan 18 18:58:46 2018 +0000
@@ -60,7 +60,7 @@
public Boolean call() {
fail("The task should never be run!");
return null;
- };
+ }
});
}
--- a/test/jdk/java/util/concurrent/FutureTask/LoopHelpers.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/FutureTask/LoopHelpers.java Thu Jan 18 18:58:46 2018 +0000
@@ -95,7 +95,7 @@
String num = Long.toString(n);
if (num.length() >= field.length())
return num;
- StringBuffer b = new StringBuffer(field);
+ StringBuilder b = new StringBuilder(field);
b.replace(b.length()-num.length(), b.length(), num);
return b.toString();
}
--- a/test/jdk/java/util/concurrent/FutureTask/NegativeTimeout.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/FutureTask/NegativeTimeout.java Thu Jan 18 18:58:46 2018 +0000
@@ -38,7 +38,7 @@
public class NegativeTimeout {
public static void main(String[] args) throws Exception {
- FutureTask<Void> task = new FutureTask<>( () -> { return null; } );
+ FutureTask<Void> task = new FutureTask<>(() -> null);
try {
task.get(Long.MIN_VALUE, TimeUnit.NANOSECONDS);
} catch (TimeoutException success) {}
--- a/test/jdk/java/util/concurrent/LinkedTransferQueue/WhiteBox.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/LinkedTransferQueue/WhiteBox.java Thu Jan 18 18:58:46 2018 +0000
@@ -56,7 +56,6 @@
import java.util.concurrent.TimeUnit;
import static java.util.stream.Collectors.toList;
import java.util.function.Consumer;
-import java.util.function.Function;
@Test
public class WhiteBox {
--- a/test/jdk/java/util/concurrent/atomic/AtomicUpdaters.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/atomic/AtomicUpdaters.java Thu Jan 18 18:58:46 2018 +0000
@@ -89,9 +89,9 @@
// Would like to test a public volatile in a class in another
// package - but of course there aren't any
- new Config(AtomicInteger.class, "value", "private", hasSM ? false : true, false, "private int field of class in different package", TYPE.INT),
- new Config(AtomicLong.class, "value", "private", hasSM ? false : true, false, "private long field of class in different package", TYPE.LONG),
- new Config(AtomicReference.class, "value", "private", hasSM ? false : true, false, "private reference field of class in different package", TYPE.REF),
+ new Config(AtomicInteger.class, "value", "private", !hasSM, false, "private int field of class in different package", TYPE.INT),
+ new Config(AtomicLong.class, "value", "private", !hasSM, false, "private long field of class in different package", TYPE.LONG),
+ new Config(AtomicReference.class, "value", "private", !hasSM, false, "private reference field of class in different package", TYPE.REF),
};
}
--- a/test/jdk/java/util/concurrent/locks/Lock/LoopHelpers.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/locks/Lock/LoopHelpers.java Thu Jan 18 18:58:46 2018 +0000
@@ -95,7 +95,7 @@
String num = Long.toString(n);
if (num.length() >= field.length())
return num;
- StringBuffer b = new StringBuffer(field);
+ StringBuilder b = new StringBuilder(field);
b.replace(b.length()-num.length(), b.length(), num);
return b.toString();
}
--- a/test/jdk/java/util/concurrent/locks/ReentrantLock/LoopHelpers.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/locks/ReentrantLock/LoopHelpers.java Thu Jan 18 18:58:46 2018 +0000
@@ -95,7 +95,7 @@
String num = Long.toString(n);
if (num.length() >= field.length())
return num;
- StringBuffer b = new StringBuffer(field);
+ StringBuilder b = new StringBuilder(field);
b.replace(b.length()-num.length(), b.length(), num);
return b.toString();
}
--- a/test/jdk/java/util/concurrent/locks/ReentrantReadWriteLock/LoopHelpers.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/locks/ReentrantReadWriteLock/LoopHelpers.java Thu Jan 18 18:58:46 2018 +0000
@@ -95,7 +95,7 @@
String num = Long.toString(n);
if (num.length() >= field.length())
return num;
- StringBuffer b = new StringBuffer(field);
+ StringBuilder b = new StringBuilder(field);
b.replace(b.length()-num.length(), b.length(), num);
return b.toString();
}
--- a/test/jdk/java/util/concurrent/tck/AbstractQueueTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/tck/AbstractQueueTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -80,7 +80,7 @@
}
/**
- * add throws IllegalStateException true if offer fails
+ * add throws IllegalStateException if offer fails
*/
public void testAddF() {
Fail q = new Fail();
@@ -106,7 +106,7 @@
*/
public void testRemoveS() {
Succeed q = new Succeed();
- q.remove();
+ assertSame(one, q.remove());
}
/**
@@ -125,7 +125,7 @@
*/
public void testElementS() {
Succeed q = new Succeed();
- q.element();
+ assertSame(one, q.element());
}
/**
--- a/test/jdk/java/util/concurrent/tck/AbstractQueuedSynchronizerTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/tck/AbstractQueuedSynchronizerTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -1289,11 +1289,10 @@
}
/**
- * Disabled demo test for (unfixed as of 2017-11)
* JDK-8191483: AbstractQueuedSynchronizer cancel/cancel race
* ant -Djsr166.tckTestClass=AbstractQueuedSynchronizerTest -Djsr166.methodFilter=testCancelCancelRace -Djsr166.runsPerTest=100 tck
*/
- public void DISABLED_testCancelCancelRace() throws InterruptedException {
+ public void testCancelCancelRace() throws InterruptedException {
class Sync extends AbstractQueuedSynchronizer {
protected boolean tryAcquire(int acquires) {
return !hasQueuedPredecessors() && compareAndSetState(0, 1);
--- a/test/jdk/java/util/concurrent/tck/ArrayDeque8Test.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/tck/ArrayDeque8Test.java Thu Jan 18 18:58:46 2018 +0000
@@ -110,14 +110,13 @@
assertEquals((Integer) 1, q.peekLast());
assertEquals(maxArraySize - 1, q.size());
- ArrayDeque qq = q;
ArrayDeque smallish = new ArrayDeque(
Collections.nCopies(Integer.MAX_VALUE - q.size() + 1, e));
assertThrows(
IllegalStateException.class,
- () -> qq.addAll(qq),
- () -> qq.addAll(smallish),
- () -> smallish.addAll(qq));
+ () -> q.addAll(q),
+ () -> q.addAll(smallish),
+ () -> smallish.addAll(q));
}
}
--- a/test/jdk/java/util/concurrent/tck/AtomicReferenceArrayTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/tck/AtomicReferenceArrayTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -84,7 +84,7 @@
*/
public void testConstructorSubClassArray() {
Integer[] a = { two, one, three, four, seven };
- AtomicReferenceArray<Number> aa = new AtomicReferenceArray<Number>(a);
+ AtomicReferenceArray<Number> aa = new AtomicReferenceArray<>(a);
assertEquals(a.length, aa.length());
for (int i = 0; i < a.length; i++) {
assertSame(a[i], aa.get(i));
--- a/test/jdk/java/util/concurrent/tck/BlockingQueueTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/tck/BlockingQueueTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -216,18 +216,20 @@
public void testDrainToNonPositiveMaxElements() {
final BlockingQueue q = emptyCollection();
final int[] ns = { 0, -1, -42, Integer.MIN_VALUE };
- for (int n : ns)
- assertEquals(0, q.drainTo(new ArrayList(), n));
+ final ArrayList sink = new ArrayList();
+ for (int n : ns) {
+ assertEquals(0, q.drainTo(sink, n));
+ assertTrue(sink.isEmpty());
+ }
if (q.remainingCapacity() > 0) {
// Not SynchronousQueue, that is
Object one = makeElement(1);
q.add(one);
- ArrayList c = new ArrayList();
for (int n : ns)
- assertEquals(0, q.drainTo(new ArrayList(), n));
+ assertEquals(0, q.drainTo(sink, n));
assertEquals(1, q.size());
assertSame(one, q.poll());
- assertTrue(c.isEmpty());
+ assertTrue(sink.isEmpty());
}
}
--- a/test/jdk/java/util/concurrent/tck/CompletableFutureTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/tck/CompletableFutureTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -357,7 +357,7 @@
* toString indicates current completion state
*/
public void testToString_incomplete() {
- CompletableFuture<String> f = new CompletableFuture<String>();
+ CompletableFuture<String> f = new CompletableFuture<>();
assertTrue(f.toString().matches(".*\\[.*Not completed.*\\]"));
if (testImplementationDetails)
assertEquals(identityString(f) + "[Not completed]",
@@ -365,7 +365,7 @@
}
public void testToString_normal() {
- CompletableFuture<String> f = new CompletableFuture<String>();
+ CompletableFuture<String> f = new CompletableFuture<>();
assertTrue(f.complete("foo"));
assertTrue(f.toString().matches(".*\\[.*Completed normally.*\\]"));
if (testImplementationDetails)
@@ -374,7 +374,7 @@
}
public void testToString_exception() {
- CompletableFuture<String> f = new CompletableFuture<String>();
+ CompletableFuture<String> f = new CompletableFuture<>();
assertTrue(f.completeExceptionally(new IndexOutOfBoundsException()));
assertTrue(f.toString().matches(".*\\[.*Completed exceptionally.*\\]"));
if (testImplementationDetails)
@@ -384,7 +384,7 @@
public void testToString_cancelled() {
for (boolean mayInterruptIfRunning : new boolean[] { true, false }) {
- CompletableFuture<String> f = new CompletableFuture<String>();
+ CompletableFuture<String> f = new CompletableFuture<>();
assertTrue(f.cancel(mayInterruptIfRunning));
assertTrue(f.toString().matches(".*\\[.*Completed exceptionally.*\\]"));
if (testImplementationDetails)
--- a/test/jdk/java/util/concurrent/tck/ConcurrentHashMap8Test.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/tck/ConcurrentHashMap8Test.java Thu Jan 18 18:58:46 2018 +0000
@@ -212,7 +212,7 @@
*/
public void testReplaceAll() {
ConcurrentHashMap<Integer, String> map = map5();
- map.replaceAll((x, y) -> { return x > 3 ? "Z" : y; });
+ map.replaceAll((x, y) -> (x > 3) ? "Z" : y);
assertEquals("A", map.get(one));
assertEquals("B", map.get(two));
assertEquals("C", map.get(three));
--- a/test/jdk/java/util/concurrent/tck/ConcurrentHashMapTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/tck/ConcurrentHashMapTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -83,17 +83,12 @@
return map;
}
- /** Re-implement Integer.compare for old java versions */
- static int compare(int x, int y) {
- return (x < y) ? -1 : (x > y) ? 1 : 0;
- }
-
// classes for testing Comparable fallbacks
static class BI implements Comparable<BI> {
private final int value;
BI(int value) { this.value = value; }
public int compareTo(BI other) {
- return compare(value, other.value);
+ return Integer.compare(value, other.value);
}
public boolean equals(Object x) {
return (x instanceof BI) && ((BI)x).value == value;
@@ -127,7 +122,7 @@
break;
}
if (r == 0)
- r = compare(size(), other.size());
+ r = Integer.compare(size(), other.size());
return r;
}
private static final long serialVersionUID = 0;
@@ -155,8 +150,7 @@
*/
public void testComparableFamily() {
int size = 500; // makes measured test run time -> 60ms
- ConcurrentHashMap<BI, Boolean> m =
- new ConcurrentHashMap<BI, Boolean>();
+ ConcurrentHashMap<BI, Boolean> m = new ConcurrentHashMap<>();
for (int i = 0; i < size; i++) {
assertNull(m.put(new CI(i), true));
}
@@ -172,13 +166,12 @@
*/
public void testGenericComparable() {
int size = 120; // makes measured test run time -> 60ms
- ConcurrentHashMap<Object, Boolean> m =
- new ConcurrentHashMap<Object, Boolean>();
+ ConcurrentHashMap<Object, Boolean> m = new ConcurrentHashMap<>();
for (int i = 0; i < size; i++) {
BI bi = new BI(i);
BS bs = new BS(String.valueOf(i));
- LexicographicList<BI> bis = new LexicographicList<BI>(bi);
- LexicographicList<BS> bss = new LexicographicList<BS>(bs);
+ LexicographicList<BI> bis = new LexicographicList<>(bi);
+ LexicographicList<BS> bss = new LexicographicList<>(bs);
assertNull(m.putIfAbsent(bis, true));
assertTrue(m.containsKey(bis));
if (m.putIfAbsent(bss, true) == null)
@@ -197,14 +190,13 @@
*/
public void testGenericComparable2() {
int size = 500; // makes measured test run time -> 60ms
- ConcurrentHashMap<Object, Boolean> m =
- new ConcurrentHashMap<Object, Boolean>();
+ ConcurrentHashMap<Object, Boolean> m = new ConcurrentHashMap<>();
for (int i = 0; i < size; i++) {
m.put(Collections.singletonList(new BI(i)), true);
}
for (int i = 0; i < size; i++) {
- LexicographicList<BI> bis = new LexicographicList<BI>(new BI(i));
+ LexicographicList<BI> bis = new LexicographicList<>(new BI(i));
assertTrue(m.containsKey(bis));
}
}
@@ -215,8 +207,7 @@
*/
public void testMixedComparable() {
int size = 1200; // makes measured test run time -> 35ms
- ConcurrentHashMap<Object, Object> map =
- new ConcurrentHashMap<Object, Object>();
+ ConcurrentHashMap<Object, Object> map = new ConcurrentHashMap<>();
Random rng = new Random();
for (int i = 0; i < size; i++) {
Object x;
--- a/test/jdk/java/util/concurrent/tck/ConcurrentSkipListSetTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/tck/ConcurrentSkipListSetTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -65,8 +65,7 @@
* Integers 0 ... n - 1.
*/
private static ConcurrentSkipListSet<Integer> populatedSet(int n) {
- ConcurrentSkipListSet<Integer> q =
- new ConcurrentSkipListSet<Integer>();
+ ConcurrentSkipListSet<Integer> q = new ConcurrentSkipListSet<>();
assertTrue(q.isEmpty());
for (int i = n - 1; i >= 0; i -= 2)
assertTrue(q.add(new Integer(i)));
--- a/test/jdk/java/util/concurrent/tck/ConcurrentSkipListSubSetTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/tck/ConcurrentSkipListSubSetTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -60,8 +60,7 @@
* Integers 0 ... n - 1.
*/
private static NavigableSet<Integer> populatedSet(int n) {
- ConcurrentSkipListSet<Integer> q =
- new ConcurrentSkipListSet<Integer>();
+ ConcurrentSkipListSet<Integer> q = new ConcurrentSkipListSet<>();
assertTrue(q.isEmpty());
for (int i = n - 1; i >= 0; i -= 2)
--- a/test/jdk/java/util/concurrent/tck/CopyOnWriteArrayListTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/tck/CopyOnWriteArrayListTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -83,8 +83,8 @@
static CopyOnWriteArrayList<Integer> populatedArray(Integer[] elements) {
CopyOnWriteArrayList<Integer> a = new CopyOnWriteArrayList<>();
assertTrue(a.isEmpty());
- for (int i = 0; i < elements.length; i++)
- a.add(elements[i]);
+ for (Integer element : elements)
+ a.add(element);
assertFalse(a.isEmpty());
assertEquals(elements.length, a.size());
return a;
--- a/test/jdk/java/util/concurrent/tck/CyclicBarrierTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/tck/CyclicBarrierTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -335,8 +335,7 @@
c.await();
shouldThrow();
}
- catch (BrokenBarrierException ok) {}
- catch (InterruptedException ok) {}
+ catch (BrokenBarrierException | InterruptedException ok) {}
}}});
for (int i = 0; i < 4; i++) {
--- a/test/jdk/java/util/concurrent/tck/ForkJoinPool8Test.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/tck/ForkJoinPool8Test.java Thu Jan 18 18:58:46 2018 +0000
@@ -1557,7 +1557,7 @@
* timeout elapsed
*/
public void testAwaitQuiescence2() throws Exception {
- /**
+ /*
* """It is possible to disable or limit the use of threads in the
* common pool by setting the parallelism property to zero. However
* doing so may cause unjoined tasks to never be executed."""
--- a/test/jdk/java/util/concurrent/tck/FutureTaskTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/tck/FutureTaskTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -865,7 +865,7 @@
* toString indicates current completion state
*/
public void testToString_incomplete() {
- FutureTask<String> f = new FutureTask<String>(() -> "");
+ FutureTask<String> f = new FutureTask<>(() -> "");
assertTrue(f.toString().matches(".*\\[.*Not completed.*\\]"));
if (testImplementationDetails)
assertTrue(f.toString().startsWith(
@@ -873,7 +873,7 @@
}
public void testToString_normal() {
- FutureTask<String> f = new FutureTask<String>(() -> "");
+ FutureTask<String> f = new FutureTask<>(() -> "");
f.run();
assertTrue(f.toString().matches(".*\\[.*Completed normally.*\\]"));
if (testImplementationDetails)
@@ -882,7 +882,7 @@
}
public void testToString_exception() {
- FutureTask<String> f = new FutureTask<String>(
+ FutureTask<String> f = new FutureTask<>(
() -> { throw new ArithmeticException(); });
f.run();
assertTrue(f.toString().matches(".*\\[.*Completed exceptionally.*\\]"));
@@ -893,7 +893,7 @@
public void testToString_cancelled() {
for (boolean mayInterruptIfRunning : new boolean[] { true, false }) {
- FutureTask<String> f = new FutureTask<String>(() -> "");
+ FutureTask<String> f = new FutureTask<>(() -> "");
assertTrue(f.cancel(mayInterruptIfRunning));
assertTrue(f.toString().matches(".*\\[.*Cancelled.*\\]"));
if (testImplementationDetails)
--- a/test/jdk/java/util/concurrent/tck/JSR166TestCase.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/tck/JSR166TestCase.java Thu Jan 18 18:58:46 2018 +0000
@@ -472,18 +472,11 @@
}
}
- public static boolean atLeastJava6() { return JAVA_CLASS_VERSION >= 50.0; }
- public static boolean atLeastJava7() { return JAVA_CLASS_VERSION >= 51.0; }
- public static boolean atLeastJava8() { return JAVA_CLASS_VERSION >= 52.0; }
- public static boolean atLeastJava9() {
- return JAVA_CLASS_VERSION >= 53.0
- // As of 2015-09, java9 still uses 52.0 class file version
- || JAVA_SPECIFICATION_VERSION.matches("^(1\\.)?(9|[0-9][0-9])$");
- }
- public static boolean atLeastJava10() {
- return JAVA_CLASS_VERSION >= 54.0
- || JAVA_SPECIFICATION_VERSION.matches("^(1\\.)?[0-9][0-9]$");
- }
+ public static boolean atLeastJava6() { return JAVA_CLASS_VERSION >= 50.0; }
+ public static boolean atLeastJava7() { return JAVA_CLASS_VERSION >= 51.0; }
+ public static boolean atLeastJava8() { return JAVA_CLASS_VERSION >= 52.0; }
+ public static boolean atLeastJava9() { return JAVA_CLASS_VERSION >= 53.0; }
+ public static boolean atLeastJava10() { return JAVA_CLASS_VERSION >= 54.0; }
/**
* Collects all JSR166 unit tests as one suite.
--- a/test/jdk/java/util/concurrent/tck/LinkedBlockingQueueTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/tck/LinkedBlockingQueueTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -86,8 +86,7 @@
* Integers 0 ... n - 1.
*/
private static LinkedBlockingQueue<Integer> populatedQueue(int n) {
- LinkedBlockingQueue<Integer> q =
- new LinkedBlockingQueue<Integer>(n);
+ LinkedBlockingQueue<Integer> q = new LinkedBlockingQueue<>(n);
assertTrue(q.isEmpty());
for (int i = 0; i < n; i++)
assertTrue(q.offer(new Integer(i)));
--- a/test/jdk/java/util/concurrent/tck/MapTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/tck/MapTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -129,7 +129,7 @@
final Object v2 = (permitsNullValues && rnd.nextBoolean() && v1 != null)
? null : impl.makeValue(2);
- /** If true, always lands in first bucket in hash tables. */
+ // If true, always lands in first bucket in hash tables.
final boolean poorHash = rnd.nextBoolean();
class Key implements Comparable<Key> {
final int i;
--- a/test/jdk/java/util/concurrent/tck/RecursiveActionTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/tck/RecursiveActionTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -352,8 +352,7 @@
* succeeds in the presence of interrupts
*/
public void testJoinIgnoresInterruptsOutsideForkJoinPool() {
- final SynchronousQueue<FibAction[]> sq =
- new SynchronousQueue<FibAction[]>();
+ final SynchronousQueue<FibAction[]> sq = new SynchronousQueue<>();
RecursiveAction a = new CheckedRecursiveAction() {
protected void realCompute() throws InterruptedException {
FibAction[] fibActions = new FibAction[6];
--- a/test/jdk/java/util/concurrent/tck/ScheduledExecutorSubclassTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/tck/ScheduledExecutorSubclassTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -872,7 +872,7 @@
immediates.forEach(
f -> assertTrue(((ScheduledFuture)f).getDelay(NANOSECONDS) <= 0L));
- Stream.of(immediates, delayeds, periodics).flatMap(c -> c.stream())
+ Stream.of(immediates, delayeds, periodics).flatMap(Collection::stream)
.forEach(f -> assertFalse(f.isDone()));
try { p.shutdown(); } catch (SecurityException ok) { return; }
@@ -926,7 +926,7 @@
assertTrue(q.isEmpty());
- Stream.of(immediates, delayeds, periodics).flatMap(c -> c.stream())
+ Stream.of(immediates, delayeds, periodics).flatMap(Collection::stream)
.forEach(f -> assertTrue(f.isDone()));
for (Future<?> f : immediates) assertNull(f.get());
--- a/test/jdk/java/util/concurrent/tck/ScheduledExecutorTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/tck/ScheduledExecutorTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -831,7 +831,7 @@
immediates.forEach(
f -> assertTrue(((ScheduledFuture)f).getDelay(NANOSECONDS) <= 0L));
- Stream.of(immediates, delayeds, periodics).flatMap(c -> c.stream())
+ Stream.of(immediates, delayeds, periodics).flatMap(Collection::stream)
.forEach(f -> assertFalse(f.isDone()));
try { p.shutdown(); } catch (SecurityException ok) { return; }
@@ -885,7 +885,7 @@
assertTrue(q.isEmpty());
- Stream.of(immediates, delayeds, periodics).flatMap(c -> c.stream())
+ Stream.of(immediates, delayeds, periodics).flatMap(Collection::stream)
.forEach(f -> assertTrue(f.isDone()));
for (Future<?> f : immediates) assertNull(f.get());
--- a/test/jdk/java/util/concurrent/tck/SubmissionPublisherTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/tck/SubmissionPublisherTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -431,7 +431,7 @@
*/
public void testCancel() {
SubmissionPublisher<Integer> p =
- new SubmissionPublisher<Integer>(basicExecutor, 4); // must be < 20
+ new SubmissionPublisher<>(basicExecutor, 4); // must be < 20
TestSubscriber s1 = new TestSubscriber();
TestSubscriber s2 = new TestSubscriber();
p.subscribe(s1);
@@ -1012,6 +1012,7 @@
* cvs update -D '2017-11-25' src/main/java/util/concurrent/SubmissionPublisher.java && ant -Djsr166.expensiveTests=true -Djsr166.tckTestClass=SubmissionPublisherTest -Djsr166.methodFilter=testMissedSignal tck; cvs update -A src/main/java/util/concurrent/SubmissionPublisher.java
*/
public void testMissedSignal_8187947() throws Exception {
+ if (!atLeastJava9()) return; // backport to jdk8 too hard
final int N = expensiveTests ? (1 << 20) : (1 << 10);
final CountDownLatch finished = new CountDownLatch(1);
final SubmissionPublisher<Boolean> pub = new SubmissionPublisher<>();
--- a/test/jdk/java/util/concurrent/tck/ThreadLocalRandomTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/concurrent/tck/ThreadLocalRandomTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -382,7 +382,7 @@
// Don't use main thread's ThreadLocalRandom - it is likely to
// be polluted by previous tests.
final AtomicReference<ThreadLocalRandom> threadLocalRandom =
- new AtomicReference<ThreadLocalRandom>();
+ new AtomicReference<>();
final AtomicLong rand = new AtomicLong();
long firstRand = 0;
--- a/test/jdk/java/util/regex/RegExTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/regex/RegExTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,7 @@
* 8027645 8035076 8039124 8035975 8074678 6854417 8143854 8147531 7071819
* 8151481 4867170 7080302 6728861 6995635 6736245 4916384 6328855 6192895
* 6345469 6988218 6693451 7006761 8140212 8143282 8158482 8176029 8184706
+ * 8194667
*
* @library /test/lib
* @build jdk.test.lib.RandomFactory
@@ -1367,24 +1368,35 @@
report("Reluctant Repetition");
}
+ private static Pattern serializedPattern(Pattern p) throws Exception {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(p);
+ oos.close();
+ try (ObjectInputStream ois = new ObjectInputStream(
+ new ByteArrayInputStream(baos.toByteArray()))) {
+ return (Pattern)ois.readObject();
+ }
+ }
+
private static void serializeTest() throws Exception {
String patternStr = "(b)";
String matchStr = "b";
Pattern pattern = Pattern.compile(patternStr);
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ObjectOutputStream oos = new ObjectOutputStream(baos);
- oos.writeObject(pattern);
- oos.close();
- ObjectInputStream ois = new ObjectInputStream(
- new ByteArrayInputStream(baos.toByteArray()));
- Pattern serializedPattern = (Pattern)ois.readObject();
- ois.close();
+ Pattern serializedPattern = serializedPattern(pattern);
Matcher matcher = serializedPattern.matcher(matchStr);
if (!matcher.matches())
failCount++;
if (matcher.groupCount() != 1)
failCount++;
+ pattern = Pattern.compile("a(?-i)b", Pattern.CASE_INSENSITIVE);
+ serializedPattern = serializedPattern(pattern);
+ if (!serializedPattern.matcher("Ab").matches())
+ failCount++;
+ if (serializedPattern.matcher("AB").matches())
+ failCount++;
+
report("Serialization");
}
--- a/test/jdk/java/util/stream/test/org/openjdk/tests/java/util/stream/WhileOpTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/java/util/stream/test/org/openjdk/tests/java/util/stream/WhileOpTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -47,6 +47,7 @@
/*
* @test
* @bug 8071597 8193856
+ * @run main/timeout=240
*/
@Test
public class WhileOpTest extends OpTestCase {
--- a/test/jdk/javax/net/ssl/compatibility/Parameter.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/javax/net/ssl/compatibility/Parameter.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -65,15 +65,15 @@
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384(
Protocol.TLSV1_2, JdkRelease.JDK7),
TLS_RSA_WITH_AES_256_CBC_SHA256(
- Protocol.TLSV1_2, JdkRelease.JDK7),
+ Protocol.TLSV1_2, JdkRelease.JDK6),
TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384(
Protocol.TLSV1_2, JdkRelease.JDK7),
TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384(
Protocol.TLSV1_2, JdkRelease.JDK7),
TLS_DHE_RSA_WITH_AES_256_CBC_SHA256(
- Protocol.TLSV1_2, JdkRelease.JDK7),
+ Protocol.TLSV1_2, JdkRelease.JDK6),
TLS_DHE_DSS_WITH_AES_256_CBC_SHA256(
- Protocol.TLSV1_2, JdkRelease.JDK7),
+ Protocol.TLSV1_2, JdkRelease.JDK6),
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA(),
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA(),
TLS_RSA_WITH_AES_256_CBC_SHA(),
@@ -86,15 +86,15 @@
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256(
Protocol.TLSV1_2, JdkRelease.JDK7),
TLS_RSA_WITH_AES_128_CBC_SHA256(
- Protocol.TLSV1_2, JdkRelease.JDK7),
+ Protocol.TLSV1_2, JdkRelease.JDK6),
TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256(
Protocol.TLSV1_2, JdkRelease.JDK7),
TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256(
Protocol.TLSV1_2, JdkRelease.JDK7),
TLS_DHE_RSA_WITH_AES_128_CBC_SHA256(
- Protocol.TLSV1_2, JdkRelease.JDK7),
+ Protocol.TLSV1_2, JdkRelease.JDK6),
TLS_DHE_DSS_WITH_AES_128_CBC_SHA256(
- Protocol.TLSV1_2, JdkRelease.JDK7),
+ Protocol.TLSV1_2, JdkRelease.JDK6),
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA(),
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA(),
TLS_RSA_WITH_AES_128_CBC_SHA(),
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/net/ssl/sanity/CacertsExplorer.java Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2018 Google Inc. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.security.KeyStore;
+import java.security.cert.X509Certificate;
+import java.util.Arrays;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.TrustManagerFactory;
+import javax.net.ssl.X509TrustManager;
+
+/*
+ * @test
+ * @bug 8194960
+ * @summary Sanity check trust manager defaults/cacerts.
+ */
+
+/**
+ * Explores the set of root certificates.
+ * Also useful as a standalone program.
+ *
+ * Prior to JEP 319, stock openjdk fails this because no root
+ * certificates were checked into the repo.
+ */
+public class CacertsExplorer {
+ public static void main(String[] args) throws Throwable {
+ String defaultAlgorithm = TrustManagerFactory.getDefaultAlgorithm();
+ if (!defaultAlgorithm.equals("PKIX")) {
+ throw new AssertionError(
+ "Expected default algorithm PKIX, got " + defaultAlgorithm);
+ }
+
+ TrustManagerFactory trustManagerFactory =
+ TrustManagerFactory.getInstance(defaultAlgorithm);
+ trustManagerFactory.init((KeyStore) null);
+ TrustManager[] trustManagers = trustManagerFactory.getTrustManagers();
+ if (trustManagers.length != 1) {
+ throw new AssertionError(
+ "Expected exactly one TrustManager, got "
+ + Arrays.toString(trustManagers));
+ }
+ X509TrustManager trustManager = (X509TrustManager) trustManagers[0];
+
+ X509Certificate[] acceptedIssuers = trustManager.getAcceptedIssuers();
+ if (acceptedIssuers.length == 0) {
+ throw new AssertionError(
+ "no accepted issuers - cacerts file configuration problem?");
+ }
+ Arrays.stream(acceptedIssuers)
+ .map(X509Certificate::getIssuerX500Principal)
+ .forEach(System.out::println);
+ }
+}
--- a/test/jdk/jdk/internal/reflect/Reflection/GetCallerClassWithDepth.java Thu Jan 18 09:01:00 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 8025799
- * @summary Reflection.getCallerClass(int)
- * @modules java.base/jdk.internal.reflect
- * @run main GetCallerClassWithDepth
- */
-
-import jdk.internal.reflect.Reflection;
-
-public class GetCallerClassWithDepth {
- public static void main(String[] args) throws Exception {
- Class<?> c = Test.test();
- assertEquals(c, GetCallerClassWithDepth.class);
- Class<?> caller = Test.caller();
- assertEquals(caller, GetCallerClassWithDepth.class);
- Test.selfTest();
-
- try {
- Reflection.getCallerClass(-1);
- throw new RuntimeException("getCallerClass(-1) should fail");
- } catch (Error e) {
- System.out.println("Expected: " + e.getMessage());
- }
- }
-
- public Class<?> getCallerClass() {
- // 0: Reflection 1: getCallerClass 2: Test.test 3: main
- return Reflection.getCallerClass(3);
- }
-
- static void assertEquals(Class<?> c, Class<?> expected) {
- if (c != expected) {
- throw new RuntimeException("Incorrect caller: " + c);
- }
- }
-
- static class Test {
- // Returns the caller of this method
- public static Class<?> test() {
- return new GetCallerClassWithDepth().getCallerClass();
- }
-
- // Returns the caller of this method
- public static Class<?> caller() {
- // 0: Reflection 1: Test.caller 2: main
- return Reflection.getCallerClass(2);
- }
- public static void selfTest() {
- // 0: Reflection 1: Test.selfTest
- Class<?> c = Reflection.getCallerClass(1);
- assertEquals(c, Test.class);
- Inner1.deep();
- }
-
- static class Inner1 {
- static void deep() {
- deeper();
- }
- static void deeper() {
- Inner2.deepest();
- }
- static class Inner2 {
- static void deepest() {
- // 0: Reflection 1: deepest 2: deeper 3: deep 4: Test.selfTest
- Class<?> c = Reflection.getCallerClass(4);
- assertEquals(c, Test.class);
- }
- }
- }
- }
-}
--- a/test/jdk/lib/testlibrary/bootlib/java.base/java/util/stream/LambdaTestHelpers.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/lib/testlibrary/bootlib/java.base/java/util/stream/LambdaTestHelpers.java Thu Jan 18 18:58:46 2018 +0000
@@ -48,6 +48,7 @@
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.fail;
/**
* LambdaTestHelpers -- assertion methods and useful objects for lambda test cases
@@ -277,7 +278,7 @@
public static<T> void assertContents(Iterable<T> actual, Iterable<T> expected) {
if (actual instanceof Collection && expected instanceof Collection) {
- assertEquals(actual, expected);
+ assertIterableEquals(actual, expected);
} else {
assertContents(actual.iterator(), expected.iterator());
}
@@ -287,6 +288,42 @@
assertEquals(toBoxedList(actual), toBoxedList(expected));
}
+ // Workaround excessive String creation in inner loop in org.testng.Assert.assertEquals(Iterable<?>, Iterable<?>)
+ static public void assertIterableEquals(Iterable<?> actual, Iterable<?> expected) {
+ if(actual == expected) {
+ return;
+ }
+
+ if(actual == null || expected == null) {
+ fail("Iterables not equal: expected: " + expected + " and actual: " + actual);
+ }
+
+ assertIteratorsEquals(actual.iterator(), expected.iterator());
+ }
+
+ // Workaround excessive String creation in inner loop in org.testng.Assert.assertEquals(Iterator<?>, Iterator<?>)
+ static public void assertIteratorsEquals(Iterator<?> actual, Iterator<?> expected) {
+ if (actual == expected) {
+ return;
+ }
+
+ if (actual == null || expected == null) {
+ fail("Iterators not equal: expected: " + expected + " and actual: " + actual);
+ }
+
+ while (actual.hasNext() && expected.hasNext()) {
+ Object e = expected.next();
+ Object a = actual.next();
+ assertEquals(a, e, "Iterator contents differ");
+ }
+
+ if(actual.hasNext()) {
+ fail("Actual iterator returned more elements than the expected iterator.");
+ } else if(expected.hasNext()) {
+ fail("Expected iterator returned more elements than the actual iterator.");
+ }
+ }
+
@SafeVarargs
@SuppressWarnings("varargs")
public static<T> void assertContents(Iterator<T> actual, T... expected) {
--- a/test/jdk/lib/testlibrary/jdk/testlibrary/OutputAnalyzer.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/lib/testlibrary/jdk/testlibrary/OutputAnalyzer.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,12 +25,16 @@
import static jdk.testlibrary.Asserts.*;
+import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintStream;
+import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
/**
* Utility class for verifying output and exit value from a {@code Process}.
@@ -446,8 +450,9 @@
/**
- * Get the contents of the output buffer (stdout and stderr) as list of strings.
- * Output will be split by system property 'line.separator'.
+ * Get the contents of the output buffer (stdout and stderr)
+ * as a list of strings. Output will be split at new-lines as
+ * recognized by java.io.BufferedReader.readLine().
*
* @return Contents of the output buffer as list of strings
*/
@@ -456,12 +461,8 @@
}
private List<String> asLines(String buffer) {
- List<String> l = new ArrayList<>();
- String[] a = buffer.split(Utils.NEW_LINE);
- for (String string : a) {
- l.add(string);
- }
- return l;
+ return new BufferedReader(new StringReader(buffer))
+ .lines().collect(Collectors.toList());
}
/**
--- a/test/jdk/sun/reflect/Reflection/GetCallerClassWithDepth.java Thu Jan 18 09:01:00 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 8137058
- * @summary Basic test for the unsupported Reflection.getCallerClass(int)
- * @modules jdk.unsupported
- */
-
-import sun.reflect.Reflection;
-
-public class GetCallerClassWithDepth {
- public static void main(String[] args) throws Exception {
- Class<?> c = Test.test();
- assertEquals(c, GetCallerClassWithDepth.class);
- Class<?> caller = Test.caller();
- assertEquals(caller, GetCallerClassWithDepth.class);
- Test.selfTest();
-
- try {
- Reflection.getCallerClass(-1);
- throw new RuntimeException("getCallerClass(-1) should fail");
- } catch (Error e) {
- System.out.println("Expected: " + e.getMessage());
- }
- }
-
- public Class<?> getCallerClass() {
- // 0: Reflection 1: getCallerClass 2: Test.test 3: main
- return Reflection.getCallerClass(3);
- }
-
- static void assertEquals(Class<?> c, Class<?> expected) {
- if (c != expected) {
- throw new RuntimeException("Incorrect caller: " + c);
- }
- }
-
- static class Test {
- // Returns the caller of this method
- public static Class<?> test() {
- return new GetCallerClassWithDepth().getCallerClass();
- }
-
- // Returns the caller of this method
- public static Class<?> caller() {
- // 0: Reflection 1: Test.caller 2: main
- return Reflection.getCallerClass(2);
- }
- public static void selfTest() {
- // 0: Reflection 1: Test.selfTest
- Class<?> c = Reflection.getCallerClass(1);
- assertEquals(c, Test.class);
- Inner1.deep();
- }
-
- static class Inner1 {
- static void deep() {
- deeper();
- }
- static void deeper() {
- Inner2.deepest();
- }
- static class Inner2 {
- static void deepest() {
- // 0: Reflection 1: deepest 2: deeper 3: deep 4: Test.selfTest
- Class<?> c = Reflection.getCallerClass(4);
- assertEquals(c, Test.class);
- }
- }
- }
- }
-}
--- a/test/jdk/sun/security/pkcs11/PKCS11Test.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/sun/security/pkcs11/PKCS11Test.java Thu Jan 18 18:58:46 2018 +0000
@@ -443,7 +443,17 @@
// the index after whitespace after nssHeader
int afterheader = s.indexOf("NSS", i) + 4;
- String version = s.substring(afterheader, s.indexOf(' ', afterheader));
+ int nextSpaceIndex = s.indexOf(' ', afterheader);
+
+ // If the next space is not found,
+ // it has to print the content for further investigation.
+ if (nextSpaceIndex == -1) {
+ System.out.println("===== Content start =====");
+ System.out.println(s);
+ System.out.println("===== Content end =====");
+ }
+
+ String version = s.substring(afterheader, nextSpaceIndex);
// If a "dot dot" release, strip the extra dots for double parsing
String[] dot = version.split("\\.");
--- a/test/jdk/sun/security/ssl/CertPathRestrictions/JSSEServer.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/sun/security/ssl/CertPathRestrictions/JSSEServer.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,8 +36,6 @@
private SSLServerSocket server = null;
- private Exception exception = null;
-
public JSSEServer(SSLContext context, String constraint,
boolean needClientAuth) throws Exception {
TLSRestrictions.setConstraint("Server", constraint);
@@ -49,35 +47,28 @@
System.out.println("Server: port=" + getPort());
}
- public void start() {
- new Thread(new Runnable() {
+ public Exception start() {
+ System.out.println("Server: started");
+ Exception exception = null;
+ try (SSLSocket socket = (SSLSocket) server.accept()) {
+ System.out.println("Server: accepted connection");
+ socket.setSoTimeout(TLSRestrictions.TIMEOUT);
+ InputStream sslIS = socket.getInputStream();
+ OutputStream sslOS = socket.getOutputStream();
+ sslIS.read();
+ sslOS.write('S');
+ sslOS.flush();
+ System.out.println("Server: finished");
+ } catch (Exception e) {
+ exception = e;
+ e.printStackTrace(System.out);
+ System.out.println("Server: failed");
+ }
- @Override
- public void run() {
- try {
- System.out.println("Server: started");
- try (SSLSocket socket = (SSLSocket) server.accept()) {
- socket.setSoTimeout(TLSRestrictions.TIMEOUT);
- InputStream sslIS = socket.getInputStream();
- OutputStream sslOS = socket.getOutputStream();
- sslIS.read();
- sslOS.write('S');
- sslOS.flush();
- System.out.println("Server: finished");
- }
- } catch (Exception e) {
- e.printStackTrace(System.out);
- exception = e;
- }
- }
- }).start();
+ return exception;
}
public int getPort() {
return server.getLocalPort();
}
-
- public Exception getException() {
- return exception;
- }
}
--- a/test/jdk/sun/security/ssl/CertPathRestrictions/TLSRestrictions.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/sun/security/ssl/CertPathRestrictions/TLSRestrictions.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,6 +36,10 @@
import java.security.cert.CertificateFactory;
import java.security.spec.PKCS8EncodedKeySpec;
import java.util.Base64;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import javax.net.ssl.KeyManagerFactory;
@@ -216,59 +220,59 @@
needClientAuth,
pass);
- JSSEServer server = new JSSEServer(
- createSSLContext(trustNames, certNames),
- serverConstraint,
- needClientAuth);
- int port = server.getPort();
- server.start();
-
- // Run client on another JVM so that its properties cannot be in conflict
- // with server's.
- OutputAnalyzer outputAnalyzer = ProcessTools.executeTestJvm(
- "-Dcert.dir=" + CERT_DIR,
- "-Djava.security.debug=certpath",
- "-classpath",
- TEST_CLASSES,
- "JSSEClient",
- port + "",
- trustNameStr,
- certNameStr,
- clientConstraint);
- int exitValue = outputAnalyzer.getExitValue();
- String clientOut = outputAnalyzer.getOutput();
+ ExecutorService executor = Executors.newFixedThreadPool(1);
+ try {
+ JSSEServer server = new JSSEServer(
+ createSSLContext(trustNames, certNames),
+ serverConstraint,
+ needClientAuth);
+ int port = server.getPort();
+ Future<Exception> serverFuture = executor.submit(() -> server.start());
- Exception serverException = server.getException();
- if (serverException != null) {
- System.out.println("Server: failed");
- }
-
- System.out.println("---------- Client output start ----------");
- System.out.println(clientOut);
- System.out.println("---------- Client output end ----------");
+ // Run client on another JVM so that its properties cannot be in conflict
+ // with server's.
+ OutputAnalyzer outputAnalyzer = ProcessTools.executeTestJvm(
+ "-Dcert.dir=" + CERT_DIR,
+ "-Djava.security.debug=certpath",
+ "-classpath",
+ TEST_CLASSES,
+ "JSSEClient",
+ port + "",
+ trustNameStr,
+ certNameStr,
+ clientConstraint);
+ int clientExitValue = outputAnalyzer.getExitValue();
+ String clientOut = outputAnalyzer.getOutput();
+ System.out.println("---------- Client output start ----------");
+ System.out.println(clientOut);
+ System.out.println("---------- Client output end ----------");
- if (serverException instanceof SocketTimeoutException
- || clientOut.contains("SocketTimeoutException")) {
- System.out.println("The communication gets timeout and skips the test.");
- return;
- }
-
- if (pass) {
- if (serverException != null || exitValue != 0) {
- throw new RuntimeException(
- "Unexpected failure. Operation was blocked.");
- }
- } else {
- if (serverException == null && exitValue == 0) {
- throw new RuntimeException(
- "Unexpected pass. Operation was allowed.");
+ Exception serverException = serverFuture.get(TIMEOUT, TimeUnit.MILLISECONDS);
+ if (serverException instanceof SocketTimeoutException
+ || clientOut.contains("SocketTimeoutException")) {
+ System.out.println("The communication gets timeout and skips the test.");
+ return;
}
- // The test may encounter non-SSL issues, like network problem.
- if (!(serverException instanceof SSLHandshakeException
- || clientOut.contains("SSLHandshakeException"))) {
- throw new RuntimeException("Failure with unexpected exception.");
+ if (pass) {
+ if (serverException != null || clientExitValue != 0) {
+ throw new RuntimeException(
+ "Unexpected failure. Operation was blocked.");
+ }
+ } else {
+ if (serverException == null && clientExitValue == 0) {
+ throw new RuntimeException(
+ "Unexpected pass. Operation was allowed.");
+ }
+
+ // The test may encounter non-SSL issues, like network problem.
+ if (!(serverException instanceof SSLHandshakeException
+ || clientOut.contains("SSLHandshakeException"))) {
+ throw new RuntimeException("Failure with unexpected exception.");
+ }
}
+ } finally {
+ executor.shutdown();
}
}
@@ -520,7 +524,6 @@
true);
break;
}
-
System.out.println("Case passed");
System.out.println("========================================");
}
--- a/test/jdk/sun/tools/jcmd/TestJcmdDefaults.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/sun/tools/jcmd/TestJcmdDefaults.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -52,20 +52,22 @@
private static final String JCMD_LIST_REGEX = "(?s)^\\d+\\s*.*";
public static void main(String[] args) throws Exception {
+ testJcmdUsage("-?");
testJcmdUsage("-h");
- testJcmdUsage("-help");
+ testJcmdUsage("--help");
testJcmdDefaults();
testJcmdDefaults("-l");
}
/**
+ * jcmd -J-XX:+UsePerfData -?
* jcmd -J-XX:+UsePerfData -h
- * jcmd -J-XX:+UsePerfData -help
+ * jcmd -J-XX:+UsePerfData --help
*/
private static void testJcmdUsage(String... jcmdArgs) throws Exception {
OutputAnalyzer output = JcmdBase.jcmdNoPid(VM_ARGS, jcmdArgs);
- assertNotEquals(output.getExitValue(), 0);
+ assertEquals(output.getExitValue(), 0);
verifyOutputAgainstFile(output);
}
--- a/test/jdk/sun/tools/jcmd/usage.out Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/sun/tools/jcmd/usage.out Thu Jan 18 18:58:46 2018 +0000
@@ -12,4 +12,4 @@
PerfCounter.print display the counters exposed by this process
-f read and execute commands from the file
-l list JVM processes on the local machine
- -h this help
+ -? -h --help print this help message
--- a/test/jdk/sun/tools/jps/TestJpsSanity.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/sun/tools/jps/TestJpsSanity.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -84,7 +84,10 @@
OutputAnalyzer output = JpsHelper.jps("-?");
JpsHelper.verifyOutputAgainstFile(output);
- output = JpsHelper.jps("-help");
+ output = JpsHelper.jps("-h");
+ JpsHelper.verifyOutputAgainstFile(output);
+
+ output = JpsHelper.jps("--help");
JpsHelper.verifyOutputAgainstFile(output);
}
--- a/test/jdk/sun/tools/jps/usage.out Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/sun/tools/jps/usage.out Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,6 @@
-usage: jps [-help]
+usage: jps [--help]
jps [-q] [-mlvV] [<hostid>]
Definitions:
<hostid>: <hostname>[:<port>]
+ -? -h --help -help: Print this help message and exit.
--- a/test/jdk/sun/tools/jstat/jstatHelp.sh Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/sun/tools/jstat/jstatHelp.sh Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
# @test
# @bug 4990825 6364329
# @run shell jstatHelp.sh
-# @summary Test that output of 'jstat -?', 'jstat -help' and 'jstat' matches the usage.out file
+# @summary Test that output of 'jstat -?', 'jstat -h', 'jstat --help' and 'jstat' matches the usage.out file
. ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
@@ -43,12 +43,22 @@
fi
rm -f jstat.out 2>/dev/null
-${JSTAT} -J-XX:+UsePerfData -help > jstat.out 2>&1
+${JSTAT} -J-XX:+UsePerfData --help > jstat.out 2>&1
diff -w jstat.out ${TESTSRC}/usage.out
if [ $? != 0 ]
then
- echo "Output of jstat -help differs from expected output. Failed."
+ echo "Output of jstat -h differs from expected output. Failed."
+ exit 1
+fi
+
+rm -f jstat.out 2>/dev/null
+${JSTAT} -J-XX:+UsePerfData --help > jstat.out 2>&1
+
+diff -w jstat.out ${TESTSRC}/usage.out
+if [ $? != 0 ]
+then
+ echo "Output of jstat --help differs from expected output. Failed."
exit 1
fi
--- a/test/jdk/sun/tools/jstat/usage.out Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/sun/tools/jstat/usage.out Thu Jan 18 18:58:46 2018 +0000
@@ -1,4 +1,4 @@
-Usage: jstat -help|-options
+Usage: jstat --help|-options
jstat -<option> [-t] [-h<lines>] <vmid> [<interval> [<count>]]
Definitions:
@@ -18,3 +18,5 @@
milliseconds("ms") or seconds("s"). The default units are "ms".
<count> Number of samples to take before terminating.
-J<flag> Pass <flag> directly to the runtime system.
+ -? -h --help Prints this help message.
+ -help Prints this help message.
--- a/test/jdk/sun/tools/jstatd/TestJstatdUsage.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/jdk/sun/tools/jstatd/TestJstatdUsage.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, 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
@@ -36,8 +36,9 @@
public class TestJstatdUsage {
public static void main(String[] args) throws Exception {
- testUsage("-help");
testUsage("-?");
+ testUsage("-h");
+ testUsage("--help");
}
private static void testUsage(String option) throws Exception {
@@ -47,7 +48,7 @@
OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);
output.shouldContain("usage: jstatd [-nr] [-p port] [-n rminame]");
- output.shouldHaveExitValue(1);
+ output.shouldHaveExitValue(0);
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/launcher/HelpFlagsTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,425 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018 SAP SE. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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
+ * @summary Validate and test -?, -h and --help flags. All tools in the jdk
+ * should take the same flags to display the help message. These
+ * flags should be documented in the printed help message. The
+ * tool should quit without error code after displaying the
+ * help message (if there is no other problem with the command
+ * line).
+ * Also check that tools that used to accept -help still do
+ * so. Test that tools that never accepted -help don't do so
+ * in future. I.e., check that the tool returns with the same
+ * return code as called with an invalid flag, and does not
+ * print anything containing '-help' in that case.
+ * @compile HelpFlagsTest.java
+ * @run main HelpFlagsTest
+ */
+
+import java.io.File;
+import java.io.FileFilter;
+import java.util.Map;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.HashSet;
+import java.util.Set;
+
+
+public class HelpFlagsTest extends TestHelper {
+
+ // Tools that should not be tested because a usage message is pointless.
+ static final String[] TOOLS_NOT_TO_TEST = {
+ "appletviewer", // deprecated, don't test
+ "jaccessinspector", // gui, don't test, win only
+ "jaccesswalker", // gui, don't test, win only
+ "jconsole", // gui, don't test
+ "servertool", // none. Shell, don't test.
+ "javaw", // don't test, win only
+ // The flags of these tools need to be fixed in Java EE.
+ // The tools are deprecated for removal in Java SE. Don't test.
+ "idlj",
+ "orbd",
+ "schemagen",
+ "tnameserv",
+ "wsgen",
+ "wsimport",
+ "xjc",
+ // These shall have a help message that resembles that of
+ // MIT's tools. Thus -?, -h and --help are supported, but not
+ // mentioned in the help text.
+ "kinit",
+ "klist",
+ "ktab"
+ };
+
+ // Lists which tools support which flags.
+ private static class ToolHelpSpec {
+ String toolname;
+
+ // How the flags supposed to be supported are handled.
+ //
+ // These flags are supported, i.e.,
+ // * the tool accepts the flag
+ // * the tool prints a help message if the flag is specified
+ // * this help message lists the flag
+ // * the tool exits with exit code '0'.
+ boolean supportsQuestionMark;
+ boolean supportsH;
+ boolean supportsHelp;
+
+ // One tool returns with exit code != '0'.
+ int exitcodeOfHelp;
+
+ // How legacy -help is handled.
+ //
+ // Tools that so far support -help should still do so, but
+ // not print documentation about it. Tools that do not
+ // support -help should not do so in future.
+ //
+ // The tools accepts legacy -help. -help should not be
+ // documented in the usage message.
+ boolean supportsLegacyHelp;
+
+ // Java itself documents -help. -help prints to stderr,
+ // while --help prints to stdout. Leave as is.
+ boolean documentsLegacyHelp;
+
+ // The exit code of the tool if an invalid argument is passed to it.
+ // An exit code != 0 would be expected, but not all tools handle it
+ // that way.
+ int exitcodeOfWrongFlag;
+
+ // Some tools accept the invalid argument and thus hang the test.
+ // Don't execute these with the wrong flags.
+ // This actually should be considered a bug in the corresponding tool.
+ boolean dontExecuteWithWrongFlags;
+
+ ToolHelpSpec(String n, int q, int h, int hp, int ex1, int l, int dl, int ex2, int hangs) {
+ toolname = n;
+ supportsQuestionMark = ( q == 1 ? true : false );
+ supportsH = ( h == 1 ? true : false );
+ supportsHelp = ( hp == 1 ? true : false );
+ exitcodeOfHelp = ex1;
+
+ supportsLegacyHelp = ( l == 1 ? true : false );
+ documentsLegacyHelp = ( dl == 1 ? true : false );
+ exitcodeOfWrongFlag = ex2;
+
+ dontExecuteWithWrongFlags = ( hangs == 1 ? true : false );
+ }
+ }
+
+ static ToolHelpSpec[] jdkTools = {
+ // name -? -h --help exitcode -help -help exitcode Don't
+ // of help docu of wrong test
+ // mented flag inv flag
+ new ToolHelpSpec("jabswitch", 0, 0, 0, 0, 0, 0, 0, 0), // /?, prints help message anyways, win only
+ new ToolHelpSpec("jaotc", 1, 1, 1, 0, 0, 0, 2, 0), // -?, -h, --help
+ new ToolHelpSpec("jar", 1, 1, 1, 0, 0, 0, 1, 0), // -?, -h, --help
+ new ToolHelpSpec("jarsigner", 1, 1, 1, 0, 1, 0, 1, 0), // -?, -h, --help, -help accepted but not documented.
+ new ToolHelpSpec("java", 1, 1, 1, 0, 1, 1, 1, 0), // -?, -h, --help -help, Documents -help
+ new ToolHelpSpec("javac", 1, 0, 1, 0, 1, 1, 2, 0), // -?, --help -help, Documents -help, -h is already taken for "native header output directory".
+ new ToolHelpSpec("javadoc", 1, 1, 1, 0, 1, 1, 1, 0), // -?, -h, --help -help, Documents -help
+ new ToolHelpSpec("javap", 1, 1, 1, 0, 1, 1, 2, 0), // -?, -h, --help, -help accepted but not documented.
+ new ToolHelpSpec("javaw", 1, 1, 1, 0, 1, 1, 1, 0), // -?, -h, --help -help, win only
+ new ToolHelpSpec("jcmd", 1, 1, 1, 0, 1, 0, 1, 0), // -?, -h, --help, -help accepted but not documented.
+ new ToolHelpSpec("jdb", 1, 1, 1, 0, 1, 1, 0, 0), // -?, -h, --help, -help accepted but not documented.
+ new ToolHelpSpec("jdeprscan", 1, 1, 1, 0, 0, 0, 1, 0), // -?, -h, --help
+ new ToolHelpSpec("jdeps", 1, 1, 1, 0, 1, 0, 2, 0), // -?, -h, --help, -help accepted but not documented.
+ new ToolHelpSpec("jhsdb", 0, 0, 0, 0, 0, 0, 0, 0), // none, prints help message anyways.
+ new ToolHelpSpec("jimage", 1, 1, 1, 0, 0, 0, 2, 0), // -?, -h, --help
+ new ToolHelpSpec("jinfo", 1, 1, 1, 0, 1, 1, 1, 0), // -?, -h, --help, -help accepted but not documented.
+ new ToolHelpSpec("jjs", 0, 1, 1, 100, 0, 0, 100, 0), // -h, --help, return code 100
+ new ToolHelpSpec("jlink", 1, 1, 1, 0, 0, 0, 2, 0), // -?, -h, --help
+ new ToolHelpSpec("jmap", 1, 1, 1, 0, 1, 0, 1, 0), // -?, -h, --help, -help accepted but not documented.
+ new ToolHelpSpec("jmod", 1, 1, 1, 0, 1, 0, 2, 0), // -?, -h, --help, -help accepted but not documented.
+ new ToolHelpSpec("jps", 1, 1, 1, 0, 1, 1, 1, 0), // -?, -h, --help, -help accepted but not documented.
+ new ToolHelpSpec("jrunscript", 1, 1, 1, 0, 1, 1, 7, 0), // -?, -h, --help, -help accepted but not documented.
+ new ToolHelpSpec("jshell", 1, 1, 1, 0, 1, 0, 1, 0), // -?, -h, --help, -help accepted but not documented.
+ new ToolHelpSpec("jstack", 1, 1, 1, 0, 1, 1, 1, 0), // -?, -h, --help, -help accepted but not documented.
+ new ToolHelpSpec("jstat", 1, 1, 1, 0, 1, 1, 1, 0), // -?, -h, --help, -help accepted but not documented.
+ new ToolHelpSpec("jstatd", 1, 1, 1, 0, 0, 0, 1, 0), // -?, -h, --help
+ new ToolHelpSpec("keytool", 1, 1, 1, 0, 1, 0, 1, 0), // none, prints help message anyways.
+ new ToolHelpSpec("pack200", 1, 1, 1, 0, 1, 0, 2, 0), // -?, -h, --help, -help accepted but not documented.
+ new ToolHelpSpec("rmic", 0, 0, 0, 0, 0, 0, 1, 0), // none, pirnts help message anyways.
+ new ToolHelpSpec("rmid", 0, 0, 0, 0, 0, 0, 1, 0), // none, prints help message anyways.
+ new ToolHelpSpec("rmiregistry", 0, 0, 0, 0, 0, 0, 1, 0), // none, prints help message anyways.
+ new ToolHelpSpec("serialver", 0, 0, 0, 0, 0, 0, 1, 0), // none, prints help message anyways.
+ new ToolHelpSpec("unpack200", 1, 1, 1, 0, 1, 0, 2, 0), // -?, -h, --help, -help accepted but not documented.
+ };
+
+ // Returns true if the file is not a tool.
+ static boolean notATool(String file) {
+ if (isWindows && !file.endsWith(EXE_FILE_EXT))
+ return true;
+ return false;
+ }
+
+ // Returns true if tool is listed in TOOLS_NOT_TO_TEST.
+ static boolean dontTestTool(String tool) {
+ tool = tool.toLowerCase();
+ for (String x : TOOLS_NOT_TO_TEST) {
+ if (tool.toLowerCase().startsWith(x))
+ return true;
+ }
+ return false;
+ }
+
+ // Returns corresponding object from jdkTools array.
+ static ToolHelpSpec getToolHelpSpec(String tool) {
+ for (ToolHelpSpec x : jdkTools) {
+ if (tool.toLowerCase().equals(x.toolname) ||
+ tool.toLowerCase().equals(x.toolname + ".exe"))
+ return x;
+ }
+ return null;
+ }
+
+ // Check whether 'flag' appears in 'line' as a word of itself. It must not
+ // be a substring of a word, as then similar flags might be matched.
+ // E.g.: --help matches in the documentation of --help-extra.
+ // This works only with english locale, as some tools have translated
+ // usage messages.
+ static boolean findFlagInLine(String line, String flag) {
+ if (line.contains(flag) &&
+ !line.contains("nknown") && // Some tools say 'Unknown option "<flag>"',
+ !line.contains("invalid flag") && // 'invalid flag: <flag>'
+ !line.contains("invalid option") && // or 'invalid option: <flag>'. Skip that.
+ !line.contains("FileNotFoundException: -help") && // Special case for idlj.
+ !line.contains("-h requires an argument") && // Special case for javac.
+ !line.contains("port argument,")) { // Special case for rmiregistry.
+ // There might be several appearances of 'flag' in
+ // 'line'. (-h as substring of --help).
+ int flagLen = flag.length();
+ int lineLen = line.length();
+ for (int i = line.indexOf(flag); i >= 0; i = line.indexOf(flag, i+1)) {
+ // There should be a space before 'flag' in 'line', or it's right at the beginning.
+ if (i > 0 &&
+ line.charAt(i-1) != ' ' &&
+ line.charAt(i-1) != '[' && // jarsigner
+ line.charAt(i-1) != '|' && // jstatd
+ line.charAt(i-1) != '\t') { // jjs
+ continue;
+ }
+ // There should be a space or comma after 'flag' in 'line', or it's just at the end.
+ int posAfter = i + flagLen;
+ if (posAfter < lineLen &&
+ line.charAt(posAfter) != ' ' &&
+ line.charAt(posAfter) != ',' &&
+ line.charAt(posAfter) != '[' && // jar
+ line.charAt(posAfter) != ']' && // jarsigner
+ line.charAt(posAfter) != '|' && // jstatd
+ line.charAt(posAfter) != ':' && // jps
+ line.charAt(posAfter) != '"') { // keytool
+ continue;
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ static TestResult runToolWithFlag(File f, String flag) {
+ String x = f.getAbsolutePath();
+ TestResult tr = doExec(x, flag);
+ System.out.println("Testing " + f.getName());
+ System.out.println("#> " + x + " " + flag);
+ tr.testOutput.forEach(System.out::println);
+ System.out.println("#> echo $?");
+ System.out.println(tr.exitValue);
+
+ return tr;
+ }
+
+ // Checks whether tool supports flag 'flag' and documents it
+ // in the help message.
+ static String testTool(File f, String flag, int exitcode) {
+ String result = "";
+ TestResult tr = runToolWithFlag(f, flag);
+
+ // Check that the tool accepted the flag.
+ if (exitcode == 0 && !tr.isOK()) {
+ System.out.println("failed");
+ result = "failed: " + f.getName() + " " + flag + " has exit code " + tr.exitValue + ".\n";
+ }
+
+ // Check there is a help message listing the flag.
+ boolean foundFlag = false;
+ for (String y : tr.testOutput) {
+ if (!foundFlag && findFlagInLine(y, flag)) { // javac
+ foundFlag = true;
+ System.out.println("Found documentation of '" + flag + "': '" + y.trim() +"'");
+ }
+ }
+ if (!foundFlag) {
+ result += "failed: " + f.getName() + " does not document " +
+ flag + " in help message.\n";
+ }
+
+ if (!result.isEmpty())
+ System.out.println(result);
+
+ return result;
+ }
+
+ // Test the tool supports legacy option -help, but does
+ // not document it.
+ static String testLegacyFlag(File f, int exitcode) {
+ String result = "";
+ TestResult tr = runToolWithFlag(f, "-help");
+
+ // Check that the tool accepted the flag.
+ if (exitcode == 0 && !tr.isOK()) {
+ System.out.println("failed");
+ result = "failed: " + f.getName() + " -help has exit code " + tr.exitValue + ".\n";
+ }
+
+ // Check there is _no_ documentation of -help.
+ boolean foundFlag = false;
+ for (String y : tr.testOutput) {
+ if (!foundFlag && findFlagInLine(y, "-help")) { // javac
+ foundFlag = true;
+ System.out.println("Found documentation of '-help': '" + y.trim() +"'");
+ }
+ }
+ if (foundFlag) {
+ result += "failed: " + f.getName() + " does document -help " +
+ "in help message. This legacy flag should not be documented.\n";
+ }
+
+ if (!result.isEmpty())
+ System.out.println(result);
+
+ return result;
+ }
+
+ // Test that the tool exits with the exit code expected for
+ // invalid flags. In general, one would expect this to be != 0,
+ // but currently a row of tools exit with 0 in this case.
+ // The output should not ask to get help with flag '-help'.
+ static String testInvalidFlag(File f, String flag, int exitcode, boolean documentsLegacyHelp) {
+ String result = "";
+ TestResult tr = runToolWithFlag(f, flag);
+
+ // Check that the tool did exit with the expected return code.
+ if (!((exitcode == tr.exitValue) ||
+ // Windows reports -1 where unix reports 255.
+ (tr.exitValue < 0 && exitcode == tr.exitValue + 256))) {
+ System.out.println("failed");
+ result = "failed: " + f.getName() + " " + flag + " should not be " +
+ "accepted. But it has exit code " + tr.exitValue + ".\n";
+ }
+
+ if (!documentsLegacyHelp) {
+ // Check there is _no_ documentation of -help.
+ boolean foundFlag = false;
+ for (String y : tr.testOutput) {
+ if (!foundFlag && findFlagInLine(y, "-help")) { // javac
+ foundFlag = true;
+ System.out.println("Found documentation of '-help': '" + y.trim() +"'");
+ }
+ }
+ if (foundFlag) {
+ result += "failed: " + f.getName() + " does document -help " +
+ "in error message. This legacy flag should not be documented.\n";
+ }
+ }
+
+ if (!result.isEmpty())
+ System.out.println(result);
+
+ return result;
+ }
+
+ public static void main(String[] args) {
+ String errorMessage = "";
+
+ // The test analyses the help messages printed. It assumes englisch
+ // help messages. Thus it only works with english locale.
+ if (!isEnglishLocale()) { return; }
+
+ for (File f : new File(JAVA_BIN).listFiles()) {
+ String toolName = f.getName();
+
+ if (notATool(toolName)) {
+ continue;
+ }
+ if (dontTestTool(toolName)) {
+ System.out.println("Skipping test of tool " + toolName +
+ ". Tool has no help message.");
+ continue;
+ }
+
+ ToolHelpSpec tool = getToolHelpSpec(toolName);
+ if (tool == null) {
+ errorMessage += "Tool " + toolName + " not covered by this test. " +
+ "Add specification to jdkTools array!\n";
+ continue;
+ }
+
+ // Test for help flags to be supported.
+ if (tool.supportsQuestionMark == true) {
+ errorMessage += testTool(f, "-?", tool.exitcodeOfHelp);
+ } else {
+ System.out.println("Skip " + tool.toolname + ". It does not support -?.");
+ }
+ if (tool.supportsH == true) {
+ errorMessage += testTool(f, "-h", tool.exitcodeOfHelp);
+ } else {
+ System.out.println("Skip " + tool.toolname + ". It does not support -h.");
+ }
+ if (tool.supportsHelp == true) {
+ errorMessage += testTool(f, "--help", tool.exitcodeOfHelp);
+ } else {
+ System.out.println("Skip " + tool.toolname + ". It does not support --help.");
+ }
+
+ // Check that the return code listing in jdkTools[] is
+ // correct for an invalid flag.
+ if (!tool.dontExecuteWithWrongFlags) {
+ errorMessage += testInvalidFlag(f, "-asdfxgr", tool.exitcodeOfWrongFlag, tool.documentsLegacyHelp);
+ }
+
+ // Test for legacy -help flag.
+ if (!tool.documentsLegacyHelp) {
+ if (tool.supportsLegacyHelp == true) {
+ errorMessage += testLegacyFlag(f, tool.exitcodeOfHelp);
+ } else {
+ if (!tool.dontExecuteWithWrongFlags) {
+ errorMessage += testInvalidFlag(f, "-help", tool.exitcodeOfWrongFlag, false);
+ }
+ }
+ }
+ }
+
+ if (errorMessage.isEmpty()) {
+ System.out.println("All help string tests: PASS");
+ } else {
+ throw new AssertionError("HelpFlagsTest failed:\n" + errorMessage);
+ }
+ }
+}
--- a/test/langtools/ProblemList.txt Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/ProblemList.txt Thu Jan 18 18:58:46 2018 +0000
@@ -37,7 +37,7 @@
# jshell
jdk/jshell/UserJdiUserRemoteTest.java 8173079 linux-all
-jdk/jshell/UserInputTest.java 8169536 generic-all
+jdk/jshell/UserInputTest.java 8169536 generic-all
###########################################################################
#
@@ -54,6 +54,8 @@
tools/javac/annotations/typeAnnotations/referenceinfos/NestedTypes.java 8057687 generic-all emit correct byte code an attributes for type annotations
tools/javac/warnings/suppress/TypeAnnotations.java 8057683 generic-all improve ordering of errors with type annotations
tools/javac/modules/SourceInSymlinkTest.java 8180263 windows-all fails when run on a subst drive
+tools/javac/options/release/ReleaseOptionUnsupported.java 8193784 generic-all temporary until support for --release 11 is worked out
+tools/javac/jvm/VerboseOutTest.java 8194968 windows-all
###########################################################################
#
@@ -76,3 +78,5 @@
###########################################################################
#
# jdeps
+
+tools/jdeprscan/tests/jdk/jdeprscan/TestNotFound.java 8193784 generic-all temporary until support for --release 11 is worked out
--- a/test/langtools/TEST.ROOT Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/TEST.ROOT Thu Jan 18 18:58:46 2018 +0000
@@ -15,7 +15,7 @@
groups=TEST.groups
# Minimum jtreg version
-requiredVersion=4.2 b08
+requiredVersion=4.2 b11
# Use new module options
useNewOptions=true
--- a/test/langtools/jdk/javadoc/doclet/testHelpOption/TestHelpOption.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/jdk/javadoc/doclet/testHelpOption/TestHelpOption.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
/*
* @test
* @bug 4934778 4777599 6553182 8146427 8146475 8175055 8185371
- * @summary Make sure that -help, -helpfile and -nohelp options work correctly.
+ * @summary Make sure that --help, -helpfile and -nohelp options work correctly.
* @author jamieh
* @library ../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
@@ -66,7 +66,7 @@
void testWithOption() {
javadoc("-d", "out1",
"-sourcepath", testSrc,
- "-help",
+ "--help",
testSrc("Sample.java"));
checkExit(Exit.OK);
--- a/test/langtools/jdk/javadoc/tool/CheckResourceKeys.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/jdk/javadoc/tool/CheckResourceKeys.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -117,7 +117,7 @@
}
void usageTests(boolean xflag) {
- String[] argarray = { xflag ? "-X" : "-help" };
+ String[] argarray = { xflag ? "-X" : "--help" };
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
if (jdk.javadoc.internal.tool.Main.execute(argarray, pw) == 0) {
--- a/test/langtools/jdk/javadoc/tool/ToolProviderTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/jdk/javadoc/tool/ToolProviderTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -69,7 +69,7 @@
public void testOneStream() throws Exception {
StringWriter sw = new StringWriter();
try (PrintWriter pw = new PrintWriter(sw)) {
- int rc = javadoc.run(pw, pw, "-help");
+ int rc = javadoc.run(pw, pw, "--help");
if (rc != 0) {
error("unexpected exit code: " + rc);
}
@@ -86,7 +86,7 @@
StringWriter swErr = new StringWriter();
try (PrintWriter pwOut = new PrintWriter(swOut);
PrintWriter pwErr = new PrintWriter(swErr)) {
- int rc = javadoc.run(pwOut, pwErr, "-help");
+ int rc = javadoc.run(pwOut, pwErr, "--help");
if (rc != 0) {
error("unexpected exit code: " + rc);
}
--- a/test/langtools/jdk/jshell/StartOptionTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/jdk/jshell/StartOptionTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -214,7 +214,7 @@
// Test that the usage message is printed
public void testUsage() {
- for (String opt : new String[]{"-h", "--help"}) {
+ for (String opt : new String[]{"-?", "-h", "--help"}) {
startCo(s -> {
assertTrue(s.split("\n").length >= 7, "Not enough usage lines: " + s);
assertTrue(s.startsWith("Usage: jshell <option>..."), "Unexpect usage start: " + s);
--- a/test/langtools/jdk/jshell/ToolShiftTabTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/jdk/jshell/ToolShiftTabTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -23,7 +23,7 @@
/**
* @test
- * @bug 8166334
+ * @bug 8166334 8188894
* @summary test shift-tab shortcuts "fixes"
* @modules
* jdk.jshell/jdk.internal.jshell.tool.resources:open
@@ -107,11 +107,12 @@
public void testFixImport() throws Exception {
doRunTest((inputSink, out) -> {
- inputSink.write("Frame");
- inputSink.write(FIX + "i");
- inputSink.write("1");
- inputSink.write(".WIDTH\n");
- waitOutput(out, "==> 1");
+ do {
+ inputSink.write("Frame");
+ inputSink.write(FIX + "i");
+ inputSink.write("1");
+ inputSink.write(".WIDTH\n");
+ } while (!waitOutput(out, "==> 1", "Results may be incomplete"));
inputSink.write("/import\n");
waitOutput(out, "| import java.awt.Frame");
--- a/test/langtools/jdk/jshell/UITesting.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/jdk/jshell/UITesting.java Thu Jan 18 18:58:46 2018 +0000
@@ -135,8 +135,19 @@
}
protected void waitOutput(StringBuilder out, String expected) {
+ waitOutput(out, expected, null);
+ }
+
+ // Return true if expected is found, false if secondary is found,
+ // otherwise, time out with an IllegalStateException
+ protected boolean waitOutput(StringBuilder out, String expected, String secondary) {
expected = expected.replaceAll("\n", laxLineEndings ? "\r?\n" : System.getProperty("line.separator"));
Pattern expectedPattern = Pattern.compile(expected, Pattern.DOTALL);
+ Pattern secondaryPattern = null;
+ if (secondary != null) {
+ secondary = secondary.replaceAll("\n", laxLineEndings ? "\r?\n" : System.getProperty("line.separator"));
+ secondaryPattern = Pattern.compile(secondary, Pattern.DOTALL);
+ }
synchronized (out) {
long s = System.currentTimeMillis();
@@ -144,7 +155,14 @@
Matcher m = expectedPattern.matcher(out);
if (m.find()) {
out.delete(0, m.end());
- return ;
+ return true;
+ }
+ if (secondaryPattern != null) {
+ m = secondaryPattern.matcher(out);
+ if (m.find()) {
+ out.delete(0, m.end());
+ return false;
+ }
}
long e = System.currentTimeMillis();
if ((e - s) > TIMEOUT) {
--- a/test/langtools/tools/javac/6330997/T6330997.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/javac/6330997/T6330997.java Thu Jan 18 18:58:46 2018 +0000
@@ -32,8 +32,8 @@
* jdk.compiler/com.sun.tools.javac.main
* jdk.compiler/com.sun.tools.javac.util
* @clean T1 T2
- * @compile -source 10 -target 10 T1.java
- * @compile -source 10 -target 10 T2.java
+ * @compile -source 10 -target 11 T1.java
+ * @compile -source 10 -target 11 T2.java
* @run main/othervm T6330997
*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/8194932/Foo.jcod Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,115 @@
+class Foo {
+ 0xCAFEBABE;
+ 0; // minor version
+ 52; // version
+ [] { // Constant Pool
+ ; // first element is empty
+ Method #4 #14; // #1
+ String #15; // #2
+ class #16; // #3
+ class #17; // #4
+ Utf8 "<init>"; // #5
+ Utf8 "()V"; // #6
+ Utf8 "Code"; // #7
+ Utf8 "LineNumberTable"; // #8
+ Utf8 "m"; // #9
+ Utf8 "m2"; // #10
+ Utf8 "()Ljava/lang/String;"; // #11
+ Utf8 "SourceFile"; // #12
+ Utf8 "Foo.java"; // #13
+ NameAndType #5 #6; // #14
+ Utf8 "Hello"; // #15
+ Utf8 "Foo"; // #16
+ Utf8 "java/lang/Object"; // #17
+ } // Constant Pool
+
+ 0x0020; // access
+ #3;// this_cpx
+ #4;// super_cpx
+
+ [] { // Interfaces
+ } // Interfaces
+
+ [] { // fields
+ } // fields
+
+ [] { // methods
+ { // Member
+ 0x0000; // access
+ #5; // name_cpx
+ #6; // sig_cpx
+ [] { // Attributes
+ Attr(#7) { // Code
+ 1; // max_stack
+ 1; // max_locals
+ Bytes[]{
+ 0x2AB70001B1;
+ };
+ [] { // Traps
+ } // end Traps
+ [] { // Attributes
+ Attr(#8) { // LineNumberTable
+ [] { // LineNumberTable
+ 0 1;
+ }
+ } // end LineNumberTable
+ } // Attributes
+ } // end Code
+ } // Attributes
+ } // Member
+ ;
+ { // Member
+ 0x0000; // access
+ #9; // name_cpx
+ #6; // sig_cpx
+ [] { // Attributes
+ Attr(#7) { // Code
+ 0; // max_stack
+ 1; // max_locals
+ Bytes[]{
+ 0xB1;
+ };
+ [] { // Traps
+ } // end Traps
+ [] { // Attributes
+ Attr(#8) { // LineNumberTable
+ [] { // LineNumberTable
+ 0 2;
+ }
+ } // end LineNumberTable
+ } // Attributes
+ } // end Code
+ } // Attributes
+ } // Member
+ ;
+ { // Member
+ 0x0000; // access
+ #9; // name_cpx
+ #11; // sig_cpx
+ [] { // Attributes
+ Attr(#7) { // Code
+ 1; // max_stack
+ 1; // max_locals
+ Bytes[]{
+ 0x1202B0;
+ };
+ [] { // Traps
+ } // end Traps
+ [] { // Attributes
+ Attr(#8) { // LineNumberTable
+ [] { // LineNumberTable
+ 0 3;
+ }
+ } // end LineNumberTable
+ } // Attributes
+ } // end Code
+ } // Attributes
+ } // Member
+ } // methods
+
+ [] { // Attributes
+ Attr(#12) { // SourceFile
+ #13;
+ } // end SourceFile
+ } // Attributes
+} // end class Foo
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/8194932/T8194932.java Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,13 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8194932
+ * @summary no ambuguity error is emitted if classfile contains two identical methods with different return types
+ * @build Foo
+ * @compile/fail/ref=T8194932.out -XDrawDiagnostics T8194932.java
+ */
+
+class T8194932 {
+ void test(Foo foo) {
+ foo.m(); //should get an ambiguity here
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/8194932/T8194932.out Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,2 @@
+T8194932.java:11:12: compiler.err.ref.ambiguous: m, kindname.method, m(), Foo, kindname.method, m(), Foo
+1 error
--- a/test/langtools/tools/javac/BadCovar.out Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/javac/BadCovar.out Thu Jan 18 18:58:46 2018 +0000
@@ -1,2 +1,2 @@
-BadCovar.java:22:10: compiler.err.types.incompatible.diff.ret: bad.covar.B, bad.covar.A, f()
+BadCovar.java:22:10: compiler.err.types.incompatible: bad.covar.B, bad.covar.A, (compiler.misc.incompatible.diff.ret: f, )
1 error
--- a/test/langtools/tools/javac/InconsistentInheritedSignature.out Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/javac/InconsistentInheritedSignature.out Thu Jan 18 18:58:46 2018 +0000
@@ -1,2 +1,2 @@
-InconsistentInheritedSignature.java:17:1: compiler.err.types.incompatible.diff.ret: I2, I1, f()
+InconsistentInheritedSignature.java:17:1: compiler.err.types.incompatible: I2, I1, (compiler.misc.incompatible.diff.ret: f, )
1 error
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/MethodParameters/ClassReaderTest/ClassReaderTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2017 Google Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8007720 8177486
+ * @summary class reading of named parameters
+ * @library /tools/javac/lib
+ * @modules java.compiler
+ * jdk.compiler
+ * @compile -parameters ClassReaderTest.java MethodParameterProcessor.java
+ * @compile/process/ref=ClassReaderTest.out -proc:only -processor MethodParameterProcessor ClassReaderTest ClassReaderTest$I ClassReaderTest$E
+ */
+
+import static java.lang.annotation.RetentionPolicy.CLASS;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+
+public class ClassReaderTest {
+
+ @Retention(RUNTIME)
+ @interface RuntimeAnnoOne {
+ int value() default 0;
+ }
+
+ @Retention(RUNTIME)
+ @interface RuntimeAnnoTwo {
+ int value() default 0;
+ }
+
+ @Retention(CLASS)
+ @interface ClassAnno {
+ int value() default 0;
+ }
+
+ @MethodParameterProcessor.ParameterNames
+ void f(
+ @RuntimeAnnoOne(1) @RuntimeAnnoTwo(2) @ClassAnno(3) int a,
+ @RuntimeAnnoOne(4) @RuntimeAnnoTwo(5) @ClassAnno(6) String b) {}
+
+ class I {
+ @MethodParameterProcessor.ParameterNames
+ I(@ClassAnno(7) int d, @RuntimeAnnoOne(8) String e, Object o) {}
+ }
+
+ enum E {
+ ONE(42, "");
+
+ @MethodParameterProcessor.ParameterNames
+ E(int x, @RuntimeAnnoOne(9) String s) {}
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/MethodParameters/ClassReaderTest/ClassReaderTest.out Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,3 @@
+Note: ClassReaderTest.E.<init>(x, @ClassReaderTest.RuntimeAnnoOne(9) s)
+Note: ClassReaderTest.I.<init>(@ClassReaderTest.ClassAnno(7) d, @ClassReaderTest.RuntimeAnnoOne(8) e, o)
+Note: ClassReaderTest.f(@ClassReaderTest.ClassAnno(3) @ClassReaderTest.RuntimeAnnoOne(1) @ClassReaderTest.RuntimeAnnoTwo(2) a, @ClassReaderTest.ClassAnno(6) @ClassReaderTest.RuntimeAnnoOne(4) @ClassReaderTest.RuntimeAnnoTwo(5) b)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/MethodParameters/ClassReaderTest/MethodParameterProcessor.java Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2017 Google Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import static java.util.stream.Collectors.joining;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.VariableElement;
+import javax.lang.model.element.TypeElement;
+import javax.tools.Diagnostic.Kind;
+
+@SupportedAnnotationTypes("MethodParameterProcessor.ParameterNames")
+public class MethodParameterProcessor extends JavacTestingAbstractProcessor {
+
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
+ @interface ParameterNames {
+ String[] value() default {};
+ }
+
+ @Override
+ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+ for (Element element : roundEnv.getElementsAnnotatedWith(ParameterNames.class)) {
+ ExecutableElement exec = (ExecutableElement)element;
+ String message = printNamesAndAnnotations(exec);
+ messager.printMessage(Kind.NOTE, message);
+ }
+ return false;
+ }
+
+ private String printNamesAndAnnotations(ExecutableElement exec) {
+ return String.format("%s.%s(%s)",
+ exec.getEnclosingElement(),
+ exec.getSimpleName(),
+ exec.getParameters().stream().map(this::printParameter).collect(joining(", ")));
+ }
+
+ private String printParameter(VariableElement param) {
+ return param.getAnnotationMirrors().stream().map(String::valueOf).collect(joining(" "))
+ + (param.getAnnotationMirrors().isEmpty() ? "" : " ")
+ + param.getSimpleName();
+ }
+}
--- a/test/langtools/tools/javac/OverrideChecks/InconsistentReturn.out Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/javac/OverrideChecks/InconsistentReturn.out Thu Jan 18 18:58:46 2018 +0000
@@ -1,2 +1,2 @@
-InconsistentReturn.java:17:1: compiler.err.types.incompatible.diff.ret: I2, I1, f()
+InconsistentReturn.java:17:1: compiler.err.types.incompatible: I2, I1, (compiler.misc.incompatible.diff.ret: f, )
1 error
--- a/test/langtools/tools/javac/api/T6265137.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/javac/api/T6265137.java Thu Jan 18 18:58:46 2018 +0000
@@ -52,7 +52,7 @@
String srcdir = System.getProperty("test.src");
Iterable<? extends JavaFileObject> files =
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(srcdir, "T6265137a.java")));
- javac.getTask(null, fm, dl, Arrays.asList("-target","10"), null, files).call();
+ javac.getTask(null, fm, dl, Arrays.asList("-target","11"), null, files).call();
}
}
}
--- a/test/langtools/tools/javac/api/T6395981.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/javac/api/T6395981.java Thu Jan 18 18:58:46 2018 +0000
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6395981 6458819 7025784 8028543 8028544
+ * @bug 6395981 6458819 7025784 8028543 8028544 8193291
* @summary JavaCompilerTool and Tool must specify version of JLS and JVMS
* @author Peter von der Ah\u00e9
* @modules java.compiler
@@ -31,7 +31,7 @@
* @run main/fail T6395981
* @run main/fail T6395981 RELEASE_3 RELEASE_5 RELEASE_6
* @run main/fail T6395981 RELEASE_0 RELEASE_1 RELEASE_2 RELEASE_3 RELEASE_4 RELEASE_5 RELEASE_6
- * @run main T6395981 RELEASE_3 RELEASE_4 RELEASE_5 RELEASE_6 RELEASE_7 RELEASE_8 RELEASE_9 RELEASE_10
+ * @run main T6395981 RELEASE_3 RELEASE_4 RELEASE_5 RELEASE_6 RELEASE_7 RELEASE_8 RELEASE_9 RELEASE_10 RELEASE_11
*/
import java.util.EnumSet;
--- a/test/langtools/tools/javac/classfiles/ClassVersionChecker.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/javac/classfiles/ClassVersionChecker.java Thu Jan 18 18:58:46 2018 +0000
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 7157626 8001112 8188870
+ * @bug 7157626 8001112 8188870 8173382
* @summary Test major version for all legal combinations for -source and -target
* @author sgoel
*
@@ -38,7 +38,7 @@
public class ClassVersionChecker {
int errors;
- String[] jdk = {"", "1.6", "1.7", "1.8", "1.9", "1.10"};
+ String[] jdk = {"", "1.6", "1.7", "1.8", "1.9", "1.10", "11"};
File javaFile = null;
public static void main(String[] args) throws Throwable {
@@ -58,11 +58,12 @@
* -1 => invalid combinations
*/
int[][] ver =
- {{54, -1, -1, -1, -1, -1},
- {54, 50, 51, 52, 53, 54},
- {54, -1, 51, 52, 53, 54},
- {54, -1, -1, 52, 53, 54},
- {54, -1, -1, -1, 53, 54}};
+ {{55, -1, -1, -1, -1, -1, -1},
+ {55, 50, 51, 52, 53, 54, 55},
+ {55, -1, 51, 52, 53, 54, 55},
+ {55, -1, -1, 52, 53, 54, 55},
+ {55, -1, -1, -1, 53, 54, 55},
+ {55, -1, -1, -1, -1, 54, 55}};
// Loop to run all possible combinations of source/target values
for (int i = 0; i< ver.length; i++) {
--- a/test/langtools/tools/javac/defaultMethods/Neg01.out Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/javac/defaultMethods/Neg01.out Thu Jan 18 18:58:46 2018 +0000
@@ -1,2 +1,2 @@
-Neg01.java:14:12: compiler.err.types.incompatible.unrelated.defaults: kindname.class, Neg01.AB, m, , Neg01.IA, Neg01.IB
+Neg01.java:14:12: compiler.err.types.incompatible: Neg01.IA, Neg01.IB, (compiler.misc.incompatible.unrelated.defaults: kindname.class, Neg01.AB, m, , Neg01.IA, Neg01.IB)
1 error
--- a/test/langtools/tools/javac/defaultMethods/Neg02.out Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/javac/defaultMethods/Neg02.out Thu Jan 18 18:58:46 2018 +0000
@@ -1,2 +1,2 @@
-Neg02.java:16:13: compiler.err.types.incompatible.unrelated.defaults: kindname.class, Neg02.X, m, , Neg02.A, Neg02.B
+Neg02.java:16:13: compiler.err.types.incompatible: Neg02.A, Neg02.B, (compiler.misc.incompatible.unrelated.defaults: kindname.class, Neg02.X, m, , Neg02.A, Neg02.B)
1 error
--- a/test/langtools/tools/javac/defaultMethods/Neg14.out Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/javac/defaultMethods/Neg14.out Thu Jan 18 18:58:46 2018 +0000
@@ -1,2 +1,2 @@
-Neg14.java:10:14: compiler.err.types.incompatible.abstract.default: kindname.class, Neg14.AB, m, , Neg14.IB, Neg14.IA
+Neg14.java:10:14: compiler.err.types.incompatible: Neg14.IB, Neg14.IA, (compiler.misc.incompatible.abstract.default: kindname.class, Neg14.AB, m, , Neg14.IB, Neg14.IA)
1 error
--- a/test/langtools/tools/javac/diags/examples/IncompatibleDescsInFunctionalIntf.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/javac/diags/examples/IncompatibleDescsInFunctionalIntf.java Thu Jan 18 18:58:46 2018 +0000
@@ -21,7 +21,8 @@
* questions.
*/
-// key: compiler.err.types.incompatible.diff.ret
+// key: compiler.err.types.incompatible
+// key: compiler.misc.incompatible.diff.ret
// key: compiler.err.prob.found.req
// key: compiler.misc.incompatible.descs.in.functional.intf
// key: compiler.misc.descriptor
--- a/test/langtools/tools/javac/diags/examples/TypesIncompatible.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/javac/diags/examples/TypesIncompatible.java Thu Jan 18 18:58:46 2018 +0000
@@ -21,7 +21,8 @@
* questions.
*/
-// key: compiler.err.types.incompatible.diff.ret
+// key: compiler.err.types.incompatible
+// key: compiler.misc.incompatible.diff.ret
interface A {
int m();
--- a/test/langtools/tools/javac/diags/examples/TypesIncompatibleAbstractDefault.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/javac/diags/examples/TypesIncompatibleAbstractDefault.java Thu Jan 18 18:58:46 2018 +0000
@@ -21,7 +21,8 @@
* questions.
*/
-// key: compiler.err.types.incompatible.abstract.default
+// key: compiler.err.types.incompatible
+// key: compiler.misc.incompatible.abstract.default
class TypesIncompatibleAbstractDefault {
interface A {
--- a/test/langtools/tools/javac/diags/examples/TypesIncompatibleUnrelatedDefaults.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/javac/diags/examples/TypesIncompatibleUnrelatedDefaults.java Thu Jan 18 18:58:46 2018 +0000
@@ -21,7 +21,8 @@
* questions.
*/
-// key: compiler.err.types.incompatible.unrelated.defaults
+// key: compiler.err.types.incompatible
+// key: compiler.misc.incompatible.unrelated.defaults
class TypesIncompatibleUnrelatedDefaults {
interface A {
--- a/test/langtools/tools/javac/generics/6294779/T6294779c.out Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/javac/generics/6294779/T6294779c.out Thu Jan 18 18:58:46 2018 +0000
@@ -1,2 +1,2 @@
-T6294779c.java:29:5: compiler.err.types.incompatible.diff.ret: T6294779c.I2, T6294779c.I1, get()
+T6294779c.java:29:5: compiler.err.types.incompatible: T6294779c.I2, T6294779c.I1, (compiler.misc.incompatible.diff.ret: get, )
1 error
--- a/test/langtools/tools/javac/generics/abstract/T4717181c.out Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/javac/generics/abstract/T4717181c.out Thu Jan 18 18:58:46 2018 +0000
@@ -1,2 +1,2 @@
-T4717181c.java:15:21: compiler.err.types.incompatible.diff.ret: T4717181c.A<java.lang.Integer>, T4717181c.A<java.lang.Integer>, f(java.lang.Integer)
+T4717181c.java:15:21: compiler.err.types.incompatible: T4717181c.A<java.lang.Integer>, T4717181c.A<java.lang.Integer>, (compiler.misc.incompatible.diff.ret: f, java.lang.Integer)
1 error
--- a/test/langtools/tools/javac/generics/rawOverride/7157798/Test3.out Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/javac/generics/rawOverride/7157798/Test3.out Thu Jan 18 18:58:46 2018 +0000
@@ -1,6 +1,6 @@
-Test3.java:14:1: compiler.err.types.incompatible.diff.ret: B, A, m()
-Test3.java:19:1: compiler.err.types.incompatible.diff.ret: D, C, m()
-Test3.java:27:1: compiler.err.types.incompatible.diff.ret: E<T>, B, m()
-Test3.java:33:1: compiler.err.types.incompatible.diff.ret: F<V>, E<U>, m()
-Test3.java:37:1: compiler.err.types.incompatible.diff.ret: F<V>, E<U>, m()
+Test3.java:14:1: compiler.err.types.incompatible: B, A, (compiler.misc.incompatible.diff.ret: m, )
+Test3.java:19:1: compiler.err.types.incompatible: D, C, (compiler.misc.incompatible.diff.ret: m, )
+Test3.java:27:1: compiler.err.types.incompatible: E<T>, B, (compiler.misc.incompatible.diff.ret: m, )
+Test3.java:33:1: compiler.err.types.incompatible: F<V>, E<U>, (compiler.misc.incompatible.diff.ret: m, )
+Test3.java:37:1: compiler.err.types.incompatible: F<V>, E<U>, (compiler.misc.incompatible.diff.ret: m, )
5 errors
--- a/test/langtools/tools/javac/generics/typevars/4856983/T4856983a.out Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/javac/generics/typevars/4856983/T4856983a.out Thu Jan 18 18:58:46 2018 +0000
@@ -1,2 +1,2 @@
-T4856983a.java:13:6: compiler.err.types.incompatible.diff.ret: I2, I1, m()
+T4856983a.java:13:6: compiler.err.types.incompatible: I2, I1, (compiler.misc.incompatible.diff.ret: m, )
1 error
--- a/test/langtools/tools/javac/generics/typevars/4856983/T4856983b.out Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/javac/generics/typevars/4856983/T4856983b.out Thu Jan 18 18:58:46 2018 +0000
@@ -1,2 +1,2 @@
-T4856983b.java:12:24: compiler.err.types.incompatible.diff.ret: I2, I1, m()
+T4856983b.java:12:24: compiler.err.types.incompatible: I2, I1, (compiler.misc.incompatible.diff.ret: m, )
1 error
--- a/test/langtools/tools/javac/generics/typevars/6199146/T6199146.out Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/javac/generics/typevars/6199146/T6199146.out Thu Jan 18 18:58:46 2018 +0000
@@ -1,2 +1,2 @@
-T6199146.java:9:25: compiler.err.types.incompatible.diff.ret: T6199146.I2, T6199146.I1, getFoo()
+T6199146.java:9:25: compiler.err.types.incompatible: T6199146.I2, T6199146.I1, (compiler.misc.incompatible.diff.ret: getFoo, )
1 error
--- a/test/langtools/tools/javac/generics/wildcards/7034495/T7034495.out Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/javac/generics/wildcards/7034495/T7034495.out Thu Jan 18 18:58:46 2018 +0000
@@ -1,2 +1,2 @@
-T7034495.java:40:17: compiler.err.types.incompatible.diff.ret: T7034495.B<compiler.misc.type.captureof: 1, ?>, T7034495.A<compiler.misc.type.captureof: 2, ?>, foo()
+T7034495.java:40:17: compiler.err.types.incompatible: T7034495.B<compiler.misc.type.captureof: 1, ?>, T7034495.A<compiler.misc.type.captureof: 2, ?>, (compiler.misc.incompatible.diff.ret: foo, )
1 error
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/jvm/VerboseOutTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8194893
+ * @summary javac -verbose prints wrong paths for output files
+ * @modules jdk.compiler
+ * @run main VerboseOutTest
+ */
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.spi.ToolProvider;
+
+public class VerboseOutTest {
+ public static void main(String... args) throws Exception {
+ new VerboseOutTest().run();
+ }
+
+ void run() throws Exception {
+ String className = getClass().getName();
+ Path testSrc = Paths.get(System.getProperty("test.src"));
+ Path file = testSrc.resolve(className + ".java");
+ ToolProvider javac = ToolProvider.findFirst("javac").orElseThrow();
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw, true);
+ int rc = javac.run(pw, pw,
+ "-d", ".",
+ "-verbose",
+ file.toString());
+ String log = sw.toString();
+ System.out.println(log);
+ if (rc != 0) {
+ throw new Exception("compilation failed: rc=" + rc);
+ }
+ String expected = "[wrote ./" + className + ".class]";
+ if (!log.contains(expected)) {
+ throw new Exception("expected output not found: " + expected);
+ }
+ }
+}
+
--- a/test/langtools/tools/javac/lambda/BadConv04.out Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/javac/lambda/BadConv04.out Thu Jan 18 18:58:46 2018 +0000
@@ -1,3 +1,3 @@
-BadConv04.java:19:5: compiler.err.types.incompatible.diff.ret: BadConv04.I2, BadConv04.I1, m()
+BadConv04.java:19:5: compiler.err.types.incompatible: BadConv04.I2, BadConv04.I1, (compiler.misc.incompatible.diff.ret: m, )
BadConv04.java:21:13: compiler.err.prob.found.req: (compiler.misc.incompatible.descs.in.functional.intf: kindname.interface, BadConv04.SAM,{(compiler.misc.descriptor: m, , long, ),(compiler.misc.descriptor: m, , int, )})
2 errors
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lambda/T8195598.java Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8195598
+ * @summary Reference to overloaded method is ambiguous with 3 methods but works with 2
+ * @compile T8195598.java
+ */
+
+import java.util.concurrent.*;
+import java.util.function.*;
+
+class T8195598 {
+ public CompletableFuture<?> test() {
+ return ok(() -> System.out.append("aaa"));
+ }
+ public <T> CompletableFuture<T> ok(Supplier<T> action) {
+ return CompletableFuture.supplyAsync(action);
+ }
+ public <T> CompletableFuture<T> ok(T body) {
+ return CompletableFuture.completedFuture(body);
+ }
+ public CompletableFuture<Void> ok(Runnable action) {
+ return CompletableFuture.runAsync(action);
+ }
+}
--- a/test/langtools/tools/javac/lambda/bridge/template_tests/BridgeMethodsTemplateTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/javac/lambda/bridge/template_tests/BridgeMethodsTemplateTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -1001,18 +1001,18 @@
public void testA5() throws IOException, ReflectiveOperationException {
compileSpec("C(A(Id0),Jd0)",
- "compiler.err.types.incompatible.unrelated.defaults");
+ "compiler.err.types.incompatible");
}
public void testA6() throws IOException, ReflectiveOperationException {
compileSpec("C(A(Ia0,Jd0))",
"compiler.err.does.not.override.abstract",
- "compiler.err.types.incompatible.abstract.default");
+ "compiler.err.types.incompatible");
}
public void testA7() throws IOException, ReflectiveOperationException {
compileSpec("C(A(Id0,Jd0))",
- "compiler.err.types.incompatible.unrelated.defaults");
+ "compiler.err.types.incompatible");
}
public void testA8() throws IOException, ReflectiveOperationException {
--- a/test/langtools/tools/javac/lambda/funcInterfaces/NonSAM2.out Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/javac/lambda/funcInterfaces/NonSAM2.out Thu Jan 18 18:58:46 2018 +0000
@@ -1,4 +1,4 @@
-NonSAM2.java:13:1: compiler.err.types.incompatible.diff.ret: Bar1, Foo1, getAge(java.lang.String)
+NonSAM2.java:13:1: compiler.err.types.incompatible: Bar1, Foo1, (compiler.misc.incompatible.diff.ret: getAge, java.lang.String)
NonSAM2.java:15:1: compiler.err.name.clash.same.erasure.no.override: getOldest, java.util.List<?>, C, getOldest, java.util.List<java.lang.Number>, A
NonSAM2.java:17:1: compiler.err.name.clash.same.erasure.no.override: getOldest, java.util.List<java.lang.Integer>, D, getOldest, java.util.List<java.lang.Number>, A
NonSAM2.java:21:1: compiler.err.name.clash.same.erasure.no.override: m, T2, Bar2, m, T1, Foo2
--- a/test/langtools/tools/javac/lib/DPrinter.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/javac/lib/DPrinter.java Thu Jan 18 18:58:46 2018 +0000
@@ -1233,7 +1233,6 @@
public Void visitMethodSymbol(MethodSymbol sym, Void ignore) {
// code
printList("params", sym.params);
- printList("savedParameterNames", sym.savedParameterNames);
return visitSymbol(sym, null);
}
--- a/test/langtools/tools/javac/lib/JavacTestingAbstractProcessor.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/javac/lib/JavacTestingAbstractProcessor.java Thu Jan 18 18:58:46 2018 +0000
@@ -110,7 +110,7 @@
* corresponding platform visitor type.
*/
- @SupportedSourceVersion(RELEASE_10)
+ @SupportedSourceVersion(RELEASE_11)
public static abstract class AbstractAnnotationValueVisitor<R, P> extends AbstractAnnotationValueVisitor9<R, P> {
/**
@@ -121,7 +121,7 @@
}
}
- @SupportedSourceVersion(RELEASE_10)
+ @SupportedSourceVersion(RELEASE_11)
public static abstract class AbstractElementVisitor<R, P> extends AbstractElementVisitor9<R, P> {
/**
* Constructor for concrete subclasses to call.
@@ -131,7 +131,7 @@
}
}
- @SupportedSourceVersion(RELEASE_10)
+ @SupportedSourceVersion(RELEASE_11)
public static abstract class AbstractTypeVisitor<R, P> extends AbstractTypeVisitor9<R, P> {
/**
* Constructor for concrete subclasses to call.
@@ -141,7 +141,7 @@
}
}
- @SupportedSourceVersion(RELEASE_10)
+ @SupportedSourceVersion(RELEASE_11)
public static class ElementKindVisitor<R, P> extends ElementKindVisitor9<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
@@ -162,7 +162,7 @@
}
}
- @SupportedSourceVersion(RELEASE_10)
+ @SupportedSourceVersion(RELEASE_11)
public static class ElementScanner<R, P> extends ElementScanner9<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
@@ -181,7 +181,7 @@
}
}
- @SupportedSourceVersion(RELEASE_10)
+ @SupportedSourceVersion(RELEASE_11)
public static class SimpleAnnotationValueVisitor<R, P> extends SimpleAnnotationValueVisitor9<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
@@ -202,7 +202,7 @@
}
}
- @SupportedSourceVersion(RELEASE_10)
+ @SupportedSourceVersion(RELEASE_11)
public static class SimpleElementVisitor<R, P> extends SimpleElementVisitor9<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
@@ -223,7 +223,7 @@
}
}
- @SupportedSourceVersion(RELEASE_10)
+ @SupportedSourceVersion(RELEASE_11)
public static class SimpleTypeVisitor<R, P> extends SimpleTypeVisitor9<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
@@ -244,7 +244,7 @@
}
}
- @SupportedSourceVersion(RELEASE_10)
+ @SupportedSourceVersion(RELEASE_11)
public static class TypeKindVisitor<R, P> extends TypeKindVisitor9<R, P> {
/**
* Constructor for concrete subclasses to call; uses {@code null}
--- a/test/langtools/tools/javac/miranda/4711056/T1.out Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/javac/miranda/4711056/T1.out Thu Jan 18 18:58:46 2018 +0000
@@ -1,2 +1,2 @@
-T4.java:3:10: compiler.err.types.incompatible.diff.ret: iclss01004_2, iclss01004_1, foo(int)
+T4.java:3:10: compiler.err.types.incompatible: iclss01004_2, iclss01004_1, (compiler.misc.incompatible.diff.ret: foo, int)
1 error
--- a/test/langtools/tools/javac/processing/model/TestSourceVersion.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/javac/processing/model/TestSourceVersion.java Thu Jan 18 18:58:46 2018 +0000
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 7025809 8028543 6415644 8028544 8029942 8187951
+ * @bug 7025809 8028543 6415644 8028544 8029942 8187951 8193291
* @summary Test latest, latestSupported, underscore as keyword, etc.
* @author Joseph D. Darcy
* @modules java.compiler
@@ -46,7 +46,7 @@
}
private static void testLatestSupported() {
- if (SourceVersion.latest() != RELEASE_10 ||
+ if (SourceVersion.latest() != RELEASE_11 ||
SourceVersion.latestSupported() != RELEASE_10)
throw new RuntimeException("Unexpected release value(s) found:\n" +
"latest:\t" + SourceVersion.latest() + "\n" +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/processing/warnings/TypeAlreadyExists/A.java Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2017, Google Inc. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+public class A {}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/processing/warnings/TypeAlreadyExists/B.java Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2017, Google Inc. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+class B {
+ A a;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/processing/warnings/TypeAlreadyExists/TestProcTypeAlreadyExistsWarning.java Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2017, Google Inc. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8193216
+ * @summary Filer should warn if processors redefine symbols from the classpath or sourcepath
+ * @library /tools/javac/lib
+ * @modules java.compiler
+ * jdk.compiler
+ * @build JavacTestingAbstractProcessor TestProcTypeAlreadyExistsWarning
+ * @compile A.java
+ * @compile/ref=warn.out -XDrawDiagnostics -Xlint:processing -processor TestProcTypeAlreadyExistsWarning B.java
+ */
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+
+import java.io.IOError;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Set;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.element.TypeElement;
+
+@SupportedAnnotationTypes("*")
+public class TestProcTypeAlreadyExistsWarning extends JavacTestingAbstractProcessor {
+
+ int round = 0;
+
+ @Override
+ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+ round++;
+
+ if (round == 1) {
+ try (OutputStream os =
+ processingEnv.getFiler().createSourceFile("A").openOutputStream()) {
+ os.write("class A {}".getBytes(UTF_8));
+ } catch (IOException e) {
+ throw new IOError(e);
+ }
+ }
+
+ return false;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/processing/warnings/TypeAlreadyExists/warn.out Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,2 @@
+- compiler.warn.proc.type.already.exists: A
+1 warning
--- a/test/langtools/tools/javac/profiles/ProfileOptionTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/javac/profiles/ProfileOptionTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -149,6 +149,7 @@
break;
case JDK1_9:
case JDK1_10:
+ case JDK1_11:
if (p == Profile.DEFAULT)
break;
if (ise == null)
--- a/test/langtools/tools/javac/versions/Versions.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/javac/versions/Versions.java Thu Jan 18 18:58:46 2018 +0000
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4981566 5028634 5094412 6304984 7025786 7025789 8001112 8028545 8000961 8030610 8028546 8188870
+ * @bug 4981566 5028634 5094412 6304984 7025786 7025789 8001112 8028545 8000961 8030610 8028546 8188870 8173382 8173382
* @summary Check interpretation of -target and -source options
* @modules java.compiler
* jdk.compiler
@@ -64,28 +64,35 @@
String TC = "";
System.out.println("Version.java: Starting");
- check("54.0");
- check("54.0", "-source 1.6");
- check("54.0", "-source 1.7");
- check("54.0", "-source 1.8");
- check("54.0", "-source 1.9");
- check("54.0", "-source 1.10");
+ check("55.0");
+ check("55.0", "-source 1.6");
+ check("55.0", "-source 1.7");
+ check("55.0", "-source 1.8");
+ check("55.0", "-source 1.9");
+ check("55.0", "-source 1.10");
+ check("55.0", "-source 11");
- check_source_target("50.0", "6", "6");
- check_source_target("51.0", "6", "7");
- check_source_target("51.0", "7", "7");
- check_source_target("52.0", "6", "8");
- check_source_target("52.0", "7", "8");
- check_source_target("52.0", "8", "8");
- check_source_target("53.0", "6", "9");
- check_source_target("53.0", "7", "9");
- check_source_target("53.0", "8", "9");
- check_source_target("53.0", "9", "9");
- check_source_target("54.0", "6", "10");
- check_source_target("54.0", "7", "10");
- check_source_target("54.0", "8", "10");
- check_source_target("54.0", "9", "10");
- check_source_target("54.0", "10", "10");
+ check_source_target(true, "50.0", "6", "6");
+ check_source_target(true, "51.0", "6", "7");
+ check_source_target(true, "51.0", "7", "7");
+ check_source_target(true, "52.0", "6", "8");
+ check_source_target(true, "52.0", "7", "8");
+ check_source_target(true, "52.0", "8", "8");
+ check_source_target(true, "53.0", "6", "9");
+ check_source_target(true, "53.0", "7", "9");
+ check_source_target(true, "53.0", "8", "9");
+ check_source_target(true, "53.0", "9", "9");
+ check_source_target(true, "54.0", "6", "10");
+ check_source_target(true, "54.0", "7", "10");
+ check_source_target(true, "54.0", "8", "10");
+ check_source_target(true, "54.0", "9", "10");
+ check_source_target(true, "54.0", "10", "10");
+ check_source_target(false, "55.0", "6", "11");
+ check_source_target(false, "55.0", "7", "11");
+ check_source_target(false, "55.0", "8", "11");
+ check_source_target(false, "55.0", "9", "11");
+ check_source_target(false, "55.0", "10", "11");
+ check_source_target(false, "55.0", "11", "11");
checksrc16("-source 1.6");
checksrc16("-source 6");
@@ -108,8 +115,9 @@
checksrc110("-source 10");
checksrc110("-source 1.10", "-target 1.10");
checksrc110("-source 10", "-target 10");
- checksrc110("-target 1.10");
- checksrc110("-target 10");
+ checksrc111("-source 11");
+ checksrc111("-source 11", "-target 11");
+ checksrc111("-target 11");
fail("-source 7", "-target 1.6", "Base.java");
fail("-source 8", "-target 1.6", "Base.java");
@@ -118,6 +126,8 @@
fail("-source 9", "-target 1.8", "Base.java");
fail("-source 10", "-target 1.7", "Base.java");
fail("-source 10", "-target 1.8", "Base.java");
+ fail("-source 11", "-target 1.9", "Base.java");
+ fail("-source 11", "-target 1.10", "Base.java");
fail("-source 1.5", "-target 1.5", "Base.java");
fail("-source 1.4", "-target 1.4", "Base.java");
@@ -139,20 +149,24 @@
System.out.printf("\n", fname);
}
- protected void check_source_target(String... args) {
+ protected void check_source_target(boolean dotOne, String... args) {
printargs("check_source_target", args);
- check_target(args[0], args[1], args[2]);
- check_target(args[0], "1." + args[1], args[2]);
+ check_target(dotOne, args[0], args[1], args[2]);
+ if (dotOne) {
+ check_target(dotOne, args[0], "1." + args[1], args[2]);
+ }
}
- protected void check_target(String... args) {
+ protected void check_target(boolean dotOne, String... args) {
check(args[0], "-source " + args[1], "-target " + args[2]);
- check(args[0], "-source " + args[1], "-target 1." + args[2]);
+ if (dotOne) {
+ check(args[0], "-source " + args[1], "-target 1." + args[2]);
+ }
}
protected void check(String major, String... args) {
printargs("check", args);
- List<String> jcargs = new ArrayList<String>();
+ List<String> jcargs = new ArrayList<>();
jcargs.add("-Xlint:-options");
// add in args conforming to List requrements of JavaCompiler
@@ -207,6 +221,8 @@
pass(newargs);
newargs[asize] = "New18.java";
pass(newargs);
+ newargs[asize] = "New110.java";
+ fail(newargs);
}
protected void checksrc19(String... args) {
@@ -216,7 +232,20 @@
protected void checksrc110(String... args) {
printargs("checksrc110", args);
- checksrc19(args);
+ int asize = args.length;
+ String[] newargs = new String[asize+1];
+ System.arraycopy(args, 0, newargs,0 , asize);
+ newargs[asize] = "New17.java";
+ pass(newargs);
+ newargs[asize] = "New18.java";
+ pass(newargs);
+ newargs[asize] = "New110.java";
+ pass(newargs);
+ }
+
+ protected void checksrc111(String... args) {
+ printargs("checksrc111", args);
+ checksrc110(args);
}
protected void pass(String... args) {
@@ -347,6 +376,17 @@
"} \n"
);
+ /*
+ * Create a file with a new feature in 1.10, not in 1.9 : var
+ */
+ writeSourceFile("New110.java",
+ "public class New110 { \n" +
+ " void m() { \n" +
+ " var tmp = new Thread(() -> { }); \n" +
+ " } \n" +
+ "} \n"
+ );
+
}
protected boolean checkClassFileVersion
--- a/test/langtools/tools/javap/InvalidOptions.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/javap/InvalidOptions.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,7 @@
void run() throws Exception {
test(2, "-b", "Error: unknown option: -b",
"Usage: javap <options> <classes>",
- "use -help for a list of possible options");
+ "use --help for a list of possible options");
if (errorCount > 0)
throw new Exception(errorCount + " errors received");
}
--- a/test/langtools/tools/jdeps/MultiReleaseJar.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/jdeps/MultiReleaseJar.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -118,7 +118,7 @@
checkResult(r, false,
"Error: unknown option: -multi-release",
"Usage: jdeps <options> <path",
- "use -h, -?, -help, or --help"
+ "use --help"
);
r = run("jdeps -v -R -cp Version.jar --multi-release 9 test/Main.class");
--- a/test/langtools/tools/jdeps/jdkinternals/RemovedJDKInternals.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/jdeps/jdkinternals/RemovedJDKInternals.java Thu Jan 18 18:58:46 2018 +0000
@@ -85,7 +85,8 @@
.reference("p.Main", "java.lang.Object", "java.base")
.reference("p.Main", "java.util.Iterator", "java.base")
.reference("p.S", "java.lang.Object", "java.base")
- .jdkInternal("p.Main", "sun.reflect.Reflection", "jdk.unsupported")
+ .jdkInternal("p.Main", "sun.reflect.ReflectionFactory", "jdk.unsupported")
+ .removedJdkInternal("p.Main", "sun.reflect.Reflection")
.removedJdkInternal("p.Main", "com.sun.image.codec.jpeg.JPEGCodec")
.removedJdkInternal("p.Main", "sun.misc.Service")
.removedJdkInternal("p.Main", "sun.misc.SoftCache")
@@ -118,7 +119,8 @@
"com.sun.image.codec.jpeg.JPEGCodec", "Use javax.imageio @since 1.4",
"sun.misc.Service", "Use java.util.ServiceLoader @since 1.6",
"sun.misc.SoftCache", "Removed. See http://openjdk.java.net/jeps/260",
- "sun.reflect.Reflection", "Use java.lang.StackWalker @since 9"
+ "sun.reflect.Reflection", "Use java.lang.StackWalker @since 9",
+ "sun.reflect.ReflectionFactory", "See http://openjdk.java.net/jeps/260"
);
@Test
@@ -139,6 +141,8 @@
int pos = line.indexOf("Use ");
if (pos < 0)
pos = line.indexOf("Removed. ");
+ if (pos < 0)
+ pos = line.indexOf("See ");
assertTrue(pos > 0);
String name = line.substring(0, pos).trim();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/jdeps/jdkinternals/patches/jdk.unsupported/sun/reflect/Reflection.java Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.reflect;
+
+/*
+ * JDK removed internal API
+ */
+public class Reflection {
+ public static Class<?> getCallerClass(int depth) {
+ return null;
+ }
+}
--- a/test/langtools/tools/jdeps/jdkinternals/src/p/Main.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/jdeps/jdkinternals/src/p/Main.java Thu Jan 18 18:58:46 2018 +0000
@@ -27,10 +27,14 @@
import sun.misc.Service;
import sun.misc.SoftCache;
import sun.reflect.Reflection;
+import sun.reflect.ReflectionFactory;
public class Main {
public static void main() {
// in jdk.unsupported
+ ReflectionFactory factory = ReflectionFactory.getReflectionFactory();
+
+ // removed from jdk.unsupported in JDK 11
Class<?> caller = Reflection.getCallerClass(2);
// removed
--- a/test/langtools/tools/jdeps/listdeps/ListModuleDeps.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/langtools/tools/jdeps/listdeps/ListModuleDeps.java Thu Jan 18 18:58:46 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -88,6 +88,8 @@
public Object[][] jdkModules() {
return new Object[][]{
{"jdk.compiler", new String[]{
+ "java.base/jdk.internal.jmod",
+ "java.base/jdk.internal.misc",
"java.base/sun.reflect.annotation",
"java.compiler",
}
--- a/test/nashorn/TEST.ROOT Thu Jan 18 09:01:00 2018 -0800
+++ b/test/nashorn/TEST.ROOT Thu Jan 18 18:58:46 2018 +0000
@@ -8,7 +8,7 @@
groups=TEST.groups
# Minimum jtreg version
-requiredVersion=4.2 b08
+requiredVersion=4.2 b11
# Use new module options
useNewOptions=true
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/nashorn/script/basic/JDK-8157251.js Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8157251: BeanLinker relinks array length operations for array types
+ *
+ * @test
+ * @run
+ */
+
+var intArray = Java.type("int[]")
+var doubleArray = Java.type("double[]")
+var arrs = [new intArray(20), new doubleArray(0)]
+for (var i in arrs)
+ print(arrs[i].length)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/nashorn/script/basic/JDK-8157251.js.EXPECTED Thu Jan 18 18:58:46 2018 +0000
@@ -0,0 +1,2 @@
+20
+0
\ No newline at end of file
--- a/test/nashorn/src/jdk/nashorn/api/scripting/test/ScriptEngineSecurityTest.java Thu Jan 18 09:01:00 2018 -0800
+++ b/test/nashorn/src/jdk/nashorn/api/scripting/test/ScriptEngineSecurityTest.java Thu Jan 18 18:58:46 2018 +0000
@@ -133,7 +133,7 @@
}
}
-
+ // This also covers overriding finalizer in JavaAdapter such as JDK-8194985
@Test
public void securitySystemExitFromFinalizerThread() throws ScriptException {
if (System.getSecurityManager() == null) {