OpenJDK / jdk-updates / jdk12u
changeset 27770:1335153ca9da
Merge
author | prr |
---|---|
date | Tue, 25 Nov 2014 10:41:40 -0800 |
parents | d5c53b177f54 8f9827afe8d0 |
children | 360714d431ab bf2f4f9b3a96 |
files | jdk/src/java.base/share/classes/java/util/zip/package.html |
diffstat | 114 files changed, 2471 insertions(+), 1079 deletions(-) [+] |
line wrap: on
line diff
--- a/jdk/.hgtags Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/.hgtags Tue Nov 25 10:41:40 2014 -0800 @@ -282,3 +282,4 @@ 27c3345d6dce39a22c262f30bb1f0e0b00c3709e jdk9-b37 d2d745313c81d1fc01f426983b9f784ab1f750e8 jdk9-b38 ca6edf957fe1c6ea818530b503578e872cea7239 jdk9-b39 +f1ed1540da70a066527fd043413107e47721edbf jdk9-b40
--- a/jdk/make/CompileDemos.gmk Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/make/CompileDemos.gmk Tue Nov 25 10:41:40 2014 -0800 @@ -44,7 +44,7 @@ DEMO_SHARE_SRC := $(JDK_TOPDIR)/src/demo/share DEMO_CLOSED_SHARE_SRC := $(JDK_TOPDIR)/src/closed/demo/share DEMO_SOLARIS_SRC := $(JDK_TOPDIR)/src/demo/solaris -DEMO_OS_API_SRC := $(JDK_TOPDIR)/src/demo/$(OPENJDK_TARGET_OS_API_DIR) +DEMO_OS_TYPE_SRC := $(JDK_TOPDIR)/src/demo/$(OPENJDK_TARGET_OS_TYPE) VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc ################################################################################################## @@ -214,13 +214,13 @@ # Param 2 = add these directories to the includes, default is agent_util # Param 3 = extra CFLAGS # Param 4 = C or C++ (defaults to C) - # Param 5 = libs for posix + # Param 5 = libs for unix # Param 6 = libs for windows # Param 7 = libs for solaris # Param 8 = libs for linux # Param 9 = extra directories with required sources BUILD_DEMO_JVMTI_$1_EXTRA_SRC := \ - $$(wildcard $(DEMO_OS_API_SRC)/jvmti/$1) \ + $$(wildcard $(DEMO_OS_TYPE_SRC)/jvmti/$1) \ $$(wildcard $$(addprefix $(DEMO_SHARE_SRC)/jvmti/, $2)) \ $9 BUILD_DEMO_JVMTI_$1_EXTRA_SRC_EXCLUDE := \ @@ -257,7 +257,7 @@ LDFLAGS := $(filter-out -incremental:no -opt:ref, $(LDFLAGS_JDKLIB)), \ LDFLAGS_macosx := $(call SET_EXECUTABLE_ORIGIN), \ LDFLAGS_SUFFIX := $$($1_EXTRA_CXX), \ - LDFLAGS_SUFFIX_posix := $5, \ + LDFLAGS_SUFFIX_unix := $5, \ LDFLAGS_SUFFIX_windows := $6, \ LDFLAGS_SUFFIX_solaris := $7 -lc, \ LDFLAGS_SUFFIX_linux := $8, \
--- a/jdk/make/CreateJars.gmk Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/make/CreateJars.gmk Tue Nov 25 10:41:40 2014 -0800 @@ -656,7 +656,7 @@ SRC_ZIP_SRCS := $(wildcard \ $(JDK_TOPDIR)/src/*/share/classes \ $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS)/classes \ - $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS_API_DIR)/classes \ + $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS_TYPE)/classes \ $(LANGTOOLS_TOPDIR)/src/*/share/classes \ $(CORBA_TOPDIR)/src/*/share/classes \ $(JAXP_TOPDIR)/src/*/share/classes \ @@ -679,7 +679,7 @@ FILES := $(wildcard \ $(JDK_TOPDIR)/src/java.base/share/native/launcher/* \ $(JDK_TOPDIR)/src/java.base/share/native/libjli/* \ - $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjli/java_md*))) + $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjli/java_md*))) LAUNCHER_ZIP_SRC := $(COPY_LAUNCHER_SRC)
--- a/jdk/make/Import.gmk Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/make/Import.gmk Tue Nov 25 10:41:40 2014 -0800 @@ -30,8 +30,8 @@ ################################################################################ -# Put the libraries here. Different locations for different target apis. -ifeq ($(OPENJDK_TARGET_OS_API), posix) +# Put the libraries here. Different locations for different target OS types. +ifeq ($(OPENJDK_TARGET_OS_TYPE), unix) INSTALL_LIBRARIES_HERE := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR) HOTSPOT_LIB_DIR := $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR) else
--- a/jdk/make/copy/Copy-java.base.gmk Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/make/copy/Copy-java.base.gmk Tue Nov 25 10:41:40 2014 -0800 @@ -83,7 +83,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx) JVMCFG_SRC := $(JDK_TOPDIR)/src/java.base/macosx/conf/$(JVMCFG_ARCH)/jvm.cfg else - JVMCFG_SRC := $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/conf/$(JVMCFG_ARCH)/jvm.cfg + JVMCFG_SRC := $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/conf/$(JVMCFG_ARCH)/jvm.cfg endif JVMCFG_DIR := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR) JVMCFG := $(JVMCFG_DIR)/jvm.cfg @@ -190,7 +190,7 @@ NET_CONF_FILES += $(JDK_OUTPUTDIR)/lib/net.properties ifeq ($(OPENJDK_TARGET_OS), solaris) - $(JDK_OUTPUTDIR)/lib/sdp/sdp.conf.template: $(JDK_TOPDIR)/src/java.base/${OPENJDK_TARGET_OS_API_DIR}/conf/sdp/sdp.conf.template + $(JDK_OUTPUTDIR)/lib/sdp/sdp.conf.template: $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/conf/sdp/sdp.conf.template $(ECHO) $(LOG_INFO) Copying $(@F) $(call install-file)
--- a/jdk/make/copy/Copy-java.desktop.gmk Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/make/copy/Copy-java.desktop.gmk Tue Nov 25 10:41:40 2014 -0800 @@ -102,13 +102,13 @@ # Copy cursor.properties and cursors gif files to LIB_DST_DIR # ifneq ($(OPENJDK_TARGET_OS), macosx) - OPENJDK_TARGET_OS_LIB_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/conf + OPENJDK_TARGET_OS_LIB_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/conf else OPENJDK_TARGET_OS_LIB_SRC := $(JDK_TOPDIR)/src/java.desktop/macosx/conf endif CURSORS_DEST_DIR := $(LIB_DST_DIR)/images/cursors -CURSORS_OPENJDK_TARGET_OS_LIB_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/conf/images/cursors +CURSORS_OPENJDK_TARGET_OS_LIB_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/conf/images/cursors $(CURSORS_DEST_DIR)/cursors.properties: $(CURSORS_OPENJDK_TARGET_OS_LIB_SRC)/cursors.properties $(call install-file)
--- a/jdk/make/gensrc/GensrcIcons.gmk Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/make/gensrc/GensrcIcons.gmk Tue Nov 25 10:41:40 2014 -0800 @@ -29,9 +29,9 @@ GENSRC_AWT_ICONS_DST := $(GENSRC_AWT_ICONS_TMP)/java.desktop/sun/awt/ ifdef OPENJDK - X11_ICONS_PATH_PREFIX := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR) + X11_ICONS_PATH_PREFIX := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE) else - X11_ICONS_PATH_PREFIX := $(JDK_TOPDIR)/src/closed/java.desktop/$(OPENJDK_TARGET_OS_API_DIR) + X11_ICONS_PATH_PREFIX := $(JDK_TOPDIR)/src/closed/java.desktop/$(OPENJDK_TARGET_OS_TYPE) endif GENSRC_AWT_ICONS_SRC += \
--- a/jdk/make/gensrc/GensrcProperties.gmk Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/make/gensrc/GensrcProperties.gmk Tue Nov 25 10:41:40 2014 -0800 @@ -58,13 +58,15 @@ $1_CLASS := $3 # Convert .../src/<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties - # to .../langtools/gensrc/<module>/com/sun/tools/javac/resources/javac_zh_CN.java + # to .../support/gensrc/<module>/com/sun/tools/javac/resources/javac_zh_CN.java # Strip away prefix and suffix, leaving for example only: # "<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN" $1_JAVAS := $$(patsubst $(JDK_TOPDIR)/src/%, \ $(JDK_OUTPUTDIR)/gensrc/%, \ $$(patsubst %.properties, %.java, \ - $$(subst /share/classes,, $$($1_SRCS)))) + $$(subst /$(OPENJDK_TARGET_OS)/classes,, \ + $$(subst /$(OPENJDK_TARGET_OS_TYPE)/classes,, \ + $$(subst /share/classes,, $$($1_SRCS)))))) # Generate the package dirs for the to be generated java files. Sort to remove # duplicates.
--- a/jdk/make/gensrc/GensrcX11Wrappers.gmk Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/make/gensrc/GensrcX11Wrappers.gmk Tue Nov 25 10:41:40 2014 -0800 @@ -95,8 +95,8 @@ -I$(JDK_TOPDIR)/src/java.base/share/native/include \ -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_EXPORT_DIR)/native/include \ -I$(JDK_TOPDIR)/src/java.base/share/native/libjava \ - -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjava \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/awt \ + -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \ #
--- a/jdk/make/launcher/Launcher-jdk.runtime.gmk Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/make/launcher/Launcher-jdk.runtime.gmk Tue Nov 25 10:41:40 2014 -0800 @@ -42,7 +42,7 @@ $(JDK_TOPDIR)/src/jdk.runtime/share/native/unpack200 UNPACKEXE_CFLAGS := -I$(JDK_TOPDIR)/src/jdk.runtime/share/native/common-unpack \ -I$(JDK_TOPDIR)/src/java.base/share/native/libjava \ - -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjava + -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava ifeq ($(USE_EXTERNAL_LIBZ), true) UNPACKEXE_CFLAGS += -DSYSTEM_ZLIB @@ -102,7 +102,7 @@ MAPFILE := $(UNPACK_MAPFILE),\ LDFLAGS := $(UNPACKEXE_ZIPOBJS), \ LDFLAGS_windows := $(CXXFLAGS_JDKEXE), \ - LDFLAGS_posix := $(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \ + LDFLAGS_unix := $(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \ $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)unpack$(SHARED_LIBRARY_SUFFIX)) \ $(call SET_SHARED_LIBRARY_ORIGIN), \ LDFLAGS_linux := -lc, \
--- a/jdk/make/launcher/LauncherCommon.gmk Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/make/launcher/LauncherCommon.gmk Tue Nov 25 10:41:40 2014 -0800 @@ -62,7 +62,7 @@ LAUNCHER_SRC := $(JDK_TOPDIR)/src/java.base/share/native/launcher LAUNCHER_CFLAGS := -I$(JDK_TOPDIR)/src/java.base/share/native/launcher \ -I$(JDK_TOPDIR)/src/java.base/share/native/libjli \ - -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjli \ + -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjli \ -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libjli \ # GLOBAL_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc @@ -71,10 +71,10 @@ # Until the shuffle is permanent, we can't add this in configure CFLAGS_JDKEXE := $(filter-out %javavm/export, $(CFLAGS_JDKEXE)) CFLAGS_JDKEXE += -I$(JDK_TOPDIR)/src/java.base/share/native/include \ - -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/include + -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/include CXXFLAGS_JDKEXE := $(filter-out %javavm/export, $(CXXFLAGS_JDKEXE)) CXXFLAGS_JDKEXE += -I$(JDK_TOPDIR)/src/java.base/share/native/include \ - -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/include + -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/include JAVA_MANIFEST := $(JDK_TOPDIR)/src/java.base/windows/native/launcher/java.manifest define SetupLauncher @@ -82,7 +82,7 @@ # Parameter 1 is the name of the launcher (java, javac, jar...) # Parameter 2 is extra CFLAGS # Parameter 3 is extra LDFLAGS - # Parameter 4 is extra LDFLAGS_SUFFIX_posix + # Parameter 4 is extra LDFLAGS_SUFFIX_unix # Parameter 5 is extra LDFLAGS_SUFFIX_windows # Parameter 6 is optional Windows JLI library (full path) # Parameter 7 is optional Windows resource (RC) flags @@ -187,7 +187,7 @@ $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)), \ MAPFILE := $$($1_MAPFILE), \ LDFLAGS_SUFFIX := $(LDFLAGS_JDKEXE_SUFFIX) $$($1_LDFLAGS_SUFFIX), \ - LDFLAGS_SUFFIX_posix := $4, \ + LDFLAGS_SUFFIX_unix := $4, \ LDFLAGS_SUFFIX_windows := $$($1_WINDOWS_JLI_LIB) \ $(JDK_OUTPUTDIR)/objs/libjava/java.lib advapi32.lib $5, \ LDFLAGS_SUFFIX_linux := -L$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli -ljli $(LIBDL) -lc, \ @@ -231,4 +231,3 @@ else JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/closed/java.base/windows/native/launcher/icons" endif -
--- a/jdk/make/lib/Awt2dLibraries.gmk Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/make/lib/Awt2dLibraries.gmk Tue Nov 25 10:41:40 2014 -0800 @@ -31,7 +31,7 @@ $(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/medialib BUILD_LIBMLIB_CFLAGS := -D__USE_J2D_NAMES -D__MEDIALIB_OLD_NAMES \ $(addprefix -I, $(BUILD_LIBMLIB_SRC)) \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libmlib_image + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libmlib_image BUILD_LIBMLIB_LDLIBS := BUILD_LIBMLIB_IMAGE_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libmlib_image/mapfile-vers @@ -144,9 +144,9 @@ ################################################################################ LIBAWT_DIRS := $(JDK_TOPDIR)/src/java.desktop/share/native/libawt \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt \ $(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/awt \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \ # ifeq ($(OPENJDK_TARGET_OS), aix) @@ -211,7 +211,7 @@ # Why does libawt need java.base headers? LIBAWT_CFLAGS += -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/font \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/java2d/opengl \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/opengl \ -I$(JDK_TOPDIR)/src/java.desktop/windows/native/include \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/include \ -I$(JDK_OUTPUTDIR)/gensrc_headers/java.base \ @@ -298,15 +298,15 @@ ifndef BUILD_HEADLESS_ONLY LIBAWT_XAWT_DIRS := \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt_xawt \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libjawt \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt_xawt \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libjawt \ $(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \ $(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/utility \ $(JDK_TOPDIR)/src/java.desktop/share/native/common/font \ $(JDK_TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/java2d/opengl \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/java2d/x11 \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/awt \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/opengl \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/x11 \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \ # LIBAWT_XAWT_EXCLUDES := medialib @@ -315,15 +315,15 @@ -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/include \ -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS)/native/include \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/include \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/include \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt/java2d \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libsunwjdga \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/font \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libsunwjdga \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/font \ $(LIBJAVA_HEADER_FLAGS) # @@ -514,14 +514,14 @@ ################################################################################ LIBFONTMANAGER_SRC := $(JDK_TOPDIR)/src/java.desktop/share/native/libfontmanager \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libfontmanager + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libfontmanager LIBFONTMANAGER_CFLAGS := \ $(addprefix -I, $(shell $(FIND) \ $(LIBFONTMANAGER_SRC) \ $(JDK_TOPDIR)/src/java.desktop/share/native/libawt \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt \ $(JDK_TOPDIR)/src/java.desktop/share/native/common \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common -type d)) \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common -type d)) \ -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \ $(LIBJAVA_HEADER_FLAGS) \ # @@ -542,7 +542,7 @@ LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \ X11TextRenderer.c LIBFONTMANAGER_OPTIMIZATION := HIGHEST - LIBFONTMANAGER_CFLAGS += -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt/windows + LIBFONTMANAGER_CFLAGS += -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/windows else ifeq ($(OPENJDK_TARGET_OS), macosx) LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \ X11TextRenderer.c \ @@ -606,12 +606,12 @@ ################################################################################ ifeq ($(OPENJDK_TARGET_OS), windows) - LIBJAWT_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libjawt - LIBJAWT_CFLAGS := -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt/windows \ + LIBJAWT_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libjawt + LIBJAWT_CFLAGS := -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/windows \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt/java2d/windows \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d/windows \ -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \ -I$(JDK_TOPDIR)/src/java.desktop/windows/native/include \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/include \ @@ -655,12 +655,12 @@ ifeq ($(OPENJDK_TARGET_OS), macosx) LIBJAWT_SRC := $(JDK_TOPDIR)/src/java.desktop/macosx/native/libjawt else - LIBJAWT_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libjawt + LIBJAWT_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libjawt endif LIBJAWT_CFLAGS := \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/awt \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \ -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS)/native/include \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/include \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/include \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/include \ $(LIBJAVA_HEADER_FLAGS) \ # @@ -724,9 +724,9 @@ ifeq ($(findstring $(OPENJDK_TARGET_OS), windows macosx),) LIBAWT_HEADLESS_DIRS := $(JDK_TOPDIR)/src/java.desktop/unix/native/libawt_headless/awt \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/awt \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/java2d/opengl \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/java2d/x11 \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/opengl \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/x11 \ $(JDK_TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \ $(JDK_TOPDIR)/src/java.desktop/share/native/common/font \ # @@ -739,11 +739,11 @@ -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt/java2d \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/font \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/font \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libsunwjdga/ \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/font \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libsunwjdga/ \ $(LIBJAVA_HEADER_FLAGS) \ # @@ -817,7 +817,7 @@ endif ifneq ($(OPENJDK_TARGET_OS), macosx) - LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libsplashscreen + LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libsplashscreen else LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/java.desktop/macosx/native/libsplashscreen endif @@ -988,7 +988,7 @@ -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/awt \ -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libosxapp \ -I$(JDK_TOPDIR)/src/java.base/share/native/libjava \ - -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjava \ + -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \ -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop, \ LDFLAGS := $(LDFLAGS_JDKLIB) \ $(call SET_SHARED_LIBRARY_ORIGIN) \
--- a/jdk/make/lib/CoreLibraries.gmk Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/make/lib/CoreLibraries.gmk Tue Nov 25 10:41:40 2014 -0800 @@ -99,7 +99,7 @@ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libverify/mapfile-vers, \ LDFLAGS := $(LDFLAGS_JDKLIB) \ $(call SET_SHARED_LIBRARY_ORIGIN), \ - LDFLAGS_SUFFIX_posix := -ljvm -lc, \ + LDFLAGS_SUFFIX_unix := -ljvm -lc, \ LDFLAGS_SUFFIX_windows := jvm.lib, \ VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \ RC_FLAGS := $(RC_FLAGS) \ @@ -160,7 +160,7 @@ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjava/mapfile-vers, \ LDFLAGS := $(LDFLAGS_JDKLIB) \ $(call SET_SHARED_LIBRARY_ORIGIN), \ - LDFLAGS_SUFFIX_posix := -ljvm -lverify, \ + LDFLAGS_SUFFIX_unix := -ljvm -lverify, \ LDFLAGS_SUFFIX_solaris := -lsocket -lnsl -lscf $(LIBDL) $(BUILD_LIBFDLIBM) -lc, \ LDFLAGS_SUFFIX_linux := $(LIBDL) $(BUILD_LIBFDLIBM), \ LDFLAGS_SUFFIX_aix := $(LIBDL) $(BUILD_LIBFDLIBM) -lm,\ @@ -216,9 +216,9 @@ CFLAGS := $(CFLAGS_JDKLIB) \ $(ZLIB_CPPFLAGS) \ -I$(JDK_TOPDIR)/src/java.base/share/native/libjava \ - -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjava \ + -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \ -I$(JDK_OUTPUTDIR)/gensrc_headers/java.base, \ - CFLAGS_posix := $(BUILD_LIBZIP_MMAP) -UDEBUG, \ + CFLAGS_unix := $(BUILD_LIBZIP_MMAP) -UDEBUG, \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libzip/mapfile-vers, \ REORDER := $(BUILD_LIBZIP_REORDER), \ LDFLAGS := $(LDFLAGS_JDKLIB) \ @@ -247,7 +247,7 @@ ########################################################################################## BUILD_LIBJLI_SRC_DIRS := $(JDK_TOPDIR)/src/java.base/share/native/libjli \ - $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjli + $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjli LIBJLI_CFLAGS := $(CFLAGS_JDKLIB) @@ -291,7 +291,7 @@ # if the architecture specific ergo file exists then # use it, else use the generic definitions from ergo.c - ifneq ($(wildcard $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjli/$(ERGO_ARCH_FILE)), ) + ifneq ($(wildcard $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjli/$(ERGO_ARCH_FILE)), ) BUILD_LIBJLI_FILES += $(ERGO_ARCH_FILE) else # !ERGO_ARCH_FILE LIBJLI_CFLAGS += -DUSE_GENERIC_ERGO
--- a/jdk/make/lib/Lib-java.instrument.gmk Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/make/lib/Lib-java.instrument.gmk Tue Nov 25 10:41:40 2014 -0800 @@ -28,7 +28,7 @@ ################################################################################ LIBINSTRUMENT_SRC := $(JDK_TOPDIR)/src/java.instrument/share/native/libinstrument \ - $(JDK_TOPDIR)/src/java.instrument/$(OPENJDK_TARGET_OS_API_DIR)/native/libinstrument \ + $(JDK_TOPDIR)/src/java.instrument/$(OPENJDK_TARGET_OS_TYPE)/native/libinstrument \ # LIBINSTRUMENT_CFLAGS := $(CFLAGS_JDKLIB) \ $(addprefix -I, $(LIBINSTRUMENT_SRC)) \
--- a/jdk/make/lib/Lib-java.management.gmk Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/make/lib/Lib-java.management.gmk Tue Nov 25 10:41:40 2014 -0800 @@ -31,7 +31,7 @@ ################################################################################ BUILD_LIBMANAGEMENT_SRC += $(JDK_TOPDIR)/src/java.management/share/native/libmanagement \ - $(JDK_TOPDIR)/src/java.management/$(OPENJDK_TARGET_OS_API_DIR)/native/libmanagement + $(JDK_TOPDIR)/src/java.management/$(OPENJDK_TARGET_OS_TYPE)/native/libmanagement BUILD_LIBMANAGEMENT_CFLAGS := -I$(JDK_TOPDIR)/src/java.management/share/native/include \ $(addprefix -I,$(BUILD_LIBMANAGEMENT_SRC)) \ -I$(JDK_OUTPUTDIR)/gensrc_headers/java.management \
--- a/jdk/make/lib/Lib-java.prefs.gmk Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/make/lib/Lib-java.prefs.gmk Tue Nov 25 10:41:40 2014 -0800 @@ -30,7 +30,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx) LIBPREF_SRC_DIRS := $(JDK_TOPDIR)/src/java.prefs/macosx/native/libprefs else - LIBPREF_SRC_DIRS := $(JDK_TOPDIR)/src/java.prefs/$(OPENJDK_TARGET_OS_API_DIR)/native/libprefs + LIBPREF_SRC_DIRS := $(JDK_TOPDIR)/src/java.prefs/$(OPENJDK_TARGET_OS_TYPE)/native/libprefs endif $(eval $(call SetupNativeCompilation,BUILD_LIBPREFS, \
--- a/jdk/make/lib/Lib-java.security.jgss.gmk Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/make/lib/Lib-java.security.jgss.gmk Tue Nov 25 10:41:40 2014 -0800 @@ -29,7 +29,7 @@ ifneq ($(OPENJDK_TARGET_OS), windows) LIBJ2GSS_SRC := $(JDK_TOPDIR)/src/java.security.jgss/share/native/libj2gss \ - $(JDK_TOPDIR)/src/java.security.jgss/$(OPENJDK_TARGET_OS_API_DIR)/native/libj2gss \ + $(JDK_TOPDIR)/src/java.security.jgss/$(OPENJDK_TARGET_OS_TYPE)/native/libj2gss \ # $(eval $(call SetupNativeCompilation,BUILD_LIBJ2GSS, \ @@ -58,7 +58,7 @@ BUILD_LIBKRB5_NAME := ifeq ($(OPENJDK_TARGET_OS), windows) BUILD_LIBKRB5_NAME := w2k_lsa_auth - BUILD_LIBKRB5_SRC := $(JDK_TOPDIR)/src/java.security.jgss/$(OPENJDK_TARGET_OS_API_DIR)/native/libw2k_lsa_auth + BUILD_LIBKRB5_SRC := $(JDK_TOPDIR)/src/java.security.jgss/$(OPENJDK_TARGET_OS_TYPE)/native/libw2k_lsa_auth BUILD_LIBKRB5_LIBS := advapi32.lib Secur32.lib netapi32.lib kernel32.lib user32.lib \ gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib \ ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib
--- a/jdk/make/lib/Lib-java.smartcardio.gmk Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/make/lib/Lib-java.smartcardio.gmk Tue Nov 25 10:41:40 2014 -0800 @@ -28,9 +28,9 @@ ################################################################################ LIBJ2PCSC_SRC := $(JDK_TOPDIR)/src/java.smartcardio/share/native/libj2pcsc \ - $(JDK_TOPDIR)/src/java.smartcardio/$(OPENJDK_TARGET_OS_API_DIR)/native/libj2pcsc + $(JDK_TOPDIR)/src/java.smartcardio/$(OPENJDK_TARGET_OS_TYPE)/native/libj2pcsc LIBJ2PCSC_CPPFLAGS := $(addprefix -I,$(LIBJ2PCSC_SRC)) \ - -I$(JDK_TOPDIR)/src/java.smartcardio/$(OPENJDK_TARGET_OS_API_DIR)/native/libj2pcsc/MUSCLE \ + -I$(JDK_TOPDIR)/src/java.smartcardio/$(OPENJDK_TARGET_OS_TYPE)/native/libj2pcsc/MUSCLE \ -I$(JDK_OUTPUTDIR)/gensrc_headers/java.smartcardio $(eval $(call SetupNativeCompilation,BUILD_LIBJ2PCSC, \ @@ -38,13 +38,13 @@ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \ SRC := $(LIBJ2PCSC_SRC), \ LANG := C, \ - CFLAGS_posix := -D__sun_jdk, \ + CFLAGS_unix := -D__sun_jdk, \ OPTIMIZATION := LOW, \ CFLAGS := $(CFLAGS_JDKLIB) $(LIBJ2PCSC_CPPFLAGS), \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libj2pcsc/mapfile-vers, \ LDFLAGS := $(LDFLAGS_JDKLIB) \ $(call SET_SHARED_LIBRARY_ORIGIN), \ - LDFLAGS_SUFFIX_posix := $(LIBDL), \ + LDFLAGS_SUFFIX_unix := $(LIBDL), \ LDFLAGS_SUFFIX_windows := winscard.lib, \ LDFLAGS_SUFFIX_solaris := -lc, \ VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
--- a/jdk/make/lib/Lib-jdk.crypto.mscapi.gmk Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/make/lib/Lib-jdk.crypto.mscapi.gmk Tue Nov 25 10:41:40 2014 -0800 @@ -29,7 +29,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows) - LIBSUNMSCAPI_SRC := $(JDK_TOPDIR)/src/jdk.crypto.mscapi/$(OPENJDK_TARGET_OS_API_DIR)/native/libsunmscapi + LIBSUNMSCAPI_SRC := $(JDK_TOPDIR)/src/jdk.crypto.mscapi/$(OPENJDK_TARGET_OS_TYPE)/native/libsunmscapi $(eval $(call SetupNativeCompilation,BUILD_LIBSUNMSCAPI, \ LIBRARY := sunmscapi, \
--- a/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk Tue Nov 25 10:41:40 2014 -0800 @@ -28,7 +28,7 @@ ################################################################################ LIBJ2PKCS11_SRC := $(JDK_TOPDIR)/src/jdk.crypto.pkcs11/share/native/libj2pkcs11 \ - $(JDK_TOPDIR)/src/jdk.crypto.pkcs11/$(OPENJDK_TARGET_OS_API_DIR)/native/libj2pkcs11 + $(JDK_TOPDIR)/src/jdk.crypto.pkcs11/$(OPENJDK_TARGET_OS_TYPE)/native/libj2pkcs11 $(eval $(call SetupNativeCompilation,BUILD_LIBJ2PKCS11, \ LIBRARY := j2pkcs11, \ @@ -42,7 +42,7 @@ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libj2pkcs11/mapfile-vers, \ LDFLAGS := $(LDFLAGS_JDKLIB) \ $(call SET_SHARED_LIBRARY_ORIGIN), \ - LDFLAGS_SUFFIX_posix := $(LIBDL), \ + LDFLAGS_SUFFIX_unix := $(LIBDL), \ LDFLAGS_SUFFIX_solaris := -lc, \ VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \ RC_FLAGS := $(RC_FLAGS) \
--- a/jdk/make/lib/Lib-jdk.jdi.gmk Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/make/lib/Lib-jdk.jdi.gmk Tue Nov 25 10:41:40 2014 -0800 @@ -30,7 +30,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows) LIBDT_SHMEM_SRC := $(JDK_TOPDIR)/src/jdk.jdi/share/native/libdt_shmem \ - $(JDK_TOPDIR)/src/jdk.jdi/$(OPENJDK_TARGET_OS_API_DIR)/native/libdt_shmem \ + $(JDK_TOPDIR)/src/jdk.jdi/$(OPENJDK_TARGET_OS_TYPE)/native/libdt_shmem \ # LIBDT_SHMEM_CPPFLAGS := -I$(INCLUDEDIR) -I$(JDK_OUTPUTDIR)/include/$(OPENJDK_TARGET_OS) \ $(addprefix -I, $(LIBDT_SHMEM_SRC)) \
--- a/jdk/make/lib/Lib-jdk.jdwp.agent.gmk Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/make/lib/Lib-jdk.jdwp.agent.gmk Tue Nov 25 10:41:40 2014 -0800 @@ -28,7 +28,7 @@ ################################################################################ LIBDT_SOCKET_SRC := $(JDK_TOPDIR)/src/jdk.jdwp.agent/share/native/libdt_socket \ - $(JDK_TOPDIR)/src/jdk.jdwp.agent/$(OPENJDK_TARGET_OS_API_DIR)/native/libdt_socket + $(JDK_TOPDIR)/src/jdk.jdwp.agent/$(OPENJDK_TARGET_OS_TYPE)/native/libdt_socket LIBDT_SOCKET_CPPFLAGS := \ $(addprefix -I, $(LIBDT_SOCKET_SRC)) \ -I$(JDK_TOPDIR)/src/jdk.jdwp.agent/share/native/libjdwp/export \ @@ -66,7 +66,7 @@ ################################################################################ LIBJDWP_SRC := $(JDK_TOPDIR)/src/jdk.jdwp.agent/share/native/libjdwp \ - $(JDK_TOPDIR)/src/jdk.jdwp.agent/$(OPENJDK_TARGET_OS_API_DIR)/native/libjdwp + $(JDK_TOPDIR)/src/jdk.jdwp.agent/$(OPENJDK_TARGET_OS_TYPE)/native/libjdwp LIBJDWP_CPPFLAGS := \ -I$(JDK_TOPDIR)/src/jdk.jdwp.agent/share/native/libjdwp/export \ -I$(JDK_TOPDIR)/src/jdk.jdwp.agent/share/native/include \
--- a/jdk/make/lib/Lib-jdk.runtime.gmk Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/make/lib/Lib-jdk.runtime.gmk Tue Nov 25 10:41:40 2014 -0800 @@ -45,7 +45,7 @@ $(call SET_SHARED_LIBRARY_ORIGIN), \ LDFLAGS_windows := -map:$(JDK_OUTPUTDIR)/objs/unpack.map -debug \ jvm.lib $(WIN_JAVA_LIB), \ - LDFLAGS_SUFFIX_posix := -ljvm $(LIBCXX) -ljava -lc, \ + LDFLAGS_SUFFIX_unix := -ljvm $(LIBCXX) -ljava -lc, \ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libunpack, \ VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \ RC_FLAGS := $(RC_FLAGS) \ @@ -61,7 +61,7 @@ ################################################################################ LIBJSDT_SRC := $(JDK_TOPDIR)/src/jdk.runtime/share/native/libjsdt \ - $(JDK_TOPDIR)/src/jdk.runtime/$(OPENJDK_TARGET_OS_API_DIR)/native/libjsdt + $(JDK_TOPDIR)/src/jdk.runtime/$(OPENJDK_TARGET_OS_TYPE)/native/libjsdt $(eval $(call SetupNativeCompilation,BUILD_LIBJSDT, \ LIBRARY := jsdt, \
--- a/jdk/make/lib/Lib-jdk.sctp.gmk Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/make/lib/Lib-jdk.sctp.gmk Tue Nov 25 10:41:40 2014 -0800 @@ -27,7 +27,7 @@ ################################################################################ -ifeq ($(OPENJDK_TARGET_OS_API), posix) +ifeq ($(OPENJDK_TARGET_OS_TYPE), unix) ifeq (, $(filter $(OPENJDK_TARGET_OS), macosx aix)) @@ -40,11 +40,11 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBSCTP, \ LIBRARY := sctp, \ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \ - SRC := $(JDK_TOPDIR)/src/jdk.sctp/$(OPENJDK_TARGET_OS_API_DIR)/native/libsctp, \ + SRC := $(JDK_TOPDIR)/src/jdk.sctp/$(OPENJDK_TARGET_OS_TYPE)/native/libsctp, \ LANG := C, \ OPTIMIZATION := LOW, \ CFLAGS := $(CFLAGS_JDKLIB) \ - -I $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libnio/ch \ + -I $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libnio/ch \ -I $(JDK_TOPDIR)/src/java.base/share/native/libnio/ch \ $(addprefix -I, $(call FindSrcDirsForLib, java.base, net)) \ $(LIBJAVA_HEADER_FLAGS) \ @@ -55,7 +55,7 @@ LDFLAGS := $(LDFLAGS_JDKLIB) \ $(call SET_SHARED_LIBRARY_ORIGIN), \ LDFLAGS_SUFFIX_linux := -lpthread $(LIBDL) -ljava -ljvm, \ - LDFLAGS_SUFFIX_posix := -lnio -lnet, \ + LDFLAGS_SUFFIX_unix := -lnio -lnet, \ LDFLAGS_SUFFIX_solaris := -lsocket -ljava -ljvm -lc, \ LDFLAGS_SUFFIX_macosx := -ljava -ljvm, \ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libsctp, \
--- a/jdk/make/lib/Lib-jdk.security.auth.gmk Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/make/lib/Lib-jdk.security.auth.gmk Tue Nov 25 10:41:40 2014 -0800 @@ -43,7 +43,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAAS, \ LIBRARY := $(LIBJAAS_NAME), \ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \ - SRC := $(JDK_TOPDIR)/src/jdk.security.auth/$(OPENJDK_TARGET_OS_API_DIR)/native/libjaas, \ + SRC := $(JDK_TOPDIR)/src/jdk.security.auth/$(OPENJDK_TARGET_OS_TYPE)/native/libjaas, \ LANG := C, \ OPTIMIZATION := LOW, \ CFLAGS := $(CFLAGS_JDKLIB) -I$(JDK_OUTPUTDIR)/gensrc_headers/jdk.security.auth, \
--- a/jdk/make/lib/LibCommon.gmk Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/make/lib/LibCommon.gmk Tue Nov 25 10:41:40 2014 -0800 @@ -34,8 +34,8 @@ GLOBAL_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc -# Put the libraries here. Different locations for different target apis. -ifeq ($(OPENJDK_TARGET_OS_API), posix) +# Put the libraries here. Different locations for different target OS types. +ifeq ($(OPENJDK_TARGET_OS_TYPE), unix) INSTALL_LIBRARIES_HERE := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR) else INSTALL_LIBRARIES_HERE := $(JDK_OUTPUTDIR)/bin @@ -63,7 +63,7 @@ # Param 2 - library name FindSrcDirsForLib = $(call uniq, $(wildcard \ $(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS)/native/lib$(strip $2) \ - $(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_API_DIR)/native/lib$(strip $2) \ + $(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/native/lib$(strip $2) \ $(JDK_TOPDIR)/src/$(strip $1)/share/native/lib$(strip $2))) ################################################################################
--- a/jdk/make/lib/NetworkingLibraries.gmk Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/make/lib/NetworkingLibraries.gmk Tue Nov 25 10:41:40 2014 -0800 @@ -24,7 +24,7 @@ # LIBNET_SRC_DIRS := $(JDK_TOPDIR)/src/java.base/share/native/libnet \ - $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libnet + $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libnet LIBNET_CFLAGS += -I$(JDK_OUTPUTDIR)/gensrc_headers/java.base \ $(LIBJAVA_HEADER_FLAGS) @@ -77,4 +77,3 @@ $(BUILD_LIBNET): $(BUILD_LIBJAVA) BASE_LIBRARIES += $(BUILD_LIBNET) -
--- a/jdk/make/lib/NioLibraries.gmk Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/make/lib/NioLibraries.gmk Tue Nov 25 10:41:40 2014 -0800 @@ -25,10 +25,10 @@ BUILD_LIBNIO_SRC := \ $(JDK_TOPDIR)/src/java.base/share/native/libnio/ch \ - $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libnio \ + $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libnio \ $(sort $(wildcard \ - $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libnio/ch \ - $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libnio/fs \ + $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libnio/ch \ + $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libnio/fs \ $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libnio/ch \ $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libnio/fs)) \ #
--- a/jdk/make/lib/SoundLibraries.gmk Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/make/lib/SoundLibraries.gmk Tue Nov 25 10:41:40 2014 -0800 @@ -25,7 +25,7 @@ LIBJSOUND_SRC_DIRS := \ $(JDK_TOPDIR)/src/java.desktop/share/native/libjsound \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libjsound \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libjsound \ # LIBJSOUND_CFLAGS := \ -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \ @@ -165,7 +165,7 @@ -framework CoreServices -framework AudioUnit $(LIBCXX) \ -framework CoreMIDI -framework AudioToolbox, \ LDFLAGS_windows := $(WIN_JAVA_LIB) advapi32.lib winmm.lib, \ - LDFLAGS_SUFFIX_posix := -ljava -ljvm, \ + LDFLAGS_SUFFIX_unix := -ljava -ljvm, \ LDFLAGS_SUFFIX_solaris := -lc, \ VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \ RC_FLAGS := $(RC_FLAGS) \
--- a/jdk/src/java.base/share/classes/java/lang/Class.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.base/share/classes/java/lang/Class.java Tue Nov 25 10:41:40 2014 -0800 @@ -719,15 +719,15 @@ /** - * Returns the {@code Class} representing the superclass of the entity - * (class, interface, primitive type or void) represented by this - * {@code Class}. If this {@code Class} represents either the + * Returns the {@code Class} representing the direct superclass of the + * entity (class, interface, primitive type or void) represented by + * this {@code Class}. If this {@code Class} represents either the * {@code Object} class, an interface, a primitive type, or void, then * null is returned. If this object represents an array class then the * {@code Class} object representing the {@code Object} class is * returned. * - * @return the superclass of the class represented by this object. + * @return the direct superclass of the class represented by this object */ public native Class<? super T> getSuperclass(); @@ -758,7 +758,7 @@ * @throws java.lang.reflect.MalformedParameterizedTypeException if the * generic superclass refers to a parameterized type that cannot be * instantiated for any reason - * @return the superclass of the class represented by this object + * @return the direct superclass of the class represented by this object * @since 1.5 */ public Type getGenericSuperclass() { @@ -798,15 +798,15 @@ /** - * Determines the interfaces implemented by the class or interface + * Returns the interfaces directly implemented by the class or interface * represented by this object. * - * <p> If this object represents a class, the return value is an array - * containing objects representing all interfaces implemented by the - * class. The order of the interface objects in the array corresponds to - * the order of the interface names in the {@code implements} clause - * of the declaration of the class represented by this object. For - * example, given the declaration: + * <p>If this object represents a class, the return value is an array + * containing objects representing all interfaces directly implemented by + * the class. The order of the interface objects in the array corresponds + * to the order of the interface names in the {@code implements} clause of + * the declaration of the class represented by this object. For example, + * given the declaration: * <blockquote> * {@code class Shimmer implements FloorWax, DessertTopping { ... }} * </blockquote> @@ -823,23 +823,23 @@ * is the {@code Class} object that represents interface * {@code DessertTopping}. * - * <p> If this object represents an interface, the array contains objects - * representing all interfaces extended by the interface. The order of the - * interface objects in the array corresponds to the order of the interface - * names in the {@code extends} clause of the declaration of the - * interface represented by this object. + * <p>If this object represents an interface, the array contains objects + * representing all interfaces directly extended by the interface. The + * order of the interface objects in the array corresponds to the order of + * the interface names in the {@code extends} clause of the declaration of + * the interface represented by this object. * - * <p> If this object represents a class or interface that implements no + * <p>If this object represents a class or interface that implements no * interfaces, the method returns an array of length 0. * - * <p> If this object represents a primitive type or void, the method + * <p>If this object represents a primitive type or void, the method * returns an array of length 0. * - * <p> If this {@code Class} object represents an array type, the + * <p>If this {@code Class} object represents an array type, the * interfaces {@code Cloneable} and {@code java.io.Serializable} are * returned in that order. * - * @return an array of interfaces implemented by this class. + * @return an array of interfaces directly implemented by this class */ public Class<?>[] getInterfaces() { ReflectionData<T> rd = reflectionData(); @@ -873,29 +873,28 @@ * for the semantics of the creation process for parameterized * types. * - * <p> If this object represents a class, the return value is an - * array containing objects representing all interfaces - * implemented by the class. The order of the interface objects in - * the array corresponds to the order of the interface names in - * the {@code implements} clause of the declaration of the class - * represented by this object. In the case of an array class, the - * interfaces {@code Cloneable} and {@code Serializable} are + * <p>If this object represents a class, the return value is an array + * containing objects representing all interfaces directly implemented by + * the class. The order of the interface objects in the array corresponds + * to the order of the interface names in the {@code implements} clause of + * the declaration of the class represented by this object. + * + * <p>If this object represents an interface, the array contains objects + * representing all interfaces directly extended by the interface. The + * order of the interface objects in the array corresponds to the order of + * the interface names in the {@code extends} clause of the declaration of + * the interface represented by this object. + * + * <p>If this object represents a class or interface that implements no + * interfaces, the method returns an array of length 0. + * + * <p>If this object represents a primitive type or void, the method + * returns an array of length 0. + * + * <p>If this {@code Class} object represents an array type, the + * interfaces {@code Cloneable} and {@code java.io.Serializable} are * returned in that order. * - * <p>If this object represents an interface, the array contains - * objects representing all interfaces directly extended by the - * interface. The order of the interface objects in the array - * corresponds to the order of the interface names in the - * {@code extends} clause of the declaration of the interface - * represented by this object. - * - * <p>If this object represents a class or interface that - * implements no interfaces, the method returns an array of length - * 0. - * - * <p>If this object represents a primitive type or void, the - * method returns an array of length 0. - * * @throws java.lang.reflect.GenericSignatureFormatError * if the generic class signature does not conform to the format * specified in @@ -905,7 +904,7 @@ * @throws java.lang.reflect.MalformedParameterizedTypeException * if any of the generic superinterfaces refer to a parameterized * type that cannot be instantiated for any reason - * @return an array of interfaces implemented by this class + * @return an array of interfaces directly implemented by this class * @since 1.5 */ public Type[] getGenericInterfaces() {
--- a/jdk/src/java.base/share/classes/java/lang/Object.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.base/share/classes/java/lang/Object.java Tue Nov 25 10:41:40 2014 -0800 @@ -453,7 +453,7 @@ "nanosecond timeout value out of range"); } - if (nanos >= 500000 || (nanos != 0 && timeout == 0)) { + if (nanos > 0) { timeout++; }
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandle.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandle.java Tue Nov 25 10:41:40 2014 -0800 @@ -867,15 +867,11 @@ MethodType postSpreadType = asSpreaderChecks(arrayType, arrayLength); int arity = type().parameterCount(); int spreadArgPos = arity - arrayLength; - if (USE_LAMBDA_FORM_EDITOR) { - MethodHandle afterSpread = this.asType(postSpreadType); - BoundMethodHandle mh = afterSpread.rebind(); - LambdaForm lform = mh.editor().spreadArgumentsForm(1 + spreadArgPos, arrayType, arrayLength); - MethodType preSpreadType = postSpreadType.replaceParameterTypes(spreadArgPos, arity, arrayType); - return mh.copyWith(preSpreadType, lform); - } else { - return MethodHandleImpl.makeSpreadArguments(this, arrayType, spreadArgPos, arrayLength); - } + MethodHandle afterSpread = this.asType(postSpreadType); + BoundMethodHandle mh = afterSpread.rebind(); + LambdaForm lform = mh.editor().spreadArgumentsForm(1 + spreadArgPos, arrayType, arrayLength); + MethodType preSpreadType = postSpreadType.replaceParameterTypes(spreadArgPos, arity, arrayType); + return mh.copyWith(preSpreadType, lform); } /** @@ -996,23 +992,15 @@ public MethodHandle asCollector(Class<?> arrayType, int arrayLength) { asCollectorChecks(arrayType, arrayLength); int collectArgPos = type().parameterCount() - 1; - if (USE_LAMBDA_FORM_EDITOR) { - BoundMethodHandle mh = rebind(); - MethodType resultType = type().asCollectorType(arrayType, arrayLength); - MethodHandle newArray = MethodHandleImpl.varargsArray(arrayType, arrayLength); - LambdaForm lform = mh.editor().collectArgumentArrayForm(1 + collectArgPos, newArray); - if (lform != null) { - return mh.copyWith(resultType, lform); - } - lform = mh.editor().collectArgumentsForm(1 + collectArgPos, newArray.type().basicType()); - return mh.copyWithExtendL(resultType, lform, newArray); - } else { - MethodHandle target = this; - if (arrayType != type().parameterType(collectArgPos)) - target = MethodHandleImpl.makePairwiseConvert(this, type().changeParameterType(collectArgPos, arrayType), true); - MethodHandle collector = MethodHandleImpl.varargsArray(arrayType, arrayLength); - return MethodHandles.collectArguments(target, collectArgPos, collector); + BoundMethodHandle mh = rebind(); + MethodType resultType = type().asCollectorType(arrayType, arrayLength); + MethodHandle newArray = MethodHandleImpl.varargsArray(arrayType, arrayLength); + LambdaForm lform = mh.editor().collectArgumentArrayForm(1 + collectArgPos, newArray); + if (lform != null) { + return mh.copyWith(resultType, lform); } + lform = mh.editor().collectArgumentsForm(1 + collectArgPos, newArray.type().basicType()); + return mh.copyWithExtendL(resultType, lform, newArray); } /**
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java Tue Nov 25 10:41:40 2014 -0800 @@ -191,11 +191,7 @@ MethodType dstType = target.type(); if (srcType == dstType) return target; - if (USE_LAMBDA_FORM_EDITOR) { - return makePairwiseConvertByEditor(target, srcType, strict, monobox); - } else { - return makePairwiseConvertIndirect(target, srcType, strict, monobox); - } + return makePairwiseConvertByEditor(target, srcType, strict, monobox); } private static int countNonNull(Object[] array) {
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleStatics.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleStatics.java Tue Nov 25 10:41:40 2014 -0800 @@ -45,23 +45,21 @@ static final boolean DUMP_CLASS_FILES; static final boolean TRACE_INTERPRETER; static final boolean TRACE_METHOD_LINKAGE; - static final boolean USE_LAMBDA_FORM_EDITOR; static final int COMPILE_THRESHOLD; static final int DONT_INLINE_THRESHOLD; static final int PROFILE_LEVEL; static { - final Object[] values = new Object[8]; + final Object[] values = new Object[7]; AccessController.doPrivileged(new PrivilegedAction<Void>() { public Void run() { values[0] = Boolean.getBoolean("java.lang.invoke.MethodHandle.DEBUG_NAMES"); values[1] = Boolean.getBoolean("java.lang.invoke.MethodHandle.DUMP_CLASS_FILES"); values[2] = Boolean.getBoolean("java.lang.invoke.MethodHandle.TRACE_INTERPRETER"); values[3] = Boolean.getBoolean("java.lang.invoke.MethodHandle.TRACE_METHOD_LINKAGE"); - values[4] = Boolean.getBoolean("java.lang.invoke.MethodHandle.USE_LF_EDITOR"); - values[5] = Integer.getInteger("java.lang.invoke.MethodHandle.COMPILE_THRESHOLD", 30); - values[6] = Integer.getInteger("java.lang.invoke.MethodHandle.DONT_INLINE_THRESHOLD", 30); - values[7] = Integer.getInteger("java.lang.invoke.MethodHandle.PROFILE_LEVEL", 0); + values[4] = Integer.getInteger("java.lang.invoke.MethodHandle.COMPILE_THRESHOLD", 0); + values[5] = Integer.getInteger("java.lang.invoke.MethodHandle.DONT_INLINE_THRESHOLD", 30); + values[6] = Integer.getInteger("java.lang.invoke.MethodHandle.PROFILE_LEVEL", 0); return null; } }); @@ -69,10 +67,9 @@ DUMP_CLASS_FILES = (Boolean) values[1]; TRACE_INTERPRETER = (Boolean) values[2]; TRACE_METHOD_LINKAGE = (Boolean) values[3]; - USE_LAMBDA_FORM_EDITOR = (Boolean) values[4]; - COMPILE_THRESHOLD = (Integer) values[5]; - DONT_INLINE_THRESHOLD = (Integer) values[6]; - PROFILE_LEVEL = (Integer) values[7]; + COMPILE_THRESHOLD = (Integer) values[4]; + DONT_INLINE_THRESHOLD = (Integer) values[5]; + PROFILE_LEVEL = (Integer) values[6]; } /** Tell if any of the debugging switches are turned on.
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java Tue Nov 25 10:41:40 2014 -0800 @@ -2103,115 +2103,65 @@ reorder = reorder.clone(); // get a private copy MethodType oldType = target.type(); permuteArgumentChecks(reorder, newType, oldType); - if (USE_LAMBDA_FORM_EDITOR) { - // first detect dropped arguments and handle them separately - int[] originalReorder = reorder; - BoundMethodHandle result = target.rebind(); - LambdaForm form = result.form; - int newArity = newType.parameterCount(); - // Normalize the reordering into a real permutation, - // by removing duplicates and adding dropped elements. - // This somewhat improves lambda form caching, as well - // as simplifying the transform by breaking it up into steps. - for (int ddIdx; (ddIdx = findFirstDupOrDrop(reorder, newArity)) != 0; ) { - if (ddIdx > 0) { - // We found a duplicated entry at reorder[ddIdx]. - // Example: (x,y,z)->asList(x,y,z) - // permuted by [1*,0,1] => (a0,a1)=>asList(a1,a0,a1) - // permuted by [0,1,0*] => (a0,a1)=>asList(a0,a1,a0) - // The starred element corresponds to the argument - // deleted by the dupArgumentForm transform. - int srcPos = ddIdx, dstPos = srcPos, dupVal = reorder[srcPos]; - boolean killFirst = false; - for (int val; (val = reorder[--dstPos]) != dupVal; ) { - // Set killFirst if the dup is larger than an intervening position. - // This will remove at least one inversion from the permutation. - if (dupVal > val) killFirst = true; - } - if (!killFirst) { - srcPos = dstPos; - dstPos = ddIdx; - } - form = form.editor().dupArgumentForm(1 + srcPos, 1 + dstPos); - assert (reorder[srcPos] == reorder[dstPos]); - oldType = oldType.dropParameterTypes(dstPos, dstPos + 1); - // contract the reordering by removing the element at dstPos - int tailPos = dstPos + 1; - System.arraycopy(reorder, tailPos, reorder, dstPos, reorder.length - tailPos); - reorder = Arrays.copyOf(reorder, reorder.length - 1); - } else { - int dropVal = ~ddIdx, insPos = 0; - while (insPos < reorder.length && reorder[insPos] < dropVal) { - // Find first element of reorder larger than dropVal. - // This is where we will insert the dropVal. - insPos += 1; - } - Class<?> ptype = newType.parameterType(dropVal); - form = form.editor().addArgumentForm(1 + insPos, BasicType.basicType(ptype)); - oldType = oldType.insertParameterTypes(insPos, ptype); - // expand the reordering by inserting an element at insPos - int tailPos = insPos + 1; - reorder = Arrays.copyOf(reorder, reorder.length + 1); - System.arraycopy(reorder, insPos, reorder, tailPos, reorder.length - tailPos); - reorder[insPos] = dropVal; + // first detect dropped arguments and handle them separately + int[] originalReorder = reorder; + BoundMethodHandle result = target.rebind(); + LambdaForm form = result.form; + int newArity = newType.parameterCount(); + // Normalize the reordering into a real permutation, + // by removing duplicates and adding dropped elements. + // This somewhat improves lambda form caching, as well + // as simplifying the transform by breaking it up into steps. + for (int ddIdx; (ddIdx = findFirstDupOrDrop(reorder, newArity)) != 0; ) { + if (ddIdx > 0) { + // We found a duplicated entry at reorder[ddIdx]. + // Example: (x,y,z)->asList(x,y,z) + // permuted by [1*,0,1] => (a0,a1)=>asList(a1,a0,a1) + // permuted by [0,1,0*] => (a0,a1)=>asList(a0,a1,a0) + // The starred element corresponds to the argument + // deleted by the dupArgumentForm transform. + int srcPos = ddIdx, dstPos = srcPos, dupVal = reorder[srcPos]; + boolean killFirst = false; + for (int val; (val = reorder[--dstPos]) != dupVal; ) { + // Set killFirst if the dup is larger than an intervening position. + // This will remove at least one inversion from the permutation. + if (dupVal > val) killFirst = true; } - assert (permuteArgumentChecks(reorder, newType, oldType)); + if (!killFirst) { + srcPos = dstPos; + dstPos = ddIdx; + } + form = form.editor().dupArgumentForm(1 + srcPos, 1 + dstPos); + assert (reorder[srcPos] == reorder[dstPos]); + oldType = oldType.dropParameterTypes(dstPos, dstPos + 1); + // contract the reordering by removing the element at dstPos + int tailPos = dstPos + 1; + System.arraycopy(reorder, tailPos, reorder, dstPos, reorder.length - tailPos); + reorder = Arrays.copyOf(reorder, reorder.length - 1); + } else { + int dropVal = ~ddIdx, insPos = 0; + while (insPos < reorder.length && reorder[insPos] < dropVal) { + // Find first element of reorder larger than dropVal. + // This is where we will insert the dropVal. + insPos += 1; + } + Class<?> ptype = newType.parameterType(dropVal); + form = form.editor().addArgumentForm(1 + insPos, BasicType.basicType(ptype)); + oldType = oldType.insertParameterTypes(insPos, ptype); + // expand the reordering by inserting an element at insPos + int tailPos = insPos + 1; + reorder = Arrays.copyOf(reorder, reorder.length + 1); + System.arraycopy(reorder, insPos, reorder, tailPos, reorder.length - tailPos); + reorder[insPos] = dropVal; } - assert (reorder.length == newArity); // a perfect permutation - // Note: This may cache too many distinct LFs. Consider backing off to varargs code. - form = form.editor().permuteArgumentsForm(1, reorder); - if (newType == result.type() && form == result.internalForm()) - return result; - return result.copyWith(newType, form); - } else { - // first detect dropped arguments and handle them separately - MethodHandle originalTarget = target; - int newArity = newType.parameterCount(); - for (int dropIdx; (dropIdx = findFirstDrop(reorder, newArity)) >= 0; ) { - // dropIdx is missing from reorder; add it in at the end - int oldArity = reorder.length; - target = dropArguments(target, oldArity, newType.parameterType(dropIdx)); - reorder = Arrays.copyOf(reorder, oldArity + 1); - reorder[oldArity] = dropIdx; - } - assert(target == originalTarget || permuteArgumentChecks(reorder, newType, target.type())); - // Note: This may cache too many distinct LFs. Consider backing off to varargs code. - BoundMethodHandle result = target.rebind(); - LambdaForm form = result.form.permuteArguments(1, reorder, basicTypes(newType.parameterList())); - return result.copyWith(newType, form); + assert (permuteArgumentChecks(reorder, newType, oldType)); } - } - - /** Return the first value in [0..newArity-1] that is not present in reorder. */ - private static int findFirstDrop(int[] reorder, int newArity) { - final int BIT_LIMIT = 63; // max number of bits in bit mask - if (newArity < BIT_LIMIT) { - long mask = 0; - for (int arg : reorder) { - assert(arg < newArity); - mask |= (1L << arg); - } - if (mask == (1L << newArity) - 1) { - assert(Long.numberOfTrailingZeros(Long.lowestOneBit(~mask)) == newArity); - return -1; - } - // find first zero - long zeroBit = Long.lowestOneBit(~mask); - int zeroPos = Long.numberOfTrailingZeros(zeroBit); - assert(zeroPos < newArity); - return zeroPos; - } else { - BitSet mask = new BitSet(newArity); - for (int arg : reorder) { - assert (arg < newArity); - mask.set(arg); - } - int zeroPos = mask.nextClearBit(0); - assert(zeroPos <= newArity); - if (zeroPos == newArity) - return -1; - return zeroPos; - } + assert (reorder.length == newArity); // a perfect permutation + // Note: This may cache too many distinct LFs. Consider backing off to varargs code. + form = form.editor().permuteArgumentsForm(1, reorder); + if (newType == result.type() && form == result.internalForm()) + return result; + return result.copyWith(newType, form); } /** @@ -2502,13 +2452,9 @@ if (dropped == 0) return target; BoundMethodHandle result = target.rebind(); LambdaForm lform = result.form; - if (USE_LAMBDA_FORM_EDITOR) { - int insertFormArg = 1 + pos; - for (Class<?> ptype : valueTypes) { - lform = lform.editor().addArgumentForm(insertFormArg++, BasicType.basicType(ptype)); - } - } else { - lform = lform.addArguments(pos, valueTypes); + int insertFormArg = 1 + pos; + for (Class<?> ptype : valueTypes) { + lform = lform.editor().addArgumentForm(insertFormArg++, BasicType.basicType(ptype)); } result = result.copyWith(newType, lform); return result; @@ -2659,18 +2605,14 @@ /*non-public*/ static MethodHandle filterArgument(MethodHandle target, int pos, MethodHandle filter) { filterArgumentChecks(target, pos, filter); - if (USE_LAMBDA_FORM_EDITOR) { - MethodType targetType = target.type(); - MethodType filterType = filter.type(); - BoundMethodHandle result = target.rebind(); - Class<?> newParamType = filterType.parameterType(0); - LambdaForm lform = result.editor().filterArgumentForm(1 + pos, BasicType.basicType(newParamType)); - MethodType newType = targetType.changeParameterType(pos, newParamType); - result = result.copyWithExtendL(newType, lform, filter); - return result; - } else { - return MethodHandleImpl.makeCollectArguments(target, filter, pos, false); - } + MethodType targetType = target.type(); + MethodType filterType = filter.type(); + BoundMethodHandle result = target.rebind(); + Class<?> newParamType = filterType.parameterType(0); + LambdaForm lform = result.editor().filterArgumentForm(1 + pos, BasicType.basicType(newParamType)); + MethodType newType = targetType.changeParameterType(pos, newParamType); + result = result.copyWithExtendL(newType, lform, filter); + return result; } private static void filterArgumentsCheckArity(MethodHandle target, int pos, MethodHandle[] filters) { @@ -2797,21 +2739,17 @@ public static MethodHandle collectArguments(MethodHandle target, int pos, MethodHandle filter) { MethodType newType = collectArgumentsChecks(target, pos, filter); - if (USE_LAMBDA_FORM_EDITOR) { - MethodType collectorType = filter.type(); - BoundMethodHandle result = target.rebind(); - LambdaForm lform; - if (collectorType.returnType().isArray() && filter.intrinsicName() == Intrinsic.NEW_ARRAY) { - lform = result.editor().collectArgumentArrayForm(1 + pos, filter); - if (lform != null) { - return result.copyWith(newType, lform); - } + MethodType collectorType = filter.type(); + BoundMethodHandle result = target.rebind(); + LambdaForm lform; + if (collectorType.returnType().isArray() && filter.intrinsicName() == Intrinsic.NEW_ARRAY) { + lform = result.editor().collectArgumentArrayForm(1 + pos, filter); + if (lform != null) { + return result.copyWith(newType, lform); } - lform = result.editor().collectArgumentsForm(1 + pos, collectorType.basicType()); - return result.copyWithExtendL(newType, lform, filter); - } else { - return MethodHandleImpl.makeCollectArguments(target, filter, pos, false); } + lform = result.editor().collectArgumentsForm(1 + pos, collectorType.basicType()); + return result.copyWithExtendL(newType, lform, filter); } private static MethodType collectArgumentsChecks(MethodHandle target, int pos, MethodHandle filter) throws RuntimeException { @@ -2890,16 +2828,12 @@ MethodType targetType = target.type(); MethodType filterType = filter.type(); filterReturnValueChecks(targetType, filterType); - if (USE_LAMBDA_FORM_EDITOR) { - BoundMethodHandle result = target.rebind(); - BasicType rtype = BasicType.basicType(filterType.returnType()); - LambdaForm lform = result.editor().filterReturnForm(rtype, false); - MethodType newType = targetType.changeReturnType(filterType.returnType()); - result = result.copyWithExtendL(newType, lform, filter); - return result; - } else { - return MethodHandleImpl.makeCollectArguments(filter, target, 0, false); - } + BoundMethodHandle result = target.rebind(); + BasicType rtype = BasicType.basicType(filterType.returnType()); + LambdaForm lform = result.editor().filterReturnForm(rtype, false); + MethodType newType = targetType.changeReturnType(filterType.returnType()); + result = result.copyWithExtendL(newType, lform, filter); + return result; } private static void filterReturnValueChecks(MethodType targetType, MethodType filterType) throws RuntimeException { @@ -2993,19 +2927,15 @@ MethodType targetType = target.type(); MethodType combinerType = combiner.type(); Class<?> rtype = foldArgumentChecks(foldPos, targetType, combinerType); - if (USE_LAMBDA_FORM_EDITOR) { - BoundMethodHandle result = target.rebind(); - boolean dropResult = (rtype == void.class); - // Note: This may cache too many distinct LFs. Consider backing off to varargs code. - LambdaForm lform = result.editor().foldArgumentsForm(1 + foldPos, dropResult, combinerType.basicType()); - MethodType newType = targetType; - if (!dropResult) - newType = newType.dropParameterTypes(foldPos, foldPos + 1); - result = result.copyWithExtendL(newType, lform, combiner); - return result; - } else { - return MethodHandleImpl.makeCollectArguments(target, combiner, foldPos, true); - } + BoundMethodHandle result = target.rebind(); + boolean dropResult = (rtype == void.class); + // Note: This may cache too many distinct LFs. Consider backing off to varargs code. + LambdaForm lform = result.editor().foldArgumentsForm(1 + foldPos, dropResult, combinerType.basicType()); + MethodType newType = targetType; + if (!dropResult) + newType = newType.dropParameterTypes(foldPos, foldPos + 1); + result = result.copyWithExtendL(newType, lform, combiner); + return result; } private static Class<?> foldArgumentChecks(int foldPos, MethodType targetType, MethodType combinerType) {
--- a/jdk/src/java.base/share/classes/java/nio/channels/spi/AbstractInterruptibleChannel.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.base/share/classes/java/nio/channels/spi/AbstractInterruptibleChannel.java Tue Nov 25 10:41:40 2014 -0800 @@ -198,7 +198,7 @@ blockedOn(null); Thread interrupted = this.interrupted; if (interrupted != null && interrupted == Thread.currentThread()) { - interrupted = null; + this.interrupted = null; throw new ClosedByInterruptException(); } if (!completed && !open)
--- a/jdk/src/java.base/share/classes/java/text/AttributedString.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.base/share/classes/java/text/AttributedString.java Tue Nov 25 10:41:40 2014 -0800 @@ -48,21 +48,18 @@ */ public class AttributedString { - - // since there are no vectors of int, we have to use arrays. - // We allocate them in chunks of 10 elements so we don't have to allocate all the time. - private static final int ARRAY_SIZE_INCREMENT = 10; - // field holding the text String text; - // fields holding run attribute information - // run attributes are organized by run - int runArraySize; // current size of the arrays - int runCount; // actual number of runs, <= runArraySize - int runStarts[]; // start index for each run - Vector<Attribute> runAttributes[]; // vector of attribute keys for each run - Vector<Object> runAttributeValues[]; // parallel vector of attribute values for each run + // Fields holding run attribute information. + // Run attributes are organized by run. + // Arrays are always of equal lengths (the current capacity). + // Since there are no vectors of int, we have to use arrays. + private static final int INITIAL_CAPACITY = 10; + int runCount; // actual number of runs, <= current capacity + int[] runStarts; // start index for each run + Vector<Attribute>[] runAttributes; // vector of attribute keys for each run + Vector<Object>[] runAttributeValues; // parallel vector of attribute values for each run /** * Constructs an AttributedString instance with the given @@ -416,18 +413,17 @@ private final void createRunAttributeDataVectors() { // use temporary variables so things remain consistent in case of an exception - int newRunStarts[] = new int[ARRAY_SIZE_INCREMENT]; + int[] newRunStarts = new int[INITIAL_CAPACITY]; @SuppressWarnings("unchecked") - Vector<Attribute> newRunAttributes[] = (Vector<Attribute>[]) new Vector<?>[ARRAY_SIZE_INCREMENT]; + Vector<Attribute>[] newRunAttributes = (Vector<Attribute>[]) new Vector<?>[INITIAL_CAPACITY]; @SuppressWarnings("unchecked") - Vector<Object> newRunAttributeValues[] = (Vector<Object>[]) new Vector<?>[ARRAY_SIZE_INCREMENT]; + Vector<Object>[] newRunAttributeValues = (Vector<Object>[]) new Vector<?>[INITIAL_CAPACITY]; runStarts = newRunStarts; runAttributes = newRunAttributes; runAttributeValues = newRunAttributeValues; - runArraySize = ARRAY_SIZE_INCREMENT; runCount = 1; // assume initial run starting at index 0 } @@ -465,25 +461,22 @@ // we'll have to break up a run // first, make sure we have enough space in our arrays - if (runCount == runArraySize) { - int newArraySize = runArraySize + ARRAY_SIZE_INCREMENT; - int newRunStarts[] = new int[newArraySize]; + int currentCapacity = runStarts.length; + if (runCount == currentCapacity) { + // We need to resize - we grow capacity by 25%. + int newCapacity = currentCapacity + (currentCapacity >> 2); - @SuppressWarnings("unchecked") - Vector<Attribute> newRunAttributes[] = (Vector<Attribute>[]) new Vector<?>[newArraySize]; + // use temporary variables so things remain consistent in case of an exception + int[] newRunStarts = + Arrays.copyOf(runStarts, newCapacity); + Vector<Attribute>[] newRunAttributes = + Arrays.copyOf(runAttributes, newCapacity); + Vector<Object>[] newRunAttributeValues = + Arrays.copyOf(runAttributeValues, newCapacity); - @SuppressWarnings("unchecked") - Vector<Object> newRunAttributeValues[] = (Vector<Object>[]) new Vector<?>[newArraySize]; - - for (int i = 0; i < runArraySize; i++) { - newRunStarts[i] = runStarts[i]; - newRunAttributes[i] = runAttributes[i]; - newRunAttributeValues[i] = runAttributeValues[i]; - } runStarts = newRunStarts; runAttributes = newRunAttributes; runAttributeValues = newRunAttributeValues; - runArraySize = newArraySize; } // make copies of the attribute information of the old run that the new one used to be part of
--- a/jdk/src/java.base/share/classes/java/util/Formatter.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.base/share/classes/java/util/Formatter.java Tue Nov 25 10:41:40 2014 -0800 @@ -2624,10 +2624,11 @@ private boolean dt = false; private char c; - private int index(String s) { - if (s != null) { + private int index(String s, int start, int end) { + if (start >= 0) { try { - index = Integer.parseInt(s.substring(0, s.length() - 1)); + // skip the trailing '$' + index = Integer.parseInt(s, start, end - 1, 10); } catch (NumberFormatException x) { assert(false); } @@ -2648,11 +2649,11 @@ return f; } - private int width(String s) { + private int width(String s, int start, int end) { width = -1; - if (s != null) { + if (start >= 0) { try { - width = Integer.parseInt(s); + width = Integer.parseInt(s, start, end, 10); if (width < 0) throw new IllegalFormatWidthException(width); } catch (NumberFormatException x) { @@ -2662,12 +2663,12 @@ return width; } - private int precision(String s) { + private int precision(String s, int start, int end) { precision = -1; - if (s != null) { + if (start >= 0) { try { - // remove the '.' - precision = Integer.parseInt(s.substring(1)); + // skip the leading '.' + precision = Integer.parseInt(s, start + 1, end, 10); if (precision < 0) throw new IllegalFormatPrecisionException(precision); } catch (NumberFormatException x) { @@ -2695,23 +2696,19 @@ } FormatSpecifier(String s, Matcher m) { - int idx = 1; - - index(m.group(idx++)); - flags(s, m.start(idx), m.end(idx++)); - width(m.group(idx++)); - precision(m.group(idx++)); - - int tTStart = m.start(idx); - int tTEnd = m.end(idx++); - if (tTStart != -1 && tTEnd != -1) { + index(s, m.start(1), m.end(1)); + flags(s, m.start(2), m.end(2)); + width(s, m.start(3), m.end(3)); + precision(s, m.start(4), m.end(4)); + + int tTStart = m.start(5); + if (tTStart >= 0) { dt = true; - if (tTStart == tTEnd - 1 && s.charAt(tTStart) == 'T') { + if (s.charAt(tTStart) == 'T') { f.add(Flags.UPPERCASE); } } - - conversion(s.charAt(m.start(idx))); + conversion(s.charAt(m.start(6))); if (dt) checkDateTime();
--- a/jdk/src/java.base/share/classes/java/util/zip/Adler32.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.base/share/classes/java/util/zip/Adler32.java Tue Nov 25 10:41:40 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2014, 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,9 +34,8 @@ * can be computed much faster. * * <p> Passing a {@code null} argument to a method in this class will cause - * a {@link NullPointerException} to be thrown. + * a {@link NullPointerException} to be thrown.</p> * - * @see Checksum * @author David Connelly */ public @@ -53,9 +52,8 @@ /** * Updates the checksum with the specified byte (the low eight * bits of the argument b). - * - * @param b the byte to update the checksum with */ + @Override public void update(int b) { adler = update(adler, b); } @@ -63,11 +61,12 @@ /** * Updates the checksum with the specified array of bytes. * - * @throws ArrayIndexOutOfBoundsException - * if {@code off} is negative, or {@code len} is negative, - * or {@code off+len} is greater than the length of the - * array {@code b} + * @throws ArrayIndexOutOfBoundsException + * if {@code off} is negative, or {@code len} is negative, or + * {@code off+len} is negative or greater than the length of + * the array {@code b}. */ + @Override public void update(byte[] b, int off, int len) { if (b == null) { throw new NullPointerException(); @@ -79,28 +78,15 @@ } /** - * Updates the checksum with the specified array of bytes. - * - * @param b the byte array to update the checksum with - */ - public void update(byte[] b) { - adler = updateBytes(adler, b, 0, b.length); - } - - - /** * Updates the checksum with the bytes from the specified buffer. * - * The checksum is updated using - * buffer.{@link java.nio.Buffer#remaining() remaining()} - * bytes starting at - * buffer.{@link java.nio.Buffer#position() position()} - * Upon return, the buffer's position will be updated to its - * limit; its limit will not have been changed. + * The checksum is updated with the remaining bytes in the buffer, starting + * at the buffer's position. Upon return, the buffer's position will be + * updated to its limit; its limit will not have been changed. * - * @param buffer the ByteBuffer to update the checksum with * @since 1.8 */ + @Override public void update(ByteBuffer buffer) { int pos = buffer.position(); int limit = buffer.limit(); @@ -113,9 +99,12 @@ } else if (buffer.hasArray()) { adler = updateBytes(adler, buffer.array(), pos + buffer.arrayOffset(), rem); } else { - byte[] b = new byte[rem]; - buffer.get(b); - adler = updateBytes(adler, b, 0, b.length); + byte[] b = new byte[Math.min(buffer.remaining(), 4096)]; + while (buffer.hasRemaining()) { + int length = Math.min(buffer.remaining(), b.length); + buffer.get(b, 0, length); + update(b, 0, length); + } } buffer.position(limit); } @@ -123,6 +112,7 @@ /** * Resets the checksum to initial value. */ + @Override public void reset() { adler = 1; } @@ -130,6 +120,7 @@ /** * Returns the checksum value. */ + @Override public long getValue() { return (long)adler & 0xffffffffL; }
--- a/jdk/src/java.base/share/classes/java/util/zip/CRC32.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.base/share/classes/java/util/zip/CRC32.java Tue Nov 25 10:41:40 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2014, 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,9 +32,8 @@ * A class that can be used to compute the CRC-32 of a data stream. * * <p> Passing a {@code null} argument to a method in this class will cause - * a {@link NullPointerException} to be thrown. + * a {@link NullPointerException} to be thrown.</p> * - * @see Checksum * @author David Connelly */ public @@ -51,9 +50,8 @@ /** * Updates the CRC-32 checksum with the specified byte (the low * eight bits of the argument b). - * - * @param b the byte to update the checksum with */ + @Override public void update(int b) { crc = update(crc, b); } @@ -61,11 +59,12 @@ /** * Updates the CRC-32 checksum with the specified array of bytes. * - * @throws ArrayIndexOutOfBoundsException - * if {@code off} is negative, or {@code len} is negative, - * or {@code off+len} is greater than the length of the - * array {@code b} + * @throws ArrayIndexOutOfBoundsException + * if {@code off} is negative, or {@code len} is negative, or + * {@code off+len} is negative or greater than the length of + * the array {@code b}. */ + @Override public void update(byte[] b, int off, int len) { if (b == null) { throw new NullPointerException(); @@ -77,27 +76,15 @@ } /** - * Updates the CRC-32 checksum with the specified array of bytes. + * Updates the CRC-32 checksum with the bytes from the specified buffer. * - * @param b the array of bytes to update the checksum with - */ - public void update(byte[] b) { - crc = updateBytes(crc, b, 0, b.length); - } - - /** - * Updates the checksum with the bytes from the specified buffer. + * The checksum is updated with the remaining bytes in the buffer, starting + * at the buffer's position. Upon return, the buffer's position will be + * updated to its limit; its limit will not have been changed. * - * The checksum is updated using - * buffer.{@link java.nio.Buffer#remaining() remaining()} - * bytes starting at - * buffer.{@link java.nio.Buffer#position() position()} - * Upon return, the buffer's position will - * be updated to its limit; its limit will not have been changed. - * - * @param buffer the ByteBuffer to update the checksum with * @since 1.8 */ + @Override public void update(ByteBuffer buffer) { int pos = buffer.position(); int limit = buffer.limit(); @@ -110,9 +97,12 @@ } else if (buffer.hasArray()) { crc = updateBytes(crc, buffer.array(), pos + buffer.arrayOffset(), rem); } else { - byte[] b = new byte[rem]; - buffer.get(b); - crc = updateBytes(crc, b, 0, b.length); + byte[] b = new byte[Math.min(buffer.remaining(), 4096)]; + while (buffer.hasRemaining()) { + int length = Math.min(buffer.remaining(), b.length); + buffer.get(b, 0, length); + update(b, 0, length); + } } buffer.position(limit); } @@ -120,6 +110,7 @@ /** * Resets CRC-32 to initial value. */ + @Override public void reset() { crc = 0; } @@ -127,6 +118,7 @@ /** * Returns CRC-32 value. */ + @Override public long getValue() { return (long)crc & 0xffffffffL; }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/src/java.base/share/classes/java/util/zip/CRC32C.java Tue Nov 25 10:41:40 2014 -0800 @@ -0,0 +1,339 @@ +/* + * Copyright (c) 2014, 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.zip; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import sun.misc.Unsafe; +import sun.nio.ch.DirectBuffer; + +/** + * A class that can be used to compute the CRC-32C of a data stream. + * + * <p> + * CRC-32C is defined in <a href="http://www.ietf.org/rfc/rfc3720.txt">RFC + * 3720</a>: Internet Small Computer Systems Interface (iSCSI). + * </p> + * + * <p> + * Passing a {@code null} argument to a method in this class will cause a + * {@link NullPointerException} to be thrown. + * </p> + * + * @since 1.9 + */ +public final class CRC32C implements Checksum { + + /* + * This CRC-32C implementation uses the 'slicing-by-8' algorithm described + * in the paper "A Systematic Approach to Building High Performance + * Software-Based CRC Generators" by Michael E. Kounavis and Frank L. Berry, + * Intel Research and Development + */ + + /** + * CRC-32C Polynomial + */ + private static final int CRC32C_POLY = 0x1EDC6F41; + private static final int REVERSED_CRC32C_POLY = Integer.reverse(CRC32C_POLY); + + private static final Unsafe UNSAFE = Unsafe.getUnsafe(); + + // Lookup tables + // Lookup table for single byte calculations + private static final int[] byteTable; + // Lookup tables for bulk operations in 'slicing-by-8' algorithm + private static final int[][] byteTables = new int[8][256]; + private static final int[] byteTable0 = byteTables[0]; + private static final int[] byteTable1 = byteTables[1]; + private static final int[] byteTable2 = byteTables[2]; + private static final int[] byteTable3 = byteTables[3]; + private static final int[] byteTable4 = byteTables[4]; + private static final int[] byteTable5 = byteTables[5]; + private static final int[] byteTable6 = byteTables[6]; + private static final int[] byteTable7 = byteTables[7]; + + static { + // Generate lookup tables + // High-order polynomial term stored in LSB of r. + for (int index = 0; index < byteTables[0].length; index++) { + int r = index; + for (int i = 0; i < Byte.SIZE; i++) { + if ((r & 1) != 0) { + r = (r >>> 1) ^ REVERSED_CRC32C_POLY; + } else { + r >>>= 1; + } + } + byteTables[0][index] = r; + } + + for (int index = 0; index < byteTables[0].length; index++) { + int r = byteTables[0][index]; + + for (int k = 1; k < byteTables.length; k++) { + r = byteTables[0][r & 0xFF] ^ (r >>> 8); + byteTables[k][index] = r; + } + } + + if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) { + byteTable = byteTables[0]; + } else { // ByteOrder.BIG_ENDIAN + byteTable = new int[byteTable0.length]; + System.arraycopy(byteTable0, 0, byteTable, 0, byteTable0.length); + for (int[] table : byteTables) { + for (int index = 0; index < table.length; index++) { + table[index] = Integer.reverseBytes(table[index]); + } + } + } + } + + /** + * Calculated CRC-32C value + */ + private int crc = 0xFFFFFFFF; + + /** + * Creates a new CRC32C object. + */ + public CRC32C() { + } + + /** + * Updates the CRC-32C checksum with the specified byte (the low eight bits + * of the argument b). + */ + @Override + public void update(int b) { + crc = (crc >>> 8) ^ byteTable[(crc ^ (b & 0xFF)) & 0xFF]; + } + + /** + * Updates the CRC-32C checksum with the specified array of bytes. + * + * @throws ArrayIndexOutOfBoundsException + * if {@code off} is negative, or {@code len} is negative, or + * {@code off+len} is negative or greater than the length of + * the array {@code b}. + */ + @Override + public void update(byte[] b, int off, int len) { + if (b == null) { + throw new NullPointerException(); + } + if (off < 0 || len < 0 || off > b.length - len) { + throw new ArrayIndexOutOfBoundsException(); + } + crc = updateBytes(crc, b, off, (off + len)); + } + + /** + * Updates the CRC-32C checksum with the bytes from the specified buffer. + * + * The checksum is updated with the remaining bytes in the buffer, starting + * at the buffer's position. Upon return, the buffer's position will be + * updated to its limit; its limit will not have been changed. + */ + @Override + public void update(ByteBuffer buffer) { + int pos = buffer.position(); + int limit = buffer.limit(); + assert (pos <= limit); + int rem = limit - pos; + if (rem <= 0) { + return; + } + + if (buffer instanceof DirectBuffer) { + crc = updateDirectByteBuffer(crc, ((DirectBuffer) buffer).address(), + pos, limit); + } else if (buffer.hasArray()) { + crc = updateBytes(crc, buffer.array(), pos + buffer.arrayOffset(), + limit + buffer.arrayOffset()); + } else { + byte[] b = new byte[Math.min(buffer.remaining(), 4096)]; + while (buffer.hasRemaining()) { + int length = Math.min(buffer.remaining(), b.length); + buffer.get(b, 0, length); + update(b, 0, length); + } + } + buffer.position(limit); + } + + /** + * Resets CRC-32C to initial value. + */ + @Override + public void reset() { + crc = 0xFFFFFFFF; + } + + /** + * Returns CRC-32C value. + */ + @Override + public long getValue() { + return (~crc) & 0xFFFFFFFFL; + } + + /** + * Updates the CRC-32C checksum with the specified array of bytes. + */ + private static int updateBytes(int crc, byte[] b, int off, int end) { + + // Do only byte reads for arrays so short they can't be aligned + // or if bytes are stored with a larger witdh than one byte.,% + if (end - off >= 8 && Unsafe.ARRAY_BYTE_INDEX_SCALE == 1) { + + // align on 8 bytes + int alignLength + = (8 - ((Unsafe.ARRAY_BYTE_BASE_OFFSET + off) & 0x7)) & 0x7; + for (int alignEnd = off + alignLength; off < alignEnd; off++) { + crc = (crc >>> 8) ^ byteTable[(crc ^ b[off]) & 0xFF]; + } + + if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN) { + crc = Integer.reverseBytes(crc); + } + + // slicing-by-8 + for (; off < (end - Long.BYTES); off += Long.BYTES) { + int firstHalf; + int secondHalf; + if (Unsafe.ADDRESS_SIZE == 4) { + // On 32 bit platforms read two ints instead of a single 64bit long + firstHalf = UNSAFE.getInt(b, Unsafe.ARRAY_BYTE_BASE_OFFSET + off); + secondHalf = UNSAFE.getInt(b, Unsafe.ARRAY_BYTE_BASE_OFFSET + off + + Integer.BYTES); + } else { + long value = UNSAFE.getLong(b, Unsafe.ARRAY_BYTE_BASE_OFFSET + off); + if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) { + firstHalf = (int) value; + secondHalf = (int) (value >>> 32); + } else { // ByteOrder.BIG_ENDIAN + firstHalf = (int) (value >>> 32); + secondHalf = (int) value; + } + } + crc ^= firstHalf; + if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) { + crc = byteTable7[crc & 0xFF] + ^ byteTable6[(crc >>> 8) & 0xFF] + ^ byteTable5[(crc >>> 16) & 0xFF] + ^ byteTable4[crc >>> 24] + ^ byteTable3[secondHalf & 0xFF] + ^ byteTable2[(secondHalf >>> 8) & 0xFF] + ^ byteTable1[(secondHalf >>> 16) & 0xFF] + ^ byteTable0[secondHalf >>> 24]; + } else { // ByteOrder.BIG_ENDIAN + crc = byteTable0[secondHalf & 0xFF] + ^ byteTable1[(secondHalf >>> 8) & 0xFF] + ^ byteTable2[(secondHalf >>> 16) & 0xFF] + ^ byteTable3[secondHalf >>> 24] + ^ byteTable4[crc & 0xFF] + ^ byteTable5[(crc >>> 8) & 0xFF] + ^ byteTable6[(crc >>> 16) & 0xFF] + ^ byteTable7[crc >>> 24]; + } + } + + if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN) { + crc = Integer.reverseBytes(crc); + } + } + + // Tail + for (; off < end; off++) { + crc = (crc >>> 8) ^ byteTable[(crc ^ b[off]) & 0xFF]; + } + + return crc; + } + + /** + * Updates the CRC-32C checksum reading from the specified address. + */ + private static int updateDirectByteBuffer(int crc, long address, + int off, int end) { + + // Do only byte reads for arrays so short they can't be aligned + if (end - off >= 8) { + + // align on 8 bytes + int alignLength = (8 - (int) ((address + off) & 0x7)) & 0x7; + for (int alignEnd = off + alignLength; off < alignEnd; off++) { + crc = (crc >>> 8) + ^ byteTable[(crc ^ UNSAFE.getByte(address + off)) & 0xFF]; + } + + if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN) { + crc = Integer.reverseBytes(crc); + } + + // slicing-by-8 + for (; off <= (end - Long.BYTES); off += Long.BYTES) { + // Always reading two ints as reading a long followed by + // shifting and casting was slower. + int firstHalf = UNSAFE.getInt(address + off); + int secondHalf = UNSAFE.getInt(address + off + Integer.BYTES); + crc ^= firstHalf; + if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) { + crc = byteTable7[crc & 0xFF] + ^ byteTable6[(crc >>> 8) & 0xFF] + ^ byteTable5[(crc >>> 16) & 0xFF] + ^ byteTable4[crc >>> 24] + ^ byteTable3[secondHalf & 0xFF] + ^ byteTable2[(secondHalf >>> 8) & 0xFF] + ^ byteTable1[(secondHalf >>> 16) & 0xFF] + ^ byteTable0[secondHalf >>> 24]; + } else { // ByteOrder.BIG_ENDIAN + crc = byteTable0[secondHalf & 0xFF] + ^ byteTable1[(secondHalf >>> 8) & 0xFF] + ^ byteTable2[(secondHalf >>> 16) & 0xFF] + ^ byteTable3[secondHalf >>> 24] + ^ byteTable4[crc & 0xFF] + ^ byteTable5[(crc >>> 8) & 0xFF] + ^ byteTable6[(crc >>> 16) & 0xFF] + ^ byteTable7[crc >>> 24]; + } + } + + if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN) { + crc = Integer.reverseBytes(crc); + } + } + + // Tail + for (; off < end; off++) { + crc = (crc >>> 8) + ^ byteTable[(crc ^ UNSAFE.getByte(address + off)) & 0xFF]; + } + + return crc; + } +}
--- a/jdk/src/java.base/share/classes/java/util/zip/Checksum.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.base/share/classes/java/util/zip/Checksum.java Tue Nov 25 10:41:40 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,16 +22,17 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ +package java.util.zip; -package java.util.zip; +import java.nio.ByteBuffer; /** * An interface representing a data checksum. * - * @author David Connelly + * @author David Connelly */ -public -interface Checksum { +public interface Checksum { + /** * Updates the current checksum with the specified byte. * @@ -41,6 +42,24 @@ /** * Updates the current checksum with the specified array of bytes. + * + * @implSpec This default implementation is equal to calling + * {@code update(b, 0, b.length)}. + * + * @param b the array of bytes to update the checksum with + * + * @throws NullPointerException + * if {@code b} is {@code null} + * + * @since 1.9 + */ + default public void update(byte[] b) { + update(b, 0, b.length); + } + + /** + * Updates the current checksum with the specified array of bytes. + * * @param b the byte array to update the checksum with * @param off the start offset of the data * @param len the number of bytes to use for the update @@ -48,7 +67,64 @@ public void update(byte[] b, int off, int len); /** + * Updates the current checksum with the bytes from the specified buffer. + * + * The checksum is updated with the remaining bytes in the buffer, starting + * at the buffer's position. Upon return, the buffer's position will be + * updated to its limit; its limit will not have been changed. + * + * @apiNote For best performance with DirectByteBuffer and other ByteBuffer + * implementations without a backing array implementers of this interface + * should override this method. + * + * @implSpec The default implementation has the following behavior.<br> + * For ByteBuffers backed by an accessible byte array. + * <pre>{@code + * update(buffer.array(), + * buffer.position() + buffer.arrayOffset(), + * buffer.remaining()); + * }</pre> + * For ByteBuffers not backed by an accessible byte array. + * <pre>{@code + * byte[] b = new byte[Math.min(buffer.remaining(), 4096)]; + * while (buffer.hasRemaining()) { + * int length = Math.min(buffer.remaining(), b.length); + * buffer.get(b, 0, length); + * update(b, 0, length); + * } + * }</pre> + * + * @param buffer the ByteBuffer to update the checksum with + * + * @throws NullPointerException + * if {@code buffer} is {@code null} + * + * @since 1.9 + */ + default public void update(ByteBuffer buffer) { + int pos = buffer.position(); + int limit = buffer.limit(); + assert (pos <= limit); + int rem = limit - pos; + if (rem <= 0) { + return; + } + if (buffer.hasArray()) { + update(buffer.array(), pos + buffer.arrayOffset(), rem); + } else { + byte[] b = new byte[Math.min(buffer.remaining(), 4096)]; + while (buffer.hasRemaining()) { + int length = Math.min(buffer.remaining(), b.length); + buffer.get(b, 0, length); + update(b, 0, length); + } + } + buffer.position(limit); + } + + /** * Returns the current checksum value. + * * @return the current checksum value */ public long getValue();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/src/java.base/share/classes/java/util/zip/package-info.java Tue Nov 25 10:41:40 2014 -0800 @@ -0,0 +1,77 @@ +/* + * Copyright (c) 1998, 2014, 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. + */ + +/** + * Provides classes for reading and writing the standard ZIP and GZIP file + * formats. Also includes classes for compressing and decompressing data using + * the DEFLATE compression algorithm, which is used by the ZIP and GZIP file + * formats. Additionally, there are utility classes for computing the CRC-32, + * CRC-32C and Adler-32 checksums of arbitrary input streams. + * + * <h2>Package Specification</h2> + * + * <ul> + * <li><a href="http://www.info-zip.org/doc/appnote-19970311-iz.zip"> + * Info-ZIP Application Note 970311</a> - a detailed description of + * the Info-ZIP format upon which the {@code java.util.zip} classes + * are based. + * <li><a name="zip64">An implementation may optionally support the + * ZIP64(tm) format extensions defined by the</a> + * <a href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT"> + * PKWARE ZIP File Format Specification</a>. The ZIP64(tm) format + * extensions are used to overcome the size limitations of the + * original ZIP format. + * <li><a name="lang_encoding">APPENDIX D of</a> + * <a href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT"> + * PKWARE ZIP File Format Specification</a> - Language Encoding Flag + * (EFS) to encode ZIP entry filename and comment fields using UTF-8. + * <li><a href="http://www.ietf.org/rfc/rfc1950.txt"> + * ZLIB Compressed Data Format Specification version 3.3</a> + * + * <a href="http://www.ietf.org/rfc/rfc1950.txt.pdf">(pdf)</a> + * (RFC 1950) + * <li><a href="http://www.ietf.org/rfc/rfc1951.txt"> + * DEFLATE Compressed Data Format Specification version 1.3</a> + * + * <a href="http://www.ietf.org/rfc/rfc1951.txt.pdf">(pdf)</a> + * (RFC 1951) + * <li><a href="http://www.ietf.org/rfc/rfc1952.txt"> + * GZIP file format specification version 4.3</a> + * + * <a href="http://www.ietf.org/rfc/rfc1952.txt.pdf">(pdf)</a> + * (RFC 1952) + * <li>CRC-32 checksum is described in RFC 1952 (above) + * <li>CRC-32C checksum is described in + * <a href="http://www.ietf.org/rfc/rfc3720.txt">Internet Small + * Computer Systems Interface (iSCSI)</a> + * + * <a href="http://www.ietf.org/rfc/rfc3720.txt.pdf">(pdf)</a> + * (RFC 3720) + * <li>Adler-32 checksum is described in RFC 1950 (above) + * </ul> + * + * @since 1.1 + */ +package java.util.zip;
--- a/jdk/src/java.base/share/classes/java/util/zip/package.html Mon Nov 17 12:32:27 2014 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> -<html> -<head> -<!-- -Copyright (c) 1998, 2012, 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. ---> - -</head> -<body bgcolor="white"> - -Provides classes for reading and writing the standard ZIP and GZIP -file formats. Also includes classes for compressing and decompressing -data using the DEFLATE compression algorithm, which is used by the -ZIP and GZIP file formats. Additionally, there are utility classes -for computing the CRC-32 and Adler-32 checksums of arbitrary -input streams. - - -<h2>Package Specification</h2> - -<ul> - <li><a href="http://www.info-zip.org/doc/appnote-19970311-iz.zip"> - Info-ZIP Application Note 970311 - </a> - a detailed description of the Info-ZIP format upon which - the <code>java.util.zip</code> classes are based. - <li><a name="zip64">An implementation may optionally support the ZIP64(tm) format extensions - defined by the </a> - <a href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT"> - PKWARE ZIP File Format Specification</a>. The ZIP64(tm) format extensions - are used to overcome the size limitations of the original ZIP format. - <li><a name="lang_encoding">APPENDIX D of </a><a href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT"> - PKWARE ZIP File Format Specification</a> - Language Encoding Flag (EFS) to - encode ZIP entry filename and comment fields using UTF-8. - <li><a href="http://www.ietf.org/rfc/rfc1950.txt"> - ZLIB Compressed Data Format Specification version 3.3</a> - - <a href="http://www.ietf.org/rfc/rfc1950.txt.pdf">(pdf)</a> - (RFC 1950) - <li><a href="http://www.ietf.org/rfc/rfc1951.txt"> - DEFLATE Compressed Data Format Specification version 1.3</a> - - <a href="http://www.ietf.org/rfc/rfc1951.txt.pdf">(pdf)</a> - (RFC 1951) - <li><a href="http://www.ietf.org/rfc/rfc1952.txt"> - GZIP file format specification version 4.3</a> - - <a href="http://www.ietf.org/rfc/rfc1952.txt.pdf">(pdf)</a> - (RFC 1952) - <li>CRC-32 checksum is described in RFC 1952 (above) - <li>Adler-32 checksum is described in RFC 1950 (above) -</ul> - - -<!-- -<h2>Related Documentation</h2> - -For overviews, tutorials, examples, guides, and tool documentation, please see: -<ul> - <li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a> -</ul> ---> - -@since 1.1 -</body> -</html> - -
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/repository/ClassRepository.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.base/share/classes/sun/reflect/generics/repository/ClassRepository.java Tue Nov 25 10:41:40 2014 -0800 @@ -42,8 +42,11 @@ public static final ClassRepository NONE = ClassRepository.make("Ljava/lang/Object;", null); - private Type superclass; // caches the generic superclass info - private Type[] superInterfaces; // caches the generic superinterface info + /** The generic superclass info. Lazily initialized. */ + private volatile Type superclass; + + /** The generic superinterface info. Lazily initialized. */ + private volatile Type[] superInterfaces; // private, to enforce use of static factory private ClassRepository(String rawSig, GenericsFactory f) { @@ -79,31 +82,34 @@ * with which the repository was created. */ - public Type getSuperclass(){ + public Type getSuperclass() { + Type superclass = this.superclass; if (superclass == null) { // lazily initialize superclass Reifier r = getReifier(); // obtain visitor // Extract superclass subtree from AST and reify getTree().getSuperclass().accept(r); // extract result from visitor and cache it superclass = r.getResult(); - } + this.superclass = superclass; + } return superclass; // return cached result } - public Type[] getSuperInterfaces(){ + public Type[] getSuperInterfaces() { + Type[] superInterfaces = this.superInterfaces; if (superInterfaces == null) { // lazily initialize super interfaces // first, extract super interface subtree(s) from AST TypeTree[] ts = getTree().getSuperInterfaces(); // create array to store reified subtree(s) - Type[] sis = new Type[ts.length]; + superInterfaces = new Type[ts.length]; // reify all subtrees for (int i = 0; i < ts.length; i++) { Reifier r = getReifier(); // obtain visitor ts[i].accept(r);// reify subtree // extract result from visitor and store it - sis[i] = r.getResult(); + superInterfaces[i] = r.getResult(); } - superInterfaces = sis; // cache overall result + this.superInterfaces = superInterfaces; } return superInterfaces.clone(); // return cached result }
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.base/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java Tue Nov 25 10:41:40 2014 -0800 @@ -42,7 +42,8 @@ public abstract class GenericDeclRepository<S extends Signature> extends AbstractRepository<S> { - private TypeVariable<?>[] typeParams; // caches the formal type parameters + /** The formal type parameters. Lazily initialized. */ + private volatile TypeVariable<?>[] typeParams; protected GenericDeclRepository(String rawSig, GenericsFactory f) { super(rawSig, f); @@ -55,8 +56,7 @@ * If the corresponding field is non-null, it is returned. * If not, it is created lazily. This is done by selecting the appropriate * part of the tree and transforming it into a reflective object - * using a visitor. - * a visitor, which is created by feeding it the factory + * using a visitor, which is created by feeding it the factory * with which the repository was created. */ @@ -64,20 +64,21 @@ * Return the formal type parameters of this generic declaration. * @return the formal type parameters of this generic declaration */ - public TypeVariable<?>[] getTypeParameters(){ + public TypeVariable<?>[] getTypeParameters() { + TypeVariable<?>[] typeParams = this.typeParams; if (typeParams == null) { // lazily initialize type parameters // first, extract type parameter subtree(s) from AST FormalTypeParameter[] ftps = getTree().getFormalTypeParameters(); // create array to store reified subtree(s) - TypeVariable<?>[] tps = new TypeVariable<?>[ftps.length]; + typeParams = new TypeVariable<?>[ftps.length]; // reify all subtrees for (int i = 0; i < ftps.length; i++) { Reifier r = getReifier(); // obtain visitor ftps[i].accept(r); // reify subtree // extract result from visitor and store it - tps[i] = (TypeVariable<?>) r.getResult(); + typeParams[i] = (TypeVariable<?>) r.getResult(); } - typeParams = tps; // cache overall result + this.typeParams = typeParams; // cache overall result } return typeParams.clone(); // return cached result }
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/scope/AbstractScope.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.base/share/classes/sun/reflect/generics/scope/AbstractScope.java Tue Nov 25 10:41:40 2014 -0800 @@ -42,7 +42,9 @@ implements Scope { private final D recvr; // the declaration whose scope this instance represents - private Scope enclosingScope; // the enclosing scope of this scope + + /** The enclosing scope of this scope. Lazily initialized. */ + private volatile Scope enclosingScope; /** * Constructor. Takes a reflective object whose scope the newly @@ -71,7 +73,11 @@ * @return the enclosing scope */ protected Scope getEnclosingScope(){ - if (enclosingScope == null) {enclosingScope = computeEnclosingScope();} + Scope enclosingScope = this.enclosingScope; + if (enclosingScope == null) { + enclosingScope = computeEnclosingScope(); + this.enclosingScope = enclosingScope; + } return enclosingScope; }
--- a/jdk/src/java.base/unix/classes/java/lang/UNIXProcess.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.base/unix/classes/java/lang/UNIXProcess.java Tue Nov 25 10:41:40 2014 -0800 @@ -406,14 +406,17 @@ if (hasExited) return true; if (timeout <= 0) return false; - long timeoutAsNanos = unit.toNanos(timeout); - long startTime = System.nanoTime(); - long rem = timeoutAsNanos; + long remainingNanos = unit.toNanos(timeout); + long deadline = System.nanoTime() + remainingNanos; - while (!hasExited && (rem > 0)) { - wait(Math.max(TimeUnit.NANOSECONDS.toMillis(rem), 1)); - rem = timeoutAsNanos - (System.nanoTime() - startTime); - } + do { + // Round up to next millisecond + wait(TimeUnit.NANOSECONDS.toMillis(remainingNanos + 999_999L)); + if (hasExited) { + return true; + } + remainingNanos = deadline - System.nanoTime(); + } while (remainingNanos > 0); return hasExited; }
--- a/jdk/src/java.base/windows/classes/java/lang/ProcessImpl.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.base/windows/classes/java/lang/ProcessImpl.java Tue Nov 25 10:41:40 2014 -0800 @@ -461,11 +461,21 @@ if (getExitCodeProcess(handle) != STILL_ACTIVE) return true; if (timeout <= 0) return false; - long msTimeout = unit.toMillis(timeout); + long remainingNanos = unit.toNanos(timeout); + long deadline = System.nanoTime() + remainingNanos ; - waitForTimeoutInterruptibly(handle, msTimeout); - if (Thread.interrupted()) - throw new InterruptedException(); + do { + // Round up to next millisecond + long msTimeout = TimeUnit.NANOSECONDS.toMillis(remainingNanos + 999_999L); + waitForTimeoutInterruptibly(handle, msTimeout); + if (Thread.interrupted()) + throw new InterruptedException(); + if (getExitCodeProcess(handle) != STILL_ACTIVE) { + return true; + } + remainingNanos = deadline - System.nanoTime(); + } while (remainingNanos > 0); + return (getExitCodeProcess(handle) != STILL_ACTIVE); }
--- a/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java Tue Nov 25 10:41:40 2014 -0800 @@ -31,6 +31,7 @@ import java.security.*; import java.lang.ref.ReferenceQueue; import java.lang.ref.WeakReference; +import java.util.concurrent.CopyOnWriteArrayList; import sun.misc.JavaAWTAccess; import sun.misc.SharedSecrets; @@ -100,6 +101,19 @@ * Note that these Handlers may be created lazily, when they are * first used. * + * <li>A property "<logger>.handlers.ensureCloseOnReset". This defines a + * a boolean value. If "<logger>.handlers" is not defined or is empty, + * this property is ignored. Otherwise it defaults to {@code true}. When the + * value is {@code true}, the handlers associated with the logger are guaranteed + * to be closed on {@linkplain #reset} and shutdown. This can be turned off + * by explicitly setting "<logger>.handlers.ensureCloseOnReset=false" in + * the configuration. Note that turning this property off causes the risk of + * introducing a resource leak, as the logger may get garbage collected before + * {@code reset()} is called, thus preventing its handlers from being closed + * on {@code reset()}. In that case it is the responsibility of the application + * to ensure that the handlers are closed before the logger is garbage + * collected. + * * <li>A property "<logger>.useParentHandlers". This defines a boolean * value. By default every logger calls its parent in addition to * handling the logging message itself, this often result in messages @@ -169,6 +183,33 @@ // True if JVM death is imminent and the exit hook has been called. private boolean deathImminent; + // This list contains the loggers for which some handlers have been + // explicitly configured in the configuration file. + // It prevents these loggers from being arbitrarily garbage collected. + private static final class CloseOnReset { + private final Logger logger; + private CloseOnReset(Logger ref) { + this.logger = Objects.requireNonNull(ref); + } + @Override + public boolean equals(Object other) { + return (other instanceof CloseOnReset) && ((CloseOnReset)other).logger == logger; + } + @Override + public int hashCode() { + return System.identityHashCode(logger); + } + public Logger get() { + return logger; + } + public static CloseOnReset create(Logger logger) { + return new CloseOnReset(logger); + } + } + private final CopyOnWriteArrayList<CloseOnReset> closeOnResetLoggers = + new CopyOnWriteArrayList<>(); + + private final Map<Object, Runnable> listeners = Collections.synchronizedMap(new IdentityHashMap<>()); @@ -204,7 +245,6 @@ }); } - // This private class is used as a shutdown hook. // It does a "reset" to close all open handlers. private class Cleaner extends Thread { @@ -875,30 +915,39 @@ @Override public Object run() { String names[] = parseClassNames(handlersPropertyName); - for (String word : names) { + final boolean ensureCloseOnReset = names.length > 0 + && getBooleanProperty(handlersPropertyName + ".ensureCloseOnReset",true); + + int count = 0; + for (String type : names) { try { - Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(word); + Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(type); Handler hdl = (Handler) clz.newInstance(); // Check if there is a property defining the // this handler's level. - String levs = getProperty(word + ".level"); + String levs = getProperty(type + ".level"); if (levs != null) { Level l = Level.findLevel(levs); if (l != null) { hdl.setLevel(l); } else { // Probably a bad level. Drop through. - System.err.println("Can't set level for " + word); + System.err.println("Can't set level for " + type); } } // Add this Handler to the logger logger.addHandler(hdl); + if (++count == 1 && ensureCloseOnReset) { + // add this logger to the closeOnResetLoggers list. + closeOnResetLoggers.addIfAbsent(CloseOnReset.create(logger)); + } } catch (Exception ex) { - System.err.println("Can't load log handler \"" + word + "\""); + System.err.println("Can't load log handler \"" + type + "\""); System.err.println("" + ex); ex.printStackTrace(); } } + return null; } }); @@ -1233,8 +1282,15 @@ public void reset() throws SecurityException { checkPermission(); + List<CloseOnReset> persistent; synchronized (this) { props = new Properties(); + // make sure we keep the loggers persistent until reset is done. + // Those are the loggers for which we previously created a + // handler from the configuration, and we need to prevent them + // from being gc'ed until those handlers are closed. + persistent = new ArrayList<>(closeOnResetLoggers); + closeOnResetLoggers.clear(); // Since we are doing a reset we no longer want to initialize // the global handlers, if they haven't been initialized yet. initializedGlobalHandlers = true; @@ -1249,6 +1305,7 @@ } } } + persistent.clear(); } // Private method to reset an individual target logger.
--- a/jdk/src/java.management/share/classes/sun/management/Flag.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.management/share/classes/sun/management/Flag.java Tue Nov 25 10:41:40 2014 -0800 @@ -28,6 +28,7 @@ import java.util.*; import com.sun.management.VMOption; import com.sun.management.VMOption.Origin; +import java.security.AccessController; /** * Flag class is a helper class for constructing a VMOption. @@ -115,6 +116,13 @@ static synchronized native void setStringValue(String name, String value); static { + AccessController.doPrivileged( + new java.security.PrivilegedAction<Void>() { + public Void run() { + System.loadLibrary("management"); + return null; + } + }); initialize(); } private static native void initialize();
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/NodeSetData.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/NodeSetData.java Tue Nov 25 10:41:40 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,9 +37,10 @@ * * @author Sean Mullan * @author JSR 105 Expert Group + * @param <T> the type of nodes maintained by this set * @since 1.6 */ -public interface NodeSetData extends Data { +public interface NodeSetData<T> extends Data, Iterable<T> { /** * Returns a read-only iterator over the nodes contained in this @@ -52,6 +53,5 @@ * @return an <code>Iterator</code> over the nodes in this * <code>NodeSetData</code> in document order */ - @SuppressWarnings("rawtypes") - Iterator iterator(); + Iterator<T> iterator(); }
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dom/DOMCryptoContext.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dom/DOMCryptoContext.java Tue Nov 25 10:41:40 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,6 +33,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.Iterator; +import java.util.Map; import org.w3c.dom.Element; /** @@ -219,8 +220,7 @@ * * @return a read-only iterator over the set of mappings */ - @SuppressWarnings("rawtypes") - public Iterator iterator() { + public Iterator<Map.Entry<String, Element>> iterator() { return Collections.unmodifiableMap(idMap).entrySet().iterator(); }
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Manifest.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Manifest.java Tue Nov 25 10:41:40 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, 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 @@ -51,8 +51,8 @@ * * <pre> * XMLSignatureFactory factory = XMLSignatureFactory.getInstance("DOM"); - * List references = Collections.singletonList(factory.newReference - * ("#reference-1", DigestMethod.SHA1)); + * Reference ref = factory.newReference("#reference-1", DigestMethod.SHA1); + * List<Reference> references = Collections.singletonList(ref); * Manifest manifest = factory.newManifest(references, "manifest-1"); * </pre> * @@ -86,6 +86,5 @@ * * @return an unmodifiable list of one or more <code>Reference</code>s */ - @SuppressWarnings("rawtypes") - List getReferences(); + List<Reference> getReferences(); }
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Reference.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Reference.java Tue Nov 25 10:41:40 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, 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 @@ -85,8 +85,7 @@ * @return an unmodifiable list of <code>Transform</code>s * (may be empty but never <code>null</code>) */ - @SuppressWarnings("rawtypes") - List getTransforms(); + List<Transform> getTransforms(); /** * Returns the digest method of this <code>Reference</code>.
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignatureProperties.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignatureProperties.java Tue Nov 25 10:41:40 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, 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 @@ -87,6 +87,5 @@ * @return an unmodifiable list of one or more * <code>SignatureProperty</code>s */ - @SuppressWarnings("rawtypes") - List getProperties(); + List<SignatureProperty> getProperties(); }
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignatureProperty.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignatureProperty.java Tue Nov 25 10:41:40 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, 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 @@ -91,6 +91,5 @@ * * @return an unmodifiable list of one or more <code>XMLStructure</code>s */ - @SuppressWarnings("rawtypes") - List getContent(); + List<XMLStructure> getContent(); }
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignedInfo.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignedInfo.java Tue Nov 25 10:41:40 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, 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 @@ -80,8 +80,7 @@ * * @return an unmodifiable list of one or more {@link Reference}s */ - @SuppressWarnings("rawtypes") - List getReferences(); + List<Reference> getReferences(); /** * Returns the optional <code>Id</code> attribute of this
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLObject.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLObject.java Tue Nov 25 10:41:40 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, 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,8 @@ * * <pre> * XMLSignatureFactory fac = XMLSignatureFactory.getInstance("DOM"); - * List content = Collections.singletonList(fac.newManifest(references))); + * Manifest manifest = fac.newManifest(references); + * List<XMLStructure> content = Collections.singletonList(manifest); * XMLObject object = factory.newXMLObject(content, "object-1", null, null); * </pre> * @@ -100,8 +101,7 @@ * @return an unmodifiable list of <code>XMLStructure</code>s (may be empty * but never <code>null</code>) */ - @SuppressWarnings("rawtypes") - List getContent(); + List<XMLStructure> getContent(); /** * Returns the Id of this <code>XMLObject</code>.
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignature.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignature.java Tue Nov 25 10:41:40 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, 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 @@ -136,8 +136,7 @@ * @return an unmodifiable list of <code>XMLObject</code>s (may be empty * but never <code>null</code>) */ - @SuppressWarnings("rawtypes") - List getObjects(); + List<XMLObject> getObjects(); /** * Returns the optional Id of this <code>XMLSignature</code>.
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java Tue Nov 25 10:41:40 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, 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 @@ -365,9 +365,8 @@ * @throws ClassCastException if any of the <code>objects</code> are not of * type <code>XMLObject</code> */ - @SuppressWarnings("rawtypes") public abstract XMLSignature newXMLSignature(SignedInfo si, KeyInfo ki, - List objects, String id, String signatureValueId); + List<? extends XMLObject> objects, String id, String signatureValueId); /** * Creates a <code>Reference</code> with the specified URI and digest @@ -399,9 +398,8 @@ * compliant * @throws NullPointerException if <code>dm</code> is <code>null</code> */ - @SuppressWarnings("rawtypes") public abstract Reference newReference(String uri, DigestMethod dm, - List transforms, String type, String id); + List<? extends Transform> transforms, String type, String id); /** * Creates a <code>Reference</code> with the specified parameters and @@ -430,9 +428,9 @@ * @throws NullPointerException if <code>dm</code> or * <code>digestValue</code> is <code>null</code> */ - @SuppressWarnings("rawtypes") public abstract Reference newReference(String uri, DigestMethod dm, - List transforms, String type, String id, byte[] digestValue); + List<? extends Transform> transforms, String type, String id, + byte[] digestValue); /** * Creates a <code>Reference</code> with the specified parameters. @@ -473,10 +471,9 @@ * <code>appliedTransforms</code> or <code>result</code> is * <code>null</code> */ - @SuppressWarnings("rawtypes") public abstract Reference newReference(String uri, DigestMethod dm, - List appliedTransforms, Data result, List transforms, String type, - String id); + List<? extends Transform> appliedTransforms, Data result, + List<? extends Transform> transforms, String type, String id); /** * Creates a <code>SignedInfo</code> with the specified canonicalization @@ -493,9 +490,8 @@ * @throws NullPointerException if any of the parameters * are <code>null</code> */ - @SuppressWarnings("rawtypes") public abstract SignedInfo newSignedInfo(CanonicalizationMethod cm, - SignatureMethod sm, List references); + SignatureMethod sm, List<? extends Reference> references); /** * Creates a <code>SignedInfo</code> with the specified parameters. @@ -512,9 +508,8 @@ * @throws NullPointerException if <code>cm</code>, <code>sm</code>, or * <code>references</code> are <code>null</code> */ - @SuppressWarnings("rawtypes") public abstract SignedInfo newSignedInfo(CanonicalizationMethod cm, - SignatureMethod sm, List references, String id); + SignatureMethod sm, List<? extends Reference> references, String id); // Object factory methods /** @@ -530,9 +525,8 @@ * @throws ClassCastException if <code>content</code> contains any * entries that are not of type {@link XMLStructure} */ - @SuppressWarnings("rawtypes") - public abstract XMLObject newXMLObject(List content, String id, - String mimeType, String encoding); + public abstract XMLObject newXMLObject(List<? extends XMLStructure> content, + String id, String mimeType, String encoding); /** * Creates a <code>Manifest</code> containing the specified @@ -547,8 +541,7 @@ * @throws ClassCastException if <code>references</code> contains any * entries that are not of type {@link Reference} */ - @SuppressWarnings("rawtypes") - public abstract Manifest newManifest(List references); + public abstract Manifest newManifest(List<? extends Reference> references); /** * Creates a <code>Manifest</code> containing the specified @@ -564,8 +557,8 @@ * @throws ClassCastException if <code>references</code> contains any * entries that are not of type {@link Reference} */ - @SuppressWarnings("rawtypes") - public abstract Manifest newManifest(List references, String id); + public abstract Manifest newManifest(List<? extends Reference> references, + String id); /** * Creates a <code>SignatureProperty</code> containing the specified @@ -583,9 +576,8 @@ * @throws ClassCastException if <code>content</code> contains any * entries that are not of type {@link XMLStructure} */ - @SuppressWarnings("rawtypes") public abstract SignatureProperty newSignatureProperty - (List content, String target, String id); + (List<? extends XMLStructure> content, String target, String id); /** * Creates a <code>SignatureProperties</code> containing the specified @@ -602,9 +594,8 @@ * @throws ClassCastException if <code>properties</code> contains any * entries that are not of type {@link SignatureProperty} */ - @SuppressWarnings("rawtypes") public abstract SignatureProperties newSignatureProperties - (List properties, String id); + (List<? extends SignatureProperty> properties, String id); // Algorithm factory methods /**
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfo.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfo.java Tue Nov 25 10:41:40 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, 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 @@ -94,8 +94,7 @@ * in this <code>KeyInfo</code>. Never returns <code>null</code> or an * empty list. */ - @SuppressWarnings("rawtypes") - List getContent(); + List<XMLStructure> getContent(); /** * Return the optional Id attribute of this <code>KeyInfo</code>, which
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java Tue Nov 25 10:41:40 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, 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,8 +305,7 @@ * @throws ClassCastException if <code>content</code> contains any entries * that are not of type {@link XMLStructure} */ - @SuppressWarnings("rawtypes") - public abstract KeyInfo newKeyInfo(List content); + public abstract KeyInfo newKeyInfo(List<? extends XMLStructure> content); /** * Creates a <code>KeyInfo</code> containing the specified list of key @@ -325,8 +324,8 @@ * @throws ClassCastException if <code>content</code> contains any entries * that are not of type {@link XMLStructure} */ - @SuppressWarnings("rawtypes") - public abstract KeyInfo newKeyInfo(List content, String id); + public abstract KeyInfo newKeyInfo(List<? extends XMLStructure> content, + String id); /** * Creates a <code>KeyName</code> from the specified name. @@ -387,9 +386,8 @@ * @throws ClassCastException if <code>other</code> contains any * entries that are not of type {@link XMLStructure} */ - @SuppressWarnings("rawtypes") public abstract PGPData newPGPData(byte[] keyId, byte[] keyPacket, - List other); + List<? extends XMLStructure> other); /** * Creates a <code>PGPData</code> from the specified PGP key material @@ -411,8 +409,8 @@ * @throws ClassCastException if <code>other</code> contains any * entries that are not of type {@link XMLStructure} */ - @SuppressWarnings("rawtypes") - public abstract PGPData newPGPData(byte[] keyPacket, List other); + public abstract PGPData newPGPData(byte[] keyPacket, + List<? extends XMLStructure> other); /** * Creates a <code>RetrievalMethod</code> from the specified URI. @@ -443,9 +441,8 @@ * @throws ClassCastException if <code>transforms</code> contains any * entries that are not of type {@link Transform} */ - @SuppressWarnings("rawtypes") public abstract RetrievalMethod newRetrievalMethod(String uri, String type, - List transforms); + List<? extends Transform> transforms); /** * Creates a <code>X509Data</code> containing the specified list of @@ -469,8 +466,7 @@ * @throws ClassCastException if <code>content</code> contains any entries * that are not of one of the valid types mentioned above */ - @SuppressWarnings("rawtypes") - public abstract X509Data newX509Data(List content); + public abstract X509Data newX509Data(List<?> content); /** * Creates an <code>X509IssuerSerial</code> from the specified X.500 issuer
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/PGPData.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/PGPData.java Tue Nov 25 10:41:40 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, 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 @@ -112,6 +112,5 @@ * @return an unmodifiable list of <code>XMLStructure</code>s (may be * empty, but never <code>null</code>) */ - @SuppressWarnings("rawtypes") - List getExternalElements(); + List<XMLStructure> getExternalElements(); }
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/RetrievalMethod.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/RetrievalMethod.java Tue Nov 25 10:41:40 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, 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 @@ -80,8 +80,7 @@ * @return an unmodifiable list of <code>Transform</code> objects (may be * empty but never <code>null</code>). */ - @SuppressWarnings("rawtypes") - List getTransforms(); + List<Transform> getTransforms(); /** * Returns the URI of the referenced <code>KeyInfo</code> information.
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/X509Data.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/X509Data.java Tue Nov 25 10:41:40 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, 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 @@ -109,6 +109,5 @@ * @return an unmodifiable list of the content in this <code>X509Data</code> * (never <code>null</code> or empty) */ - @SuppressWarnings("rawtypes") - List getContent(); + List<?> getContent(); }
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/ExcC14NParameterSpec.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/ExcC14NParameterSpec.java Tue Nov 25 10:41:40 2014 -0800 @@ -59,7 +59,7 @@ */ public final class ExcC14NParameterSpec implements C14NMethodParameterSpec { - private List<String> preList; + private final List<String> prefixList; /** * Indicates the default namespace ("#default"). @@ -71,7 +71,7 @@ * list. */ public ExcC14NParameterSpec() { - preList = Collections.emptyList(); + prefixList = Collections.emptyList(); } /** @@ -86,22 +86,14 @@ * @throws ClassCastException if any of the entries in the list are not * of type <code>String</code> */ - @SuppressWarnings("rawtypes") - public ExcC14NParameterSpec(List prefixList) { + public ExcC14NParameterSpec(List<String> prefixList) { if (prefixList == null) { throw new NullPointerException("prefixList cannot be null"); } - List<?> copy = new ArrayList<>((List<?>)prefixList); - for (int i = 0, size = copy.size(); i < size; i++) { - if (!(copy.get(i) instanceof String)) { - throw new ClassCastException("not a String"); - } - } - - @SuppressWarnings("unchecked") - List<String> temp = (List<String>)copy; - - preList = Collections.unmodifiableList(temp); + List<String> tempList = Collections.checkedList(new ArrayList<>(), + String.class); + tempList.addAll(prefixList); + this.prefixList = Collections.unmodifiableList(tempList); } /** @@ -114,8 +106,7 @@ * @return the inclusive namespace prefix list (may be empty but never * <code>null</code>) */ - @SuppressWarnings("rawtypes") - public List getPrefixList() { - return preList; + public List<String> getPrefixList() { + return prefixList; } }
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathFilter2ParameterSpec.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathFilter2ParameterSpec.java Tue Nov 25 10:41:40 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, 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 @@ -59,27 +59,18 @@ * @throws NullPointerException if <code>xPathList</code> is * <code>null</code> */ - @SuppressWarnings("rawtypes") - public XPathFilter2ParameterSpec(List xPathList) { + public XPathFilter2ParameterSpec(List<XPathType> xPathList) { if (xPathList == null) { throw new NullPointerException("xPathList cannot be null"); } - List<?> xPathListCopy = new ArrayList<>((List<?>)xPathList); - if (xPathListCopy.isEmpty()) { + List<XPathType> tempList = + Collections.checkedList(new ArrayList<XPathType>(), + XPathType.class); + tempList.addAll(xPathList); + if (tempList.isEmpty()) { throw new IllegalArgumentException("xPathList cannot be empty"); } - int size = xPathListCopy.size(); - for (int i = 0; i < size; i++) { - if (!(xPathListCopy.get(i) instanceof XPathType)) { - throw new ClassCastException - ("xPathList["+i+"] is not a valid type"); - } - } - - @SuppressWarnings("unchecked") - List<XPathType> temp = (List<XPathType>)xPathListCopy; - - this.xPathList = Collections.unmodifiableList(temp); + this.xPathList = Collections.unmodifiableList(tempList); } /** @@ -91,8 +82,7 @@ * @return a <code>List</code> of <code>XPathType</code> objects * (never <code>null</code> or empty) */ - @SuppressWarnings("rawtypes") - public List getXPathList() { + public List<XPathType> getXPathList() { return xPathList; } }
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathFilterParameterSpec.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathFilterParameterSpec.java Tue Nov 25 10:41:40 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, 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,6 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; -import java.util.Map.Entry; /** * Parameters for the <a href="http://www.w3.org/TR/xmldsig-core/#sec-XPath"> @@ -51,8 +50,8 @@ */ public final class XPathFilterParameterSpec implements TransformParameterSpec { - private String xPath; - private Map<String,String> nsMap; + private final String xPath; + private final Map<String,String> nsMap; /** * Creates an <code>XPathFilterParameterSpec</code> with the specified @@ -83,26 +82,16 @@ * @throws ClassCastException if any of the map's keys or entries are not * of type <code>String</code> */ - @SuppressWarnings("rawtypes") - public XPathFilterParameterSpec(String xPath, Map namespaceMap) { + public XPathFilterParameterSpec(String xPath, Map<String,String> namespaceMap) { if (xPath == null || namespaceMap == null) { throw new NullPointerException(); } this.xPath = xPath; - Map<?,?> copy = new HashMap<>((Map<?,?>)namespaceMap); - Iterator<? extends Map.Entry<?,?>> entries = copy.entrySet().iterator(); - while (entries.hasNext()) { - Map.Entry<?,?> me = entries.next(); - if (!(me.getKey() instanceof String) || - !(me.getValue() instanceof String)) { - throw new ClassCastException("not a String"); - } - } - - @SuppressWarnings("unchecked") - Map<String,String> temp = (Map<String,String>)copy; - - nsMap = Collections.unmodifiableMap(temp); + Map<String,String> tempMap = Collections.checkedMap(new HashMap<>(), + String.class, + String.class); + tempMap.putAll(namespaceMap); + this.nsMap = Collections.unmodifiableMap(tempMap); } /** @@ -125,8 +114,7 @@ * @return a <code>Map</code> of namespace prefixes to namespace URIs (may * be empty, but never <code>null</code>) */ - @SuppressWarnings("rawtypes") - public Map getNamespaceMap() { + public Map<String,String> getNamespaceMap() { return nsMap; } }
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathType.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathType.java Tue Nov 25 10:41:40 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,6 @@ package javax.xml.crypto.dsig.spec; import java.util.Collections; -import java.util.Iterator; import java.util.HashMap; import java.util.Map; @@ -106,7 +105,7 @@ private final String expression; private final Filter filter; - private Map<String,String> nsMap; + private final Map<String,String> nsMap; /** * Creates an <code>XPathType</code> instance with the specified XPath @@ -147,26 +146,24 @@ * @throws ClassCastException if any of the map's keys or entries are * not of type <code>String</code> */ - @SuppressWarnings("rawtypes") - public XPathType(String expression, Filter filter, Map namespaceMap) { - this(expression, filter); + public XPathType(String expression, Filter filter, + Map<String,String> namespaceMap) { + if (expression == null) { + throw new NullPointerException("expression cannot be null"); + } + if (filter == null) { + throw new NullPointerException("filter cannot be null"); + } if (namespaceMap == null) { throw new NullPointerException("namespaceMap cannot be null"); } - Map<?,?> copy = new HashMap<>((Map<?,?>)namespaceMap); - Iterator<? extends Map.Entry<?,?>> entries = copy.entrySet().iterator(); - while (entries.hasNext()) { - Map.Entry<?,?> me = entries.next(); - if (!(me.getKey() instanceof String) || - !(me.getValue() instanceof String)) { - throw new ClassCastException("not a String"); - } - } - - @SuppressWarnings("unchecked") - Map<String,String> temp = (Map<String,String>)copy; - - nsMap = Collections.unmodifiableMap(temp); + this.expression = expression; + this.filter = filter; + Map<String,String> tempMap = Collections.checkedMap(new HashMap<>(), + String.class, + String.class); + tempMap.putAll(namespaceMap); + this.nsMap = Collections.unmodifiableMap(tempMap); } /** @@ -198,8 +195,7 @@ * @return a <code>Map</code> of namespace prefixes to namespace URIs * (may be empty, but never <code>null</code>) */ - @SuppressWarnings("rawtypes") - public Map getNamespaceMap() { + public Map<String,String> getNamespaceMap() { return nsMap; } }
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java Tue Nov 25 10:41:40 2014 -0800 @@ -21,7 +21,7 @@ * under the License. */ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. */ /* * $Id: ApacheCanonicalizer.java 1333869 2012-05-04 10:42:44Z coheigea $ @@ -166,11 +166,9 @@ (subTree.getRoot()))); } } else if (data instanceof NodeSetData) { - NodeSetData nsd = (NodeSetData)data; - // convert Iterator to Set - @SuppressWarnings("unchecked") - Set<Node> ns = Utils.toNodeSet(nsd.iterator()); - nodeSet = ns; + NodeSetData<?> nsd = (NodeSetData<?>)data; + // convert Iterator to Set<Node> + nodeSet = Utils.toNodeSet(nsd.iterator()); if (log.isLoggable(java.util.logging.Level.FINE)) { log.log(java.util.logging.Level.FINE, "Canonicalizing " + nodeSet.size() + " nodes"); } @@ -236,7 +234,6 @@ in = new XMLSignatureInput(subTree.getRoot()); in.setExcludeComments(subTree.excludeComments()); } else { - @SuppressWarnings("unchecked") Set<Node> nodeSet = Utils.toNodeSet(((NodeSetData)data).iterator()); in = new XMLSignatureInput(nodeSet);
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheNodeSetData.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheNodeSetData.java Tue Nov 25 10:41:40 2014 -0800 @@ -39,7 +39,7 @@ import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput; import com.sun.org.apache.xml.internal.security.utils.XMLUtils; -public class ApacheNodeSetData implements ApacheData, NodeSetData { +public class ApacheNodeSetData implements ApacheData, NodeSetData<Node> { private XMLSignatureInput xi;
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheTransform.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheTransform.java Tue Nov 25 10:41:40 2014 -0800 @@ -21,7 +21,7 @@ * under the License. */ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. */ /* * $Id: ApacheTransform.java 1333869 2012-05-04 10:42:44Z coheigea $ @@ -175,7 +175,6 @@ in = new XMLSignatureInput(subTree.getRoot()); in.setExcludeComments(subTree.excludeComments()); } else { - @SuppressWarnings("unchecked") Set<Node> nodeSet = Utils.toNodeSet(((NodeSetData)data).iterator()); in = new XMLSignatureInput(nodeSet);
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMExcC14NMethod.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMExcC14NMethod.java Tue Nov 25 10:41:40 2014 -0800 @@ -21,7 +21,7 @@ * under the License. */ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. */ /* * $Id: DOMExcC14NMethod.java 1197150 2011-11-03 14:34:57Z coheigea $ @@ -119,7 +119,6 @@ ExcC14NParameterSpec params = (ExcC14NParameterSpec)spec; StringBuilder prefixListAttr = new StringBuilder(""); - @SuppressWarnings("unchecked") List<String> prefixList = params.getPrefixList(); for (int i = 0, size = prefixList.size(); i < size; i++) { prefixListAttr.append(prefixList.get(i));
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfo.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfo.java Tue Nov 25 10:41:40 2014 -0800 @@ -68,17 +68,14 @@ if (content == null) { throw new NullPointerException("content cannot be null"); } - this.keyInfoTypes = - Collections.unmodifiableList(new ArrayList<XMLStructure>(content)); + List<XMLStructure> tempList = + Collections.checkedList(new ArrayList<XMLStructure>(), + XMLStructure.class); + tempList.addAll(content); + this.keyInfoTypes = Collections.unmodifiableList(tempList); if (this.keyInfoTypes.isEmpty()) { throw new IllegalArgumentException("content cannot be empty"); } - for (int i = 0, size = this.keyInfoTypes.size(); i < size; i++) { - if (!(this.keyInfoTypes.get(i) instanceof XMLStructure)) { - throw new ClassCastException - ("content["+i+"] is not a valid KeyInfo type"); - } - } this.id = id; }
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java Tue Nov 25 10:41:40 2014 -0800 @@ -34,6 +34,7 @@ import java.util.List; import javax.xml.crypto.*; import javax.xml.crypto.dom.DOMCryptoContext; +import javax.xml.crypto.dsig.Transform; import javax.xml.crypto.dsig.keyinfo.*; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -48,13 +49,11 @@ public DOMKeyInfoFactory() { } - @SuppressWarnings("rawtypes") - public KeyInfo newKeyInfo(List content) { + public KeyInfo newKeyInfo(List<? extends XMLStructure> content) { return newKeyInfo(content, null); } - @SuppressWarnings({ "unchecked", "rawtypes" }) - public KeyInfo newKeyInfo(List content, String id) { + public KeyInfo newKeyInfo(List<? extends XMLStructure> content, String id) { return new DOMKeyInfo(content, id); } @@ -79,13 +78,13 @@ return newPGPData(keyId, null, null); } - @SuppressWarnings({ "unchecked", "rawtypes" }) - public PGPData newPGPData(byte[] keyId, byte[] keyPacket, List other) { + public PGPData newPGPData(byte[] keyId, byte[] keyPacket, + List<? extends XMLStructure> other) { return new DOMPGPData(keyId, keyPacket, other); } - @SuppressWarnings({ "unchecked", "rawtypes" }) - public PGPData newPGPData(byte[] keyPacket, List other) { + public PGPData newPGPData(byte[] keyPacket, + List<? extends XMLStructure> other) { return new DOMPGPData(keyPacket, other); } @@ -93,17 +92,15 @@ return newRetrievalMethod(uri, null, null); } - @SuppressWarnings({ "unchecked", "rawtypes" }) public RetrievalMethod newRetrievalMethod(String uri, String type, - List transforms) { + List<? extends Transform> transforms) { if (uri == null) { throw new NullPointerException("uri must not be null"); } return new DOMRetrievalMethod(uri, type, transforms); } - @SuppressWarnings("rawtypes") - public X509Data newX509Data(List content) { + public X509Data newX509Data(List<?> content) { return new DOMX509Data(content); }
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java Tue Nov 25 10:41:40 2014 -0800 @@ -33,7 +33,6 @@ import javax.xml.crypto.dsig.*; import javax.xml.crypto.dsig.keyinfo.KeyValue; -// import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.security.AccessController;
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMManifest.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMManifest.java Tue Nov 25 10:41:40 2014 -0800 @@ -67,18 +67,15 @@ if (references == null) { throw new NullPointerException("references cannot be null"); } - this.references = - Collections.unmodifiableList(new ArrayList<Reference>(references)); + List<Reference> tempList = + Collections.checkedList(new ArrayList<Reference>(), + Reference.class); + tempList.addAll(references); + this.references = Collections.unmodifiableList(tempList); if (this.references.isEmpty()) { throw new IllegalArgumentException("list of references must " + "contain at least one entry"); } - for (int i = 0, size = this.references.size(); i < size; i++) { - if (!(this.references.get(i) instanceof Reference)) { - throw new ClassCastException - ("references["+i+"] is not a valid type"); - } - } this.id = id; } @@ -127,7 +124,6 @@ return id; } - @SuppressWarnings("unchecked") static List<Reference> getManifestReferences(Manifest mf) { return mf.getReferences(); }
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMPGPData.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMPGPData.java Tue Nov 25 10:41:40 2014 -0800 @@ -73,18 +73,13 @@ if (keyPacket == null) { throw new NullPointerException("keyPacket cannot be null"); } - if (other == null || other.isEmpty()) { - this.externalElements = Collections.emptyList(); - } else { - this.externalElements = - Collections.unmodifiableList(new ArrayList<XMLStructure>(other)); - for (int i = 0, size = this.externalElements.size(); i < size; i++) { - if (!(this.externalElements.get(i) instanceof XMLStructure)) { - throw new ClassCastException - ("other["+i+"] is not a valid PGPData type"); - } - } + List<XMLStructure> tempList = + Collections.checkedList(new ArrayList<XMLStructure>(), + XMLStructure.class); + if (other != null) { + tempList.addAll(other); } + this.externalElements = Collections.unmodifiableList(tempList); this.keyPacket = keyPacket.clone(); checkKeyPacket(keyPacket); this.keyId = null; @@ -120,18 +115,13 @@ if (keyId.length != 8) { throw new IllegalArgumentException("keyId must be 8 bytes long"); } - if (other == null || other.isEmpty()) { - this.externalElements = Collections.emptyList(); - } else { - this.externalElements = - Collections.unmodifiableList(new ArrayList<XMLStructure>(other)); - for (int i = 0, size = this.externalElements.size(); i < size; i++) { - if (!(this.externalElements.get(i) instanceof XMLStructure)) { - throw new ClassCastException - ("other["+i+"] is not a valid PGPData type"); - } - } + List<XMLStructure> tempList = + Collections.checkedList(new ArrayList<XMLStructure>(), + XMLStructure.class); + if (other != null) { + tempList.addAll(other); } + this.externalElements = Collections.unmodifiableList(tempList); this.keyId = keyId.clone(); this.keyPacket = keyPacket == null ? null : keyPacket.clone();
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java Tue Nov 25 10:41:40 2014 -0800 @@ -147,29 +147,21 @@ if (dm == null) { throw new NullPointerException("DigestMethod must be non-null"); } - if (appliedTransforms == null) { - this.allTransforms = new ArrayList<Transform>(); - } else { - this.allTransforms = new ArrayList<Transform>(appliedTransforms); - for (int i = 0, size = this.allTransforms.size(); i < size; i++) { - if (!(this.allTransforms.get(i) instanceof Transform)) { - throw new ClassCastException - ("appliedTransforms["+i+"] is not a valid type"); - } - } + List<Transform> tempList = + Collections.checkedList(new ArrayList<Transform>(), + Transform.class); + if (appliedTransforms != null) { + tempList.addAll(appliedTransforms); } - if (transforms == null) { - this.transforms = Collections.emptyList(); - } else { - this.transforms = new ArrayList<Transform>(transforms); - for (int i = 0, size = this.transforms.size(); i < size; i++) { - if (!(this.transforms.get(i) instanceof Transform)) { - throw new ClassCastException - ("transforms["+i+"] is not a valid type"); - } - } - this.allTransforms.addAll(this.transforms); + List<Transform> tempList2 = + Collections.checkedList(new ArrayList<Transform>(), + Transform.class); + if (transforms != null) { + tempList.addAll(transforms); + tempList2.addAll(transforms); } + this.allTransforms = Collections.unmodifiableList(tempList); + this.transforms = tempList2; this.digestMethod = dm; this.uri = uri; if ((uri != null) && (!uri.equals(""))) { @@ -642,7 +634,7 @@ if (xsi.isNodeSet()) { try { final Set<Node> s = xsi.getNodeSet(); - return new NodeSetData() { + return new NodeSetData<Node>() { public Iterator<Node> iterator() { return s.iterator(); } }; } catch (Exception e) {
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java Tue Nov 25 10:41:40 2014 -0800 @@ -90,18 +90,13 @@ if (uri == null) { throw new NullPointerException("uri cannot be null"); } - if (transforms == null || transforms.isEmpty()) { - this.transforms = Collections.emptyList(); - } else { - this.transforms = Collections.unmodifiableList( - new ArrayList<Transform>(transforms)); - for (int i = 0, size = this.transforms.size(); i < size; i++) { - if (!(this.transforms.get(i) instanceof Transform)) { - throw new ClassCastException - ("transforms["+i+"] is not a valid type"); - } - } + List<Transform> tempList = + Collections.checkedList(new ArrayList<Transform>(), + Transform.class); + if (transforms != null) { + tempList.addAll(transforms); } + this.transforms = Collections.unmodifiableList(tempList); this.uri = uri; if (!uri.equals("")) { try { @@ -244,7 +239,7 @@ // guard against RetrievalMethod loops if ((data instanceof NodeSetData) && Utils.secureValidation(context)) { - NodeSetData nsd = (NodeSetData)data; + NodeSetData<?> nsd = (NodeSetData<?>)data; Iterator<?> i = nsd.iterator(); if (i.hasNext()) { Node root = (Node)i.next();
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java Tue Nov 25 10:41:40 2014 -0800 @@ -69,18 +69,15 @@ { if (properties == null) { throw new NullPointerException("properties cannot be null"); - } else if (properties.isEmpty()) { + } + List<SignatureProperty> tempList = + Collections.checkedList(new ArrayList<SignatureProperty>(), + SignatureProperty.class); + tempList.addAll(properties); + if (tempList.isEmpty()) { throw new IllegalArgumentException("properties cannot be empty"); - } else { - this.properties = Collections.unmodifiableList( - new ArrayList<SignatureProperty>(properties)); - for (int i = 0, size = this.properties.size(); i < size; i++) { - if (!(this.properties.get(i) instanceof SignatureProperty)) { - throw new ClassCastException - ("properties["+i+"] is not a valid type"); - } - } } + this.properties = Collections.unmodifiableList(tempList); this.id = id; }
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java Tue Nov 25 10:41:40 2014 -0800 @@ -71,20 +71,18 @@ { if (target == null) { throw new NullPointerException("target cannot be null"); - } else if (content == null) { + } + if (content == null) { throw new NullPointerException("content cannot be null"); - } else if (content.isEmpty()) { + } + List<XMLStructure> tempList = + Collections.checkedList(new ArrayList<XMLStructure>(), + XMLStructure.class); + tempList.addAll(content); + if (tempList.isEmpty()) { throw new IllegalArgumentException("content cannot be empty"); - } else { - this.content = Collections.unmodifiableList( - new ArrayList<XMLStructure>(content)); - for (int i = 0, size = this.content.size(); i < size; i++) { - if (!(this.content.get(i) instanceof XMLStructure)) { - throw new ClassCastException - ("content["+i+"] is not a valid type"); - } - } } + this.content = Collections.unmodifiableList(tempList); this.target = target; this.id = id; } @@ -169,7 +167,6 @@ boolean idsEqual = (id == null ? osp.getId() == null : id.equals(osp.getId())); - @SuppressWarnings("unchecked") List<XMLStructure> ospContent = osp.getContent(); return (equalsContent(ospContent) && target.equals(osp.getTarget()) && idsEqual);
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java Tue Nov 25 10:41:40 2014 -0800 @@ -100,19 +100,14 @@ } this.canonicalizationMethod = cm; this.signatureMethod = sm; - this.references = Collections.unmodifiableList( - new ArrayList<Reference>(references)); - if (this.references.isEmpty()) { - throw new IllegalArgumentException("list of references must " + - "contain at least one entry"); + List<Reference> tempList = + Collections.checkedList(new ArrayList<Reference>(), + Reference.class); + tempList.addAll(references); + if (tempList.isEmpty()) { + throw new IllegalArgumentException("references cannot be empty"); } - for (int i = 0, size = this.references.size(); i < size; i++) { - Object obj = this.references.get(i); - if (!(obj instanceof Reference)) { - throw new ClassCastException("list of references contains " + - "an illegal type"); - } - } + this.references = Collections.unmodifiableList(tempList); } /**
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSubTreeData.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSubTreeData.java Tue Nov 25 10:41:40 2014 -0800 @@ -44,7 +44,7 @@ * directly on the subdocument and there is no need to convert it * first to an XPath node-set. */ -public class DOMSubTreeData implements NodeSetData { +public class DOMSubTreeData implements NodeSetData<Node> { private boolean excludeComments; private Node root;
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMUtils.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMUtils.java Tue Nov 25 10:41:40 2014 -0800 @@ -367,9 +367,7 @@ private static boolean paramsEqual(XPathFilter2ParameterSpec spec1, XPathFilter2ParameterSpec spec2) { - @SuppressWarnings("unchecked") List<XPathType> types = spec1.getXPathList(); - @SuppressWarnings("unchecked") List<XPathType> otypes = spec2.getXPathList(); int size = types.size(); if (size != otypes.size()) {
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509Data.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509Data.java Tue Nov 25 10:41:40 2014 -0800 @@ -135,7 +135,7 @@ this.content = Collections.unmodifiableList(content); } - public List<Object> getContent() { + public List<?> getContent() { return content; } @@ -265,7 +265,7 @@ } X509Data oxd = (X509Data)o; - @SuppressWarnings("unchecked") List<Object> ocontent = oxd.getContent(); + List<?> ocontent = oxd.getContent(); int size = content.size(); if (size != ocontent.size()) { return false;
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java Tue Nov 25 10:41:40 2014 -0800 @@ -70,18 +70,13 @@ public DOMXMLObject(List<? extends XMLStructure> content, String id, String mimeType, String encoding) { - if (content == null || content.isEmpty()) { - this.content = Collections.emptyList(); - } else { - this.content = Collections.unmodifiableList( - new ArrayList<XMLStructure>(content)); - for (int i = 0, size = this.content.size(); i < size; i++) { - if (!(this.content.get(i) instanceof XMLStructure)) { - throw new ClassCastException - ("content["+i+"] is not a valid type"); - } - } + List<XMLStructure> tempList = + Collections.checkedList(new ArrayList<XMLStructure>(), + XMLStructure.class); + if (content != null) { + tempList.addAll(content); } + this.content = Collections.unmodifiableList(tempList); this.id = id; this.mimeType = mimeType; this.encoding = encoding; @@ -204,7 +199,6 @@ (mimeType == null ? oxo.getMimeType() == null : mimeType.equals(oxo.getMimeType())); - @SuppressWarnings("unchecked") List<XMLStructure> oxoContent = oxo.getContent(); return (idsEqual && encodingsEqual && mimeTypesEqual && equalsContent(oxoContent));
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java Tue Nov 25 10:41:40 2014 -0800 @@ -109,18 +109,13 @@ this.si = si; this.id = id; this.sv = new DOMSignatureValue(signatureValueId); - if (objs == null) { - this.objects = Collections.emptyList(); - } else { - this.objects = - Collections.unmodifiableList(new ArrayList<XMLObject>(objs)); - for (int i = 0, size = this.objects.size(); i < size; i++) { - if (!(this.objects.get(i) instanceof XMLObject)) { - throw new ClassCastException - ("objs["+i+"] is not an XMLObject"); - } - } + List<XMLObject> tempList = + Collections.checkedList(new ArrayList<XMLObject>(), + XMLObject.class); + if (objs != null) { + tempList.addAll(objs); } + this.objects = Collections.unmodifiableList(tempList); this.ki = ki; } @@ -270,7 +265,6 @@ } // validate all References - @SuppressWarnings("unchecked") List<Reference> refs = this.si.getReferences(); boolean validateRefs = true; for (int i = 0, size = refs.size(); validateRefs && i < size; i++) { @@ -297,7 +291,6 @@ { for (int i=0, size=objects.size(); validateMans && i < size; i++) { XMLObject xo = objects.get(i); - @SuppressWarnings("unchecked") List<XMLStructure> content = xo.getContent(); int csize = content.size(); for (int j = 0; validateMans && j < csize; j++) { @@ -307,7 +300,6 @@ log.log(java.util.logging.Level.FINE, "validating manifest"); } Manifest man = (Manifest)xs; - @SuppressWarnings("unchecked") List<Reference> manRefs = man.getReferences(); int rsize = manRefs.size(); for (int k = 0; validateMans && k < rsize; k++) { @@ -348,20 +340,17 @@ signatureIdMap = new HashMap<String, XMLStructure>(); signatureIdMap.put(id, this); signatureIdMap.put(si.getId(), si); - @SuppressWarnings("unchecked") List<Reference> refs = si.getReferences(); for (Reference ref : refs) { signatureIdMap.put(ref.getId(), ref); } for (XMLObject obj : objects) { signatureIdMap.put(obj.getId(), obj); - @SuppressWarnings("unchecked") List<XMLStructure> content = obj.getContent(); for (XMLStructure xs : content) { if (xs instanceof Manifest) { Manifest man = (Manifest)xs; signatureIdMap.put(man.getId(), man); - @SuppressWarnings("unchecked") List<Reference> manRefs = man.getReferences(); for (Reference ref : manRefs) { allReferences.add(ref); @@ -483,7 +472,6 @@ // reference dependencies in the XPath Transform - so be on // the safe side, and skip and do at end in the final sweep if (uri.length() == 0) { - @SuppressWarnings("unchecked") List<Transform> transforms = ref.getTransforms(); for (Transform transform : transforms) { String transformAlg = transform.getAlgorithm();
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java Tue Nov 25 10:41:40 2014 -0800 @@ -58,9 +58,8 @@ return new DOMXMLSignature(si, ki, null, null, null); } - @SuppressWarnings({ "unchecked", "rawtypes" }) public XMLSignature newXMLSignature(SignedInfo si, KeyInfo ki, - List objects, String id, String signatureValueId) { + List<? extends XMLObject> objects, String id, String signatureValueId) { return new DOMXMLSignature(si, ki, objects, id, signatureValueId); } @@ -68,16 +67,14 @@ return newReference(uri, dm, null, null, null); } - @SuppressWarnings({ "unchecked", "rawtypes" }) - public Reference newReference(String uri, DigestMethod dm, List transforms, - String type, String id) { + public Reference newReference(String uri, DigestMethod dm, + List<? extends Transform> transforms, String type, String id) { return new DOMReference(uri, type, dm, transforms, id, getProvider()); } - @SuppressWarnings({ "unchecked", "rawtypes" }) public Reference newReference(String uri, DigestMethod dm, - List appliedTransforms, Data result, List transforms, String type, - String id) { + List<? extends Transform> appliedTransforms, Data result, + List<? extends Transform> transforms, String type, String id) { if (appliedTransforms == null) { throw new NullPointerException("appliedTransforms cannot be null"); } @@ -91,9 +88,9 @@ (uri, type, dm, appliedTransforms, result, transforms, id, getProvider()); } - @SuppressWarnings({ "unchecked", "rawtypes" }) - public Reference newReference(String uri, DigestMethod dm, List transforms, - String type, String id, byte[] digestValue) { + public Reference newReference(String uri, DigestMethod dm, + List<? extends Transform> transforms, String type, String id, + byte[] digestValue) { if (digestValue == null) { throw new NullPointerException("digestValue cannot be null"); } @@ -101,43 +98,38 @@ (uri, type, dm, null, null, transforms, id, digestValue, getProvider()); } - @SuppressWarnings("rawtypes") public SignedInfo newSignedInfo(CanonicalizationMethod cm, - SignatureMethod sm, List references) { + SignatureMethod sm, List<? extends Reference> references) { return newSignedInfo(cm, sm, references, null); } - @SuppressWarnings({ "unchecked", "rawtypes" }) public SignedInfo newSignedInfo(CanonicalizationMethod cm, - SignatureMethod sm, List references, String id) { + SignatureMethod sm, List<? extends Reference> references, String id) { return new DOMSignedInfo(cm, sm, references, id); } // Object factory methods - @SuppressWarnings({ "unchecked", "rawtypes" }) - public XMLObject newXMLObject(List content, String id, String mimeType, - String encoding) { + public XMLObject newXMLObject(List<? extends XMLStructure> content, + String id, String mimeType, String encoding) { return new DOMXMLObject(content, id, mimeType, encoding); } - @SuppressWarnings("rawtypes") - public Manifest newManifest(List references) { + public Manifest newManifest(List<? extends Reference> references) { return newManifest(references, null); } - @SuppressWarnings({ "unchecked", "rawtypes" }) - public Manifest newManifest(List references, String id) { + public Manifest newManifest(List<? extends Reference> references, + String id) { return new DOMManifest(references, id); } - @SuppressWarnings({ "unchecked", "rawtypes" }) - public SignatureProperties newSignatureProperties(List props, String id) { + public SignatureProperties newSignatureProperties( + List<? extends SignatureProperty> props, String id) { return new DOMSignatureProperties(props, id); } - @SuppressWarnings({ "unchecked", "rawtypes" }) public SignatureProperty newSignatureProperty - (List info, String target, String id) { + (List<? extends XMLStructure> info, String target, String id) { return new DOMSignatureProperty(info, target, id); }
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathFilter2Transform.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathFilter2Transform.java Tue Nov 25 10:41:40 2014 -0800 @@ -133,7 +133,6 @@ String prefix = DOMUtils.getNSPrefix(context, Transform.XPATH2); String qname = (prefix == null || prefix.length() == 0) ? "xmlns" : "xmlns:" + prefix; - @SuppressWarnings("unchecked") List<XPathType> xpathList = xp.getXPathList(); for (XPathType xpathType : xpathList) { Element elem = DOMUtils.createElement(ownerDoc, "XPath", @@ -146,7 +145,6 @@ Transform.XPATH2); // add namespace attributes, if necessary - @SuppressWarnings("unchecked") Set<Map.Entry<String, String>> entries = xpathType.getNamespaceMap().entrySet(); for (Map.Entry<String, String> entry : entries) {
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathTransform.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathTransform.java Tue Nov 25 10:41:40 2014 -0800 @@ -99,7 +99,6 @@ xpathElem.appendChild(ownerDoc.createTextNode(xp.getXPath())); // add namespace attributes, if necessary - @SuppressWarnings("unchecked") Set<Map.Entry<String, String>> entries = xp.getNamespaceMap().entrySet(); for (Map.Entry<String, String> entry : entries) {
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/Utils.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/Utils.java Tue Nov 25 10:41:40 2014 -0800 @@ -70,10 +70,10 @@ * @param i the Iterator * @return the Set of Nodes */ - static Set<Node> toNodeSet(Iterator<Node> i) { + static Set<Node> toNodeSet(Iterator<?> i) { Set<Node> nodeSet = new HashSet<Node>(); while (i.hasNext()) { - Node n = i.next(); + Node n = (Node)i.next(); nodeSet.add(n); // insert attributes nodes to comply with XPath if (n.getNodeType() == Node.ELEMENT_NODE) {
--- a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/debugLoop.c Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/debugLoop.c Tue Nov 25 10:41:40 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, 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,7 +45,7 @@ static volatile struct PacketList *cmdQueue; static jrawMonitorID cmdQueueLock; -static jrawMonitorID resumeLock; +static jrawMonitorID vmDeathLock; static jboolean transportError; static jboolean @@ -60,28 +60,17 @@ } } -static jboolean -resumeCommand(jdwpCmdPacket *cmd) -{ - if ( (cmd->cmdSet == JDWP_COMMAND_SET(VirtualMachine)) && - (cmd->cmd == JDWP_COMMAND(VirtualMachine, Resume)) ) { - return JNI_TRUE; - } else { - return JNI_FALSE; - } -} - void debugLoop_initialize(void) { - resumeLock = debugMonitorCreate("JDWP Resume Lock"); + vmDeathLock = debugMonitorCreate("JDWP VM_DEATH Lock"); } void debugLoop_sync(void) { - debugMonitorEnter(resumeLock); - debugMonitorExit(resumeLock); + debugMonitorEnter(vmDeathLock); + debugMonitorExit(vmDeathLock); } /* @@ -136,14 +125,14 @@ jboolean replyToSender = JNI_TRUE; /* - * For VirtualMachine.Resume commands we hold the resumeLock + * For VirtualMachine commands we hold the vmDeathLock * while executing and replying to the command. This ensures - * that a Resume after VM_DEATH will be allowed to complete + * that a VM command after VM_DEATH will be allowed to complete * before the thread posting the VM_DEATH continues VM * termination. */ - if (resumeCommand(cmd)) { - debugMonitorEnter(resumeLock); + if (cmd->cmdSet == JDWP_COMMAND_SET(VirtualMachine)){ + debugMonitorEnter(vmDeathLock); } /* Initialize the input and output streams */ @@ -181,10 +170,10 @@ } /* - * Release the resumeLock as the reply has been posted. + * Release the vmDeathLock as the reply has been posted. */ - if (resumeCommand(cmd)) { - debugMonitorExit(resumeLock); + if (cmd->cmdSet == JDWP_COMMAND_SET(VirtualMachine)){ + debugMonitorExit(vmDeathLock); } inStream_destroy(&in);
--- a/jdk/test/ProblemList.txt Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/test/ProblemList.txt Tue Nov 25 10:41:40 2014 -0800 @@ -127,6 +127,10 @@ # 8058536 java/lang/instrument/NativeMethodPrefixAgent.java generic-all +# 8061177 +java/lang/instrument/RedefineBigClass.sh generic-all +java/lang/instrument/RetransformBigClass.sh generic-all + ############################################################################ # jdk_management
--- a/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java Tue Nov 25 10:41:40 2014 -0800 @@ -31,7 +31,7 @@ * @build TestMethods * @build LambdaFormTestCase * @build LFGarbageCollectedTest - * @run main/othervm/timeout=600 -Djava.lang.invoke.MethodHandle.USE_LF_EDITOR=true -DtestLimit=150 LFGarbageCollectedTest + * @run main/othervm LFGarbageCollectedTest */ import java.lang.invoke.MethodHandle;
--- a/jdk/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java Tue Nov 25 10:41:40 2014 -0800 @@ -31,7 +31,7 @@ * @build LambdaFormTestCase * @build LFCachingTestCase * @build LFMultiThreadCachingTest - * @run main/othervm/timeout=300 -Djava.lang.invoke.MethodHandle.USE_LF_EDITOR=true LFMultiThreadCachingTest + * @run main/othervm LFMultiThreadCachingTest */ import java.lang.invoke.MethodHandle;
--- a/jdk/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java Tue Nov 25 10:41:40 2014 -0800 @@ -31,7 +31,7 @@ * @build LambdaFormTestCase * @build LFCachingTestCase * @build LFSingleThreadCachingTest - * @run main/othervm/timeout=300 -Djava.lang.invoke.MethodHandle.USE_LF_EDITOR=true LFSingleThreadCachingTest + * @run main/othervm LFSingleThreadCachingTest */ import java.lang.invoke.MethodHandle;
--- a/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java Tue Nov 25 10:41:40 2014 -0800 @@ -27,6 +27,7 @@ import java.lang.reflect.Method; import java.util.Collection; import java.util.function.Function; +import jdk.testlibrary.Utils; /** * Lambda forms caching test case class. Contains all necessary test routines to @@ -41,6 +42,7 @@ private final static String INTERNAL_FORM_METHOD_NAME = "internalForm"; private static final double ITERATIONS_TO_CODE_CACHE_SIZE_RATIO = 45 / (128.0 * 1024 * 1024); + private static final long TIMEOUT = Utils.adjustTimeout(Utils.DEFAULT_TEST_TIMEOUT); /** * Reflection link to {@code j.l.i.MethodHandle.internalForm} method. It is @@ -120,6 +122,7 @@ System.out.printf("Number of iterations is set to %d (%d cases)%n", iterations, iterations * testCaseNum); System.out.flush(); + long startTime = System.currentTimeMillis(); for (long i = 0; i < iterations; i++) { System.err.println(String.format("Iteration %d:", i)); for (TestMethods testMethod : testMethods) { @@ -137,6 +140,14 @@ } testCounter++; } + long passedTime = System.currentTimeMillis() - startTime; + long avgIterTime = passedTime / (i + 1); + long remainTime = TIMEOUT - passedTime; + if (avgIterTime > 2 * remainTime) { + System.err.printf("Stopping iterations because of lack of time.%n" + + "Increase timeout factor for more iterations.%n"); + break; + } } if (!passed) { throw new Error(String.format("%d of %d test cases FAILED! %n"
--- a/jdk/test/java/lang/reflect/Parameter/BadClassFiles.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/test/java/lang/reflect/Parameter/BadClassFiles.java Tue Nov 25 10:41:40 2014 -0800 @@ -81,10 +81,23 @@ 0,25,0,0,0,3,0,0, 0,1,-79,0,0,0,1,0, 7,0,0,0,6,0,1,0, - 0,0,2,0,10,0,0,0, - 9,2,0,11,0,0,0,12, - 0,0,0,1,0,13,0,0, - 0,2,0,14 + 0,0,2, + // Method Parameters attribute here + 0,10, + // attribute_length + 0,0,0,9, + // parameter_count + 2, + // first parameter name + 0,11, + // first parameter modifiers + 0,0, + // second parameter name + 0,12, + // second parameter modifiers + 0,0, + // end attribute + 0,1,0,13,0,0,0,2,0,14 }; private static final byte[] BadModifiers_bytes = { @@ -121,10 +134,23 @@ 25,0,0,0,3,0,0,0, 1,-79,0,0,0,1,0,7, 0,0,0,6,0,1,0,0, - 0,2,0,10,0,0,0,9, - 2,0,11,0,51,51,12,0, - 0,0,1,0,13,0,0,0, - 2,0,14 + 0,2, + // Method Parameters attribute here + 0,10, + // attribute_length + 0,0,0,9, + // parameter_count + 2, + // first parameter name + 0,11, + // first parameter modifiers + 51,51, + // second parameter name + 0,12, + // second parameter modifiers + 0,0, + // end attribute + 0,1,0,13,0,0,0,2,0,14 }; private static final byte[] BadNameIndex_bytes = { @@ -161,10 +187,23 @@ 25,0,0,0,3,0,0,0, 1,-79,0,0,0,1,0,7, 0,0,0,6,0,1,0,0, - 0,2,0,10,0,0,0,9, - 2,0,1,0,0,0,12,0, - 0,0,1,0,13,0,0,0, - 2,0,14 + 0,2, + // Method Parameters attribute here + 0,10, + // attribute_length + 0,0,0,9, + // parameter_count + 2, + // first parameter name + 0,1, + // first parameter modifiers + 0,0, + // second parameter name + 0,12, + // second parameter modifiers + 0,0, + // end attribute + 0,1,0,13,0,0,0,2,0,14 }; private static final byte[] NameIndexOutOfBounds_bytes = { @@ -203,11 +242,23 @@ 25,0,0,0,3,0,0,0, 1,-79,0,0,0,1,0,7, 0,0,0,6,0,1,0,0, - 0,2,0,10,0,0,0,9, - 2,0,-1,0,0,0,12,0, - 0,0,1,0,13,0,0,0, - 2,0,14 - + 0,2, + // Method Parameters attribute here + 0,10, + // attribute_length + 0,0,0,9, + // parameter_count + 2, + // first parameter name + 0,-1, + // first parameter modifiers + 0,0, + // second parameter name + 0,12, + // second parameter modifiers + 0,0, + // end attribute + 0,1,0,13,0,0,0,2,0,14 }; private static final byte[] ExtraParams_bytes = { @@ -244,10 +295,26 @@ 0,0,3,0,0,0,1,-79, 0,0,0,1,0,7,0,0, 0,6,0,1,0,0,0,2, - 0,10,0,0,0,13,3,0, - 11,0,0,0,12,0,0,0, - 11,0,0,0,1,0,13,0, - 0,0,2,0,14 + // Method Parameters attribute here + 0,10, + // attribute_length + 0,0,0,13, + // parameter_count + 3, + // first parameter name + 0,11, + // first parameter modifiers + 0,0, + // second parameter name + 0,12, + // second parameter modifiers + 0,0, + // third parameter name + 0,11, + // third parameter modifiers + 0,0, + // end attribute + 0,1,0,13,0,0,0,2,0,14 }; private static final byte[] BadName1_bytes = { @@ -283,10 +350,23 @@ 25,0,0,0,3,0,0,0, 1,-79,0,0,0,1,0,7, 0,0,0,6,0,1,0,0, - 0,2,0,10,0,0,0,9, - 2,0,11,0,0,0,12,0, - 0,0,1,0,13,0,0,0, - 2,0,14 + 0,2, + // Method Parameters attribute here + 0,10, + // attribute_length + 0,0,0,9, + // parameter_count + 2, + // first parameter name + 0,11, + // first parameter modifiers + 0,0, + // second parameter name + 0,12, + // second parameter modifiers + 0,0, + // end attribute + 0,1,0,13,0,0,0,2,0,14 }; private static final byte[] BadName2_bytes = { @@ -322,10 +402,23 @@ 25,0,0,0,3,0,0,0, 1,-79,0,0,0,1,0,7, 0,0,0,6,0,1,0,0, - 0,2,0,10,0,0,0,9, - 2,0,11,0,0,0,12,0, - 0,0,1,0,13,0,0,0, - 2,0,14 + 0,2, + // Method Parameters attribute here + 0,10, + // attribute_length + 0,0,0,9, + // parameter_count + 2, + // first parameter name + 0,11, + // first parameter modifiers + 0,0, + // second parameter name + 0,12, + // second parameter modifiers + 0,0, + // end attribute + 0,1,0,13,0,0,0,2,0,14 }; private static final byte[] BadName3_bytes = { @@ -361,10 +454,23 @@ 25,0,0,0,3,0,0,0, 1,-79,0,0,0,1,0,7, 0,0,0,6,0,1,0,0, - 0,2,0,10,0,0,0,9, - 2,0,11,0,0,0,12,0, - 0,0,1,0,13,0,0,0, - 2,0,14 + 0,2, + // Method Parameters attribute here + 0,10, + // attribute_length + 0,0,0,9, + // parameter_count + 2, + // first parameter name + 0,11, + // first parameter modifiers + 0,0, + // second parameter name + 0,12, + // second parameter modifiers + 0,0, + // end attribute + 0,1,0,13,0,0,0,2,0,14 }; private static final byte[] BadName4_bytes = { @@ -400,10 +506,68 @@ 25,0,0,0,3,0,0,0, 1,-79,0,0,0,1,0,7, 0,0,0,6,0,1,0,0, - 0,2,0,10,0,0,0,9, - 2,0,11,0,0,0,12,0, - 0,0,1,0,13,0,0,0, - 2,0,14 + 0,2, + // Method Parameters attribute here + 0,10, + // attribute_length + 0,0,0,9, + // parameter_count + 2, + // first parameter name + 0,11, + // first parameter modifiers + 0,0, + // second parameter name + 0,12, + // second parameter modifiers + 0,0, + // end attribute + 0,1,0,13,0,0,0,2,0,14 + }; + + private static final byte[] BadParams_bytes = { + -54,-2,-70,-66,0,0,0, + 52,0,18,10,0,3,0,15, + 7,0,16,7,0,17,1,0,6, + 60,105,110,105,116,62, + 1,0,3,40,41,86,1,0,4, + 67,111,100,101,1,0,15, + 76,105,110,101,78,117, + 109,98,101,114,84,97, + 98,108,101,1,0,1,109, + 1,0,5,40,73,73,41,86, + 1,0,16,77,101,116,104, + 111,100,80,97,114,97, + 109,101,116,101,114,115, + 1,0,1,97,1,0,1,98,1, + 0,10,83,111,117,114, + 99,101,70,105,108,101, + 1,0,14,66,97,100,80,97, + 114,97,109,115,46,106, + 97,118,97,12,0,4,0,5, + 1,0,9,66,97,100,80,97, + 114,97,109,115,1,0,16, + 106,97,118,97,47,108,97, + 110,103,47,79,98,106, + 101,99,116,0,33,0, + 2,0,3,0,0,0,0,0,2, + 0,1,0,4,0,5,0,1,0, + 6,0,0,0,29,0,1,0,1, + 0,0,0,5,42,-73,0,1, + -79,0,0,0,1,0,7,0,0, + 0,6,0,1,0,0,0,1,0,1, + 0,8,0,9,0,2,0,6,0,0, + 0,25,0,0,0,3,0,0,0,1, + -79,0,0,0,1,0,7,0,0, + 0,6,0,1,0,0,0,2, + // Method Parameters attribute here + 0,10, + // attribute_length + 0,0,0,1, + // parameter_count + 0, + // end attribute + 0,1,0,13,0,0,0,2,0,14 }; private static class InMemoryClassLoader extends ClassLoader { @@ -423,6 +587,7 @@ loader.defineClass("BadNameIndex", BadNameIndex_bytes), loader.defineClass("NameIndexOutOfBounds", NameIndexOutOfBounds_bytes), loader.defineClass("ExtraParams", ExtraParams_bytes), + loader.defineClass("BadParams", BadParams_bytes), // Name with . loader.defineClass("BadName1", BadName1_bytes), // Name with [
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/lang/reflect/Parameter/NoName.java Tue Nov 25 10:41:40 2014 -0800 @@ -0,0 +1,121 @@ +/* + * 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 + * @run main NoName + * @summary The reflection API should report parameters with no name properly. + */ +import java.lang.Class; +import java.lang.reflect.Method; +import java.lang.reflect.Parameter; +import java.lang.reflect.MalformedParametersException; +import java.lang.ClassLoader; +import java.lang.ClassNotFoundException; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; + +public class NoName { + + private static final byte[] NoName_bytes = { + -54,-2,-70,-66,0,0,0,52, + 0,18,10,0,3,0,15,7, + 0,16,7,0,17,1,0,6, + 60,105,110,105,116,62,1,0, + 3,40,41,86,1,0,4,67, + 111,100,101,1,0,15,76,105, + 110,101,78,117,109,98,101,114, + 84,97,98,108,101,1,0,1, + 109,1,0,5,40,73,73,41, + 86,1,0,16,77,101,116,104, + 111,100,80,97,114,97,109,101, + 116,101,114,115,1,0,0,1, + 0,1,98,1,0,10,83,111, + 117,114,99,101,70,105,108,101, + 1,0,14,69,109,112,116,121, + 78,97,109,101,46,106,97,118, + 97,12,0,4,0,5,1,0, + 9,69,109,112,116,121,78,97, + 109,101,1,0,16,106,97,118, + 97,47,108,97,110,103,47,79, + 98,106,101,99,116,0,33,0, + 2,0,3,0,0,0,0,0, + 2,0,1,0,4,0,5,0, + 1,0,6,0,0,0,29,0, + 1,0,1,0,0,0,5,42, + -73,0,1,-79,0,0,0,1, + 0,7,0,0,0,6,0,1, + 0,0,0,1,0,1,0,8, + 0,9,0,2,0,6,0,0, + 0,25,0,0,0,3,0,0, + 0,1,-79,0,0,0,1,0, + 7,0,0,0,6,0,1,0, + 0,0,2, + // Method Parameters attribute here + 0,10, + // attribute_length + 0,0,0,9, + // parameter_count + 2, + // first parameter name + 0,0, + // first parameter modifiers + 0,0, + // second parameter name + 0,12, + // second parameter modifiers + 0,0, + // end attribute + 0,1,0,13,0,0,0,2,0,14 + }; + + private static class InMemoryClassLoader extends ClassLoader { + public Class<?> defineClass(String name, byte[] b) { + return defineClass(name, b, 0, b.length); + } + }; + + private static final InMemoryClassLoader loader = new InMemoryClassLoader(); + + private final Class<?> noName; + + private NoName() throws ClassNotFoundException { + noName = loader.defineClass("EmptyName", NoName_bytes); + } + + public static void main(String... args) + throws NoSuchMethodException, IOException, ClassNotFoundException { + new NoName().run(); + } + + public void run() throws NoSuchMethodException { + final Class<?> cls = noName; + System.err.println("Trying " + cls); + final Method method = cls.getMethod("m", int.class, int.class); + final Parameter[] params = method.getParameters(); + System.err.println("Name " + params[0].getName()); + System.err.println("Name " + params[1].getName()); + } + +}
--- a/jdk/test/java/util/Timer/NameConstructors.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/test/java/util/Timer/NameConstructors.java Tue Nov 25 10:41:40 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, 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,37 +23,42 @@ /* * @test - * @bug 4279061 + * @bug 4279061 8056313 * @summary Basic test for constructors with thread name */ -import java.util.*; +import java.util.Timer; +import java.util.TimerTask; +import java.util.concurrent.LinkedTransferQueue; public class NameConstructors { private static final String NAME1 = "Norm D. Plume"; private static final String NAME2 = "Ann Onymous"; - public static void main (String[] args) throws Exception { - Random rnd = new Random(); + public static void main (String[] args) throws InterruptedException { test(new Timer(NAME1), NAME1); test(new Timer(NAME2, true), NAME2); } - private static boolean done, passed; + public static void test(Timer timer, String expected) throws InterruptedException { + try { + LinkedTransferQueue<String> queue = new LinkedTransferQueue<>(); - public static void test(Timer timer, final String name) throws Exception { - done = passed = false; + TimerTask task = new TimerTask() { + public void run() { + queue.put(Thread.currentThread().getName()); + } + }; - TimerTask task = new TimerTask() { - public void run() { - passed = Thread.currentThread().getName().equals(name); - done = true; + timer.schedule(task, 0L); // immediately + String actual = queue.take(); + + if (!expected.equals(actual)) { + throw new AssertionError( + String.format("expected='%s', actual='%s'", expected, actual)); } - }; - timer.schedule(task, 0); // Immediate - Thread.sleep(500); - if (!(done && passed)) - throw new RuntimeException(done + " : " + passed); - timer.cancel(); + } finally { + timer.cancel(); + } } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/util/logging/LogManager/Configuration/ParentLoggerWithHandlerGC.java Tue Nov 25 10:41:40 2014 -0800 @@ -0,0 +1,517 @@ +/* + * Copyright (c) 2014, 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.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.FilePermission; +import java.io.IOException; +import java.lang.ref.Reference; +import java.lang.ref.ReferenceQueue; +import java.lang.ref.WeakReference; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.CodeSource; +import java.security.Permission; +import java.security.PermissionCollection; +import java.security.Permissions; +import java.security.Policy; +import java.security.ProtectionDomain; +import java.util.Arrays; +import java.util.Collections; +import java.util.Enumeration; +import java.util.HashSet; +import java.util.List; +import java.util.Properties; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.Callable; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.logging.FileHandler; +import java.util.logging.Handler; +import java.util.logging.LogManager; +import java.util.logging.Logger; +import java.util.logging.LoggingPermission; + +/** + * @test + * @bug 8060132 + * @summary tests that FileHandlers configured on abstract nodes in logging.properties + * will be closed by reset(). + * @run main/othervm ParentLoggerWithHandlerGC UNSECURE + * @run main/othervm ParentLoggerWithHandlerGC SECURE + * @author danielfuchs + */ +public class ParentLoggerWithHandlerGC { + + /** + * We will test the handling of abstract logger nodes with file handlers in + * two configurations: + * UNSECURE: No security manager. + * SECURE: With the security manager present - and the required + * permissions granted. + */ + public static enum TestCase { + UNSECURE, SECURE; + public void run(Properties propertyFile) throws Exception { + System.out.println("Running test case: " + name()); + Configure.setUp(this, propertyFile); + test(this.name() + " " + propertyFile.getProperty("test.name"), propertyFile); + } + } + + + private static final String PREFIX = + "FileHandler-" + UUID.randomUUID() + ".log"; + private static final String userDir = System.getProperty("user.dir", "."); + private static final boolean userDirWritable = Files.isWritable(Paths.get(userDir)); + + static enum ConfigMode { DEFAULT, ENSURE_CLOSE_ON_RESET_TRUE, ENSURE_CLOSE_ON_RESET_FALSE } + + private static final List<Properties> properties; + static { + Properties props1 = new Properties(); + props1.setProperty("test.name", "parent logger with handler"); + props1.setProperty("test.config.mode", ConfigMode.DEFAULT.name()); + props1.setProperty(FileHandler.class.getName() + ".pattern", PREFIX); + props1.setProperty(FileHandler.class.getName() + ".limit", String.valueOf(Integer.MAX_VALUE)); + props1.setProperty(FileHandler.class.getName() + ".level", "ALL"); + props1.setProperty(FileHandler.class.getName() + ".formatter", "java.util.logging.SimpleFormatter"); + props1.setProperty("com.foo.handlers", FileHandler.class.getName()); + props1.setProperty("com.bar.level", "FINEST"); + + Properties props2 = new Properties(); + props2.setProperty("test.name", "parent logger with handler"); + props2.setProperty("test.config.mode", ConfigMode.ENSURE_CLOSE_ON_RESET_TRUE.name()); + props2.setProperty(FileHandler.class.getName() + ".pattern", PREFIX); + props2.setProperty(FileHandler.class.getName() + ".limit", String.valueOf(Integer.MAX_VALUE)); + props2.setProperty(FileHandler.class.getName() + ".level", "ALL"); + props2.setProperty(FileHandler.class.getName() + ".formatter", "java.util.logging.SimpleFormatter"); + props2.setProperty("com.foo.handlers", FileHandler.class.getName()); + props2.setProperty("com.foo.handlers.ensureCloseOnReset", "true"); + props2.setProperty("com.bar.level", "FINEST"); + + Properties props3 = new Properties(); + props3.setProperty("test.name", "parent logger with handler"); + props3.setProperty("test.config.mode", ConfigMode.ENSURE_CLOSE_ON_RESET_FALSE.name()); + props3.setProperty(FileHandler.class.getName() + ".pattern", PREFIX); + props3.setProperty(FileHandler.class.getName() + ".limit", String.valueOf(Integer.MAX_VALUE)); + props3.setProperty(FileHandler.class.getName() + ".level", "ALL"); + props3.setProperty(FileHandler.class.getName() + ".formatter", "java.util.logging.SimpleFormatter"); + props3.setProperty("com.foo.handlers", FileHandler.class.getName()); + props3.setProperty("com.foo.handlers.ensureCloseOnReset", "false"); + props3.setProperty("com.bar.level", "FINEST"); + + properties = Collections.unmodifiableList(Arrays.asList( + props1, props2, props3)); + } + + public static void main(String... args) throws Exception { + + + if (args == null || args.length == 0) { + args = new String[] { + TestCase.UNSECURE.name(), + TestCase.SECURE.name(), + }; + } + + try { + for (String testName : args) { + for (Properties propertyFile : properties) { + TestCase test = TestCase.valueOf(testName); + test.run(propertyFile); + } + } + } finally { + if (userDirWritable) { + Configure.doPrivileged(() -> { + // cleanup - delete files that have been created + try { + Files.list(Paths.get(userDir)) + .filter((f) -> f.toString().contains(PREFIX)) + .forEach((f) -> { + try { + System.out.println("deleting " + f); + Files.delete(f); + } catch(Throwable t) { + System.err.println("Failed to delete " + f + ": " + t); + } + }); + } catch(Throwable t) { + System.err.println("Cleanup failed to list files: " + t); + t.printStackTrace(); + } + }); + } + } + } + + static class Configure { + static Policy policy = null; + static final AtomicBoolean allowAll = new AtomicBoolean(false); + static void setUp(TestCase test, Properties propertyFile) { + switch (test) { + case SECURE: + if (policy == null && System.getSecurityManager() != null) { + throw new IllegalStateException("SecurityManager already set"); + } else if (policy == null) { + policy = new SimplePolicy(TestCase.SECURE, allowAll); + Policy.setPolicy(policy); + System.setSecurityManager(new SecurityManager()); + } + if (System.getSecurityManager() == null) { + throw new IllegalStateException("No SecurityManager."); + } + if (policy == null) { + throw new IllegalStateException("policy not configured"); + } + break; + case UNSECURE: + if (System.getSecurityManager() != null) { + throw new IllegalStateException("SecurityManager already set"); + } + break; + default: + new InternalError("No such testcase: " + test); + } + doPrivileged(() -> { + try { + ByteArrayOutputStream bytes = new ByteArrayOutputStream(); + propertyFile.store(bytes, propertyFile.getProperty("test.name")); + ByteArrayInputStream bais = new ByteArrayInputStream(bytes.toByteArray()); + LogManager.getLogManager().readConfiguration(bais); + } catch (IOException ex) { + throw new RuntimeException(ex); + } + }); + } + static void doPrivileged(Runnable run) { + allowAll.set(true); + try { + run.run(); + } finally { + allowAll.set(false); + } + } + static <T> T callPrivileged(Callable<T> call) throws Exception { + allowAll.set(true); + try { + return call.call(); + } finally { + allowAll.set(false); + } + } + } + + @FunctionalInterface + public static interface FileHandlerSupplier { + public FileHandler test() throws Exception; + } + + static final class TestAssertException extends RuntimeException { + TestAssertException(String msg) { + super(msg); + } + } + + private static void assertEquals(long expected, long received, String msg) { + if (expected != received) { + throw new TestAssertException("Unexpected result for " + msg + + ".\n\texpected: " + expected + + "\n\tactual: " + received); + } else { + System.out.println("Got expected " + msg + ": " + received); + } + } + + + public static void test(String name, Properties props) throws Exception { + ConfigMode configMode = ConfigMode.valueOf(props.getProperty("test.config.mode")); + System.out.println("\nTesting: " + name + " mode=" + configMode); + if (!userDirWritable) { + throw new RuntimeException("Not writable: "+userDir); + } + switch(configMode) { + case DEFAULT: + case ENSURE_CLOSE_ON_RESET_TRUE: + testCloseOnResetTrue(name, props); break; + case ENSURE_CLOSE_ON_RESET_FALSE: + testCloseOnResetFalse(name, props); break; + default: + throw new RuntimeException("Unknwown mode: " + configMode); + } + } + + + // Test a configuration which has either + // com.foo.handlers.ensureCloseOnReset=true, or where + // com.foo.handlers.ensureCloseOnReset is not specified. + public static void testCloseOnResetTrue(String name, Properties props) + throws Exception { + Logger fooChild = Logger.getLogger("com.foo.child"); + fooChild.info("hello world"); + Logger barChild = Logger.getLogger("com.bar.child"); + barChild.info("hello world"); + + ReferenceQueue<Logger> queue = new ReferenceQueue(); + WeakReference<Logger> fooRef = new WeakReference<>(Logger.getLogger("com.foo"), queue); + if (fooRef.get() != fooChild.getParent()) { + throw new RuntimeException("Unexpected parent logger: " + + fooChild.getParent() +"\n\texpected: " + fooRef.get()); + } + WeakReference<Logger> barRef = new WeakReference<>(Logger.getLogger("com.bar"), queue); + if (barRef.get() != barChild.getParent()) { + throw new RuntimeException("Unexpected parent logger: " + + barChild.getParent() +"\n\texpected: " + barRef.get()); + } + fooChild = barChild = null; + Reference<? extends Logger> ref2 = null; + while ((ref2 = queue.poll()) == null) { + System.gc(); + Thread.sleep(1000); + } + Throwable failed = null; + try { + do { + if (ref2 != barRef) { + throw new RuntimeException("Unexpected reference: " + + ref2 +"\n\texpected: " + barRef); + } + if (ref2.get() != null) { + throw new RuntimeException("Referent not cleared: " + + ref2.get()); + } + System.out.println("Got barRef"); + System.gc(); + Thread.sleep(1000); + } while( (ref2 = queue.poll()) != null); + System.out.println("Parent logger GCed"); + } catch(Throwable t) { + failed = t; + } finally { + final Throwable suppressed = failed; + Configure.doPrivileged(() -> LogManager.getLogManager().reset()); + Configure.doPrivileged(() -> { + try { + StringBuilder builder = new StringBuilder(); + Files.list(Paths.get(userDir)) + .filter((f) -> f.toString().contains(PREFIX)) + .filter((f) -> f.toString().endsWith(".lck")) + .forEach((f) -> { + builder.append(f.toString()).append('\n'); + }); + if (!builder.toString().isEmpty()) { + throw new RuntimeException("Lock files not cleaned:\n" + + builder.toString()); + } + } catch(RuntimeException | Error x) { + if (suppressed != null) x.addSuppressed(suppressed); + throw x; + } catch(Exception x) { + if (suppressed != null) x.addSuppressed(suppressed); + throw new RuntimeException(x); + } + }); + while ((ref2 = queue.poll()) == null) { + System.gc(); + Thread.sleep(1000); + } + if (ref2 != fooRef) { + throw new RuntimeException("Unexpected reference: " + + ref2 +"\n\texpected: " + fooRef); + } + if (ref2.get() != null) { + throw new RuntimeException("Referent not cleared: " + ref2.get()); + } + System.out.println("Got fooRef after reset()"); + + } + if (failed != null) { + // should rarely happen... + throw new RuntimeException(failed); + } + + } + + private static Handler getHandlerToClose() throws Exception { + return Configure.callPrivileged( + () -> Logger.getLogger("com.foo.child").getParent().getHandlers()[0]); + } + + // Test a configuration which has com.foo.handlers.ensureCloseOnReset=false + public static void testCloseOnResetFalse(String name, Properties props) + throws Exception { + Logger fooChild = Logger.getLogger("com.foo.child"); + fooChild.info("hello world"); + Logger barChild = Logger.getLogger("com.bar.child"); + barChild.info("hello world"); + + Handler toClose = getHandlerToClose(); + + ReferenceQueue<Logger> queue = new ReferenceQueue(); + WeakReference<Logger> fooRef = new WeakReference<>(Logger.getLogger("com.foo"), queue); + if (fooRef.get() != fooChild.getParent()) { + throw new RuntimeException("Unexpected parent logger: " + + fooChild.getParent() +"\n\texpected: " + fooRef.get()); + } + WeakReference<Logger> barRef = new WeakReference<>(Logger.getLogger("com.bar"), queue); + if (barRef.get() != barChild.getParent()) { + throw new RuntimeException("Unexpected parent logger: " + + barChild.getParent() +"\n\texpected: " + barRef.get()); + } + fooChild = barChild = null; + Reference<? extends Logger> ref2 = null; + Set<WeakReference<Logger>> expectedRefs = new HashSet<>(Arrays.asList(fooRef, barRef)); + Throwable failed = null; + try { + int l=0; + while (failed == null && !expectedRefs.isEmpty()) { + int max = 60; + while ((ref2 = queue.poll()) == null) { + if (l > 0 && max-- <= 0) { + throw new RuntimeException("Logger #2 not GC'ed!" + + " max too short (max=60) or " + + "com.foo.handlers.ensureCloseOnReset=false" + + " does not work"); + } + System.gc(); + Thread.sleep(1000); + } + do { + if (!expectedRefs.contains(ref2)) { + throw new RuntimeException("Unexpected reference: " + + ref2 +"\n\texpected: " + expectedRefs); + } + if (ref2.get() != null) { + throw new RuntimeException("Referent not cleared: " + + ref2.get()); + } + expectedRefs.remove(ref2); + System.out.println("Got "+ + (ref2 == barRef ? "barRef" + : (ref2 == fooRef ? "fooRef" + : ref2.toString()))); + System.gc(); + Thread.sleep(1000); + System.out.println("Logger #" + (++l) + " GCed"); + } while( (ref2 = queue.poll()) != null); + } + } catch(Throwable t) { + failed = t; + } finally { + final Throwable suppressed = failed; + Configure.doPrivileged(() -> LogManager.getLogManager().reset()); + Configure.doPrivileged(() -> { + try { + toClose.close(); + StringBuilder builder = new StringBuilder(); + Files.list(Paths.get(userDir)) + .filter((f) -> f.toString().contains(PREFIX)) + .filter((f) -> f.toString().endsWith(".lck")) + .forEach((f) -> { + builder.append(f.toString()).append('\n'); + }); + if (!builder.toString().isEmpty()) { + throw new RuntimeException("Lock files not cleaned:\n" + builder.toString()); + } + } catch(RuntimeException | Error x) { + if (suppressed != null) x.addSuppressed(suppressed); + throw x; + } catch(Exception x) { + if (suppressed != null) x.addSuppressed(suppressed); + throw new RuntimeException(x); + } + }); + } + if (failed != null) { + // should rarely happen... + throw new RuntimeException(failed); + } + + } + + + final static class PermissionsBuilder { + final Permissions perms; + public PermissionsBuilder() { + this(new Permissions()); + } + public PermissionsBuilder(Permissions perms) { + this.perms = perms; + } + public PermissionsBuilder add(Permission p) { + perms.add(p); + return this; + } + public PermissionsBuilder addAll(PermissionCollection col) { + if (col != null) { + for (Enumeration<Permission> e = col.elements(); e.hasMoreElements(); ) { + perms.add(e.nextElement()); + } + } + return this; + } + public Permissions toPermissions() { + final PermissionsBuilder builder = new PermissionsBuilder(); + builder.addAll(perms); + return builder.perms; + } + } + + public static class SimplePolicy extends Policy { + + final Permissions permissions; + final Permissions allPermissions; + final AtomicBoolean allowAll; + public SimplePolicy(TestCase test, AtomicBoolean allowAll) { + this.allowAll = allowAll; + permissions = new Permissions(); + permissions.add(new LoggingPermission("control", null)); + permissions.add(new FilePermission(PREFIX+".lck", "read,write,delete")); + permissions.add(new FilePermission(PREFIX, "read,write")); + + // these are used for configuring the test itself... + allPermissions = new Permissions(); + allPermissions.add(new java.security.AllPermission()); + + } + + @Override + public boolean implies(ProtectionDomain domain, Permission permission) { + if (allowAll.get()) return allPermissions.implies(permission); + return permissions.implies(permission); + } + + @Override + public PermissionCollection getPermissions(CodeSource codesource) { + return new PermissionsBuilder().addAll(allowAll.get() + ? allPermissions : permissions).toPermissions(); + } + + @Override + public PermissionCollection getPermissions(ProtectionDomain domain) { + return new PermissionsBuilder().addAll(allowAll.get() + ? allPermissions : permissions).toPermissions(); + } + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/util/zip/ChecksumBase.java Tue Nov 25 10:41:40 2014 -0800 @@ -0,0 +1,196 @@ +/* + * Copyright (c) 2014, 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. + */ + +/** + * Base class for Checksum tests + */ +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.charset.StandardCharsets; +import java.util.zip.Checksum; + +public class ChecksumBase { + + private final static byte[] BYTES_123456789 = "123456789".getBytes(StandardCharsets.US_ASCII); + + public static void testAll(Checksum checksum, long expected) { + testBytes(checksum, expected); + testByteArray(checksum, expected); + testWrappedByteBuffer(checksum, expected); + testReadonlyByteBuffer(checksum, expected); + testDirectByteBuffer(checksum, expected); + testByteArrayOffset(checksum, expected); + testDirectByteBufferOffset(checksum, expected); + testLittleEndianDirectByteBufferOffset(checksum, expected); + testWrappedByteBufferOffset(checksum, expected); + testLittleEndianWrappedByteBufferOffset(checksum, expected); + testReadonlyByteBufferOffset(checksum, expected); + testLittleEndianReadonlyByteBufferOffset(checksum, expected); + } + + private static void testBytes(Checksum checksum, long expected) { + checksum.reset(); + for (byte bits : BYTES_123456789) { + checksum.update(bits); + } + checkChecksum(checksum, expected); + } + + private static void testByteArray(Checksum checksum, long expected) { + checksum.reset(); + checksum.update(BYTES_123456789); + checkChecksum(checksum, expected); + } + + private static void testWrappedByteBuffer(Checksum checksum, long expected) { + checksum.reset(); + ByteBuffer bb = ByteBuffer.wrap(BYTES_123456789); + checksum.update(bb); + checkChecksum(checksum, expected); + } + + private static void testReadonlyByteBuffer(Checksum checksum, long expected) { + checksum.reset(); + ByteBuffer bb = ByteBuffer.wrap(BYTES_123456789).asReadOnlyBuffer(); + checksum.update(bb); + checkChecksum(checksum, expected); + } + + private static void testDirectByteBuffer(Checksum checksum, long expected) { + checksum.reset(); + ByteBuffer bb = ByteBuffer.allocateDirect(BYTES_123456789.length); + bb.put(BYTES_123456789); + bb.rewind(); + checksum.update(bb); + checkChecksum(checksum, expected); + } + + private static void checkChecksum(Checksum checksum, long expected) { + if (checksum.getValue() != expected) { + throw new RuntimeException("Calculated checksum result was invalid." + + " Expected " + Long.toHexString(expected) + + ", but got " + Long.toHexString(checksum.getValue()) + "."); + } + } + + private static void testByteArrayOffset(Checksum checksum, long expected) { + byte[] unaligned_bytes_123456789 = new byte[BYTES_123456789.length + 64]; + for (int i = 0; i < unaligned_bytes_123456789.length - BYTES_123456789.length; i++) { + checksum.reset(); + System.arraycopy(BYTES_123456789, 0, unaligned_bytes_123456789, i, BYTES_123456789.length); + checksum.update(unaligned_bytes_123456789, i, BYTES_123456789.length); + checkChecksumOffset(checksum, expected, i); + } + } + + private static void testDirectByteBufferOffset(Checksum checksum, long expected) { + byte[] unaligned_bytes_123456789 = new byte[BYTES_123456789.length + 64]; + for (int i = 0; i < unaligned_bytes_123456789.length - BYTES_123456789.length; i++) { + checksum.reset(); + ByteBuffer bb = ByteBuffer.allocateDirect(unaligned_bytes_123456789.length); + System.arraycopy(BYTES_123456789, 0, unaligned_bytes_123456789, i, BYTES_123456789.length); + bb.put(unaligned_bytes_123456789); + bb.position(i); + bb.limit(i + BYTES_123456789.length); + checksum.update(bb); + checkChecksumOffset(checksum, expected, i); + } + } + + private static void testLittleEndianDirectByteBufferOffset(Checksum checksum, long expected) { + byte[] unaligned_bytes_123456789 = new byte[BYTES_123456789.length + 64]; + for (int i = 0; i < unaligned_bytes_123456789.length - BYTES_123456789.length; i++) { + checksum.reset(); + ByteBuffer bb = ByteBuffer.allocateDirect(unaligned_bytes_123456789.length); + bb.order(ByteOrder.LITTLE_ENDIAN); + System.arraycopy(BYTES_123456789, 0, unaligned_bytes_123456789, i, BYTES_123456789.length); + bb.put(unaligned_bytes_123456789); + bb.position(i); + bb.limit(i + BYTES_123456789.length); + checksum.update(bb); + checkChecksumOffset(checksum, expected, i); + } + } + + private static void testWrappedByteBufferOffset(Checksum checksum, long expected) { + byte[] unaligned_bytes_123456789 = new byte[BYTES_123456789.length + 64]; + for (int i = 0; i < unaligned_bytes_123456789.length - BYTES_123456789.length; i++) { + checksum.reset(); + System.arraycopy(BYTES_123456789, 0, unaligned_bytes_123456789, i, BYTES_123456789.length); + ByteBuffer bb = ByteBuffer.wrap(unaligned_bytes_123456789); + bb.position(i); + bb.limit(i + BYTES_123456789.length); + checksum.update(bb); + checkChecksumOffset(checksum, expected, i); + } + } + + private static void testLittleEndianWrappedByteBufferOffset(Checksum checksum, long expected) { + byte[] unaligned_bytes_123456789 = new byte[BYTES_123456789.length + 64]; + for (int i = 0; i < unaligned_bytes_123456789.length - BYTES_123456789.length; i++) { + checksum.reset(); + System.arraycopy(BYTES_123456789, 0, unaligned_bytes_123456789, i, BYTES_123456789.length); + ByteBuffer bb = ByteBuffer.wrap(unaligned_bytes_123456789); + bb.order(ByteOrder.LITTLE_ENDIAN); + bb.position(i); + bb.limit(i + BYTES_123456789.length); + checksum.update(bb); + checkChecksumOffset(checksum, expected, i); + } + } + + private static void testReadonlyByteBufferOffset(Checksum checksum, long expected) { + byte[] unaligned_bytes_123456789 = new byte[BYTES_123456789.length + 64]; + for (int i = 0; i < unaligned_bytes_123456789.length - BYTES_123456789.length; i++) { + checksum.reset(); + System.arraycopy(BYTES_123456789, 0, unaligned_bytes_123456789, i, BYTES_123456789.length); + ByteBuffer bb = ByteBuffer.wrap(unaligned_bytes_123456789).asReadOnlyBuffer(); + bb.position(i); + bb.limit(i + BYTES_123456789.length); + checksum.update(bb); + checkChecksumOffset(checksum, expected, i); + } + } + + private static void testLittleEndianReadonlyByteBufferOffset(Checksum checksum, long expected) { + byte[] unaligned_bytes_123456789 = new byte[BYTES_123456789.length + 64]; + for (int i = 0; i < unaligned_bytes_123456789.length - BYTES_123456789.length; i++) { + checksum.reset(); + System.arraycopy(BYTES_123456789, 0, unaligned_bytes_123456789, i, BYTES_123456789.length); + ByteBuffer bb = ByteBuffer.wrap(unaligned_bytes_123456789).asReadOnlyBuffer(); + bb.order(ByteOrder.LITTLE_ENDIAN); + bb.position(i); + bb.limit(i + BYTES_123456789.length); + checksum.update(bb); + checkChecksumOffset(checksum, expected, i); + } + } + + private static void checkChecksumOffset(Checksum checksum, long expected, int offset) { + if (checksum.getValue() != expected) { + throw new RuntimeException("Calculated CRC32C result was invalid. Array offset " + + offset + ". Expected: " + Long.toHexString(expected) + ", Got: " + + Long.toHexString(checksum.getValue())); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/util/zip/TestCRC32.java Tue Nov 25 10:41:40 2014 -0800 @@ -0,0 +1,40 @@ + +import java.util.zip.CRC32; + +/* + * Copyright (c) 2014, 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 @summary Check that CRC-32 returns the expected CRC value for the + * string 123456789 + * http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-32 + * @build ChecksumBase + * @run main TestCRC32 + */ + +public class TestCRC32 { + + public static void main(String[] args) { + ChecksumBase.testAll(new CRC32(), 0xCBF43926L); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/util/zip/TestCRC32C.java Tue Nov 25 10:41:40 2014 -0800 @@ -0,0 +1,40 @@ + +import java.util.zip.CRC32C; + +/* + * Copyright (c) 2014, 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 @summary Check that CRC-32C returns the expected CRC value for the + * string 123456789 + * http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-32c + * @build ChecksumBase + * @run main TestCRC32C + */ + +public class TestCRC32C { + + public static void main(String[] args) { + ChecksumBase.testAll(new CRC32C(), 0xE3069283L); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/util/zip/TestChecksum.java Tue Nov 25 10:41:40 2014 -0800 @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2014, 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 @summary Test that default methods in Checksum works as expected + * @build ChecksumBase + * @run main TestChecksum + */ +import java.util.zip.CRC32C; +import java.util.zip.Checksum; + +public class TestChecksum { + + public static void main(String[] args) { + ChecksumBase.testAll(new MyCRC32C(), 0xE3069283L); + } + + /** + * Only implementing required methods + */ + private static class MyCRC32C implements Checksum { + + private final CRC32C crc32c = new CRC32C(); + + @Override + public void update(int b) { + crc32c.update(b); + } + + @Override + public void update(byte[] b, int off, int len) { + crc32c.update(b, off, len); + } + + @Override + public long getValue() { + return crc32c.getValue(); + } + + @Override + public void reset() { + crc32c.reset(); + } + + } +}
--- a/jdk/test/javax/xml/crypto/dsig/GenerationTests.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/test/javax/xml/crypto/dsig/GenerationTests.java Tue Nov 25 10:41:40 2014 -0800 @@ -23,7 +23,7 @@ /** * @test - * @bug 4635230 6283345 6303830 6824440 6867348 7094155 8038184 8038349 + * @bug 4635230 6283345 6303830 6824440 6867348 7094155 8038184 8038349 8046949 * @summary Basic unit tests for generating XML Signatures with JSR 105 * @compile -XDignore.symbol.file KeySelectors.java SignatureValidator.java * X509KeySelector.java GenerationTests.java @@ -377,7 +377,7 @@ static void test_create_signature_x509_crt_crl() throws Exception { System.out.println("* Generating signature-x509-crt-crl.xml"); - List<Object> xds = new ArrayList<Object>(); + List<Object> xds = new ArrayList<>(); CertificateFactory cf = CertificateFactory.getInstance("X.509"); xds.add(signingCert); FileInputStream fis = new FileInputStream(CRL); @@ -444,7 +444,7 @@ SignedInfo si = fac.newSignedInfo(withoutComments, rsaSha1, refs); // create objects - List<XMLStructure> objs = new ArrayList<XMLStructure>(); + List<XMLObject> objs = new ArrayList<>(); // Object 1 List<Reference> manRefs = Collections.singletonList @@ -559,7 +559,7 @@ System.out.println("* Generating signature.xml"); // create references - List<Reference> refs = new ArrayList<Reference>(); + List<Reference> refs = new ArrayList<>(); // Reference 1 refs.add(fac.newReference(STYLESHEET, sha1)); @@ -610,7 +610,7 @@ SignatureProperties.TYPE, null)); // Reference 8 - List<Transform> transforms = new ArrayList<Transform>(); + List<Transform> transforms = new ArrayList<>(); transforms.add(fac.newTransform (Transform.ENVELOPED, (TransformParameterSpec) null)); refs.add(fac.newReference("", sha1, transforms, null, null)); @@ -685,7 +685,7 @@ Document doc = db.newDocument(); // create objects - List<XMLStructure> objs = new ArrayList<XMLStructure>(); + List<XMLObject> objs = new ArrayList<>(); // Object 1 objs.add(fac.newXMLObject(Collections.singletonList @@ -705,7 +705,7 @@ (new DOMStructure(nc)), "object-3", null, null)); // Manifest - List<Reference> manRefs = new ArrayList<Reference>(); + List<Reference> manRefs = new ArrayList<>(); // Manifest Reference 1 manRefs.add(fac.newReference(STYLESHEET, @@ -715,7 +715,7 @@ manRefs.add(fac.newReference("#reference-1", sha1)); // Manifest Reference 3 - List<Transform> manTrans = new ArrayList<Transform>(); + List<Transform> manTrans = new ArrayList<>(); String xslt = "" + "<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'\n" + " xmlns='http://www.w3.org/TR/xhtml1/strict' \n" @@ -770,7 +770,7 @@ null, null)); // Object 4 - List<Object> xds = new ArrayList<Object>(); + List<Object> xds = new ArrayList<>(); xds.add("CN=User"); xds.add(kifac.newX509IssuerSerial ("CN=User", new BigInteger("45ef2729", 16))); @@ -930,7 +930,7 @@ static void test_create_exc_signature() throws Exception { System.out.println("* Generating exc_signature.xml"); - List<Reference> refs = new ArrayList<Reference>(4); + List<Reference> refs = new ArrayList<>(4); // create reference 1 refs.add(fac.newReference @@ -942,7 +942,7 @@ null, null)); // create reference 2 - List<String> prefixList = new ArrayList<String>(2); + List<String> prefixList = new ArrayList<>(2); prefixList.add("bar"); prefixList.add("#default"); ExcC14NParameterSpec params = new ExcC14NParameterSpec(prefixList); @@ -963,7 +963,7 @@ null, null)); // create reference 4 - prefixList = new ArrayList<String>(2); + prefixList = new ArrayList<>(2); prefixList.add("bar"); prefixList.add("#default"); params = new ExcC14NParameterSpec(prefixList); @@ -982,7 +982,7 @@ fac.newSignatureMethod(SignatureMethod.DSA_SHA1, null), refs); // create KeyInfo - List<XMLStructure> kits = new ArrayList<XMLStructure>(2); + List<XMLStructure> kits = new ArrayList<>(2); kits.add(kifac.newKeyValue(validatingKey)); KeyInfo ki = kifac.newKeyInfo(kits); @@ -1027,10 +1027,10 @@ static void test_create_sign_spec() throws Exception { System.out.println("* Generating sign-spec.xml"); - List<Reference> refs = new ArrayList<Reference>(2); + List<Reference> refs = new ArrayList<>(2); // create reference 1 - List<XPathType> types = new ArrayList<XPathType>(3); + List<XPathType> types = new ArrayList<>(3); types.add(new XPathType(" //ToBeSigned ", XPathType.Filter.INTERSECT)); types.add(new XPathType(" //NotToBeSigned ", XPathType.Filter.SUBTRACT)); @@ -1043,7 +1043,7 @@ null, null)); // create reference 2 - List<Transform> trans2 = new ArrayList<Transform>(2); + List<Transform> trans2 = new ArrayList<>(2); trans2.add(fac.newTransform(Transform.ENVELOPED, (TransformParameterSpec) null)); XPathFilter2ParameterSpec xp2 = new XPathFilter2ParameterSpec @@ -1061,9 +1061,9 @@ fac.newSignatureMethod(SignatureMethod.DSA_SHA1, null), refs); // create KeyInfo - List<XMLStructure> kits = new ArrayList<XMLStructure>(2); + List<XMLStructure> kits = new ArrayList<>(2); kits.add(kifac.newKeyValue(validatingKey)); - List<Object> xds = new ArrayList<Object>(2); + List<Object> xds = new ArrayList<>(2); xds.add("CN=User"); xds.add(signingCert); kits.add(kifac.newX509Data(xds));
--- a/jdk/test/javax/xml/crypto/dsig/KeySelectors.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/test/javax/xml/crypto/dsig/KeySelectors.java Tue Nov 25 10:41:40 2014 -0800 @@ -101,9 +101,7 @@ throw new KeySelectorException("Null KeyInfo object!"); } // search for X509Data in keyinfo - Iterator iter = keyInfo.getContent().iterator(); - while (iter.hasNext()) { - XMLStructure kiType = (XMLStructure) iter.next(); + for (XMLStructure kiType : keyInfo.getContent()) { if (kiType instanceof X509Data) { X509Data xd = (X509Data) kiType; Object[] entries = xd.getContent().toArray(); @@ -114,10 +112,8 @@ crl = (X509CRL) entries[i]; } } - Iterator xi = xd.getContent().iterator(); boolean hasCRL = false; - while (xi.hasNext()) { - Object o = xi.next(); + for (Object o : xd.getContent()) { // skip non-X509Certificate entries if (o instanceof X509Certificate) { if ((purpose != KeySelector.Purpose.VERIFY) && @@ -152,10 +148,8 @@ throw new KeySelectorException("Null KeyInfo object!"); } SignatureMethod sm = (SignatureMethod) method; - List list = keyInfo.getContent(); - for (int i = 0; i < list.size(); i++) { - XMLStructure xmlStructure = (XMLStructure) list.get(i); + for (XMLStructure xmlStructure : keyInfo.getContent()) { if (xmlStructure instanceof KeyValue) { PublicKey pk = null; try { @@ -282,9 +276,7 @@ if (keyInfo == null) { throw new KeySelectorException("Null KeyInfo object!"); } - Iterator iter = keyInfo.getContent().iterator(); - while (iter.hasNext()) { - XMLStructure xmlStructure = (XMLStructure) iter.next(); + for (XMLStructure xmlStructure : keyInfo.getContent()) { try { if (xmlStructure instanceof KeyName) { String name = ((KeyName)xmlStructure).getName(); @@ -330,14 +322,12 @@ } } else if (xmlStructure instanceof X509Data) { List content = ((X509Data)xmlStructure).getContent(); - int size = content.size(); Vector<X509Certificate> result = null; // Lookup the public key using the information // specified in X509Data element, i.e. searching // over the collection of certificate files under // "certs" subdirectory and return those match. - for (int k = 0; k<size; k++) { - Object obj = content.get(k); + for (Object obj : content) { if (obj instanceof String) { result = match(MATCH_SUBJECT, obj, certs); } else if (obj instanceof byte[]) {
--- a/jdk/test/javax/xml/crypto/dsig/SignatureValidator.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/test/javax/xml/crypto/dsig/SignatureValidator.java Tue Nov 25 10:41:40 2014 -0800 @@ -78,9 +78,10 @@ // Check reference cache if (cache) { - Iterator i = signature.getSignedInfo().getReferences().iterator(); - for (int j=0; i.hasNext(); j++) { - Reference ref = (Reference) i.next(); + Iterator<Reference> i = + signature.getSignedInfo().getReferences().iterator(); + for (int j = 0; i.hasNext(); j++) { + Reference ref = i.next(); if (!digestInputEqual(ref)) { throw new Exception ("cached data for Reference[" + j + "] is not correct"); @@ -88,10 +89,10 @@ // check that dereferenced data does not contain comment nodes if (ref.getURI() == "") { System.out.println("checking deref data"); - NodeSetData data = (NodeSetData) ref.getDereferencedData(); - Iterator ni = data.iterator(); - while (ni.hasNext()) { - Node n = (Node) ni.next(); + @SuppressWarnings("unchecked") + NodeSetData<Node> data = + (NodeSetData<Node>)ref.getDereferencedData(); + for (Node n : data) { if (n.getNodeType() == Node.COMMENT_NODE) { throw new Exception("dereferenced data for " + " Reference[" + j + " contains comment node");
--- a/jdk/test/javax/xml/crypto/dsig/X509KeySelector.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/test/javax/xml/crypto/dsig/X509KeySelector.java Tue Nov 25 10:41:40 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -139,9 +139,7 @@ } // Iterate through KeyInfo types - Iterator i = keyInfo.getContent().iterator(); - while (i.hasNext()) { - XMLStructure kiType = (XMLStructure) i.next(); + for (XMLStructure kiType : keyInfo.getContent()) { // check X509Data if (kiType instanceof X509Data) { X509Data xd = (X509Data) kiType; @@ -303,9 +301,7 @@ } Collection<X509Certificate> certs = new ArrayList<>(); - Iterator xi = xd.getContent().iterator(); - while (xi.hasNext()) { - Object o = xi.next(); + for (Object o : xd.getContent()) { // check X509IssuerSerial if (o instanceof X509IssuerSerial) { X509IssuerSerial xis = (X509IssuerSerial) o;
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java Tue Nov 25 10:41:40 2014 -0800 @@ -38,6 +38,7 @@ import java.util.Collections; import java.util.regex.Pattern; import java.util.regex.Matcher; +import java.util.concurrent.TimeUnit; /** * Common library for various test helper functions. @@ -69,6 +70,12 @@ TIMEOUT_FACTOR = Double.parseDouble(toFactor); } + /** + * Returns the value of JTREG default test timeout in milliseconds + * converted to {@code long}. + */ + public static final long DEFAULT_TEST_TIMEOUT = TimeUnit.SECONDS.toMillis(120); + private Utils() { // Private constructor to prevent class instantiation } @@ -128,8 +135,7 @@ */ private static final Pattern useGcPattern = Pattern.compile( "(?:\\-XX\\:[\\+\\-]Use.+GC)" - + "|(?:\\-Xconcgc)" - + "|(?:\\-Xincgc)"); + + "|(?:\\-Xconcgc)"); public static List<String> removeGcOpts(List<String> opts) { List<String> optsWithoutGC = new ArrayList<String>(); for (String opt : opts) {
--- a/jdk/test/sun/net/www/http/HttpClient/StreamingRetry.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/test/sun/net/www/http/HttpClient/StreamingRetry.java Tue Nov 25 10:41:40 2014 -0800 @@ -37,13 +37,13 @@ public class StreamingRetry implements Runnable { static final int ACCEPT_TIMEOUT = 20 * 1000; // 20 seconds - ServerSocket ss; + volatile ServerSocket ss; - public static void main(String[] args) throws IOException { + public static void main(String[] args) throws Exception { (new StreamingRetry()).instanceMain(); } - void instanceMain() throws IOException { + void instanceMain() throws Exception { out.println("Test with default method"); test(null); out.println("Test with POST method"); @@ -54,12 +54,13 @@ if (failed > 0) throw new RuntimeException("Some tests failed"); } - void test(String method) throws IOException { + void test(String method) throws Exception { ss = new ServerSocket(0); ss.setSoTimeout(ACCEPT_TIMEOUT); int port = ss.getLocalPort(); - (new Thread(this)).start(); + Thread otherThread = new Thread(this); + otherThread.start(); try { URL url = new URL("http://localhost:" + port + "/"); @@ -77,6 +78,7 @@ //expected.printStackTrace(); } finally { ss.close(); + otherThread.join(); } }
--- a/jdk/test/sun/net/www/protocol/http/B6369510.java Mon Nov 17 12:32:27 2014 -0800 +++ b/jdk/test/sun/net/www/protocol/http/B6369510.java Tue Nov 25 10:41:40 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2014, 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,7 +40,7 @@ com.sun.net.httpserver.HttpServer httpServer; ExecutorService executorService; - public static void main(String[] args) + public static void main(String[] args) throws Exception { new B6369510(); } @@ -58,13 +58,15 @@ void doClient() { try { InetSocketAddress address = httpServer.getAddress(); + String urlString = "http://" + InetAddress.getLocalHost().getHostName() + ":" + address.getPort() + "/test/"; + System.out.println("URL == " + urlString); // GET Request - URL url = new URL("http://" + address.getHostName() + ":" + address.getPort() + "/test/"); + URL url = new URL("http://" + InetAddress.getLocalHost().getHostName() + ":" + address.getPort() + "/test/"); HttpURLConnection uc = (HttpURLConnection)url.openConnection(); int resp = uc.getResponseCode(); if (resp != 200) - throw new RuntimeException("Failed: Response code from GET is not 200"); + throw new RuntimeException("Failed: Response code from GET is not 200 RSP == " + resp); System.out.println("Response code from GET = 200 OK"); @@ -75,12 +77,13 @@ OutputStream os = uc.getOutputStream(); resp = uc.getResponseCode(); if (resp != 200) - throw new RuntimeException("Failed: Response code form POST is not 200"); + throw new RuntimeException("Failed: Response code form POST is not 200 RSP == " + resp); System.out.println("Response code from POST = 200 OK"); } catch (IOException e) { e.printStackTrace(); + throw new RuntimeException("Failed with IOException"); } finally { httpServer.stop(1); executorService.shutdown();