--- a/.hgtags Mon Oct 09 10:42:27 2017 +0530
+++ b/.hgtags Mon Oct 09 11:38:46 2017 -0700
@@ -449,3 +449,5 @@
e5357aa85dadacc6562175ff74714fecfb4470cf jdk-10+22
22850b3a55240253841b9a425ad60a7fcdb22d47 jdk-10+23
3b201865d5c1f244f555cad58da599c9261286d8 jdk-10+24
+8eb5e3ccee560c28ac9b1df2670adac2b3d36fad jdk-10+25
+1129253d3bc728a2963ba411ab9dd1adf358fb6b jdk-10+26
--- a/bin/jib.sh Mon Oct 09 10:42:27 2017 +0530
+++ b/bin/jib.sh Mon Oct 09 11:38:46 2017 -0700
@@ -28,8 +28,8 @@
mydir="$(dirname "${BASH_SOURCE[0]}")"
myname="$(basename "${BASH_SOURCE[0]}")"
-installed_jib_script=${mydir}/../../.jib/jib
-install_data=${mydir}/../../.jib/.data
+installed_jib_script=${mydir}/../.jib/jib
+install_data=${mydir}/../.jib/.data
setup_url() {
if [ -f ~/.config/jib/jib.conf ]; then
@@ -42,7 +42,7 @@
jib_revision="2.0-SNAPSHOT"
jib_ext="jib.sh.gz"
- closed_script="${mydir}/../../../closed/conf/jib-install.conf"
+ closed_script="${mydir}/../../closed/make/conf/jib-install.conf"
if [ -f "${closed_script}" ]; then
source "${closed_script}"
fi
--- a/doc/nashorn/JavaScriptingProgrammersGuide.html Mon Oct 09 10:42:27 2017 +0530
+++ b/doc/nashorn/JavaScriptingProgrammersGuide.html Mon Oct 09 11:38:46 2017 -0700
@@ -127,7 +127,7 @@
<hr>
<span><a name="package" id="package"></a></span>
<h2><span>Scripting Package</span></h2>
-<p><span>The Java Scripting functionality is in the <code><a href="http://docs.oracle.com/javase/6/docs/api/javax/script/package-summary.html">javax.script</a></code>
+<p><span>The Java Scripting functionality is in the <code><a href="http://docs.oracle.com/javase/9/docs/api/javax/script/package-summary.html">javax.script</a></code>
package. This is a relatively small, simple API. The starting point
of the scripting API is the <code>ScriptEngineManager</code> class.
A ScriptEngineManager object can discover script engines through
--- a/make/Bundles.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/Bundles.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -40,7 +40,7 @@
endif
# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, , Bundles-pre.gmk))
+$(eval $(call IncludeCustomExtension, Bundles-pre.gmk))
################################################################################
# BUNDLE : Name of bundle to create
# FILES : Files in BASE_DIRS to add to bundle
@@ -322,7 +322,7 @@
################################################################################
# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, , Bundles.gmk))
+$(eval $(call IncludeCustomExtension, Bundles.gmk))
################################################################################
--- a/make/CompileDemos.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/CompileDemos.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -303,7 +303,7 @@
################################################################################
# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, , CompileDemos.gmk))
+$(eval $(call IncludeCustomExtension, CompileDemos.gmk))
all: $(TARGETS)
images: $(IMAGES_TARGETS)
--- a/make/CompileJavaModules.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/CompileJavaModules.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -33,7 +33,7 @@
include SetupJavaCompilers.gmk
# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, , CompileJavaModules.gmk))
+$(eval $(call IncludeCustomExtension, CompileJavaModules.gmk))
################################################################################
# Module specific build settings
@@ -689,7 +689,7 @@
################################################################################
-$(eval $(call IncludeCustomExtension, , CompileJavaModules-post.gmk))
+$(eval $(call IncludeCustomExtension, CompileJavaModules-post.gmk))
################################################################################
--- a/make/CompileToolsHotspot.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/CompileToolsHotspot.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -35,7 +35,7 @@
TARGETS :=
# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, , hotspot/CompileTools.gmk))
+$(eval $(call IncludeCustomExtension, hotspot/CompileTools.gmk))
ifeq ($(INCLUDE_GRAAL), true)
VM_CI_SRC_DIR := $(TOPDIR)/src/jdk.internal.vm.ci/share/classes
--- a/make/CompileToolsJdk.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/CompileToolsJdk.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -32,7 +32,7 @@
################################################################################
-$(eval $(call IncludeCustomExtension, , CompileTools.gmk))
+$(eval $(call IncludeCustomExtension, CompileTools.gmk))
################################################################################
--- a/make/Docs.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/Docs.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -37,7 +37,7 @@
################################################################################
# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, , Docs.gmk))
+$(eval $(call IncludeCustomExtension, Docs.gmk))
################################################################################
# This file generates all documentation for OpenJDK.
--- a/make/Images.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/Images.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -34,7 +34,7 @@
JRE_TARGETS :=
# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, , Images-pre.gmk))
+$(eval $(call IncludeCustomExtension, Images-pre.gmk))
############################################################################
@@ -426,7 +426,7 @@
# Include custom post hook here to make it possible to augment the target lists
# before actual target prerequisites are declared.
-$(eval $(call IncludeCustomExtension, , Images-post.gmk))
+$(eval $(call IncludeCustomExtension, Images-post.gmk))
################################################################################
--- a/make/Init.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/Init.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -137,15 +137,16 @@
# The spec files depend on the autoconf source code. This check makes sure
# the configuration is up to date after changes to configure.
- CUSTOM_CONFIG_DIR ?= $(topdir)/closed/autoconf
-
- $(SPECS): $(wildcard $(topdir)/common/autoconf/*) $(wildcard $(CUSTOM_CONFIG_DIR)/*)
+ $(SPECS): $(wildcard $(topdir)/make/autoconf/*) \
+ $(if $(CUSTOM_CONFIG_DIR), $(wildcard $(CUSTOM_CONFIG_DIR)/*))
ifeq ($(CONF_CHECK), fail)
- @echo "Error: The configuration is not up to date for '$(lastword $(subst /, , $(dir $@)))'."
+ @echo Error: The configuration is not up to date for \
+ "'$(lastword $(subst /, , $(dir $@)))'."
$(call PrintConfCheckFailed)
@exit 2
else ifeq ($(CONF_CHECK), auto)
- @echo "Note: The configuration is not up to date for '$(lastword $(subst /, , $(dir $@)))'."
+ @echo Note: The configuration is not up to date for \
+ "'$(lastword $(subst /, , $(dir $@)))'."
@( cd $(topdir) && \
$(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -f $(topdir)/make/Init.gmk \
SPEC=$@ HAS_SPEC=true ACTUAL_TOPDIR=$(topdir) \
@@ -266,6 +267,7 @@
$(ECHO) "Re-running configure using default settings"
endif
( cd $(OUTPUTDIR) && PATH="$(ORIGINAL_PATH)" \
+ CUSTOM_CONFIG_DIR="$(CUSTOM_CONFIG_DIR)" \
$(BASH) $(CONFIGURE_CMD) $(CONFIGURE_COMMAND_LINE) )
##############################################################################
--- a/make/InitSupport.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/InitSupport.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -35,8 +35,9 @@
ifeq ($(HAS_SPEC),)
# Include the corresponding closed file, if present.
- # Normal hook mechanism cannot be used since we have no SPEC.
- -include $(topdir)/closed/make/InitSupport.gmk
+ ifneq ($(CUSTOM_MAKE_DIR), )
+ -include $(CUSTOM_MAKE_DIR)/InitSupport.gmk
+ endif
##############################################################################
# Helper functions for the initial part of Init.gmk, before the spec file is
--- a/make/Jprt.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/Jprt.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -104,4 +104,4 @@
################################################################################
-$(eval $(call IncludeCustomExtension, , Jprt.gmk))
+$(eval $(call IncludeCustomExtension, Jprt.gmk))
--- a/make/Main.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/Main.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -51,7 +51,7 @@
ALL_TARGETS :=
# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, , Main.gmk))
+$(eval $(call IncludeCustomExtension, Main.gmk))
# All modules for the current target platform.
ALL_MODULES := $(call FindAllModules)
--- a/make/ReleaseFile.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/ReleaseFile.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -80,7 +80,7 @@
################################################################################
-$(eval $(call IncludeCustomExtension, , ReleaseFile.gmk))
+$(eval $(call IncludeCustomExtension, ReleaseFile.gmk))
################################################################################
--- a/make/RunTests.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/RunTests.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -36,7 +36,7 @@
JTREG_TEST_TOPDIRS := $(TOPDIR) $(JTREG_TESTROOTS)
# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, , RunTests.gmk))
+$(eval $(call IncludeCustomExtension, RunTests.gmk))
TEST_RESULTS_DIR := $(OUTPUTDIR)/test-results
TEST_SUPPORT_DIR := $(OUTPUTDIR)/test-support
--- a/make/SourceRevision.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/SourceRevision.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -28,7 +28,7 @@
include $(SPEC)
include MakeBase.gmk
-$(eval $(call IncludeCustomExtension, , SourceRevision.gmk))
+$(eval $(call IncludeCustomExtension, SourceRevision.gmk))
################################################################################
# Keep track of what source revision is used to create the build, by creating
--- a/make/ToolsJdk.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/ToolsJdk.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -29,7 +29,7 @@
include JavaCompilation.gmk
# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, , Tools.gmk))
+$(eval $(call IncludeCustomExtension, Tools.gmk))
################################################################################
# To avoid reevaluating the compilation setup for the tools each time this file
--- a/make/UpdateBuildDocs.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/UpdateBuildDocs.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -63,7 +63,7 @@
################################################################################
-$(eval $(call IncludeCustomExtension, , UpdateBuildDocs.gmk))
+$(eval $(call IncludeCustomExtension, UpdateBuildDocs.gmk))
################################################################################
--- a/make/ZipSource.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/ZipSource.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -33,7 +33,7 @@
SRC_ZIP_WORK_DIR := $(SUPPORT_OUTPUTDIR)/src
# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, , ZipSource.gmk))
+$(eval $(call IncludeCustomExtension, ZipSource.gmk))
################################################################################
# Create the directory structure for src.zip using symlinks.
--- a/make/autoconf/autogen.sh Mon Oct 09 10:42:27 2017 +0530
+++ b/make/autoconf/autogen.sh Mon Oct 09 11:38:46 2017 -0700
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -52,15 +52,6 @@
TIMESTAMP=`date +%s`
fi
-if test "x$CUSTOM_CONFIG_DIR" = "x"; then
- topdir=`cd $script_dir/../.. >/dev/null && pwd`
- custom_script_dir="$topdir/closed/autoconf"
-else
- custom_script_dir=$CUSTOM_CONFIG_DIR
-fi
-
-custom_hook=$custom_script_dir/custom-hook.m4
-
AUTOCONF="`which autoconf 2> /dev/null | grep -v '^no autoconf in'`"
if test "x${AUTOCONF}" = x; then
@@ -75,11 +66,16 @@
echo "Generating generated-configure.sh"
generate_configure_script "$script_dir/generated-configure.sh" 'cat'
-if test -e $custom_hook; then
+if test "x$CUSTOM_CONFIG_DIR" != "x"; then
+ custom_hook=$CUSTOM_CONFIG_DIR/custom-hook.m4
+ if test ! -e $custom_hook; then
+ echo "CUSTOM_CONFIG_DIR set but $CUSTOM_CONFIG_DIR/custom-hook.m4 not present"
+ echo "Error: Cannot continue" 1>&2
+ exit 1
+ fi
+
# We have custom sources available; also generate configure script
# with custom hooks compiled in.
echo "Generating custom generated-configure.sh"
- generate_configure_script "$custom_script_dir/generated-configure.sh" 'sed -e "s|#CUSTOM_AUTOCONF_INCLUDE|m4_include([$custom_hook])|"'
-else
- echo "(No custom hook found at $custom_hook)"
+ generate_configure_script "$CUSTOM_CONFIG_DIR/generated-configure.sh" 'sed -e "s|#CUSTOM_AUTOCONF_INCLUDE|m4_include([$custom_hook])|"'
fi
--- a/make/autoconf/configure Mon Oct 09 10:42:27 2017 +0530
+++ b/make/autoconf/configure Mon Oct 09 11:38:46 2017 -0700
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -46,10 +46,12 @@
conf_script_dir="$TOPDIR/make/autoconf"
-if [ "$CUSTOM_CONFIG_DIR" = "" ]; then
- conf_custom_script_dir="$TOPDIR/closed/autoconf"
-else
- conf_custom_script_dir="$CUSTOM_CONFIG_DIR"
+if test "x$CUSTOM_CONFIG_DIR" != x; then
+ if test ! -e $CUSTOM_CONFIG_DIR/generated-configure.sh; then
+ echo "CUSTOM_CONFIG_DIR not pointing to a proper custom config dir."
+ echo "Error: Cannot continue" 1>&2
+ exit 1
+ fi
fi
###
@@ -76,10 +78,10 @@
fi
done
- if test -e $conf_custom_script_dir/generated-configure.sh; then
+ if test "x$CUSTOM_CONFIG_DIR" != x; then
# If custom source configure is available, make sure it is up-to-date as well.
- for file in $conf_script_dir/configure.ac $conf_script_dir/*.m4 $conf_custom_script_dir/*.m4; do
- if test $file -nt $conf_custom_script_dir/generated-configure.sh; then
+ for file in $conf_script_dir/configure.ac $conf_script_dir/*.m4 $CUSTOM_CONFIG_DIR/*.m4; do
+ if test $file -nt $CUSTOM_CONFIG_DIR/generated-configure.sh; then
echo "Warning: The configure source files is newer than the custom generated files."
run_autogen_or_fail
fi
@@ -93,11 +95,9 @@
if test "x$conf_updated_autoconf_files" != x; then
echo "Configure source code has been updated, checking time stamps"
check_autoconf_timestamps
- fi
-
- if test -e $conf_custom_script_dir; then
+ elif test "x$CUSTOM_CONFIG_DIR" != x; then
# If custom source configure is available, make sure it is up-to-date as well.
- conf_custom_updated_autoconf_files=`cd $conf_custom_script_dir && hg status -mard 2> /dev/null | grep autoconf`
+ conf_custom_updated_autoconf_files=`cd $CUSTOM_CONFIG_DIR && hg status -mard 2> /dev/null | grep autoconf`
if test "x$conf_custom_updated_autoconf_files" != x; then
echo "Configure custom source code has been updated, checking time stamps"
check_autoconf_timestamps
@@ -109,11 +109,11 @@
# Check for local changes
check_hg_updates
-if test -e $conf_custom_script_dir/generated-configure.sh; then
+if test "x$CUSTOM_CONFIG_DIR" != x; then
# Test if open configure is newer than custom configure, if so, custom needs to
# be regenerated. This test is required to ensure consistency with custom source.
conf_open_configure_timestamp=`grep DATE_WHEN_GENERATED= $conf_script_dir/generated-configure.sh | cut -d"=" -f 2`
- conf_custom_configure_timestamp=`grep DATE_WHEN_GENERATED= $conf_custom_script_dir/generated-configure.sh | cut -d"=" -f 2`
+ conf_custom_configure_timestamp=`grep DATE_WHEN_GENERATED= $CUSTOM_CONFIG_DIR/generated-configure.sh | cut -d"=" -f 2`
if test $conf_open_configure_timestamp -gt $conf_custom_configure_timestamp; then
echo "Warning: The generated configure file contains changes not present in the custom generated file."
run_autogen_or_fail
@@ -241,10 +241,10 @@
###
### Call the configure script
###
-if test -e $conf_custom_script_dir/generated-configure.sh; then
+if test "x$CUSTOM_CONFIG_DIR" != x; then
# Custom source configure available; run that instead
echo "Running custom generated-configure.sh"
- conf_script_to_run=$conf_custom_script_dir/generated-configure.sh
+ conf_script_to_run=$CUSTOM_CONFIG_DIR/generated-configure.sh
else
echo "Running generated-configure.sh"
conf_script_to_run=$conf_script_dir/generated-configure.sh
--- a/make/autoconf/spec.gmk.in Mon Oct 09 10:42:27 2017 +0530
+++ b/make/autoconf/spec.gmk.in Mon Oct 09 11:38:46 2017 -0700
@@ -847,9 +847,8 @@
# This macro is called to allow inclusion of closed source counterparts.
# Unless overridden in closed sources, it expands to nothing.
# Usage: This function is called in an open makefile, with the following
-# arguments:
-# $1 the name of the repo, or empty if the top-level repo.
-# $2 the name of the makefile
+# argument:
+# $1 the name of the makefile
define IncludeCustomExtension
endef
--- a/make/common/FindTests.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/common/FindTests.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -27,7 +27,7 @@
_FIND_TESTS_GMK := 1
# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, , common/FindTests.gmk))
+$(eval $(call IncludeCustomExtension, common/FindTests.gmk))
# JTREG_TESTROOTS might have been set by a custom extension
JTREG_TESTROOTS += $(addprefix $(TOPDIR)/test/, hotspot/jtreg jdk langtools nashorn jaxp)
--- a/make/common/MakeBase.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/common/MakeBase.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -991,6 +991,6 @@
################################################################################
# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, , common/MakeBase.gmk))
+$(eval $(call IncludeCustomExtension, common/MakeBase.gmk))
endif # _MAKEBASE_GMK
--- a/make/common/Modules.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/common/Modules.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -43,7 +43,7 @@
DOCS_MODULES :=
# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, , common/Modules.gmk))
+$(eval $(call IncludeCustomExtension, common/Modules.gmk))
BOOT_MODULES += \
java.base \
--- a/make/conf/jib-profiles.js Mon Oct 09 10:42:27 2017 +0530
+++ b/make/conf/jib-profiles.js Mon Oct 09 11:38:46 2017 -0700
@@ -900,6 +900,45 @@
}
},
+ "windows-x64-open": {
+ artifacts: {
+ jdk: {
+ local: "bundles/\\(jdk.*bin.tar.gz\\)",
+ remote: [
+ "bundles/openjdk/GPL/windows-x64/jdk-" + data.version
+ + "_windows-x64_bin.tar.gz",
+ "bundles/openjdk/GPL/windows-x64/\\1"
+ ],
+ subdir: "jdk-" + data.version
+ },
+ jre: {
+ local: "bundles/\\(jre.*bin.tar.gz\\)",
+ remote: "bundles/openjdk/GPL/windows-x64/\\1"
+ },
+ test: {
+ local: "bundles/\\(jdk.*bin-tests.tar.gz\\)",
+ remote: [
+ "bundles/openjdk/GPL/windows-x64/jdk-" + data.version
+ + "_windows-x64_bin-tests.tar.gz",
+ "bundles/openjdk/GPL/windows-x64/\\1"
+ ]
+ },
+ jdk_symbols: {
+ local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)",
+ remote: [
+ "bundles/openjdk/GPL/windows-x64/jdk-" + data.version
+ + "_windows-x64_bin-symbols.tar.gz",
+ "bundles/openjdk/GPL/windows-x64/\\1"
+ ],
+ subdir: "jdk-" + data.version
+ },
+ jre_symbols: {
+ local: "bundles/\\(jre.*bin-symbols.tar.gz\\)",
+ remote: "bundles/openjdk/GPL/windows-x64/\\1",
+ }
+ }
+ },
+
"linux-x86-open-debug": {
artifacts: {
jdk: {
@@ -929,9 +968,10 @@
profiles["linux-x86-ri-debug"] = clone(profiles["linux-x86-open-debug"]);
profiles["macosx-x64-ri"] = clone(profiles["macosx-x64-open"]);
profiles["windows-x86-ri"] = clone(profiles["windows-x86-open"]);
+ profiles["windows-x64-ri"] = clone(profiles["windows-x64-open"]);
// Generate artifacts for ri profiles
- [ "linux-x64-ri", "linux-x86-ri", "linux-x86-ri-debug", "macosx-x64-ri", "windows-x86-ri" ]
+ [ "linux-x64-ri", "linux-x86-ri", "linux-x86-ri-debug", "macosx-x64-ri", "windows-x86-ri", "windows-x64-ri" ]
.forEach(function (name) {
// Rewrite all remote dirs to "bundles/openjdk/BCL/..."
for (artifactName in profiles[name].artifacts) {
@@ -947,6 +987,11 @@
configure_args: "--with-freetype-license="
+ input.get("freetype", "install_path")
+ "/freetype-2.7.1-v120-x86/freetype.md"
+ },
+ "windows-x64-ri": {
+ configure_args: "--with-freetype-license="
+ + input.get("freetype", "install_path")
+ + "/freetype-2.7.1-v120-x64/freetype.md"
}
};
profiles = concatObjects(profiles, profilesRiFreetype);
--- a/make/copy/Copy-java.base.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/copy/Copy-java.base.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -25,7 +25,7 @@
include CopyCommon.gmk
-$(eval $(call IncludeCustomExtension, , copy/Copy-java.base.gmk))
+$(eval $(call IncludeCustomExtension, copy/Copy-java.base.gmk))
################################################################################
#
--- a/make/copy/Copy-java.desktop.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/copy/Copy-java.desktop.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -25,7 +25,7 @@
include CopyCommon.gmk
-$(eval $(call IncludeCustomExtension, , copy/Copy-java.desktop.gmk))
+$(eval $(call IncludeCustomExtension, copy/Copy-java.desktop.gmk))
################################################################################
--- a/make/gendata/Gendata-java.base.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/gendata/Gendata-java.base.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -26,7 +26,7 @@
include GendataCommon.gmk
# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, , gendata/Gendata-java.base.gmk))
+$(eval $(call IncludeCustomExtension, gendata/Gendata-java.base.gmk))
include GendataBreakIterator.gmk
--- a/make/gendata/GendataBlacklistedCerts.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/gendata/GendataBlacklistedCerts.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -23,7 +23,7 @@
# questions.
#
-$(eval $(call IncludeCustomExtension, , gendata/GendataBlacklistedCerts.gmk))
+$(eval $(call IncludeCustomExtension, gendata/GendataBlacklistedCerts.gmk))
GENDATA_BLACKLISTED_CERTS_SRC += $(TOPDIR)/make/data/blacklistedcertsconverter/blacklisted.certs.pem
GENDATA_BLACKLISTED_CERTS := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/security/blacklisted.certs
--- a/make/gendata/GendataFontConfig.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/gendata/GendataFontConfig.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -23,7 +23,7 @@
# questions.
#
-$(eval $(call IncludeCustomExtension, , gendata/GendataFontConfig.gmk))
+$(eval $(call IncludeCustomExtension, gendata/GendataFontConfig.gmk))
GENDATA_FONT_CONFIG_DST := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)
--- a/make/gensrc/Gensrc-java.desktop.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/gensrc/Gensrc-java.desktop.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -26,7 +26,7 @@
include GensrcCommonJdk.gmk
# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, , gensrc/Gensrc-java.desktop.gmk))
+$(eval $(call IncludeCustomExtension, gensrc/Gensrc-java.desktop.gmk))
ifneq ($(OPENJDK_TARGET_OS), windows)
include GensrcIcons.gmk
--- a/make/gensrc/Gensrc-jdk.internal.vm.compiler.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/gensrc/Gensrc-jdk.internal.vm.compiler.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -28,7 +28,7 @@
include $(SPEC)
include MakeBase.gmk
-$(eval $(call IncludeCustomExtension, , gensrc/Gensrc-jdk.internal.vm.compiler.gmk))
+$(eval $(call IncludeCustomExtension, gensrc/Gensrc-jdk.internal.vm.compiler.gmk))
GENSRC_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)
SRC_DIR := $(TOPDIR)/src/$(MODULE)/share/classes
--- a/make/gensrc/Gensrc-jdk.localedata.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/gensrc/Gensrc-jdk.localedata.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -26,7 +26,7 @@
include GensrcCommonJdk.gmk
# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, , gensrc/Gensrc-jdk.localedata.gmk))
+$(eval $(call IncludeCustomExtension, gensrc/Gensrc-jdk.localedata.gmk))
include GensrcLocaleData.gmk
include GensrcCLDR.gmk
--- a/make/gensrc/GensrcIcons.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/gensrc/GensrcIcons.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -23,7 +23,7 @@
# questions.
#
-$(eval $(call IncludeCustomExtension, , gensrc/GensrcIcons.gmk))
+$(eval $(call IncludeCustomExtension, gensrc/GensrcIcons.gmk))
GENSRC_AWT_ICONS :=
GENSRC_AWT_ICONS_SRC :=
--- a/make/hotspot/gensrc/GenerateSources.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/hotspot/gensrc/GenerateSources.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -39,7 +39,7 @@
include gensrc/GensrcDtrace.gmk
include gensrc/GensrcJvmti.gmk
-$(eval $(call IncludeCustomExtension, , hotspot/gensrc/GenerateSources.gmk))
+$(eval $(call IncludeCustomExtension, hotspot/gensrc/GenerateSources.gmk))
# While technically the rules below are "gendata" which can be done in parallel
# with native compilation, let's keep it here for simplicity.
--- a/make/hotspot/gensrc/GensrcAdlc.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/hotspot/gensrc/GensrcAdlc.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -23,7 +23,7 @@
# questions.
#
-$(eval $(call IncludeCustomExtension, , hotspot/gensrc/GensrcAdlc.gmk))
+$(eval $(call IncludeCustomExtension, hotspot/gensrc/GensrcAdlc.gmk))
ifeq ($(call check-jvm-feature, compiler2), true)
--- a/make/hotspot/gensrc/GensrcJvmti.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/hotspot/gensrc/GensrcJvmti.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -23,7 +23,7 @@
# questions.
#
-$(eval $(call IncludeCustomExtension, , hotspot/gensrc/GensrcJvmti.gmk))
+$(eval $(call IncludeCustomExtension, hotspot/gensrc/GensrcJvmti.gmk))
################################################################################
# Build tools needed for the JVMTI source code generation
--- a/make/hotspot/lib/CompileGtest.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/hotspot/lib/CompileGtest.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -23,7 +23,7 @@
# questions.
#
-$(eval $(call IncludeCustomExtension, , hotspot/lib/CompileGtest.gmk))
+$(eval $(call IncludeCustomExtension, hotspot/lib/CompileGtest.gmk))
GTEST_TEST_SRC += $(TOPDIR)/test/hotspot/gtest
GTEST_LAUNCHER_SRC := $(TOPDIR)/test/hotspot/gtest/gtestLauncher.cpp
--- a/make/hotspot/lib/CompileJvm.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/hotspot/lib/CompileJvm.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -28,7 +28,7 @@
include lib/JvmFeatures.gmk
include lib/JvmOverrideFiles.gmk
-$(eval $(call IncludeCustomExtension, , hotspot/lib/CompileJvm.gmk))
+$(eval $(call IncludeCustomExtension, hotspot/lib/CompileJvm.gmk))
################################################################################
# Setup compilation of the main Hotspot native library (libjvm).
--- a/make/hotspot/lib/JvmFeatures.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/hotspot/lib/JvmFeatures.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -23,7 +23,7 @@
# questions.
#
-$(eval $(call IncludeCustomExtension, , hotspot/lib/JvmFeatures.gmk))
+$(eval $(call IncludeCustomExtension, hotspot/lib/JvmFeatures.gmk))
################################################################################
# Setup CFLAGS and EXCLUDES for the libjvm compilation, depending on which
--- a/make/hotspot/lib/JvmMapfile.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/hotspot/lib/JvmMapfile.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -23,7 +23,7 @@
# questions.
#
-$(eval $(call IncludeCustomExtension, , hotspot/lib/JvmMapfile.gmk))
+$(eval $(call IncludeCustomExtension, hotspot/lib/JvmMapfile.gmk))
################################################################################
# Combine a list of static symbols
--- a/make/hotspot/lib/JvmOverrideFiles.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/hotspot/lib/JvmOverrideFiles.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -23,7 +23,7 @@
# questions.
#
-$(eval $(call IncludeCustomExtension, , hotspot/lib/JvmOverrideFiles.gmk))
+$(eval $(call IncludeCustomExtension, hotspot/lib/JvmOverrideFiles.gmk))
################################################################################
# This file contains explicit overrides of CFLAGS and/or precompiled header
--- a/make/launcher/Launcher-java.base.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/launcher/Launcher-java.base.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -25,7 +25,7 @@
include LauncherCommon.gmk
-$(eval $(call IncludeCustomExtension, , launcher/Launcher-java.base.gmk))
+$(eval $(call IncludeCustomExtension, launcher/Launcher-java.base.gmk))
JAVA_RC_FLAGS += -I $(TOPDIR)/src/java.base/windows/native/common
JAVA_RC_FLAGS += -I $(TOPDIR)/src/java.base/windows/native/launcher/icons
--- a/make/launcher/Launcher-java.desktop.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/launcher/Launcher-java.desktop.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -26,7 +26,7 @@
include LauncherCommon.gmk
# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, , launcher/Launcher-java.desktop.gmk))
+$(eval $(call IncludeCustomExtension, launcher/Launcher-java.desktop.gmk))
ifeq ($(ENABLE_HEADLESS_ONLY), false)
$(eval $(call SetupBuildLauncher, appletviewer, \
--- a/make/lib/Awt2dLibraries.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/lib/Awt2dLibraries.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -23,7 +23,7 @@
# questions.
#
-$(eval $(call IncludeCustomExtension, , lib/Awt2dLibraries-pre.gmk))
+$(eval $(call IncludeCustomExtension, lib/Awt2dLibraries-pre.gmk))
WIN_AWT_LIB := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt/awt.lib
@@ -1070,4 +1070,4 @@
################################################################################
# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, , lib/Awt2dLibraries.gmk))
+$(eval $(call IncludeCustomExtension, lib/Awt2dLibraries.gmk))
--- a/make/lib/CoreLibraries.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/lib/CoreLibraries.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -26,7 +26,7 @@
WIN_VERIFY_LIB := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libverify/verify.lib
# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, , lib/CoreLibraries.gmk))
+$(eval $(call IncludeCustomExtension, lib/CoreLibraries.gmk))
##########################################################################################
--- a/make/lib/Lib-java.instrument.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/lib/Lib-java.instrument.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -26,7 +26,7 @@
include LibCommon.gmk
# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, , lib/Lib-java.instrument.gmk))
+$(eval $(call IncludeCustomExtension, lib/Lib-java.instrument.gmk))
################################################################################
--- a/make/lib/Lib-java.management.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/lib/Lib-java.management.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -26,7 +26,7 @@
include LibCommon.gmk
# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, , lib/Lib-java.management.gmk))
+$(eval $(call IncludeCustomExtension, lib/Lib-java.management.gmk))
################################################################################
--- a/make/lib/Lib-jdk.hotspot.agent.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/lib/Lib-jdk.hotspot.agent.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -25,7 +25,7 @@
include NativeCompilation.gmk
-$(eval $(call IncludeCustomExtension, , hotspot/lib/Lib-jdk.hotspot.agent.gmk))
+$(eval $(call IncludeCustomExtension, hotspot/lib/Lib-jdk.hotspot.agent.gmk))
################################################################################
--- a/make/lib/Lib-jdk.management.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/lib/Lib-jdk.management.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -26,7 +26,7 @@
include LibCommon.gmk
# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, , lib/Lib-jdk.management.gmk))
+$(eval $(call IncludeCustomExtension, lib/Lib-jdk.management.gmk))
################################################################################
--- a/make/lib/LibCommon.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/lib/LibCommon.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -26,7 +26,7 @@
include NativeCompilation.gmk
# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, , lib/LibCommon.gmk))
+$(eval $(call IncludeCustomExtension, lib/LibCommon.gmk))
################################################################################
--- a/make/test/JtregNativeHotspot.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/test/JtregNativeHotspot.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -35,7 +35,7 @@
include MakeBase.gmk
include TestFilesCompilation.gmk
-$(eval $(call IncludeCustomExtension, , hotspot/test/JtregNative.gmk))
+$(eval $(call IncludeCustomExtension, hotspot/test/JtregNative.gmk))
################################################################################
# Targets for building the native tests themselves.
--- a/make/test/JtregNativeJdk.gmk Mon Oct 09 10:42:27 2017 +0530
+++ b/make/test/JtregNativeJdk.gmk Mon Oct 09 11:38:46 2017 -0700
@@ -35,7 +35,7 @@
include MakeBase.gmk
include TestFilesCompilation.gmk
-$(eval $(call IncludeCustomExtension, , test/JtregNative.gmk))
+$(eval $(call IncludeCustomExtension, test/JtregNative.gmk))
################################################################################
# Targets for building the native tests themselves.
--- a/src/java.base/share/classes/java/lang/StackFrameInfo.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.base/share/classes/java/lang/StackFrameInfo.java Mon Oct 09 11:38:46 2017 -0700
@@ -29,6 +29,7 @@
import static java.lang.StackWalker.Option.*;
import java.lang.StackWalker.StackFrame;
+import java.lang.invoke.MethodType;
class StackFrameInfo implements StackFrame {
private final static JavaLangInvokeAccess JLIA =
@@ -79,6 +80,17 @@
}
@Override
+ public MethodType getMethodType() {
+ walker.ensureAccessEnabled(RETAIN_CLASS_REFERENCE);
+ return JLIA.getMethodType(memberName);
+ }
+
+ @Override
+ public String getDescriptor() {
+ return JLIA.getMethodDescriptor(memberName);
+ }
+
+ @Override
public int getByteCodeIndex() {
// bci not available for native methods
if (isNativeMethod())
--- a/src/java.base/share/classes/java/lang/StackWalker.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.base/share/classes/java/lang/StackWalker.java Mon Oct 09 11:38:46 2017 -0700
@@ -26,10 +26,12 @@
import jdk.internal.reflect.CallerSensitive;
-import java.util.*;
+import java.lang.invoke.MethodType;
+import java.util.EnumSet;
+import java.util.Objects;
+import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Function;
-import java.util.function.Predicate;
import java.util.stream.Stream;
/**
@@ -96,7 +98,7 @@
* @since 9
* @jvms 2.6
*/
- public static interface StackFrame {
+ public interface StackFrame {
/**
* Gets the <a href="ClassLoader.html#name">binary name</a>
* of the declaring class of the method represented by this stack frame.
@@ -128,6 +130,47 @@
public Class<?> getDeclaringClass();
/**
+ * Returns the {@link MethodType} representing the parameter types and
+ * the return type for the method represented by this stack frame.
+ *
+ * @implSpec
+ * The default implementation throws {@code UnsupportedOperationException}.
+ *
+ * @return the {@code MethodType} for this stack frame
+ *
+ * @throws UnsupportedOperationException if this {@code StackWalker}
+ * is not configured with {@link Option#RETAIN_CLASS_REFERENCE
+ * Option.RETAIN_CLASS_REFERENCE}.
+ *
+ * @since 10
+ */
+ public default MethodType getMethodType() {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Returns the <i>descriptor</i> of the method represented by
+ * this stack frame as defined by
+ * <cite>The Java Virtual Machine Specification</cite>.
+ *
+ * @implSpec
+ * The default implementation throws {@code UnsupportedOperationException}.
+ *
+ * @return the descriptor of the method represented by
+ * this stack frame
+ *
+ * @see MethodType#fromMethodDescriptorString(String, ClassLoader)
+ * @see MethodType#toMethodDescriptorString()
+ * @jvms 4.3.3 Method Descriptor
+ *
+ * @since 10
+ */
+ public default String getDescriptor() {
+ throw new UnsupportedOperationException();
+ }
+
+
+ /**
* Returns the index to the code array of the {@code Code} attribute
* containing the execution point represented by this stack frame.
* The code array gives the actual bytes of Java Virtual Machine code
--- a/src/java.base/share/classes/java/lang/invoke/MemberName.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.base/share/classes/java/lang/invoke/MemberName.java Mon Oct 09 11:38:46 2017 -0700
@@ -162,6 +162,29 @@
return (MethodType) type;
}
+ /** Return the descriptor of this member, which
+ * must be a method or constructor.
+ */
+ String getMethodDescriptor() {
+ if (type == null) {
+ expandFromVM();
+ if (type == null) {
+ return null;
+ }
+ }
+ if (!isInvocable()) {
+ throw newIllegalArgumentException("not invocable, no method type");
+ }
+
+ // Get a snapshot of type which doesn't get changed by racing threads.
+ final Object type = this.type;
+ if (type instanceof String) {
+ return (String) type;
+ } else {
+ return getMethodType().toMethodDescriptorString();
+ }
+ }
+
/** Return the actual type under which this method or constructor must be invoked.
* For non-static methods or constructors, this is the type with a leading parameter,
* a reference to declaring class. For static methods, it is the same as the declared type.
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java Mon Oct 09 11:38:46 2017 -0700
@@ -1786,6 +1786,18 @@
}
@Override
+ public MethodType getMethodType(Object mname) {
+ MemberName memberName = (MemberName)mname;
+ return memberName.getMethodType();
+ }
+
+ @Override
+ public String getMethodDescriptor(Object mname) {
+ MemberName memberName = (MemberName)mname;
+ return memberName.getMethodDescriptor();
+ }
+
+ @Override
public boolean isNative(Object mname) {
MemberName memberName = (MemberName)mname;
return memberName.isNative();
--- a/src/java.base/share/classes/java/util/ArrayDeque.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.base/share/classes/java/util/ArrayDeque.java Mon Oct 09 11:38:46 2017 -0700
@@ -211,7 +211,7 @@
}
/**
- * Increments i, mod modulus.
+ * Circularly increments i, mod modulus.
* Precondition and postcondition: 0 <= i < modulus.
*/
static final int inc(int i, int modulus) {
@@ -220,7 +220,7 @@
}
/**
- * Decrements i, mod modulus.
+ * Circularly decrements i, mod modulus.
* Precondition and postcondition: 0 <= i < modulus.
*/
static final int dec(int i, int modulus) {
@@ -233,7 +233,7 @@
* Precondition: 0 <= i < modulus, 0 <= distance <= modulus.
* @return index 0 <= i < modulus
*/
- static final int add(int i, int distance, int modulus) {
+ static final int inc(int i, int distance, int modulus) {
if ((i += distance) - modulus >= 0) i -= modulus;
return i;
}
@@ -825,7 +825,7 @@
final int i, n;
return ((n = sub(getFence(), i = cursor, es.length) >> 1) <= 0)
? null
- : new DeqSpliterator(i, cursor = add(i, n, es.length));
+ : new DeqSpliterator(i, cursor = inc(i, n, es.length));
}
public void forEachRemaining(Consumer<? super E> action) {
--- a/src/java.base/share/classes/java/util/HashMap.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.base/share/classes/java/util/HashMap.java Mon Oct 09 11:38:46 2017 -0700
@@ -490,7 +490,7 @@
}
/**
- * Implements Map.putAll and Map constructor
+ * Implements Map.putAll and Map constructor.
*
* @param m the map
* @param evict false when initially constructing this map, else
@@ -557,7 +557,7 @@
}
/**
- * Implements Map.get and related methods
+ * Implements Map.get and related methods.
*
* @param hash hash for key
* @param key the key
@@ -612,7 +612,7 @@
}
/**
- * Implements Map.put and related methods
+ * Implements Map.put and related methods.
*
* @param hash hash for key
* @param key the key
@@ -700,7 +700,7 @@
}
threshold = newThr;
@SuppressWarnings({"rawtypes","unchecked"})
- Node<K,V>[] newTab = (Node<K,V>[])new Node[newCap];
+ Node<K,V>[] newTab = (Node<K,V>[])new Node[newCap];
table = newTab;
if (oldTab != null) {
for (int j = 0; j < oldCap; ++j) {
@@ -800,7 +800,7 @@
}
/**
- * Implements Map.remove and related methods
+ * Implements Map.remove and related methods.
*
* @param hash hash for key
* @param key the key
@@ -875,7 +875,7 @@
public boolean containsValue(Object value) {
Node<K,V>[] tab; V v;
if ((tab = table) != null && size > 0) {
- for (Node<K, V> e : tab) {
+ for (Node<K,V> e : tab) {
for (; e != null; e = e.next) {
if ((v = e.value) == value ||
(value != null && value.equals(v)))
@@ -927,7 +927,7 @@
throw new NullPointerException();
if (size > 0 && (tab = table) != null) {
int mc = modCount;
- for (Node<K, V> e : tab) {
+ for (Node<K,V> e : tab) {
for (; e != null; e = e.next)
action.accept(e.key);
}
@@ -975,7 +975,7 @@
throw new NullPointerException();
if (size > 0 && (tab = table) != null) {
int mc = modCount;
- for (Node<K, V> e : tab) {
+ for (Node<K,V> e : tab) {
for (; e != null; e = e.next)
action.accept(e.value);
}
@@ -1038,7 +1038,7 @@
throw new NullPointerException();
if (size > 0 && (tab = table) != null) {
int mc = modCount;
- for (Node<K, V> e : tab) {
+ for (Node<K,V> e : tab) {
for (; e != null; e = e.next)
action.accept(e);
}
@@ -1335,7 +1335,7 @@
throw new NullPointerException();
if (size > 0 && (tab = table) != null) {
int mc = modCount;
- for (Node<K, V> e : tab) {
+ for (Node<K,V> e : tab) {
for (; e != null; e = e.next)
action.accept(e.key, e.value);
}
@@ -1351,7 +1351,7 @@
throw new NullPointerException();
if (size > 0 && (tab = table) != null) {
int mc = modCount;
- for (Node<K, V> e : tab) {
+ for (Node<K,V> e : tab) {
for (; e != null; e = e.next) {
e.value = function.apply(e.key, e.value);
}
@@ -1394,9 +1394,10 @@
}
/**
- * Save the state of the {@code HashMap} instance to a stream (i.e.,
- * serialize it).
+ * Saves this map to a stream (that is, serializes it).
*
+ * @param s the stream
+ * @throws IOException if an I/O error occurs
* @serialData The <i>capacity</i> of the HashMap (the length of the
* bucket array) is emitted (int), followed by the
* <i>size</i> (an int, the number of key-value
@@ -1415,8 +1416,11 @@
}
/**
- * Reconstitute the {@code HashMap} instance from a stream (i.e.,
- * deserialize it).
+ * Reconstitutes this map from a stream (that is, deserializes it).
+ * @param s the stream
+ * @throws ClassNotFoundException if the class of a serialized object
+ * could not be found
+ * @throws IOException if an I/O error occurs
*/
private void readObject(java.io.ObjectInputStream s)
throws IOException, ClassNotFoundException {
@@ -1445,7 +1449,7 @@
threshold = ((cap < MAXIMUM_CAPACITY && ft < MAXIMUM_CAPACITY) ?
(int)ft : Integer.MAX_VALUE);
@SuppressWarnings({"rawtypes","unchecked"})
- Node<K,V>[] tab = (Node<K,V>[])new Node[cap];
+ Node<K,V>[] tab = (Node<K,V>[])new Node[cap];
table = tab;
// Read the keys and values, and put the mappings in the HashMap
@@ -1830,7 +1834,7 @@
void internalWriteEntries(java.io.ObjectOutputStream s) throws IOException {
Node<K,V>[] tab;
if (size > 0 && (tab = table) != null) {
- for (Node<K, V> e : tab) {
+ for (Node<K,V> e : tab) {
for (; e != null; e = e.next) {
s.writeObject(e.key);
s.writeObject(e.value);
@@ -1951,7 +1955,6 @@
/**
* Forms tree of the nodes linked from this node.
- * @return root of tree
*/
final void treeify(Node<K,V>[] tab) {
TreeNode<K,V> root = null;
@@ -2089,8 +2092,11 @@
return;
if (root.parent != null)
root = root.root();
- if (root == null || root.right == null ||
- (rl = root.left) == null || rl.left == null) {
+ if (root == null
+ || (movable
+ && (root.right == null
+ || (rl = root.left) == null
+ || rl.left == null))) {
tab[index] = first.untreeify(map); // too small
return;
}
@@ -2319,7 +2325,7 @@
static <K,V> TreeNode<K,V> balanceDeletion(TreeNode<K,V> root,
TreeNode<K,V> x) {
- for (TreeNode<K,V> xp, xpl, xpr;;) {
+ for (TreeNode<K,V> xp, xpl, xpr;;) {
if (x == null || x == root)
return root;
else if ((xp = x.parent) == null) {
--- a/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java Mon Oct 09 11:38:46 2017 -0700
@@ -2490,13 +2490,13 @@
for (Completion p = stack; p != null; p = p.next)
++count;
return super.toString() +
- ((r == null) ?
- ((count == 0) ?
- "[Not completed]" :
- "[Not completed, " + count + " dependents]") :
- (((r instanceof AltResult) && ((AltResult)r).ex != null) ?
- "[Completed exceptionally]" :
- "[Completed normally]"));
+ ((r == null)
+ ? ((count == 0)
+ ? "[Not completed]"
+ : "[Not completed, " + count + " dependents]")
+ : (((r instanceof AltResult) && ((AltResult)r).ex != null)
+ ? "[Completed exceptionally: " + ((AltResult)r).ex + "]"
+ : "[Completed normally]"));
}
// jdk9 additions
--- a/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java Mon Oct 09 11:38:46 2017 -0700
@@ -1394,8 +1394,8 @@
}
/**
- * Saves the state of the {@code ConcurrentHashMap} instance to a
- * stream (i.e., serializes it).
+ * Saves this map to a stream (that is, serializes it).
+ *
* @param s the stream
* @throws java.io.IOException if an I/O error occurs
* @serialData
@@ -1439,7 +1439,7 @@
}
/**
- * Reconstitutes the instance from a stream (that is, deserializes it).
+ * Reconstitutes this map from a stream (that is, deserializes it).
* @param s the stream
* @throws ClassNotFoundException if the class of a serialized object
* could not be found
--- a/src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListMap.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListMap.java Mon Oct 09 11:38:46 2017 -0700
@@ -58,6 +58,7 @@
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
+import java.util.concurrent.atomic.LongAdder;
/**
* A scalable concurrent {@link ConcurrentNavigableMap} implementation.
@@ -86,12 +87,7 @@
* associated map using {@code put}, {@code putIfAbsent}, or
* {@code replace}, depending on exactly which effect you need.)
*
- * <p>Beware that, unlike in most collections, the {@code size}
- * method is <em>not</em> a constant-time operation. Because of the
- * asynchronous nature of these maps, determining the current number
- * of elements requires a traversal of the elements, and so may report
- * inaccurate results if this collection is modified during traversal.
- * Additionally, the bulk operations {@code putAll}, {@code equals},
+ * <p>Beware that bulk operations {@code putAll}, {@code equals},
* {@code toArray}, {@code containsValue}, and {@code clear} are
* <em>not</em> guaranteed to be performed atomically. For example, an
* iterator operating concurrently with a {@code putAll} operation
@@ -158,42 +154,35 @@
* be slow and space-intensive using AtomicMarkedReference), nodes
* use direct CAS'able next pointers. On deletion, instead of
* marking a pointer, they splice in another node that can be
- * thought of as standing for a marked pointer (indicating this by
- * using otherwise impossible field values). Using plain nodes
- * acts roughly like "boxed" implementations of marked pointers,
- * but uses new nodes only when nodes are deleted, not for every
- * link. This requires less space and supports faster
- * traversal. Even if marked references were better supported by
- * JVMs, traversal using this technique might still be faster
- * because any search need only read ahead one more node than
- * otherwise required (to check for trailing marker) rather than
- * unmasking mark bits or whatever on each read.
+ * thought of as standing for a marked pointer (see method
+ * unlinkNode). Using plain nodes acts roughly like "boxed"
+ * implementations of marked pointers, but uses new nodes only
+ * when nodes are deleted, not for every link. This requires less
+ * space and supports faster traversal. Even if marked references
+ * were better supported by JVMs, traversal using this technique
+ * might still be faster because any search need only read ahead
+ * one more node than otherwise required (to check for trailing
+ * marker) rather than unmasking mark bits or whatever on each
+ * read.
*
* This approach maintains the essential property needed in the HM
* algorithm of changing the next-pointer of a deleted node so
* that any other CAS of it will fail, but implements the idea by
- * changing the pointer to point to a different node, not by
- * marking it. While it would be possible to further squeeze
- * space by defining marker nodes not to have key/value fields, it
- * isn't worth the extra type-testing overhead. The deletion
- * markers are rarely encountered during traversal and are
- * normally quickly garbage collected. (Note that this technique
- * would not work well in systems without garbage collection.)
+ * changing the pointer to point to a different node (with
+ * otherwise illegal null fields), not by marking it. While it
+ * would be possible to further squeeze space by defining marker
+ * nodes not to have key/value fields, it isn't worth the extra
+ * type-testing overhead. The deletion markers are rarely
+ * encountered during traversal, are easily detected via null
+ * checks that are needed anyway, and are normally quickly garbage
+ * collected. (Note that this technique would not work well in
+ * systems without garbage collection.)
*
* In addition to using deletion markers, the lists also use
* nullness of value fields to indicate deletion, in a style
* similar to typical lazy-deletion schemes. If a node's value is
* null, then it is considered logically deleted and ignored even
- * though it is still reachable. This maintains proper control of
- * concurrent replace vs delete operations -- an attempted replace
- * must fail if a delete beat it by nulling field, and a delete
- * must return the last non-null value held in the field. (Note:
- * Null, rather than some special marker, is used for value fields
- * here because it just so happens to mesh with the Map API
- * requirement that method get returns null if there is no
- * mapping, which allows nodes to remain concurrently readable
- * even when deleted. Using any other marker value here would be
- * messy at best.)
+ * though it is still reachable.
*
* Here's the sequence of events for a deletion of node n with
* predecessor b and successor f, initially:
@@ -203,9 +192,8 @@
* +------+ +------+ +------+
*
* 1. CAS n's value field from non-null to null.
- * From this point on, no public operations encountering
- * the node consider this mapping to exist. However, other
- * ongoing insertions and deletions might still modify
+ * Traversals encountering a node with null value ignore it.
+ * However, ongoing insertions and deletions might still modify
* n's next pointer.
*
* 2. CAS n's next pointer to point to a new marker node.
@@ -228,12 +216,7 @@
* thread noticed during a traversal a node with null value and
* helped out by marking and/or unlinking. This helping-out
* ensures that no thread can become stuck waiting for progress of
- * the deleting thread. The use of marker nodes slightly
- * complicates helping-out code because traversals must track
- * consistent reads of up to four nodes (b, n, marker, f), not
- * just (b, n, f), although the next field of a marker is
- * immutable, and once a next field is CAS'ed to point to a
- * marker, it never again changes, so this requires less care.
+ * the deleting thread.
*
* Skip lists add indexing to this scheme, so that the base-level
* traversals start close to the locations being found, inserted
@@ -243,113 +226,101 @@
* b) that are not (structurally) deleted, otherwise retrying
* after processing the deletion.
*
- * Index levels are maintained as lists with volatile next fields,
- * using CAS to link and unlink. Races are allowed in index-list
- * operations that can (rarely) fail to link in a new index node
- * or delete one. (We can't do this of course for data nodes.)
- * However, even when this happens, the index lists remain sorted,
- * so correctly serve as indices. This can impact performance,
- * but since skip lists are probabilistic anyway, the net result
- * is that under contention, the effective "p" value may be lower
- * than its nominal value. And race windows are kept small enough
- * that in practice these failures are rare, even under a lot of
- * contention.
+ * Index levels are maintained using CAS to link and unlink
+ * successors ("right" fields). Races are allowed in index-list
+ * operations that can (rarely) fail to link in a new index node.
+ * (We can't do this of course for data nodes.) However, even
+ * when this happens, the index lists correctly guide search.
+ * This can impact performance, but since skip lists are
+ * probabilistic anyway, the net result is that under contention,
+ * the effective "p" value may be lower than its nominal value.
*
- * The fact that retries (for both base and index lists) are
- * relatively cheap due to indexing allows some minor
- * simplifications of retry logic. Traversal restarts are
- * performed after most "helping-out" CASes. This isn't always
- * strictly necessary, but the implicit backoffs tend to help
- * reduce other downstream failed CAS's enough to outweigh restart
- * cost. This worsens the worst case, but seems to improve even
- * highly contended cases.
- *
- * Unlike most skip-list implementations, index insertion and
- * deletion here require a separate traversal pass occurring after
- * the base-level action, to add or remove index nodes. This adds
- * to single-threaded overhead, but improves contended
- * multithreaded performance by narrowing interference windows,
- * and allows deletion to ensure that all index nodes will be made
- * unreachable upon return from a public remove operation, thus
- * avoiding unwanted garbage retention. This is more important
- * here than in some other data structures because we cannot null
- * out node fields referencing user keys since they might still be
- * read by other ongoing traversals.
+ * Index insertion and deletion sometimes require a separate
+ * traversal pass occurring after the base-level action, to add or
+ * remove index nodes. This adds to single-threaded overhead, but
+ * improves contended multithreaded performance by narrowing
+ * interference windows, and allows deletion to ensure that all
+ * index nodes will be made unreachable upon return from a public
+ * remove operation, thus avoiding unwanted garbage retention.
*
* Indexing uses skip list parameters that maintain good search
* performance while using sparser-than-usual indices: The
- * hardwired parameters k=1, p=0.5 (see method doPut) mean
- * that about one-quarter of the nodes have indices. Of those that
- * do, half have one level, a quarter have two, and so on (see
- * Pugh's Skip List Cookbook, sec 3.4). The expected total space
- * requirement for a map is slightly less than for the current
- * implementation of java.util.TreeMap.
+ * hardwired parameters k=1, p=0.5 (see method doPut) mean that
+ * about one-quarter of the nodes have indices. Of those that do,
+ * half have one level, a quarter have two, and so on (see Pugh's
+ * Skip List Cookbook, sec 3.4), up to a maximum of 62 levels
+ * (appropriate for up to 2^63 elements). The expected total
+ * space requirement for a map is slightly less than for the
+ * current implementation of java.util.TreeMap.
*
* Changing the level of the index (i.e, the height of the
- * tree-like structure) also uses CAS. The head index has initial
- * level/height of one. Creation of an index with height greater
- * than the current level adds a level to the head index by
- * CAS'ing on a new top-most head. To maintain good performance
- * after a lot of removals, deletion methods heuristically try to
- * reduce the height if the topmost levels appear to be empty.
- * This may encounter races in which it possible (but rare) to
- * reduce and "lose" a level just as it is about to contain an
- * index (that will then never be encountered). This does no
- * structural harm, and in practice appears to be a better option
- * than allowing unrestrained growth of levels.
+ * tree-like structure) also uses CAS. Creation of an index with
+ * height greater than the current level adds a level to the head
+ * index by CAS'ing on a new top-most head. To maintain good
+ * performance after a lot of removals, deletion methods
+ * heuristically try to reduce the height if the topmost levels
+ * appear to be empty. This may encounter races in which it is
+ * possible (but rare) to reduce and "lose" a level just as it is
+ * about to contain an index (that will then never be
+ * encountered). This does no structural harm, and in practice
+ * appears to be a better option than allowing unrestrained growth
+ * of levels.
*
- * The code for all this is more verbose than you'd like. Most
- * operations entail locating an element (or position to insert an
- * element). The code to do this can't be nicely factored out
- * because subsequent uses require a snapshot of predecessor
- * and/or successor and/or value fields which can't be returned
- * all at once, at least not without creating yet another object
- * to hold them -- creating such little objects is an especially
- * bad idea for basic internal search operations because it adds
- * to GC overhead. (This is one of the few times I've wished Java
- * had macros.) Instead, some traversal code is interleaved within
- * insertion and removal operations. The control logic to handle
- * all the retry conditions is sometimes twisty. Most search is
- * broken into 2 parts. findPredecessor() searches index nodes
- * only, returning a base-level predecessor of the key. findNode()
- * finishes out the base-level search. Even with this factoring,
- * there is a fair amount of near-duplication of code to handle
- * variants.
+ * This class provides concurrent-reader-style memory consistency,
+ * ensuring that read-only methods report status and/or values no
+ * staler than those holding at method entry. This is done by
+ * performing all publication and structural updates using
+ * (volatile) CAS, placing an acquireFence in a few access
+ * methods, and ensuring that linked objects are transitively
+ * acquired via dependent reads (normally once) unless performing
+ * a volatile-mode CAS operation (that also acts as an acquire and
+ * release). This form of fence-hoisting is similar to RCU and
+ * related techniques (see McKenney's online book
+ * https://www.kernel.org/pub/linux/kernel/people/paulmck/perfbook/perfbook.html)
+ * It minimizes overhead that may otherwise occur when using so
+ * many volatile-mode reads. Using explicit acquireFences is
+ * logistically easier than targeting particular fields to be read
+ * in acquire mode: fences are just hoisted up as far as possible,
+ * to the entry points or loop headers of a few methods. A
+ * potential disadvantage is that these few remaining fences are
+ * not easily optimized away by compilers under exclusively
+ * single-thread use. It requires some care to avoid volatile
+ * mode reads of other fields. (Note that the memory semantics of
+ * a reference dependently read in plain mode exactly once are
+ * equivalent to those for atomic opaque mode.) Iterators and
+ * other traversals encounter each node and value exactly once.
+ * Other operations locate an element (or position to insert an
+ * element) via a sequence of dereferences. This search is broken
+ * into two parts. Method findPredecessor (and its specialized
+ * embeddings) searches index nodes only, returning a base-level
+ * predecessor of the key. Callers carry out the base-level
+ * search, restarting if encountering a marker preventing link
+ * modification. In some cases, it is possible to encounter a
+ * node multiple times while descending levels. For mutative
+ * operations, the reported value is validated using CAS (else
+ * retrying), preserving linearizability with respect to each
+ * other. Others may return any (non-null) value holding in the
+ * course of the method call. (Search-based methods also include
+ * some useless-looking explicit null checks designed to allow
+ * more fields to be nulled out upon removal, to reduce floating
+ * garbage, but which is not currently done, pending discovery of
+ * a way to do this with less impact on other operations.)
*
* To produce random values without interference across threads,
* we use within-JDK thread local random support (via the
* "secondary seed", to avoid interference with user-level
* ThreadLocalRandom.)
*
- * A previous version of this class wrapped non-comparable keys
- * with their comparators to emulate Comparables when using
- * comparators vs Comparables. However, JVMs now appear to better
- * handle infusing comparator-vs-comparable choice into search
- * loops. Static method cpr(comparator, x, y) is used for all
- * comparisons, which works well as long as the comparator
- * argument is set up outside of loops (thus sometimes passed as
- * an argument to internal methods) to avoid field re-reads.
- *
* For explanation of algorithms sharing at least a couple of
* features with this one, see Mikhail Fomitchev's thesis
* (http://www.cs.yorku.ca/~mikhail/), Keir Fraser's thesis
* (http://www.cl.cam.ac.uk/users/kaf24/), and Hakan Sundell's
* thesis (http://www.cs.chalmers.se/~phs/).
*
- * Given the use of tree-like index nodes, you might wonder why
- * this doesn't use some kind of search tree instead, which would
- * support somewhat faster search operations. The reason is that
- * there are no known efficient lock-free insertion and deletion
- * algorithms for search trees. The immutability of the "down"
- * links of index nodes (as opposed to mutable "left" fields in
- * true trees) makes this tractable using only CAS operations.
- *
* Notation guide for local variables
- * Node: b, n, f for predecessor, node, successor
+ * Node: b, n, f, p for predecessor, node, successor, aux
* Index: q, r, d for index node, right, down.
- * t for another index node
* Head: h
- * Levels: j
* Keys: k, key
* Values: v, value
* Comparisons: c
@@ -358,16 +329,6 @@
private static final long serialVersionUID = -8627078645895051609L;
/**
- * Special value used to identify base-level header.
- */
- static final Object BASE_HEADER = new Object();
-
- /**
- * The topmost head index of the skiplist.
- */
- private transient volatile HeadIndex<K,V> head;
-
- /**
* The comparator used to maintain order in this map, or null if
* using natural ordering. (Non-private to simplify access in
* nested classes.)
@@ -375,311 +336,152 @@
*/
final Comparator<? super K> comparator;
+ /** Lazily initialized topmost index of the skiplist. */
+ private transient Index<K,V> head;
+ /** Lazily initialized element count */
+ private transient LongAdder adder;
/** Lazily initialized key set */
private transient KeySet<K,V> keySet;
/** Lazily initialized values collection */
private transient Values<K,V> values;
/** Lazily initialized entry set */
private transient EntrySet<K,V> entrySet;
- /** Lazily initialized descending key set */
+ /** Lazily initialized descending map */
private transient SubMap<K,V> descendingMap;
/**
- * Initializes or resets state. Needed by constructors, clone,
- * clear, readObject. and ConcurrentSkipListSet.clone.
- * (Note that comparator must be separately initialized.)
- */
- private void initialize() {
- keySet = null;
- entrySet = null;
- values = null;
- descendingMap = null;
- head = new HeadIndex<K,V>(new Node<K,V>(null, BASE_HEADER, null),
- null, null, 1);
- }
-
- /**
- * compareAndSet head node.
- */
- private boolean casHead(HeadIndex<K,V> cmp, HeadIndex<K,V> val) {
- return HEAD.compareAndSet(this, cmp, val);
- }
-
- /* ---------------- Nodes -------------- */
-
- /**
* Nodes hold keys and values, and are singly linked in sorted
* order, possibly with some intervening marker nodes. The list is
- * headed by a dummy node accessible as head.node. The value field
- * is declared only as Object because it takes special non-V
- * values for marker and header nodes.
+ * headed by a header node accessible as head.node. Headers and
+ * marker nodes have null keys. The val field (but currently not
+ * the key field) is nulled out upon deletion.
*/
static final class Node<K,V> {
- final K key;
- volatile Object value;
- volatile Node<K,V> next;
-
- /**
- * Creates a new regular node.
- */
- Node(K key, Object value, Node<K,V> next) {
+ final K key; // currently, never detached
+ V val;
+ Node<K,V> next;
+ Node(K key, V value, Node<K,V> next) {
this.key = key;
- this.value = value;
- this.next = next;
- }
-
- /**
- * Creates a new marker node. A marker is distinguished by
- * having its value field point to itself. Marker nodes also
- * have null keys, a fact that is exploited in a few places,
- * but this doesn't distinguish markers from the base-level
- * header node (head.node), which also has a null key.
- */
- Node(Node<K,V> next) {
- this.key = null;
- this.value = this;
+ this.val = value;
this.next = next;
}
-
- /**
- * compareAndSet value field.
- */
- boolean casValue(Object cmp, Object val) {
- return VALUE.compareAndSet(this, cmp, val);
- }
-
- /**
- * compareAndSet next field.
- */
- boolean casNext(Node<K,V> cmp, Node<K,V> val) {
- return NEXT.compareAndSet(this, cmp, val);
- }
-
- /**
- * Returns true if this node is a marker. This method isn't
- * actually called in any current code checking for markers
- * because callers will have already read value field and need
- * to use that read (not another done here) and so directly
- * test if value points to node.
- *
- * @return true if this node is a marker node
- */
- boolean isMarker() {
- return value == this;
- }
-
- /**
- * Returns true if this node is the header of base-level list.
- * @return true if this node is header node
- */
- boolean isBaseHeader() {
- return value == BASE_HEADER;
- }
-
- /**
- * Tries to append a deletion marker to this node.
- * @param f the assumed current successor of this node
- * @return true if successful
- */
- boolean appendMarker(Node<K,V> f) {
- return casNext(f, new Node<K,V>(f));
- }
-
- /**
- * Helps out a deletion by appending marker or unlinking from
- * predecessor. This is called during traversals when value
- * field seen to be null.
- * @param b predecessor
- * @param f successor
- */
- void helpDelete(Node<K,V> b, Node<K,V> f) {
- /*
- * Rechecking links and then doing only one of the
- * help-out stages per call tends to minimize CAS
- * interference among helping threads.
- */
- if (f == next && this == b.next) {
- if (f == null || f.value != f) // not already marked
- casNext(f, new Node<K,V>(f));
- else
- b.casNext(this, f.next);
- }
- }
-
- /**
- * Returns value if this node contains a valid key-value pair,
- * else null.
- * @return this node's value if it isn't a marker or header or
- * is deleted, else null
- */
- V getValidValue() {
- Object v = value;
- if (v == this || v == BASE_HEADER)
- return null;
- @SuppressWarnings("unchecked") V vv = (V)v;
- return vv;
- }
-
- /**
- * Creates and returns a new SimpleImmutableEntry holding current
- * mapping if this node holds a valid value, else null.
- * @return new entry or null
- */
- AbstractMap.SimpleImmutableEntry<K,V> createSnapshot() {
- Object v = value;
- if (v == null || v == this || v == BASE_HEADER)
- return null;
- @SuppressWarnings("unchecked") V vv = (V)v;
- return new AbstractMap.SimpleImmutableEntry<K,V>(key, vv);
- }
-
- // VarHandle mechanics
- private static final VarHandle VALUE;
- private static final VarHandle NEXT;
- static {
- try {
- MethodHandles.Lookup l = MethodHandles.lookup();
- VALUE = l.findVarHandle(Node.class, "value", Object.class);
- NEXT = l.findVarHandle(Node.class, "next", Node.class);
- } catch (ReflectiveOperationException e) {
- throw new Error(e);
- }
- }
}
- /* ---------------- Indexing -------------- */
-
/**
- * Index nodes represent the levels of the skip list. Note that
- * even though both Nodes and Indexes have forward-pointing
- * fields, they have different types and are handled in different
- * ways, that can't nicely be captured by placing field in a
- * shared abstract class.
+ * Index nodes represent the levels of the skip list.
*/
- static class Index<K,V> {
- final Node<K,V> node;
+ static final class Index<K,V> {
+ final Node<K,V> node; // currently, never detached
final Index<K,V> down;
- volatile Index<K,V> right;
-
- /**
- * Creates index node with given values.
- */
+ Index<K,V> right;
Index(Node<K,V> node, Index<K,V> down, Index<K,V> right) {
this.node = node;
this.down = down;
this.right = right;
}
-
- /**
- * compareAndSet right field.
- */
- final boolean casRight(Index<K,V> cmp, Index<K,V> val) {
- return RIGHT.compareAndSet(this, cmp, val);
- }
-
- /**
- * Returns true if the node this indexes has been deleted.
- * @return true if indexed node is known to be deleted
- */
- final boolean indexesDeletedNode() {
- return node.value == null;
- }
-
- /**
- * Tries to CAS newSucc as successor. To minimize races with
- * unlink that may lose this index node, if the node being
- * indexed is known to be deleted, it doesn't try to link in.
- * @param succ the expected current successor
- * @param newSucc the new successor
- * @return true if successful
- */
- final boolean link(Index<K,V> succ, Index<K,V> newSucc) {
- Node<K,V> n = node;
- newSucc.right = succ;
- return n.value != null && casRight(succ, newSucc);
- }
-
- /**
- * Tries to CAS right field to skip over apparent successor
- * succ. Fails (forcing a retraversal by caller) if this node
- * is known to be deleted.
- * @param succ the expected current successor
- * @return true if successful
- */
- final boolean unlink(Index<K,V> succ) {
- return node.value != null && casRight(succ, succ.right);
- }
-
- // VarHandle mechanics
- private static final VarHandle RIGHT;
- static {
- try {
- MethodHandles.Lookup l = MethodHandles.lookup();
- RIGHT = l.findVarHandle(Index.class, "right", Index.class);
- } catch (ReflectiveOperationException e) {
- throw new Error(e);
- }
- }
}
- /* ---------------- Head nodes -------------- */
-
- /**
- * Nodes heading each level keep track of their level.
- */
- static final class HeadIndex<K,V> extends Index<K,V> {
- final int level;
- HeadIndex(Node<K,V> node, Index<K,V> down, Index<K,V> right, int level) {
- super(node, down, right);
- this.level = level;
- }
- }
-
- /* ---------------- Comparison utilities -------------- */
+ /* ---------------- Utilities -------------- */
/**
* Compares using comparator or natural ordering if null.
* Called only by methods that have performed required type checks.
*/
@SuppressWarnings({"unchecked", "rawtypes"})
- static final int cpr(Comparator c, Object x, Object y) {
+ static int cpr(Comparator c, Object x, Object y) {
return (c != null) ? c.compare(x, y) : ((Comparable)x).compareTo(y);
}
+ /**
+ * Returns the header for base node list, or null if uninitialized
+ */
+ final Node<K,V> baseHead() {
+ Index<K,V> h;
+ VarHandle.acquireFence();
+ return ((h = head) == null) ? null : h.node;
+ }
+
+ /**
+ * Tries to unlink deleted node n from predecessor b (if both
+ * exist), by first splicing in a marker if not already present.
+ * Upon return, node n is sure to be unlinked from b, possibly
+ * via the actions of some other thread.
+ *
+ * @param b if nonnull, predecessor
+ * @param n if nonnull, node known to be deleted
+ */
+ static <K,V> void unlinkNode(Node<K,V> b, Node<K,V> n) {
+ if (b != null && n != null) {
+ Node<K,V> f, p;
+ for (;;) {
+ if ((f = n.next) != null && f.key == null) {
+ p = f.next; // already marked
+ break;
+ }
+ else if (NEXT.compareAndSet(n, f,
+ new Node<K,V>(null, null, f))) {
+ p = f; // add marker
+ break;
+ }
+ }
+ NEXT.compareAndSet(b, n, p);
+ }
+ }
+
+ /**
+ * Adds to element count, initializing adder if necessary
+ *
+ * @param c count to add
+ */
+ private void addCount(long c) {
+ LongAdder a;
+ do {} while ((a = adder) == null &&
+ !ADDER.compareAndSet(this, null, a = new LongAdder()));
+ a.add(c);
+ }
+
+ /**
+ * Returns element count, initializing adder if necessary.
+ */
+ final long getAdderCount() {
+ LongAdder a; long c;
+ do {} while ((a = adder) == null &&
+ !ADDER.compareAndSet(this, null, a = new LongAdder()));
+ return ((c = a.sum()) <= 0L) ? 0L : c; // ignore transient negatives
+ }
+
/* ---------------- Traversal -------------- */
/**
- * Returns a base-level node with key strictly less than given key,
- * or the base-level header if there is no such node. Also
- * unlinks indexes to deleted nodes found along the way. Callers
- * rely on this side-effect of clearing indices to deleted nodes.
- * @param key the key
- * @return a predecessor of key
+ * Returns an index node with key strictly less than given key.
+ * Also unlinks indexes to deleted nodes found along the way.
+ * Callers rely on this side-effect of clearing indices to deleted
+ * nodes.
+ *
+ * @param key if nonnull the key
+ * @return a predecessor node of key, or null if uninitialized or null key
*/
private Node<K,V> findPredecessor(Object key, Comparator<? super K> cmp) {
- if (key == null)
- throw new NullPointerException(); // don't postpone errors
- for (;;) {
- for (Index<K,V> q = head, r = q.right, d;;) {
- if (r != null) {
- Node<K,V> n = r.node;
- K k = n.key;
- if (n.value == null) {
- if (!q.unlink(r))
- break; // restart
- r = q.right; // reread r
- continue;
- }
- if (cpr(cmp, key, k) > 0) {
+ Index<K,V> q;
+ VarHandle.acquireFence();
+ if ((q = head) == null || key == null)
+ return null;
+ else {
+ for (Index<K,V> r, d;;) {
+ while ((r = q.right) != null) {
+ Node<K,V> p; K k;
+ if ((p = r.node) == null || (k = p.key) == null ||
+ p.val == null) // unlink index to deleted node
+ RIGHT.compareAndSet(q, r, r.right);
+ else if (cpr(cmp, key, k) > 0)
q = r;
- r = r.right;
- continue;
- }
+ else
+ break;
}
- if ((d = q.down) == null)
+ if ((d = q.down) != null)
+ q = d;
+ else
return q.node;
- q = d;
- r = d.right;
}
}
}
@@ -689,41 +491,11 @@
* deleted nodes seen along the way. Repeatedly traverses at
* base-level looking for key starting at predecessor returned
* from findPredecessor, processing base-level deletions as
- * encountered. Some callers rely on this side-effect of clearing
- * deleted nodes.
- *
- * Restarts occur, at traversal step centered on node n, if:
- *
- * (1) After reading n's next field, n is no longer assumed
- * predecessor b's current successor, which means that
- * we don't have a consistent 3-node snapshot and so cannot
- * unlink any subsequent deleted nodes encountered.
- *
- * (2) n's value field is null, indicating n is deleted, in
- * which case we help out an ongoing structural deletion
- * before retrying. Even though there are cases where such
- * unlinking doesn't require restart, they aren't sorted out
- * here because doing so would not usually outweigh cost of
- * restarting.
- *
- * (3) n is a marker or n's predecessor's value field is null,
- * indicating (among other possibilities) that
- * findPredecessor returned a deleted node. We can't unlink
- * the node because we don't know its predecessor, so rely
- * on another call to findPredecessor to notice and return
- * some earlier predecessor, which it will do. This check is
- * only strictly needed at beginning of loop, (and the
- * b.value check isn't strictly needed at all) but is done
- * each iteration to help avoid contention with other
- * threads by callers that will fail to be able to change
- * links, and so will retry anyway.
- *
- * The traversal loops in doPut, doRemove, and findNear all
- * include the same three kinds of checks. And specialized
- * versions appear in findFirst, and findLast and their variants.
- * They can't easily share code because each uses the reads of
- * fields held in locals occurring in the orders they were
- * performed.
+ * encountered. Restarts occur, at traversal step encountering
+ * node n, if n's key field is null, indicating it is a marker, so
+ * its predecessor is deleted before continuing, which we help do
+ * by re-finding a valid predecessor. The traversal loops in
+ * doPut, doRemove, and findNear all include the same checks.
*
* @param key the key
* @return node holding key, or null if no such
@@ -732,67 +504,81 @@
if (key == null)
throw new NullPointerException(); // don't postpone errors
Comparator<? super K> cmp = comparator;
- outer: for (;;) {
- for (Node<K,V> b = findPredecessor(key, cmp), n = b.next;;) {
- Object v; int c;
- if (n == null)
+ Node<K,V> b;
+ outer: while ((b = findPredecessor(key, cmp)) != null) {
+ for (;;) {
+ Node<K,V> n; K k; V v; int c;
+ if ((n = b.next) == null)
+ break outer; // empty
+ else if ((k = n.key) == null)
+ break; // b is deleted
+ else if ((v = n.val) == null)
+ unlinkNode(b, n); // n is deleted
+ else if ((c = cpr(cmp, key, k)) > 0)
+ b = n;
+ else if (c == 0)
+ return n;
+ else
break outer;
- Node<K,V> f = n.next;
- if (n != b.next) // inconsistent read
- break;
- if ((v = n.value) == null) { // n is deleted
- n.helpDelete(b, f);
- break;
- }
- if (b.value == null || v == n) // b is deleted
- break;
- if ((c = cpr(cmp, key, n.key)) == 0)
- return n;
- if (c < 0)
- break outer;
- b = n;
- n = f;
}
}
return null;
}
/**
- * Gets value for key. Almost the same as findNode, but returns
- * the found value (to avoid retries during re-reads)
+ * Gets value for key. Same idea as findNode, except skips over
+ * deletions and markers, and returns first encountered value to
+ * avoid possibly inconsistent rereads.
*
* @param key the key
* @return the value, or null if absent
*/
private V doGet(Object key) {
+ Index<K,V> q;
+ VarHandle.acquireFence();
if (key == null)
throw new NullPointerException();
Comparator<? super K> cmp = comparator;
- outer: for (;;) {
- for (Node<K,V> b = findPredecessor(key, cmp), n = b.next;;) {
- Object v; int c;
- if (n == null)
- break outer;
- Node<K,V> f = n.next;
- if (n != b.next) // inconsistent read
- break;
- if ((v = n.value) == null) { // n is deleted
- n.helpDelete(b, f);
+ V result = null;
+ if ((q = head) != null) {
+ outer: for (Index<K,V> r, d;;) {
+ while ((r = q.right) != null) {
+ Node<K,V> p; K k; V v; int c;
+ if ((p = r.node) == null || (k = p.key) == null ||
+ (v = p.val) == null)
+ RIGHT.compareAndSet(q, r, r.right);
+ else if ((c = cpr(cmp, key, k)) > 0)
+ q = r;
+ else if (c == 0) {
+ result = v;
+ break outer;
+ }
+ else
+ break;
+ }
+ if ((d = q.down) != null)
+ q = d;
+ else {
+ Node<K,V> b, n;
+ if ((b = q.node) != null) {
+ while ((n = b.next) != null) {
+ V v; int c;
+ K k = n.key;
+ if ((v = n.val) == null || k == null ||
+ (c = cpr(cmp, key, k)) > 0)
+ b = n;
+ else {
+ if (c == 0)
+ result = v;
+ break;
+ }
+ }
+ }
break;
}
- if (b.value == null || v == n) // b is deleted
- break;
- if ((c = cpr(cmp, key, n.key)) == 0) {
- @SuppressWarnings("unchecked") V vv = (V)v;
- return vv;
- }
- if (c < 0)
- break outer;
- b = n;
- n = f;
}
}
- return null;
+ return result;
}
/* ---------------- Insertion -------------- */
@@ -800,129 +586,160 @@
/**
* Main insertion method. Adds element if not present, or
* replaces value if present and onlyIfAbsent is false.
+ *
* @param key the key
* @param value the value that must be associated with key
* @param onlyIfAbsent if should not insert if already present
* @return the old value, or null if newly inserted
*/
private V doPut(K key, V value, boolean onlyIfAbsent) {
- Node<K,V> z; // added node
if (key == null)
throw new NullPointerException();
Comparator<? super K> cmp = comparator;
- outer: for (;;) {
- for (Node<K,V> b = findPredecessor(key, cmp), n = b.next;;) {
- if (n != null) {
- Object v; int c;
- Node<K,V> f = n.next;
- if (n != b.next) // inconsistent read
- break;
- if ((v = n.value) == null) { // n is deleted
- n.helpDelete(b, f);
- break;
- }
- if (b.value == null || v == n) // b is deleted
- break;
- if ((c = cpr(cmp, key, n.key)) > 0) {
- b = n;
- n = f;
- continue;
- }
- if (c == 0) {
- if (onlyIfAbsent || n.casValue(v, value)) {
- @SuppressWarnings("unchecked") V vv = (V)v;
- return vv;
- }
- break; // restart if lost race to replace value
+ for (;;) {
+ Index<K,V> h; Node<K,V> b;
+ VarHandle.acquireFence();
+ int levels = 0; // number of levels descended
+ if ((h = head) == null) { // try to initialize
+ Node<K,V> base = new Node<K,V>(null, null, null);
+ h = new Index<K,V>(base, null, null);
+ b = (HEAD.compareAndSet(this, null, h)) ? base : null;
+ }
+ else {
+ for (Index<K,V> q = h, r, d;;) { // count while descending
+ while ((r = q.right) != null) {
+ Node<K,V> p; K k;
+ if ((p = r.node) == null || (k = p.key) == null ||
+ p.val == null)
+ RIGHT.compareAndSet(q, r, r.right);
+ else if (cpr(cmp, key, k) > 0)
+ q = r;
+ else
+ break;
}
- // else c < 0; fall through
- } else if (b == head.node) {
- // map is empty, so type check key now
- cpr(cmp, key, key);
- }
-
- z = new Node<K,V>(key, value, n);
- if (!b.casNext(n, z))
- break; // restart if lost race to append to b
- break outer;
- }
- }
-
- int rnd = ThreadLocalRandom.nextSecondarySeed();
- if ((rnd & 0x80000001) == 0) { // test highest and lowest bits
- int level = 1, max;
- while (((rnd >>>= 1) & 1) != 0)
- ++level;
- Index<K,V> idx = null;
- HeadIndex<K,V> h = head;
- if (level <= (max = h.level)) {
- for (int i = 1; i <= level; ++i)
- idx = new Index<K,V>(z, idx, null);
- }
- else { // try to grow by one level
- level = max + 1; // hold in array and later pick the one to use
- @SuppressWarnings("unchecked")Index<K,V>[] idxs =
- (Index<K,V>[])new Index<?,?>[level+1];
- for (int i = 1; i <= level; ++i)
- idxs[i] = idx = new Index<K,V>(z, idx, null);
- for (;;) {
- h = head;
- int oldLevel = h.level;
- if (level <= oldLevel) // lost race to add level
- break;
- HeadIndex<K,V> newh = h;
- Node<K,V> oldbase = h.node;
- for (int j = oldLevel+1; j <= level; ++j)
- newh = new HeadIndex<K,V>(oldbase, newh, idxs[j], j);
- if (casHead(h, newh)) {
- h = newh;
- idx = idxs[level = oldLevel];
+ if ((d = q.down) != null) {
+ ++levels;
+ q = d;
+ }
+ else {
+ b = q.node;
break;
}
}
}
- // find insertion points and splice in
- splice: for (int insertionLevel = level;;) {
- int j = h.level;
- for (Index<K,V> q = h, r = q.right, t = idx;;) {
- if (q == null || t == null)
- break splice;
- if (r != null) {
- Node<K,V> n = r.node;
- // compare before deletion check avoids needing recheck
- int c = cpr(cmp, key, n.key);
- if (n.value == null) {
- if (!q.unlink(r))
+ if (b != null) {
+ Node<K,V> z = null; // new node, if inserted
+ for (;;) { // find insertion point
+ Node<K,V> n, p; K k; V v; int c;
+ if ((n = b.next) == null) {
+ if (b.key == null) // if empty, type check key now
+ cpr(cmp, key, key);
+ c = -1;
+ }
+ else if ((k = n.key) == null)
+ break; // can't append; restart
+ else if ((v = n.val) == null) {
+ unlinkNode(b, n);
+ c = 1;
+ }
+ else if ((c = cpr(cmp, key, k)) > 0)
+ b = n;
+ else if (c == 0 &&
+ (onlyIfAbsent || VAL.compareAndSet(n, v, value)))
+ return v;
+
+ if (c < 0 &&
+ NEXT.compareAndSet(b, n,
+ p = new Node<K,V>(key, value, n))) {
+ z = p;
+ break;
+ }
+ }
+
+ if (z != null) {
+ int lr = ThreadLocalRandom.nextSecondarySeed();
+ if ((lr & 0x3) == 0) { // add indices with 1/4 prob
+ int hr = ThreadLocalRandom.nextSecondarySeed();
+ long rnd = ((long)hr << 32) | ((long)lr & 0xffffffffL);
+ int skips = levels; // levels to descend before add
+ Index<K,V> x = null;
+ for (;;) { // create at most 62 indices
+ x = new Index<K,V>(z, x, null);
+ if (rnd >= 0L || --skips < 0)
break;
- r = q.right;
- continue;
+ else
+ rnd <<= 1;
}
- if (c > 0) {
- q = r;
- r = r.right;
- continue;
+ if (addIndices(h, skips, x, cmp) && skips < 0 &&
+ head == h) { // try to add new level
+ Index<K,V> hx = new Index<K,V>(z, x, null);
+ Index<K,V> nh = new Index<K,V>(h.node, h, hx);
+ HEAD.compareAndSet(this, h, nh);
}
+ if (z.val == null) // deleted while adding indices
+ findPredecessor(key, cmp); // clean
}
-
- if (j == insertionLevel) {
- if (!q.link(r, t))
- break; // restart
- if (t.node.value == null) {
- findNode(key);
- break splice;
- }
- if (--insertionLevel == 0)
- break splice;
- }
-
- if (--j >= insertionLevel && j < level)
- t = t.down;
- q = q.down;
- r = q.right;
+ addCount(1L);
+ return null;
}
}
}
- return null;
+ }
+
+ /**
+ * Add indices after an insertion. Descends iteratively to the
+ * highest level of insertion, then recursively, to chain index
+ * nodes to lower ones. Returns null on (staleness) failure,
+ * disabling higher-level insertions. Recursion depths are
+ * exponentially less probable.
+ *
+ * @param q starting index for current level
+ * @param skips levels to skip before inserting
+ * @param x index for this insertion
+ * @param cmp comparator
+ */
+ static <K,V> boolean addIndices(Index<K,V> q, int skips, Index<K,V> x,
+ Comparator<? super K> cmp) {
+ Node<K,V> z; K key;
+ if (x != null && (z = x.node) != null && (key = z.key) != null &&
+ q != null) { // hoist checks
+ boolean retrying = false;
+ for (;;) { // find splice point
+ Index<K,V> r, d; int c;
+ if ((r = q.right) != null) {
+ Node<K,V> p; K k;
+ if ((p = r.node) == null || (k = p.key) == null ||
+ p.val == null) {
+ RIGHT.compareAndSet(q, r, r.right);
+ c = 0;
+ }
+ else if ((c = cpr(cmp, key, k)) > 0)
+ q = r;
+ else if (c == 0)
+ break; // stale
+ }
+ else
+ c = -1;
+
+ if (c < 0) {
+ if ((d = q.down) != null && skips > 0) {
+ --skips;
+ q = d;
+ }
+ else if (d != null && !retrying &&
+ !addIndices(d, 0, x.down, cmp))
+ break;
+ else {
+ x.right = r;
+ if (RIGHT.compareAndSet(q, r, x))
+ return true;
+ else
+ retrying = true; // re-find splice point
+ }
+ }
+ }
+ }
+ return false;
}
/* ---------------- Deletion -------------- */
@@ -932,15 +749,6 @@
* deletion marker, unlinks predecessor, removes associated index
* nodes, and possibly reduces head index level.
*
- * Index nodes are cleared out simply by calling findPredecessor.
- * which unlinks indexes to deleted nodes found along path to key,
- * which will include the indexes to this node. This is done
- * unconditionally. We can't check beforehand whether there are
- * index nodes because it might be the case that some or all
- * indexes hadn't been inserted yet for this node during initial
- * search for it, and we'd like to ensure lack of garbage
- * retention, so must call to be sure.
- *
* @param key the key
* @param value if non-null, the value that must be
* associated with key
@@ -950,43 +758,36 @@
if (key == null)
throw new NullPointerException();
Comparator<? super K> cmp = comparator;
- outer: for (;;) {
- for (Node<K,V> b = findPredecessor(key, cmp), n = b.next;;) {
- Object v; int c;
- if (n == null)
- break outer;
- Node<K,V> f = n.next;
- if (n != b.next) // inconsistent read
- break;
- if ((v = n.value) == null) { // n is deleted
- n.helpDelete(b, f);
- break;
- }
- if (b.value == null || v == n) // b is deleted
- break;
- if ((c = cpr(cmp, key, n.key)) < 0)
+ V result = null;
+ Node<K,V> b;
+ outer: while ((b = findPredecessor(key, cmp)) != null &&
+ result == null) {
+ for (;;) {
+ Node<K,V> n; K k; V v; int c;
+ if ((n = b.next) == null)
break outer;
- if (c > 0) {
- b = n;
- n = f;
- continue;
- }
- if (value != null && !value.equals(v))
- break outer;
- if (!n.casValue(v, null))
+ else if ((k = n.key) == null)
break;
- if (!n.appendMarker(f) || !b.casNext(n, f))
- findNode(key); // retry via findNode
- else {
- findPredecessor(key, cmp); // clean index
- if (head.right == null)
- tryReduceLevel();
+ else if ((v = n.val) == null)
+ unlinkNode(b, n);
+ else if ((c = cpr(cmp, key, k)) > 0)
+ b = n;
+ else if (c < 0)
+ break outer;
+ else if (value != null && !value.equals(v))
+ break outer;
+ else if (VAL.compareAndSet(n, v, null)) {
+ result = v;
+ unlinkNode(b, n);
+ break; // loop to clean up
}
- @SuppressWarnings("unchecked") V vv = (V)v;
- return vv;
}
}
- return null;
+ if (result != null) {
+ tryReduceLevel();
+ addCount(-1L);
+ }
+ return result;
}
/**
@@ -1010,77 +811,132 @@
* reduction.
*/
private void tryReduceLevel() {
- HeadIndex<K,V> h = head;
- HeadIndex<K,V> d;
- HeadIndex<K,V> e;
- if (h.level > 3 &&
- (d = (HeadIndex<K,V>)h.down) != null &&
- (e = (HeadIndex<K,V>)d.down) != null &&
- e.right == null &&
- d.right == null &&
- h.right == null &&
- casHead(h, d) && // try to set
- h.right != null) // recheck
- casHead(d, h); // try to backout
+ Index<K,V> h, d, e;
+ if ((h = head) != null && h.right == null &&
+ (d = h.down) != null && d.right == null &&
+ (e = d.down) != null && e.right == null &&
+ HEAD.compareAndSet(this, h, d) &&
+ h.right != null) // recheck
+ HEAD.compareAndSet(this, d, h); // try to backout
}
/* ---------------- Finding and removing first element -------------- */
/**
- * Specialized variant of findNode to get first valid node.
+ * Gets first valid node, unlinking deleted nodes if encountered.
* @return first node or null if empty
*/
final Node<K,V> findFirst() {
- for (Node<K,V> b, n;;) {
- if ((n = (b = head.node).next) == null)
- return null;
- if (n.value != null)
- return n;
- n.helpDelete(b, n.next);
+ Node<K,V> b, n;
+ if ((b = baseHead()) != null) {
+ while ((n = b.next) != null) {
+ if (n.val == null)
+ unlinkNode(b, n);
+ else
+ return n;
+ }
}
+ return null;
+ }
+
+ /**
+ * Entry snapshot version of findFirst
+ */
+ final AbstractMap.SimpleImmutableEntry<K,V> findFirstEntry() {
+ Node<K,V> b, n; V v;
+ if ((b = baseHead()) != null) {
+ while ((n = b.next) != null) {
+ if ((v = n.val) == null)
+ unlinkNode(b, n);
+ else
+ return new AbstractMap.SimpleImmutableEntry<K,V>(n.key, v);
+ }
+ }
+ return null;
}
/**
* Removes first entry; returns its snapshot.
* @return null if empty, else snapshot of first entry
*/
- private Map.Entry<K,V> doRemoveFirstEntry() {
- for (Node<K,V> b, n;;) {
- if ((n = (b = head.node).next) == null)
- return null;
- Node<K,V> f = n.next;
- if (n != b.next)
- continue;
- Object v = n.value;
- if (v == null) {
- n.helpDelete(b, f);
- continue;
+ private AbstractMap.SimpleImmutableEntry<K,V> doRemoveFirstEntry() {
+ Node<K,V> b, n; V v;
+ if ((b = baseHead()) != null) {
+ while ((n = b.next) != null) {
+ if ((v = n.val) == null || VAL.compareAndSet(n, v, null)) {
+ K k = n.key;
+ unlinkNode(b, n);
+ if (v != null) {
+ tryReduceLevel();
+ findPredecessor(k, comparator); // clean index
+ addCount(-1L);
+ return new AbstractMap.SimpleImmutableEntry<K,V>(k, v);
+ }
+ }
}
- if (!n.casValue(v, null))
- continue;
- if (!n.appendMarker(f) || !b.casNext(n, f))
- findFirst(); // retry
- clearIndexToFirst();
- @SuppressWarnings("unchecked") V vv = (V)v;
- return new AbstractMap.SimpleImmutableEntry<K,V>(n.key, vv);
}
+ return null;
+ }
+
+ /* ---------------- Finding and removing last element -------------- */
+
+ /**
+ * Specialized version of find to get last valid node.
+ * @return last node or null if empty
+ */
+ final Node<K,V> findLast() {
+ outer: for (;;) {
+ Index<K,V> q; Node<K,V> b;
+ VarHandle.acquireFence();
+ if ((q = head) == null)
+ break;
+ for (Index<K,V> r, d;;) {
+ while ((r = q.right) != null) {
+ Node<K,V> p;
+ if ((p = r.node) == null || p.val == null)
+ RIGHT.compareAndSet(q, r, r.right);
+ else
+ q = r;
+ }
+ if ((d = q.down) != null)
+ q = d;
+ else {
+ b = q.node;
+ break;
+ }
+ }
+ if (b != null) {
+ for (;;) {
+ Node<K,V> n;
+ if ((n = b.next) == null) {
+ if (b.key == null) // empty
+ break outer;
+ else
+ return b;
+ }
+ else if (n.key == null)
+ break;
+ else if (n.val == null)
+ unlinkNode(b, n);
+ else
+ b = n;
+ }
+ }
+ }
+ return null;
}
/**
- * Clears out index nodes associated with deleted first entry.
+ * Entry version of findLast
+ * @return Entry for last node or null if empty
*/
- private void clearIndexToFirst() {
+ final AbstractMap.SimpleImmutableEntry<K,V> findLastEntry() {
for (;;) {
- for (Index<K,V> q = head;;) {
- Index<K,V> r = q.right;
- if (r != null && r.indexesDeletedNode() && !q.unlink(r))
- break;
- if ((q = q.down) == null) {
- if (head.right == null)
- tryReduceLevel();
- return;
- }
- }
+ Node<K,V> n; V v;
+ if ((n = findLast()) == null)
+ return null;
+ if ((v = n.val) != null)
+ return new AbstractMap.SimpleImmutableEntry<K,V>(n.key, v);
}
}
@@ -1090,121 +946,54 @@
* @return null if empty, else snapshot of last entry
*/
private Map.Entry<K,V> doRemoveLastEntry() {
- for (;;) {
- Node<K,V> b = findPredecessorOfLast();
- Node<K,V> n = b.next;
- if (n == null) {
- if (b.isBaseHeader()) // empty
- return null;
- else
- continue; // all b's successors are deleted; retry
- }
+ outer: for (;;) {
+ Index<K,V> q; Node<K,V> b;
+ VarHandle.acquireFence();
+ if ((q = head) == null)
+ break;
for (;;) {
- Node<K,V> f = n.next;
- if (n != b.next) // inconsistent read
- break;
- Object v = n.value;
- if (v == null) { // n is deleted
- n.helpDelete(b, f);
- break;
- }
- if (b.value == null || v == n) // b is deleted
- break;
- if (f != null) {
- b = n;
- n = f;
- continue;
- }
- if (!n.casValue(v, null))
- break;
- K key = n.key;
- if (!n.appendMarker(f) || !b.casNext(n, f))
- findNode(key); // retry via findNode
- else { // clean index
- findPredecessor(key, comparator);
- if (head.right == null)
- tryReduceLevel();
- }
- @SuppressWarnings("unchecked") V vv = (V)v;
- return new AbstractMap.SimpleImmutableEntry<K,V>(key, vv);
- }
- }
- }
-
- /* ---------------- Finding and removing last element -------------- */
-
- /**
- * Specialized version of find to get last valid node.
- * @return last node or null if empty
- */
- final Node<K,V> findLast() {
- /*
- * findPredecessor can't be used to traverse index level
- * because this doesn't use comparisons. So traversals of
- * both levels are folded together.
- */
- Index<K,V> q = head;
- for (;;) {
- Index<K,V> d, r;
- if ((r = q.right) != null) {
- if (r.indexesDeletedNode()) {
- q.unlink(r);
- q = head; // restart
- }
- else
- q = r;
- } else if ((d = q.down) != null) {
- q = d;
- } else {
- for (Node<K,V> b = q.node, n = b.next;;) {
- if (n == null)
- return b.isBaseHeader() ? null : b;
- Node<K,V> f = n.next; // inconsistent read
- if (n != b.next)
+ Index<K,V> d, r; Node<K,V> p;
+ while ((r = q.right) != null) {
+ if ((p = r.node) == null || p.val == null)
+ RIGHT.compareAndSet(q, r, r.right);
+ else if (p.next != null)
+ q = r; // continue only if a successor
+ else
break;
- Object v = n.value;
- if (v == null) { // n is deleted
- n.helpDelete(b, f);
- break;
- }
- if (b.value == null || v == n) // b is deleted
- break;
- b = n;
- n = f;
- }
- q = head; // restart
- }
- }
- }
-
- /**
- * Specialized variant of findPredecessor to get predecessor of last
- * valid node. Needed when removing the last entry. It is possible
- * that all successors of returned node will have been deleted upon
- * return, in which case this method can be retried.
- * @return likely predecessor of last node
- */
- private Node<K,V> findPredecessorOfLast() {
- for (;;) {
- for (Index<K,V> q = head;;) {
- Index<K,V> d, r;
- if ((r = q.right) != null) {
- if (r.indexesDeletedNode()) {
- q.unlink(r);
- break; // must restart
- }
- // proceed as far across as possible without overshooting
- if (r.node.next != null) {
- q = r;
- continue;
- }
}
if ((d = q.down) != null)
q = d;
- else
- return q.node;
+ else {
+ b = q.node;
+ break;
+ }
+ }
+ if (b != null) {
+ for (;;) {
+ Node<K,V> n; K k; V v;
+ if ((n = b.next) == null) {
+ if (b.key == null) // empty
+ break outer;
+ else
+ break; // retry
+ }
+ else if ((k = n.key) == null)
+ break;
+ else if ((v = n.val) == null)
+ unlinkNode(b, n);
+ else if (n.next != null)
+ b = n;
+ else if (VAL.compareAndSet(n, v, null)) {
+ unlinkNode(b, n);
+ tryReduceLevel();
+ findPredecessor(k, comparator); // clean index
+ addCount(-1L);
+ return new AbstractMap.SimpleImmutableEntry<K,V>(k, v);
+ }
+ }
}
}
+ return null;
}
/* ---------------- Relational operations -------------- */
@@ -1224,47 +1013,52 @@
final Node<K,V> findNear(K key, int rel, Comparator<? super K> cmp) {
if (key == null)
throw new NullPointerException();
- for (;;) {
- for (Node<K,V> b = findPredecessor(key, cmp), n = b.next;;) {
- Object v;
- if (n == null)
- return ((rel & LT) == 0 || b.isBaseHeader()) ? null : b;
- Node<K,V> f = n.next;
- if (n != b.next) // inconsistent read
- break;
- if ((v = n.value) == null) { // n is deleted
- n.helpDelete(b, f);
+ Node<K,V> result;
+ outer: for (Node<K,V> b;;) {
+ if ((b = findPredecessor(key, cmp)) == null) {
+ result = null;
+ break; // empty
+ }
+ for (;;) {
+ Node<K,V> n; K k; int c;
+ if ((n = b.next) == null) {
+ result = ((rel & LT) != 0 && b.key != null) ? b : null;
+ break outer;
+ }
+ else if ((k = n.key) == null)
break;
+ else if (n.val == null)
+ unlinkNode(b, n);
+ else if (((c = cpr(cmp, key, k)) == 0 && (rel & EQ) != 0) ||
+ (c < 0 && (rel & LT) == 0)) {
+ result = n;
+ break outer;
}
- if (b.value == null || v == n) // b is deleted
- break;
- int c = cpr(cmp, key, n.key);
- if ((c == 0 && (rel & EQ) != 0) ||
- (c < 0 && (rel & LT) == 0))
- return n;
- if ( c <= 0 && (rel & LT) != 0)
- return b.isBaseHeader() ? null : b;
- b = n;
- n = f;
+ else if (c <= 0 && (rel & LT) != 0) {
+ result = (b.key != null) ? b : null;
+ break outer;
+ }
+ else
+ b = n;
}
}
+ return result;
}
/**
- * Returns SimpleImmutableEntry for results of findNear.
+ * Variant of findNear returning SimpleImmutableEntry
* @param key the key
* @param rel the relation -- OR'ed combination of EQ, LT, GT
* @return Entry fitting relation, or null if no such
*/
- final AbstractMap.SimpleImmutableEntry<K,V> getNear(K key, int rel) {
- Comparator<? super K> cmp = comparator;
+ final AbstractMap.SimpleImmutableEntry<K,V> findNearEntry(K key, int rel,
+ Comparator<? super K> cmp) {
for (;;) {
- Node<K,V> n = findNear(key, rel, cmp);
- if (n == null)
+ Node<K,V> n; V v;
+ if ((n = findNear(key, rel, cmp)) == null)
return null;
- AbstractMap.SimpleImmutableEntry<K,V> e = n.createSnapshot();
- if (e != null)
- return e;
+ if ((v = n.val) != null)
+ return new AbstractMap.SimpleImmutableEntry<K,V>(n.key, v);
}
}
@@ -1276,7 +1070,6 @@
*/
public ConcurrentSkipListMap() {
this.comparator = null;
- initialize();
}
/**
@@ -1289,7 +1082,6 @@
*/
public ConcurrentSkipListMap(Comparator<? super K> comparator) {
this.comparator = comparator;
- initialize();
}
/**
@@ -1305,7 +1097,6 @@
*/
public ConcurrentSkipListMap(Map<? extends K, ? extends V> m) {
this.comparator = null;
- initialize();
putAll(m);
}
@@ -1320,8 +1111,7 @@
*/
public ConcurrentSkipListMap(SortedMap<K, ? extends V> m) {
this.comparator = m.comparator();
- initialize();
- buildFromSorted(m);
+ buildFromSorted(m); // initializes transients
}
/**
@@ -1335,7 +1125,10 @@
@SuppressWarnings("unchecked")
ConcurrentSkipListMap<K,V> clone =
(ConcurrentSkipListMap<K,V>) super.clone();
- clone.initialize();
+ clone.keySet = null;
+ clone.entrySet = null;
+ clone.values = null;
+ clone.descendingMap = null;
clone.buildFromSorted(this);
return clone;
} catch (CloneNotSupportedException e) {
@@ -1351,58 +1144,49 @@
private void buildFromSorted(SortedMap<K, ? extends V> map) {
if (map == null)
throw new NullPointerException();
-
- HeadIndex<K,V> h = head;
- Node<K,V> basepred = h.node;
-
- // Track the current rightmost node at each level. Uses an
- // ArrayList to avoid committing to initial or maximum level.
- ArrayList<Index<K,V>> preds = new ArrayList<>();
-
- // initialize
- for (int i = 0; i <= h.level; ++i)
- preds.add(null);
- Index<K,V> q = h;
- for (int i = h.level; i > 0; --i) {
- preds.set(i, q);
- q = q.down;
- }
-
Iterator<? extends Map.Entry<? extends K, ? extends V>> it =
map.entrySet().iterator();
+
+ /*
+ * Add equally spaced indices at log intervals, using the bits
+ * of count during insertion. The maximum possible resulting
+ * level is less than the number of bits in a long (64). The
+ * preds array tracks the current rightmost node at each
+ * level.
+ */
+ @SuppressWarnings("unchecked")
+ Index<K,V>[] preds = (Index<K,V>[])new Index<?,?>[64];
+ Node<K,V> bp = new Node<K,V>(null, null, null);
+ Index<K,V> h = preds[0] = new Index<K,V>(bp, null, null);
+ long count = 0;
+
while (it.hasNext()) {
Map.Entry<? extends K, ? extends V> e = it.next();
- int rnd = ThreadLocalRandom.current().nextInt();
- int j = 0;
- if ((rnd & 0x80000001) == 0) {
- do {
- ++j;
- } while (((rnd >>>= 1) & 1) != 0);
- if (j > h.level) j = h.level + 1;
- }
K k = e.getKey();
V v = e.getValue();
if (k == null || v == null)
throw new NullPointerException();
Node<K,V> z = new Node<K,V>(k, v, null);
- basepred.next = z;
- basepred = z;
- if (j > 0) {
- Index<K,V> idx = null;
- for (int i = 1; i <= j; ++i) {
+ bp = bp.next = z;
+ if ((++count & 3L) == 0L) {
+ long m = count >>> 2;
+ int i = 0;
+ Index<K,V> idx = null, q;
+ do {
idx = new Index<K,V>(z, idx, null);
- if (i > h.level)
- h = new HeadIndex<K,V>(h.node, h, idx, i);
-
- if (i < preds.size()) {
- preds.get(i).right = idx;
- preds.set(i, idx);
- } else
- preds.add(idx);
- }
+ if ((q = preds[i]) == null)
+ preds[i] = h = new Index<K,V>(h.node, h, idx);
+ else
+ preds[i] = q.right = idx;
+ } while (++i < preds.length && ((m >>>= 1) & 1L) != 0L);
}
}
- head = h;
+ if (count != 0L) {
+ VarHandle.releaseFence(); // emulate volatile stores
+ addCount(count);
+ head = h;
+ VarHandle.fullFence();
+ }
}
/* ---------------- Serialization -------------- */
@@ -1424,11 +1208,14 @@
s.defaultWriteObject();
// Write out keys and values (alternating)
- for (Node<K,V> n = findFirst(); n != null; n = n.next) {
- V v = n.getValidValue();
- if (v != null) {
- s.writeObject(n.key);
- s.writeObject(v);
+ Node<K,V> b, n; V v;
+ if ((b = baseHead()) != null) {
+ while ((n = b.next) != null) {
+ if ((v = n.val) != null) {
+ s.writeObject(n.key);
+ s.writeObject(v);
+ }
+ b = n;
}
}
s.writeObject(null);
@@ -1446,64 +1233,47 @@
throws java.io.IOException, ClassNotFoundException {
// Read in the Comparator and any hidden stuff
s.defaultReadObject();
- // Reset transients
- initialize();
- /*
- * This is nearly identical to buildFromSorted, but is
- * distinct because readObject calls can't be nicely adapted
- * as the kind of iterator needed by buildFromSorted. (They
- * can be, but doing so requires type cheats and/or creation
- * of adapter classes.) It is simpler to just adapt the code.
- */
-
- HeadIndex<K,V> h = head;
- Node<K,V> basepred = h.node;
- ArrayList<Index<K,V>> preds = new ArrayList<>();
- for (int i = 0; i <= h.level; ++i)
- preds.add(null);
- Index<K,V> q = h;
- for (int i = h.level; i > 0; --i) {
- preds.set(i, q);
- q = q.down;
- }
+ // Same idea as buildFromSorted
+ @SuppressWarnings("unchecked")
+ Index<K,V>[] preds = (Index<K,V>[])new Index<?,?>[64];
+ Node<K,V> bp = new Node<K,V>(null, null, null);
+ Index<K,V> h = preds[0] = new Index<K,V>(bp, null, null);
+ Comparator<? super K> cmp = comparator;
+ K prevKey = null;
+ long count = 0;
for (;;) {
- Object k = s.readObject();
+ K k = (K)s.readObject();
if (k == null)
break;
- Object v = s.readObject();
+ V v = (V)s.readObject();
if (v == null)
throw new NullPointerException();
- K key = (K) k;
- V val = (V) v;
- int rnd = ThreadLocalRandom.current().nextInt();
- int j = 0;
- if ((rnd & 0x80000001) == 0) {
+ if (prevKey != null && cpr(cmp, prevKey, k) > 0)
+ throw new IllegalStateException("out of order");
+ prevKey = k;
+ Node<K,V> z = new Node<K,V>(k, v, null);
+ bp = bp.next = z;
+ if ((++count & 3L) == 0L) {
+ long m = count >>> 2;
+ int i = 0;
+ Index<K,V> idx = null, q;
do {
- ++j;
- } while (((rnd >>>= 1) & 1) != 0);
- if (j > h.level) j = h.level + 1;
- }
- Node<K,V> z = new Node<K,V>(key, val, null);
- basepred.next = z;
- basepred = z;
- if (j > 0) {
- Index<K,V> idx = null;
- for (int i = 1; i <= j; ++i) {
idx = new Index<K,V>(z, idx, null);
- if (i > h.level)
- h = new HeadIndex<K,V>(h.node, h, idx, i);
-
- if (i < preds.size()) {
- preds.get(i).right = idx;
- preds.set(i, idx);
- } else
- preds.add(idx);
- }
+ if ((q = preds[i]) == null)
+ preds[i] = h = new Index<K,V>(h.node, h, idx);
+ else
+ preds[i] = q.right = idx;
+ } while (++i < preds.length && ((m >>>= 1) & 1L) != 0L);
}
}
- head = h;
+ if (count != 0L) {
+ VarHandle.releaseFence();
+ addCount(count);
+ head = h;
+ VarHandle.fullFence();
+ }
}
/* ------ Map API methods ------ */
@@ -1604,42 +1374,30 @@
public boolean containsValue(Object value) {
if (value == null)
throw new NullPointerException();
- for (Node<K,V> n = findFirst(); n != null; n = n.next) {
- V v = n.getValidValue();
- if (v != null && value.equals(v))
- return true;
+ Node<K,V> b, n; V v;
+ if ((b = baseHead()) != null) {
+ while ((n = b.next) != null) {
+ if ((v = n.val) != null && value.equals(v))
+ return true;
+ else
+ b = n;
+ }
}
return false;
}
/**
- * Returns the number of key-value mappings in this map. If this map
- * contains more than {@code Integer.MAX_VALUE} elements, it
- * returns {@code Integer.MAX_VALUE}.
- *
- * <p>Beware that, unlike in most collections, this method is
- * <em>NOT</em> a constant-time operation. Because of the
- * asynchronous nature of these maps, determining the current
- * number of elements requires traversing them all to count them.
- * Additionally, it is possible for the size to change during
- * execution of this method, in which case the returned result
- * will be inaccurate. Thus, this method is typically not very
- * useful in concurrent applications.
- *
- * @return the number of elements in this map
+ * {@inheritDoc}
*/
public int size() {
- long count = 0;
- for (Node<K,V> n = findFirst(); n != null; n = n.next) {
- if (n.getValidValue() != null)
- ++count;
- }
- return (count >= Integer.MAX_VALUE) ? Integer.MAX_VALUE : (int) count;
+ long c;
+ return ((baseHead() == null) ? 0 :
+ ((c = getAdderCount()) >= Integer.MAX_VALUE) ?
+ Integer.MAX_VALUE : (int) c);
}
/**
- * Returns {@code true} if this map contains no key-value mappings.
- * @return {@code true} if this map contains no key-value mappings
+ * {@inheritDoc}
*/
public boolean isEmpty() {
return findFirst() == null;
@@ -1649,23 +1407,32 @@
* Removes all of the mappings from this map.
*/
public void clear() {
- for (;;) {
- Node<K,V> b, n;
- HeadIndex<K,V> h = head, d = (HeadIndex<K,V>)h.down;
- if (d != null)
- casHead(h, d); // remove levels
- else if ((b = h.node) != null && (n = b.next) != null) {
- Node<K,V> f = n.next; // remove values
- if (n == b.next) {
- Object v = n.value;
- if (v == null)
- n.helpDelete(b, f);
- else if (n.casValue(v, null) && n.appendMarker(f))
- b.casNext(n, f);
+ Index<K,V> h, r, d; Node<K,V> b;
+ VarHandle.acquireFence();
+ while ((h = head) != null) {
+ if ((r = h.right) != null) // remove indices
+ RIGHT.compareAndSet(h, r, null);
+ else if ((d = h.down) != null) // remove levels
+ HEAD.compareAndSet(this, h, d);
+ else {
+ long count = 0L;
+ if ((b = h.node) != null) { // remove nodes
+ Node<K,V> n; V v;
+ while ((n = b.next) != null) {
+ if ((v = n.val) != null &&
+ VAL.compareAndSet(n, v, null)) {
+ --count;
+ v = null;
+ }
+ if (v == null)
+ unlinkNode(b, n);
+ }
}
+ if (count != 0L)
+ addCount(count);
+ else
+ break;
}
- else
- break;
}
}
@@ -1712,16 +1479,15 @@
BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
if (key == null || remappingFunction == null)
throw new NullPointerException();
- Node<K,V> n; Object v;
+ Node<K,V> n; V v;
while ((n = findNode(key)) != null) {
- if ((v = n.value) != null) {
- @SuppressWarnings("unchecked") V vv = (V) v;
- V r = remappingFunction.apply(key, vv);
+ if ((v = n.val) != null) {
+ V r = remappingFunction.apply(key, v);
if (r != null) {
- if (n.casValue(vv, r))
+ if (VAL.compareAndSet(n, v, r))
return r;
}
- else if (doRemove(key, vv) != null)
+ else if (doRemove(key, v) != null)
break;
}
}
@@ -1746,20 +1512,19 @@
if (key == null || remappingFunction == null)
throw new NullPointerException();
for (;;) {
- Node<K,V> n; Object v; V r;
+ Node<K,V> n; V v; V r;
if ((n = findNode(key)) == null) {
if ((r = remappingFunction.apply(key, null)) == null)
break;
if (doPut(key, r, true) == null)
return r;
}
- else if ((v = n.value) != null) {
- @SuppressWarnings("unchecked") V vv = (V) v;
- if ((r = remappingFunction.apply(key, vv)) != null) {
- if (n.casValue(vv, r))
+ else if ((v = n.val) != null) {
+ if ((r = remappingFunction.apply(key, v)) != null) {
+ if (VAL.compareAndSet(n, v, r))
return r;
}
- else if (doRemove(key, vv) != null)
+ else if (doRemove(key, v) != null)
break;
}
}
@@ -1786,18 +1551,17 @@
if (key == null || value == null || remappingFunction == null)
throw new NullPointerException();
for (;;) {
- Node<K,V> n; Object v; V r;
+ Node<K,V> n; V v; V r;
if ((n = findNode(key)) == null) {
if (doPut(key, value, true) == null)
return value;
}
- else if ((v = n.value) != null) {
- @SuppressWarnings("unchecked") V vv = (V) v;
- if ((r = remappingFunction.apply(vv, value)) != null) {
- if (n.casValue(vv, r))
+ else if ((v = n.val) != null) {
+ if ((r = remappingFunction.apply(v, value)) != null) {
+ if (VAL.compareAndSet(n, v, r))
return r;
}
- else if (doRemove(key, vv) != null)
+ else if (doRemove(key, v) != null)
return null;
}
}
@@ -1946,16 +1710,60 @@
return false;
Map<?,?> m = (Map<?,?>) o;
try {
- for (Map.Entry<K,V> e : this.entrySet())
- if (! e.getValue().equals(m.get(e.getKey())))
- return false;
- for (Map.Entry<?,?> e : m.entrySet()) {
- Object k = e.getKey();
- Object v = e.getValue();
- if (k == null || v == null || !v.equals(get(k)))
- return false;
+ Comparator<? super K> cmp = comparator;
+ @SuppressWarnings("unchecked")
+ Iterator<Map.Entry<?,?>> it =
+ (Iterator<Map.Entry<?,?>>)m.entrySet().iterator();
+ if (m instanceof SortedMap &&
+ ((SortedMap<?,?>)m).comparator() == cmp) {
+ Node<K,V> b, n;
+ if ((b = baseHead()) != null) {
+ while ((n = b.next) != null) {
+ K k; V v;
+ if ((v = n.val) != null && (k = n.key) != null) {
+ if (!it.hasNext())
+ return false;
+ Map.Entry<?,?> e = it.next();
+ Object mk = e.getKey();
+ Object mv = e.getValue();
+ if (mk == null || mv == null)
+ return false;
+ try {
+ if (cpr(cmp, k, mk) != 0)
+ return false;
+ } catch (ClassCastException cce) {
+ return false;
+ }
+ if (!mv.equals(v))
+ return false;
+ }
+ b = n;
+ }
+ }
+ return !it.hasNext();
}
- return true;
+ else {
+ while (it.hasNext()) {
+ V v;
+ Map.Entry<?,?> e = it.next();
+ Object mk = e.getKey();
+ Object mv = e.getValue();
+ if (mk == null || mv == null ||
+ (v = get(mk)) == null || !v.equals(mv))
+ return false;
+ }
+ Node<K,V> b, n;
+ if ((b = baseHead()) != null) {
+ K k; V v; Object mv;
+ while ((n = b.next) != null) {
+ if ((v = n.val) != null && (k = n.key) != null &&
+ ((mv = m.get(k)) == null || !mv.equals(v)))
+ return false;
+ b = n;
+ }
+ }
+ return true;
+ }
} catch (ClassCastException unused) {
return false;
} catch (NullPointerException unused) {
@@ -2004,13 +1812,13 @@
if (key == null || oldValue == null || newValue == null)
throw new NullPointerException();
for (;;) {
- Node<K,V> n; Object v;
+ Node<K,V> n; V v;
if ((n = findNode(key)) == null)
return false;
- if ((v = n.value) != null) {
+ if ((v = n.val) != null) {
if (!oldValue.equals(v))
return false;
- if (n.casValue(v, newValue))
+ if (VAL.compareAndSet(n, v, newValue))
return true;
}
}
@@ -2029,13 +1837,11 @@
if (key == null || value == null)
throw new NullPointerException();
for (;;) {
- Node<K,V> n; Object v;
+ Node<K,V> n; V v;
if ((n = findNode(key)) == null)
return null;
- if ((v = n.value) != null && n.casValue(v, value)) {
- @SuppressWarnings("unchecked") V vv = (V)v;
- return vv;
- }
+ if ((v = n.val) != null && VAL.compareAndSet(n, v, value))
+ return v;
}
}
@@ -2145,7 +1951,7 @@
* @throws NullPointerException if the specified key is null
*/
public Map.Entry<K,V> lowerEntry(K key) {
- return getNear(key, LT);
+ return findNearEntry(key, LT, comparator);
}
/**
@@ -2168,7 +1974,7 @@
* @throws NullPointerException if the specified key is null
*/
public Map.Entry<K,V> floorEntry(K key) {
- return getNear(key, LT|EQ);
+ return findNearEntry(key, LT|EQ, comparator);
}
/**
@@ -2191,7 +1997,7 @@
* @throws NullPointerException if the specified key is null
*/
public Map.Entry<K,V> ceilingEntry(K key) {
- return getNear(key, GT|EQ);
+ return findNearEntry(key, GT|EQ, comparator);
}
/**
@@ -2214,7 +2020,7 @@
* @throws NullPointerException if the specified key is null
*/
public Map.Entry<K,V> higherEntry(K key) {
- return getNear(key, GT);
+ return findNearEntry(key, GT, comparator);
}
/**
@@ -2234,14 +2040,7 @@
* the {@code Entry.setValue} method.
*/
public Map.Entry<K,V> firstEntry() {
- for (;;) {
- Node<K,V> n = findFirst();
- if (n == null)
- return null;
- AbstractMap.SimpleImmutableEntry<K,V> e = n.createSnapshot();
- if (e != null)
- return e;
- }
+ return findFirstEntry();
}
/**
@@ -2251,14 +2050,7 @@
* the {@code Entry.setValue} method.
*/
public Map.Entry<K,V> lastEntry() {
- for (;;) {
- Node<K,V> n = findLast();
- if (n == null)
- return null;
- AbstractMap.SimpleImmutableEntry<K,V> e = n.createSnapshot();
- if (e != null)
- return e;
- }
+ return findLastEntry();
}
/**
@@ -2281,11 +2073,10 @@
return doRemoveLastEntry();
}
-
/* ---------------- Iterators -------------- */
/**
- * Base of iterator classes:
+ * Base of iterator classes
*/
abstract class Iter<T> implements Iterator<T> {
/** the last node returned by next() */
@@ -2297,14 +2088,7 @@
/** Initializes ascending iterator for entire range. */
Iter() {
- while ((next = findFirst()) != null) {
- Object x = next.value;
- if (x != null && x != next) {
- @SuppressWarnings("unchecked") V vv = (V)x;
- nextValue = vv;
- break;
- }
- }
+ advance(baseHead());
}
public final boolean hasNext() {
@@ -2312,54 +2096,58 @@
}
/** Advances next to higher entry. */
- final void advance() {
- if (next == null)
- throw new NoSuchElementException();
- lastReturned = next;
- while ((next = next.next) != null) {
- Object x = next.value;
- if (x != null && x != next) {
- @SuppressWarnings("unchecked") V vv = (V)x;
- nextValue = vv;
- break;
- }
+ final void advance(Node<K,V> b) {
+ Node<K,V> n = null;
+ V v = null;
+ if ((lastReturned = b) != null) {
+ while ((n = b.next) != null && (v = n.val) == null)
+ b = n;
}
+ nextValue = v;
+ next = n;
}
- public void remove() {
- Node<K,V> l = lastReturned;
- if (l == null)
+ public final void remove() {
+ Node<K,V> n; K k;
+ if ((n = lastReturned) == null || (k = n.key) == null)
throw new IllegalStateException();
// It would not be worth all of the overhead to directly
// unlink from here. Using remove is fast enough.
- ConcurrentSkipListMap.this.remove(l.key);
+ ConcurrentSkipListMap.this.remove(k);
lastReturned = null;
}
-
}
final class ValueIterator extends Iter<V> {
public V next() {
- V v = nextValue;
- advance();
+ V v;
+ if ((v = nextValue) == null)
+ throw new NoSuchElementException();
+ advance(next);
return v;
}
}
final class KeyIterator extends Iter<K> {
public K next() {
- Node<K,V> n = next;
- advance();
- return n.key;
+ Node<K,V> n;
+ if ((n = next) == null)
+ throw new NoSuchElementException();
+ K k = n.key;
+ advance(n);
+ return k;
}
}
final class EntryIterator extends Iter<Map.Entry<K,V>> {
public Map.Entry<K,V> next() {
- Node<K,V> n = next;
+ Node<K,V> n;
+ if ((n = next) == null)
+ throw new NoSuchElementException();
+ K k = n.key;
V v = nextValue;
- advance();
- return new AbstractMap.SimpleImmutableEntry<K,V>(n.key, v);
+ advance(n);
+ return new AbstractMap.SimpleImmutableEntry<K,V>(k, v);
}
}
@@ -2725,38 +2513,34 @@
Map.Entry<K,V> lowestEntry() {
Comparator<? super K> cmp = m.comparator;
for (;;) {
- ConcurrentSkipListMap.Node<K,V> n = loNode(cmp);
- if (!isBeforeEnd(n, cmp))
+ ConcurrentSkipListMap.Node<K,V> n; V v;
+ if ((n = loNode(cmp)) == null || !isBeforeEnd(n, cmp))
return null;
- Map.Entry<K,V> e = n.createSnapshot();
- if (e != null)
- return e;
+ else if ((v = n.val) != null)
+ return new AbstractMap.SimpleImmutableEntry<K,V>(n.key, v);
}
}
Map.Entry<K,V> highestEntry() {
Comparator<? super K> cmp = m.comparator;
for (;;) {
- ConcurrentSkipListMap.Node<K,V> n = hiNode(cmp);
- if (n == null || !inBounds(n.key, cmp))
+ ConcurrentSkipListMap.Node<K,V> n; V v;
+ if ((n = hiNode(cmp)) == null || !inBounds(n.key, cmp))
return null;
- Map.Entry<K,V> e = n.createSnapshot();
- if (e != null)
- return e;
+ else if ((v = n.val) != null)
+ return new AbstractMap.SimpleImmutableEntry<K,V>(n.key, v);
}
}
Map.Entry<K,V> removeLowest() {
Comparator<? super K> cmp = m.comparator;
for (;;) {
- Node<K,V> n = loNode(cmp);
- if (n == null)
+ ConcurrentSkipListMap.Node<K,V> n; K k; V v;
+ if ((n = loNode(cmp)) == null)
return null;
- K k = n.key;
- if (!inBounds(k, cmp))
+ else if (!inBounds((k = n.key), cmp))
return null;
- V v = m.doRemove(k, null);
- if (v != null)
+ else if ((v = m.doRemove(k, null)) != null)
return new AbstractMap.SimpleImmutableEntry<K,V>(k, v);
}
}
@@ -2764,20 +2548,18 @@
Map.Entry<K,V> removeHighest() {
Comparator<? super K> cmp = m.comparator;
for (;;) {
- Node<K,V> n = hiNode(cmp);
- if (n == null)
+ ConcurrentSkipListMap.Node<K,V> n; K k; V v;
+ if ((n = hiNode(cmp)) == null)
return null;
- K k = n.key;
- if (!inBounds(k, cmp))
+ else if (!inBounds((k = n.key), cmp))
return null;
- V v = m.doRemove(k, null);
- if (v != null)
+ else if ((v = m.doRemove(k, null)) != null)
return new AbstractMap.SimpleImmutableEntry<K,V>(k, v);
}
}
/**
- * Submap version of ConcurrentSkipListMap.getNearEntry.
+ * Submap version of ConcurrentSkipListMap.findNearEntry.
*/
Map.Entry<K,V> getNearEntry(K key, int rel) {
Comparator<? super K> cmp = m.comparator;
@@ -2791,15 +2573,12 @@
return ((rel & LT) != 0) ? null : lowestEntry();
if (tooHigh(key, cmp))
return ((rel & LT) != 0) ? highestEntry() : null;
- for (;;) {
- Node<K,V> n = m.findNear(key, rel, cmp);
- if (n == null || !inBounds(n.key, cmp))
- return null;
- K k = n.key;
- V v = n.getValidValue();
- if (v != null)
- return new AbstractMap.SimpleImmutableEntry<K,V>(k, v);
- }
+ AbstractMap.SimpleImmutableEntry<K,V> e =
+ m.findNearEntry(key, rel, cmp);
+ if (e == null || !inBounds(e.getKey(), cmp))
+ return null;
+ else
+ return e;
}
// Almost the same as getNearEntry, except for keys
@@ -2834,10 +2613,8 @@
Node<K,V> n = m.findNear(key, rel, cmp);
if (n == null || !inBounds(n.key, cmp))
return null;
- K k = n.key;
- V v = n.getValidValue();
- if (v != null)
- return k;
+ if (n.val != null)
+ return n.key;
}
}
@@ -2868,7 +2645,7 @@
for (ConcurrentSkipListMap.Node<K,V> n = loNode(cmp);
isBeforeEnd(n, cmp);
n = n.next) {
- if (n.getValidValue() != null)
+ if (n.val != null)
++count;
}
return count >= Integer.MAX_VALUE ? Integer.MAX_VALUE : (int)count;
@@ -2886,7 +2663,7 @@
for (ConcurrentSkipListMap.Node<K,V> n = loNode(cmp);
isBeforeEnd(n, cmp);
n = n.next) {
- V v = n.getValidValue();
+ V v = n.val;
if (v != null && value.equals(v))
return true;
}
@@ -2898,7 +2675,7 @@
for (ConcurrentSkipListMap.Node<K,V> n = loNode(cmp);
isBeforeEnd(n, cmp);
n = n.next) {
- if (n.getValidValue() != null)
+ if (n.val != null)
m.remove(n.key);
}
}
@@ -3112,19 +2889,18 @@
V nextValue;
SubMapIter() {
+ VarHandle.acquireFence();
Comparator<? super K> cmp = m.comparator;
for (;;) {
next = isDescending ? hiNode(cmp) : loNode(cmp);
if (next == null)
break;
- Object x = next.value;
- if (x != null && x != next) {
+ V x = next.val;
+ if (x != null) {
if (! inBounds(next.key, cmp))
next = null;
- else {
- @SuppressWarnings("unchecked") V vv = (V)x;
- nextValue = vv;
- }
+ else
+ nextValue = x;
break;
}
}
@@ -3150,14 +2926,12 @@
next = next.next;
if (next == null)
break;
- Object x = next.value;
- if (x != null && x != next) {
+ V x = next.val;
+ if (x != null) {
if (tooHigh(next.key, cmp))
next = null;
- else {
- @SuppressWarnings("unchecked") V vv = (V)x;
- nextValue = vv;
- }
+ else
+ nextValue = x;
break;
}
}
@@ -3169,14 +2943,12 @@
next = m.findNear(lastReturned.key, LT, cmp);
if (next == null)
break;
- Object x = next.value;
- if (x != null && x != next) {
+ V x = next.val;
+ if (x != null) {
if (tooLow(next.key, cmp))
next = null;
- else {
- @SuppressWarnings("unchecked") V vv = (V)x;
- nextValue = vv;
- }
+ else
+ nextValue = x;
break;
}
}
@@ -3256,22 +3028,28 @@
public void forEach(BiConsumer<? super K, ? super V> action) {
if (action == null) throw new NullPointerException();
- V v;
- for (Node<K,V> n = findFirst(); n != null; n = n.next) {
- if ((v = n.getValidValue()) != null)
- action.accept(n.key, v);
+ Node<K,V> b, n; V v;
+ if ((b = baseHead()) != null) {
+ while ((n = b.next) != null) {
+ if ((v = n.val) != null)
+ action.accept(n.key, v);
+ b = n;
+ }
}
}
public void replaceAll(BiFunction<? super K, ? super V, ? extends V> function) {
if (function == null) throw new NullPointerException();
- V v;
- for (Node<K,V> n = findFirst(); n != null; n = n.next) {
- while ((v = n.getValidValue()) != null) {
- V r = function.apply(n.key, v);
- if (r == null) throw new NullPointerException();
- if (n.casValue(v, r))
- break;
+ Node<K,V> b, n; V v;
+ if ((b = baseHead()) != null) {
+ while ((n = b.next) != null) {
+ while ((v = n.val) != null) {
+ V r = function.apply(n.key, v);
+ if (r == null) throw new NullPointerException();
+ if (VAL.compareAndSet(n, v, r))
+ break;
+ }
+ b = n;
}
}
}
@@ -3282,13 +3060,16 @@
boolean removeEntryIf(Predicate<? super Entry<K,V>> function) {
if (function == null) throw new NullPointerException();
boolean removed = false;
- for (Node<K,V> n = findFirst(); n != null; n = n.next) {
- V v;
- if ((v = n.getValidValue()) != null) {
- K k = n.key;
- Map.Entry<K,V> e = new AbstractMap.SimpleImmutableEntry<>(k, v);
- if (function.test(e) && remove(k, v))
- removed = true;
+ Node<K,V> b, n; V v;
+ if ((b = baseHead()) != null) {
+ while ((n = b.next) != null) {
+ if ((v = n.val) != null) {
+ K k = n.key;
+ Map.Entry<K,V> e = new AbstractMap.SimpleImmutableEntry<>(k, v);
+ if (function.test(e) && remove(k, v))
+ removed = true;
+ }
+ b = n;
}
}
return removed;
@@ -3300,12 +3081,12 @@
boolean removeValueIf(Predicate<? super V> function) {
if (function == null) throw new NullPointerException();
boolean removed = false;
- for (Node<K,V> n = findFirst(); n != null; n = n.next) {
- V v;
- if ((v = n.getValidValue()) != null) {
- K k = n.key;
- if (function.test(v) && remove(k, v))
+ Node<K,V> b, n; V v;
+ if ((b = baseHead()) != null) {
+ while ((n = b.next) != null) {
+ if ((v = n.val) != null && function.test(v) && remove(n.key, v))
removed = true;
+ b = n;
}
}
return removed;
@@ -3323,30 +3104,27 @@
* off, or the end of row is encountered. Control of the number of
* splits relies on some statistical estimation: The expected
* remaining number of elements of a skip list when advancing
- * either across or down decreases by about 25%. To make this
- * observation useful, we need to know initial size, which we
- * don't. But we can just use Integer.MAX_VALUE so that we
- * don't prematurely zero out while splitting.
+ * either across or down decreases by about 25%.
*/
abstract static class CSLMSpliterator<K,V> {
final Comparator<? super K> comparator;
final K fence; // exclusive upper bound for keys, or null if to end
Index<K,V> row; // the level to split out
Node<K,V> current; // current traversal node; initialize at origin
- int est; // pseudo-size estimate
+ long est; // size estimate
CSLMSpliterator(Comparator<? super K> comparator, Index<K,V> row,
- Node<K,V> origin, K fence, int est) {
+ Node<K,V> origin, K fence, long est) {
this.comparator = comparator; this.row = row;
this.current = origin; this.fence = fence; this.est = est;
}
- public final long estimateSize() { return (long)est; }
+ public final long estimateSize() { return est; }
}
static final class KeySpliterator<K,V> extends CSLMSpliterator<K,V>
implements Spliterator<K> {
KeySpliterator(Comparator<? super K> comparator, Index<K,V> row,
- Node<K,V> origin, K fence, int est) {
+ Node<K,V> origin, K fence, long est) {
super(comparator, row, origin, fence, est);
}
@@ -3358,7 +3136,7 @@
for (Index<K,V> q = row; q != null; q = row = q.down) {
Index<K,V> s; Node<K,V> b, n; K sk;
if ((s = q.right) != null && (b = s.node) != null &&
- (n = b.next) != null && n.value != null &&
+ (n = b.next) != null && n.val != null &&
(sk = n.key) != null && cpr(cmp, sk, ek) > 0 &&
(f == null || cpr(cmp, sk, f) < 0)) {
current = n;
@@ -3379,10 +3157,10 @@
Node<K,V> e = current;
current = null;
for (; e != null; e = e.next) {
- K k; Object v;
+ K k;
if ((k = e.key) != null && f != null && cpr(cmp, f, k) <= 0)
break;
- if ((v = e.value) != null && v != e)
+ if (e.val != null)
action.accept(k);
}
}
@@ -3393,12 +3171,12 @@
K f = fence;
Node<K,V> e = current;
for (; e != null; e = e.next) {
- K k; Object v;
+ K k;
if ((k = e.key) != null && f != null && cpr(cmp, f, k) <= 0) {
e = null;
break;
}
- if ((v = e.value) != null && v != e) {
+ if (e.val != null) {
current = e.next;
action.accept(k);
return true;
@@ -3420,21 +3198,23 @@
}
// factory method for KeySpliterator
final KeySpliterator<K,V> keySpliterator() {
- Comparator<? super K> cmp = comparator;
- for (;;) { // ensure h corresponds to origin p
- HeadIndex<K,V> h; Node<K,V> p;
- Node<K,V> b = (h = head).node;
- if ((p = b.next) == null || p.value != null)
- return new KeySpliterator<K,V>(cmp, h, p, null, (p == null) ?
- 0 : Integer.MAX_VALUE);
- p.helpDelete(b, p.next);
+ Index<K,V> h; Node<K,V> n; long est;
+ VarHandle.acquireFence();
+ if ((h = head) == null) {
+ n = null;
+ est = 0L;
}
+ else {
+ n = h.node;
+ est = getAdderCount();
+ }
+ return new KeySpliterator<K,V>(comparator, h, n, null, est);
}
static final class ValueSpliterator<K,V> extends CSLMSpliterator<K,V>
implements Spliterator<V> {
ValueSpliterator(Comparator<? super K> comparator, Index<K,V> row,
- Node<K,V> origin, K fence, int est) {
+ Node<K,V> origin, K fence, long est) {
super(comparator, row, origin, fence, est);
}
@@ -3446,7 +3226,7 @@
for (Index<K,V> q = row; q != null; q = row = q.down) {
Index<K,V> s; Node<K,V> b, n; K sk;
if ((s = q.right) != null && (b = s.node) != null &&
- (n = b.next) != null && n.value != null &&
+ (n = b.next) != null && n.val != null &&
(sk = n.key) != null && cpr(cmp, sk, ek) > 0 &&
(f == null || cpr(cmp, sk, f) < 0)) {
current = n;
@@ -3467,13 +3247,11 @@
Node<K,V> e = current;
current = null;
for (; e != null; e = e.next) {
- K k; Object v;
+ K k; V v;
if ((k = e.key) != null && f != null && cpr(cmp, f, k) <= 0)
break;
- if ((v = e.value) != null && v != e) {
- @SuppressWarnings("unchecked") V vv = (V)v;
- action.accept(vv);
- }
+ if ((v = e.val) != null)
+ action.accept(v);
}
}
@@ -3483,15 +3261,14 @@
K f = fence;
Node<K,V> e = current;
for (; e != null; e = e.next) {
- K k; Object v;
+ K k; V v;
if ((k = e.key) != null && f != null && cpr(cmp, f, k) <= 0) {
e = null;
break;
}
- if ((v = e.value) != null && v != e) {
+ if ((v = e.val) != null) {
current = e.next;
- @SuppressWarnings("unchecked") V vv = (V)v;
- action.accept(vv);
+ action.accept(v);
return true;
}
}
@@ -3507,21 +3284,23 @@
// Almost the same as keySpliterator()
final ValueSpliterator<K,V> valueSpliterator() {
- Comparator<? super K> cmp = comparator;
- for (;;) {
- HeadIndex<K,V> h; Node<K,V> p;
- Node<K,V> b = (h = head).node;
- if ((p = b.next) == null || p.value != null)
- return new ValueSpliterator<K,V>(cmp, h, p, null, (p == null) ?
- 0 : Integer.MAX_VALUE);
- p.helpDelete(b, p.next);
+ Index<K,V> h; Node<K,V> n; long est;
+ VarHandle.acquireFence();
+ if ((h = head) == null) {
+ n = null;
+ est = 0L;
}
+ else {
+ n = h.node;
+ est = getAdderCount();
+ }
+ return new ValueSpliterator<K,V>(comparator, h, n, null, est);
}
static final class EntrySpliterator<K,V> extends CSLMSpliterator<K,V>
implements Spliterator<Map.Entry<K,V>> {
EntrySpliterator(Comparator<? super K> comparator, Index<K,V> row,
- Node<K,V> origin, K fence, int est) {
+ Node<K,V> origin, K fence, long est) {
super(comparator, row, origin, fence, est);
}
@@ -3533,7 +3312,7 @@
for (Index<K,V> q = row; q != null; q = row = q.down) {
Index<K,V> s; Node<K,V> b, n; K sk;
if ((s = q.right) != null && (b = s.node) != null &&
- (n = b.next) != null && n.value != null &&
+ (n = b.next) != null && n.val != null &&
(sk = n.key) != null && cpr(cmp, sk, ek) > 0 &&
(f == null || cpr(cmp, sk, f) < 0)) {
current = n;
@@ -3554,13 +3333,12 @@
Node<K,V> e = current;
current = null;
for (; e != null; e = e.next) {
- K k; Object v;
+ K k; V v;
if ((k = e.key) != null && f != null && cpr(cmp, f, k) <= 0)
break;
- if ((v = e.value) != null && v != e) {
- @SuppressWarnings("unchecked") V vv = (V)v;
+ if ((v = e.val) != null) {
action.accept
- (new AbstractMap.SimpleImmutableEntry<K,V>(k, vv));
+ (new AbstractMap.SimpleImmutableEntry<K,V>(k, v));
}
}
}
@@ -3571,16 +3349,15 @@
K f = fence;
Node<K,V> e = current;
for (; e != null; e = e.next) {
- K k; Object v;
+ K k; V v;
if ((k = e.key) != null && f != null && cpr(cmp, f, k) <= 0) {
e = null;
break;
}
- if ((v = e.value) != null && v != e) {
+ if ((v = e.val) != null) {
current = e.next;
- @SuppressWarnings("unchecked") V vv = (V)v;
action.accept
- (new AbstractMap.SimpleImmutableEntry<K,V>(k, vv));
+ (new AbstractMap.SimpleImmutableEntry<K,V>(k, v));
return true;
}
}
@@ -3611,24 +3388,35 @@
// Almost the same as keySpliterator()
final EntrySpliterator<K,V> entrySpliterator() {
- Comparator<? super K> cmp = comparator;
- for (;;) { // almost same as key version
- HeadIndex<K,V> h; Node<K,V> p;
- Node<K,V> b = (h = head).node;
- if ((p = b.next) == null || p.value != null)
- return new EntrySpliterator<K,V>(cmp, h, p, null, (p == null) ?
- 0 : Integer.MAX_VALUE);
- p.helpDelete(b, p.next);
+ Index<K,V> h; Node<K,V> n; long est;
+ VarHandle.acquireFence();
+ if ((h = head) == null) {
+ n = null;
+ est = 0L;
}
+ else {
+ n = h.node;
+ est = getAdderCount();
+ }
+ return new EntrySpliterator<K,V>(comparator, h, n, null, est);
}
// VarHandle mechanics
private static final VarHandle HEAD;
+ private static final VarHandle ADDER;
+ private static final VarHandle NEXT;
+ private static final VarHandle VAL;
+ private static final VarHandle RIGHT;
static {
try {
MethodHandles.Lookup l = MethodHandles.lookup();
HEAD = l.findVarHandle(ConcurrentSkipListMap.class, "head",
- HeadIndex.class);
+ Index.class);
+ ADDER = l.findVarHandle(ConcurrentSkipListMap.class, "adder",
+ LongAdder.class);
+ NEXT = l.findVarHandle(Node.class, "next", Node.class);
+ VAL = l.findVarHandle(Node.class, "val", Object.class);
+ RIGHT = l.findVarHandle(Index.class, "right", Index.class);
} catch (ReflectiveOperationException e) {
throw new Error(e);
}
--- a/src/java.base/share/classes/java/util/concurrent/ExecutorCompletionService.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.base/share/classes/java/util/concurrent/ExecutorCompletionService.java Mon Oct 09 11:38:46 2017 -0700
@@ -174,6 +174,10 @@
this.completionQueue = completionQueue;
}
+ /**
+ * @throws RejectedExecutionException {@inheritDoc}
+ * @throws NullPointerException {@inheritDoc}
+ */
public Future<V> submit(Callable<V> task) {
if (task == null) throw new NullPointerException();
RunnableFuture<V> f = newTaskFor(task);
@@ -181,6 +185,10 @@
return f;
}
+ /**
+ * @throws RejectedExecutionException {@inheritDoc}
+ * @throws NullPointerException {@inheritDoc}
+ */
public Future<V> submit(Runnable task, V result) {
if (task == null) throw new NullPointerException();
RunnableFuture<V> f = newTaskFor(task, result);
--- a/src/java.base/share/classes/java/util/concurrent/Executors.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.base/share/classes/java/util/concurrent/Executors.java Mon Oct 09 11:38:46 2017 -0700
@@ -514,6 +514,9 @@
task.run();
return result;
}
+ public String toString() {
+ return super.toString() + "[Wrapped task = " + task + "]";
+ }
}
/**
@@ -540,6 +543,10 @@
throw e.getException();
}
}
+
+ public String toString() {
+ return super.toString() + "[Wrapped task = " + task + "]";
+ }
}
/**
@@ -592,6 +599,10 @@
throw e.getException();
}
}
+
+ public String toString() {
+ return super.toString() + "[Wrapped task = " + task + "]";
+ }
}
/**
--- a/src/java.base/share/classes/java/util/concurrent/ForkJoinTask.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.base/share/classes/java/util/concurrent/ForkJoinTask.java Mon Oct 09 11:38:46 2017 -0700
@@ -1375,6 +1375,9 @@
public final void setRawResult(T v) { result = v; }
public final boolean exec() { runnable.run(); return true; }
public final void run() { invoke(); }
+ public String toString() {
+ return super.toString() + "[Wrapped task = " + runnable + "]";
+ }
private static final long serialVersionUID = 5232453952276885070L;
}
@@ -1392,6 +1395,9 @@
public final void setRawResult(Void v) { }
public final boolean exec() { runnable.run(); return true; }
public final void run() { invoke(); }
+ public String toString() {
+ return super.toString() + "[Wrapped task = " + runnable + "]";
+ }
private static final long serialVersionUID = 5232453952276885070L;
}
@@ -1437,6 +1443,9 @@
}
}
public final void run() { invoke(); }
+ public String toString() {
+ return super.toString() + "[Wrapped task = " + callable + "]";
+ }
private static final long serialVersionUID = 2838392045355241008L;
}
--- a/src/java.base/share/classes/java/util/concurrent/FutureTask.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.base/share/classes/java/util/concurrent/FutureTask.java Mon Oct 09 11:38:46 2017 -0700
@@ -480,6 +480,41 @@
}
}
+ /**
+ * Returns a string representation of this FutureTask.
+ *
+ * @implSpec
+ * The default implementation returns a string identifying this
+ * FutureTask, as well as its completion state. The state, in
+ * brackets, contains one of the strings {@code "Completed Normally"},
+ * {@code "Completed Exceptionally"}, {@code "Cancelled"}, or {@code
+ * "Not completed"}.
+ *
+ * @return a string representation of this FutureTask
+ */
+ public String toString() {
+ final String status;
+ switch (state) {
+ case NORMAL:
+ status = "[Completed normally]";
+ break;
+ case EXCEPTIONAL:
+ status = "[Completed exceptionally: " + outcome + "]";
+ break;
+ case CANCELLED:
+ case INTERRUPTING:
+ case INTERRUPTED:
+ status = "[Cancelled]";
+ break;
+ default:
+ final Callable<?> callable = this.callable;
+ status = (callable == null)
+ ? "[Not completed]"
+ : "[Not completed, task = " + callable + "]";
+ }
+ return super.toString() + status;
+ }
+
// VarHandle mechanics
private static final VarHandle STATE;
private static final VarHandle RUNNER;
--- a/src/java.base/share/classes/java/util/concurrent/ThreadPoolExecutor.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.base/share/classes/java/util/concurrent/ThreadPoolExecutor.java Mon Oct 09 11:38:46 2017 -0700
@@ -383,7 +383,7 @@
*/
private final AtomicInteger ctl = new AtomicInteger(ctlOf(RUNNING, 0));
private static final int COUNT_BITS = Integer.SIZE - 3;
- private static final int CAPACITY = (1 << COUNT_BITS) - 1;
+ private static final int COUNT_MASK = (1 << COUNT_BITS) - 1;
// runState is stored in the high-order bits
private static final int RUNNING = -1 << COUNT_BITS;
@@ -393,8 +393,8 @@
private static final int TERMINATED = 3 << COUNT_BITS;
// Packing and unpacking ctl
- private static int runStateOf(int c) { return c & ~CAPACITY; }
- private static int workerCountOf(int c) { return c & CAPACITY; }
+ private static int runStateOf(int c) { return c & ~COUNT_MASK; }
+ private static int workerCountOf(int c) { return c & COUNT_MASK; }
private static int ctlOf(int rs, int wc) { return rs | wc; }
/*
@@ -434,7 +434,7 @@
* decrements are performed within getTask.
*/
private void decrementWorkerCount() {
- do {} while (! compareAndDecrementWorkerCount(ctl.get()));
+ ctl.addAndGet(-1);
}
/**
@@ -538,12 +538,17 @@
* Core pool size is the minimum number of workers to keep alive
* (and not allow to time out etc) unless allowCoreThreadTimeOut
* is set, in which case the minimum is zero.
+ *
+ * Since the worker count is actually stored in COUNT_BITS bits,
+ * the effective limit is {@code corePoolSize & COUNT_MASK}.
*/
private volatile int corePoolSize;
/**
- * Maximum pool size. Note that the actual maximum is internally
- * bounded by CAPACITY.
+ * Maximum pool size.
+ *
+ * Since the worker count is actually stored in COUNT_BITS bits,
+ * the effective limit is {@code maximumPoolSize & COUNT_MASK}.
*/
private volatile int maximumPoolSize;
@@ -705,7 +710,7 @@
int c = ctl.get();
if (isRunning(c) ||
runStateAtLeast(c, TIDYING) ||
- (runStateOf(c) == SHUTDOWN && ! workQueue.isEmpty()))
+ (runStateLessThan(c, STOP) && ! workQueue.isEmpty()))
return;
if (workerCountOf(c) != 0) { // Eligible to terminate
interruptIdleWorkers(ONLY_ONE);
@@ -744,17 +749,12 @@
* specially.
*/
private void checkShutdownAccess() {
+ // assert mainLock.isHeldByCurrentThread();
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkPermission(shutdownPerm);
- final ReentrantLock mainLock = this.mainLock;
- mainLock.lock();
- try {
- for (Worker w : workers)
- security.checkAccess(w.thread);
- } finally {
- mainLock.unlock();
- }
+ for (Worker w : workers)
+ security.checkAccess(w.thread);
}
}
@@ -763,14 +763,9 @@
* (in which case some threads may remain uninterrupted).
*/
private void interruptWorkers() {
- final ReentrantLock mainLock = this.mainLock;
- mainLock.lock();
- try {
- for (Worker w : workers)
- w.interruptIfStarted();
- } finally {
- mainLock.unlock();
- }
+ // assert mainLock.isHeldByCurrentThread();
+ for (Worker w : workers)
+ w.interruptIfStarted();
}
/**
@@ -896,26 +891,22 @@
*/
private boolean addWorker(Runnable firstTask, boolean core) {
retry:
- for (;;) {
- int c = ctl.get();
- int rs = runStateOf(c);
-
+ for (int c = ctl.get();;) {
// Check if queue empty only if necessary.
- if (rs >= SHUTDOWN &&
- ! (rs == SHUTDOWN &&
- firstTask == null &&
- ! workQueue.isEmpty()))
+ if (runStateAtLeast(c, SHUTDOWN)
+ && (runStateAtLeast(c, STOP)
+ || firstTask != null
+ || workQueue.isEmpty()))
return false;
for (;;) {
- int wc = workerCountOf(c);
- if (wc >= CAPACITY ||
- wc >= (core ? corePoolSize : maximumPoolSize))
+ if (workerCountOf(c)
+ >= ((core ? corePoolSize : maximumPoolSize) & COUNT_MASK))
return false;
if (compareAndIncrementWorkerCount(c))
break retry;
c = ctl.get(); // Re-read ctl
- if (runStateOf(c) != rs)
+ if (runStateAtLeast(c, SHUTDOWN))
continue retry;
// else CAS failed due to workerCount change; retry inner loop
}
@@ -934,10 +925,10 @@
// Recheck while holding lock.
// Back out on ThreadFactory failure or if
// shut down before lock acquired.
- int rs = runStateOf(ctl.get());
+ int c = ctl.get();
- if (rs < SHUTDOWN ||
- (rs == SHUTDOWN && firstTask == null)) {
+ if (isRunning(c) ||
+ (runStateLessThan(c, STOP) && firstTask == null)) {
if (t.isAlive()) // precheck that t is startable
throw new IllegalThreadStateException();
workers.add(w);
@@ -1044,10 +1035,10 @@
for (;;) {
int c = ctl.get();
- int rs = runStateOf(c);
// Check if queue empty only if necessary.
- if (rs >= SHUTDOWN && (rs >= STOP || workQueue.isEmpty())) {
+ if (runStateAtLeast(c, SHUTDOWN)
+ && (runStateAtLeast(c, STOP) || workQueue.isEmpty())) {
decrementWorkerCount();
return null;
}
@@ -1140,17 +1131,12 @@
wt.interrupt();
try {
beforeExecute(wt, task);
- Throwable thrown = null;
try {
task.run();
- } catch (RuntimeException x) {
- thrown = x; throw x;
- } catch (Error x) {
- thrown = x; throw x;
- } catch (Throwable x) {
- thrown = x; throw new Error(x);
- } finally {
- afterExecute(task, thrown);
+ afterExecute(task, null);
+ } catch (Throwable ex) {
+ afterExecute(task, ex);
+ throw ex;
}
} finally {
task = null;
@@ -1331,7 +1317,7 @@
*
* If the task cannot be submitted for execution, either because this
* executor has been shutdown or because its capacity has been reached,
- * the task is handled by the current {@code RejectedExecutionHandler}.
+ * the task is handled by the current {@link RejectedExecutionHandler}.
*
* @param command the task to execute
* @throws RejectedExecutionException at discretion of
@@ -1438,7 +1424,7 @@
}
public boolean isShutdown() {
- return ! isRunning(ctl.get());
+ return runStateAtLeast(ctl.get(), SHUTDOWN);
}
/** Used by ScheduledThreadPoolExecutor. */
@@ -1459,7 +1445,7 @@
*/
public boolean isTerminating() {
int c = ctl.get();
- return ! isRunning(c) && runStateLessThan(c, TERMINATED);
+ return runStateAtLeast(c, SHUTDOWN) && runStateLessThan(c, TERMINATED);
}
public boolean isTerminated() {
@@ -1472,7 +1458,7 @@
final ReentrantLock mainLock = this.mainLock;
mainLock.lock();
try {
- while (!runStateAtLeast(ctl.get(), TERMINATED)) {
+ while (runStateLessThan(ctl.get(), TERMINATED)) {
if (nanos <= 0L)
return false;
nanos = termination.awaitNanos(nanos);
@@ -1951,7 +1937,7 @@
}
int c = ctl.get();
String runState =
- runStateLessThan(c, SHUTDOWN) ? "Running" :
+ isRunning(c) ? "Running" :
runStateAtLeast(c, TERMINATED) ? "Terminated" :
"Shutting down";
return super.toString() +
--- a/src/java.base/share/classes/java/util/concurrent/TimeUnit.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.base/share/classes/java/util/concurrent/TimeUnit.java Mon Oct 09 11:38:46 2017 -0700
@@ -342,11 +342,13 @@
* using:
*
* <pre> {@code
- * public synchronized Object poll(long timeout, TimeUnit unit)
+ * public E poll(long timeout, TimeUnit unit)
* throws InterruptedException {
- * while (empty) {
- * unit.timedWait(this, timeout);
- * ...
+ * synchronized (lock) {
+ * while (isEmpty()) {
+ * unit.timedWait(lock, timeout);
+ * ...
+ * }
* }
* }}</pre>
*
--- a/src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java Mon Oct 09 11:38:46 2017 -0700
@@ -67,11 +67,11 @@
private static final long serialVersionUID = 7373984972572414692L;
/*
- To keep sources in sync, the remainder of this source file is
- exactly cloned from AbstractQueuedSynchronizer, replacing class
- name and changing ints related with sync state to longs. Please
- keep it that way.
- */
+ * To keep sources in sync, the remainder of this source file is
+ * exactly cloned from AbstractQueuedSynchronizer, replacing class
+ * name and changing ints related with sync state to longs. Please
+ * keep it that way.
+ */
/**
* Creates a new {@code AbstractQueuedLongSynchronizer} instance
@@ -725,8 +725,7 @@
/**
* Returns {@code true} if synchronization is held exclusively with
* respect to the current (calling) thread. This method is invoked
- * upon each call to a non-waiting {@link ConditionObject} method.
- * (Waiting methods instead invoke {@link #release}.)
+ * upon each call to a {@link ConditionObject} method.
*
* <p>The default implementation throws {@link
* UnsupportedOperationException}. This method is invoked
@@ -1366,9 +1365,8 @@
}
/**
- * Condition implementation for a {@link
- * AbstractQueuedLongSynchronizer} serving as the basis of a {@link
- * Lock} implementation.
+ * Condition implementation for a {@link AbstractQueuedLongSynchronizer}
+ * serving as the basis of a {@link Lock} implementation.
*
* <p>Method documentation for this class describes mechanics,
* not behavioral specifications from the point of view of Lock
@@ -1401,6 +1399,8 @@
* @return its new wait node
*/
private Node addConditionWaiter() {
+ if (!isHeldExclusively())
+ throw new IllegalMonitorStateException();
Node t = lastWaiter;
// If lastWaiter is cancelled, clean out.
if (t != null && t.waitStatus != Node.CONDITION) {
--- a/src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java Mon Oct 09 11:38:46 2017 -0700
@@ -194,19 +194,13 @@
* represent the locked state. While a non-reentrant lock
* does not strictly require recording of the current owner
* thread, this class does so anyway to make usage easier to monitor.
- * It also supports conditions and exposes
- * one of the instrumentation methods:
+ * It also supports conditions and exposes some instrumentation methods:
*
* <pre> {@code
* class Mutex implements Lock, java.io.Serializable {
*
* // Our internal helper class
* private static class Sync extends AbstractQueuedSynchronizer {
- * // Reports whether in locked state
- * protected boolean isHeldExclusively() {
- * return getState() == 1;
- * }
- *
* // Acquires the lock if state is zero
* public boolean tryAcquire(int acquires) {
* assert acquires == 1; // Otherwise unused
@@ -220,14 +214,27 @@
* // Releases the lock by setting state to zero
* protected boolean tryRelease(int releases) {
* assert releases == 1; // Otherwise unused
- * if (getState() == 0) throw new IllegalMonitorStateException();
+ * if (!isHeldExclusively())
+ * throw new IllegalMonitorStateException();
* setExclusiveOwnerThread(null);
* setState(0);
* return true;
* }
*
+ * // Reports whether in locked state
+ * public boolean isLocked() {
+ * return getState() != 0;
+ * }
+ *
+ * public boolean isHeldExclusively() {
+ * // a data race, but safe due to out-of-thin-air guarantees
+ * return getExclusiveOwnerThread() == Thread.currentThread();
+ * }
+ *
* // Provides a Condition
- * Condition newCondition() { return new ConditionObject(); }
+ * public Condition newCondition() {
+ * return new ConditionObject();
+ * }
*
* // Deserializes properly
* private void readObject(ObjectInputStream s)
@@ -240,12 +247,17 @@
* // The sync object does all the hard work. We just forward to it.
* private final Sync sync = new Sync();
*
- * public void lock() { sync.acquire(1); }
- * public boolean tryLock() { return sync.tryAcquire(1); }
- * public void unlock() { sync.release(1); }
- * public Condition newCondition() { return sync.newCondition(); }
- * public boolean isLocked() { return sync.isHeldExclusively(); }
- * public boolean hasQueuedThreads() { return sync.hasQueuedThreads(); }
+ * public void lock() { sync.acquire(1); }
+ * public boolean tryLock() { return sync.tryAcquire(1); }
+ * public void unlock() { sync.release(1); }
+ * public Condition newCondition() { return sync.newCondition(); }
+ * public boolean isLocked() { return sync.isLocked(); }
+ * public boolean isHeldByCurrentThread() {
+ * return sync.isHeldExclusively();
+ * }
+ * public boolean hasQueuedThreads() {
+ * return sync.hasQueuedThreads();
+ * }
* public void lockInterruptibly() throws InterruptedException {
* sync.acquireInterruptibly(1);
* }
@@ -1193,8 +1205,7 @@
/**
* Returns {@code true} if synchronization is held exclusively with
* respect to the current (calling) thread. This method is invoked
- * upon each call to a non-waiting {@link ConditionObject} method.
- * (Waiting methods instead invoke {@link #release}.)
+ * upon each call to a {@link ConditionObject} method.
*
* <p>The default implementation throws {@link
* UnsupportedOperationException}. This method is invoked
@@ -1834,9 +1845,8 @@
}
/**
- * Condition implementation for a {@link
- * AbstractQueuedSynchronizer} serving as the basis of a {@link
- * Lock} implementation.
+ * Condition implementation for a {@link AbstractQueuedSynchronizer}
+ * serving as the basis of a {@link Lock} implementation.
*
* <p>Method documentation for this class describes mechanics,
* not behavioral specifications from the point of view of Lock
@@ -1867,6 +1877,8 @@
* @return its new wait node
*/
private Node addConditionWaiter() {
+ if (!isHeldExclusively())
+ throw new IllegalMonitorStateException();
Node t = lastWaiter;
// If lastWaiter is cancelled, clean out.
if (t != null && t.waitStatus != Node.CONDITION) {
--- a/src/java.base/share/classes/java/util/concurrent/locks/Condition.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.base/share/classes/java/util/concurrent/locks/Condition.java Mon Oct 09 11:38:46 2017 -0700
@@ -73,7 +73,7 @@
* available in the buffer. This can be achieved using two
* {@link Condition} instances.
* <pre>
- * class BoundedBuffer {
+ * class BoundedBuffer<E> {
* <b>final Lock lock = new ReentrantLock();</b>
* final Condition notFull = <b>lock.newCondition(); </b>
* final Condition notEmpty = <b>lock.newCondition(); </b>
@@ -81,7 +81,7 @@
* final Object[] items = new Object[100];
* int putptr, takeptr, count;
*
- * public void put(Object x) throws InterruptedException {
+ * public void put(E x) throws InterruptedException {
* <b>lock.lock();
* try {</b>
* while (count == items.length)
@@ -95,12 +95,12 @@
* }</b>
* }
*
- * public Object take() throws InterruptedException {
+ * public E take() throws InterruptedException {
* <b>lock.lock();
* try {</b>
* while (count == 0)
* <b>notEmpty.await();</b>
- * Object x = items[takeptr];
+ * E x = (E) items[takeptr];
* if (++takeptr == items.length) takeptr = 0;
* --count;
* <b>notFull.signal();</b>
@@ -310,7 +310,8 @@
* the following form:
*
* <pre> {@code
- * boolean aMethod(long timeout, TimeUnit unit) {
+ * boolean aMethod(long timeout, TimeUnit unit)
+ * throws InterruptedException {
* long nanos = unit.toNanos(timeout);
* lock.lock();
* try {
@@ -320,6 +321,7 @@
* nanos = theCondition.awaitNanos(nanos);
* }
* // ...
+ * return true;
* } finally {
* lock.unlock();
* }
@@ -410,7 +412,8 @@
* <p>The return value indicates whether the deadline has elapsed,
* which can be used as follows:
* <pre> {@code
- * boolean aMethod(Date deadline) {
+ * boolean aMethod(Date deadline)
+ * throws InterruptedException {
* boolean stillWaiting = true;
* lock.lock();
* try {
@@ -420,6 +423,7 @@
* stillWaiting = theCondition.awaitUntil(deadline);
* }
* // ...
+ * return true;
* } finally {
* lock.unlock();
* }
--- a/src/java.base/share/classes/java/util/concurrent/locks/StampedLock.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.base/share/classes/java/util/concurrent/locks/StampedLock.java Mon Oct 09 11:38:46 2017 -0700
@@ -151,18 +151,20 @@
* }
*
* double distanceFromOrigin() { // A read-only method
+ * double currentX, currentY;
* long stamp = sl.tryOptimisticRead();
- * double currentX = x, currentY = y;
- * if (!sl.validate(stamp)) {
- * stamp = sl.readLock();
+ * do {
+ * if (stamp == 0L)
+ * stamp = sl.readLock();
* try {
+ * // possibly racy reads
* currentX = x;
* currentY = y;
* } finally {
- * sl.unlockRead(stamp);
+ * stamp = sl.tryConvertToOptimisticRead(stamp);
* }
- * }
- * return Math.sqrt(currentX * currentX + currentY * currentY);
+ * } while (stamp == 0);
+ * return Math.hypot(currentX, currentY);
* }
*
* void moveIfAtOrigin(double newX, double newY) { // upgrade
--- a/src/java.base/share/classes/jdk/internal/misc/JavaLangInvokeAccess.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.base/share/classes/jdk/internal/misc/JavaLangInvokeAccess.java Mon Oct 09 11:38:46 2017 -0700
@@ -40,6 +40,18 @@
String getName(Object mname);
/**
+ * Returns the {@code MethodType} for the given MemberName.
+ * Used by {@see StackFrameInfo}.
+ */
+ MethodType getMethodType(Object mname);
+
+ /**
+ * Returns the descriptor for the given MemberName.
+ * Used by {@see StackFrameInfo}.
+ */
+ String getMethodDescriptor(Object mname);
+
+ /**
* Returns {@code true} if the given MemberName is a native method. Used by
* {@see StackFrameInfo}.
*/
--- a/src/java.base/share/classes/sun/security/util/Cache.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.base/share/classes/sun/security/util/Cache.java Mon Oct 09 11:38:46 2017 -0700
@@ -164,7 +164,7 @@
public static class EqualByteArray {
private final byte[] b;
- private volatile int hash;
+ private int hash;
public EqualByteArray(byte[] b) {
this.b = b;
@@ -172,12 +172,8 @@
public int hashCode() {
int h = hash;
- if (h == 0) {
- h = b.length + 1;
- for (int i = 0; i < b.length; i++) {
- h += (b[i] & 0xff) * 37;
- }
- hash = h;
+ if (h == 0 && b.length > 0) {
+ hash = h = Arrays.hashCode(b);
}
return h;
}
--- a/src/java.base/windows/native/libjava/io_util_md.c Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.base/windows/native/libjava/io_util_md.c Mon Oct 09 11:38:46 2017 -0700
@@ -550,10 +550,10 @@
fileDescriptorClose(JNIEnv *env, jobject this)
{
FD fd = (*env)->GetLongField(env, this, IO_handle_fdID);
+ HANDLE h = (HANDLE)fd;
if ((*env)->ExceptionOccurred(env)) {
return;
}
- HANDLE h = (HANDLE)fd;
if (h == INVALID_HANDLE_VALUE) {
return;
--- a/src/java.base/windows/native/libnet/NetworkInterface_winXP.c Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.base/windows/native/libnet/NetworkInterface_winXP.c Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -62,7 +62,8 @@
#endif
-static int bufsize = 4096;
+const ULONG BUFF_SIZE = 15360;
+const int MAX_TRIES = 3;
/*
* return an array of IP_ADAPTER_ADDRESSES containing one element
@@ -78,25 +79,26 @@
strlen("IP Helper Library GetAdaptersAddresses function failed"
" with error == ") + 10;
int _ret = 0;
+ int try;
- adapterInfo = (IP_ADAPTER_ADDRESSES *)malloc (bufsize);
+ adapterInfo = (IP_ADAPTER_ADDRESSES *) malloc(BUFF_SIZE);
if (adapterInfo == NULL) {
JNU_ThrowByName(env, "java/lang/OutOfMemoryError",
"Native heap allocation failure");
return -1;
}
- len = bufsize;
+ len = BUFF_SIZE;
flags = GAA_FLAG_SKIP_DNS_SERVER;
flags |= GAA_FLAG_SKIP_MULTICAST;
flags |= GAA_FLAG_INCLUDE_PREFIX;
ret = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len);
- if (ret == ERROR_BUFFER_OVERFLOW) {
+ for (try = 0; ret == ERROR_BUFFER_OVERFLOW && try < MAX_TRIES; ++try) {
IP_ADAPTER_ADDRESSES * newAdapterInfo = NULL;
- if (len < (ULONG_MAX - bufsize)) {
- len = len + bufsize;
+ if (len < (ULONG_MAX - BUFF_SIZE)) {
+ len += BUFF_SIZE;
}
newAdapterInfo =
(IP_ADAPTER_ADDRESSES *) realloc (adapterInfo, len);
@@ -159,21 +161,22 @@
size_t error_msg_buf_size =
strlen("IP Helper Library GetAdaptersAddresses function failed with error == ") + 10;
int _ret = 0;
- adapterInfo = (IP_ADAPTER_ADDRESSES *)malloc (bufsize);
+ int try;
+ adapterInfo = (IP_ADAPTER_ADDRESSES *) malloc(BUFF_SIZE);
if (adapterInfo == NULL) {
JNU_ThrowByName(env, "java/lang/OutOfMemoryError",
"Native heap allocation failure");
return NULL;
}
- len = bufsize;
+ len = BUFF_SIZE;
flags = GAA_FLAG_SKIP_DNS_SERVER;
flags |= GAA_FLAG_SKIP_MULTICAST;
flags |= GAA_FLAG_INCLUDE_PREFIX;
val = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len);
- if (val == ERROR_BUFFER_OVERFLOW) {
+ for (try = 0; val == ERROR_BUFFER_OVERFLOW && try < MAX_TRIES; ++try) {
IP_ADAPTER_ADDRESSES * newAdapterInfo = NULL;
- if (len < (ULONG_MAX - bufsize)) {
- len = len + bufsize;
+ if (len < (ULONG_MAX - BUFF_SIZE)) {
+ len += BUFF_SIZE;
}
newAdapterInfo =
(IP_ADAPTER_ADDRESSES *) realloc (adapterInfo, len);
--- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/XalanConstants.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/XalanConstants.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,6 @@
/*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +26,7 @@
package com.sun.org.apache.xalan.internal;
-import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
+import jdk.xml.internal.SecuritySupport;
/**
* Commonly used constants.
--- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLMessages.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLMessages.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,6 +1,6 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -21,10 +21,9 @@
package com.sun.org.apache.xalan.internal.res;
-import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
-import java.util.ListResourceBundle;
-
import com.sun.org.apache.xpath.internal.res.XPATHMessages;
+import java.util.ResourceBundle;
+import jdk.xml.internal.SecuritySupport;
/**
* Sets things up for issuing error messages. This class is misnamed, and should
@@ -37,7 +36,7 @@
/**
* The language specific resource object for Xalan messages.
*/
- private static ListResourceBundle XSLTBundle = null;
+ private static ResourceBundle XSLTBundle = null;
/**
* The class name of the Xalan error message string table.
*/
--- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/FeaturePropertyBase.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/FeaturePropertyBase.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
package com.sun.org.apache.xalan.internal.utils;
import com.sun.org.apache.xalan.internal.XalanConstants;
+import jdk.xml.internal.SecuritySupport;
/**
* This is the base class for features and properties
--- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/ObjectFactory.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/ObjectFactory.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -21,6 +22,7 @@
package com.sun.org.apache.xalan.internal.utils;
import java.util.function.Supplier;
+import jdk.xml.internal.SecuritySupport;
/**
* This class is duplicated for each JAXP subpackage so keep it in sync.
--- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/SecuritySupport.java Mon Oct 09 10:42:27 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,326 +0,0 @@
-/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
- */
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xalan.internal.utils;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-import java.util.Properties;
-
-/**
- * This class is duplicated for each subpackage so keep it in sync. It is
- * package private and therefore is not exposed as part of any API.
- *
- * @xerces.internal
- */
-public final class SecuritySupport {
-
- private static final SecuritySupport securitySupport = new SecuritySupport();
-
- /**
- * Return an instance of this class.
- */
- public static SecuritySupport getInstance() {
- return securitySupport;
- }
-
- public static ClassLoader getContextClassLoader() {
- return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- ClassLoader cl = null;
- try {
- cl = Thread.currentThread().getContextClassLoader();
- } catch (SecurityException ex) {
- }
- return cl;
- }
- });
- }
-
- static ClassLoader getSystemClassLoader() {
- return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- ClassLoader cl = null;
- try {
- cl = ClassLoader.getSystemClassLoader();
- } catch (SecurityException ex) {
- }
- return cl;
- }
- });
- }
-
- static ClassLoader getParentClassLoader(final ClassLoader cl) {
- return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- ClassLoader parent = null;
- try {
- parent = cl.getParent();
- } catch (SecurityException ex) {
- }
-
- // eliminate loops in case of the boot
- // ClassLoader returning itself as a parent
- return (parent == cl) ? null : parent;
- }
- });
- }
-
- public static String getSystemProperty(final String propName) {
- return (String) AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return System.getProperty(propName);
- }
- });
- }
-
- public static String getSystemProperty(final String propName, final String def) {
- return (String) AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return System.getProperty(propName, def);
- }
- });
- }
-
- static FileInputStream getFileInputStream(final File file)
- throws FileNotFoundException {
- try {
- return (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws FileNotFoundException {
- return new FileInputStream(file);
- }
- });
- } catch (PrivilegedActionException e) {
- throw (FileNotFoundException)e.getException();
- }
- }
-
- public static InputStream getResourceAsStream(final String name) {
- return (InputStream) AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return SecuritySupport.class.getResourceAsStream("/"+name);
- }
- });
- }
-
- /**
- * Gets a resource bundle using the specified base name, the default locale, and the caller's class loader.
- * @param bundle the base name of the resource bundle, a fully qualified class name
- * @return a resource bundle for the given base name and the default locale
- */
- public static ListResourceBundle getResourceBundle(String bundle) {
- return getResourceBundle(bundle, Locale.getDefault());
- }
-
- /**
- * Gets a resource bundle using the specified base name and locale, and the caller's class loader.
- * @param bundle the base name of the resource bundle, a fully qualified class name
- * @param locale the locale for which a resource bundle is desired
- * @return a resource bundle for the given base name and locale
- */
- public static ListResourceBundle getResourceBundle(final String bundle, final Locale locale) {
- return AccessController.doPrivileged(new PrivilegedAction<ListResourceBundle>() {
- public ListResourceBundle run() {
- try {
- return (ListResourceBundle)ResourceBundle.getBundle(bundle, locale);
- } catch (MissingResourceException e) {
- try {
- return (ListResourceBundle)ResourceBundle.getBundle(bundle, new Locale("en", "US"));
- } catch (MissingResourceException e2) {
- throw new MissingResourceException(
- "Could not load any resource bundle by " + bundle, bundle, "");
- }
- }
- }
- });
- }
-
- public static boolean getFileExists(final File f) {
- return ((Boolean) AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return f.exists() ? Boolean.TRUE : Boolean.FALSE;
- }
- })).booleanValue();
- }
-
- static long getLastModified(final File f) {
- return ((Long) AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return f.lastModified();
- }
- })).longValue();
- }
-
- /**
- * Strip off path from an URI
- *
- * @param uri an URI with full path
- * @return the file name only
- */
- public static String sanitizePath(String uri) {
- if (uri == null) {
- return "";
- }
- int i = uri.lastIndexOf("/");
- if (i > 0) {
- return uri.substring(i+1, uri.length());
- }
- return "";
- }
-
- /**
- * Check the protocol used in the systemId against allowed protocols
- *
- * @param systemId the Id of the URI
- * @param allowedProtocols a list of allowed protocols separated by comma
- * @param accessAny keyword to indicate allowing any protocol
- * @return the name of the protocol if rejected, null otherwise
- */
- public static String checkAccess(String systemId, String allowedProtocols, String accessAny) throws IOException {
- if (systemId == null || (allowedProtocols != null &&
- allowedProtocols.equalsIgnoreCase(accessAny))) {
- return null;
- }
-
- String protocol;
- if (systemId.indexOf(":")==-1) {
- protocol = "file";
- } else {
- URL url = new URL(systemId);
- protocol = url.getProtocol();
- if (protocol.equalsIgnoreCase("jar")) {
- String path = url.getPath();
- protocol = path.substring(0, path.indexOf(":"));
- } else if (protocol.equalsIgnoreCase("jrt")) {
- // if the systemId is "jrt" then allow access if "file" allowed
- protocol = "file";
- }
- }
-
- if (isProtocolAllowed(protocol, allowedProtocols)) {
- //access allowed
- return null;
- } else {
- return protocol;
- }
- }
-
- /**
- * Check if the protocol is in the allowed list of protocols. The check
- * is case-insensitive while ignoring whitespaces.
- *
- * @param protocol a protocol
- * @param allowedProtocols a list of allowed protocols
- * @return true if the protocol is in the list
- */
- private static boolean isProtocolAllowed(String protocol, String allowedProtocols) {
- if (allowedProtocols == null) {
- return false;
- }
- String temp[] = allowedProtocols.split(",");
- for (String t : temp) {
- t = t.trim();
- if (t.equalsIgnoreCase(protocol)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Read JAXP system property in this order: system property,
- * $java.home/conf/jaxp.properties if the system property is not specified
- *
- * @param propertyId the Id of the property
- * @return the value of the property
- */
- public static String getJAXPSystemProperty(String sysPropertyId) {
- String accessExternal = getSystemProperty(sysPropertyId);
- if (accessExternal == null) {
- accessExternal = readJAXPProperty(sysPropertyId);
- }
- return accessExternal;
- }
-
- /**
- * Read from $java.home/conf/jaxp.properties for the specified property
- * The program
- *
- * @param propertyId the Id of the property
- * @return the value of the property
- */
- static String readJAXPProperty(String propertyId) {
- String value = null;
- InputStream is = null;
- try {
- if (firstTime) {
- synchronized (cacheProps) {
- if (firstTime) {
- String configFile = getSystemProperty("java.home") + File.separator +
- "conf" + File.separator + "jaxp.properties";
- File f = new File(configFile);
- if (getFileExists(f)) {
- is = getFileInputStream(f);
- cacheProps.load(is);
- }
- firstTime = false;
- }
- }
- }
- value = cacheProps.getProperty(propertyId);
-
- }
- catch (Exception ex) {}
- finally {
- if (is != null) {
- try {
- is.close();
- } catch (IOException ex) {}
- }
- }
-
- return value;
- }
-
- /**
- * Cache for properties in java.home/conf/jaxp.properties
- */
- static final Properties cacheProps = new Properties();
-
- /**
- * Flag indicating if the program has tried reading java.home/conf/jaxp.properties
- */
- static volatile boolean firstTime = true;
-
- private SecuritySupport () {}
-}
--- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/XMLSecurityManager.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/XMLSecurityManager.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
import com.sun.org.apache.xalan.internal.XalanConstants;
import java.util.concurrent.CopyOnWriteArrayList;
+import jdk.xml.internal.SecuritySupport;
import org.xml.sax.SAXException;
--- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Import.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Import.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,6 @@
/*
- * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -24,7 +25,6 @@
package com.sun.org.apache.xalan.internal.xsltc.compiler;
import com.sun.org.apache.xalan.internal.XalanConstants;
-import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
@@ -33,6 +33,7 @@
import com.sun.org.apache.xml.internal.utils.SystemIDResolver;
import java.util.Iterator;
import javax.xml.XMLConstants;
+import jdk.xml.internal.SecuritySupport;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
--- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Include.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Include.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,6 @@
/*
- * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -24,7 +25,6 @@
package com.sun.org.apache.xalan.internal.xsltc.compiler;
import com.sun.org.apache.xalan.internal.XalanConstants;
-import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
@@ -33,6 +33,7 @@
import com.sun.org.apache.xml.internal.utils.SystemIDResolver;
import java.util.Iterator;
import javax.xml.XMLConstants;
+import jdk.xml.internal.SecuritySupport;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
--- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -24,7 +25,6 @@
import com.sun.org.apache.xalan.internal.XalanConstants;
import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
-import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodType;
@@ -49,6 +49,7 @@
import javax.xml.parsers.SAXParserFactory;
import jdk.xml.internal.JdkXmlFeatures;
import jdk.xml.internal.JdkXmlUtils;
+import jdk.xml.internal.SecuritySupport;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.InputSource;
--- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -22,12 +23,10 @@
import com.sun.org.apache.bcel.internal.classfile.JavaClass;
import com.sun.org.apache.xalan.internal.XalanConstants;
-import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
import com.sun.org.apache.xml.internal.dtm.DTM;
-import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
@@ -51,6 +50,7 @@
import javax.xml.catalog.CatalogFeatures;
import jdk.xml.internal.JdkXmlFeatures;
import jdk.xml.internal.JdkXmlUtils;
+import jdk.xml.internal.SecuritySupport;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
@@ -730,7 +730,7 @@
*/
public boolean setDestDirectory(String dstDirName) {
final File dir = new File(dstDirName);
- if (SecuritySupport.getFileExists(dir) || dir.mkdirs()) {
+ if (SecuritySupport.doesFileExist(dir) || dir.mkdirs()) {
_destDir = dir;
return true;
}
@@ -902,7 +902,7 @@
String parentDir = outFile.getParent();
if (parentDir != null) {
File parentFile = new File(parentDir);
- if (!SecuritySupport.getFileExists(parentFile))
+ if (!SecuritySupport.doesFileExist(parentFile))
parentFile.mkdirs();
}
}
--- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMsg.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMsg.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,6 @@
/*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -20,13 +21,12 @@
package com.sun.org.apache.xalan.internal.xsltc.compiler.util;
-import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
+import com.sun.org.apache.xalan.internal.xsltc.compiler.Stylesheet;
+import com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode;
import java.text.MessageFormat;
import java.util.Locale;
import java.util.ResourceBundle;
-
-import com.sun.org.apache.xalan.internal.xsltc.compiler.Stylesheet;
-import com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode;
+import jdk.xml.internal.SecuritySupport;
/**
* @author Jacek Ambroziak
--- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/Util.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/Util.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,6 +1,6 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -21,12 +21,11 @@
package com.sun.org.apache.xalan.internal.xsltc.compiler.util;
-import java.util.StringTokenizer;
-
import com.sun.org.apache.bcel.internal.generic.Type;
-import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants;
import com.sun.org.apache.xml.internal.utils.XML11Char;
+import java.util.StringTokenizer;
+import jdk.xml.internal.SecuritySupport;
/**
* @author Jacek Ambroziak
--- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/LoadDocument.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/LoadDocument.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,6 +1,6 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -22,10 +22,6 @@
package com.sun.org.apache.xalan.internal.xsltc.dom;
import com.sun.org.apache.xalan.internal.XalanConstants;
-import java.io.FileNotFoundException;
-
-import javax.xml.transform.stream.StreamSource;
-
import com.sun.org.apache.xalan.internal.xsltc.DOM;
import com.sun.org.apache.xalan.internal.xsltc.DOMCache;
import com.sun.org.apache.xalan.internal.xsltc.DOMEnhancedForDTM;
@@ -33,16 +29,14 @@
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
import com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet;
import com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl;
-import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import com.sun.org.apache.xml.internal.dtm.DTM;
import com.sun.org.apache.xml.internal.dtm.DTMAxisIterator;
import com.sun.org.apache.xml.internal.dtm.DTMManager;
-import com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBase;
import com.sun.org.apache.xml.internal.dtm.ref.EmptyIterator;
import com.sun.org.apache.xml.internal.utils.SystemIDResolver;
-
-import org.xml.sax.InputSource;
-import org.xml.sax.XMLReader;
+import java.io.FileNotFoundException;
+import javax.xml.transform.stream.StreamSource;
+import jdk.xml.internal.SecuritySupport;
/**
* @author Morten Jorgensen
--- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/NodeSortRecord.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/NodeSortRecord.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -20,17 +21,16 @@
package com.sun.org.apache.xalan.internal.xsltc.dom;
-import java.text.CollationKey;
-import java.text.Collator;
-import java.util.Locale;
-
+import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
import com.sun.org.apache.xalan.internal.xsltc.CollatorFactory;
import com.sun.org.apache.xalan.internal.xsltc.DOM;
import com.sun.org.apache.xalan.internal.xsltc.TransletException;
import com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet;
import com.sun.org.apache.xml.internal.utils.StringComparable;
-import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
-import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
+import java.text.CollationKey;
+import java.text.Collator;
+import java.util.Locale;
+import jdk.xml.internal.SecuritySupport;
/**
* Base class for sort records containing application specific sort keys
--- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -23,7 +24,23 @@
package com.sun.org.apache.xalan.internal.xsltc.runtime;
-import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
+import com.sun.org.apache.xalan.internal.xsltc.DOM;
+import com.sun.org.apache.xalan.internal.xsltc.Translet;
+import com.sun.org.apache.xalan.internal.xsltc.dom.AbsoluteIterator;
+import com.sun.org.apache.xalan.internal.xsltc.dom.ArrayNodeListIterator;
+import com.sun.org.apache.xalan.internal.xsltc.dom.DOMAdapter;
+import com.sun.org.apache.xalan.internal.xsltc.dom.MultiDOM;
+import com.sun.org.apache.xalan.internal.xsltc.dom.SingletonIterator;
+import com.sun.org.apache.xalan.internal.xsltc.dom.StepIterator;
+import com.sun.org.apache.xml.internal.dtm.Axis;
+import com.sun.org.apache.xml.internal.dtm.DTM;
+import com.sun.org.apache.xml.internal.dtm.DTMAxisIterator;
+import com.sun.org.apache.xml.internal.dtm.DTMManager;
+import com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBase;
+import com.sun.org.apache.xml.internal.dtm.ref.DTMNodeProxy;
+import com.sun.org.apache.xml.internal.serializer.NamespaceMappings;
+import com.sun.org.apache.xml.internal.serializer.SerializationHandler;
+import com.sun.org.apache.xml.internal.utils.XML11Char;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.FieldPosition;
@@ -33,31 +50,13 @@
import java.util.ResourceBundle;
import java.util.concurrent.atomic.AtomicInteger;
import javax.xml.transform.dom.DOMSource;
-
-import com.sun.org.apache.xalan.internal.xsltc.DOM;
-import com.sun.org.apache.xalan.internal.xsltc.Translet;
-import com.sun.org.apache.xalan.internal.xsltc.dom.AbsoluteIterator;
-import com.sun.org.apache.xml.internal.dtm.Axis;
-import com.sun.org.apache.xalan.internal.xsltc.dom.DOMAdapter;
-import com.sun.org.apache.xalan.internal.xsltc.dom.MultiDOM;
-import com.sun.org.apache.xalan.internal.xsltc.dom.SingletonIterator;
-import com.sun.org.apache.xalan.internal.xsltc.dom.StepIterator;
-import com.sun.org.apache.xalan.internal.xsltc.dom.ArrayNodeListIterator;
-import com.sun.org.apache.xml.internal.dtm.DTM;
-import com.sun.org.apache.xml.internal.dtm.DTMAxisIterator;
-import com.sun.org.apache.xml.internal.dtm.DTMManager;
-import com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBase;
-import com.sun.org.apache.xml.internal.dtm.ref.DTMNodeProxy;
-
+import jdk.xml.internal.SecuritySupport;
+import org.w3c.dom.Attr;
import org.w3c.dom.DOMException;
-import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
-import com.sun.org.apache.xml.internal.serializer.NamespaceMappings;
-import com.sun.org.apache.xml.internal.serializer.SerializationHandler;
-import com.sun.org.apache.xml.internal.utils.XML11Char;
/**
* Standard XSLT functions. All standard functions expect the current node
--- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/output/WriterOutputBuffer.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/output/WriterOutputBuffer.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,6 +1,6 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -21,10 +21,10 @@
package com.sun.org.apache.xalan.internal.xsltc.runtime.output;
-import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.Writer;
+import jdk.xml.internal.SecuritySupport;
/**
* @author Santiago Pericas-Geertsen
--- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -25,7 +26,6 @@
import com.sun.org.apache.xalan.internal.XalanConstants;
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
-import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import com.sun.org.apache.xalan.internal.xsltc.DOM;
import com.sun.org.apache.xalan.internal.xsltc.Translet;
import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants;
@@ -41,8 +41,8 @@
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
+import java.lang.module.ModuleReader;
import java.lang.module.ModuleReference;
-import java.lang.module.ModuleReader;
import java.lang.reflect.InvocationTargetException;
import java.security.AccessController;
import java.security.CodeSigner;
@@ -61,6 +61,7 @@
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.URIResolver;
+import jdk.xml.internal.SecuritySupport;
/**
--- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,6 @@
/*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -24,10 +25,9 @@
import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
import com.sun.org.apache.xalan.internal.utils.FeaturePropertyBase;
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
-import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
+import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager.Property;
import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager;
-import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager.Property;
import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants;
import com.sun.org.apache.xalan.internal.xsltc.compiler.SourceLoader;
import com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC;
@@ -52,8 +52,8 @@
import java.util.zip.ZipFile;
import javax.xml.XMLConstants;
import javax.xml.catalog.CatalogException;
+import javax.xml.catalog.CatalogFeatures.Feature;
import javax.xml.catalog.CatalogFeatures;
-import javax.xml.catalog.CatalogFeatures.Feature;
import javax.xml.catalog.CatalogManager;
import javax.xml.catalog.CatalogResolver;
import javax.xml.parsers.SAXParser;
@@ -78,6 +78,7 @@
import javax.xml.transform.stream.StreamSource;
import jdk.xml.internal.JdkXmlFeatures;
import jdk.xml.internal.JdkXmlUtils;
+import jdk.xml.internal.SecuritySupport;
import org.xml.sax.InputSource;
import org.xml.sax.XMLFilter;
import org.xml.sax.XMLReader;
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/CoreDocumentImpl.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/CoreDocumentImpl.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -24,7 +25,6 @@
import com.sun.org.apache.xerces.internal.util.XML11Char;
import com.sun.org.apache.xerces.internal.util.XMLChar;
import com.sun.org.apache.xerces.internal.utils.ObjectFactory;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import com.sun.org.apache.xerces.internal.xni.NamespaceContext;
import java.io.IOException;
import java.io.ObjectInputStream;
@@ -34,6 +34,7 @@
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
+import jdk.xml.internal.SecuritySupport;
import org.w3c.dom.Attr;
import org.w3c.dom.CDATASection;
import org.w3c.dom.Comment;
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DOMConfigurationImpl.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DOMConfigurationImpl.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,6 @@
/*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -54,7 +55,6 @@
import javax.xml.XMLConstants;
import javax.xml.catalog.CatalogFeatures;
import jdk.xml.internal.JdkXmlUtils;
-import jdk.xml.internal.SecuritySupport;
import org.w3c.dom.DOMConfiguration;
import org.w3c.dom.DOMErrorHandler;
import org.w3c.dom.DOMException;
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DOMMessageFormatter.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DOMMessageFormatter.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,6 +1,6 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -21,10 +21,10 @@
package com.sun.org.apache.xerces.internal.dom;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
+import jdk.xml.internal.SecuritySupport;
/**
* Used to format DOM error messages, using the system locale.
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/Constants.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/Constants.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,6 @@
/*
- * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -20,9 +21,9 @@
package com.sun.org.apache.xerces.internal.impl;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.Enumeration;
import java.util.NoSuchElementException;
+import jdk.xml.internal.SecuritySupport;
/**
* Commonly used constants.
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/PropertyManager.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/PropertyManager.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -35,7 +35,6 @@
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLResolver;
import jdk.xml.internal.JdkXmlUtils;
-import jdk.xml.internal.SecuritySupport;
/**
* This class manages different properties related to Stax specification and its implementation.
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,6 @@
/*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
@@ -27,6 +28,10 @@
import com.sun.org.apache.xerces.internal.util.XMLChar;
import com.sun.org.apache.xerces.internal.util.XMLStringBuffer;
import com.sun.org.apache.xerces.internal.util.XMLSymbols;
+import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.Limit;
+import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
+import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
+import com.sun.org.apache.xerces.internal.xni.Augmentations;
import com.sun.org.apache.xerces.internal.xni.QName;
import com.sun.org.apache.xerces.internal.xni.XMLAttributes;
import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler;
@@ -38,11 +43,6 @@
import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentScanner;
import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
-import com.sun.org.apache.xerces.internal.xni.Augmentations;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
-import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
-import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.Limit;
-import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
import com.sun.xml.internal.stream.XMLBufferListener;
import com.sun.xml.internal.stream.XMLEntityStorage;
import com.sun.xml.internal.stream.dtd.DTDGrammarUtil;
@@ -53,6 +53,7 @@
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.events.XMLEvent;
import jdk.xml.internal.JdkXmlUtils;
+import jdk.xml.internal.SecuritySupport;
/**
*
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
@@ -27,7 +28,6 @@
import com.sun.org.apache.xerces.internal.util.XMLChar;
import com.sun.org.apache.xerces.internal.util.XMLResourceIdentifierImpl;
import com.sun.org.apache.xerces.internal.util.XMLStringBuffer;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import com.sun.org.apache.xerces.internal.xni.Augmentations;
import com.sun.org.apache.xerces.internal.xni.NamespaceContext;
import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier;
@@ -43,6 +43,7 @@
import java.io.IOException;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.events.XMLEvent;
+import jdk.xml.internal.SecuritySupport;
/**
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -27,7 +28,6 @@
import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager;
import com.sun.org.apache.xerces.internal.util.*;
import com.sun.org.apache.xerces.internal.util.URI;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import com.sun.org.apache.xerces.internal.utils.XMLLimitAnalyzer;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
@@ -52,13 +52,14 @@
import java.util.StringTokenizer;
import javax.xml.XMLConstants;
import javax.xml.catalog.CatalogException;
+import javax.xml.catalog.CatalogFeatures.Feature;
import javax.xml.catalog.CatalogFeatures;
-import javax.xml.catalog.CatalogFeatures.Feature;
import javax.xml.catalog.CatalogManager;
import javax.xml.catalog.CatalogResolver;
import javax.xml.stream.XMLInputFactory;
import javax.xml.transform.Source;
import jdk.xml.internal.JdkXmlUtils;
+import jdk.xml.internal.SecuritySupport;
import org.xml.sax.InputSource;
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/dv/DatatypeException.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/dv/DatatypeException.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,6 +1,6 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -21,10 +21,10 @@
package com.sun.org.apache.xerces.internal.impl.dv;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
+import java.util.MissingResourceException;
+import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
-import java.util.PropertyResourceBundle;
-import java.util.MissingResourceException;
+import jdk.xml.internal.SecuritySupport;
/**
* Base class for datatype exceptions. For DTD types, the exception can be
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,6 +1,6 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -22,10 +22,10 @@
package com.sun.org.apache.xerces.internal.impl.msg;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
+import jdk.xml.internal.SecuritySupport;
/**
* XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_de.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_de.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,6 +1,6 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -21,13 +21,12 @@
package com.sun.org.apache.xerces.internal.impl.msg;
+import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import java.util.Locale;
import java.util.MissingResourceException;
+import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
-import java.util.PropertyResourceBundle;
-
-import com.sun.org.apache.xerces.internal.util.MessageFormatter;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
+import jdk.xml.internal.SecuritySupport;
/**
* XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_es.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_es.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,6 +1,6 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -21,13 +21,12 @@
package com.sun.org.apache.xerces.internal.impl.msg;
+import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import java.util.Locale;
import java.util.MissingResourceException;
+import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
-import java.util.PropertyResourceBundle;
-
-import com.sun.org.apache.xerces.internal.util.MessageFormatter;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
+import jdk.xml.internal.SecuritySupport;
/**
* XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_fr.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_fr.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,6 +1,6 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -21,13 +21,12 @@
package com.sun.org.apache.xerces.internal.impl.msg;
+import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import java.util.Locale;
import java.util.MissingResourceException;
+import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
-import java.util.PropertyResourceBundle;
-
-import com.sun.org.apache.xerces.internal.util.MessageFormatter;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
+import jdk.xml.internal.SecuritySupport;
/**
* XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_it.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_it.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,6 +1,6 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -21,13 +21,12 @@
package com.sun.org.apache.xerces.internal.impl.msg;
+import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import java.util.Locale;
import java.util.MissingResourceException;
+import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
-import java.util.PropertyResourceBundle;
-
-import com.sun.org.apache.xerces.internal.util.MessageFormatter;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
+import jdk.xml.internal.SecuritySupport;
/**
* XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_ja.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_ja.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,6 +1,6 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -21,13 +21,12 @@
package com.sun.org.apache.xerces.internal.impl.msg;
+import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import java.util.Locale;
import java.util.MissingResourceException;
+import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
-import java.util.PropertyResourceBundle;
-
-import com.sun.org.apache.xerces.internal.util.MessageFormatter;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
+import jdk.xml.internal.SecuritySupport;
/**
* XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_ko.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_ko.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,6 +1,6 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -21,13 +21,12 @@
package com.sun.org.apache.xerces.internal.impl.msg;
+import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import java.util.Locale;
import java.util.MissingResourceException;
+import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
-import java.util.PropertyResourceBundle;
-
-import com.sun.org.apache.xerces.internal.util.MessageFormatter;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
+import jdk.xml.internal.SecuritySupport;
/**
* XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_pt_BR.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_pt_BR.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,6 +1,6 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -21,13 +21,12 @@
package com.sun.org.apache.xerces.internal.impl.msg;
+import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import java.util.Locale;
import java.util.MissingResourceException;
+import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
-import java.util.PropertyResourceBundle;
-
-import com.sun.org.apache.xerces.internal.util.MessageFormatter;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
+import jdk.xml.internal.SecuritySupport;
/**
* XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_sv.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_sv.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,6 +1,6 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -21,13 +21,12 @@
package com.sun.org.apache.xerces.internal.impl.msg;
+import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import java.util.Locale;
import java.util.MissingResourceException;
+import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
-import java.util.PropertyResourceBundle;
-
-import com.sun.org.apache.xerces.internal.util.MessageFormatter;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
+import jdk.xml.internal.SecuritySupport;
/**
* XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_zh_CN.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_zh_CN.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,6 +1,6 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -21,13 +21,12 @@
package com.sun.org.apache.xerces.internal.impl.msg;
+import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import java.util.Locale;
import java.util.MissingResourceException;
+import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
-import java.util.PropertyResourceBundle;
-
-import com.sun.org.apache.xerces.internal.util.MessageFormatter;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
+import jdk.xml.internal.SecuritySupport;
/**
* XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_zh_TW.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessageFormatter_zh_TW.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,6 +1,6 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -21,13 +21,12 @@
package com.sun.org.apache.xerces.internal.impl.msg;
+import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import java.util.Locale;
import java.util.MissingResourceException;
+import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
-import java.util.PropertyResourceBundle;
-
-import com.sun.org.apache.xerces.internal.util.MessageFormatter;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
+import jdk.xml.internal.SecuritySupport;
/**
* XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xpath/regex/RegexParser.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xpath/regex/RegexParser.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,6 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -20,11 +21,11 @@
package com.sun.org.apache.xerces.internal.impl.xpath.regex;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
+import java.util.ArrayList;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
-import java.util.ArrayList;
+import jdk.xml.internal.SecuritySupport;
/**
* A Regular Expression Parser.
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaLoader.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaLoader.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,6 @@
/*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -41,7 +42,6 @@
import com.sun.org.apache.xerces.internal.util.SymbolTable;
import com.sun.org.apache.xerces.internal.util.URI.MalformedURIException;
import com.sun.org.apache.xerces.internal.util.XMLSymbols;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
import com.sun.org.apache.xerces.internal.xni.QName;
@@ -77,6 +77,7 @@
import java.util.WeakHashMap;
import javax.xml.XMLConstants;
import jdk.xml.internal.JdkXmlUtils;
+import jdk.xml.internal.SecuritySupport;
import org.w3c.dom.DOMConfiguration;
import org.w3c.dom.DOMError;
import org.w3c.dom.DOMErrorHandler;
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaValidator.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaValidator.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,6 @@
/*
- * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -87,7 +88,6 @@
import java.util.Vector;
import javax.xml.XMLConstants;
import jdk.xml.internal.JdkXmlUtils;
-import jdk.xml.internal.SecuritySupport;
/**
* The XML Schema validator. The validator implements a document
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XSMessageFormatter.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XSMessageFormatter.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,6 +1,6 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -22,10 +22,10 @@
package com.sun.org.apache.xerces.internal.impl.xs;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
+import jdk.xml.internal.SecuritySupport;
/**
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/opti/SchemaParsingConfig.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/opti/SchemaParsingConfig.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,6 @@
/*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -20,9 +21,6 @@
package com.sun.org.apache.xerces.internal.impl.xs.opti;
-import java.io.IOException;
-import java.util.Locale;
-
import com.sun.org.apache.xerces.internal.impl.Constants;
import com.sun.org.apache.xerces.internal.impl.XML11DTDScannerImpl;
import com.sun.org.apache.xerces.internal.impl.XML11NSDocumentScannerImpl;
@@ -50,6 +48,8 @@
import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentScanner;
import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
import com.sun.org.apache.xerces.internal.xni.parser.XMLPullParserConfiguration;
+import java.io.IOException;
+import java.util.Locale;
import javax.xml.XMLConstants;
import jdk.xml.internal.JdkXmlUtils;
import jdk.xml.internal.SecuritySupport;
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -61,7 +62,6 @@
import com.sun.org.apache.xerces.internal.util.SymbolTable;
import com.sun.org.apache.xerces.internal.util.URI.MalformedURIException;
import com.sun.org.apache.xerces.internal.util.XMLSymbols;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
import com.sun.org.apache.xerces.internal.xni.QName;
@@ -107,6 +107,7 @@
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import jdk.xml.internal.JdkXmlUtils;
+import jdk.xml.internal.SecuritySupport;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java Mon Oct 09 11:38:46 2017 -0700
@@ -26,7 +26,6 @@
package com.sun.org.apache.xerces.internal.jaxp.datatype;
import com.sun.org.apache.xerces.internal.util.DatatypeMessageFormatter;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serializable;
@@ -42,6 +41,7 @@
import javax.xml.datatype.Duration;
import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.namespace.QName;
+import jdk.xml.internal.SecuritySupport;
/**
* <p>Representation for W3C XML Schema 1.0 date/time datatypes.
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/JAXPValidationMessageFormatter.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/JAXPValidationMessageFormatter.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,6 +1,6 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -21,10 +21,10 @@
package com.sun.org.apache.xerces.internal.jaxp.validation;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
+import jdk.xml.internal.SecuritySupport;
/**
* <p>Used to format JAXP Validation API error messages using a specified locale.</p>
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -68,7 +69,6 @@
import javax.xml.XMLConstants;
import javax.xml.catalog.CatalogFeatures;
import jdk.xml.internal.JdkXmlUtils;
-import jdk.xml.internal.SecuritySupport;
/**
* This class is the configuration used to parse XML 1.0 and XML 1.1 documents.
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/DatatypeMessageFormatter.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/DatatypeMessageFormatter.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,6 +1,6 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -21,10 +21,10 @@
package com.sun.org.apache.xerces.internal.util;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
+import jdk.xml.internal.SecuritySupport;
/**
* <p>Used to format JAXP 1.3 Datatype API error messages using a specified locale.</p>
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/SAXMessageFormatter.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/SAXMessageFormatter.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,6 +1,6 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -21,10 +21,10 @@
package com.sun.org.apache.xerces.internal.util;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
+import jdk.xml.internal.SecuritySupport;
/**
* Used to format SAX error messages using a specified locale.
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/ObjectFactory.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/ObjectFactory.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,6 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -21,6 +22,7 @@
package com.sun.org.apache.xerces.internal.utils;
import java.util.function.Supplier;
+import jdk.xml.internal.SecuritySupport;
/**
* This class is duplicated for each JAXP subpackage so keep it in sync.
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java Mon Oct 09 10:42:27 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,295 +0,0 @@
-/*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.org.apache.xerces.internal.utils;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.Properties;
-import java.util.PropertyResourceBundle;
-import java.util.ResourceBundle;
-
-/**
- * This class is duplicated for each subpackage so keep it in sync.
- * It is package private and therefore is not exposed as part of any API.
- *
- * @xerces.internal
- */
-public final class SecuritySupport {
-
- private static final SecuritySupport securitySupport = new SecuritySupport();
-
- /**
- * Return an instance of this class.
- * @return an instance of this class
- */
- public static SecuritySupport getInstance() {
- return securitySupport;
- }
-
- static ClassLoader getContextClassLoader() {
- return AccessController.doPrivileged((PrivilegedAction<ClassLoader>) () -> {
- ClassLoader cl = null;
- try {
- cl = Thread.currentThread().getContextClassLoader();
- } catch (SecurityException ex) { }
- return cl;
- });
- }
-
- static ClassLoader getSystemClassLoader() {
- return AccessController.doPrivileged((PrivilegedAction<ClassLoader>) () -> {
- ClassLoader cl = null;
- try {
- cl = ClassLoader.getSystemClassLoader();
- } catch (SecurityException ex) {}
- return cl;
- });
- }
-
- static ClassLoader getParentClassLoader(final ClassLoader cl) {
- return AccessController.doPrivileged((PrivilegedAction<ClassLoader>) () -> {
- ClassLoader parent = null;
- try {
- parent = cl.getParent();
- } catch (SecurityException ex) {}
-
- // eliminate loops in case of the boot
- // ClassLoader returning itself as a parent
- return (parent == cl) ? null : parent;
- });
- }
-
- public static String getSystemProperty(final String propName) {
- return AccessController.doPrivileged((PrivilegedAction<String>) () ->
- System.getProperty(propName));
- }
-
- static FileInputStream getFileInputStream(final File file)
- throws FileNotFoundException
- {
- try {
- return AccessController.doPrivileged(
- (PrivilegedExceptionAction<FileInputStream>)() ->
- new FileInputStream(file));
- } catch (PrivilegedActionException e) {
- throw (FileNotFoundException)e.getException();
- }
- }
-
- /**
- * Gets a resource bundle using the specified base name, the default locale, and the caller's class loader.
- * @param bundle the base name of the resource bundle, a fully qualified class name
- * @return a resource bundle for the given base name and the default locale
- */
- public static ResourceBundle getResourceBundle(String bundle) {
- return getResourceBundle(bundle, Locale.getDefault());
- }
-
- /**
- * Gets a resource bundle using the specified base name and locale, and the caller's class loader.
- * @param bundle the base name of the resource bundle, a fully qualified class name
- * @param locale the locale for which a resource bundle is desired
- * @return a resource bundle for the given base name and locale
- */
- public static ResourceBundle getResourceBundle(final String bundle, final Locale locale) {
- return AccessController.doPrivileged((PrivilegedAction<ResourceBundle>) () -> {
- try {
- return PropertyResourceBundle.getBundle(bundle, locale);
- } catch (MissingResourceException e) {
- try {
- return PropertyResourceBundle.getBundle(bundle, new Locale("en", "US"));
- } catch (MissingResourceException e2) {
- throw new MissingResourceException(
- "Could not load any resource bundle by " + bundle, bundle, "");
- }
- }
- });
- }
-
- static boolean getFileExists(final File f) {
- return (AccessController.doPrivileged((PrivilegedAction<Boolean>) () ->
- f.exists()));
- }
-
- static long getLastModified(final File f) {
- return (AccessController.doPrivileged((PrivilegedAction<Long>) () ->
- f.lastModified()));
- }
-
- /**
- * Strip off path from an URI
- *
- * @param uri an URI with full path
- * @return the file name only
- */
- public static String sanitizePath(String uri) {
- if (uri == null) {
- return "";
- }
- int i = uri.lastIndexOf("/");
- if (i > 0) {
- return uri.substring(i+1, uri.length());
- }
- return uri;
- }
-
- /**
- * Check the protocol used in the systemId against allowed protocols
- *
- * @param systemId the Id of the URI
- * @param allowedProtocols a list of allowed protocols separated by comma
- * @param accessAny keyword to indicate allowing any protocol
- * @return the name of the protocol if rejected, null otherwise
- * @throws java.io.IOException
- */
- public static String checkAccess(String systemId, String allowedProtocols, String accessAny) throws IOException {
- if (systemId == null || (allowedProtocols != null &&
- allowedProtocols.equalsIgnoreCase(accessAny))) {
- return null;
- }
-
- String protocol;
- if (!systemId.contains(":")) {
- protocol = "file";
- } else {
- URL url = new URL(systemId);
- protocol = url.getProtocol();
- if (protocol.equalsIgnoreCase("jar")) {
- String path = url.getPath();
- protocol = path.substring(0, path.indexOf(":"));
- } else if (protocol.equalsIgnoreCase("jrt")) {
- // if the systemId is "jrt" then allow access if "file" allowed
- protocol = "file";
- }
- }
-
- if (isProtocolAllowed(protocol, allowedProtocols)) {
- //access allowed
- return null;
- } else {
- return protocol;
- }
- }
-
- /**
- * Check if the protocol is in the allowed list of protocols. The check
- * is case-insensitive while ignoring whitespaces.
- *
- * @param protocol a protocol
- * @param allowedProtocols a list of allowed protocols
- * @return true if the protocol is in the list
- */
- private static boolean isProtocolAllowed(String protocol, String allowedProtocols) {
- if (allowedProtocols == null) {
- return false;
- }
- String temp[] = allowedProtocols.split(",");
- for (String t : temp) {
- t = t.trim();
- if (t.equalsIgnoreCase(protocol)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Read JAXP system property in this order: system property,
- * $java.home/conf/jaxp.properties if the system property is not specified
- *
- * @param sysPropertyId the Id of the property
- * @return the value of the property
- */
- public static String getJAXPSystemProperty(String sysPropertyId) {
- String value = getSystemProperty(sysPropertyId);
- if (value == null) {
- value = readJAXPProperty(sysPropertyId);
- }
- return value;
- }
-
- /**
- * Read from $java.home/conf/jaxp.properties for the specified property
- * The program
- *
- * @param propertyId the Id of the property
- * @return the value of the property
- */
- static String readJAXPProperty(String propertyId) {
- String value = null;
- InputStream is = null;
- try {
- if (firstTime) {
- synchronized (cacheProps) {
- if (firstTime) {
- String configFile = getSystemProperty("java.home") + File.separator +
- "conf" + File.separator + "jaxp.properties";
- File f = new File(configFile);
- if (getFileExists(f)) {
- is = getFileInputStream(f);
- cacheProps.load(is);
- }
- firstTime = false;
- }
- }
- }
- value = cacheProps.getProperty(propertyId);
-
- }
- catch (IOException ex) {}
- finally {
- if (is != null) {
- try {
- is.close();
- } catch (IOException ex) {}
- }
- }
-
- return value;
- }
-
- /**
- * Cache for properties in java.home/conf/jaxp.properties
- */
- static final Properties cacheProps = new Properties();
-
- /**
- * Flag indicating if the program has tried reading java.home/conf/jaxp.properties
- */
- static volatile boolean firstTime = true;
-
- private SecuritySupport () {}
-}
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/XMLSecurityManager.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/XMLSecurityManager.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
import com.sun.org.apache.xerces.internal.impl.Constants;
import com.sun.org.apache.xerces.internal.util.SecurityManager;
import java.util.concurrent.CopyOnWriteArrayList;
+import jdk.xml.internal.SecuritySupport;
import org.xml.sax.SAXException;
/**
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/XMLSecurityPropertyManager.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/XMLSecurityPropertyManager.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
import com.sun.org.apache.xerces.internal.impl.Constants;
import javax.xml.XMLConstants;
+import jdk.xml.internal.SecuritySupport;
/**
* This class manages security related properties
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/SecuritySupport.java Mon Oct 09 10:42:27 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,134 +0,0 @@
-/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
- */
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xerces.internal.xinclude;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-/**
- * This class is duplicated for each subpackage so keep it in sync.
- * It is package private and therefore is not exposed as part of any API.
- *
- * @xerces.internal
- */
-final class SecuritySupport {
-
- private static final SecuritySupport securitySupport = new SecuritySupport();
-
- /**
- * Return an instance of this class.
- */
- static SecuritySupport getInstance() {
- return securitySupport;
- }
-
- ClassLoader getContextClassLoader() {
- return (ClassLoader)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- ClassLoader cl = null;
- try {
- cl = Thread.currentThread().getContextClassLoader();
- } catch (SecurityException ex) { }
- return cl;
- }
- });
- }
-
- ClassLoader getSystemClassLoader() {
- return (ClassLoader)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- ClassLoader cl = null;
- try {
- cl = ClassLoader.getSystemClassLoader();
- } catch (SecurityException ex) {}
- return cl;
- }
- });
- }
-
- ClassLoader getParentClassLoader(final ClassLoader cl) {
- return (ClassLoader)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- ClassLoader parent = null;
- try {
- parent = cl.getParent();
- } catch (SecurityException ex) {}
-
- // eliminate loops in case of the boot
- // ClassLoader returning itself as a parent
- return (parent == cl) ? null : parent;
- }
- });
- }
-
- String getSystemProperty(final String propName) {
- return (String)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return System.getProperty(propName);
- }
- });
- }
-
- FileInputStream getFileInputStream(final File file)
- throws FileNotFoundException
- {
- try {
- return (FileInputStream)
- AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws FileNotFoundException {
- return new FileInputStream(file);
- }
- });
- } catch (PrivilegedActionException e) {
- throw (FileNotFoundException)e.getException();
- }
- }
-
- boolean getFileExists(final File f) {
- return ((Boolean)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return f.exists();
- }
- })).booleanValue();
- }
-
- long getLastModified(final File f) {
- return ((Long)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return f.lastModified();
- }
- })).longValue();
- }
-
- private SecuritySupport () {}
-}
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XIncludeMessageFormatter.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XIncludeMessageFormatter.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,6 +1,6 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -22,10 +22,10 @@
package com.sun.org.apache.xerces.internal.xinclude;
import com.sun.org.apache.xerces.internal.util.MessageFormatter;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
+import jdk.xml.internal.SecuritySupport;
// TODO: fix error messages in XIncludeMessages.properties
/**
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xpointer/XPointerMessageFormatter.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xpointer/XPointerMessageFormatter.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,6 +1,6 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -21,12 +21,12 @@
package com.sun.org.apache.xerces.internal.xpointer;
+import com.sun.org.apache.xerces.internal.util.MessageFormatter;
import java.util.Locale;
import java.util.MissingResourceException;
+import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
-import java.util.PropertyResourceBundle;
-import com.sun.org.apache.xerces.internal.util.MessageFormatter;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
+import jdk.xml.internal.SecuritySupport;
/**
* XPointerMessageFormatter provides error messages for the XPointer Framework
--- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/res/XMLMessages.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/res/XMLMessages.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,6 +1,6 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -21,9 +21,9 @@
package com.sun.org.apache.xml.internal.res;
-import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
-import java.util.ListResourceBundle;
import java.util.Locale;
+import java.util.ResourceBundle;
+import jdk.xml.internal.SecuritySupport;
/**
* A utility class for issuing XML error messages.
@@ -36,7 +36,7 @@
protected Locale fLocale = Locale.getDefault();
/** The language specific resource object for XML messages. */
- private static ListResourceBundle XMLBundle = null;
+ private static ResourceBundle XMLBundle = null;
/** The class name of the XML error message string table. */
private static final String XML_ERROR_RESOURCES =
@@ -103,7 +103,7 @@
*
* @return The formatted message string.
*/
- public static final String createMsg(ListResourceBundle fResourceBundle,
+ public static final String createMsg(ResourceBundle fResourceBundle,
String msgKey, Object args[]) //throws Exception
{
--- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/SecuritySupport.java Mon Oct 09 10:42:27 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,134 +0,0 @@
-/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
- */
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.serialize;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-/**
- * This class is duplicated for each subpackage so keep it in sync.
- * It is package private and therefore is not exposed as part of any API.
- *
- * @xerces.internal
- */
-final class SecuritySupport {
-
- private static final SecuritySupport securitySupport = new SecuritySupport();
-
- /**
- * Return an instance of this class.
- */
- static SecuritySupport getInstance() {
- return securitySupport;
- }
-
- ClassLoader getContextClassLoader() {
- return (ClassLoader)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- ClassLoader cl = null;
- try {
- cl = Thread.currentThread().getContextClassLoader();
- } catch (SecurityException ex) { }
- return cl;
- }
- });
- }
-
- ClassLoader getSystemClassLoader() {
- return (ClassLoader)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- ClassLoader cl = null;
- try {
- cl = ClassLoader.getSystemClassLoader();
- } catch (SecurityException ex) {}
- return cl;
- }
- });
- }
-
- ClassLoader getParentClassLoader(final ClassLoader cl) {
- return (ClassLoader)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- ClassLoader parent = null;
- try {
- parent = cl.getParent();
- } catch (SecurityException ex) {}
-
- // eliminate loops in case of the boot
- // ClassLoader returning itself as a parent
- return (parent == cl) ? null : parent;
- }
- });
- }
-
- String getSystemProperty(final String propName) {
- return (String)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return System.getProperty(propName);
- }
- });
- }
-
- FileInputStream getFileInputStream(final File file)
- throws FileNotFoundException
- {
- try {
- return (FileInputStream)
- AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws FileNotFoundException {
- return new FileInputStream(file);
- }
- });
- } catch (PrivilegedActionException e) {
- throw (FileNotFoundException)e.getException();
- }
- }
-
- boolean getFileExists(final File f) {
- return ((Boolean)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return f.exists();
- }
- })).booleanValue();
- }
-
- long getLastModified(final File f) {
- return ((Long)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return f.lastModified();
- }
- })).longValue();
- }
-
- private SecuritySupport () {}
-}
--- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/SerializerFactory.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/SerializerFactory.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2015, 2017 Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -22,7 +23,6 @@
package com.sun.org.apache.xml.internal.serialize;
import com.sun.org.apache.xerces.internal.utils.ObjectFactory;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
@@ -30,6 +30,7 @@
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
+import jdk.xml.internal.SecuritySupport;
/**
*
--- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/CharInfo.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/CharInfo.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,6 +1,6 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -21,7 +21,6 @@
package com.sun.org.apache.xml.internal.serializer;
-import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import com.sun.org.apache.xml.internal.serializer.utils.MsgKey;
import com.sun.org.apache.xml.internal.serializer.utils.SystemIDResolver;
import com.sun.org.apache.xml.internal.serializer.utils.Utils;
@@ -37,6 +36,7 @@
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
import javax.xml.transform.TransformerException;
+import jdk.xml.internal.SecuritySupport;
/**
* This class provides services that tell if a character should have
--- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/Encodings.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/Encodings.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,6 +1,6 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -21,27 +21,26 @@
package com.sun.org.apache.xml.internal.serializer;
+import java.io.BufferedWriter;
+import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
-import java.io.BufferedWriter;
+import java.net.MalformedURLException;
import java.net.URL;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Properties;
-import java.util.StringTokenizer;
-import java.io.IOException;
-import java.net.MalformedURLException;
import java.nio.charset.Charset;
import java.nio.charset.IllegalCharsetNameException;
import java.nio.charset.UnsupportedCharsetException;
import java.util.Collections;
-import java.util.Map;
+import java.util.Enumeration;
+import java.util.HashMap;
import java.util.Map.Entry;
-
-import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
+import java.util.Map;
+import java.util.Properties;
+import java.util.StringTokenizer;
+import jdk.xml.internal.SecuritySupport;
/**
* Provides information about encodings. Depends on the Java runtime
--- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/OutputPropertiesFactory.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/OutputPropertiesFactory.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -20,7 +21,9 @@
package com.sun.org.apache.xml.internal.serializer;
-import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
+import com.sun.org.apache.xml.internal.serializer.utils.MsgKey;
+import com.sun.org.apache.xml.internal.serializer.utils.Utils;
+import com.sun.org.apache.xml.internal.serializer.utils.WrappedRuntimeException;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -28,12 +31,8 @@
import java.security.PrivilegedAction;
import java.util.Enumeration;
import java.util.Properties;
-
import javax.xml.transform.OutputKeys;
-
-import com.sun.org.apache.xml.internal.serializer.utils.MsgKey;
-import com.sun.org.apache.xml.internal.serializer.utils.Utils;
-import com.sun.org.apache.xml.internal.serializer.utils.WrappedRuntimeException;
+import jdk.xml.internal.SecuritySupport;
/**
* This class is a factory to generate a set of default properties
--- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToStream.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToStream.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,6 @@
/*
- * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -20,6 +21,9 @@
package com.sun.org.apache.xml.internal.serializer;
+import com.sun.org.apache.xml.internal.serializer.utils.MsgKey;
+import com.sun.org.apache.xml.internal.serializer.utils.Utils;
+import com.sun.org.apache.xml.internal.serializer.utils.WrappedRuntimeException;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
@@ -34,22 +38,16 @@
import java.util.Properties;
import java.util.Set;
import java.util.StringTokenizer;
-
import javax.xml.transform.ErrorListener;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
-
+import jdk.xml.internal.SecuritySupport;
import org.w3c.dom.Node;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
-import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
-import com.sun.org.apache.xml.internal.serializer.utils.MsgKey;
-import com.sun.org.apache.xml.internal.serializer.utils.Utils;
-import com.sun.org.apache.xml.internal.serializer.utils.WrappedRuntimeException;
-
/**
* This abstract class is a base class for other stream
* serializers (xml, html, text ...) that write output to a stream.
--- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/Messages.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/Messages.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,6 +1,6 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -21,11 +21,9 @@
package com.sun.org.apache.xml.internal.serializer.utils;
-import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
-import java.util.ListResourceBundle;
import java.util.Locale;
-import java.util.MissingResourceException;
import java.util.ResourceBundle;
+import jdk.xml.internal.SecuritySupport;
/**
* A utility class for issuing error messages.
@@ -99,7 +97,7 @@
private final Locale m_locale = Locale.getDefault();
/** The language specific resource object for messages. */
- private ListResourceBundle m_resourceBundle;
+ private ResourceBundle m_resourceBundle;
/** The class name of the error message string table with no language suffix. */
private String m_resourceBundleName;
@@ -173,10 +171,8 @@
* @return The formatted message string.
* @xsl.usage internal
*/
- private final String createMsg(
- ListResourceBundle fResourceBundle,
- String msgKey,
- Object args[]) //throws Exception
+ private final String createMsg(ResourceBundle fResourceBundle, String msgKey,
+ Object args[]) //throws Exception
{
String fmsg = null;
--- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,6 @@
/*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -22,7 +23,6 @@
import com.sun.org.apache.xalan.internal.XalanConstants;
import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
-import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
import java.util.HashMap;
import javax.xml.XMLConstants;
@@ -32,6 +32,7 @@
import javax.xml.parsers.SAXParserFactory;
import jdk.xml.internal.JdkXmlFeatures;
import jdk.xml.internal.JdkXmlUtils;
+import jdk.xml.internal.SecuritySupport;
import org.xml.sax.SAXException;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;
--- a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/functions/FuncSystemProperty.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/functions/FuncSystemProperty.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,6 +1,6 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Sep 2017
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -21,15 +21,14 @@
package com.sun.org.apache.xpath.internal.functions;
-import java.io.BufferedInputStream;
-import java.io.InputStream;
-import java.util.Properties;
-
import com.sun.org.apache.xpath.internal.XPathContext;
import com.sun.org.apache.xpath.internal.objects.XObject;
import com.sun.org.apache.xpath.internal.objects.XString;
import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
-import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
+import java.io.BufferedInputStream;
+import java.io.InputStream;
+import java.util.Properties;
+import jdk.xml.internal.SecuritySupport;
/**
* Execute the SystemProperty() function.
--- a/src/java.xml/share/classes/com/sun/xml/internal/stream/XMLEntityStorage.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/xml/internal/stream/XMLEntityStorage.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,11 +32,11 @@
import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter;
import com.sun.org.apache.xerces.internal.util.URI;
import com.sun.org.apache.xerces.internal.util.XMLResourceIdentifierImpl;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
import java.util.HashMap;
import java.util.Map;
+import jdk.xml.internal.SecuritySupport;
/**
*
--- a/src/java.xml/share/classes/com/sun/xml/internal/stream/writers/WriterUtility.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/xml/internal/stream/writers/WriterUtility.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,8 +31,7 @@
import java.io.Writer;
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
-import com.sun.org.apache.xerces.internal.util.XMLChar;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
+import jdk.xml.internal.SecuritySupport;
/**
* Implements common xml writer functions.
--- a/src/java.xml/share/classes/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,12 @@
package com.sun.xml.internal.stream.writers;
+import com.sun.org.apache.xerces.internal.impl.Constants;
+import com.sun.org.apache.xerces.internal.impl.PropertyManager;
+import com.sun.org.apache.xerces.internal.util.NamespaceSupport;
+import com.sun.org.apache.xerces.internal.util.SymbolTable;
+import com.sun.org.apache.xerces.internal.xni.QName;
+import com.sun.xml.internal.stream.util.ReadOnlyIterator;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
@@ -35,26 +41,17 @@
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.Random;
-import java.util.Vector;
import java.util.Set;
-import java.util.Iterator;
-
+import java.util.Vector;
import javax.xml.XMLConstants;
import javax.xml.namespace.NamespaceContext;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
import javax.xml.transform.stream.StreamResult;
-
-import com.sun.org.apache.xerces.internal.impl.Constants;
-import com.sun.org.apache.xerces.internal.impl.PropertyManager;
-import com.sun.org.apache.xerces.internal.util.NamespaceSupport;
-import com.sun.org.apache.xerces.internal.util.SymbolTable;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
-import com.sun.org.apache.xerces.internal.xni.QName;
-
-import com.sun.xml.internal.stream.util.ReadOnlyIterator;
+import jdk.xml.internal.SecuritySupport;
/**
* This class implements a StAX XMLStreamWriter. It extends
--- a/src/java.xml/share/classes/javax/xml/datatype/FactoryFinder.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/javax/xml/datatype/FactoryFinder.java Mon Oct 09 11:38:46 2017 -0700
@@ -33,6 +33,7 @@
import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;
import java.util.function.Supplier;
+import jdk.xml.internal.SecuritySupport;
/**
* <p>Implements pluggable Datatypes.</p>
@@ -61,18 +62,12 @@
*/
private static volatile boolean firstTime = true;
- /**
- * Security support class use to check access control before
- * getting certain system resources.
- */
- private final static SecuritySupport ss = new SecuritySupport();
-
// Define system property "jaxp.debug" to get output
static {
// Use try/catch block to support applets, which throws
// SecurityException out of this code.
try {
- String val = ss.getSystemProperty("jaxp.debug");
+ String val = SecuritySupport.getSystemProperty("jaxp.debug");
// Allow simply setting the prop to turn on debug
debug = val != null && !"false".equals(val);
}
@@ -106,7 +101,7 @@
if (useBSClsLoader) {
return Class.forName(className, false, FactoryFinder.class.getClassLoader());
} else {
- cl = ss.getContextClassLoader();
+ cl = SecuritySupport.getContextClassLoader();
if (cl == null) {
throw new ClassNotFoundException();
}
@@ -227,7 +222,7 @@
// Use the system property first
try {
- String systemProp = ss.getSystemProperty(factoryId);
+ String systemProp = SecuritySupport.getSystemProperty(factoryId);
if (systemProp != null) {
dPrint(()->"found system property, value=" + systemProp);
return newInstance(type, systemProp, null, true);
@@ -242,13 +237,13 @@
if (firstTime) {
synchronized (cacheProps) {
if (firstTime) {
- String configFile = ss.getSystemProperty("java.home") + File.separator +
+ String configFile = SecuritySupport.getSystemProperty("java.home") + File.separator +
"conf" + File.separator + "jaxp.properties";
File f = new File(configFile);
firstTime = false;
- if (ss.doesFileExist(f)) {
+ if (SecuritySupport.doesFileExist(f)) {
dPrint(()->"Read properties file "+f);
- cacheProps.load(ss.getFileInputStream(f));
+ cacheProps.load(SecuritySupport.getFileInputStream(f));
}
}
}
--- a/src/java.xml/share/classes/javax/xml/datatype/SecuritySupport.java Mon Oct 09 10:42:27 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.xml.datatype;
-
-import java.security.*;
-import java.io.*;
-
-/**
- * This class is duplicated for each JAXP subpackage so keep it in sync.
- * It is package private and therefore is not exposed as part of the JAXP
- * API.
- *
- * Security related methods that only work on J2SE 1.2 and newer.
- */
-class SecuritySupport {
-
-
- ClassLoader getContextClassLoader() {
- return (ClassLoader)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- ClassLoader cl = null;
- try {
- cl = Thread.currentThread().getContextClassLoader();
- } catch (SecurityException ex) { }
- return cl;
- }
- });
- }
-
- String getSystemProperty(final String propName) {
- return (String)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return System.getProperty(propName);
- }
- });
- }
-
- FileInputStream getFileInputStream(final File file)
- throws FileNotFoundException
- {
- try {
- return (FileInputStream)
- AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws FileNotFoundException {
- return new FileInputStream(file);
- }
- });
- } catch (PrivilegedActionException e) {
- throw (FileNotFoundException)e.getException();
- }
- }
-
- boolean doesFileExist(final File f) {
- return ((Boolean)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return f.exists();
- }
- })).booleanValue();
- }
-
-}
--- a/src/java.xml/share/classes/javax/xml/parsers/FactoryFinder.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/javax/xml/parsers/FactoryFinder.java Mon Oct 09 11:38:46 2017 -0700
@@ -33,6 +33,7 @@
import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;
import java.util.function.Supplier;
+import jdk.xml.internal.SecuritySupport;
/**
* <p>Implements pluggable Parsers.</p>
@@ -61,18 +62,12 @@
*/
static volatile boolean firstTime = true;
- /**
- * Security support class use to check access control before
- * getting certain system resources.
- */
- private static final SecuritySupport ss = new SecuritySupport();
-
// Define system property "jaxp.debug" to get output
static {
// Use try/catch block to support applets, which throws
// SecurityException out of this code.
try {
- String val = ss.getSystemProperty("jaxp.debug");
+ String val = SecuritySupport.getSystemProperty("jaxp.debug");
// Allow simply setting the prop to turn on debug
debug = val != null && !"false".equals(val);
}
@@ -106,7 +101,7 @@
if (useBSClsLoader) {
return Class.forName(className, false, FactoryFinder.class.getClassLoader());
} else {
- cl = ss.getContextClassLoader();
+ cl = SecuritySupport.getContextClassLoader();
if (cl == null) {
throw new ClassNotFoundException();
}
@@ -226,7 +221,7 @@
// Use the system property first
try {
- String systemProp = ss.getSystemProperty(factoryId);
+ String systemProp = SecuritySupport.getSystemProperty(factoryId);
if (systemProp != null) {
dPrint(()->"found system property, value=" + systemProp);
return newInstance(type, systemProp, null, true);
@@ -241,13 +236,13 @@
if (firstTime) {
synchronized (cacheProps) {
if (firstTime) {
- String configFile = ss.getSystemProperty("java.home") + File.separator +
+ String configFile = SecuritySupport.getSystemProperty("java.home") + File.separator +
"conf" + File.separator + "jaxp.properties";
File f = new File(configFile);
firstTime = false;
- if (ss.doesFileExist(f)) {
+ if (SecuritySupport.doesFileExist(f)) {
dPrint(()->"Read properties file "+f);
- cacheProps.load(ss.getFileInputStream(f));
+ cacheProps.load(SecuritySupport.getFileInputStream(f));
}
}
}
--- a/src/java.xml/share/classes/javax/xml/parsers/SecuritySupport.java Mon Oct 09 10:42:27 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.xml.parsers;
-
-import java.security.*;
-import java.io.*;
-
-/**
- * This class is duplicated for each JAXP subpackage so keep it in sync.
- * It is package private and therefore is not exposed as part of the JAXP
- * API.
- *
- * Security related methods that only work on J2SE 1.2 and newer.
- */
-class SecuritySupport {
-
-
- ClassLoader getContextClassLoader() throws SecurityException{
- return (ClassLoader)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- ClassLoader cl = null;
- //try {
- cl = Thread.currentThread().getContextClassLoader();
- //} catch (SecurityException ex) { }
-
- if (cl == null)
- cl = ClassLoader.getSystemClassLoader();
-
- return cl;
- }
- });
- }
-
- String getSystemProperty(final String propName) {
- return (String)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return System.getProperty(propName);
- }
- });
- }
-
- FileInputStream getFileInputStream(final File file)
- throws FileNotFoundException
- {
- try {
- return (FileInputStream)
- AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws FileNotFoundException {
- return new FileInputStream(file);
- }
- });
- } catch (PrivilegedActionException e) {
- throw (FileNotFoundException)e.getException();
- }
- }
-
- boolean doesFileExist(final File f) {
- return ((Boolean)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return f.exists();
- }
- })).booleanValue();
- }
-
-}
--- a/src/java.xml/share/classes/javax/xml/stream/FactoryFinder.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/javax/xml/stream/FactoryFinder.java Mon Oct 09 11:38:46 2017 -0700
@@ -33,6 +33,7 @@
import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;
import java.util.function.Supplier;
+import jdk.xml.internal.SecuritySupport;
/**
* <p>Implements pluggable streams.</p>
@@ -62,18 +63,12 @@
*/
private static volatile boolean firstTime = true;
- /**
- * Security support class use to check access control before
- * getting certain system resources.
- */
- final private static SecuritySupport ss = new SecuritySupport();
-
// Define system property "jaxp.debug" to get output
static {
// Use try/catch block to support applets, which throws
// SecurityException out of this code.
try {
- String val = ss.getSystemProperty("jaxp.debug");
+ String val = SecuritySupport.getSystemProperty("jaxp.debug");
// Allow simply setting the prop to turn on debug
debug = val != null && !"false".equals(val);
}
@@ -107,7 +102,7 @@
if (useBSClsLoader) {
return Class.forName(className, false, FactoryFinder.class.getClassLoader());
} else {
- cl = ss.getContextClassLoader();
+ cl = SecuritySupport.getContextClassLoader();
if (cl == null) {
throw new ClassNotFoundException();
}
@@ -256,7 +251,7 @@
final String systemProp;
if (type.getName().equals(factoryId)) {
- systemProp = ss.getSystemProperty(factoryId);
+ systemProp = SecuritySupport.getSystemProperty(factoryId);
} else {
systemProp = System.getProperty(factoryId);
}
@@ -277,21 +272,21 @@
if (firstTime) {
synchronized (cacheProps) {
if (firstTime) {
- configFile = ss.getSystemProperty("java.home") + File.separator +
+ configFile = SecuritySupport.getSystemProperty("java.home") + File.separator +
"conf" + File.separator + "stax.properties";
final File fStax = new File(configFile);
firstTime = false;
- if (ss.doesFileExist(fStax)) {
+ if (SecuritySupport.doesFileExist(fStax)) {
dPrint(()->"Read properties file "+fStax);
- cacheProps.load(ss.getFileInputStream(fStax));
+ cacheProps.load(SecuritySupport.getFileInputStream(fStax));
}
else {
- configFile = ss.getSystemProperty("java.home") + File.separator +
+ configFile = SecuritySupport.getSystemProperty("java.home") + File.separator +
"conf" + File.separator + "jaxp.properties";
final File fJaxp = new File(configFile);
- if (ss.doesFileExist(fJaxp)) {
+ if (SecuritySupport.doesFileExist(fJaxp)) {
dPrint(()->"Read properties file "+fJaxp);
- cacheProps.load(ss.getFileInputStream(fJaxp));
+ cacheProps.load(SecuritySupport.getFileInputStream(fJaxp));
}
}
}
--- a/src/java.xml/share/classes/javax/xml/stream/SecuritySupport.java Mon Oct 09 10:42:27 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.xml.stream;
-
-import java.security.*;
-import java.io.*;
-
-/**
- * This class is duplicated for each JAXP subpackage so keep it in sync.
- * It is package private and therefore is not exposed as part of the JAXP
- * API.
- *
- * Security related methods that only work on J2SE 1.2 and newer.
- */
-class SecuritySupport {
-
-
- ClassLoader getContextClassLoader() throws SecurityException{
- return AccessController.doPrivileged((PrivilegedAction<ClassLoader>) () -> {
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
-
- if (cl == null)
- cl = ClassLoader.getSystemClassLoader();
-
- return cl;
- });
- }
-
- String getSystemProperty(final String propName) {
- return AccessController.doPrivileged((PrivilegedAction<String>) () ->
- System.getProperty(propName));
- }
-
- FileInputStream getFileInputStream(final File file)
- throws FileNotFoundException
- {
- try {
- return AccessController.doPrivileged((PrivilegedExceptionAction<FileInputStream>) ()
- -> new FileInputStream(file));
- } catch (PrivilegedActionException e) {
- throw (FileNotFoundException)e.getException();
- }
- }
-
- boolean doesFileExist(final File f) {
- return AccessController.doPrivileged((PrivilegedAction<Boolean>) () -> f.exists());
- }
-
-}
--- a/src/java.xml/share/classes/javax/xml/transform/FactoryFinder.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/javax/xml/transform/FactoryFinder.java Mon Oct 09 11:38:46 2017 -0700
@@ -35,6 +35,7 @@
import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;
import java.util.function.Supplier;
+import jdk.xml.internal.SecuritySupport;
/**
* <p>Implements pluggable Datatypes.</p>
@@ -64,18 +65,12 @@
*/
static volatile boolean firstTime = true;
- /**
- * Security support class use to check access control before
- * getting certain system resources.
- */
- private final static SecuritySupport ss = new SecuritySupport();
-
// Define system property "jaxp.debug" to get output
static {
// Use try/catch block to support applets, which throws
// SecurityException out of this code.
try {
- String val = ss.getSystemProperty("jaxp.debug");
+ String val = SecuritySupport.getSystemProperty("jaxp.debug");
// Allow simply setting the prop to turn on debug
debug = val != null && !"false".equals(val);
}
@@ -109,7 +104,7 @@
if (useBSClsLoader) {
return Class.forName(className, false, FactoryFinder.class.getClassLoader());
} else {
- cl = ss.getContextClassLoader();
+ cl = SecuritySupport.getContextClassLoader();
if (cl == null) {
throw new ClassNotFoundException();
}
@@ -258,7 +253,7 @@
dPrint(()->"find factoryId =" + factoryId);
// Use the system property first
try {
- String systemProp = ss.getSystemProperty(factoryId);
+ String systemProp = SecuritySupport.getSystemProperty(factoryId);
if (systemProp != null) {
dPrint(()->"found system property, value=" + systemProp);
return newInstance(type, systemProp, null, true, true);
@@ -273,13 +268,13 @@
if (firstTime) {
synchronized (cacheProps) {
if (firstTime) {
- String configFile = ss.getSystemProperty("java.home") + File.separator +
+ String configFile = SecuritySupport.getSystemProperty("java.home") + File.separator +
"conf" + File.separator + "jaxp.properties";
File f = new File(configFile);
firstTime = false;
- if (ss.doesFileExist(f)) {
+ if (SecuritySupport.doesFileExist(f)) {
dPrint(()->"Read properties file "+f);
- cacheProps.load(ss.getFileInputStream(f));
+ cacheProps.load(SecuritySupport.getFileInputStream(f));
}
}
}
--- a/src/java.xml/share/classes/javax/xml/transform/SecuritySupport.java Mon Oct 09 10:42:27 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.xml.transform;
-
-import java.security.*;
-import java.io.*;
-
-/**
- * This class is duplicated for each JAXP subpackage so keep it in sync.
- * It is package private and therefore is not exposed as part of the JAXP
- * API.
- *
- * Security related methods that only work on J2SE 1.2 and newer.
- */
-class SecuritySupport {
-
-
- ClassLoader getContextClassLoader() throws SecurityException{
- return (ClassLoader)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- ClassLoader cl = null;
- //try {
- cl = Thread.currentThread().getContextClassLoader();
- //} catch (SecurityException ex) { }
- if (cl == null)
- cl = ClassLoader.getSystemClassLoader();
- return cl;
- }
- });
- }
-
- String getSystemProperty(final String propName) {
- return (String)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return System.getProperty(propName);
- }
- });
- }
-
- FileInputStream getFileInputStream(final File file)
- throws FileNotFoundException
- {
- try {
- return (FileInputStream)
- AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws FileNotFoundException {
- return new FileInputStream(file);
- }
- });
- } catch (PrivilegedActionException e) {
- throw (FileNotFoundException)e.getException();
- }
- }
-
- boolean doesFileExist(final File f) {
- return ((Boolean)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return f.exists();
- }
- })).booleanValue();
- }
-
-}
--- a/src/java.xml/share/classes/javax/xml/validation/SchemaFactory.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/javax/xml/validation/SchemaFactory.java Mon Oct 09 11:38:46 2017 -0700
@@ -30,6 +30,7 @@
import java.net.URL;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
+import jdk.xml.internal.SecuritySupport;
import org.w3c.dom.ls.LSResourceResolver;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
@@ -111,8 +112,6 @@
*/
public abstract class SchemaFactory {
- private static SecuritySupport ss = new SecuritySupport();
-
/**
* Constructor for derived classes.
*
@@ -235,7 +234,7 @@
*/
public static SchemaFactory newInstance(String schemaLanguage) {
ClassLoader cl;
- cl = ss.getContextClassLoader();
+ cl = SecuritySupport.getContextClassLoader();
if (cl == null) {
//cl = ClassLoader.getSystemClassLoader();
@@ -299,7 +298,7 @@
ClassLoader cl = classLoader;
if (cl == null) {
- cl = ss.getContextClassLoader();
+ cl = SecuritySupport.getContextClassLoader();
}
SchemaFactory f = new SchemaFactoryFinder(cl).createInstance(factoryClassName);
--- a/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryFinder.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryFinder.java Mon Oct 09 11:38:46 2017 -0700
@@ -36,6 +36,7 @@
import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;
import java.util.function.Supplier;
+import jdk.xml.internal.SecuritySupport;
/**
* Implementation of {@link SchemaFactory#newInstance(String)}.
@@ -47,10 +48,7 @@
/** debug support code. */
private static boolean debug = false;
- /**
- *<p> Take care of restrictions imposed by java security model </p>
- */
- private static final SecuritySupport ss = new SecuritySupport();
+
private static final String DEFAULT_PACKAGE = "com.sun.org.apache.xerces.internal";
/**
* <p>Cache properties for performance.</p>
@@ -65,7 +63,7 @@
static {
// Use try/catch block to support applets
try {
- debug = ss.getSystemProperty("jaxp.debug") != null;
+ debug = SecuritySupport.getSystemProperty("jaxp.debug") != null;
} catch (Exception unused) {
debug = false;
}
@@ -107,7 +105,7 @@
private void debugDisplayClassLoader() {
try {
- if( classLoader == ss.getContextClassLoader() ) {
+ if( classLoader == SecuritySupport.getContextClassLoader() ) {
debugPrintln(()->"using thread context class loader ("+classLoader+") for search");
return;
}
@@ -166,7 +164,7 @@
// system property look up
try {
debugPrintln(()->"Looking up system property '"+propertyName+"'" );
- String r = ss.getSystemProperty(propertyName);
+ String r = SecuritySupport.getSystemProperty(propertyName);
if(r!=null) {
debugPrintln(()->"The value is '"+r+"'");
sf = createInstance(r, true);
@@ -180,7 +178,7 @@
}
}
- String javah = ss.getSystemProperty( "java.home" );
+ String javah = SecuritySupport.getSystemProperty( "java.home" );
String configFile = javah + File.separator +
"conf" + File.separator + "jaxp.properties";
@@ -192,9 +190,9 @@
if(firstTime){
File f=new File( configFile );
firstTime = false;
- if(ss.doesFileExist(f)){
+ if(SecuritySupport.doesFileExist(f)){
debugPrintln(()->"Read properties file " + f);
- cacheProps.load(ss.getFileInputStream(f));
+ cacheProps.load(SecuritySupport.getFileInputStream(f));
}
}
}
@@ -411,6 +409,6 @@
// Used for debugging purposes
private static String which( Class<?> clazz ) {
- return ss.getClassSource(clazz);
+ return SecuritySupport.getClassSource(clazz);
}
}
--- a/src/java.xml/share/classes/javax/xml/validation/SecuritySupport.java Mon Oct 09 10:42:27 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.xml.validation;
-
-import java.net.URL;
-import java.security.*;
-import java.io.*;
-
-/**
- * This class is duplicated for each JAXP subpackage so keep it in sync.
- * It is package private and therefore is not exposed as part of the JAXP
- * API.
- *
- * Security related methods that only work on J2SE 1.2 and newer.
- */
-class SecuritySupport {
-
-
- ClassLoader getContextClassLoader() {
- return
- AccessController.doPrivileged(new PrivilegedAction<>() {
- @Override
- public ClassLoader run() {
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- if (cl == null)
- cl = ClassLoader.getSystemClassLoader();
- return cl;
- }
- });
- }
-
- String getSystemProperty(final String propName) {
- return AccessController.doPrivileged(new PrivilegedAction<>() {
- @Override
- public String run() {
- return System.getProperty(propName);
- }
- });
- }
-
- FileInputStream getFileInputStream(final File file)
- throws FileNotFoundException
- {
- try {
- return AccessController.doPrivileged(
- new PrivilegedExceptionAction<>() {
- @Override
- public FileInputStream run() throws FileNotFoundException {
- return new FileInputStream(file);
- }
- });
- } catch (PrivilegedActionException e) {
- throw (FileNotFoundException)e.getException();
- }
- }
-
- // Used for debugging purposes
- String getClassSource(Class<?> cls) {
- return AccessController.doPrivileged(new PrivilegedAction<>() {
- @Override
- public String run() {
- CodeSource cs = cls.getProtectionDomain().getCodeSource();
- if (cs != null) {
- URL loc = cs.getLocation();
- return loc != null ? loc.toString() : "(no location)";
- } else {
- return "(no code source)";
- }
- }
- });
- }
-
- boolean doesFileExist(final File f) {
- return AccessController.doPrivileged(new PrivilegedAction<>() {
- @Override
- public Boolean run() {
- return f.exists();
- }
- });
- }
-
-}
--- a/src/java.xml/share/classes/javax/xml/xpath/SecuritySupport.java Mon Oct 09 10:42:27 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.xml.xpath;
-
-import java.net.URL;
-import java.security.*;
-import java.io.*;
-
-/**
- * This class is duplicated for each JAXP subpackage so keep it in sync.
- * It is package private and therefore is not exposed as part of the JAXP
- * API.
- *
- * Security related methods that only work on J2SE 1.2 and newer.
- */
-class SecuritySupport {
-
-
- ClassLoader getContextClassLoader() {
- return AccessController.doPrivileged(new PrivilegedAction<>() {
- @Override
- public ClassLoader run() {
- ClassLoader cl = null;
- try {
- cl = Thread.currentThread().getContextClassLoader();
- } catch (SecurityException ex) { }
- return cl;
- }
- });
- }
-
- String getSystemProperty(final String propName) {
- return AccessController.doPrivileged(new PrivilegedAction<>() {
- @Override
- public String run() {
- return System.getProperty(propName);
- }
- });
- }
-
- FileInputStream getFileInputStream(final File file)
- throws FileNotFoundException
- {
- try {
- return AccessController.doPrivileged(
- new PrivilegedExceptionAction<>() {
- @Override
- public FileInputStream run() throws FileNotFoundException {
- return new FileInputStream(file);
- }
- });
- } catch (PrivilegedActionException e) {
- throw (FileNotFoundException)e.getException();
- }
- }
-
- // Used for debugging purposes
- String getClassSource(Class<?> cls) {
- return AccessController.doPrivileged(new PrivilegedAction<>() {
- @Override
- public String run() {
- CodeSource cs = cls.getProtectionDomain().getCodeSource();
- if (cs != null) {
- URL loc = cs.getLocation();
- return loc != null ? loc.toString() : "(no location)";
- } else {
- return "(no code source)";
- }
- }
- });
- }
-
- boolean doesFileExist(final File f) {
- return AccessController.doPrivileged(new PrivilegedAction<>() {
- @Override
- public Boolean run() {
- return f.exists();
- }
- });
- }
-
-}
--- a/src/java.xml/share/classes/javax/xml/xpath/XPathFactory.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/javax/xml/xpath/XPathFactory.java Mon Oct 09 11:38:46 2017 -0700
@@ -26,6 +26,7 @@
package javax.xml.xpath;
import com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl;
+import jdk.xml.internal.SecuritySupport;
/**
* <p>An {@code XPathFactory} instance can be used to create
@@ -63,11 +64,6 @@
public static final String DEFAULT_OBJECT_MODEL_URI = "http://java.sun.com/jaxp/xpath/dom";
/**
- *<p> Take care of restrictions imposed by java security model </p>
- */
- private static SecuritySupport ss = new SecuritySupport() ;
-
- /**
* <p>Protected constructor as {@link #newInstance()} or {@link #newInstance(String uri)}
* or {@link #newInstance(String uri, String factoryClassName, ClassLoader classLoader)}
* should be used to create a new instance of an {@code XPathFactory}.</p>
@@ -217,7 +213,7 @@
"XPathFactory#newInstance(String uri) cannot be called with uri == \"\"");
}
- ClassLoader classLoader = ss.getContextClassLoader();
+ ClassLoader classLoader = SecuritySupport.getContextClassLoader();
if (classLoader == null) {
//use the current class loader
@@ -296,7 +292,7 @@
}
if (cl == null) {
- cl = ss.getContextClassLoader();
+ cl = SecuritySupport.getContextClassLoader();
}
XPathFactory f = new XPathFactoryFinder(cl).createInstance(factoryClassName);
--- a/src/java.xml/share/classes/javax/xml/xpath/XPathFactoryFinder.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/javax/xml/xpath/XPathFactoryFinder.java Mon Oct 09 11:38:46 2017 -0700
@@ -36,6 +36,7 @@
import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;
import java.util.function.Supplier;
+import jdk.xml.internal.SecuritySupport;
/**
* Implementation of {@link XPathFactory#newInstance(String)}.
@@ -46,13 +47,12 @@
class XPathFactoryFinder {
private static final String DEFAULT_PACKAGE = "com.sun.org.apache.xpath.internal";
- private static final SecuritySupport ss = new SecuritySupport() ;
/** debug support code. */
private static boolean debug = false;
static {
// Use try/catch block to support applets
try {
- debug = ss.getSystemProperty("jaxp.debug") != null;
+ debug = SecuritySupport.getSystemProperty("jaxp.debug") != null;
} catch (Exception unused) {
debug = false;
}
@@ -103,7 +103,7 @@
private void debugDisplayClassLoader() {
try {
- if( classLoader == ss.getContextClassLoader() ) {
+ if( classLoader == SecuritySupport.getContextClassLoader() ) {
debugPrintln(() -> "using thread context class loader ("+classLoader+") for search");
return;
}
@@ -159,7 +159,7 @@
// system property look up
try {
debugPrintln(()->"Looking up system property '"+propertyName+"'" );
- String r = ss.getSystemProperty(propertyName);
+ String r = SecuritySupport.getSystemProperty(propertyName);
if(r!=null) {
debugPrintln(()->"The value is '"+r+"'");
xpathFactory = createInstance(r, true);
@@ -175,7 +175,7 @@
}
}
- String javah = ss.getSystemProperty( "java.home" );
+ String javah = SecuritySupport.getSystemProperty( "java.home" );
String configFile = javah + File.separator +
"conf" + File.separator + "jaxp.properties";
@@ -186,9 +186,9 @@
if(firstTime){
File f=new File( configFile );
firstTime = false;
- if(ss.doesFileExist(f)){
+ if(SecuritySupport.doesFileExist(f)){
debugPrintln(()->"Read properties file " + f);
- cacheProps.load(ss.getFileInputStream(f));
+ cacheProps.load(SecuritySupport.getFileInputStream(f));
}
}
}
@@ -407,7 +407,7 @@
// Used for debugging purposes
private static String which( Class<?> clazz ) {
- return ss.getClassSource(clazz);
+ return SecuritySupport.getClassSource(clazz);
}
}
--- a/src/java.xml/share/classes/jdk/xml/internal/SecuritySupport.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/jdk/xml/internal/SecuritySupport.java Mon Oct 09 11:38:46 2017 -0700
@@ -29,7 +29,9 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
+import java.net.URL;
import java.security.AccessController;
+import java.security.CodeSource;
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
@@ -82,7 +84,7 @@
public static String getSystemProperty(final String propName) {
return
AccessController.doPrivileged(
- (PrivilegedAction<String>) () -> (String)System.getProperty(propName));
+ (PrivilegedAction<String>) () -> System.getProperty(propName));
}
/**
@@ -220,6 +222,12 @@
-> f.exists()));
}
+ /**
+ * Creates and returns a new FileInputStream from a file.
+ * @param file the specified file
+ * @return the FileInputStream
+ * @throws FileNotFoundException if the file is not found
+ */
public static FileInputStream getFileInputStream(final File file)
throws FileNotFoundException {
try {
@@ -231,6 +239,16 @@
}
/**
+ * Returns the resource as a stream.
+ * @param name the resource name
+ * @return the resource stream
+ */
+ public static InputStream getResourceAsStream(final String name) {
+ return AccessController.doPrivileged((PrivilegedAction<InputStream>) () ->
+ SecuritySupport.class.getResourceAsStream("/"+name));
+ }
+
+ /**
* Gets a resource bundle using the specified base name, the default locale, and the caller's class loader.
* @param bundle the base name of the resource bundle, a fully qualified class name
* @return a resource bundle for the given base name and the default locale
@@ -259,4 +277,179 @@
}
});
}
+
+ /**
+ * Checks whether the file exists.
+ * @param f the specified file
+ * @return true if the file exists, false otherwise
+ */
+ public static boolean doesFileExist(final File f) {
+ return (AccessController.doPrivileged((PrivilegedAction<Boolean>) () -> f.exists()));
+ }
+
+ /**
+ * Checks the LastModified attribute of a file.
+ * @param f the specified file
+ * @return the LastModified attribute
+ */
+ static long getLastModified(final File f) {
+ return (AccessController.doPrivileged((PrivilegedAction<Long>) () -> f.lastModified()));
+ }
+
+ /**
+ * Strip off path from an URI
+ *
+ * @param uri an URI with full path
+ * @return the file name only
+ */
+ public static String sanitizePath(String uri) {
+ if (uri == null) {
+ return "";
+ }
+ int i = uri.lastIndexOf("/");
+ if (i > 0) {
+ return uri.substring(i+1, uri.length());
+ }
+ return "";
+ }
+
+ /**
+ * Check the protocol used in the systemId against allowed protocols
+ *
+ * @param systemId the Id of the URI
+ * @param allowedProtocols a list of allowed protocols separated by comma
+ * @param accessAny keyword to indicate allowing any protocol
+ * @return the name of the protocol if rejected, null otherwise
+ */
+ public static String checkAccess(String systemId, String allowedProtocols,
+ String accessAny) throws IOException {
+ if (systemId == null || (allowedProtocols != null &&
+ allowedProtocols.equalsIgnoreCase(accessAny))) {
+ return null;
+ }
+
+ String protocol;
+ if (!systemId.contains(":")) {
+ protocol = "file";
+ } else {
+ URL url = new URL(systemId);
+ protocol = url.getProtocol();
+ if (protocol.equalsIgnoreCase("jar")) {
+ String path = url.getPath();
+ protocol = path.substring(0, path.indexOf(":"));
+ } else if (protocol.equalsIgnoreCase("jrt")) {
+ // if the systemId is "jrt" then allow access if "file" allowed
+ protocol = "file";
+ }
+ }
+
+ if (isProtocolAllowed(protocol, allowedProtocols)) {
+ //access allowed
+ return null;
+ } else {
+ return protocol;
+ }
+ }
+
+ /**
+ * Check if the protocol is in the allowed list of protocols. The check
+ * is case-insensitive while ignoring whitespaces.
+ *
+ * @param protocol a protocol
+ * @param allowedProtocols a list of allowed protocols
+ * @return true if the protocol is in the list
+ */
+ private static boolean isProtocolAllowed(String protocol, String allowedProtocols) {
+ if (allowedProtocols == null) {
+ return false;
+ }
+ String temp[] = allowedProtocols.split(",");
+ for (String t : temp) {
+ t = t.trim();
+ if (t.equalsIgnoreCase(protocol)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static ClassLoader getContextClassLoader() {
+ return AccessController.doPrivileged((PrivilegedAction<ClassLoader>) () -> {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ if (cl == null)
+ cl = ClassLoader.getSystemClassLoader();
+ return cl;
+ });
+ }
+
+
+ public static ClassLoader getSystemClassLoader() {
+ return AccessController.doPrivileged((PrivilegedAction<ClassLoader>) () -> {
+ ClassLoader cl = null;
+ try {
+ cl = ClassLoader.getSystemClassLoader();
+ } catch (SecurityException ex) {
+ }
+ return cl;
+ });
+ }
+
+ public static ClassLoader getParentClassLoader(final ClassLoader cl) {
+ return AccessController.doPrivileged((PrivilegedAction<ClassLoader>) () -> {
+ ClassLoader parent = null;
+ try {
+ parent = cl.getParent();
+ } catch (SecurityException ex) {
+ }
+
+ // eliminate loops in case of the boot
+ // ClassLoader returning itself as a parent
+ return (parent == cl) ? null : parent;
+ });
+ }
+
+
+ // Used for debugging purposes
+ public static String getClassSource(Class<?> cls) {
+ return AccessController.doPrivileged((PrivilegedAction<String>) () -> {
+ CodeSource cs = cls.getProtectionDomain().getCodeSource();
+ if (cs != null) {
+ URL loc = cs.getLocation();
+ return loc != null ? loc.toString() : "(no location)";
+ } else {
+ return "(no code source)";
+ }
+ });
+ }
+
+ // ---------------- For SAX ----------------------
+ /**
+ * Returns the current thread's context class loader, or the system class loader
+ * if the context class loader is null.
+ * @return the current thread's context class loader, or the system class loader
+ * @throws SecurityException
+ */
+ public static ClassLoader getClassLoader() throws SecurityException{
+ return AccessController.doPrivileged((PrivilegedAction<ClassLoader>)() -> {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ if (cl == null) {
+ cl = ClassLoader.getSystemClassLoader();
+ }
+
+ return cl;
+ });
+ }
+
+ public static InputStream getResourceAsStream(final ClassLoader cl, final String name)
+ {
+ return AccessController.doPrivileged((PrivilegedAction<InputStream>) () -> {
+ InputStream ris;
+ if (cl == null) {
+ ris = SecuritySupport.class.getResourceAsStream(name);
+ } else {
+ ris = cl.getResourceAsStream(name);
+ }
+ return ris;
+ });
+ }
}
--- a/src/java.xml/share/classes/org/xml/sax/helpers/ParserAdapter.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/org/xml/sax/helpers/ParserAdapter.java Mon Oct 09 11:38:46 2017 -0700
@@ -34,23 +34,22 @@
import java.io.IOException;
import java.util.Enumeration;
import java.util.Vector;
-
-import org.xml.sax.Parser; // deprecated
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
+import jdk.xml.internal.SecuritySupport;
import org.xml.sax.AttributeList; // deprecated
-import org.xml.sax.EntityResolver;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
import org.xml.sax.DTDHandler;
import org.xml.sax.DocumentHandler; // deprecated
+import org.xml.sax.EntityResolver;
import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.Parser; // deprecated
import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-
-import org.xml.sax.XMLReader;
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.XMLReader;
/**
@@ -82,7 +81,6 @@
@SuppressWarnings("deprecation")
public class ParserAdapter implements XMLReader, DocumentHandler
{
- private static SecuritySupport ss = new SecuritySupport();
////////////////////////////////////////////////////////////////////
// Constructors.
@@ -104,7 +102,7 @@
{
super();
- String driver = ss.getSystemProperty("org.xml.sax.parser");
+ String driver = SecuritySupport.getSystemProperty("org.xml.sax.parser");
try {
setup(ParserFactory.makeParser());
--- a/src/java.xml/share/classes/org/xml/sax/helpers/ParserFactory.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/org/xml/sax/helpers/ParserFactory.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,7 @@
package org.xml.sax.helpers;
+import jdk.xml.internal.SecuritySupport;
/**
* Java-specific class for dynamically loading SAX parsers.
@@ -66,7 +67,6 @@
@SuppressWarnings( "deprecation" )
@Deprecated(since="1.5")
public class ParserFactory {
- private static SecuritySupport ss = new SecuritySupport();
/**
* Private null constructor.
@@ -104,7 +104,7 @@
NullPointerException,
ClassCastException
{
- String className = ss.getSystemProperty("org.xml.sax.parser");
+ String className = SecuritySupport.getSystemProperty("org.xml.sax.parser");
if (className == null) {
throw new NullPointerException("No value for sax.parser property");
} else {
@@ -140,7 +140,8 @@
InstantiationException,
ClassCastException
{
- return NewInstance.newInstance (org.xml.sax.Parser.class, ss.getClassLoader(), className);
+ return NewInstance.newInstance (org.xml.sax.Parser.class,
+ SecuritySupport.getClassLoader(), className);
}
}
--- a/src/java.xml/share/classes/org/xml/sax/helpers/SecuritySupport.java Mon Oct 09 10:42:27 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package org.xml.sax.helpers;
-
-import java.io.*;
-import java.security.*;
-
-/**
- * This class is duplicated for each JAXP subpackage so keep it in sync.
- * It is package private and therefore is not exposed as part of the JAXP
- * API.
- *
- * Security related methods that only work on J2SE 1.2 and newer.
- */
-class SecuritySupport {
-
- /**
- * Returns the current thread's context class loader, or the system class loader
- * if the context class loader is null.
- * @return the current thread's context class loader, or the system class loader
- * @throws SecurityException
- */
- ClassLoader getClassLoader() throws SecurityException{
- return AccessController.doPrivileged((PrivilegedAction<ClassLoader>)() -> {
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- if (cl == null) {
- cl = ClassLoader.getSystemClassLoader();
- }
-
- return cl;
- });
- }
-
- String getSystemProperty(final String propName) {
- return AccessController.doPrivileged((PrivilegedAction<String>)()
- -> System.getProperty(propName));
- }
-
- FileInputStream getFileInputStream(final File file)
- throws FileNotFoundException
- {
- try {
- return AccessController.doPrivileged((PrivilegedExceptionAction<FileInputStream>)() ->
- new FileInputStream(file));
- } catch (PrivilegedActionException e) {
- throw (FileNotFoundException)e.getException();
- }
- }
-
-
- InputStream getResourceAsStream(final ClassLoader cl, final String name)
- {
- return AccessController.doPrivileged((PrivilegedAction<InputStream>) () -> {
- InputStream ris;
- if (cl == null) {
- ris = SecuritySupport.class.getResourceAsStream(name);
- } else {
- ris = cl.getResourceAsStream(name);
- }
- return ris;
- });
- }
-
- boolean doesFileExist(final File f) {
- return (AccessController.doPrivileged((PrivilegedAction<Boolean>)() ->
- f.exists()));
- }
-
-}
--- a/src/java.xml/share/classes/org/xml/sax/helpers/XMLReaderFactory.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/java.xml/share/classes/org/xml/sax/helpers/XMLReaderFactory.java Mon Oct 09 11:38:46 2017 -0700
@@ -31,6 +31,7 @@
// $Id: XMLReaderFactory.java,v 1.2.2.1 2005/07/31 22:48:08 jeffsuttor Exp $
package org.xml.sax.helpers;
+
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
@@ -41,6 +42,7 @@
import java.util.Objects;
import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;
+import jdk.xml.internal.SecuritySupport;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
@@ -94,7 +96,6 @@
}
private static final String property = "org.xml.sax.driver";
- private static final SecuritySupport ss = new SecuritySupport();
/**
* Obtains a new instance of a {@link org.xml.sax.XMLReader}.
@@ -138,11 +139,11 @@
throws SAXException
{
String className = null;
- ClassLoader cl = ss.getClassLoader();
+ ClassLoader cl = SecuritySupport.getClassLoader();
// 1. try the JVM-instance-wide system property
try {
- className = ss.getSystemProperty(property);
+ className = SecuritySupport.getSystemProperty(property);
}
catch (RuntimeException e) { /* continue searching */ }
@@ -187,7 +188,7 @@
public static XMLReader createXMLReader (String className)
throws SAXException
{
- return loadClass (ss.getClassLoader(), className);
+ return loadClass (SecuritySupport.getClassLoader(), className);
}
private static XMLReader loadClass (ClassLoader loader, String className)
@@ -224,11 +225,11 @@
BufferedReader reader;
try {
- in = ss.getResourceAsStream(cl, service);
+ in = SecuritySupport.getResourceAsStream(cl, service);
// If no provider found then try the current ClassLoader
if (in == null) {
- in = ss.getResourceAsStream(null, service);
+ in = SecuritySupport.getResourceAsStream(null, service);
}
if (in != null) {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Mon Oct 09 11:38:46 2017 -0700
@@ -1174,6 +1174,9 @@
v.type = chk.checkLocalVarType(tree, tree.init.type.baseType(), tree.name);
}
}
+ if (tree.isImplicitlyTyped()) {
+ setSyntheticVariableType(tree, v.type);
+ }
}
result = tree.type = v.type;
}
@@ -1348,11 +1351,7 @@
}
if (tree.var.isImplicitlyTyped()) {
Type inferredType = chk.checkLocalVarType(tree.var, elemtype, tree.var.name);
- if (inferredType.isErroneous()) {
- tree.var.vartype = make.at(tree.var.vartype).Erroneous();
- } else {
- tree.var.vartype = make.at(tree.var.vartype).Type(inferredType);
- }
+ setSyntheticVariableType(tree.var, inferredType);
}
attribStat(tree.var, loopEnv);
chk.checkType(tree.expr.pos(), elemtype, tree.var.sym.type);
@@ -2559,7 +2558,7 @@
Type argType = arityMismatch ?
syms.errType :
actuals.head;
- params.head.vartype = make.at(params.head).Type(argType);
+ setSyntheticVariableType(params.head, argType);
params.head.sym = null;
actuals = actuals.isEmpty() ?
actuals :
@@ -3077,7 +3076,7 @@
if (that.getMode() == ReferenceMode.INVOKE &&
TreeInfo.isStaticSelector(that.expr, names) &&
that.kind.isUnbound() &&
- !desc.getParameterTypes().head.isParameterized()) {
+ lookupHelper.site.isRaw()) {
chk.checkRaw(that.expr, localEnv);
}
@@ -4831,6 +4830,14 @@
return types.capture(type);
}
+ private void setSyntheticVariableType(JCVariableDecl tree, Type type) {
+ if (type.isErroneous()) {
+ tree.vartype = make.at(Position.NOPOS).Erroneous();
+ } else {
+ tree.vartype = make.at(Position.NOPOS).Type(type);
+ }
+ }
+
public void validateTypeAnnotations(JCTree tree, boolean sigOnly) {
tree.accept(new TypeAnnotationsValidator(sigOnly));
}
@@ -5152,7 +5159,7 @@
that.sym.adr = 0;
}
if (that.vartype == null) {
- that.vartype = make.Erroneous();
+ that.vartype = make.at(Position.NOPOS).Erroneous();
}
super.visitVarDef(that);
}
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java Mon Oct 09 11:38:46 2017 -0700
@@ -308,8 +308,8 @@
void visitSymbol(Symbol _sym) {
Symbol sym = _sym;
if (sym.kind == VAR || sym.kind == MTH) {
- while (sym != null && sym.owner != owner)
- sym = proxies.findFirst(proxyName(sym.name));
+ if (sym != null && sym.owner != owner)
+ sym = proxies.get(sym);
if (sym != null && sym.owner == owner) {
VarSymbol v = (VarSymbol)sym;
if (v.getConstValue() == null) {
@@ -1084,7 +1084,7 @@
return makeLit(sym.type, cv);
}
// Otherwise replace the variable by its proxy.
- sym = proxies.findFirst(proxyName(sym.name));
+ sym = proxies.get(sym);
Assert.check(sym != null && (sym.flags_field & FINAL) != 0);
tree = make.at(tree.pos).Ident(sym);
}
@@ -1359,14 +1359,12 @@
* Free variables proxies and this$n
*************************************************************************/
- /** A scope containing all free variable proxies for currently translated
- * class, as well as its this$n symbol (if needed).
- * Proxy scopes are nested in the same way classes are.
- * Inside a constructor, proxies and any this$n symbol are duplicated
- * in an additional innermost scope, where they represent the constructor
- * parameters.
+ /** A map which allows to retrieve the translated proxy variable for any given symbol of an
+ * enclosing scope that is accessed (the accessed symbol could be the synthetic 'this$n' symbol).
+ * Inside a constructor, the map temporarily overrides entries corresponding to proxies and any
+ * 'this$n' symbols, where they represent the constructor parameters.
*/
- WriteableScope proxies;
+ Map<Symbol, Symbol> proxies;
/** A scope containing all unnamed resource variables/saved
* exception variables for translated TWR blocks
@@ -1383,8 +1381,12 @@
/** The name of a free variable proxy.
*/
- Name proxyName(Name name) {
- return names.fromString("val" + target.syntheticNameChar() + name);
+ Name proxyName(Name name, int index) {
+ Name proxyName = names.fromString("val" + target.syntheticNameChar() + name);
+ if (index > 0) {
+ proxyName = proxyName.append(names.fromString("" + target.syntheticNameChar() + index));
+ }
+ return proxyName;
}
/** Proxy definitions for all free variables in given list, in reverse order.
@@ -1400,11 +1402,17 @@
long additionalFlags) {
long flags = FINAL | SYNTHETIC | additionalFlags;
List<JCVariableDecl> defs = List.nil();
+ Set<Name> proxyNames = new HashSet<>();
for (List<VarSymbol> l = freevars; l.nonEmpty(); l = l.tail) {
VarSymbol v = l.head;
+ int index = 0;
+ Name proxyName;
+ do {
+ proxyName = proxyName(v.name, index++);
+ } while (!proxyNames.add(proxyName));
VarSymbol proxy = new VarSymbol(
- flags, proxyName(v.name), v.erasure(types), owner);
- proxies.enter(proxy);
+ flags, proxyName, v.erasure(types), owner);
+ proxies.put(v, proxy);
JCVariableDecl vd = make.at(pos).VarDef(proxy, null);
vd.vartype = access(vd.vartype);
defs = defs.prepend(vd);
@@ -1843,11 +1851,8 @@
/** Return tree simulating the assignment {@code this.name = name}, where
* name is the name of a free variable.
*/
- JCStatement initField(int pos, Name name) {
- Iterator<Symbol> it = proxies.getSymbolsByName(name).iterator();
- Symbol rhs = it.next();
+ JCStatement initField(int pos, Symbol rhs, Symbol lhs) {
Assert.check(rhs.owner.kind == MTH);
- Symbol lhs = it.next();
Assert.check(rhs.owner.owner == lhs.owner);
make.at(pos);
return
@@ -2207,7 +2212,8 @@
classdefs.put(currentClass, tree);
- proxies = proxies.dup(currentClass);
+ Map<Symbol, Symbol> prevProxies = proxies;
+ proxies = new HashMap<>(proxies);
List<VarSymbol> prevOuterThisStack = outerThisStack;
// If this is an enum definition
@@ -2270,7 +2276,7 @@
enterSynthetic(tree.pos(), otdef.sym, currentClass.members());
}
- proxies = proxies.leave();
+ proxies = prevProxies;
outerThisStack = prevOuterThisStack;
// Append translated tree to `translated' queue.
@@ -2488,7 +2494,8 @@
// Push a new proxy scope for constructor parameters.
// and create definitions for any this$n and proxy parameters.
- proxies = proxies.dup(m);
+ Map<Symbol, Symbol> prevProxies = proxies;
+ proxies = new HashMap<>(proxies);
List<VarSymbol> prevOuterThisStack = outerThisStack;
List<VarSymbol> fvs = freevars(currentClass);
JCVariableDecl otdef = null;
@@ -2523,13 +2530,12 @@
if (fvs.nonEmpty()) {
List<Type> addedargtypes = List.nil();
for (List<VarSymbol> l = fvs; l.nonEmpty(); l = l.tail) {
- final Name pName = proxyName(l.head.name);
m.capturedLocals =
m.capturedLocals.prepend((VarSymbol)
- (proxies.findFirst(pName)));
+ (proxies.get(l.head)));
if (TreeInfo.isInitialConstructor(tree)) {
added = added.prepend(
- initField(tree.body.pos, pName));
+ initField(tree.body.pos, proxies.get(l.head), prevProxies.get(l.head)));
}
addedargtypes = addedargtypes.prepend(l.head.erasure(types));
}
@@ -2547,7 +2553,7 @@
}
// pop local variables from proxy stack
- proxies = proxies.leave();
+ proxies = prevProxies;
// recursively translate following local statements and
// combine with this- or super-call
@@ -3714,7 +3720,7 @@
classdefs = new HashMap<>();
actualSymbols = new HashMap<>();
freevarCache = new HashMap<>();
- proxies = WriteableScope.create(syms.noSymbol);
+ proxies = new HashMap<>();
twrVars = WriteableScope.create(syms.noSymbol);
outerThisStack = List.nil();
accessNums = new HashMap<>();
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java Mon Oct 09 11:38:46 2017 -0700
@@ -59,6 +59,7 @@
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
+import java.util.LinkedList;
import java.util.Map;
import java.util.Set;
import java.util.function.BiFunction;
@@ -117,7 +118,7 @@
varNotFound = new SymbolNotFoundError(ABSENT_VAR);
methodNotFound = new SymbolNotFoundError(ABSENT_MTH);
typeNotFound = new SymbolNotFoundError(ABSENT_TYP);
- referenceNotFound = new ReferenceLookupResult(methodNotFound, null);
+ referenceNotFound = ReferenceLookupResult.error(methodNotFound);
names = Names.instance(context);
log = Log.instance(context);
@@ -2968,10 +2969,10 @@
//merge results
Pair<Symbol, ReferenceLookupHelper> res;
- Symbol bestSym = referenceChooser.result(boundRes, unboundRes);
- res = new Pair<>(bestSym,
- bestSym == unboundSym ? unboundLookupHelper : boundLookupHelper);
- env.info.pendingResolutionPhase = bestSym == unboundSym ?
+ ReferenceLookupResult bestRes = referenceChooser.result(boundRes, unboundRes);
+ res = new Pair<>(bestRes.sym,
+ bestRes == unboundRes ? unboundLookupHelper : boundLookupHelper);
+ env.info.pendingResolutionPhase = bestRes == unboundRes ?
unboundEnv.info.pendingResolutionPhase :
boundEnv.info.pendingResolutionPhase;
@@ -3027,11 +3028,15 @@
Symbol sym;
ReferenceLookupResult(Symbol sym, MethodResolutionContext resolutionContext) {
- this.staticKind = staticKind(sym, resolutionContext);
+ this(sym, staticKind(sym, resolutionContext));
+ }
+
+ private ReferenceLookupResult(Symbol sym, StaticKind staticKind) {
+ this.staticKind = staticKind;
this.sym = sym;
}
- private StaticKind staticKind(Symbol sym, MethodResolutionContext resolutionContext) {
+ private static StaticKind staticKind(Symbol sym, MethodResolutionContext resolutionContext) {
switch (sym.kind) {
case MTH:
case AMBIGUOUS:
@@ -3080,6 +3085,10 @@
return false;
}
}
+
+ static ReferenceLookupResult error(Symbol sym) {
+ return new ReferenceLookupResult(sym, StaticKind.UNDEFINED);
+ }
}
/**
@@ -3092,7 +3101,7 @@
* Generate a result from a pair of lookup result objects. This method delegates to the
* appropriate result generation routine.
*/
- Symbol result(ReferenceLookupResult boundRes, ReferenceLookupResult unboundRes) {
+ ReferenceLookupResult result(ReferenceLookupResult boundRes, ReferenceLookupResult unboundRes) {
return unboundRes != referenceNotFound ?
unboundResult(boundRes, unboundRes) :
boundResult(boundRes);
@@ -3101,12 +3110,12 @@
/**
* Generate a symbol from a given bound lookup result.
*/
- abstract Symbol boundResult(ReferenceLookupResult boundRes);
+ abstract ReferenceLookupResult boundResult(ReferenceLookupResult boundRes);
/**
* Generate a symbol from a pair of bound/unbound lookup results.
*/
- abstract Symbol unboundResult(ReferenceLookupResult boundRes, ReferenceLookupResult unboundRes);
+ abstract ReferenceLookupResult unboundResult(ReferenceLookupResult boundRes, ReferenceLookupResult unboundRes);
}
/**
@@ -3116,37 +3125,38 @@
ReferenceChooser basicReferenceChooser = new ReferenceChooser() {
@Override
- Symbol boundResult(ReferenceLookupResult boundRes) {
+ ReferenceLookupResult boundResult(ReferenceLookupResult boundRes) {
return !boundRes.isSuccess() || boundRes.hasKind(StaticKind.NON_STATIC) ?
- boundRes.sym : //the search produces a non-static method
- new BadMethodReferenceError(boundRes.sym, false);
+ boundRes : //the search produces a non-static method
+ ReferenceLookupResult.error(new BadMethodReferenceError(boundRes.sym, false));
}
@Override
- Symbol unboundResult(ReferenceLookupResult boundRes, ReferenceLookupResult unboundRes) {
+ ReferenceLookupResult unboundResult(ReferenceLookupResult boundRes, ReferenceLookupResult unboundRes) {
if (boundRes.hasKind(StaticKind.STATIC) &&
(!unboundRes.isSuccess() || unboundRes.hasKind(StaticKind.STATIC))) {
//the first search produces a static method and no non-static method is applicable
//during the second search
- return boundRes.sym;
+ return boundRes;
} else if (unboundRes.hasKind(StaticKind.NON_STATIC) &&
(!boundRes.isSuccess() || boundRes.hasKind(StaticKind.NON_STATIC))) {
//the second search produces a non-static method and no static method is applicable
//during the first search
- return unboundRes.sym;
+ return unboundRes;
} else if (boundRes.isSuccess() && unboundRes.isSuccess()) {
//both searches produce some result; ambiguity (error recovery)
- return ambiguityError(boundRes.sym, unboundRes.sym);
+ return ReferenceLookupResult.error(ambiguityError(boundRes.sym, unboundRes.sym));
} else if (boundRes.isSuccess() || unboundRes.isSuccess()) {
//Both searches failed to produce a result with correct staticness (i.e. first search
//produces an non-static method). Alternatively, a given search produced a result
//with the right staticness, but the other search has applicable methods with wrong
//staticness (error recovery)
- return new BadMethodReferenceError(boundRes.isSuccess() ? boundRes.sym : unboundRes.sym, true);
+ return ReferenceLookupResult.error(new BadMethodReferenceError(boundRes.isSuccess() ?
+ boundRes.sym : unboundRes.sym, true));
} else {
//both searches fail to produce a result - pick 'better' error using heuristics (error recovery)
return (boundRes.canIgnore() && !unboundRes.canIgnore()) ?
- unboundRes.sym : boundRes.sym;
+ unboundRes : boundRes;
}
}
};
@@ -3158,28 +3168,29 @@
ReferenceChooser structuralReferenceChooser = new ReferenceChooser() {
@Override
- Symbol boundResult(ReferenceLookupResult boundRes) {
+ ReferenceLookupResult boundResult(ReferenceLookupResult boundRes) {
return (!boundRes.isSuccess() || !boundRes.hasKind(StaticKind.STATIC)) ?
- boundRes.sym : //the search has at least one applicable non-static method
- new BadMethodReferenceError(boundRes.sym, false);
+ boundRes : //the search has at least one applicable non-static method
+ ReferenceLookupResult.error(new BadMethodReferenceError(boundRes.sym, false));
}
@Override
- Symbol unboundResult(ReferenceLookupResult boundRes, ReferenceLookupResult unboundRes) {
+ ReferenceLookupResult unboundResult(ReferenceLookupResult boundRes, ReferenceLookupResult unboundRes) {
if (boundRes.isSuccess() && !boundRes.hasKind(StaticKind.NON_STATIC)) {
//the first serach has at least one applicable static method
- return boundRes.sym;
+ return boundRes;
} else if (unboundRes.isSuccess() && !unboundRes.hasKind(StaticKind.STATIC)) {
//the second search has at least one applicable non-static method
- return unboundRes.sym;
+ return unboundRes;
} else if (boundRes.isSuccess() || unboundRes.isSuccess()) {
//either the first search produces a non-static method, or second search produces
//a non-static method (error recovery)
- return new BadMethodReferenceError(boundRes.isSuccess() ? boundRes.sym : unboundRes.sym, true);
+ return ReferenceLookupResult.error(new BadMethodReferenceError(boundRes.isSuccess() ?
+ boundRes.sym : unboundRes.sym, true));
} else {
//both searches fail to produce a result - pick 'better' error using heuristics (error recovery)
return (boundRes.canIgnore() && !unboundRes.canIgnore()) ?
- unboundRes.sym : boundRes.sym;
+ unboundRes : boundRes;
}
}
};
@@ -4030,14 +4041,35 @@
}
//where
private Map<Symbol, JCDiagnostic> mapCandidates() {
- Map<Symbol, JCDiagnostic> candidates = new LinkedHashMap<>();
+ MostSpecificMap candidates = new MostSpecificMap();
for (Candidate c : resolveContext.candidates) {
if (c.isApplicable()) continue;
- candidates.put(c.sym, c.details);
+ candidates.put(c);
}
return candidates;
}
+ @SuppressWarnings("serial")
+ private class MostSpecificMap extends LinkedHashMap<Symbol, JCDiagnostic> {
+ private void put(Candidate c) {
+ ListBuffer<Symbol> overridden = new ListBuffer<>();
+ for (Symbol s : keySet()) {
+ if (s == c.sym) {
+ continue;
+ }
+ if (c.sym.overrides(s, (TypeSymbol)s.owner, types, false)) {
+ overridden.add(s);
+ } else if (s.overrides(c.sym, (TypeSymbol)c.sym.owner, types, false)) {
+ return;
+ }
+ }
+ for (Symbol s : overridden) {
+ remove(s);
+ }
+ put(c.sym, c.details);
+ }
+ }
+
Map<Symbol, JCDiagnostic> filterCandidates(Map<Symbol, JCDiagnostic> candidatesMap) {
Map<Symbol, JCDiagnostic> candidates = new LinkedHashMap<>();
for (Map.Entry<Symbol, JCDiagnostic> _entry : candidatesMap.entrySet()) {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java Mon Oct 09 11:38:46 2017 -0700
@@ -3063,6 +3063,7 @@
}
else if (reqInit) syntaxError(token.pos, "expected", EQ);
JCTree elemType = TreeInfo.innermostType(type, true);
+ int startPos = Position.NOPOS;
if (allowLocalVariableTypeInference && elemType.hasTag(IDENT)) {
Name typeName = ((JCIdent)elemType).name;
if (isRestrictedLocalVarTypeName(typeName)) {
@@ -3070,6 +3071,9 @@
//error - 'var' and arrays
reportSyntaxError(pos, "var.not.allowed.array");
} else {
+ startPos = TreeInfo.getStartPos(mods);
+ if (startPos == Position.NOPOS)
+ startPos = TreeInfo.getStartPos(type);
//implicit type
type = null;
}
@@ -3078,6 +3082,7 @@
JCVariableDecl result =
toP(F.at(pos).VarDef(mods, name, type, init));
attach(result, dc);
+ result.startPos = startPos;
return result;
}
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java Mon Oct 09 11:38:46 2017 -0700
@@ -920,6 +920,8 @@
public JCExpression init;
/** symbol */
public VarSymbol sym;
+ /** explicit start pos */
+ public int startPos = Position.NOPOS;
protected JCVariableDecl(JCModifiers mods,
Name name,
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java Mon Oct 09 11:38:46 2017 -0700
@@ -457,9 +457,11 @@
}
case VARDEF: {
JCVariableDecl node = (JCVariableDecl)tree;
- if (node.mods.pos != Position.NOPOS) {
+ if (node.startPos != Position.NOPOS) {
+ return node.startPos;
+ } else if (node.mods.pos != Position.NOPOS) {
return node.mods.pos;
- } else if (node.vartype == null) {
+ } else if (node.vartype == null || node.vartype.pos == Position.NOPOS) {
//if there's no type (partially typed lambda parameter)
//simply return node position
return node.pos;
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/RawDiagnosticFormatter.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/RawDiagnosticFormatter.java Mon Oct 09 11:38:46 2017 -0700
@@ -34,7 +34,6 @@
import com.sun.tools.javac.api.Formattable;
import com.sun.tools.javac.file.PathFileObject;
import com.sun.tools.javac.tree.JCTree.*;
-import com.sun.tools.javac.util.AbstractDiagnosticFormatter.SimpleConfiguration;
import static com.sun.tools.javac.api.DiagnosticFormatter.PositionKind.*;
@@ -52,6 +51,37 @@
public final class RawDiagnosticFormatter extends AbstractDiagnosticFormatter {
/**
+ * The raw diagnostic helper.
+ */
+ RawDiagnosticPosHelper rawDiagnosticPosHelper;
+
+ /**
+ * Helper class to generate stable positions for AST nodes occurring in diagnostic arguments.
+ * If the AST node appears in the same line number as the main diagnostic, the line is information is omitted.
+ * Otherwise both line and column information is included, using the format @{code line:col}".
+ *
+ * Note: since subdiagnostics can be created without a diagnostic source, a position helper
+ * should always refer to the toplevel diagnostic source.
+ */
+ static class RawDiagnosticPosHelper {
+ private final JCDiagnostic diag;
+
+ RawDiagnosticPosHelper(JCDiagnostic diag) {
+ this.diag = diag;
+ }
+
+ String getPosition(JCExpression exp) {
+ DiagnosticSource diagSource = diag.getDiagnosticSource();
+ long diagLine = diag.getLineNumber();
+ long expLine = diagSource.getLineNumber(exp.pos);
+ long expCol = diagSource.getColumnNumber(exp.pos, false);
+ return (expLine == diagLine) ?
+ String.valueOf(expCol) :
+ expLine + ":" + expCol;
+ }
+ }
+
+ /**
* Create a formatter based on the supplied options.
* @param options
*/
@@ -65,6 +95,7 @@
//provide common default formats
public String formatDiagnostic(JCDiagnostic d, Locale l) {
try {
+ rawDiagnosticPosHelper = new RawDiagnosticPosHelper(d);
StringBuilder buf = new StringBuilder();
if (d.getPosition() != Position.NOPOS) {
buf.append(formatSource(d, false, null));
@@ -89,8 +120,9 @@
return buf.toString();
}
catch (Exception e) {
- //e.printStackTrace();
return null;
+ } finally {
+ rawDiagnosticPosHelper = null;
}
}
@@ -122,8 +154,8 @@
if (arg instanceof Formattable) {
s = arg.toString();
} else if (arg instanceof JCExpression) {
- JCExpression tree = (JCExpression)arg;
- s = "@" + tree.getStartPosition();
+ Assert.checkNonNull(rawDiagnosticPosHelper);
+ s = "@" + rawDiagnosticPosHelper.getPosition((JCExpression)arg);
} else if (arg instanceof PathFileObject) {
s = ((PathFileObject) arg).getShortName();
} else {
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java Mon Oct 09 11:38:46 2017 -0700
@@ -99,15 +99,19 @@
*/
@Override
protected Content getDeprecatedLink(Element member) {
- StringBuilder sb = new StringBuilder();
- sb.append(utils.getFullyQualifiedName(member));
+ Content deprecatedLinkContent = new ContentBuilder();
+ deprecatedLinkContent.addContent(utils.getFullyQualifiedName(member));
if (!utils.isConstructor(member)) {
- sb.append(".");
- sb.append(member.getSimpleName());
+ deprecatedLinkContent.addContent(".");
+ deprecatedLinkContent.addContent(member.getSimpleName());
}
- sb.append(utils.flatSignature((ExecutableElement) member));
+ String signature = utils.flatSignature((ExecutableElement) member);
+ if (signature.length() > 2) {
+ deprecatedLinkContent.addContent(Contents.ZERO_WIDTH_SPACE);
+ }
+ deprecatedLinkContent.addContent(signature);
- return writer.getDocLink(MEMBER, member, sb);
+ return writer.getDocLink(MEMBER, utils.getEnclosingTypeElement(member), member, deprecatedLinkContent);
}
/**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java Mon Oct 09 11:38:46 2017 -0700
@@ -334,7 +334,6 @@
List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0));
if (!commentTags.isEmpty()) {
- div.addContent(Contents.SPACE);
addInlineDeprecatedComment(annotationType, deprs.get(0), div);
}
}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java Mon Oct 09 11:38:46 2017 -0700
@@ -616,7 +616,6 @@
DocTree dt = deprs.get(0);
List<? extends DocTree> commentTags = ch.getBody(configuration, dt);
if (!commentTags.isEmpty()) {
- div.addContent(Contents.SPACE);
addInlineDeprecatedComment(typeElement, deprs.get(0), div);
}
}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java Mon Oct 09 11:38:46 2017 -0700
@@ -100,33 +100,33 @@
private String getHeadingKey(DeprElementKind kind) {
switch (kind) {
case REMOVAL:
- return "doclet.Deprecated_For_Removal";
+ return "doclet.For_Removal";
case MODULE:
- return "doclet.Deprecated_Modules";
+ return "doclet.Modules";
case PACKAGE:
- return "doclet.Deprecated_Packages";
+ return "doclet.Packages";
case INTERFACE:
- return "doclet.Deprecated_Interfaces";
+ return "doclet.Interfaces";
case CLASS:
- return "doclet.Deprecated_Classes";
+ return "doclet.Classes";
case ENUM:
- return "doclet.Deprecated_Enums";
+ return "doclet.Enums";
case EXCEPTION:
- return "doclet.Deprecated_Exceptions";
+ return "doclet.Exceptions";
case ERROR:
- return "doclet.Deprecated_Errors";
+ return "doclet.Errors";
case ANNOTATION_TYPE:
- return "doclet.Deprecated_Annotation_Types";
+ return "doclet.Annotation_Types";
case FIELD:
- return "doclet.Deprecated_Fields";
+ return "doclet.Fields";
case METHOD:
- return "doclet.Deprecated_Methods";
+ return "doclet.Methods";
case CONSTRUCTOR:
- return "doclet.Deprecated_Constructors";
+ return "doclet.Constructors";
case ENUM_CONSTANT:
- return "doclet.Deprecated_Enum_Constants";
+ return "doclet.Enum_Constants";
case ANNOTATION_TYPE_MEMBER:
- return "doclet.Deprecated_Annotation_Type_Members";
+ return "doclet.Annotation_Type_Members";
default:
throw new AssertionError("unknown kind: " + kind);
}
@@ -135,33 +135,33 @@
private String getSummaryKey(DeprElementKind kind) {
switch (kind) {
case REMOVAL:
- return "doclet.deprecated_for_removal";
+ return "doclet.for_removal";
case MODULE:
- return "doclet.deprecated_modules";
+ return "doclet.modules";
case PACKAGE:
- return "doclet.deprecated_packages";
+ return "doclet.packages";
case INTERFACE:
- return "doclet.deprecated_interfaces";
+ return "doclet.interfaces";
case CLASS:
- return "doclet.deprecated_classes";
+ return "doclet.classes";
case ENUM:
- return "doclet.deprecated_enums";
+ return "doclet.enums";
case EXCEPTION:
- return "doclet.deprecated_exceptions";
+ return "doclet.exceptions";
case ERROR:
- return "doclet.deprecated_errors";
+ return "doclet.errors";
case ANNOTATION_TYPE:
- return "doclet.deprecated_annotation_types";
+ return "doclet.annotation_types";
case FIELD:
- return "doclet.deprecated_fields";
+ return "doclet.fields";
case METHOD:
- return "doclet.deprecated_methods";
+ return "doclet.methods";
case CONSTRUCTOR:
- return "doclet.deprecated_constructors";
+ return "doclet.constructors";
case ENUM_CONSTANT:
- return "doclet.deprecated_enum_constants";
+ return "doclet.enum_constants";
case ANNOTATION_TYPE_MEMBER:
- return "doclet.deprecated_annotation_type_members";
+ return "doclet.annotation_type_members";
default:
throw new AssertionError("unknown kind: " + kind);
}
@@ -473,6 +473,6 @@
default:
writer = new AnnotationTypeOptionalMemberWriterImpl(this, null);
}
- return HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, writer.getDeprecatedLink(e));
+ return HtmlTree.TH_ROW_SCOPE(HtmlStyle.colDeprecatedItemName, writer.getDeprecatedLink(e));
}
}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FrameOutputWriter.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FrameOutputWriter.java Mon Oct 09 11:38:46 2017 -0700
@@ -25,11 +25,15 @@
package jdk.javadoc.internal.doclets.formats.html;
+import jdk.javadoc.internal.doclets.formats.html.markup.Comment;
+import jdk.javadoc.internal.doclets.formats.html.markup.DocType;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlDocument;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
+import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
import jdk.javadoc.internal.doclets.toolkit.Content;
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
@@ -110,15 +114,41 @@
body.addContent(frame);
}
if (configuration.windowtitle.length() > 0) {
- printFramesDocument(configuration.windowtitle, configuration,
- body);
+ printFramesDocument(configuration.windowtitle, body);
} else {
- printFramesDocument(configuration.getText("doclet.Generated_Docs_Untitled"),
- configuration, body);
+ printFramesDocument(configuration.getText("doclet.Generated_Docs_Untitled"), body);
}
}
/**
+ * Print the frames version of the Html file header.
+ * Called only when generating an HTML frames file.
+ *
+ * @param title Title of this HTML document
+ * @param body the body content tree to be added to the HTML document
+ * @throws DocFileIOException if there is an error writing the frames document
+ */
+ private void printFramesDocument(String title, HtmlTree body) throws DocFileIOException {
+ Content htmlDocType = configuration.isOutputHtml5()
+ ? DocType.HTML5
+ : DocType.TRANSITIONAL;
+ Content htmlComment = new Comment(configuration.getText("doclet.New_Page"));
+ Content head = new HtmlTree(HtmlTag.HEAD);
+ head.addContent(getGeneratedBy(!configuration.notimestamp));
+ Content windowTitle = HtmlTree.TITLE(new StringContent(title));
+ head.addContent(windowTitle);
+ Content meta = HtmlTree.META("Content-Type", CONTENT_TYPE, configuration.charset);
+ head.addContent(meta);
+ head.addContent(getStyleSheetProperties(configuration));
+ head.addContent(getFramesJavaScript());
+ Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(),
+ head, body);
+ Content htmlDocument = new HtmlDocument(htmlDocType,
+ htmlComment, htmlTree);
+ write(htmlDocument);
+ }
+
+ /**
* Get the frame sizes and their contents.
*
* @return a content tree for the frame details
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java Mon Oct 09 11:38:46 2017 -0700
@@ -1715,8 +1715,7 @@
Content div;
Content result = commentTagsToContent(null, element, tags, first);
if (depr) {
- Content italic = HtmlTree.SPAN(HtmlStyle.deprecationComment, result);
- div = HtmlTree.DIV(HtmlStyle.block, italic);
+ div = HtmlTree.DIV(HtmlStyle.deprecationComment, result);
htmltree.addContent(div);
}
else {
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SubWriterHolderWriter.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SubWriterHolderWriter.java Mon Oct 09 11:38:46 2017 -0700
@@ -189,9 +189,8 @@
if (utils.isDeprecated(member)) {
Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(member));
div = HtmlTree.DIV(HtmlStyle.block, deprLabel);
- div.addContent(Contents.SPACE);
if (!deprs.isEmpty()) {
- addInlineDeprecatedComment(member, deprs.get(0), div);
+ addSummaryDeprecatedComment(member, deprs.get(0), div);
}
tdSummary.addContent(div);
return;
@@ -200,7 +199,6 @@
if (te != null && utils.isTypeElement(te) && utils.isDeprecated(te)) {
Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(te));
div = HtmlTree.DIV(HtmlStyle.block, deprLabel);
- div.addContent(Contents.SPACE);
tdSummary.addContent(div);
}
}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java Mon Oct 09 11:38:46 2017 -0700
@@ -179,7 +179,6 @@
if (utils.isDeprecated(element)) {
result.addContent(HtmlTree.SPAN(HtmlStyle.deprecatedLabel,
htmlWriter.getDeprecatedPhrase(element)));
- result.addContent(RawHtml.nbsp);
if (!deprs.isEmpty()) {
List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0));
if (!commentTags.isEmpty()) {
@@ -191,19 +190,17 @@
if (utils.isDeprecated(element)) {
result.addContent(HtmlTree.SPAN(HtmlStyle.deprecatedLabel,
htmlWriter.getDeprecatedPhrase(element)));
- result.addContent(RawHtml.nbsp);
if (!deprs.isEmpty()) {
List<? extends DocTree> bodyTags = ch.getBody(configuration, deprs.get(0));
Content body = commentTagsToOutput(null, element, bodyTags, false);
if (!body.isEmpty())
- result.addContent(HtmlTree.SPAN(HtmlStyle.deprecationComment, body));
+ result.addContent(HtmlTree.DIV(HtmlStyle.deprecationComment, body));
}
} else {
Element ee = utils.getEnclosingTypeElement(element);
if (utils.isDeprecated(ee)) {
result.addContent(HtmlTree.SPAN(HtmlStyle.deprecatedLabel,
htmlWriter.getDeprecatedPhrase(ee)));
- result.addContent(RawHtml.nbsp);
}
}
}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlDocWriter.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlDocWriter.java Mon Oct 09 11:38:46 2017 -0700
@@ -37,7 +37,6 @@
import jdk.javadoc.internal.doclets.toolkit.Content;
import jdk.javadoc.internal.doclets.toolkit.Messages;
import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
-import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
import jdk.javadoc.internal.doclets.toolkit.util.DocLink;
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
@@ -310,36 +309,6 @@
}
/**
- * Print the frames version of the Html file header.
- * Called only when generating an HTML frames file.
- *
- * @param title Title of this HTML document
- * @param configuration the configuration object
- * @param body the body content tree to be added to the HTML document
- * @throws DocFileIOException if there is an error writing the frames document
- */
- public void printFramesDocument(String title, HtmlConfiguration configuration,
- HtmlTree body) throws DocFileIOException {
- Content htmlDocType = configuration.isOutputHtml5()
- ? DocType.HTML5
- : DocType.TRANSITIONAL;
- Content htmlComment = new Comment(configuration.getText("doclet.New_Page"));
- Content head = new HtmlTree(HtmlTag.HEAD);
- head.addContent(getGeneratedBy(!configuration.notimestamp));
- Content windowTitle = HtmlTree.TITLE(new StringContent(title));
- head.addContent(windowTitle);
- Content meta = HtmlTree.META("Content-Type", CONTENT_TYPE, configuration.charset);
- head.addContent(meta);
- head.addContent(getStyleSheetProperties(configuration));
- head.addContent(getFramesJavaScript());
- Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(),
- head, body);
- Content htmlDocument = new HtmlDocument(htmlDocType,
- htmlComment, htmlTree);
- write(htmlDocument);
- }
-
- /**
* Returns a link to the stylesheet file.
*
* @param configuration the configuration for this doclet
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java Mon Oct 09 11:38:46 2017 -0700
@@ -47,6 +47,7 @@
circle,
classUseContainer,
colConstructorName,
+ colDeprecatedItemName,
colFirst,
colLast,
colSecond,
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties Mon Oct 09 10:42:27 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties Mon Oct 09 11:38:46 2017 -0700
@@ -74,34 +74,12 @@
doclet.see.class_or_package_not_accessible=Tag {0}: reference not accessible: {1}
doclet.tag.invalid_usage=invalid usage of tag {0}
doclet.Deprecated_API=Deprecated API
-doclet.Deprecated_For_Removal=Deprecated For Removal
-doclet.Deprecated_Modules=Deprecated Modules
-doclet.Deprecated_Packages=Deprecated Packages
-doclet.Deprecated_Classes=Deprecated Classes
-doclet.Deprecated_Enums=Deprecated Enums
-doclet.Deprecated_Interfaces=Deprecated Interfaces
-doclet.Deprecated_Exceptions=Deprecated Exceptions
-doclet.Deprecated_Annotation_Types=Deprecated Annotation Types
-doclet.Deprecated_Errors=Deprecated Errors
-doclet.Deprecated_Fields=Deprecated Fields
-doclet.Deprecated_Constructors=Deprecated Constructors
-doclet.Deprecated_Methods=Deprecated Methods
-doclet.Deprecated_Enum_Constants=Deprecated Enum Constants
-doclet.Deprecated_Annotation_Type_Members=Deprecated Annotation Type Elements
-doclet.deprecated_for_removal=deprecated for removal
-doclet.deprecated_modules=deprecated modules
-doclet.deprecated_packages=deprecated packages
-doclet.deprecated_classes=deprecated classes
-doclet.deprecated_enums=deprecated enums
-doclet.deprecated_interfaces=deprecated interfaces
-doclet.deprecated_exceptions=deprecated exceptions
-doclet.deprecated_annotation_types=deprecated annotation types
-doclet.deprecated_errors=deprecated errors
-doclet.deprecated_fields=deprecated fields
-doclet.deprecated_constructors=deprecated constructors
-doclet.deprecated_methods=deprecated methods
-doclet.deprecated_enum_constants=deprecated enum constants
-doclet.deprecated_annotation_type_members=deprecated annotation type elements
+doclet.For_Removal=For Removal
+doclet.Annotation_Types=Annotation Types
+doclet.Annotation_Type_Members=Annotation Type Elements
+doclet.for_removal=for removal
+doclet.annotation_types=annotation types
+doclet.annotation_type_members=annotation type elements
doclet.Generated_Docs_Untitled=Generated Documentation (Untitled)
doclet.Other_Packages=Other Packages
doclet.Description=Description
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css Mon Oct 09 10:42:27 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css Mon Oct 09 11:38:46 2017 -0700
@@ -531,14 +531,16 @@
text-align:left;
padding:0px 0px 12px 10px;
}
-th.colFirst, th.colSecond, th.colLast, th.colConstructorName, .useSummary th, .constantsSummary th, .packagesSummary th,
-td.colFirst, td.colSecond, td.colLast, .useSummary td, .constantsSummary td {
+th.colFirst, th.colSecond, th.colLast, th.colConstructorName, th.colDeprecatedItemName, .useSummary th,
+.constantsSummary th, .packagesSummary th, td.colFirst, td.colSecond, td.colLast, .useSummary td,
+.constantsSummary td {
vertical-align:top;
padding-right:0px;
padding-top:8px;
padding-bottom:3px;
}
-th.colFirst, th.colSecond, th.colLast, th.colConstructorName, .constantsSummary th, .packagesSummary th {
+th.colFirst, th.colSecond, th.colLast, th.colConstructorName, th.colDeprecatedItemName, .constantsSummary th,
+.packagesSummary th {
background:#dee3e9;
text-align:left;
padding:8px 3px 3px 7px;
@@ -547,7 +549,7 @@
white-space:nowrap;
font-size:13px;
}
-td.colSecond, th.colSecond, td.colLast, th.colConstructorName, th.colLast {
+td.colSecond, th.colSecond, td.colLast, th.colConstructorName, th.colDeprecatedItemName, th.colLast {
font-size:13px;
}
.constantsSummary th, .packagesSummary th {
@@ -576,6 +578,7 @@
th.colFirst a:link, th.colFirst a:visited,
th.colSecond a:link, th.colSecond a:visited,
th.colConstructorName a:link, th.colConstructorName a:visited,
+th.colDeprecatedItemName a:link, th.colDeprecatedItemName a:visited,
.constantValuesContainer td a:link, .constantValuesContainer td a:visited {
font-weight:bold;
}
@@ -657,7 +660,7 @@
display:inline-block;
}
-div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase,
+div.block div.deprecationComment, div.block div.block span.emphasizedPhrase,
div.block div.block span.interfaceName {
font-style:normal;
}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DeprecatedAPIListBuilder.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DeprecatedAPIListBuilder.java Mon Oct 09 11:38:46 2017 -0700
@@ -78,7 +78,7 @@
deprecatedMap = new EnumMap<>(DeprElementKind.class);
for (DeprElementKind kind : DeprElementKind.values()) {
deprecatedMap.put(kind,
- new TreeSet<>(utils.makeGeneralPurposeComparator()));
+ new TreeSet<>(utils.makeDeprecatedComparator()));
}
buildDeprecatedAPIInfo();
}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java Mon Oct 09 11:38:46 2017 -0700
@@ -1733,6 +1733,25 @@
return packageComparator;
}
+ private Comparator<Element> deprecatedComparator = null;
+ /**
+ * Returns a Comparator for deprecated items listed on deprecated list page, by comparing the
+ * fully qualified names.
+ *
+ * @return a Comparator
+ */
+ public Comparator<Element> makeDeprecatedComparator() {
+ if (deprecatedComparator == null) {
+ deprecatedComparator = new Utils.ElementComparator() {
+ @Override
+ public int compare(Element e1, Element e2) {
+ return compareFullyQualifiedNames(e1, e2);
+ }
+ };
+ }
+ return deprecatedComparator;
+ }
+
private Comparator<SerialFieldTree> serialFieldTreeComparator = null;
/**
* Returns a Comparator for SerialFieldTree.
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java Mon Oct 09 11:38:46 2017 -0700
@@ -234,49 +234,6 @@
}
},
- new Option(true, CommandOption.CHECK_MODULES) {
- void process(JdepsTask task, String opt, String arg) throws BadArgs {
- if (task.command != null) {
- throw new BadArgs("err.command.set", task.command, opt);
- }
- Set<String> mods = Set.of(arg.split(","));
- task.options.addmods.addAll(mods);
- task.command = task.checkModuleDeps(mods);
- }
- },
- new Option(true, CommandOption.GENERATE_MODULE_INFO) {
- void process(JdepsTask task, String opt, String arg) throws BadArgs {
- if (task.command != null) {
- throw new BadArgs("err.command.set", task.command, opt);
- }
- task.command = task.genModuleInfo(Paths.get(arg), false);
- }
- },
- new Option(true, CommandOption.GENERATE_OPEN_MODULE) {
- void process(JdepsTask task, String opt, String arg) throws BadArgs {
- if (task.command != null) {
- throw new BadArgs("err.command.set", task.command, opt);
- }
- task.command = task.genModuleInfo(Paths.get(arg), true);
- }
- },
- new Option(false, CommandOption.LIST_DEPS) {
- void process(JdepsTask task, String opt, String arg) throws BadArgs {
- if (task.command != null) {
- throw new BadArgs("err.command.set", task.command, opt);
- }
- task.command = task.listModuleDeps(false);
- }
- },
- new Option(false, CommandOption.LIST_REDUCED_DEPS) {
- void process(JdepsTask task, String opt, String arg) throws BadArgs {
- if (task.command != null) {
- throw new BadArgs("err.command.set", task.command, opt);
- }
- task.command = task.listModuleDeps(true);
- }
- },
-
// ---- paths option ----
new Option(true, "-cp", "-classpath", "--class-path") {
void process(JdepsTask task, String opt, String arg) {
@@ -312,15 +269,6 @@
task.options.addmods.addAll(mods);
}
},
- new Option(true, "-m", "--module") {
- void process(JdepsTask task, String opt, String arg) throws BadArgs {
- if (!task.options.rootModules.isEmpty()) {
- throw new BadArgs("err.option.already.specified", opt);
- }
- task.options.rootModules.add(arg);
- task.options.addmods.add(arg);
- }
- },
new Option(true, "--multi-release") {
void process(JdepsTask task, String opt, String arg) throws BadArgs {
if (arg.equalsIgnoreCase("base")) {
@@ -338,6 +286,70 @@
}
}
},
+ new Option(false, "-q", "-quiet") {
+ void process(JdepsTask task, String opt, String arg) {
+ task.options.nowarning = true;
+ }
+ },
+ new Option(false, "-version", "--version") {
+ void process(JdepsTask task, String opt, String arg) {
+ task.options.version = true;
+ }
+ },
+
+ // ---- module-specific options ----
+
+ new Option(true, "-m", "--module") {
+ void process(JdepsTask task, String opt, String arg) throws BadArgs {
+ if (!task.options.rootModules.isEmpty()) {
+ throw new BadArgs("err.option.already.specified", opt);
+ }
+ task.options.rootModules.add(arg);
+ task.options.addmods.add(arg);
+ }
+ },
+ new Option(true, CommandOption.GENERATE_MODULE_INFO) {
+ void process(JdepsTask task, String opt, String arg) throws BadArgs {
+ if (task.command != null) {
+ throw new BadArgs("err.command.set", task.command, opt);
+ }
+ task.command = task.genModuleInfo(Paths.get(arg), false);
+ }
+ },
+ new Option(true, CommandOption.GENERATE_OPEN_MODULE) {
+ void process(JdepsTask task, String opt, String arg) throws BadArgs {
+ if (task.command != null) {
+ throw new BadArgs("err.command.set", task.command, opt);
+ }
+ task.command = task.genModuleInfo(Paths.get(arg), true);
+ }
+ },
+ new Option(true, CommandOption.CHECK_MODULES) {
+ void process(JdepsTask task, String opt, String arg) throws BadArgs {
+ if (task.command != null) {
+ throw new BadArgs("err.command.set", task.command, opt);
+ }
+ Set<String> mods = Set.of(arg.split(","));
+ task.options.addmods.addAll(mods);
+ task.command = task.checkModuleDeps(mods);
+ }
+ },
+ new Option(false, CommandOption.LIST_DEPS) {
+ void process(JdepsTask task, String opt, String arg) throws BadArgs {
+ if (task.command != null) {
+ throw new BadArgs("err.command.set", task.command, opt);
+ }
+ task.command = task.listModuleDeps(false);
+ }
+ },
+ new Option(false, CommandOption.LIST_REDUCED_DEPS) {
+ void process(JdepsTask task, String opt, String arg) throws BadArgs {
+ if (task.command != null) {
+ throw new BadArgs("err.command.set", task.command, opt);
+ }
+ task.command = task.listModuleDeps(true);
+ }
+ },
// ---- Target filtering options ----
new Option(true, "-p", "-package", "--package") {
@@ -424,17 +436,6 @@
}
},
- new Option(false, "-q", "-quiet") {
- void process(JdepsTask task, String opt, String arg) {
- task.options.nowarning = true;
- }
- },
-
- new Option(false, "-version", "--version") {
- void process(JdepsTask task, String opt, String arg) {
- task.options.version = true;
- }
- },
new HiddenOption(false, "-fullversion") {
void process(JdepsTask task, String opt, String arg) {
task.options.fullVersion = true;
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/jdeps.properties Mon Oct 09 10:42:27 2017 +0530
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/jdeps.properties Mon Oct 09 11:38:46 2017 -0700
@@ -86,10 +86,6 @@
\ --add-modules <module-name>[,<module-name>...]\n\
\ Adds modules to the root set for analysis
-main.opt.m=\
-\ -m <module-name>\n\
-\ --module <module-name> Specify the root module for analysis
-
main.opt.R=\
\ -R -recursive Recursively traverse all run-time dependences.\n\
\ The -R option implies -filter:none. If -p,\n\
@@ -121,6 +117,11 @@
\ type, method parameter types, returned type,\n\
\ checked exception types etc.
+main.opt.m=\n\
+\Module dependence analysis options:\n\
+\ -m <module-name>\n\
+\ --module <module-name> Specify the root module for analysis
+
main.opt.generate-module-info=\
\ --generate-module-info <dir> Generate module-info.java under the specified\n\
\ directory. The specified JAR files will be\n\
@@ -142,7 +143,6 @@
\ graph after transition reduction. It also\n\
\ identifies any unused qualified exports.
-
main.opt.dotoutput=\
\ -dotoutput <dir>\n\
\ --dot-output <dir> Destination directory for DOT file output
@@ -157,15 +157,15 @@
\ WARNING: JDK internal APIs are inaccessible.
main.opt.list-deps=\
-\ --list-deps Lists the dependences and use of JDK internal\n\
-\ APIs.
+\ --list-deps Lists the module dependences and also the\n\
+\ package names of JDK internal APIs if referenced.
main.opt.list-reduced-deps=\
\ --list-reduced-deps Same as --list-deps with not listing\n\
\ the implied reads edges from the module graph\n\
-\ If module M1 depends on M2 and M3,\n\
-\ M2 requires public on M3, then M1 reading M3 is\n\
-\ implied and removed from the module graph.
+\ If module M1 reads M2, and M2 requires\n\
+\ transitive on M3, then M1 reading M3 is implied\n\
+\ and is not shown in the graph.
main.opt.depth=\
\ -depth=<depth> Specify the depth of the transitive\n\
--- a/src/jdk.jshell/share/classes/jdk/jshell/Eval.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/jdk.jshell/share/classes/jdk/jshell/Eval.java Mon Oct 09 11:38:46 2017 -0700
@@ -295,6 +295,10 @@
Range rtype = dis.treeToRange(baseType);
typeWrap = Wrap.rangeWrap(compileSource, rtype);
} else {
+ AnalyzeTask at = trialCompile(Wrap.methodWrap(compileSource));
+ if (at.hasErrors()) {
+ return compileFailResult(at, userSource, kindOfTree(unitTree));
+ }
Tree init = vt.getInitializer();
if (init != null) {
Range rinit = dis.treeToRange(init);
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/LinkerCallSite.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/LinkerCallSite.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -59,7 +59,7 @@
*/
public class LinkerCallSite extends ChainedCallSite {
/** Maximum number of arguments passed directly. */
- public static final int ARGLIMIT = 250;
+ public static final int ARGLIMIT = 125;
private static final String PROFILEFILE = Options.getStringProperty("nashorn.profilefile", "NashornProfile.txt");
--- a/src/jdk.scripting.nashorn/share/classes/module-info.java Mon Oct 09 10:42:27 2017 +0530
+++ b/src/jdk.scripting.nashorn/share/classes/module-info.java Mon Oct 09 11:38:46 2017 -0700
@@ -44,8 +44,7 @@
</pre>
*
* and then use it just as you would any other JSR-223 script engine. See
- * <a href="jdk/nashorn/api/scripting/package-summary.html">
- * {@code jdk.nashorn.api.scripting}</a> package for details.
+ * {@link jdk.nashorn.api.scripting} package for details.
* <h1>Compatibility</h1>
* Nashorn is 100% compliant with the
* <a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm"
--- a/test/jdk/java/lang/StackWalker/Basic.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/jdk/java/lang/StackWalker/Basic.java Mon Oct 09 11:38:46 2017 -0700
@@ -29,8 +29,9 @@
*/
import java.lang.StackWalker.StackFrame;
+import java.lang.invoke.MethodType;
import java.util.List;
-import java.util.Objects;
+import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static java.lang.StackWalker.Option.*;
@@ -74,6 +75,37 @@
found);
}
+ @Test
+ public static void testMethodSignature() throws Exception {
+ List<StackFrame> frames = new StackBuilder(16, 16).build();
+ Map<String, MethodType> methodTypes = StackBuilder.methodTypes();
+ for (StackFrame f : frames) {
+ MethodType type = methodTypes.get(f.getMethodName());
+ if (type != null) {
+ System.out.format("%s.%s %s%n", f.getClassName(), f.getMethodName(),
+ f.getDescriptor());
+
+ String descriptor = f.getDescriptor();
+ if (!descriptor.equals(type.toMethodDescriptorString())) {
+ throw new RuntimeException("Expected: " + type.toMethodDescriptorString()
+ + " got: " + f.getDescriptor());
+ }
+
+ if (!f.getMethodType().equals(type)) {
+ throw new RuntimeException("Expected: " + type
+ + " got: " + f.getMethodType());
+ }
+
+ // verify descriptor returned by getDescriptor() before and after
+ // getMethodType() is called
+ if (!descriptor.equals(f.getDescriptor())) {
+ throw new RuntimeException("Mismatched: " + descriptor
+ + " got: " + f.getDescriptor());
+ }
+ }
+ }
+ }
+
private final int depth;
Basic(int depth) {
this.depth = depth;
@@ -132,7 +164,7 @@
}
}
- class StackBuilder {
+ static class StackBuilder {
private final int stackDepth;
private final int limit;
private int depth = 0;
@@ -150,15 +182,17 @@
trace("m1");
m2();
}
- void m2() {
+ List m2() {
trace("m2");
m3();
+ return null;
}
- void m3() {
+ int m3() {
trace("m3");
- m4();
+ m4(null);
+ return 0;
}
- void m4() {
+ void m4(Object o) {
trace("m4");
int remaining = stackDepth-depth-1;
if (remaining >= 4) {
@@ -184,6 +218,13 @@
if (verbose)
System.out.format("%2d: %s%n", depth, methodname);
}
+
+ static Map<String, MethodType> methodTypes() throws Exception {
+ return Map.of("m1", MethodType.methodType(void.class),
+ "m2", MethodType.methodType(List.class),
+ "m3", MethodType.methodType(int.class),
+ "m4", MethodType.methodType(void.class, Object.class));
+ }
}
}
--- a/test/jdk/java/lang/StackWalker/SanityTest.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/jdk/java/lang/StackWalker/SanityTest.java Mon Oct 09 11:38:46 2017 -0700
@@ -79,4 +79,24 @@
throw new RuntimeException("NPE expected");
} catch (NullPointerException e) {}
}
+
+
+ @Test
+ public static void testUOEFromGetDeclaringClass() {
+ try {
+ StackWalker sw = StackWalker.getInstance();
+ sw.forEach(StackWalker.StackFrame::getDeclaringClass);
+ throw new RuntimeException("UOE expected");
+ } catch (UnsupportedOperationException expected) {
+ }
+ }
+
+ @Test
+ public static void testUOEFromGetMethodType() {
+ try {
+ StackWalker sw = StackWalker.getInstance();
+ sw.forEach(StackWalker.StackFrame::getMethodType);
+ throw new RuntimeException("UOE expected");
+ } catch (UnsupportedOperationException expected) {}
+ }
}
--- a/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPSetAuthenticatorTest.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPSetAuthenticatorTest.java Mon Oct 09 11:38:46 2017 -0700
@@ -147,11 +147,6 @@
throw new AssertionError("Authenticator #2 called " + count(count)
+ " expected it to be called " + expected(expectedIncrement));
}
- count = authTwo.count.get();
- if (count != expectedIncrement) {
- throw new AssertionError("Authenticator #2 called " + count(count)
- + " expected it to be called " + expected(expectedIncrement));
- }
// Connect to the server with a GET request, then with a
// POST that contains "Hello World!"
--- a/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPTestServer.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPTestServer.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -46,6 +46,7 @@
import java.net.MalformedURLException;
import java.net.ServerSocket;
import java.net.Socket;
+import java.net.SocketAddress;
import java.net.URL;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
@@ -148,62 +149,139 @@
}
/**
- * The HttpServerFactory ensures that the local port used by an HttpServer
- * previously created by the current test/VM will not get reused by
- * a subsequent test in the same VM. This is to avoid having the
- * AuthCache reuse credentials from previous tests - which would
- * invalidate the assumptions made by the current test on when
- * the default authenticator should be called.
+ * The SocketBindableFactory ensures that the local port used by an HttpServer
+ * or a proxy ServerSocket previously created by the current test/VM will not
+ * get reused by a subsequent test in the same VM. This is to avoid having the
+ * AuthCache reuse credentials from previous tests - which would invalidate the
+ * assumptions made by the current test on when the default authenticator should
+ * be called.
*/
- private static final class HttpServerFactory {
+ private static abstract class SocketBindableFactory<B> {
private static final int MAX = 10;
private static final CopyOnWriteArrayList<String> addresses =
new CopyOnWriteArrayList<>();
- private static HttpServer newHttpServer(HttpProtocolType protocol)
- throws IOException {
- switch (protocol) {
- case HTTP: return HttpServer.create();
- case HTTPS: return HttpsServer.create();
- default: throw new InternalError("Unsupported protocol " + protocol);
- }
- }
- static <T extends HttpServer> T create(HttpProtocolType protocol)
- throws IOException {
+ protected B createInternal() throws IOException {
final int max = addresses.size() + MAX;
- final List<HttpServer> toClose = new ArrayList<>();
+ final List<B> toClose = new ArrayList<>();
try {
for (int i = 1; i <= max; i++) {
- HttpServer server = newHttpServer(protocol);
- server.bind(new InetSocketAddress("127.0.0.1", 0), 0);
- InetSocketAddress address = server.getAddress();
+ B bindable = createBindable();
+ SocketAddress address = getAddress(bindable);
String key = address.toString();
if (addresses.addIfAbsent(key)) {
- System.out.println("Server bound to: " + key
+ System.out.println("Socket bound to: " + key
+ " after " + i + " attempt(s)");
- return (T) server;
+ return bindable;
}
System.out.println("warning: address " + key
+ " already used. Retrying bind.");
// keep the port bound until we get a port that we haven't
// used already
- toClose.add(server);
+ toClose.add(bindable);
}
} finally {
- // if we had to retry, then close the servers we're not
+ // if we had to retry, then close the socket we're not
// going to use.
- for (HttpServer s : toClose) {
- try { s.stop(1); } catch (Exception x) { /* ignore */ }
+ for (B b : toClose) {
+ try { close(b); } catch (Exception x) { /* ignore */ }
}
}
- throw new IOException("Couldn't bind servers after " + max + " attempts: "
+ throw new IOException("Couldn't bind socket after " + max + " attempts: "
+ "addresses used before: " + addresses);
}
+
+ protected abstract B createBindable() throws IOException;
+
+ protected abstract SocketAddress getAddress(B bindable);
+
+ protected abstract void close(B bindable) throws IOException;
+ }
+
+ /*
+ * Used to create ServerSocket for a proxy.
+ */
+ private static final class ServerSocketFactory
+ extends SocketBindableFactory<ServerSocket> {
+ private static final ServerSocketFactory instance = new ServerSocketFactory();
+
+ static ServerSocket create() throws IOException {
+ return instance.createInternal();
+ }
+
+ @Override
+ protected ServerSocket createBindable() throws IOException {
+ return new ServerSocket(0, 0, InetAddress.getByName("127.0.0.1"));
+ }
+
+ @Override
+ protected SocketAddress getAddress(ServerSocket socket) {
+ return socket.getLocalSocketAddress();
+ }
+
+ @Override
+ protected void close(ServerSocket socket) throws IOException {
+ socket.close();
+ }
+ }
+
+ /*
+ * Used to create HttpServer for a NTLMTestServer.
+ */
+ private static abstract class WebServerFactory<S extends HttpServer>
+ extends SocketBindableFactory<S> {
+ @Override
+ protected S createBindable() throws IOException {
+ S server = newHttpServer();
+ server.bind(new InetSocketAddress("127.0.0.1", 0), 0);
+ return server;
+ }
+
+ @Override
+ protected SocketAddress getAddress(S server) {
+ return server.getAddress();
+ }
+
+ @Override
+ protected void close(S server) throws IOException {
+ server.stop(1);
+ }
+
+ /*
+ * Returns a HttpServer or a HttpsServer in different subclasses.
+ */
+ protected abstract S newHttpServer() throws IOException;
+ }
+
+ private static final class HttpServerFactory extends WebServerFactory<HttpServer> {
+ private static final HttpServerFactory instance = new HttpServerFactory();
+
+ static HttpServer create() throws IOException {
+ return instance.createInternal();
+ }
+
+ @Override
+ protected HttpServer newHttpServer() throws IOException {
+ return HttpServer.create();
+ }
+ }
+
+ private static final class HttpsServerFactory extends WebServerFactory<HttpsServer> {
+ private static final HttpsServerFactory instance = new HttpsServerFactory();
+
+ static HttpsServer create() throws IOException {
+ return instance.createInternal();
+ }
+
+ @Override
+ protected HttpsServer newHttpServer() throws IOException {
+ return HttpsServer.create();
+ }
}
static HttpServer createHttpServer(HttpProtocolType protocol) throws IOException {
switch (protocol) {
- case HTTP: return HttpServerFactory.create(protocol);
- case HTTPS: return configure(HttpServerFactory.create(protocol));
+ case HTTP: return HttpServerFactory.create();
+ case HTTPS: return configure(HttpsServerFactory.create());
default: throw new InternalError("Unsupported protocol " + protocol);
}
}
@@ -894,7 +972,7 @@
super(server, target, delegate);
System.out.flush();
System.err.println("WARNING: HttpsProxyTunnel is an experimental test class");
- ss = new ServerSocket(0, 0, InetAddress.getByName("127.0.0.1"));
+ ss = ServerSocketFactory.create();
start();
}
--- a/test/jdk/java/util/Collection/IteratorMicroBenchmark.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/jdk/java/util/Collection/IteratorMicroBenchmark.java Mon Oct 09 11:38:46 2017 -0700
@@ -36,12 +36,10 @@
import java.util.Collection;
import java.util.Collections;
import java.util.Deque;
-import java.util.Enumeration;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
-import java.util.Map;
import java.util.PriorityQueue;
import java.util.Spliterator;
import java.util.Vector;
@@ -52,7 +50,6 @@
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.LinkedTransferQueue;
import java.util.concurrent.PriorityBlockingQueue;
-import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
--- a/test/jdk/java/util/Collection/RemoveMicroBenchmark.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/jdk/java/util/Collection/RemoveMicroBenchmark.java Mon Oct 09 11:38:46 2017 -0700
@@ -29,20 +29,16 @@
import java.lang.ref.WeakReference;
import java.util.ArrayDeque;
-import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Deque;
-import java.util.Enumeration;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
-import java.util.Map;
import java.util.PriorityQueue;
import java.util.Queue;
-import java.util.Spliterator;
import java.util.Vector;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingDeque;
--- a/test/jdk/java/util/Collection/testlibrary/CollectionAsserts.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/jdk/java/util/Collection/testlibrary/CollectionAsserts.java Mon Oct 09 11:38:46 2017 -0700
@@ -23,7 +23,6 @@
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Iterator;
--- a/test/jdk/java/util/Collection/testlibrary/ExtendsAbstractCollection.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/jdk/java/util/Collection/testlibrary/ExtendsAbstractCollection.java Mon Oct 09 11:38:46 2017 -0700
@@ -21,8 +21,6 @@
* questions.
*/
import java.util.AbstractCollection;
-import java.util.HashSet;
-import java.util.AbstractSet;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
--- a/test/jdk/java/util/List/ListDefaults.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/jdk/java/util/List/ListDefaults.java Mon Oct 09 11:38:46 2017 -0700
@@ -42,12 +42,10 @@
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
-import java.lang.reflect.Constructor;
import java.util.ConcurrentModificationException;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
-import java.util.function.Supplier;
/**
* @test
--- a/test/jdk/java/util/concurrent/CompletableFuture/Basic.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/jdk/java/util/concurrent/CompletableFuture/Basic.java Mon Oct 09 11:38:46 2017 -0700
@@ -74,7 +74,7 @@
check(!cf.isCompletedExceptionally(), "Expected isCompletedExceptionally to return false");
check(!cf.isCancelled(), "Expected isCancelled to be false");
check(!cf.cancel(true), "Expected cancel to return false");
- check(cf.toString().contains("[Completed normally]"));
+ check(cf.toString().matches(".*\\[.*Completed normally.*\\]"));
check(cf.complete(null) == false, "Expected complete() to fail");
check(cf.completeExceptionally(new Throwable()) == false,
"Expected completeExceptionally() to fail");
@@ -106,7 +106,7 @@
check(cf.isCompletedExceptionally(), "Expected isCompletedExceptionally");
check(cf.isCancelled() == cancelled, "Expected isCancelled: " + cancelled + ", got:" + cf.isCancelled());
check(cf.cancel(true) == cancelled, "Expected cancel: " + cancelled + ", got:" + cf.cancel(true));
- check(cf.toString().contains("[Completed exceptionally]")); // ## TODO: 'E'xceptionally
+ check(cf.toString().matches(".*\\[.*Completed exceptionally.*\\]")); // ## TODO: 'E'xceptionally
check(cf.complete((T)new Object()) == false, "Expected complete() to fail");
check(cf.completeExceptionally(new Throwable()) == false,
"Expected completeExceptionally() to fail, already completed");
--- a/test/jdk/java/util/concurrent/ThreadPoolExecutor/ThrowingTasks.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/jdk/java/util/concurrent/ThreadPoolExecutor/ThrowingTasks.java Mon Oct 09 11:38:46 2017 -0700
@@ -43,7 +43,6 @@
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.locks.ReentrantLock;
import java.util.function.Supplier;
@@ -55,26 +54,18 @@
extends ConcurrentHashMap<Class<?>, Integer> {
void inc(Class<?> key) {
- for (;;) {
- Integer i = get(key);
- if (i == null) {
- if (putIfAbsent(key, 1) == null)
- return;
- } else {
- if (replace(key, i, i + 1))
- return;
- }
- }
+ compute(key, (k, v) -> (v == null) ? 1 : v + 1);
}
}
+ /** Double-check that HashTable and ConcurrentHashMap are work-alikes. */
@SuppressWarnings("serial")
static class UncaughtExceptionsTable
extends Hashtable<Class<?>, Integer> {
synchronized void inc(Class<?> key) {
- Integer i = get(key);
- put(key, (i == null) ? 1 : i + 1);
+ Integer v = get(key);
+ put(key, (v == null) ? 1 : v + 1);
}
}
@@ -82,37 +73,20 @@
= new UncaughtExceptions();
static final UncaughtExceptionsTable uncaughtExceptionsTable
= new UncaughtExceptionsTable();
- static final AtomicLong totalUncaughtExceptions
- = new AtomicLong(0);
+ static final AtomicInteger totalUncaughtExceptions
+ = new AtomicInteger(0);
static final CountDownLatch uncaughtExceptionsLatch
= new CountDownLatch(24);
- static final Thread.UncaughtExceptionHandler handler
- = new Thread.UncaughtExceptionHandler() {
- public void uncaughtException(Thread t, Throwable e) {
- check(! Thread.currentThread().isInterrupted());
- totalUncaughtExceptions.getAndIncrement();
- uncaughtExceptions.inc(e.getClass());
- uncaughtExceptionsTable.inc(e.getClass());
- uncaughtExceptionsLatch.countDown();
- }};
-
static final ThreadGroup tg = new ThreadGroup("Flaky");
- static final ThreadFactory tf = new ThreadFactory() {
- public Thread newThread(Runnable r) {
- Thread t = new Thread(tg, r);
- t.setUncaughtExceptionHandler(handler);
- return t;
- }};
-
static final RuntimeException rte = new RuntimeException();
static final Error error = new Error();
static final Throwable weird = new Throwable();
static final Exception checkedException = new Exception();
static class Thrower implements Runnable {
- Throwable t;
+ final Throwable t;
Thrower(Throwable t) { this.t = t; }
public void run() {
if (t != null)
@@ -120,14 +94,12 @@
}
}
- static final Thrower noThrower = new Thrower(null);
- static final Thrower rteThrower = new Thrower(rte);
- static final Thrower errorThrower = new Thrower(error);
- static final Thrower weirdThrower = new Thrower(weird);
- static final Thrower checkedThrower = new Thrower(checkedException);
-
static final List<Thrower> throwers = Arrays.asList(
- noThrower, rteThrower, errorThrower, weirdThrower, checkedThrower);
+ new Thrower(null),
+ new Thrower(rte),
+ new Thrower(error),
+ new Thrower(weird),
+ new Thrower(checkedException));
static class Flaky implements Runnable {
final Runnable beforeExecute;
@@ -190,7 +162,18 @@
super(10, 10,
1L, TimeUnit.HOURS,
new LinkedBlockingQueue<Runnable>(),
- tf);
+ (ThreadFactory) (runnable) -> {
+ Thread thread = new Thread(tg, runnable);
+ Thread.UncaughtExceptionHandler handler = (t, e) -> {
+ check(! t.isInterrupted());
+ totalUncaughtExceptions.getAndIncrement();
+ uncaughtExceptions.inc(e.getClass());
+ uncaughtExceptionsTable.inc(e.getClass());
+ uncaughtExceptionsLatch.countDown();
+ };
+ thread.setUncaughtExceptionHandler(handler);
+ return thread;
+ });
}
@Override protected void beforeExecute(Thread t, Runnable r) {
final boolean lessThanCorePoolSize;
@@ -262,19 +245,17 @@
check(tpe.awaitTermination(10L, TimeUnit.MINUTES));
checkTerminated(tpe);
- //while (tg.activeCount() > 0) Thread.sleep(10);
- //System.out.println(uncaughtExceptions);
List<Map<Class<?>, Integer>> maps = new ArrayList<>();
maps.add(uncaughtExceptions);
maps.add(uncaughtExceptionsTable);
for (Map<Class<?>, Integer> map : maps) {
- equal(map.get(Exception.class), throwers.size());
- equal(map.get(weird.getClass()), throwers.size());
- equal(map.get(Error.class), throwers.size() + 1 + 2);
+ equal(map.get(Exception.class), throwers.size() + 1);
+ equal(map.get(weird.getClass()), throwers.size() + 1);
+ equal(map.get(Error.class), throwers.size() + 1);
equal(map.get(RuntimeException.class), throwers.size() + 1);
equal(map.size(), 4);
}
- equal(totalUncaughtExceptions.get(), 4L*throwers.size() + 4L);
+ equal(totalUncaughtExceptions.get(), 4*throwers.size() + 4);
equal(beforeExecuteCount.get(), flakes.size());
equal(afterExecuteCount.get(), throwers.size());
--- a/test/jdk/java/util/concurrent/tck/AbstractQueuedLongSynchronizerTest.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/jdk/java/util/concurrent/tck/AbstractQueuedLongSynchronizerTest.java Mon Oct 09 11:38:46 2017 -0700
@@ -58,6 +58,9 @@
/**
* A simple mutex class, adapted from the class javadoc. Exclusive
* acquire tests exercise this as a sample user extension.
+ *
+ * Unlike the javadoc sample, we don't track owner thread via
+ * AbstractOwnableSynchronizer methods.
*/
static class Mutex extends AbstractQueuedLongSynchronizer {
/** An eccentric value > 32 bits for locked synchronizer state. */
@@ -65,18 +68,19 @@
static final long UNLOCKED = 0;
- public boolean isHeldExclusively() {
+ /** Owner thread is untracked, so this is really just isLocked(). */
+ @Override public boolean isHeldExclusively() {
long state = getState();
assertTrue(state == UNLOCKED || state == LOCKED);
return state == LOCKED;
}
- public boolean tryAcquire(long acquires) {
+ @Override protected boolean tryAcquire(long acquires) {
assertEquals(LOCKED, acquires);
return compareAndSetState(UNLOCKED, LOCKED);
}
- public boolean tryRelease(long releases) {
+ @Override protected boolean tryRelease(long releases) {
if (getState() != LOCKED) throw new IllegalMonitorStateException();
setState(UNLOCKED);
return true;
@@ -106,13 +110,14 @@
release(LOCKED);
}
+ /** Faux-Implements Lock.newCondition(). */
public ConditionObject newCondition() {
return new ConditionObject();
}
}
/**
- * A simple latch class, to test shared mode.
+ * A minimal latch class, to test shared mode.
*/
static class BooleanLatch extends AbstractQueuedLongSynchronizer {
public boolean isSignalled() { return getState() != 0; }
--- a/test/jdk/java/util/concurrent/tck/AbstractQueuedSynchronizerTest.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/jdk/java/util/concurrent/tck/AbstractQueuedSynchronizerTest.java Mon Oct 09 11:38:46 2017 -0700
@@ -61,6 +61,9 @@
* methods/features of AbstractQueuedSynchronizer are tested via
* other test classes, including those for ReentrantLock,
* ReentrantReadWriteLock, and Semaphore.
+ *
+ * Unlike the javadoc sample, we don't track owner thread via
+ * AbstractOwnableSynchronizer methods.
*/
static class Mutex extends AbstractQueuedSynchronizer {
/** An eccentric value for locked synchronizer state. */
@@ -68,18 +71,19 @@
static final int UNLOCKED = 0;
+ /** Owner thread is untracked, so this is really just isLocked(). */
@Override public boolean isHeldExclusively() {
int state = getState();
assertTrue(state == UNLOCKED || state == LOCKED);
return state == LOCKED;
}
- @Override public boolean tryAcquire(int acquires) {
+ @Override protected boolean tryAcquire(int acquires) {
assertEquals(LOCKED, acquires);
return compareAndSetState(UNLOCKED, LOCKED);
}
- @Override public boolean tryRelease(int releases) {
+ @Override protected boolean tryRelease(int releases) {
if (getState() != LOCKED) throw new IllegalMonitorStateException();
assertEquals(LOCKED, releases);
setState(UNLOCKED);
@@ -110,13 +114,14 @@
release(LOCKED);
}
+ /** Faux-Implements Lock.newCondition(). */
public ConditionObject newCondition() {
return new ConditionObject();
}
}
/**
- * A simple latch class, to test shared mode.
+ * A minimal latch class, to test shared mode.
*/
static class BooleanLatch extends AbstractQueuedSynchronizer {
public boolean isSignalled() { return getState() != 0; }
--- a/test/jdk/java/util/concurrent/tck/AtomicIntegerFieldUpdaterTest.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/jdk/java/util/concurrent/tck/AtomicIntegerFieldUpdaterTest.java Mon Oct 09 11:38:46 2017 -0700
@@ -51,57 +51,6 @@
return new TestSuite(AtomicIntegerFieldUpdaterTest.class);
}
- // for testing subclass access
- static class AtomicIntegerFieldUpdaterTestSubclass extends AtomicIntegerFieldUpdaterTest {
- public void checkPrivateAccess() {
- try {
- AtomicIntegerFieldUpdater<AtomicIntegerFieldUpdaterTest> a =
- AtomicIntegerFieldUpdater.newUpdater
- (AtomicIntegerFieldUpdaterTest.class, "privateField");
- shouldThrow();
- } catch (RuntimeException success) {
- assertNotNull(success.getCause());
- }
- }
-
- public void checkCompareAndSetProtectedSub() {
- AtomicIntegerFieldUpdater<AtomicIntegerFieldUpdaterTest> a =
- AtomicIntegerFieldUpdater.newUpdater
- (AtomicIntegerFieldUpdaterTest.class, "protectedField");
- this.protectedField = 1;
- assertTrue(a.compareAndSet(this, 1, 2));
- assertTrue(a.compareAndSet(this, 2, -4));
- assertEquals(-4, a.get(this));
- assertFalse(a.compareAndSet(this, -5, 7));
- assertEquals(-4, a.get(this));
- assertTrue(a.compareAndSet(this, -4, 7));
- assertEquals(7, a.get(this));
- }
- }
-
- static class UnrelatedClass {
- public void checkPackageAccess(AtomicIntegerFieldUpdaterTest obj) {
- obj.x = 72;
- AtomicIntegerFieldUpdater<AtomicIntegerFieldUpdaterTest> a =
- AtomicIntegerFieldUpdater.newUpdater
- (AtomicIntegerFieldUpdaterTest.class, "x");
- assertEquals(72, a.get(obj));
- assertTrue(a.compareAndSet(obj, 72, 73));
- assertEquals(73, a.get(obj));
- }
-
- public void checkPrivateAccess(AtomicIntegerFieldUpdaterTest obj) {
- try {
- AtomicIntegerFieldUpdater<AtomicIntegerFieldUpdaterTest> a =
- AtomicIntegerFieldUpdater.newUpdater
- (AtomicIntegerFieldUpdaterTest.class, "privateField");
- throw new AssertionError("should throw");
- } catch (RuntimeException success) {
- assertNotNull(success.getCause());
- }
- }
- }
-
AtomicIntegerFieldUpdater<AtomicIntegerFieldUpdaterTest> updaterFor(String fieldName) {
return AtomicIntegerFieldUpdater.newUpdater
(AtomicIntegerFieldUpdaterTest.class, fieldName);
@@ -143,9 +92,8 @@
* construction using private field from subclass throws RuntimeException
*/
public void testPrivateFieldInSubclass() {
- AtomicIntegerFieldUpdaterTestSubclass s =
- new AtomicIntegerFieldUpdaterTestSubclass();
- s.checkPrivateAccess();
+ new NonNestmates.AtomicIntegerFieldUpdaterTestSubclass()
+ .checkPrivateAccess();
}
/**
@@ -153,8 +101,8 @@
* private access is not
*/
public void testUnrelatedClassAccess() {
- new UnrelatedClass().checkPackageAccess(this);
- new UnrelatedClass().checkPrivateAccess(this);
+ new NonNestmates().checkPackageAccess(this);
+ new NonNestmates().checkPrivateAccess(this);
}
/**
@@ -223,9 +171,8 @@
* equal to expected else fails
*/
public void testCompareAndSetProtectedInSubclass() {
- AtomicIntegerFieldUpdaterTestSubclass s =
- new AtomicIntegerFieldUpdaterTestSubclass();
- s.checkCompareAndSetProtectedSub();
+ new NonNestmates.AtomicIntegerFieldUpdaterTestSubclass()
+ .checkCompareAndSetProtectedSub();
}
/**
--- a/test/jdk/java/util/concurrent/tck/AtomicLongFieldUpdaterTest.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/jdk/java/util/concurrent/tck/AtomicLongFieldUpdaterTest.java Mon Oct 09 11:38:46 2017 -0700
@@ -51,57 +51,6 @@
return new TestSuite(AtomicLongFieldUpdaterTest.class);
}
- // for testing subclass access
- static class AtomicLongFieldUpdaterTestSubclass extends AtomicLongFieldUpdaterTest {
- public void checkPrivateAccess() {
- try {
- AtomicLongFieldUpdater<AtomicLongFieldUpdaterTest> a =
- AtomicLongFieldUpdater.newUpdater
- (AtomicLongFieldUpdaterTest.class, "privateField");
- shouldThrow();
- } catch (RuntimeException success) {
- assertNotNull(success.getCause());
- }
- }
-
- public void checkCompareAndSetProtectedSub() {
- AtomicLongFieldUpdater<AtomicLongFieldUpdaterTest> a =
- AtomicLongFieldUpdater.newUpdater
- (AtomicLongFieldUpdaterTest.class, "protectedField");
- this.protectedField = 1;
- assertTrue(a.compareAndSet(this, 1, 2));
- assertTrue(a.compareAndSet(this, 2, -4));
- assertEquals(-4, a.get(this));
- assertFalse(a.compareAndSet(this, -5, 7));
- assertEquals(-4, a.get(this));
- assertTrue(a.compareAndSet(this, -4, 7));
- assertEquals(7, a.get(this));
- }
- }
-
- static class UnrelatedClass {
- public void checkPackageAccess(AtomicLongFieldUpdaterTest obj) {
- obj.x = 72L;
- AtomicLongFieldUpdater<AtomicLongFieldUpdaterTest> a =
- AtomicLongFieldUpdater.newUpdater
- (AtomicLongFieldUpdaterTest.class, "x");
- assertEquals(72L, a.get(obj));
- assertTrue(a.compareAndSet(obj, 72L, 73L));
- assertEquals(73L, a.get(obj));
- }
-
- public void checkPrivateAccess(AtomicLongFieldUpdaterTest obj) {
- try {
- AtomicLongFieldUpdater<AtomicLongFieldUpdaterTest> a =
- AtomicLongFieldUpdater.newUpdater
- (AtomicLongFieldUpdaterTest.class, "privateField");
- throw new AssertionError("should throw");
- } catch (RuntimeException success) {
- assertNotNull(success.getCause());
- }
- }
- }
-
AtomicLongFieldUpdater<AtomicLongFieldUpdaterTest> updaterFor(String fieldName) {
return AtomicLongFieldUpdater.newUpdater
(AtomicLongFieldUpdaterTest.class, fieldName);
@@ -143,9 +92,8 @@
* construction using private field from subclass throws RuntimeException
*/
public void testPrivateFieldInSubclass() {
- AtomicLongFieldUpdaterTestSubclass s =
- new AtomicLongFieldUpdaterTestSubclass();
- s.checkPrivateAccess();
+ new NonNestmates.AtomicLongFieldUpdaterTestSubclass()
+ .checkPrivateAccess();
}
/**
@@ -153,8 +101,8 @@
* private access is not
*/
public void testUnrelatedClassAccess() {
- new UnrelatedClass().checkPackageAccess(this);
- new UnrelatedClass().checkPrivateAccess(this);
+ new NonNestmates().checkPackageAccess(this);
+ new NonNestmates().checkPrivateAccess(this);
}
/**
@@ -223,9 +171,8 @@
* equal to expected else fails
*/
public void testCompareAndSetProtectedInSubclass() {
- AtomicLongFieldUpdaterTestSubclass s =
- new AtomicLongFieldUpdaterTestSubclass();
- s.checkCompareAndSetProtectedSub();
+ new NonNestmates.AtomicLongFieldUpdaterTestSubclass()
+ .checkCompareAndSetProtectedSub();
}
/**
--- a/test/jdk/java/util/concurrent/tck/AtomicReferenceFieldUpdaterTest.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/jdk/java/util/concurrent/tck/AtomicReferenceFieldUpdaterTest.java Mon Oct 09 11:38:46 2017 -0700
@@ -53,57 +53,6 @@
return new TestSuite(AtomicReferenceFieldUpdaterTest.class);
}
- // for testing subclass access
- static class AtomicReferenceFieldUpdaterTestSubclass extends AtomicReferenceFieldUpdaterTest {
- public void checkPrivateAccess() {
- try {
- AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest,Integer> a =
- AtomicReferenceFieldUpdater.newUpdater
- (AtomicReferenceFieldUpdaterTest.class, Integer.class, "privateField");
- shouldThrow();
- } catch (RuntimeException success) {
- assertNotNull(success.getCause());
- }
- }
-
- public void checkCompareAndSetProtectedSub() {
- AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest,Integer> a =
- AtomicReferenceFieldUpdater.newUpdater
- (AtomicReferenceFieldUpdaterTest.class, Integer.class, "protectedField");
- this.protectedField = one;
- assertTrue(a.compareAndSet(this, one, two));
- assertTrue(a.compareAndSet(this, two, m4));
- assertSame(m4, a.get(this));
- assertFalse(a.compareAndSet(this, m5, seven));
- assertNotSame(seven, a.get(this));
- assertTrue(a.compareAndSet(this, m4, seven));
- assertSame(seven, a.get(this));
- }
- }
-
- static class UnrelatedClass {
- public void checkPackageAccess(AtomicReferenceFieldUpdaterTest obj) {
- obj.x = one;
- AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest,Integer> a =
- AtomicReferenceFieldUpdater.newUpdater
- (AtomicReferenceFieldUpdaterTest.class, Integer.class, "x");
- assertSame(one, a.get(obj));
- assertTrue(a.compareAndSet(obj, one, two));
- assertSame(two, a.get(obj));
- }
-
- public void checkPrivateAccess(AtomicReferenceFieldUpdaterTest obj) {
- try {
- AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest,Integer> a =
- AtomicReferenceFieldUpdater.newUpdater
- (AtomicReferenceFieldUpdaterTest.class, Integer.class, "privateField");
- throw new AssertionError("should throw");
- } catch (RuntimeException success) {
- assertNotNull(success.getCause());
- }
- }
- }
-
static AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest, Integer> updaterFor(String fieldName) {
return AtomicReferenceFieldUpdater.newUpdater
(AtomicReferenceFieldUpdaterTest.class, Integer.class, fieldName);
@@ -155,9 +104,8 @@
* construction using private field from subclass throws RuntimeException
*/
public void testPrivateFieldInSubclass() {
- AtomicReferenceFieldUpdaterTestSubclass s =
- new AtomicReferenceFieldUpdaterTestSubclass();
- s.checkPrivateAccess();
+ new NonNestmates.AtomicReferenceFieldUpdaterTestSubclass()
+ .checkPrivateAccess();
}
/**
@@ -165,8 +113,8 @@
* private access is not
*/
public void testUnrelatedClassAccess() {
- new UnrelatedClass().checkPackageAccess(this);
- new UnrelatedClass().checkPrivateAccess(this);
+ new NonNestmates().checkPackageAccess(this);
+ new NonNestmates().checkPrivateAccess(this);
}
/**
@@ -198,7 +146,7 @@
}
/**
- * compareAndSet succeeds in changing value if equal to expected else fails
+ * compareAndSet succeeds in changing value if same as expected else fails
*/
public void testCompareAndSet() {
AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest, Integer> a;
@@ -214,6 +162,15 @@
}
/**
+ * compareAndSet succeeds in changing protected field value if
+ * same as expected else fails
+ */
+ public void testCompareAndSetProtectedInSubclass() {
+ new NonNestmates.AtomicReferenceFieldUpdaterTestSubclass()
+ .checkCompareAndSetProtectedSub();
+ }
+
+ /**
* compareAndSet in one thread enables another waiting for value
* to succeed
*/
@@ -236,8 +193,7 @@
}
/**
- * repeated weakCompareAndSet succeeds in changing value when equal
- * to expected
+ * repeated weakCompareAndSet succeeds in changing value when same as expected
*/
public void testWeakCompareAndSet() {
AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest, Integer> a;
--- a/test/jdk/java/util/concurrent/tck/Collection8Test.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/jdk/java/util/concurrent/tck/Collection8Test.java Mon Oct 09 11:38:46 2017 -0700
@@ -86,9 +86,9 @@
Object bomb() {
return new Object() {
- public boolean equals(Object x) { throw new AssertionError(); }
- public int hashCode() { throw new AssertionError(); }
- };
+ public boolean equals(Object x) { throw new AssertionError(); }
+ public int hashCode() { throw new AssertionError(); }
+ };
}
/** Checks properties of empty collections. */
--- a/test/jdk/java/util/concurrent/tck/CompletableFutureTest.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/jdk/java/util/concurrent/tck/CompletableFutureTest.java Mon Oct 09 11:38:46 2017 -0700
@@ -86,7 +86,7 @@
void checkIncomplete(CompletableFuture<?> f) {
assertFalse(f.isDone());
assertFalse(f.isCancelled());
- assertTrue(f.toString().contains("Not completed"));
+ assertTrue(f.toString().matches(".*\\[.*Not completed.*\\]"));
try {
assertNull(f.getNow(null));
} catch (Throwable fail) { threadUnexpectedException(fail); }
@@ -109,7 +109,7 @@
assertTrue(f.isDone());
assertFalse(f.isCancelled());
assertFalse(f.isCompletedExceptionally());
- assertTrue(f.toString().contains("[Completed normally]"));
+ assertTrue(f.toString().matches(".*\\[.*Completed normally.*\\]"));
}
/**
@@ -165,7 +165,7 @@
assertFalse(f.isCancelled());
assertTrue(f.isDone());
assertTrue(f.isCompletedExceptionally());
- assertTrue(f.toString().contains("[Completed exceptionally]"));
+ assertTrue(f.toString().matches(".*\\[.*Completed exceptionally.*\\]"));
}
void checkCompletedWithWrappedCFException(CompletableFuture<?> f) {
@@ -220,7 +220,7 @@
assertTrue(f.isDone());
assertTrue(f.isCompletedExceptionally());
assertTrue(f.isCancelled());
- assertTrue(f.toString().contains("[Completed exceptionally]"));
+ assertTrue(f.toString().matches(".*\\[.*Completed exceptionally.*\\]"));
}
/**
@@ -356,23 +356,40 @@
/**
* toString indicates current completion state
*/
- public void testToString() {
- CompletableFuture<String> f;
-
- f = new CompletableFuture<String>();
- assertTrue(f.toString().contains("[Not completed]"));
-
+ public void testToString_incomplete() {
+ CompletableFuture<String> f = new CompletableFuture<String>();
+ assertTrue(f.toString().matches(".*\\[.*Not completed.*\\]"));
+ if (testImplementationDetails)
+ assertEquals(identityString(f) + "[Not completed]",
+ f.toString());
+ }
+
+ public void testToString_normal() {
+ CompletableFuture<String> f = new CompletableFuture<String>();
assertTrue(f.complete("foo"));
- assertTrue(f.toString().contains("[Completed normally]"));
-
- f = new CompletableFuture<String>();
+ assertTrue(f.toString().matches(".*\\[.*Completed normally.*\\]"));
+ if (testImplementationDetails)
+ assertEquals(identityString(f) + "[Completed normally]",
+ f.toString());
+ }
+
+ public void testToString_exception() {
+ CompletableFuture<String> f = new CompletableFuture<String>();
assertTrue(f.completeExceptionally(new IndexOutOfBoundsException()));
- assertTrue(f.toString().contains("[Completed exceptionally]"));
-
+ assertTrue(f.toString().matches(".*\\[.*Completed exceptionally.*\\]"));
+ if (testImplementationDetails)
+ assertTrue(f.toString().startsWith(
+ identityString(f) + "[Completed exceptionally: "));
+ }
+
+ public void testToString_cancelled() {
for (boolean mayInterruptIfRunning : new boolean[] { true, false }) {
- f = new CompletableFuture<String>();
+ CompletableFuture<String> f = new CompletableFuture<String>();
assertTrue(f.cancel(mayInterruptIfRunning));
- assertTrue(f.toString().contains("[Completed exceptionally]"));
+ assertTrue(f.toString().matches(".*\\[.*Completed exceptionally.*\\]"));
+ if (testImplementationDetails)
+ assertTrue(f.toString().startsWith(
+ identityString(f) + "[Completed exceptionally: "));
}
}
--- a/test/jdk/java/util/concurrent/tck/ConcurrentHashMapTest.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/jdk/java/util/concurrent/tck/ConcurrentHashMapTest.java Mon Oct 09 11:38:46 2017 -0700
@@ -26,8 +26,9 @@
* However, the following notice accompanied the original version of this
* file:
*
- * Written by Doug Lea with assistance from members of JCP JSR-166
- * Expert Group and released to the public domain, as explained at
+ * Written by Doug Lea and Martin Buchholz with assistance from
+ * members of JCP JSR-166 Expert Group and released to the public
+ * domain, as explained at
* http://creativecommons.org/publicdomain/zero/1.0/
* Other contributors include Andrew Wright, Jeffrey Hayes,
* Pat Fisher, Mike Judd.
@@ -45,14 +46,25 @@
import java.util.concurrent.ConcurrentHashMap;
import junit.framework.Test;
-import junit.framework.TestSuite;
public class ConcurrentHashMapTest extends JSR166TestCase {
public static void main(String[] args) {
main(suite(), args);
}
public static Test suite() {
- return new TestSuite(ConcurrentHashMapTest.class);
+ class Implementation implements MapImplementation {
+ public Class<?> klazz() { return ConcurrentHashMap.class; }
+ public Map emptyMap() { return new ConcurrentHashMap(); }
+ public Object makeKey(int i) { return i; }
+ public Object makeValue(int i) { return i; }
+ public boolean isConcurrent() { return true; }
+ public boolean permitsNullKeys() { return false; }
+ public boolean permitsNullValues() { return false; }
+ public boolean supportsSetValue() { return true; }
+ }
+ return newTestSuite(
+ ConcurrentHashMapTest.class,
+ MapTest.testSuite(new Implementation()));
}
/**
--- a/test/jdk/java/util/concurrent/tck/ConcurrentSkipListMapTest.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/jdk/java/util/concurrent/tck/ConcurrentSkipListMapTest.java Mon Oct 09 11:38:46 2017 -0700
@@ -45,14 +45,25 @@
import java.util.concurrent.ConcurrentSkipListMap;
import junit.framework.Test;
-import junit.framework.TestSuite;
public class ConcurrentSkipListMapTest extends JSR166TestCase {
public static void main(String[] args) {
main(suite(), args);
}
public static Test suite() {
- return new TestSuite(ConcurrentSkipListMapTest.class);
+ class Implementation implements MapImplementation {
+ public Class<?> klazz() { return ConcurrentSkipListMap.class; }
+ public Map emptyMap() { return new ConcurrentSkipListMap(); }
+ public Object makeKey(int i) { return i; }
+ public Object makeValue(int i) { return i; }
+ public boolean isConcurrent() { return true; }
+ public boolean permitsNullKeys() { return false; }
+ public boolean permitsNullValues() { return false; }
+ public boolean supportsSetValue() { return false; }
+ }
+ return newTestSuite(
+ ConcurrentSkipListMapTest.class,
+ MapTest.testSuite(new Implementation()));
}
/**
--- a/test/jdk/java/util/concurrent/tck/ExecutorsTest.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/jdk/java/util/concurrent/tck/ExecutorsTest.java Mon Oct 09 11:38:46 2017 -0700
@@ -613,4 +613,56 @@
} catch (NullPointerException success) {}
}
+ /**
+ * callable(runnable, x).toString() contains toString of wrapped task
+ */
+ public void testCallable_withResult_toString() {
+ if (testImplementationDetails) {
+ Runnable r = () -> {};
+ Callable<String> c = Executors.callable(r, "");
+ assertEquals(
+ identityString(c) + "[Wrapped task = " + r.toString() + "]",
+ c.toString());
+ }
+ }
+
+ /**
+ * callable(runnable).toString() contains toString of wrapped task
+ */
+ public void testCallable_toString() {
+ if (testImplementationDetails) {
+ Runnable r = () -> {};
+ Callable<Object> c = Executors.callable(r);
+ assertEquals(
+ identityString(c) + "[Wrapped task = " + r.toString() + "]",
+ c.toString());
+ }
+ }
+
+ /**
+ * privilegedCallable(callable).toString() contains toString of wrapped task
+ */
+ public void testPrivilegedCallable_toString() {
+ if (testImplementationDetails) {
+ Callable<String> c = () -> "";
+ Callable<String> priv = Executors.privilegedCallable(c);
+ assertEquals(
+ identityString(priv) + "[Wrapped task = " + c.toString() + "]",
+ priv.toString());
+ }
+ }
+
+ /**
+ * privilegedCallableUsingCurrentClassLoader(callable).toString()
+ * contains toString of wrapped task
+ */
+ public void testPrivilegedCallableUsingCurrentClassLoader_toString() {
+ if (testImplementationDetails) {
+ Callable<String> c = () -> "";
+ Callable<String> priv = Executors.privilegedCallableUsingCurrentClassLoader(c);
+ assertEquals(
+ identityString(priv) + "[Wrapped task = " + c.toString() + "]",
+ priv.toString());
+ }
+ }
}
--- a/test/jdk/java/util/concurrent/tck/ForkJoinTaskTest.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/jdk/java/util/concurrent/tck/ForkJoinTaskTest.java Mon Oct 09 11:38:46 2017 -0700
@@ -35,6 +35,7 @@
import java.util.Arrays;
import java.util.HashSet;
+import java.util.concurrent.Callable;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ForkJoinPool;
@@ -1675,4 +1676,42 @@
testInvokeOnPool(mainPool(), a);
}
+ /**
+ * adapt(runnable).toString() contains toString of wrapped task
+ */
+ public void testAdapt_Runnable_toString() {
+ if (testImplementationDetails) {
+ Runnable r = () -> {};
+ ForkJoinTask<?> task = ForkJoinTask.adapt(r);
+ assertEquals(
+ identityString(task) + "[Wrapped task = " + r.toString() + "]",
+ task.toString());
+ }
+ }
+
+ /**
+ * adapt(runnable, x).toString() contains toString of wrapped task
+ */
+ public void testAdapt_Runnable_withResult_toString() {
+ if (testImplementationDetails) {
+ Runnable r = () -> {};
+ ForkJoinTask<String> task = ForkJoinTask.adapt(r, "");
+ assertEquals(
+ identityString(task) + "[Wrapped task = " + r.toString() + "]",
+ task.toString());
+ }
+ }
+
+ /**
+ * adapt(callable).toString() contains toString of wrapped task
+ */
+ public void testAdapt_Callable_toString() {
+ if (testImplementationDetails) {
+ Callable<String> c = () -> "";
+ ForkJoinTask<String> task = ForkJoinTask.adapt(c);
+ assertEquals(
+ identityString(task) + "[Wrapped task = " + c.toString() + "]",
+ task.toString());
+ }
+ }
}
--- a/test/jdk/java/util/concurrent/tck/FutureTaskTest.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/jdk/java/util/concurrent/tck/FutureTaskTest.java Mon Oct 09 11:38:46 2017 -0700
@@ -861,4 +861,45 @@
}
}
+ /**
+ * toString indicates current completion state
+ */
+ public void testToString_incomplete() {
+ FutureTask<String> f = new FutureTask<String>(() -> "");
+ assertTrue(f.toString().matches(".*\\[.*Not completed.*\\]"));
+ if (testImplementationDetails)
+ assertTrue(f.toString().startsWith(
+ identityString(f) + "[Not completed, task ="));
+ }
+
+ public void testToString_normal() {
+ FutureTask<String> f = new FutureTask<String>(() -> "");
+ f.run();
+ assertTrue(f.toString().matches(".*\\[.*Completed normally.*\\]"));
+ if (testImplementationDetails)
+ assertEquals(identityString(f) + "[Completed normally]",
+ f.toString());
+ }
+
+ public void testToString_exception() {
+ FutureTask<String> f = new FutureTask<String>(
+ () -> { throw new ArithmeticException(); });
+ f.run();
+ assertTrue(f.toString().matches(".*\\[.*Completed exceptionally.*\\]"));
+ if (testImplementationDetails)
+ assertTrue(f.toString().startsWith(
+ identityString(f) + "[Completed exceptionally: "));
+ }
+
+ public void testToString_cancelled() {
+ for (boolean mayInterruptIfRunning : new boolean[] { true, false }) {
+ FutureTask<String> f = new FutureTask<String>(() -> "");
+ assertTrue(f.cancel(mayInterruptIfRunning));
+ assertTrue(f.toString().matches(".*\\[.*Cancelled.*\\]"));
+ if (testImplementationDetails)
+ assertEquals(identityString(f) + "[Cancelled]",
+ f.toString());
+ }
+ }
+
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/concurrent/tck/HashMapTest.java Mon Oct 09 11:38:46 2017 -0700
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Written by Doug Lea and Martin Buchholz with assistance from
+ * members of JCP JSR-166 Expert Group and released to the public
+ * domain, as explained at
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+import java.util.HashMap;
+import java.util.Map;
+
+import junit.framework.Test;
+
+public class HashMapTest extends JSR166TestCase {
+ public static void main(String[] args) {
+ main(suite(), args);
+ }
+
+ public static Test suite() {
+ class Implementation implements MapImplementation {
+ public Class<?> klazz() { return HashMap.class; }
+ public Map emptyMap() { return new HashMap(); }
+ public Object makeKey(int i) { return i; }
+ public Object makeValue(int i) { return i; }
+ public boolean isConcurrent() { return false; }
+ public boolean permitsNullKeys() { return true; }
+ public boolean permitsNullValues() { return true; }
+ public boolean supportsSetValue() { return true; }
+ }
+ return newTestSuite(
+ // HashMapTest.class,
+ MapTest.testSuite(new Implementation()));
+ }
+}
--- a/test/jdk/java/util/concurrent/tck/JSR166TestCase.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/jdk/java/util/concurrent/tck/JSR166TestCase.java Mon Oct 09 11:38:46 2017 -0700
@@ -571,6 +571,7 @@
"DoubleAdderTest",
"ForkJoinPool8Test",
"ForkJoinTask8Test",
+ "HashMapTest",
"LinkedBlockingDeque8Test",
"LinkedBlockingQueue8Test",
"LongAccumulatorTest",
@@ -1940,6 +1941,18 @@
Collections.shuffle(Arrays.asList(array), ThreadLocalRandom.current());
}
+ /**
+ * Returns the same String as would be returned by {@link
+ * Object#toString}, whether or not the given object's class
+ * overrides toString().
+ *
+ * @see System#identityHashCode
+ */
+ static String identityString(Object x) {
+ return x.getClass().getName()
+ + "@" + Integer.toHexString(System.identityHashCode(x));
+ }
+
// --- Shared assertions for Executor tests ---
/**
--- a/test/jdk/java/util/concurrent/tck/LinkedTransferQueueTest.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/jdk/java/util/concurrent/tck/LinkedTransferQueueTest.java Mon Oct 09 11:38:46 2017 -0700
@@ -801,7 +801,7 @@
}
/**
- * transfer waits until a poll occurs. The transfered element
+ * transfer waits until a poll occurs. The transferred element
* is returned by the associated poll.
*/
public void testTransfer2() throws InterruptedException {
@@ -882,7 +882,7 @@
}
/**
- * transfer waits until a take occurs. The transfered element
+ * transfer waits until a take occurs. The transferred element
* is returned by the associated take.
*/
public void testTransfer5() throws InterruptedException {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/concurrent/tck/MapImplementation.java Mon Oct 09 11:38:46 2017 -0700
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Written by Doug Lea and Martin Buchholz with assistance from
+ * members of JCP JSR-166 Expert Group and released to the public
+ * domain, as explained at
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+import java.util.Map;
+
+/** Allows tests to work with different Map implementations. */
+public interface MapImplementation {
+ /** Returns the Map implementation class. */
+ public Class<?> klazz();
+ /** Returns an empty map. */
+ public Map emptyMap();
+ public Object makeKey(int i);
+ public Object makeValue(int i);
+ public boolean isConcurrent();
+ public boolean permitsNullKeys();
+ public boolean permitsNullValues();
+ public boolean supportsSetValue();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/concurrent/tck/MapTest.java Mon Oct 09 11:38:46 2017 -0700
@@ -0,0 +1,172 @@
+/*
+ * 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.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Written by Doug Lea and Martin Buchholz with assistance from
+ * members of JCP JSR-166 Expert Group and released to the public
+ * domain, as explained at
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+import junit.framework.Test;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ThreadLocalRandom;
+
+/**
+ * Contains tests applicable to all Map implementations.
+ */
+public class MapTest extends JSR166TestCase {
+ final MapImplementation impl;
+
+ /** Tests are parameterized by a Map implementation. */
+ MapTest(MapImplementation impl, String methodName) {
+ super(methodName);
+ this.impl = impl;
+ }
+
+ public static Test testSuite(MapImplementation impl) {
+ return newTestSuite(
+ parameterizedTestSuite(MapTest.class,
+ MapImplementation.class,
+ impl));
+ }
+
+ public void testImplSanity() {
+ final ThreadLocalRandom rnd = ThreadLocalRandom.current();
+ {
+ Map m = impl.emptyMap();
+ assertTrue(m.isEmpty());
+ assertEquals(0, m.size());
+ Object k = impl.makeKey(rnd.nextInt());
+ Object v = impl.makeValue(rnd.nextInt());
+ m.put(k, v);
+ assertFalse(m.isEmpty());
+ assertEquals(1, m.size());
+ assertTrue(m.containsKey(k));
+ assertTrue(m.containsValue(v));
+ }
+ {
+ Map m = impl.emptyMap();
+ Object v = impl.makeValue(rnd.nextInt());
+ if (impl.permitsNullKeys()) {
+ m.put(null, v);
+ assertTrue(m.containsKey(null));
+ assertTrue(m.containsValue(v));
+ } else {
+ assertThrows(NullPointerException.class, () -> m.put(null, v));
+ }
+ }
+ {
+ Map m = impl.emptyMap();
+ Object k = impl.makeKey(rnd.nextInt());
+ if (impl.permitsNullValues()) {
+ m.put(k, null);
+ assertTrue(m.containsKey(k));
+ assertTrue(m.containsValue(null));
+ } else {
+ assertThrows(NullPointerException.class, () -> m.put(k, null));
+ }
+ }
+ {
+ Map m = impl.emptyMap();
+ Object k = impl.makeKey(rnd.nextInt());
+ Object v1 = impl.makeValue(rnd.nextInt());
+ Object v2 = impl.makeValue(rnd.nextInt());
+ m.put(k, v1);
+ if (impl.supportsSetValue()) {
+ ((Map.Entry)(m.entrySet().iterator().next())).setValue(v2);
+ assertSame(v2, m.get(k));
+ assertTrue(m.containsKey(k));
+ assertTrue(m.containsValue(v2));
+ assertFalse(m.containsValue(v1));
+ } else {
+ assertThrows(UnsupportedOperationException.class,
+ () -> ((Map.Entry)(m.entrySet().iterator().next())).setValue(v2));
+ }
+ }
+ }
+
+ /**
+ * Tests and extends the scenario reported in
+ * https://bugs.openjdk.java.net/browse/JDK-8186171
+ * HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
+ * ant -Djsr166.tckTestClass=HashMapTest -Djsr166.methodFilter=testBug8186171 -Djsr166.runsPerTest=1000 tck
+ */
+ public void testBug8186171() {
+ if (!impl.supportsSetValue()) return;
+ final ThreadLocalRandom rnd = ThreadLocalRandom.current();
+ final boolean permitsNullValues = impl.permitsNullValues();
+ final Object v1 = (permitsNullValues && rnd.nextBoolean())
+ ? null : impl.makeValue(1);
+ final Object v2 = (permitsNullValues && rnd.nextBoolean() && v1 != null)
+ ? null : impl.makeValue(2);
+
+ /** If true, always lands in first bucket in hash tables. */
+ final boolean poorHash = rnd.nextBoolean();
+ class Key implements Comparable<Key> {
+ final int i;
+ Key(int i) { this.i = i; }
+ public int hashCode() { return poorHash ? 0 : super.hashCode(); }
+ public int compareTo(Key x) {
+ return Integer.compare(this.i, x.i);
+ }
+ }
+
+ // Both HashMap and ConcurrentHashMap have:
+ // TREEIFY_THRESHOLD = 8; UNTREEIFY_THRESHOLD = 6;
+ final int size = rnd.nextInt(1, 25);
+
+ List<Key> keys = new ArrayList<>();
+ for (int i = size; i-->0; ) keys.add(new Key(i));
+ Key keyToFrob = keys.get(rnd.nextInt(keys.size()));
+
+ Map<Key, Object> m = impl.emptyMap();
+ for (Key key : keys) m.put(key, v1);
+
+ for (Iterator<Map.Entry<Key, Object>> it = m.entrySet().iterator();
+ it.hasNext(); ) {
+ Map.Entry<Key, Object> entry = it.next();
+ if (entry.getKey() == keyToFrob)
+ entry.setValue(v2); // does this have the expected effect?
+ else
+ it.remove();
+ }
+
+ assertFalse(m.containsValue(v1));
+ assertTrue(m.containsValue(v2));
+ assertTrue(m.containsKey(keyToFrob));
+ assertEquals(1, m.size());
+ }
+
+// public void testFailsIntentionallyForDebugging() {
+// fail(impl.klazz().getSimpleName());
+// }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/concurrent/tck/NonNestmates.java Mon Oct 09 11:38:46 2017 -0700
@@ -0,0 +1,207 @@
+/*
+ * 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.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Written by Doug Lea with assistance from members of JCP JSR-166
+ * Expert Group and released to the public domain, as explained at
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ * Other contributors include Andrew Wright, Jeffrey Hayes,
+ * Pat Fisher, Mike Judd.
+ */
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
+import java.util.concurrent.atomic.AtomicLongFieldUpdater;
+import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
+
+/**
+ * This source file contains test code deliberately not contained in
+ * the same source file as the tests that use them, to avoid making
+ * them nestmates, which affects accessibility rules (see JEP 181).
+ */
+class NonNestmates {
+
+ public void checkPackageAccess(AtomicIntegerFieldUpdaterTest obj) {
+ obj.x = 72;
+ AtomicIntegerFieldUpdater<AtomicIntegerFieldUpdaterTest> a =
+ AtomicIntegerFieldUpdater.newUpdater(
+ AtomicIntegerFieldUpdaterTest.class, "x");
+ assertEquals(72, a.get(obj));
+ assertTrue(a.compareAndSet(obj, 72, 73));
+ assertEquals(73, a.get(obj));
+ }
+
+ public void checkPackageAccess(AtomicLongFieldUpdaterTest obj) {
+ obj.x = 72L;
+ AtomicLongFieldUpdater<AtomicLongFieldUpdaterTest> a =
+ AtomicLongFieldUpdater.newUpdater(
+ AtomicLongFieldUpdaterTest.class, "x");
+ assertEquals(72L, a.get(obj));
+ assertTrue(a.compareAndSet(obj, 72L, 73L));
+ assertEquals(73L, a.get(obj));
+ }
+
+ public void checkPackageAccess(AtomicReferenceFieldUpdaterTest obj) {
+ Integer one = new Integer(1);
+ Integer two = new Integer(2);
+ obj.x = one;
+ AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest,Integer> a =
+ AtomicReferenceFieldUpdater.newUpdater(
+ AtomicReferenceFieldUpdaterTest.class, Integer.class, "x");
+ assertSame(one, a.get(obj));
+ assertTrue(a.compareAndSet(obj, one, two));
+ assertSame(two, a.get(obj));
+ }
+
+ public void checkPrivateAccess(AtomicIntegerFieldUpdaterTest obj) {
+ try {
+ AtomicIntegerFieldUpdater<AtomicIntegerFieldUpdaterTest> a =
+ AtomicIntegerFieldUpdater.newUpdater(
+ AtomicIntegerFieldUpdaterTest.class, "privateField");
+ throw new AssertionError("should throw");
+ } catch (RuntimeException success) {
+ assertNotNull(success.getCause());
+ }
+ }
+
+ public void checkPrivateAccess(AtomicLongFieldUpdaterTest obj) {
+ try {
+ AtomicLongFieldUpdater<AtomicLongFieldUpdaterTest> a =
+ AtomicLongFieldUpdater.newUpdater(
+ AtomicLongFieldUpdaterTest.class, "privateField");
+ throw new AssertionError("should throw");
+ } catch (RuntimeException success) {
+ assertNotNull(success.getCause());
+ }
+ }
+
+ public void checkPrivateAccess(AtomicReferenceFieldUpdaterTest obj) {
+ try {
+ AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest,Integer> a =
+ AtomicReferenceFieldUpdater.newUpdater(
+ AtomicReferenceFieldUpdaterTest.class,
+ Integer.class, "privateField");
+ throw new AssertionError("should throw");
+ } catch (RuntimeException success) {
+ assertNotNull(success.getCause());
+ }
+ }
+
+ static class AtomicIntegerFieldUpdaterTestSubclass
+ extends AtomicIntegerFieldUpdaterTest {
+
+ public void checkPrivateAccess() {
+ try {
+ AtomicIntegerFieldUpdater<AtomicIntegerFieldUpdaterTest> a =
+ AtomicIntegerFieldUpdater.newUpdater(
+ AtomicIntegerFieldUpdaterTest.class, "privateField");
+ shouldThrow();
+ } catch (RuntimeException success) {
+ assertNotNull(success.getCause());
+ }
+ }
+
+ public void checkCompareAndSetProtectedSub() {
+ AtomicIntegerFieldUpdater<AtomicIntegerFieldUpdaterTest> a =
+ AtomicIntegerFieldUpdater.newUpdater(
+ AtomicIntegerFieldUpdaterTest.class, "protectedField");
+ this.protectedField = 1;
+ assertTrue(a.compareAndSet(this, 1, 2));
+ assertTrue(a.compareAndSet(this, 2, -4));
+ assertEquals(-4, a.get(this));
+ assertFalse(a.compareAndSet(this, -5, 7));
+ assertEquals(-4, a.get(this));
+ assertTrue(a.compareAndSet(this, -4, 7));
+ assertEquals(7, a.get(this));
+ }
+ }
+
+ static class AtomicLongFieldUpdaterTestSubclass
+ extends AtomicLongFieldUpdaterTest {
+
+ public void checkPrivateAccess() {
+ try {
+ AtomicLongFieldUpdater<AtomicLongFieldUpdaterTest> a =
+ AtomicLongFieldUpdater.newUpdater(
+ AtomicLongFieldUpdaterTest.class, "privateField");
+ shouldThrow();
+ } catch (RuntimeException success) {
+ assertNotNull(success.getCause());
+ }
+ }
+
+ public void checkCompareAndSetProtectedSub() {
+ AtomicLongFieldUpdater<AtomicLongFieldUpdaterTest> a =
+ AtomicLongFieldUpdater.newUpdater(
+ AtomicLongFieldUpdaterTest.class, "protectedField");
+ this.protectedField = 1;
+ assertTrue(a.compareAndSet(this, 1, 2));
+ assertTrue(a.compareAndSet(this, 2, -4));
+ assertEquals(-4, a.get(this));
+ assertFalse(a.compareAndSet(this, -5, 7));
+ assertEquals(-4, a.get(this));
+ assertTrue(a.compareAndSet(this, -4, 7));
+ assertEquals(7, a.get(this));
+ }
+ }
+
+ static class AtomicReferenceFieldUpdaterTestSubclass
+ extends AtomicReferenceFieldUpdaterTest {
+
+ public void checkPrivateAccess() {
+ try {
+ AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest,Integer> a =
+ AtomicReferenceFieldUpdater.newUpdater(
+ AtomicReferenceFieldUpdaterTest.class,
+ Integer.class, "privateField");
+ shouldThrow();
+ } catch (RuntimeException success) {
+ assertNotNull(success.getCause());
+ }
+ }
+
+ public void checkCompareAndSetProtectedSub() {
+ AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest,Integer> a =
+ AtomicReferenceFieldUpdater.newUpdater(
+ AtomicReferenceFieldUpdaterTest.class,
+ Integer.class, "protectedField");
+ this.protectedField = one;
+ assertTrue(a.compareAndSet(this, one, two));
+ assertTrue(a.compareAndSet(this, two, m4));
+ assertSame(m4, a.get(this));
+ assertFalse(a.compareAndSet(this, m5, seven));
+ assertNotSame(seven, a.get(this));
+ assertTrue(a.compareAndSet(this, m4, seven));
+ assertSame(seven, a.get(this));
+ }
+ }
+}
--- a/test/jdk/java/util/concurrent/tck/ReentrantLockTest.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/jdk/java/util/concurrent/tck/ReentrantLockTest.java Mon Oct 09 11:38:46 2017 -0700
@@ -35,11 +35,13 @@
import static java.util.concurrent.TimeUnit.MILLISECONDS;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.CyclicBarrier;
+import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;
@@ -173,6 +175,11 @@
enum AwaitMethod { await, awaitTimed, awaitNanos, awaitUntil }
+ static AwaitMethod randomAwaitMethod() {
+ AwaitMethod[] awaitMethods = AwaitMethod.values();
+ return awaitMethods[ThreadLocalRandom.current().nextInt(awaitMethods.length)];
+ }
+
/**
* Awaits condition "indefinitely" using the specified AwaitMethod.
*/
@@ -1160,4 +1167,60 @@
lock.unlock();
assertTrue(lock.toString().contains("Unlocked"));
}
+
+ /**
+ * Tests scenario for JDK-8187408
+ * AbstractQueuedSynchronizer wait queue corrupted when thread awaits without holding the lock
+ */
+ public void testBug8187408() throws InterruptedException {
+ final ThreadLocalRandom rnd = ThreadLocalRandom.current();
+ final AwaitMethod awaitMethod = randomAwaitMethod();
+ final int nThreads = rnd.nextInt(2, 10);
+ final ReentrantLock lock = new ReentrantLock();
+ final Condition cond = lock.newCondition();
+ final CountDownLatch done = new CountDownLatch(nThreads);
+ final ArrayList<Thread> threads = new ArrayList<>();
+
+ Runnable rogue = () -> {
+ while (done.getCount() > 0) {
+ try {
+ // call await without holding lock?!
+ await(cond, awaitMethod);
+ throw new AssertionError("should throw");
+ }
+ catch (IllegalMonitorStateException expected) {}
+ catch (Throwable fail) { threadUnexpectedException(fail); }}};
+ Thread rogueThread = new Thread(rogue, "rogue");
+ threads.add(rogueThread);
+ rogueThread.start();
+
+ Runnable waiter = () -> {
+ lock.lock();
+ try {
+ done.countDown();
+ cond.await();
+ } catch (Throwable fail) {
+ threadUnexpectedException(fail);
+ } finally {
+ lock.unlock();
+ }};
+ for (int i = 0; i < nThreads; i++) {
+ Thread thread = new Thread(waiter, "waiter");
+ threads.add(thread);
+ thread.start();
+ }
+
+ assertTrue(done.await(LONG_DELAY_MS, MILLISECONDS));
+ lock.lock();
+ try {
+ assertEquals(nThreads, lock.getWaitQueueLength(cond));
+ } finally {
+ cond.signalAll();
+ lock.unlock();
+ }
+ for (Thread thread : threads) {
+ thread.join(LONG_DELAY_MS);
+ assertFalse(thread.isAlive());
+ }
+ }
}
--- a/test/jdk/java/util/concurrent/tck/StampedLockTest.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/jdk/java/util/concurrent/tck/StampedLockTest.java Mon Oct 09 11:38:46 2017 -0700
@@ -1207,4 +1207,90 @@
}
assertUnlocked(lock);
}
+
+ /**
+ * Stamped locks are not reentrant.
+ */
+ public void testNonReentrant() throws InterruptedException {
+ final StampedLock lock = new StampedLock();
+ long stamp;
+
+ stamp = lock.writeLock();
+ assertValid(lock, stamp);
+ assertEquals(0L, lock.tryWriteLock(0L, DAYS));
+ assertEquals(0L, lock.tryReadLock(0L, DAYS));
+ assertValid(lock, stamp);
+ lock.unlockWrite(stamp);
+
+ stamp = lock.tryWriteLock(1L, DAYS);
+ assertEquals(0L, lock.tryWriteLock(0L, DAYS));
+ assertValid(lock, stamp);
+ lock.unlockWrite(stamp);
+
+ stamp = lock.readLock();
+ assertEquals(0L, lock.tryWriteLock(0L, DAYS));
+ assertValid(lock, stamp);
+ lock.unlockRead(stamp);
+ }
+
+ /**
+ * """StampedLocks have no notion of ownership. Locks acquired in
+ * one thread can be released or converted in another."""
+ */
+ public void testNoOwnership() throws Throwable {
+ ArrayList<Future<?>> futures = new ArrayList<>();
+ for (Function<StampedLock, Long> writeLocker : writeLockers())
+ for (BiConsumer<StampedLock, Long> writeUnlocker : writeUnlockers()) {
+ StampedLock lock = new StampedLock();
+ long stamp = writeLocker.apply(lock);
+ futures.add(cachedThreadPool.submit(new CheckedRunnable() {
+ public void realRun() {
+ writeUnlocker.accept(lock, stamp);
+ assertUnlocked(lock);
+ assertFalse(lock.validate(stamp));
+ }}));
+ }
+ for (Future<?> future : futures)
+ assertNull(future.get());
+ }
+
+ /** Tries out sample usage code from StampedLock javadoc. */
+ public void testSampleUsage() throws Throwable {
+ class Point {
+ private double x, y;
+ private final StampedLock sl = new StampedLock();
+
+ void move(double deltaX, double deltaY) { // an exclusively locked method
+ long stamp = sl.writeLock();
+ try {
+ x += deltaX;
+ y += deltaY;
+ } finally {
+ sl.unlockWrite(stamp);
+ }
+ }
+
+ double distanceFromOrigin() { // A read-only method
+ double currentX, currentY;
+ long stamp = sl.tryOptimisticRead();
+ do {
+ if (stamp == 0L)
+ stamp = sl.readLock();
+ try {
+ // possibly racy reads
+ currentX = x;
+ currentY = y;
+ } finally {
+ stamp = sl.tryConvertToOptimisticRead(stamp);
+ }
+ } while (stamp == 0);
+ return Math.hypot(currentX, currentY);
+ }
+ }
+
+ Point p = new Point();
+ p.move(3.0, 4.0);
+ assertEquals(5.0, p.distanceFromOrigin());
+ }
+
}
--- a/test/jdk/java/util/concurrent/tck/ThreadLocalRandomTest.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/jdk/java/util/concurrent/tck/ThreadLocalRandomTest.java Mon Oct 09 11:38:46 2017 -0700
@@ -84,6 +84,9 @@
* possible values.
*/
public void testNext() throws ReflectiveOperationException {
+ // Inhibit "An illegal reflective access operation has occurred"
+ if (!testImplementationDetails) return;
+
ThreadLocalRandom rnd = ThreadLocalRandom.current();
final java.lang.reflect.Method m;
try {
--- a/test/jdk/java/util/concurrent/tck/TreeMapTest.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/jdk/java/util/concurrent/tck/TreeMapTest.java Mon Oct 09 11:38:46 2017 -0700
@@ -44,14 +44,25 @@
import java.util.TreeMap;
import junit.framework.Test;
-import junit.framework.TestSuite;
public class TreeMapTest extends JSR166TestCase {
public static void main(String[] args) {
main(suite(), args);
}
public static Test suite() {
- return new TestSuite(TreeMapTest.class);
+ class Implementation implements MapImplementation {
+ public Class<?> klazz() { return TreeMap.class; }
+ public Map emptyMap() { return new TreeMap(); }
+ public Object makeKey(int i) { return i; }
+ public Object makeValue(int i) { return i; }
+ public boolean isConcurrent() { return false; }
+ public boolean permitsNullKeys() { return false; }
+ public boolean permitsNullValues() { return true; }
+ public boolean supportsSetValue() { return true; }
+ }
+ return newTestSuite(
+ TreeMapTest.class,
+ MapTest.testSuite(new Implementation()));
}
/**
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sun/security/util/Cache/EbaHash.java Mon Oct 09 11:38:46 2017 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8186654
+ * @summary Transpositions of an array result in the same
+ * EqualByteArray.hashCode()
+ * @modules java.base/sun.security.util
+ */
+
+import sun.security.util.Cache;
+
+public class EbaHash {
+ public static void main(String[] args) throws Throwable {
+ int h1 = new Cache.EqualByteArray(new byte[] {1,2,3}).hashCode();
+ int h2 = new Cache.EqualByteArray(new byte[] {2,3,1}).hashCode();
+ int h3 = new Cache.EqualByteArray(new byte[] {3,1,2}).hashCode();
+ if (h1 == h2 && h2 == h3) {
+ throw new RuntimeException("Transpositions of an array" +
+ " resulted in the same hashCode()");
+ }
+ }
+}
--- a/test/langtools/jdk/javadoc/doclet/testDeprecatedDocs/TestDeprecatedDocs.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testDeprecatedDocs/TestDeprecatedDocs.java Mon Oct 09 11:38:46 2017 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4927552 8026567 8071982 8162674 8175200 8175218 8183511 8186332
+ * @bug 4927552 8026567 8071982 8162674 8175200 8175218 8183511 8186332 8169819 8074407
* @summary <DESC>
* @author jamieh
* @library ../lib
@@ -81,66 +81,99 @@
+ "extends java.lang.Object</pre>",
"<pre>@Deprecated(forRemoval=true)\n"
+ "public int field</pre>\n"
- + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> </div>",
+ + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span></div>",
"<pre>@Deprecated(forRemoval=true)\n"
+ "public DeprecatedClassByAnnotation()</pre>\n"
- + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> </div>",
+ + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span></div>",
"<pre>@Deprecated\n"
+ "public void method()</pre>\n"
- + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span> </div>");
+ + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span></div>");
checkOutput("pkg/TestAnnotationType.html", true,
"<hr>\n"
+ "<pre>@Deprecated(forRemoval=true)\n"
+ "@Documented\n"
+ "public @interface <span class=\"memberNameLabel\">TestAnnotationType</span></pre>\n"
- + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n"
- + "<div class=\"block\"><span class=\"deprecationComment\">annotation_test1 passes.</span></div>\n"
- + "</div>\n",
+ + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span>\n"
+ + "<div class=\"deprecationComment\">annotation_test1 passes.</div>\n"
+ + "</div>",
"<pre>@Deprecated(forRemoval=true)\n"
+ "static final int field</pre>\n"
+ "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This "
- + "API element is subject to removal in a future version.</span> <span class=\"deprecationComment\">annotation_test4 passes.</span></div>",
+ + "API element is subject to removal in a future version.</span>\n"
+ + "<div class=\"deprecationComment\">annotation_test4 passes.</div>\n"
+ + "</div>",
"<pre>@Deprecated(forRemoval=true)\n"
+ "int required</pre>\n"
- + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> "
- + "<span class=\"deprecationComment\">annotation_test3 passes.</span></div>",
+ + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span>\n"
+ + "<div class=\"deprecationComment\">annotation_test3 passes.</div>\n"
+ + "</div>",
"<pre>java.lang.String optional</pre>\n"
- + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span> <span class=\"deprecationComment\">annotation_test2 passes.</span></div>");
+ + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span>\n"
+ + "<div class=\"deprecationComment\">annotation_test2 passes.</div>\n"
+ + "</div>");
checkOutput("pkg/TestClass.html", true,
"<hr>\n"
+ "<pre>@Deprecated(forRemoval=true)\n"
+ "public class <span class=\"typeNameLabel\">TestClass</span>\n"
+ "extends java.lang.Object</pre>\n"
- + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n"
- + "<div class=\"block\"><span class=\"deprecationComment\">class_test1 passes.</span></div>\n"
+ + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span>\n"
+ + "<div class=\"deprecationComment\">class_test1 passes.</div>\n"
+ "</div>",
"<pre>@Deprecated(forRemoval=true)\n"
+ "public TestClass()</pre>\n"
- + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> "
- + "<span class=\"deprecationComment\">class_test3 passes.</span></div>");
+ + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span>\n"
+ + "<div class=\"deprecationComment\">class_test3 passes. This is the second sentence of deprecated description for a constructor.</div>\n"
+ + "</div>",
+ "<td class=\"colLast\">\n"
+ + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span>\n"
+ + "<div class=\"deprecationComment\">class_test2 passes.</div>\n"
+ + "</div>\n"
+ + "</td>",
+ "<td class=\"colLast\">\n"
+ + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span>\n"
+ + "<div class=\"deprecationComment\">class_test3 passes.</div>\n"
+ + "</div>\n"
+ + "</td>",
+ "<td class=\"colLast\">\n"
+ + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span>\n"
+ + "<div class=\"deprecationComment\">class_test4 passes.</div>\n"
+ + "</div>\n"
+ + "</td>");
+
+ checkOutput("pkg/TestClass.html", false,
+ "<div class=\"deprecationComment\">class_test2 passes. This is the second sentence of deprecated description for a field.</div>\n"
+ + "</div>\n"
+ + "</td>",
+ "<div class=\"deprecationComment\">class_test3 passes. This is the second sentence of deprecated description for a constructor.</div>\n"
+ + "</div>\n"
+ + "</td>",
+ "<div class=\"deprecationComment\">class_test4 passes. This is the second sentence of deprecated description for a method.</div>\n"
+ + "</div>\n"
+ + "</td>");
checkOutput("pkg/TestEnum.html", true,
"<hr>\n"
+ "<pre>@Deprecated(forRemoval=true)\n"
+ "public enum <span class=\"typeNameLabel\">TestEnum</span>\n"
+ "extends java.lang.Enum<<a href=\"../pkg/TestEnum.html\" title=\"enum in pkg\">TestEnum</a>></pre>\n"
- + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n"
- + "<div class=\"block\"><span class=\"deprecationComment\">enum_test1 passes.</span></div>\n"
+ + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span>\n"
+ + "<div class=\"deprecationComment\">enum_test1 passes.</div>\n"
+ "</div>",
"<pre>@Deprecated(forRemoval=true)\n"
+ "public static final <a href=\"../pkg/TestEnum.html\" title=\"enum in pkg\">TestEnum</a> FOR_REMOVAL</pre>\n"
- + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> "
- + "<span class=\"deprecationComment\">enum_test3 passes.</span></div>");
+ + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span>\n"
+ + "<div class=\"deprecationComment\">enum_test3 passes.</div>\n"
+ + "</div>");
checkOutput("pkg/TestError.html", true,
"<hr>\n"
+ "<pre>@Deprecated(forRemoval=true)\n"
+ "public class <span class=\"typeNameLabel\">TestError</span>\n"
+ "extends java.lang.Error</pre>\n"
- + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n"
- + "<div class=\"block\"><span class=\"deprecationComment\">error_test1 passes.</span></div>\n"
+ + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span>\n"
+ + "<div class=\"deprecationComment\">error_test1 passes.</div>\n"
+ "</div>");
checkOutput("pkg/TestException.html", true,
@@ -148,8 +181,8 @@
+ "<pre>@Deprecated(forRemoval=true)\n"
+ "public class <span class=\"typeNameLabel\">TestException</span>\n"
+ "extends java.lang.Exception</pre>\n"
- + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n"
- + "<div class=\"block\"><span class=\"deprecationComment\">exception_test1 passes.</span></div>\n"
+ + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span>\n"
+ + "<div class=\"deprecationComment\">exception_test1 passes.</div>\n"
+ "</div>");
checkOutput("pkg/TestInterface.html", true,
@@ -157,57 +190,93 @@
+ "<pre>@Deprecated(forRemoval=true)\n"
+ "public class <span class=\"typeNameLabel\">TestInterface</span>\n"
+ "extends java.lang.Object</pre>\n"
- + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n"
- + "<div class=\"block\"><span class=\"deprecationComment\">interface_test1 passes.</span></div>\n"
+ + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span>\n"
+ + "<div class=\"deprecationComment\">interface_test1 passes.</div>\n"
+ "</div>");
checkOutput("deprecated-list.html", true,
"<ul>\n"
- + "<li><a href=\"#forRemoval\">Deprecated For Removal</a></li>\n"
- + "<li><a href=\"#class\">Deprecated Classes</a></li>\n"
- + "<li><a href=\"#enum\">Deprecated Enums</a></li>\n"
- + "<li><a href=\"#exception\">Deprecated Exceptions</a></li>\n"
- + "<li><a href=\"#error\">Deprecated Errors</a></li>\n"
- + "<li><a href=\"#annotation.type\">Deprecated Annotation Types</a></li>\n"
- + "<li><a href=\"#field\">Deprecated Fields</a></li>\n"
- + "<li><a href=\"#method\">Deprecated Methods</a></li>\n"
- + "<li><a href=\"#constructor\">Deprecated Constructors</a></li>\n"
- + "<li><a href=\"#enum.constant\">Deprecated Enum Constants</a></li>\n"
- + "<li><a href=\"#annotation.type.member\">Deprecated Annotation Type Elements</a></li>\n"
+ + "<li><a href=\"#forRemoval\">For Removal</a></li>\n"
+ + "<li><a href=\"#class\">Classes</a></li>\n"
+ + "<li><a href=\"#enum\">Enums</a></li>\n"
+ + "<li><a href=\"#exception\">Exceptions</a></li>\n"
+ + "<li><a href=\"#error\">Errors</a></li>\n"
+ + "<li><a href=\"#annotation.type\">Annotation Types</a></li>\n"
+ + "<li><a href=\"#field\">Fields</a></li>\n"
+ + "<li><a href=\"#method\">Methods</a></li>\n"
+ + "<li><a href=\"#constructor\">Constructors</a></li>\n"
+ + "<li><a href=\"#enum.constant\">Enum Constants</a></li>\n"
+ + "<li><a href=\"#annotation.type.member\">Annotation Type Elements</a></li>\n"
+ "</ul>",
"<a name=\"forRemoval\">",
- "<table class=\"deprecatedSummary\" summary=\"Deprecated For Removal table, listing deprecated for removal, and an explanation\">\n"
- + "<caption><span>Deprecated For Removal</span><span class=\"tabEnd\"> </span></caption>\n"
+ "<table class=\"deprecatedSummary\" summary=\"For Removal table, listing for removal, and an explanation\">\n"
+ + "<caption><span>For Removal</span><span class=\"tabEnd\"> </span></caption>\n"
+ "<tr>\n"
+ "<th class=\"colFirst\" scope=\"col\">Element</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Description</th>\n"
+ "</tr>",
- "<table class=\"deprecatedSummary\" summary=\"Deprecated Enums table, listing deprecated enums, and an explanation\">\n"
- + "<caption><span>Deprecated Enums</span><span class=\"tabEnd\"> </span></caption>\n"
+ "<table class=\"deprecatedSummary\" summary=\"Enums table, listing enums, and an explanation\">\n"
+ + "<caption><span>Enums</span><span class=\"tabEnd\"> </span></caption>\n"
+ "<tr>\n"
+ "<th class=\"colFirst\" scope=\"col\">Enum</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Description</th>\n"
+ "</tr>\n"
+ "<tbody>\n"
+ "<tr class=\"altColor\">\n"
- + "<th class=\"colFirst\" scope=\"row\"><a href=\"pkg/TestEnum.html\" title=\"enum in pkg\">pkg.TestEnum</a></th>\n"
+ + "<th class=\"colDeprecatedItemName\" scope=\"row\"><a href=\"pkg/TestEnum.html\" title=\"enum in pkg\">pkg.TestEnum</a></th>\n"
+ "<td class=\"colLast\">\n"
- + "<div class=\"block\"><span class=\"deprecationComment\">enum_test1 passes.</span></div>\n"
+ + "<div class=\"deprecationComment\">enum_test1 passes.</div>\n"
+ "</td>\n"
+ "</tr>\n"
+ "</tbody>\n"
+ "</table>",
- "<table class=\"deprecatedSummary\" summary=\"Deprecated Exceptions table, listing deprecated exceptions, and an explanation\">\n"
- + "<caption><span>Deprecated Exceptions</span><span class=\"tabEnd\"> </span></caption>\n"
+ "<table class=\"deprecatedSummary\" summary=\"Exceptions table, listing exceptions, and an explanation\">\n"
+ + "<caption><span>Exceptions</span><span class=\"tabEnd\"> </span></caption>\n"
+ "<tr>\n"
+ "<th class=\"colFirst\" scope=\"col\">Exceptions</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Description</th>\n"
+ "</tr>\n"
+ "<tbody>\n"
+ "<tr class=\"altColor\">\n"
- + "<th class=\"colFirst\" scope=\"row\"><a href=\"pkg/TestException.html\" title=\"class in pkg\">pkg.TestException</a></th>\n"
+ + "<th class=\"colDeprecatedItemName\" scope=\"row\"><a href=\"pkg/TestException.html\" title=\"class in pkg\">pkg.TestException</a></th>\n"
+ + "<td class=\"colLast\">\n"
+ + "<div class=\"deprecationComment\">exception_test1 passes.</div>\n"
+ + "</td>\n"
+ + "</tr>\n"
+ + "</tbody>\n"
+ + "</table>",
+ "<table class=\"deprecatedSummary\" summary=\"Fields table, listing fields, and an explanation\">\n"
+ + "<caption><span>Fields</span><span class=\"tabEnd\"> </span></caption>\n"
+ + "<tr>\n"
+ + "<th class=\"colFirst\" scope=\"col\">Field</th>\n"
+ + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
+ + "</tr>\n"
+ + "<tbody>\n"
+ + "<tr class=\"altColor\">\n"
+ + "<th class=\"colDeprecatedItemName\" scope=\"row\"><a href=\"pkg/DeprecatedClassByAnnotation.html#field\">pkg.DeprecatedClassByAnnotation.field</a></th>\n"
+ + "</tr>\n"
+ + "<tr class=\"rowColor\">\n"
+ + "<th class=\"colDeprecatedItemName\" scope=\"row\"><a href=\"pkg/TestClass.html#field\">pkg.TestClass.field</a></th>\n"
+ "<td class=\"colLast\">\n"
- + "<div class=\"block\"><span class=\"deprecationComment\">exception_test1 passes.</span></div>\n"
+ + "<div class=\"deprecationComment\">class_test2 passes. This is the second sentence of deprecated description for a field.</div>\n"
+ + "</td>\n"
+ + "</tr>\n"
+ + "<tr class=\"altColor\">\n"
+ + "<th class=\"colDeprecatedItemName\" scope=\"row\"><a href=\"pkg/TestError.html#field\">pkg.TestError.field</a></th>\n"
+ + "<td class=\"colLast\">\n"
+ + "<div class=\"deprecationComment\">error_test2 passes.</div>\n"
+ + "</td>\n"
+ + "</tr>\n"
+ + "<tr class=\"rowColor\">\n"
+ + "<th class=\"colDeprecatedItemName\" scope=\"row\"><a href=\"pkg/TestException.html#field\">pkg.TestException.field</a></th>\n"
+ + "<td class=\"colLast\">\n"
+ + "<div class=\"deprecationComment\">exception_test2 passes.</div>\n"
+ + "</td>\n"
+ + "</tr>\n"
+ + "<tr class=\"altColor\">\n"
+ + "<th class=\"colDeprecatedItemName\" scope=\"row\"><a href=\"pkg/TestInterface.html#field\">pkg.TestInterface.field</a></th>\n"
+ + "<td class=\"colLast\">\n"
+ + "<div class=\"deprecationComment\">interface_test2 passes.</div>\n"
+ "</td>\n"
+ "</tr>\n"
+ "</tbody>\n"
--- a/test/langtools/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestClass.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestClass.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,18 +30,18 @@
public class TestClass {
/**
- * @deprecated class_test2 passes.
+ * @deprecated class_test2 passes. This is the second sentence of deprecated description for a field.
*/
public int field;
/**
- * @deprecated class_test3 passes.
+ * @deprecated class_test3 passes. This is the second sentence of deprecated description for a constructor.
*/
@Deprecated(forRemoval=true)
public TestClass() {}
/**
- * @deprecated class_test4 passes.
+ * @deprecated class_test4 passes. This is the second sentence of deprecated description for a method.
*/
public void method() {}
}
--- a/test/langtools/jdk/javadoc/doclet/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java Mon Oct 09 11:38:46 2017 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6786690 6820360 8025633 8026567 8175200 8183511 8186332
+ * @bug 6786690 6820360 8025633 8026567 8175200 8183511 8186332 8074407
* @summary This test verifies the nesting of definition list tags.
* @author Bhavesh Patel
* @library ../lib
@@ -226,10 +226,11 @@
+ "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+ "<code>C1.setUndecorated(boolean)</code></a></dd>\n"
+ "</dl>",
- "<span class=\"deprecatedLabel\">Deprecated.</span>"
- + " <span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n"
+ "<span class=\"deprecatedLabel\">Deprecated.</span>\n"
+ + "<div class=\"deprecationComment\">As of JDK version 1.5, replaced by\n"
+ " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
- + "<code>setUndecorated(boolean)</code></a>.</span></div>\n"
+ + "<code>setUndecorated(boolean)</code></a>.</div>\n"
+ + "</div>\n"
+ "<div class=\"block\">This field indicates whether the C1 is "
+ "undecorated.</div>\n"
+ " \n"
@@ -241,10 +242,11 @@
+ "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+ "<code>C1.setUndecorated(boolean)</code></a></dd>\n"
+ "</dl>",
- "<span class=\"deprecatedLabel\">Deprecated.</span>"
- + " <span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n"
+ "<span class=\"deprecatedLabel\">Deprecated.</span>\n"
+ + "<div class=\"deprecationComment\">As of JDK version 1.5, replaced by\n"
+ " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
- + "<code>setUndecorated(boolean)</code></a>.</span></div>\n"
+ + "<code>setUndecorated(boolean)</code></a>.</div>\n"
+ + "</div>\n"
+ "<div class=\"block\">Reads the object stream.</div>\n"
+ "<dl>\n"
+ "<dt><span class=\"throwsLabel\">Throws:"
@@ -252,7 +254,7 @@
+ "<dd><code>java.io.IOException</code></dd>\n"
+ "</dl>",
"<span class=\"deprecatedLabel\">Deprecated.</span>"
- + " </div>\n"
+ + "</div>\n"
+ "<div class=\"block\">The name for this class.</div>");
}
@@ -332,10 +334,11 @@
+ "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+ "<code>C1.setUndecorated(boolean)</code></a></dd>\n"
+ "</dl>",
- "<span class=\"deprecatedLabel\">Deprecated.</span>"
- + " <span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n"
+ "<span class=\"deprecatedLabel\">Deprecated.</span>\n"
+ + "<div class=\"deprecationComment\">As of JDK version 1.5, replaced by\n"
+ " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
- + "<code>setUndecorated(boolean)</code></a>.</span></div>\n"
+ + "<code>setUndecorated(boolean)</code></a>.</div>\n"
+ + "</div>\n"
+ "<div class=\"block\">This field indicates whether the C1 is "
+ "undecorated.</div>\n"
+ " \n"
@@ -347,10 +350,11 @@
+ "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+ "<code>C1.setUndecorated(boolean)</code></a></dd>\n"
+ "</dl>",
- "<span class=\"deprecatedLabel\">Deprecated.</span>"
- + " <span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n"
+ "<span class=\"deprecatedLabel\">Deprecated.</span>\n"
+ + "<div class=\"deprecationComment\">As of JDK version 1.5, replaced by\n"
+ " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
- + "<code>setUndecorated(boolean)</code></a>.</span></div>\n"
+ + "<code>setUndecorated(boolean)</code></a>.</div>\n"
+ + "</div>\n"
+ "<div class=\"block\">Reads the object stream.</div>\n"
+ "<dl>\n"
+ "<dt><span class=\"throwsLabel\">Throws:"
@@ -358,7 +362,7 @@
+ "<dd><code>java.io.IOException</code></dd>\n"
+ "</dl>",
"<span class=\"deprecatedLabel\">Deprecated.</span>"
- + " </div>\n"
+ + "</div>\n"
+ "<div class=\"block\">"
+ "The name for this class.</div>");
}
@@ -386,15 +390,20 @@
"<pre>boolean " +
"undecorated</pre>\n" +
"<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">" +
- "Deprecated.</span> <span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n" +
- " <a href=\"pkg1/C1.html#setUndecorated-boolean-\"><code>" +
- "setUndecorated(boolean)</code></a>.</span></div>\n" +
+ "Deprecated.</span>\n"
+ + "<div class=\"deprecationComment\">As of JDK version 1.5, replaced by\n"
+ + " <a href=\"pkg1/C1.html#setUndecorated-boolean-\"><code>"
+ + "setUndecorated(boolean)</code></a>.</div>\n"
+ + "</div>\n"
+ +
"</li>",
- "<span class=\"deprecatedLabel\">" +
- "Deprecated.</span> <span class=\"deprecationComment\">As of JDK version" +
- " 1.5, replaced by\n" +
- " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
- "<code>setUndecorated(boolean)</code></a>.</span></div>\n" +
- "</li>");
+ "<span class=\"deprecatedLabel\">"
+ + "Deprecated.</span>\n"
+ + "<div class=\"deprecationComment\">As of JDK version"
+ + " 1.5, replaced by\n"
+ + " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+ + "<code>setUndecorated(boolean)</code></a>.</div>\n"
+ + "</div>\n"
+ + "</li>");
}
}
--- a/test/langtools/jdk/javadoc/doclet/testHtmlTableStyles/TestHtmlTableStyles.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testHtmlTableStyles/TestHtmlTableStyles.java Mon Oct 09 11:38:46 2017 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8008164
+ * @bug 8008164 8169819
* @summary Test styles on HTML tables generated by javadoc.
* @author Bhavesh Patel
* @library ../lib
@@ -68,8 +68,8 @@
+ "summary=\"Packages table, listing packages, and an explanation\">");
checkOutput("deprecated-list.html", true,
- "<table class=\"deprecatedSummary\" summary=\"Deprecated Methods table, listing " +
- "deprecated methods, and an explanation\">");
+ "<table class=\"deprecatedSummary\" summary=\"Methods table, listing " +
+ "methods, and an explanation\">");
checkOutput("constant-values.html", true,
"<table class=\"constantsSummary\" summary=\"Constant Field Values table, listing " +
--- a/test/langtools/jdk/javadoc/doclet/testHtmlTableTags/TestHtmlTableTags.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testHtmlTableTags/TestHtmlTableTags.java Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6786688 8008164 8162363
+ * @bug 6786688 8008164 8162363 8169819
* @summary HTML tables should have table summary, caption and table headers.
* @author Bhavesh Patel
* @library ../lib
@@ -129,9 +129,9 @@
// Deprecated
checkOutput("deprecated-list.html", true,
- "<table class=\"deprecatedSummary\" summary=\"Deprecated Fields table, listing deprecated fields, "
+ "<table class=\"deprecatedSummary\" summary=\"Fields table, listing fields, "
+ "and an explanation\">",
- "<table class=\"deprecatedSummary\" summary=\"Deprecated Methods table, listing deprecated methods, "
+ "<table class=\"deprecatedSummary\" summary=\"Methods table, listing methods, "
+ "and an explanation\">");
// Constant values
@@ -239,9 +239,9 @@
// Deprecated
checkOutput("deprecated-list.html", true,
- "<caption><span>Deprecated Fields</span><span class=\"tabEnd\">"
+ "<caption><span>Fields</span><span class=\"tabEnd\">"
+ " </span></caption>",
- "<caption><span>Deprecated Methods</span><span class=\"tabEnd\">"
+ "<caption><span>Methods</span><span class=\"tabEnd\">"
+ " </span></caption>");
// Constant values
--- a/test/langtools/jdk/javadoc/doclet/testHtmlVersion/TestHtmlVersion.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testHtmlVersion/TestHtmlVersion.java Mon Oct 09 11:38:46 2017 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8072945 8081854 8141492 8148985 8150188 4649116 8173707 8151743
+ * @bug 8072945 8081854 8141492 8148985 8150188 4649116 8173707 8151743 8169819
* @summary Test the version of HTML generated by the javadoc tool.
* @author bpatel
* @library ../lib
@@ -736,16 +736,16 @@
+ "<div class=\"header\">\n"
+ "<h1 title=\"Deprecated API\" class=\"title\">Deprecated API</h1>\n"
+ "<h2 title=\"Contents\">Contents</h2>",
- "<table class=\"deprecatedSummary\" summary=\"Deprecated Classes table, listing deprecated classes, and an explanation\">",
- "<table class=\"deprecatedSummary\" summary=\"Deprecated Enums table, listing deprecated enums, and an explanation\">",
- "<table class=\"deprecatedSummary\" summary=\"Deprecated Exceptions table, listing deprecated exceptions, and an explanation\">",
- "<table class=\"deprecatedSummary\" summary=\"Deprecated Errors table, listing deprecated errors, and an explanation\">",
- "<table class=\"deprecatedSummary\" summary=\"Deprecated Annotation Types table, listing deprecated annotation types, and an explanation\">",
- "<table class=\"deprecatedSummary\" summary=\"Deprecated Fields table, listing deprecated fields, and an explanation\">",
- "<table class=\"deprecatedSummary\" summary=\"Deprecated Methods table, listing deprecated methods, and an explanation\">",
- "<table class=\"deprecatedSummary\" summary=\"Deprecated Constructors table, listing deprecated constructors, and an explanation\">",
- "<table class=\"deprecatedSummary\" summary=\"Deprecated Enum Constants table, listing deprecated enum constants, and an explanation\">",
- "<table class=\"deprecatedSummary\" summary=\"Deprecated Annotation Type Elements table, listing deprecated annotation type elements, and an explanation\">");
+ "<table class=\"deprecatedSummary\" summary=\"Classes table, listing classes, and an explanation\">",
+ "<table class=\"deprecatedSummary\" summary=\"Enums table, listing enums, and an explanation\">",
+ "<table class=\"deprecatedSummary\" summary=\"Exceptions table, listing exceptions, and an explanation\">",
+ "<table class=\"deprecatedSummary\" summary=\"Errors table, listing errors, and an explanation\">",
+ "<table class=\"deprecatedSummary\" summary=\"Annotation Types table, listing annotation types, and an explanation\">",
+ "<table class=\"deprecatedSummary\" summary=\"Fields table, listing fields, and an explanation\">",
+ "<table class=\"deprecatedSummary\" summary=\"Methods table, listing methods, and an explanation\">",
+ "<table class=\"deprecatedSummary\" summary=\"Constructors table, listing constructors, and an explanation\">",
+ "<table class=\"deprecatedSummary\" summary=\"Enum Constants table, listing enum constants, and an explanation\">",
+ "<table class=\"deprecatedSummary\" summary=\"Annotation Type Elements table, listing annotation type elements, and an explanation\">");
// Negated test for serialized-form page
checkOutput("serialized-form.html", false,
@@ -1179,16 +1179,16 @@
+ "<div class=\"header\">\n"
+ "<h1 title=\"Deprecated API\" class=\"title\">Deprecated API</h1>\n"
+ "<h2 title=\"Contents\">Contents</h2>",
- "<table class=\"deprecatedSummary\" summary=\"Deprecated Classes table, listing deprecated classes, and an explanation\">",
- "<table class=\"deprecatedSummary\" summary=\"Deprecated Enums table, listing deprecated enums, and an explanation\">",
- "<table class=\"deprecatedSummary\" summary=\"Deprecated Exceptions table, listing deprecated exceptions, and an explanation\">",
- "<table class=\"deprecatedSummary\" summary=\"Deprecated Errors table, listing deprecated errors, and an explanation\">",
- "<table class=\"deprecatedSummary\" summary=\"Deprecated Annotation Types table, listing deprecated annotation types, and an explanation\">",
- "<table class=\"deprecatedSummary\" summary=\"Deprecated Fields table, listing deprecated fields, and an explanation\">",
- "<table class=\"deprecatedSummary\" summary=\"Deprecated Methods table, listing deprecated methods, and an explanation\">",
- "<table class=\"deprecatedSummary\" summary=\"Deprecated Constructors table, listing deprecated constructors, and an explanation\">",
- "<table class=\"deprecatedSummary\" summary=\"Deprecated Enum Constants table, listing deprecated enum constants, and an explanation\">",
- "<table class=\"deprecatedSummary\" summary=\"Deprecated Annotation Type Elements table, listing deprecated annotation type elements, and an explanation\">");
+ "<table class=\"deprecatedSummary\" summary=\"Classes table, listing classes, and an explanation\">",
+ "<table class=\"deprecatedSummary\" summary=\"Enums table, listing enums, and an explanation\">",
+ "<table class=\"deprecatedSummary\" summary=\"Exceptions table, listing exceptions, and an explanation\">",
+ "<table class=\"deprecatedSummary\" summary=\"Errors table, listing errors, and an explanation\">",
+ "<table class=\"deprecatedSummary\" summary=\"Annotation Types table, listing annotation types, and an explanation\">",
+ "<table class=\"deprecatedSummary\" summary=\"Fields table, listing fields, and an explanation\">",
+ "<table class=\"deprecatedSummary\" summary=\"Methods table, listing methods, and an explanation\">",
+ "<table class=\"deprecatedSummary\" summary=\"Constructors table, listing constructors, and an explanation\">",
+ "<table class=\"deprecatedSummary\" summary=\"Enum Constants table, listing enum constants, and an explanation\">",
+ "<table class=\"deprecatedSummary\" summary=\"Annotation Type Elements table, listing annotation type elements, and an explanation\">");
// Test for serialized-form page
checkOutput("serialized-form.html", true,
--- a/test/langtools/jdk/javadoc/doclet/testInterface/TestInterface.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testInterface/TestInterface.java Mon Oct 09 11:38:46 2017 -0700
@@ -23,7 +23,8 @@
/*
* @test
- * @bug 4682448 4947464 5029946 8025633 8026567 8035473 8139101 8175200 8186332
+ * @bug 4682448 4947464 5029946 8025633 8026567 8035473 8139101 8175200
+ 8186332 8186703
* @summary Verify that the public modifier does not show up in the
* documentation for public methods, as recommended by the JLS.
* If A implements I and B extends A, B should be in the list of
@@ -122,10 +123,36 @@
"public int method()",
"public static final int field");
- checkOutput("pkg/ClassWithStaticMethod.html", false,
+ checkOutput("pkg/ClassWithStaticMembers.html", false,
//Make sure "Specified By" does not appear on class documentation when
//the method is a static method in the interface.
"<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n");
+
+ checkOutput("pkg/ClassWithStaticMembers.html", true,
+ "<h4>f</h4>\n"
+ + "<pre>public static int f</pre>\n"
+ + "<div class=\"block\">A hider field</div>",
+
+ "<td class=\"colFirst\"><code>static void</code></td>\n"
+ + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+ + "<a href=\"../pkg/ClassWithStaticMembers.html#m--\">m</a></span>()</code></th>\n"
+ + "<td class=\"colLast\">\n"
+ + "<div class=\"block\">A hider method</div>\n"
+ + "</td>\n",
+
+ "<h4>staticMethod</h4>\n"
+ + "<pre>public static void staticMethod()</pre>\n"
+ + "<div class=\"block\"><span class=\"descfrmTypeLabel\">"
+ + "Description copied from interface: <code>"
+ + "<a href=\"../pkg/InterfaceWithStaticMembers.html#staticMethod--\">"
+ + "InterfaceWithStaticMembers</a></code></span></div>\n"
+ + "<div class=\"block\">A static method</div>\n");
+
+ checkOutput("pkg/ClassWithStaticMembers.InnerClass.html", true,
+ "<pre>public static class <span class=\"typeNameLabel\">"
+ + "ClassWithStaticMembers.InnerClass</span>\n"
+ + "extends java.lang.Object</pre>\n"
+ + "<div class=\"block\">A hider inner class</div>");
}
@Test
@@ -155,8 +182,8 @@
checkOutput("pkg2/Spliterator.OfDouble.html", true,
// Ensure the correct type parameters are displayed correctly
"<h3>Nested classes/interfaces inherited from interface pkg2."
- + "<a href=\"../pkg2/Spliterator.html\" title=\"interface in pkg2\">Spliterator</a></h3>\n" +
- "<code><a href=\"../pkg2/Spliterator.OfDouble.html\" title=\"interface in pkg2\">"
+ + "<a href=\"../pkg2/Spliterator.html\" title=\"interface in pkg2\">Spliterator</a></h3>\n"
+ + "<code><a href=\"../pkg2/Spliterator.OfDouble.html\" title=\"interface in pkg2\">"
+ "Spliterator.OfDouble</a>, <a href=\"../pkg2/Spliterator.OfInt.html\" "
+ "title=\"interface in pkg2\">Spliterator.OfInt</a><"
+ "<a href=\"../pkg2/Spliterator.OfInt.html\" title=\"type parameter in Spliterator.OfInt\">"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testInterface/pkg/ClassWithStaticMembers.java Mon Oct 09 11:38:46 2017 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg;
+
+public class ClassWithStaticMembers implements InterfaceWithStaticMembers {
+
+ /** A hider inner class */
+ public static class InnerClass{}
+
+ /** A hider field */
+ public static int f = 1;
+
+ /** A hider method */
+ public static void m(){}
+
+ // no comment
+ public static void staticMethod() {}
+
+}
--- a/test/langtools/jdk/javadoc/doclet/testInterface/pkg/ClassWithStaticMethod.java Mon Oct 09 10:42:27 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg;
-
-public class ClassWithStaticMethod implements InterfaceWithStaticMethod {
-
- public static void staticMethod() {
- }
-
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testInterface/pkg/InterfaceWithStaticMembers.java Mon Oct 09 11:38:46 2017 -0700
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg;
+
+public interface InterfaceWithStaticMembers {
+
+ /** A static nested class */
+ static class InnerClass {}
+
+ /** A static field */
+ static int f = 0;
+
+ /** A static method */
+ static void staticMethod() { }
+}
--- a/test/langtools/jdk/javadoc/doclet/testInterface/pkg/InterfaceWithStaticMethod.java Mon Oct 09 10:42:27 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg;
-
-public interface InterfaceWithStaticMethod {
-
- /**
- * A static method
- */
- static void staticMethod() { }
-}
--- a/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java Mon Oct 09 11:38:46 2017 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363
* 8168766 8168688 8162674 8160196 8175799 8174974 8176778 8177562 8175218 8175823 8166306
- * 8178043 8181622 8183511
+ * 8178043 8181622 8183511 8169819 8074407
* @summary Test modules support in javadoc.
* @author bpatel
* @library ../lib
@@ -448,7 +448,7 @@
"<section role=\"region\">\n"
+ "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal:"
+ " This API element is subject to removal in a future version.</span>\n"
- + "<div class=\"block\"><span class=\"deprecationComment\">This module is deprecated.</span></div>\n"
+ + "<div class=\"deprecationComment\">This module is deprecated.</div>\n"
+ "</div>\n"
+ "<!-- ============ MODULE DESCRIPTION =========== -->\n"
+ "<a id=\"module.description\">\n"
@@ -1017,22 +1017,22 @@
checkOutput("moduleA-summary.html", found,
"<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal:"
+ " This API element is subject to removal in a future version.</span>\n"
- + "<div class=\"block\"><span class=\"deprecationComment\">This module is deprecated.</span></div>\n"
+ + "<div class=\"deprecationComment\">This module is deprecated.</div>\n"
+ "</div>");
checkOutput("deprecated-list.html", found,
"<ul>\n"
- + "<li><a href=\"#forRemoval\">Deprecated For Removal</a></li>\n"
- + "<li><a href=\"#module\">Deprecated Modules</a></li>\n"
+ + "<li><a href=\"#forRemoval\">For Removal</a></li>\n"
+ + "<li><a href=\"#module\">Modules</a></li>\n"
+ "</ul>",
"<tr class=\"altColor\">\n"
+ "<th class=\"colFirst\" scope=\"row\"><a href=\"moduleA-summary.html\">moduleA</a></th>\n"
+ "<td class=\"colLast\">\n"
- + "<div class=\"block\"><span class=\"deprecationComment\">This module is deprecated.</span></div>\n"
+ + "<div class=\"deprecationComment\">This module is deprecated.</div>\n"
+ "</td>\n"
+ "</tr>");
checkOutput("moduleB-summary.html", !found,
"<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span>\n"
- + "<div class=\"block\"><span class=\"deprecationComment\">This module is deprecated using just the javadoc tag.</span></div>");
+ + "<div class=\"deprecationComment\">This module is deprecated using just the javadoc tag.</div>\n");
checkOutput("moduletags-summary.html", found,
"<p>@Deprecated\n"
+ "</p>",
@@ -1143,5 +1143,5 @@
+ "<div class=\"block\">This is a test description for the test.moduleFullName.</div>\n"
+ "</dd>\n"
+ "</dl>");
+ }
}
-}
--- a/test/langtools/jdk/javadoc/doclet/testPackageDeprecation/TestPackageDeprecation.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testPackageDeprecation/TestPackageDeprecation.java Mon Oct 09 11:38:46 2017 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6492694 8026567 8048351 8162363 8183511
+ * @bug 6492694 8026567 8048351 8162363 8183511 8169819 8074407
* @summary Test package deprecation.
* @author bpatel
* @library ../lib/
@@ -48,13 +48,12 @@
checkExit(Exit.OK);
checkOutput("pkg1/package-summary.html", true,
- "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span>\n" +
- "<div class=\"block\"><span class=\"deprecationComment\">This package is Deprecated." +
- "</span></div>"
+ "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span>\n"
+ + "<div class=\"deprecationComment\">This package is Deprecated.</div>"
);
checkOutput("deprecated-list.html", true,
- "<li><a href=\"#package\">Deprecated Packages</a></li>"
+ "<li><a href=\"#package\">Packages</a></li>"
);
}
--- a/test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java Mon Oct 09 11:38:46 2017 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8141492 8071982 8141636 8147890 8166175 8168965 8176794 8175218 8147881 8181622 8182263
+ * @bug 8141492 8071982 8141636 8147890 8166175 8168965 8176794 8175218 8147881 8181622 8182263 8074407
* @summary Test the search feature of javadoc.
* @author bpatel
* @library ../lib
@@ -324,10 +324,10 @@
"<dt><span class=\"memberNameLink\"><a href=\"pkg2/TestEnum.html#TWO\">TWO</a></span> - "
+ "pkg2.<a href=\"pkg2/TestEnum.html\" title=\"enum in pkg2\">TestEnum</a></dt>");
checkOutput("index-all.html", true,
- "<div class=\"block\"><span class=\"deprecationComment\">class_test1 passes. Search tag"
- + " <a id=\"SearchTagDeprecatedClass\" class=\"searchTagResult\">SearchTagDeprecatedClass</a></span></div>",
- "<div class=\"block\"><span class=\"deprecationComment\">error_test3 passes. Search tag for\n"
- + " method <a id=\"SearchTagDeprecatedMethod\" class=\"searchTagResult\">SearchTagDeprecatedMethod</a></span></div>");
+ "<div class=\"deprecationComment\">class_test1 passes. Search tag"
+ + " <a id=\"SearchTagDeprecatedClass\" class=\"searchTagResult\">SearchTagDeprecatedClass</a></div>",
+ "<div class=\"deprecationComment\">error_test3 passes. Search tag for\n"
+ + " method <a id=\"SearchTagDeprecatedMethod\" class=\"searchTagResult\">SearchTagDeprecatedMethod</a></div>");
}
void checkSplitIndex() {
@@ -403,10 +403,10 @@
+ "SearchTagDeprecatedClass</a></span> - Search tag in pkg2.TestClass</dt>",
"<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#SingleWord\">"
+ "SingleWord</a></span> - Search tag in pkg</dt>",
- "<div class=\"block\"><span class=\"deprecationComment\">class_test1 passes. Search tag"
- + " <a id=\"SearchTagDeprecatedClass\">SearchTagDeprecatedClass</a></span></div>",
- "<div class=\"block\"><span class=\"deprecationComment\">error_test3 passes. Search tag for\n"
- + " method <a id=\"SearchTagDeprecatedMethod\">SearchTagDeprecatedMethod</a></span></div>");
+ "<div class=\"deprecationComment\">class_test1 passes. Search tag"
+ + " <a id=\"SearchTagDeprecatedClass\">SearchTagDeprecatedClass</a></div>",
+ "<div class=\"deprecationComment\">error_test3 passes. Search tag for\n"
+ + " method <a id=\"SearchTagDeprecatedMethod\">SearchTagDeprecatedMethod</a></div>");
checkOutput("index-all.html", true,
"<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestEnum.html#searchphrasedeprecated\">"
+ "search phrase deprecated</a></span> - Search tag in pkg2.TestEnum.ONE</dt>",
@@ -434,10 +434,10 @@
+ "search phrase deprecated</a></span> - Search tag in pkg2.TestEnum.ONE</dt>",
"<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestError.html#SearchTagDeprecatedMethod\">"
+ "SearchTagDeprecatedMethod</a></span> - Search tag in pkg2.TestError</dt>",
- "<div class=\"block\"><span class=\"deprecationComment\">class_test1 passes. Search tag"
- + " <a id=\"SearchTagDeprecatedClass\">SearchTagDeprecatedClass</a></span></div>",
- "<div class=\"block\"><span class=\"deprecationComment\">error_test3 passes. Search tag for\n"
- + " method <a id=\"SearchTagDeprecatedMethod\">SearchTagDeprecatedMethod</a></span></div>");
+ "<div class=\"deprecationComment\">class_test1 passes. Search tag"
+ + " <a id=\"SearchTagDeprecatedClass\">SearchTagDeprecatedClass</a></div>",
+ "<div class=\"deprecationComment\">error_test3 passes. Search tag for\n"
+ + " method <a id=\"SearchTagDeprecatedMethod\">SearchTagDeprecatedMethod</a></div>");
}
void checkJavaFXOutput() {
--- a/test/langtools/jdk/javadoc/doclet/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java Mon Oct 09 11:38:46 2017 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6802694 8025633 8026567 8183511
+ * @bug 6802694 8025633 8026567 8183511 8074407
* @summary This test verifies deprecation info in serialized-form.html.
* @author Bhavesh Patel
* @library ../lib
@@ -99,10 +99,11 @@
+ "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+ "<code>C1.setUndecorated(boolean)</code></a></dd>\n"
+ "</dl>",
- "<span class=\"deprecatedLabel\">Deprecated.</span>"
- + " <span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n"
+ "<span class=\"deprecatedLabel\">Deprecated.</span>\n"
+ + "<div class=\"deprecationComment\">As of JDK version 1.5, replaced by\n"
+ " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
- + "<code>setUndecorated(boolean)</code></a>.</span></div>\n"
+ + "<code>setUndecorated(boolean)</code></a>.</div>\n"
+ + "</div>\n"
+ "<div class=\"block\">This field indicates whether the C1 "
+ "is undecorated.</div>\n"
+ " \n"
@@ -114,17 +115,18 @@
+ "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+ "<code>C1.setUndecorated(boolean)</code></a></dd>\n"
+ "</dl>",
- "<span class=\"deprecatedLabel\">Deprecated.</span>"
- + " <span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n"
+ "<span class=\"deprecatedLabel\">Deprecated.</span>\n"
+ + "<div class=\"deprecationComment\">As of JDK version 1.5, replaced by\n"
+ " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
- + "<code>setUndecorated(boolean)</code></a>.</span></div>\n"
+ + "<code>setUndecorated(boolean)</code></a>.</div>\n"
+ + "</div>\n"
+ "<div class=\"block\">Reads the object stream.</div>\n"
+ "<dl>\n"
+ "<dt><span class=\"throwsLabel\">Throws:</span></dt>\n"
+ "<dd><code>java.io.IOException</code> - on error</dd>\n"
+ "</dl>",
"<span class=\"deprecatedLabel\">Deprecated.</span>"
- + " </div>\n"
+ + "</div>\n"
+ "<div class=\"block\">"
+ "The name for this class.</div>");
}
@@ -135,16 +137,20 @@
void checkNoComment(boolean expectFound) {
checkOutput("serialized-form.html", expectFound,
"<pre>boolean undecorated</pre>\n"
- + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span> <span class=\"deprecationComment\">"
+ + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span>\n"
+ + "<div class=\"deprecationComment\">"
+ "As of JDK version 1.5, replaced by\n"
+ " <a href=\"pkg1/C1.html#setUndecorated-boolean-\"><code>"
- + "setUndecorated(boolean)</code></a>.</span></div>\n"
+ + "setUndecorated(boolean)</code></a>.</div>\n"
+ + "</div>\n"
+ "</li>",
"<span class=\"deprecatedLabel\">"
- + "Deprecated.</span> <span class=\"deprecationComment\">As of JDK version"
+ + "Deprecated.</span>\n"
+ + "<div class=\"deprecationComment\">As of JDK version"
+ " 1.5, replaced by\n"
+ " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
- + "<code>setUndecorated(boolean)</code></a>.</span></div>\n"
+ + "<code>setUndecorated(boolean)</code></a>.</div>\n"
+ + "</div>\n"
+ "</li>");
}
--- a/test/langtools/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java Mon Oct 09 11:38:46 2017 -0700
@@ -24,7 +24,7 @@
/*
* @test
* @bug 4494033 7028815 7052425 8007338 8023608 8008164 8016549 8072461 8154261 8162363 8160196 8151743 8177417
- * 8175218 8176452 8181215 8182263 8183511
+ * 8175218 8176452 8181215 8182263 8183511 8169819
* @summary Run tests on doclet stylesheet.
* @author jamieh
* @library ../lib
@@ -183,6 +183,7 @@
+ "th.colFirst a:link, th.colFirst a:visited,\n"
+ "th.colSecond a:link, th.colSecond a:visited,\n"
+ "th.colConstructorName a:link, th.colConstructorName a:visited,\n"
+ + "th.colDeprecatedItemName a:link, th.colDeprecatedItemName a:visited, \n"
+ ".constantValuesContainer td a:link, .constantValuesContainer td a:visited {\n"
+ " font-weight:bold;\n"
+ "}",
--- a/test/langtools/jdk/javadoc/doclet/testTagOutput/TestTagOutput.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testTagOutput/TestTagOutput.java Mon Oct 09 11:38:46 2017 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8026370 8026567 8183511
+ * @bug 8026370 8026567 8183511 8074407
* @summary This test checks the generated tag output.
* @author Bhavesh Patel
* @library ../lib
@@ -47,12 +47,14 @@
checkExit(Exit.OK);
checkOutput("pkg1/DeprecatedTag.html", true,
- "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span> </div>",
- "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span> " +
- "<span class=\"deprecationComment\">Do not use this.</span></div>");
+ "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span></div>",
+ "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span>\n"
+ + "<div class=\"deprecationComment\">Do not use this.</div>\n"
+ + "</div>");
checkOutput("pkg1/DeprecatedTag.html", false,
- "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated." +
- "</span> <span class=\"deprecationComment\"></span></div>");
+ "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span>\n"
+ + "<div class=\"deprecationComment\"></div>\n"
+ + "</div>");
}
}
--- a/test/langtools/jdk/jshell/ErrorTranslationTest.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/jdk/jshell/ErrorTranslationTest.java Mon Oct 09 11:38:46 2017 -0700
@@ -23,6 +23,7 @@
/*
* @test
+ * @bug 8188225
* @summary Tests for shell error translation
* @modules jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.main
@@ -59,6 +60,13 @@
);
}
+ public void testlvtiErrors() {
+ test(
+ a -> assertDiagnostic(a, "var broken = () -> {};", newExpectedDiagnostic(0, 22, 0, -1, -1, Diagnostic.Kind.ERROR)),
+ a -> assertDiagnostic(a, "void t () { var broken = () -> {}; }", newExpectedDiagnostic(12, 34, 0, -1, -1, Diagnostic.Kind.ERROR))
+ );
+ }
+
public void testWarnings() {
List<ReplTest> list = new ArrayList<>();
ExpectedDiagnostic[] diagnostics = new ExpectedDiagnostic[]{
@@ -117,19 +125,16 @@
}
String kind = getKind(expectedDiagnostic.getKind());
assertEquals(lines[0], kind);
- String source;
- String markingLine;
- switch (expectedDiagnostic.getKind()) {
- case ERROR:
- case WARNING:
- source = lines[2];
- markingLine = lines[3];
- break;
- default:
- throw new AssertionError("Unsupported diagnostic kind: " + expectedDiagnostic.getKind());
+ boolean found = false;
+ for (int i = 0; i < lines.length; i++) {
+ if (lines[i].endsWith(expectedSource)) {
+ assertEquals(lines[i + 1], expectedMarkingLine, "Input: " + expectedSource + ", marking line: ");
+ found = true;
+ }
}
- assertTrue(source.endsWith(expectedSource), "Expected: " + expectedSource + ", found: " + source);
- assertEquals(markingLine, expectedMarkingLine, "Input: " + expectedSource + ", marking line: ");
+ if (!found) {
+ throw new AssertionError("Did not find: " + expectedSource + " in: " + s);
+ }
};
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/8169345/T8169345a.java Mon Oct 09 11:38:46 2017 -0700
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8169345
+ * @summary javac crash when local from enclosing context is captured multiple times
+ */
+
+public class T8169345a {
+ void test() {
+ Object o = new Object();
+ class Local1 {
+ Object test1() {
+ return o;
+ }
+ }
+ class Local2 {
+ void test2() {
+ Object o = new Object();
+ class Local3 extends Local1 {
+ Object test3() {
+ return o;
+ }
+ }
+ }
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ Class.forName("T8169345a$1Local1");
+ Class.forName("T8169345a$1Local2$1Local3");
+ Class.forName("T8169345a$1Local2");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/8169345/T8169345b.java Mon Oct 09 11:38:46 2017 -0700
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8169345
+ * @summary javac crash when local from enclosing context is captured multiple times
+ */
+
+public class T8169345b {
+ void test() {
+ Object o = new Object();
+ class Local1 {
+ Object test1() {
+ return o;
+ }
+ }
+ class Local2 {
+ void test2() {
+ Object o = new Object();
+ class Local3 {
+ Object test3() {
+ return o;
+ }
+ }
+ }
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ Class.forName("T8169345b$1Local1");
+ Class.forName("T8169345b$1Local2$1Local3");
+ Class.forName("T8169345b$1Local2");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/8169345/T8169345c.java Mon Oct 09 11:38:46 2017 -0700
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8169345
+ * @summary javac crash when local from enclosing context is captured multiple times
+ * @compile T8169345c.java
+ */
+
+class T8169345c {
+ void test() {
+ final int b;
+ b = 10;
+ class Local1 {
+ public String toString() {
+ return "" + b;
+ }
+ }
+ class Local2 {
+ void test() {
+ final int b;
+ b = 20;
+ class DeepLocal extends Local1 {
+ public String toString() {
+ return "" + b;
+ }
+ }
+ }
+ }
+ }
+}
--- a/test/langtools/tools/javac/T8024207/FlowCrashTest.out Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/tools/javac/T8024207/FlowCrashTest.out Mon Oct 09 11:38:46 2017 -0700
@@ -1,2 +1,2 @@
-FlowCrashTest.java:18:42: compiler.err.cant.apply.symbols: kindname.method, toMap, @475,@542,@624,{(compiler.misc.inapplicable.method: kindname.method, java.util.stream.Collectors, <T,K,U>toMap(java.util.function.Function<? super T,? extends K>,java.util.function.Function<? super T,? extends U>), (compiler.misc.infer.arg.length.mismatch: T,K,U)),(compiler.misc.inapplicable.method: kindname.method, java.util.stream.Collectors, <T,K,U>toMap(java.util.function.Function<? super T,? extends K>,java.util.function.Function<? super T,? extends U>,java.util.function.BinaryOperator<U>), (compiler.misc.infer.no.conforming.assignment.exists: T,K,U, (compiler.misc.incompatible.arg.types.in.lambda))),(compiler.misc.inapplicable.method: kindname.method, java.util.stream.Collectors, <T,K,U,M>toMap(java.util.function.Function<? super T,? extends K>,java.util.function.Function<? super T,? extends U>,java.util.function.BinaryOperator<U>,java.util.function.Supplier<M>), (compiler.misc.infer.arg.length.mismatch: T,K,U,M))}
+FlowCrashTest.java:18:42: compiler.err.cant.apply.symbols: kindname.method, toMap, @49,@19:49,@20:49,{(compiler.misc.inapplicable.method: kindname.method, java.util.stream.Collectors, <T,K,U>toMap(java.util.function.Function<? super T,? extends K>,java.util.function.Function<? super T,? extends U>), (compiler.misc.infer.arg.length.mismatch: T,K,U)),(compiler.misc.inapplicable.method: kindname.method, java.util.stream.Collectors, <T,K,U>toMap(java.util.function.Function<? super T,? extends K>,java.util.function.Function<? super T,? extends U>,java.util.function.BinaryOperator<U>), (compiler.misc.infer.no.conforming.assignment.exists: T,K,U, (compiler.misc.incompatible.arg.types.in.lambda))),(compiler.misc.inapplicable.method: kindname.method, java.util.stream.Collectors, <T,K,U,M>toMap(java.util.function.Function<? super T,? extends K>,java.util.function.Function<? super T,? extends U>,java.util.function.BinaryOperator<U>,java.util.function.Supplier<M>), (compiler.misc.infer.arg.length.mismatch: T,K,U,M))}
1 error
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/T8187978/FilterOutCandidatesForDiagnosticsTest.java Mon Oct 09 11:38:46 2017 -0700
@@ -0,0 +1,18 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8187978
+ * @summary javac can show overload error messages that include non-valid candidates
+ * @compile/fail/ref=FilterOutCandidatesForDiagnosticsTest.out -XDrawDiagnostics FilterOutCandidatesForDiagnosticsTest.java
+ */
+
+import java.util.*;
+
+class FilterOutCandidatesForDiagnosticsTest {
+ void test() {
+ make(new ArrayList<String>(), new ArrayList<Integer>()).add("");
+ }
+
+ <Z> Z make(Z z1, Z z2) {
+ return null;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/T8187978/FilterOutCandidatesForDiagnosticsTest.out Mon Oct 09 11:38:46 2017 -0700
@@ -0,0 +1,2 @@
+FilterOutCandidatesForDiagnosticsTest.java:12:64: compiler.err.cant.apply.symbols: kindname.method, add, java.lang.String,{(compiler.misc.inapplicable.method: kindname.method, java.util.ArrayList, add(compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>,java.lang.Object[],int), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, java.util.ArrayList, add(compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.String, compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>))),(compiler.misc.inapplicable.method: kindname.method, java.util.ArrayList, add(int,compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>), (compiler.misc.arg.length.mismatch))}
+1 error
--- a/test/langtools/tools/javac/capture/Martin.out Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/tools/javac/capture/Martin.out Mon Oct 09 11:38:46 2017 -0700
@@ -1,2 +1,2 @@
-Martin.java:15:11: compiler.err.cant.apply.symbols: kindname.method, addAll, java.util.List<compiler.misc.type.captureof: 1, ?>,{(compiler.misc.inapplicable.method: kindname.method, java.util.Collection, addAll(java.util.Collection<? extends compiler.misc.type.captureof: 2, ?>), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.util.List<compiler.misc.type.captureof: 1, ?>, java.util.Collection<? extends compiler.misc.type.captureof: 2, ?>))),(compiler.misc.inapplicable.method: kindname.method, java.util.List, addAll(java.util.Collection<? extends compiler.misc.type.captureof: 2, ?>), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.util.List<compiler.misc.type.captureof: 1, ?>, java.util.Collection<? extends compiler.misc.type.captureof: 2, ?>))),(compiler.misc.inapplicable.method: kindname.method, java.util.List, addAll(int,java.util.Collection<? extends compiler.misc.type.captureof: 2, ?>), (compiler.misc.arg.length.mismatch))}
+Martin.java:15:11: compiler.err.cant.apply.symbols: kindname.method, addAll, java.util.List<compiler.misc.type.captureof: 1, ?>,{(compiler.misc.inapplicable.method: kindname.method, java.util.List, addAll(java.util.Collection<? extends compiler.misc.type.captureof: 2, ?>), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.util.List<compiler.misc.type.captureof: 1, ?>, java.util.Collection<? extends compiler.misc.type.captureof: 2, ?>))),(compiler.misc.inapplicable.method: kindname.method, java.util.List, addAll(int,java.util.Collection<? extends compiler.misc.type.captureof: 2, ?>), (compiler.misc.arg.length.mismatch))}
1 error
--- a/test/langtools/tools/javac/generics/diamond/8065986/T8065986a.out Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/tools/javac/generics/diamond/8065986/T8065986a.out Mon Oct 09 11:38:46 2017 -0700
@@ -1,6 +1,6 @@
T8065986a.java:13:25: compiler.err.cant.apply.diamond.1: java.lang.Object, (compiler.misc.diamond.non.generic: java.lang.Object)
T8065986a.java:17:9: compiler.err.cant.apply.symbol: kindname.constructor, Object, compiler.misc.no.args, java.util.ArrayList<java.lang.Object>, kindname.class, java.lang.Object, (compiler.misc.arg.length.mismatch)
-T8065986a.java:21:9: compiler.err.cant.apply.symbol: kindname.constructor, Object, compiler.misc.no.args, @438, kindname.class, java.lang.Object, (compiler.misc.arg.length.mismatch)
-T8065986a.java:25:9: compiler.err.cant.apply.symbol: kindname.constructor, Object, compiler.misc.no.args, @520, kindname.class, java.lang.Object, (compiler.misc.arg.length.mismatch)
-T8065986a.java:29:9: compiler.err.cant.apply.symbol: kindname.constructor, Object, compiler.misc.no.args, @608, kindname.class, java.lang.Object, (compiler.misc.arg.length.mismatch)
+T8065986a.java:21:9: compiler.err.cant.apply.symbol: kindname.constructor, Object, compiler.misc.no.args, @15, kindname.class, java.lang.Object, (compiler.misc.arg.length.mismatch)
+T8065986a.java:25:9: compiler.err.cant.apply.symbol: kindname.constructor, Object, compiler.misc.no.args, @15, kindname.class, java.lang.Object, (compiler.misc.arg.length.mismatch)
+T8065986a.java:29:9: compiler.err.cant.apply.symbol: kindname.constructor, Object, compiler.misc.no.args, @20, kindname.class, java.lang.Object, (compiler.misc.arg.length.mismatch)
5 errors
--- a/test/langtools/tools/javac/generics/diamond/8065986/T8065986b.out Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/tools/javac/generics/diamond/8065986/T8065986b.out Mon Oct 09 11:38:46 2017 -0700
@@ -1,8 +1,8 @@
T8065986b.java:13:24: compiler.err.cant.apply.diamond.1: java.lang.Object, (compiler.misc.diamond.non.generic: java.lang.Object)
T8065986b.java:17:9: compiler.err.cant.apply.symbols: kindname.constructor, T8065986b, java.util.ArrayList<java.lang.Object>,{(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: java.util.ArrayList), (compiler.misc.infer.no.conforming.instance.exists: E, java.util.ArrayList<E>, boolean)))),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,java.lang.Object,java.lang.Object), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(int), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: java.util.ArrayList), (compiler.misc.infer.no.conforming.instance.exists: E, java.util.ArrayList<E>, int)))),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(int,int), (compiler.misc.arg.length.mismatch))}
-T8065986b.java:21:9: compiler.err.cant.apply.symbols: kindname.constructor, T8065986b, @443,{(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf: boolean))),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,java.lang.Object,java.lang.Object), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(int), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf: int))),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(int,int), (compiler.misc.arg.length.mismatch))}
-T8065986b.java:25:9: compiler.err.cant.apply.symbols: kindname.constructor, T8065986b, @524,{(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf: boolean))),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,java.lang.Object,java.lang.Object), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(int), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf: int))),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(int,int), (compiler.misc.arg.length.mismatch))}
-T8065986b.java:29:9: compiler.err.cant.apply.symbols: kindname.constructor, T8065986b, @611,{(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.type.in.conditional: (compiler.misc.inconvertible.types: java.lang.Object, boolean)))),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,java.lang.Object,java.lang.Object), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(int), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.type.in.conditional: (compiler.misc.inconvertible.types: java.lang.Object, int)))),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(int,int), (compiler.misc.arg.length.mismatch))}
+T8065986b.java:21:9: compiler.err.cant.apply.symbols: kindname.constructor, T8065986b, @14,{(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf: boolean))),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,java.lang.Object,java.lang.Object), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(int), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf: int))),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(int,int), (compiler.misc.arg.length.mismatch))}
+T8065986b.java:25:9: compiler.err.cant.apply.symbols: kindname.constructor, T8065986b, @14,{(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf: boolean))),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,java.lang.Object,java.lang.Object), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(int), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf: int))),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(int,int), (compiler.misc.arg.length.mismatch))}
+T8065986b.java:29:9: compiler.err.cant.apply.symbols: kindname.constructor, T8065986b, @19,{(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.type.in.conditional: (compiler.misc.inconvertible.types: java.lang.Object, boolean)))),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,java.lang.Object,java.lang.Object), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(int), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.type.in.conditional: (compiler.misc.inconvertible.types: java.lang.Object, int)))),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(int,int), (compiler.misc.arg.length.mismatch))}
T8065986b.java:33:24: compiler.err.cant.apply.diamond.1: java.lang.Object, (compiler.misc.diamond.non.generic: java.lang.Object)
T8065986b.java:37:9: compiler.err.cant.apply.symbols: kindname.constructor, T8065986b, java.util.ArrayList<java.lang.Object>,{(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: java.util.ArrayList), (compiler.misc.infer.no.conforming.instance.exists: E, java.util.ArrayList<E>, boolean)))),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,java.lang.Object,java.lang.Object), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(int), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: java.util.ArrayList), (compiler.misc.infer.no.conforming.instance.exists: E, java.util.ArrayList<E>, int)))),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(int,int), (compiler.misc.arg.length.mismatch))}
7 errors
--- a/test/langtools/tools/javac/generics/inference/EagerReturnTypeResolution/PrimitiveTypeBoxingTest.out Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/tools/javac/generics/inference/EagerReturnTypeResolution/PrimitiveTypeBoxingTest.out Mon Oct 09 11:38:46 2017 -0700
@@ -1,3 +1,3 @@
-PrimitiveTypeBoxingTest.java:19:9: compiler.err.cant.apply.symbol: kindname.method, m1, PrimitiveTypeBoxingTest.F<Z>,Z, @498,int, kindname.class, PrimitiveTypeBoxingTest, (compiler.misc.incompatible.upper.lower.bounds: Z, java.lang.Long,java.lang.Object, java.lang.Integer)
-PrimitiveTypeBoxingTest.java:20:9: compiler.err.cant.apply.symbol: kindname.method, m2, Z,PrimitiveTypeBoxingTest.F<Z>, int,@567, kindname.class, PrimitiveTypeBoxingTest, (compiler.misc.incompatible.upper.lower.bounds: Z, java.lang.Long,java.lang.Object, java.lang.Integer)
+PrimitiveTypeBoxingTest.java:19:9: compiler.err.cant.apply.symbol: kindname.method, m1, PrimitiveTypeBoxingTest.F<Z>,Z, @12,int, kindname.class, PrimitiveTypeBoxingTest, (compiler.misc.incompatible.upper.lower.bounds: Z, java.lang.Long,java.lang.Object, java.lang.Integer)
+PrimitiveTypeBoxingTest.java:20:9: compiler.err.cant.apply.symbol: kindname.method, m2, Z,PrimitiveTypeBoxingTest.F<Z>, int,@16, kindname.class, PrimitiveTypeBoxingTest, (compiler.misc.incompatible.upper.lower.bounds: Z, java.lang.Long,java.lang.Object, java.lang.Integer)
2 errors
--- a/test/langtools/tools/javac/lambda/8019480/T8019480.out Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/tools/javac/lambda/8019480/T8019480.out Mon Oct 09 11:38:46 2017 -0700
@@ -1,3 +1,3 @@
-T8019480.java:21:34: compiler.err.cant.apply.symbols: kindname.method, add, java.lang.Object,{(compiler.misc.inapplicable.method: kindname.method, java.util.Collection, add(U), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.Object, U))),(compiler.misc.inapplicable.method: kindname.method, java.util.List, add(U), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.Object, U))),(compiler.misc.inapplicable.method: kindname.method, java.util.List, add(int,U), (compiler.misc.arg.length.mismatch))}
+T8019480.java:21:34: compiler.err.cant.apply.symbols: kindname.method, add, java.lang.Object,{(compiler.misc.inapplicable.method: kindname.method, java.util.List, add(U), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.Object, U))),(compiler.misc.inapplicable.method: kindname.method, java.util.List, add(int,U), (compiler.misc.arg.length.mismatch))}
T8019480.java:21:46: compiler.err.report.access: clone(), protected, java.lang.Object
2 errors
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lambda/8063054/T8063054a.java Mon Oct 09 11:38:46 2017 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8063054
+ * @summary Bug summary
+ * @compile -Werror -Xlint:rawtypes T8063054a.java
+ */
+class T8063054a {
+ interface Consumer<T> { void accept(T arg); }
+ interface Parent<P> { void foo(); }
+ interface Child extends Parent<String> {}
+
+ static <T> void m(T arg, Consumer<T> f) {}
+
+ public void test(Child c) { m(c, Parent::foo); }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lambda/8063054/T8063054b.java Mon Oct 09 11:38:46 2017 -0700
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8063054
+ * @summary Bug summary
+ * @compile -Werror -Xlint:rawtypes T8063054b.java
+ */
+class T8063054b {
+ void test(Box<? extends Box<Number>> b) {
+ Number n = b.<Number>map(Box::get).get();
+ }
+
+ interface Func<S,T> { T apply(S arg); }
+
+ interface Box<T> {
+ T get();
+ <R> Box<R> map(Func<T,R> f);
+ }
+}
--- a/test/langtools/tools/javac/lambda/8074381/T8074381b.out Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/tools/javac/lambda/8074381/T8074381b.out Mon Oct 09 11:38:46 2017 -0700
@@ -1,2 +1,2 @@
-T8074381b.java:14:16: compiler.err.cant.apply.symbol: kindname.constructor, Invocation, T8074381b.ThrowingConsumer, @383, kindname.class, T8074381b.Invocation<T>, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.no.suitable.functional.intf.inst: T8074381b.ThrowingConsumer))
+T8074381b.java:14:16: compiler.err.cant.apply.symbol: kindname.constructor, Invocation, T8074381b.ThrowingConsumer, @31, kindname.class, T8074381b.Invocation<T>, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.no.suitable.functional.intf.inst: T8074381b.ThrowingConsumer))
1 error
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lambda/8188144/T8188144.java Mon Oct 09 11:38:46 2017 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8188144
+ * @summary regression in method reference type-checking
+ */
+
+import java.util.function.BiFunction;
+
+public class T8188144 {
+ public static void main(String[] args) {
+ BiFunction<String, String, String> format = String::format;
+ if (!format.apply("foo %s", "bar").endsWith("foo bar")) {
+ throw new AssertionError("Unexpected output!");
+ }
+ }
+}
--- a/test/langtools/tools/javac/lambda/BadMethodCall2.out Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/tools/javac/lambda/BadMethodCall2.out Mon Oct 09 11:38:46 2017 -0700
@@ -1,4 +1,4 @@
-BadMethodCall2.java:9:13: compiler.err.cant.resolve.location.args: kindname.method, nonExistent, , @309, (compiler.misc.location.1: kindname.variable, rec, java.lang.Object)
-BadMethodCall2.java:10:13: compiler.err.cant.resolve.location.args: kindname.method, nonExistent, , @356, (compiler.misc.location.1: kindname.variable, rec, java.lang.Object)
-BadMethodCall2.java:11:13: compiler.err.cant.resolve.location.args: kindname.method, nonExistent, , @390, (compiler.misc.location.1: kindname.variable, rec, java.lang.Object)
+BadMethodCall2.java:9:13: compiler.err.cant.resolve.location.args: kindname.method, nonExistent, , @26, (compiler.misc.location.1: kindname.variable, rec, java.lang.Object)
+BadMethodCall2.java:10:13: compiler.err.cant.resolve.location.args: kindname.method, nonExistent, , @26, (compiler.misc.location.1: kindname.variable, rec, java.lang.Object)
+BadMethodCall2.java:11:13: compiler.err.cant.resolve.location.args: kindname.method, nonExistent, , @31, (compiler.misc.location.1: kindname.variable, rec, java.lang.Object)
3 errors
--- a/test/langtools/tools/javac/lambda/BadRecovery.out Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/tools/javac/lambda/BadRecovery.out Mon Oct 09 11:38:46 2017 -0700
@@ -1,3 +1,3 @@
-BadRecovery.java:17:9: compiler.err.cant.apply.symbol: kindname.method, m, BadRecovery.SAM1, @369, kindname.class, BadRecovery, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.arg.types.in.lambda))
+BadRecovery.java:17:9: compiler.err.cant.apply.symbol: kindname.method, m, BadRecovery.SAM1, @11, kindname.class, BadRecovery, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.arg.types.in.lambda))
BadRecovery.java:17:77: compiler.err.cant.resolve.location: kindname.variable, f, , , (compiler.misc.location: kindname.class, BadRecovery, null)
2 errors
--- a/test/langtools/tools/javac/lambda/BadTargetType.out Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/tools/javac/lambda/BadTargetType.out Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,5 @@
BadTargetType.java:16:24: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: java.lang.Object)
BadTargetType.java:17:17: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: java.lang.Object)
-BadTargetType.java:20:9: compiler.err.cant.apply.symbol: kindname.method, m1, java.lang.Object, @460, kindname.class, BadTargetType, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf: java.lang.Object))
-BadTargetType.java:21:9: compiler.err.cant.apply.symbol: kindname.method, m2, java.lang.Object, @489, kindname.class, BadTargetType, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf: java.lang.Object))
+BadTargetType.java:20:9: compiler.err.cant.apply.symbol: kindname.method, m1, java.lang.Object, @12, kindname.class, BadTargetType, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf: java.lang.Object))
+BadTargetType.java:21:9: compiler.err.cant.apply.symbol: kindname.method, m2, java.lang.Object, @12, kindname.class, BadTargetType, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf: java.lang.Object))
4 errors
--- a/test/langtools/tools/javac/lambda/LambdaExpr19.out Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/tools/javac/lambda/LambdaExpr19.out Mon Oct 09 11:38:46 2017 -0700
@@ -1,6 +1,6 @@
-LambdaExpr19.java:17:9: compiler.err.cant.apply.symbol: kindname.method, m, LambdaExpr19.SAM, @363, kindname.class, LambdaExpr19, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: int, java.lang.String)))
-LambdaExpr19.java:24:9: compiler.err.cant.apply.symbol: kindname.method, m, LambdaExpr19.SAM, @512, kindname.class, LambdaExpr19, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: int, java.lang.String)))
-LambdaExpr19.java:31:9: compiler.err.cant.apply.symbol: kindname.method, m, LambdaExpr19.SAM, @676, kindname.class, LambdaExpr19, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: int, java.lang.String)))
-LambdaExpr19.java:39:9: compiler.err.cant.apply.symbol: kindname.method, m, LambdaExpr19.SAM, @824, kindname.class, LambdaExpr19, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: int, java.lang.String)))
-LambdaExpr19.java:47:9: compiler.err.cant.apply.symbol: kindname.method, m, LambdaExpr19.SAM, @965, kindname.class, LambdaExpr19, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: int, java.lang.String)))
+LambdaExpr19.java:17:9: compiler.err.cant.apply.symbol: kindname.method, m, LambdaExpr19.SAM, @11, kindname.class, LambdaExpr19, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: int, java.lang.String)))
+LambdaExpr19.java:24:9: compiler.err.cant.apply.symbol: kindname.method, m, LambdaExpr19.SAM, @11, kindname.class, LambdaExpr19, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: int, java.lang.String)))
+LambdaExpr19.java:31:9: compiler.err.cant.apply.symbol: kindname.method, m, LambdaExpr19.SAM, @11, kindname.class, LambdaExpr19, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: int, java.lang.String)))
+LambdaExpr19.java:39:9: compiler.err.cant.apply.symbol: kindname.method, m, LambdaExpr19.SAM, @11, kindname.class, LambdaExpr19, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: int, java.lang.String)))
+LambdaExpr19.java:47:9: compiler.err.cant.apply.symbol: kindname.method, m, LambdaExpr19.SAM, @11, kindname.class, LambdaExpr19, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: int, java.lang.String)))
5 errors
--- a/test/langtools/tools/javac/lambda/MethodReference20.out Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/tools/javac/lambda/MethodReference20.out Mon Oct 09 11:38:46 2017 -0700
@@ -1,3 +1,3 @@
MethodReference20.java:21:26: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, MethodReference20, java.lang.String, java.lang.Integer, kindname.class, MethodReference20<X>, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.Integer, java.lang.String))))
-MethodReference20.java:22:9: compiler.err.cant.apply.symbol: kindname.method, test, MethodReference20.SAM<java.lang.Integer>, @549, kindname.class, MethodReference20<X>, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, MethodReference20, java.lang.String, java.lang.Integer, kindname.class, MethodReference20<X>, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.Integer, java.lang.String)))))
+MethodReference20.java:22:9: compiler.err.cant.apply.symbol: kindname.method, test, MethodReference20.SAM<java.lang.Integer>, @14, kindname.class, MethodReference20<X>, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, MethodReference20, java.lang.String, java.lang.Integer, kindname.class, MethodReference20<X>, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.Integer, java.lang.String)))))
2 errors
--- a/test/langtools/tools/javac/lambda/MethodReference22.out Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/tools/javac/lambda/MethodReference22.out Mon Oct 09 11:38:46 2017 -0700
@@ -1,11 +1,11 @@
MethodReference22.java:40:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.bad.instance.method.in.unbound.lookup: kindname.method, m1(java.lang.String)))
-MethodReference22.java:41:9: compiler.err.cant.apply.symbol: kindname.method, call1, MethodReference22.SAM1, @999, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.bad.instance.method.in.unbound.lookup: kindname.method, m1(java.lang.String)))
+MethodReference22.java:41:9: compiler.err.cant.apply.symbol: kindname.method, call1, MethodReference22.SAM1, @15, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.bad.instance.method.in.unbound.lookup: kindname.method, m1(java.lang.String)))
MethodReference22.java:46:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.bad.instance.method.in.unbound.lookup: kindname.method, m4(java.lang.String)))
-MethodReference22.java:47:9: compiler.err.cant.apply.symbol: kindname.method, call1, MethodReference22.SAM1, @1270, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.bad.instance.method.in.unbound.lookup: kindname.method, m4(java.lang.String)))
+MethodReference22.java:47:9: compiler.err.cant.apply.symbol: kindname.method, call1, MethodReference22.SAM1, @15, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.bad.instance.method.in.unbound.lookup: kindname.method, m4(java.lang.String)))
MethodReference22.java:55:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m3, kindname.method, m3(MethodReference22,java.lang.String), MethodReference22, kindname.method, m3(java.lang.String), MethodReference22))
-MethodReference22.java:56:9: compiler.err.cant.apply.symbol: kindname.method, call2, MethodReference22.SAM2, @1574, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.bad.instance.method.in.unbound.lookup: kindname.method, m3(MethodReference22,java.lang.String)))
+MethodReference22.java:56:9: compiler.err.cant.apply.symbol: kindname.method, call2, MethodReference22.SAM2, @15, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.bad.instance.method.in.unbound.lookup: kindname.method, m3(MethodReference22,java.lang.String)))
MethodReference22.java:57:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m4, kindname.method, m4(MethodReference22,java.lang.String), MethodReference22, kindname.method, m4(java.lang.String), MethodReference22))
-MethodReference22.java:58:14: compiler.err.cant.apply.symbol: kindname.method, call2, MethodReference22.SAM2, @1667, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m4, kindname.method, m4(MethodReference22,java.lang.String), MethodReference22, kindname.method, m4(java.lang.String), MethodReference22)))
+MethodReference22.java:58:14: compiler.err.cant.apply.symbol: kindname.method, call2, MethodReference22.SAM2, @15, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m4, kindname.method, m4(MethodReference22,java.lang.String), MethodReference22, kindname.method, m4(java.lang.String), MethodReference22)))
MethodReference22.java:63:9: compiler.err.ref.ambiguous: call3, kindname.method, call3(MethodReference22.SAM1), MethodReference22, kindname.method, call3(MethodReference22.SAM2), MethodReference22
-MethodReference22.java:65:14: compiler.err.cant.apply.symbol: kindname.method, call3, MethodReference22.SAM2, @1881, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m4, kindname.method, m4(MethodReference22,java.lang.String), MethodReference22, kindname.method, m4(java.lang.String), MethodReference22)))
+MethodReference22.java:65:14: compiler.err.cant.apply.symbol: kindname.method, call3, MethodReference22.SAM2, @15, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m4, kindname.method, m4(MethodReference22,java.lang.String), MethodReference22, kindname.method, m4(java.lang.String), MethodReference22)))
10 errors
--- a/test/langtools/tools/javac/lambda/MethodReference41.out Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/tools/javac/lambda/MethodReference41.out Mon Oct 09 11:38:46 2017 -0700
@@ -1,4 +1,4 @@
-MethodReference41.java:38:11: compiler.err.cant.apply.symbol: kindname.method, m1, MethodReference41.SAM1, @775, kindname.class, MethodReference41, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Foo, java.lang.Number, java.lang.String, kindname.class, MethodReference41.Foo<X>, (compiler.misc.incompatible.upper.lower.bounds: X, java.lang.Number, java.lang.String))))
-MethodReference41.java:40:11: compiler.err.cant.apply.symbol: kindname.method, m3, MethodReference41.SAM3, @819, kindname.class, MethodReference41, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Foo, java.lang.Number, java.lang.Object, kindname.class, MethodReference41.Foo<X>, (compiler.misc.incompatible.upper.lower.bounds: X, java.lang.Number, java.lang.Object))))
+MethodReference41.java:38:11: compiler.err.cant.apply.symbol: kindname.method, m1, MethodReference41.SAM1, @12, kindname.class, MethodReference41, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Foo, java.lang.Number, java.lang.String, kindname.class, MethodReference41.Foo<X>, (compiler.misc.incompatible.upper.lower.bounds: X, java.lang.Number, java.lang.String))))
+MethodReference41.java:40:11: compiler.err.cant.apply.symbol: kindname.method, m3, MethodReference41.SAM3, @12, kindname.class, MethodReference41, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Foo, java.lang.Number, java.lang.Object, kindname.class, MethodReference41.Foo<X>, (compiler.misc.incompatible.upper.lower.bounds: X, java.lang.Number, java.lang.Object))))
MethodReference41.java:41:9: compiler.err.ref.ambiguous: m4, kindname.method, m4(MethodReference41.SAM2), MethodReference41, kindname.method, m4(MethodReference41.SAM3), MethodReference41
3 errors
--- a/test/langtools/tools/javac/lambda/MethodReference42.out Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/tools/javac/lambda/MethodReference42.out Mon Oct 09 11:38:46 2017 -0700
@@ -1,4 +1,4 @@
-MethodReference42.java:38:11: compiler.err.cant.apply.symbol: kindname.method, m1, MethodReference42.SAM1, @811, kindname.class, MethodReference42, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.String, java.lang.Number)))
-MethodReference42.java:40:11: compiler.err.cant.apply.symbol: kindname.method, m3, MethodReference42.SAM3, @855, kindname.class, MethodReference42, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.Object, java.lang.Number)))
+MethodReference42.java:38:11: compiler.err.cant.apply.symbol: kindname.method, m1, MethodReference42.SAM1, @12, kindname.class, MethodReference42, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.String, java.lang.Number)))
+MethodReference42.java:40:11: compiler.err.cant.apply.symbol: kindname.method, m3, MethodReference42.SAM3, @12, kindname.class, MethodReference42, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.Object, java.lang.Number)))
MethodReference42.java:41:9: compiler.err.ref.ambiguous: m4, kindname.method, m4(MethodReference42.SAM2), MethodReference42, kindname.method, m4(MethodReference42.SAM3), MethodReference42
3 errors
--- a/test/langtools/tools/javac/lambda/MethodReference43.out Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/tools/javac/lambda/MethodReference43.out Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,5 @@
-MethodReference43.java:45:11: compiler.err.cant.apply.symbol: kindname.method, m1, MethodReference43.SAM1, @905, kindname.class, MethodReference43, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Foo, java.lang.Number, java.lang.String, kindname.class, MethodReference43.Foo<X>, (compiler.misc.incompatible.upper.lower.bounds: X, java.lang.Number, java.lang.String))))
-MethodReference43.java:47:11: compiler.err.cant.apply.symbol: kindname.method, m3, MethodReference43.SAM3, @949, kindname.class, MethodReference43, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Foo, java.lang.Number, java.lang.Object, kindname.class, MethodReference43.Foo<X>, (compiler.misc.incompatible.upper.lower.bounds: X, java.lang.Number, java.lang.Object))))
+MethodReference43.java:45:11: compiler.err.cant.apply.symbol: kindname.method, m1, MethodReference43.SAM1, @12, kindname.class, MethodReference43, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Foo, java.lang.Number, java.lang.String, kindname.class, MethodReference43.Foo<X>, (compiler.misc.incompatible.upper.lower.bounds: X, java.lang.Number, java.lang.String))))
+MethodReference43.java:47:11: compiler.err.cant.apply.symbol: kindname.method, m3, MethodReference43.SAM3, @12, kindname.class, MethodReference43, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Foo, java.lang.Number, java.lang.Object, kindname.class, MethodReference43.Foo<X>, (compiler.misc.incompatible.upper.lower.bounds: X, java.lang.Number, java.lang.Object))))
MethodReference43.java:49:9: compiler.err.ref.ambiguous: m5, kindname.method, m5(MethodReference43.SAM3), MethodReference43, kindname.method, m5(MethodReference43.SAM4), MethodReference43
-MethodReference43.java:49:11: compiler.err.cant.apply.symbol: kindname.method, m5, MethodReference43.SAM3, @993, kindname.class, MethodReference43, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Foo, java.lang.Number, java.lang.Object, kindname.class, MethodReference43.Foo<X>, (compiler.misc.incompatible.upper.lower.bounds: X, java.lang.Number, java.lang.Object))))
+MethodReference43.java:49:11: compiler.err.cant.apply.symbol: kindname.method, m5, MethodReference43.SAM3, @12, kindname.class, MethodReference43, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Foo, java.lang.Number, java.lang.Object, kindname.class, MethodReference43.Foo<X>, (compiler.misc.incompatible.upper.lower.bounds: X, java.lang.Number, java.lang.Object))))
4 errors
--- a/test/langtools/tools/javac/lambda/MethodReference44.out Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/tools/javac/lambda/MethodReference44.out Mon Oct 09 11:38:46 2017 -0700
@@ -1,4 +1,4 @@
-MethodReference44.java:40:11: compiler.err.cant.apply.symbol: kindname.method, g1, MethodReference44.SAM1, @864, kindname.class, MethodReference44, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.String, java.lang.Number)))
-MethodReference44.java:42:11: compiler.err.cant.apply.symbol: kindname.method, g3, MethodReference44.SAM3, @932, kindname.class, MethodReference44, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.Object, java.lang.Number)))
+MethodReference44.java:40:11: compiler.err.cant.apply.symbol: kindname.method, g1, MethodReference44.SAM1, @12, kindname.class, MethodReference44, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.String, java.lang.Number)))
+MethodReference44.java:42:11: compiler.err.cant.apply.symbol: kindname.method, g3, MethodReference44.SAM3, @12, kindname.class, MethodReference44, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.Object, java.lang.Number)))
MethodReference44.java:43:9: compiler.err.ref.ambiguous: g4, kindname.method, g4(MethodReference44.SAM2), MethodReference44, kindname.method, g4(MethodReference44.SAM3), MethodReference44
3 errors
--- a/test/langtools/tools/javac/lambda/MethodReference46.out Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/tools/javac/lambda/MethodReference46.out Mon Oct 09 11:38:46 2017 -0700
@@ -1,4 +1,4 @@
-MethodReference46.java:40:11: compiler.err.cant.apply.symbol: kindname.method, g1, MethodReference46.SAM1, @817, kindname.class, MethodReference46, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m, X, java.lang.String, kindname.class, MethodReference46, (compiler.misc.incompatible.upper.lower.bounds: X, java.lang.Number, java.lang.String))))
-MethodReference46.java:42:11: compiler.err.cant.apply.symbol: kindname.method, g3, MethodReference46.SAM3, @885, kindname.class, MethodReference46, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m, X, java.lang.Object, kindname.class, MethodReference46, (compiler.misc.incompatible.upper.lower.bounds: X, java.lang.Number, java.lang.Object))))
+MethodReference46.java:40:11: compiler.err.cant.apply.symbol: kindname.method, g1, MethodReference46.SAM1, @12, kindname.class, MethodReference46, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m, X, java.lang.String, kindname.class, MethodReference46, (compiler.misc.incompatible.upper.lower.bounds: X, java.lang.Number, java.lang.String))))
+MethodReference46.java:42:11: compiler.err.cant.apply.symbol: kindname.method, g3, MethodReference46.SAM3, @12, kindname.class, MethodReference46, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m, X, java.lang.Object, kindname.class, MethodReference46, (compiler.misc.incompatible.upper.lower.bounds: X, java.lang.Number, java.lang.Object))))
MethodReference46.java:43:9: compiler.err.ref.ambiguous: g4, kindname.method, g4(MethodReference46.SAM2), MethodReference46, kindname.method, g4(MethodReference46.SAM3), MethodReference46
3 errors
--- a/test/langtools/tools/javac/lambda/MethodReference48.out Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/tools/javac/lambda/MethodReference48.out Mon Oct 09 11:38:46 2017 -0700
@@ -1,3 +1,3 @@
-MethodReference48.java:38:11: compiler.err.cant.apply.symbol: kindname.method, g1, MethodReference48.SAM1, @869, kindname.class, MethodReference48, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.mref: (compiler.misc.inconvertible.types: java.lang.String, MethodReference48.Foo<java.lang.Object>)))
+MethodReference48.java:38:11: compiler.err.cant.apply.symbol: kindname.method, g1, MethodReference48.SAM1, @12, kindname.class, MethodReference48, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.mref: (compiler.misc.inconvertible.types: java.lang.String, MethodReference48.Foo<java.lang.Object>)))
MethodReference48.java:41:9: compiler.err.ref.ambiguous: g4, kindname.method, g4(MethodReference48.SAM2), MethodReference48, kindname.method, g4(MethodReference48.SAM3), MethodReference48
2 errors
--- a/test/langtools/tools/javac/lambda/MethodReference55.out Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/tools/javac/lambda/MethodReference55.out Mon Oct 09 11:38:46 2017 -0700
@@ -1,3 +1,3 @@
MethodReference55.java:13:11: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.bad.static.method.in.bound.lookup: kindname.method, m(java.lang.Object)))
-MethodReference55.java:16:9: compiler.err.cant.apply.symbol: kindname.method, g, MethodReference55.V, @361, kindname.class, MethodReference55<X>, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.bad.static.method.in.bound.lookup: kindname.method, m(java.lang.Object))))
+MethodReference55.java:16:9: compiler.err.cant.apply.symbol: kindname.method, g, MethodReference55.V, @11, kindname.class, MethodReference55<X>, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.bad.static.method.in.bound.lookup: kindname.method, m(java.lang.Object))))
2 errors
--- a/test/langtools/tools/javac/lambda/MethodReference68.out Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/tools/javac/lambda/MethodReference68.out Mon Oct 09 11:38:46 2017 -0700
@@ -1,2 +1,2 @@
-MethodReference68.java:21:10: compiler.err.cant.apply.symbol: kindname.method, g, MethodReference68.F<Z>,Z[], @501,int, kindname.class, MethodReference68, (compiler.misc.incompatible.upper.lower.bounds: Z, MethodReference68.Foo,java.lang.Object, java.lang.Integer)
-1 error
+MethodReference68.java:21:10: compiler.err.cant.apply.symbol: kindname.method, g, MethodReference68.F<Z>,Z[], @12,int, kindname.class, MethodReference68, (compiler.misc.incompatible.upper.lower.bounds: Z, MethodReference68.Foo,java.lang.Object, java.lang.Integer)
+1 error
\ No newline at end of file
--- a/test/langtools/tools/javac/lambda/MethodReference72.java Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/tools/javac/lambda/MethodReference72.java Mon Oct 09 11:38:46 2017 -0700
@@ -15,6 +15,6 @@
<Z> void g(F<Z> f) { }
void test() {
- g(this::m1); //?
+ g(this::m1); //bad method reference argument type
}
}
--- a/test/langtools/tools/javac/lambda/MethodReference72.out Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/tools/javac/lambda/MethodReference72.out Mon Oct 09 11:38:46 2017 -0700
@@ -1,2 +1,2 @@
-MethodReference72.java:18:9: compiler.err.cant.apply.symbol: kindname.method, g, MethodReference72.F<Z>, @420, kindname.class, MethodReference72, (compiler.misc.infer.no.conforming.assignment.exists: Z, (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m1, java.lang.Integer, Z[], kindname.class, MethodReference72, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: Z[], java.lang.Integer)))))
+MethodReference72.java:18:9: compiler.err.cant.apply.symbol: kindname.method, g, MethodReference72.F<Z>, @11, kindname.class, MethodReference72, (compiler.misc.infer.no.conforming.assignment.exists: Z, (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m1, java.lang.Integer, Z[], kindname.class, MethodReference72, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: Z[], java.lang.Integer)))))
1 error
--- a/test/langtools/tools/javac/lambda/MostSpecific09.out Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/tools/javac/lambda/MostSpecific09.out Mon Oct 09 11:38:46 2017 -0700
@@ -3,7 +3,7 @@
MostSpecific09.java:27:9: compiler.note.verbose.resolve.multi: foo, MostSpecific09, 0, BASIC, compiler.misc.type.none, compiler.misc.no.args,{(compiler.misc.applicable.method.found: 0, foo(MostSpecific09.J), null)}
MostSpecific09.java:27:32: compiler.note.verbose.resolve.multi: println, java.io.PrintStream, 1, BASIC, java.lang.String, compiler.misc.no.args,{(compiler.misc.applicable.method.found: 0, println(java.lang.Object), null),(compiler.misc.applicable.method.found: 1, println(java.lang.String), null)}
MostSpecific09.java:28:20: compiler.err.lambda.body.neither.value.nor.void.compatible
-MostSpecific09.java:28:9: compiler.err.cant.apply.symbols: kindname.method, foo, @690,{(compiler.misc.inapplicable.method: kindname.method, MostSpecific09, foo(MostSpecific09.I), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.missing.ret.val: java.lang.String)))),(compiler.misc.inapplicable.method: kindname.method, MostSpecific09, foo(MostSpecific09.J), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.unexpected.ret.val)))}
+MostSpecific09.java:28:9: compiler.err.cant.apply.symbols: kindname.method, foo, @13,{(compiler.misc.inapplicable.method: kindname.method, MostSpecific09, foo(MostSpecific09.I), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.missing.ret.val: java.lang.String)))),(compiler.misc.inapplicable.method: kindname.method, MostSpecific09, foo(MostSpecific09.J), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.unexpected.ret.val)))}
MostSpecific09.java:28:43: compiler.note.verbose.resolve.multi: println, java.io.PrintStream, 1, BASIC, java.lang.String, compiler.misc.no.args,{(compiler.misc.applicable.method.found: 0, println(java.lang.Object), null),(compiler.misc.applicable.method.found: 1, println(java.lang.String), null)}
MostSpecific09.java:29:9: compiler.err.ref.ambiguous: foo, kindname.method, foo(MostSpecific09.I), MostSpecific09, kindname.method, foo(MostSpecific09.J), MostSpecific09
MostSpecific09.java:29:28: compiler.note.verbose.resolve.multi: <init>, java.lang.RuntimeException, 0, BASIC, compiler.misc.no.args, compiler.misc.no.args,{(compiler.misc.applicable.method.found: 0, java.lang.RuntimeException(), null)}
@@ -11,7 +11,7 @@
MostSpecific09.java:32:9: compiler.err.ref.ambiguous: foo, kindname.method, foo(MostSpecific09.I), MostSpecific09, kindname.method, foo(MostSpecific09.J), MostSpecific09
MostSpecific09.java:33:9: compiler.note.verbose.resolve.multi: foo, MostSpecific09, 0, BASIC, compiler.misc.type.none, compiler.misc.no.args,{(compiler.misc.applicable.method.found: 0, foo(MostSpecific09.I), null)}
MostSpecific09.java:42:20: compiler.err.lambda.body.neither.value.nor.void.compatible
-MostSpecific09.java:42:9: compiler.err.cant.apply.symbols: kindname.method, foo, @1139,{(compiler.misc.inapplicable.method: kindname.method, MostSpecific09, foo(MostSpecific09.I), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.missing.ret.val: java.lang.String)))),(compiler.misc.inapplicable.method: kindname.method, MostSpecific09, foo(MostSpecific09.J), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.unexpected.ret.val)))}
+MostSpecific09.java:42:9: compiler.err.cant.apply.symbols: kindname.method, foo, @13,{(compiler.misc.inapplicable.method: kindname.method, MostSpecific09, foo(MostSpecific09.I), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.missing.ret.val: java.lang.String)))),(compiler.misc.inapplicable.method: kindname.method, MostSpecific09, foo(MostSpecific09.J), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.unexpected.ret.val)))}
MostSpecific09.java:46:23: compiler.note.verbose.resolve.multi: println, java.io.PrintStream, 1, BASIC, java.lang.String, compiler.misc.no.args,{(compiler.misc.applicable.method.found: 0, println(java.lang.Object), null),(compiler.misc.applicable.method.found: 1, println(java.lang.String), null)}
MostSpecific09.java:49:9: compiler.note.verbose.resolve.multi: foo, MostSpecific09, 0, BASIC, compiler.misc.type.none, compiler.misc.no.args,{(compiler.misc.applicable.method.found: 0, foo(MostSpecific09.J), null)}
MostSpecific09.java:56:25: compiler.note.verbose.resolve.multi: <init>, Bar, 0, BASIC, compiler.misc.no.args, compiler.misc.no.args,{(compiler.misc.applicable.method.found: 0, Bar(), null)}
--- a/test/langtools/tools/javac/lambda/TargetType21.out Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/tools/javac/lambda/TargetType21.out Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,5 @@
TargetType21.java:28:9: compiler.err.ref.ambiguous: call, kindname.method, call(TargetType21.SAM2), TargetType21, kindname.method, <R,A>call(TargetType21.SAM3<R,A>), TargetType21
TargetType21.java:32:9: compiler.err.ref.ambiguous: call, kindname.method, call(TargetType21.SAM1), TargetType21, kindname.method, <R,A>call(TargetType21.SAM3<R,A>), TargetType21
-TargetType21.java:32:13: compiler.err.cant.apply.symbol: kindname.method, call, TargetType21.SAM1, @888, kindname.class, TargetType21, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: java.lang.Object, java.lang.String)))
+TargetType21.java:32:13: compiler.err.cant.apply.symbol: kindname.method, call, TargetType21.SAM1, @14, kindname.class, TargetType21, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: java.lang.Object, java.lang.String)))
TargetType21.java:33:9: compiler.err.ref.ambiguous: call, kindname.method, call(TargetType21.SAM1), TargetType21, kindname.method, <R,A>call(TargetType21.SAM3<R,A>), TargetType21
4 errors
--- a/test/langtools/tools/javac/lambda/TargetType24.out Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/tools/javac/lambda/TargetType24.out Mon Oct 09 11:38:46 2017 -0700
@@ -4,8 +4,8 @@
TargetType24.java:35:30: compiler.err.ref.ambiguous: forAll, kindname.method, forAll(TargetType24.F<A,java.lang.Boolean>), TargetType24.Array, kindname.method, forAll(TargetType24.FSub<A,java.lang.String>), TargetType24.Array
TargetType24.java:37:30: compiler.err.ref.ambiguous: forAll, kindname.method, forAll(TargetType24.F<A,java.lang.Boolean>), TargetType24.Array, kindname.method, forAll(TargetType24.FSub<A,java.lang.String>), TargetType24.Array
TargetType24.java:37:45: compiler.err.ref.ambiguous: forAll, kindname.method, forAll(TargetType24.F<A,java.lang.Boolean>), TargetType24.Array, kindname.method, forAll(TargetType24.FSub<A,java.lang.String>), TargetType24.Array
-TargetType24.java:37:52: compiler.err.cant.apply.symbol: kindname.method, forAll, TargetType24.F<java.lang.Character,java.lang.Boolean>, @1149, kindname.class, TargetType24.Array<A>, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: java.lang.String, java.lang.Boolean)))
-TargetType24.java:38:53: compiler.err.cant.apply.symbol: kindname.method, forAll2, TargetType24.FSub<java.lang.Character,java.lang.String>, @1221, kindname.class, TargetType24.Array<A>, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: boolean, java.lang.String)))
+TargetType24.java:37:52: compiler.err.cant.apply.symbol: kindname.method, forAll, TargetType24.F<java.lang.Character,java.lang.Boolean>, @53, kindname.class, TargetType24.Array<A>, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: java.lang.String, java.lang.Boolean)))
+TargetType24.java:38:53: compiler.err.cant.apply.symbol: kindname.method, forAll2, TargetType24.FSub<java.lang.Character,java.lang.String>, @54, kindname.class, TargetType24.Array<A>, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: boolean, java.lang.String)))
TargetType24.java:39:101: compiler.err.prob.found.req: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: java.lang.String, java.lang.Boolean))
TargetType24.java:40:104: compiler.err.prob.found.req: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: boolean, java.lang.String))
10 errors
--- a/test/langtools/tools/javac/lambda/TargetType33.out Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/tools/javac/lambda/TargetType33.out Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,5 @@
TargetType33.java:21:31: compiler.err.prob.found.req: (compiler.misc.incompatible.type.in.conditional: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, intRes, java.lang.Object, compiler.misc.no.args, kindname.class, TargetType33, (compiler.misc.arg.length.mismatch))))
TargetType33.java:21:46: compiler.err.prob.found.req: (compiler.misc.incompatible.type.in.conditional: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, intRes, java.lang.Object, compiler.misc.no.args, kindname.class, TargetType33, (compiler.misc.arg.length.mismatch))))
-TargetType33.java:22:9: compiler.err.cant.apply.symbol: kindname.method, m, TargetType33.A<java.lang.Integer>, @509, kindname.class, TargetType33, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.type.in.conditional: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, intRes, java.lang.Object, compiler.misc.no.args, kindname.class, TargetType33, (compiler.misc.arg.length.mismatch)))))
-TargetType33.java:23:9: compiler.err.cant.apply.symbol: kindname.method, m2, TargetType33.A<Z>, @557, kindname.class, TargetType33, (compiler.misc.infer.no.conforming.assignment.exists: Z, (compiler.misc.incompatible.type.in.conditional: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, intRes, java.lang.Object, compiler.misc.no.args, kindname.class, TargetType33, (compiler.misc.arg.length.mismatch)))))
+TargetType33.java:22:9: compiler.err.cant.apply.symbol: kindname.method, m, TargetType33.A<java.lang.Integer>, @16, kindname.class, TargetType33, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.type.in.conditional: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, intRes, java.lang.Object, compiler.misc.no.args, kindname.class, TargetType33, (compiler.misc.arg.length.mismatch)))))
+TargetType33.java:23:9: compiler.err.cant.apply.symbol: kindname.method, m2, TargetType33.A<Z>, @17, kindname.class, TargetType33, (compiler.misc.infer.no.conforming.assignment.exists: Z, (compiler.misc.incompatible.type.in.conditional: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, intRes, java.lang.Object, compiler.misc.no.args, kindname.class, TargetType33, (compiler.misc.arg.length.mismatch)))))
4 errors
--- a/test/langtools/tools/javac/lambda/TargetType43.out Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/tools/javac/lambda/TargetType43.out Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,5 @@
TargetType43.java:13:20: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: java.lang.Object)
TargetType43.java:13:30: compiler.err.cant.resolve.location: kindname.class, NonExistentClass, , , (compiler.misc.location: kindname.class, TargetType43, null)
-TargetType43.java:14:9: compiler.err.cant.apply.symbol: kindname.method, m, java.lang.Object, @359, kindname.class, TargetType43, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf: java.lang.Object))
+TargetType43.java:14:9: compiler.err.cant.apply.symbol: kindname.method, m, java.lang.Object, @11, kindname.class, TargetType43, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf: java.lang.Object))
TargetType43.java:14:21: compiler.err.cant.resolve.location: kindname.class, NonExistentClass, , , (compiler.misc.location: kindname.class, TargetType43, null)
4 errors
--- a/test/langtools/tools/javac/lambda/TargetType44.out Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/tools/javac/lambda/TargetType44.out Mon Oct 09 11:38:46 2017 -0700
@@ -1,3 +1,3 @@
-TargetType44.java:22:9: compiler.err.cant.apply.symbols: kindname.method, m, @458,{(compiler.misc.inapplicable.method: kindname.method, TargetType44, m(TargetType44.Unary), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.arg.types.in.lambda))),(compiler.misc.inapplicable.method: kindname.method, TargetType44, m(TargetType44.Binary), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.arg.types.in.lambda)))}
-TargetType44.java:25:9: compiler.err.cant.apply.symbols: kindname.method, m, @597,{(compiler.misc.inapplicable.method: kindname.method, TargetType44, m(TargetType44.Unary), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.arg.types.in.lambda))),(compiler.misc.inapplicable.method: kindname.method, TargetType44, m(TargetType44.Binary), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.arg.types.in.lambda)))}
+TargetType44.java:22:9: compiler.err.cant.apply.symbols: kindname.method, m, @11,{(compiler.misc.inapplicable.method: kindname.method, TargetType44, m(TargetType44.Unary), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.arg.types.in.lambda))),(compiler.misc.inapplicable.method: kindname.method, TargetType44, m(TargetType44.Binary), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.arg.types.in.lambda)))}
+TargetType44.java:25:9: compiler.err.cant.apply.symbols: kindname.method, m, @11,{(compiler.misc.inapplicable.method: kindname.method, TargetType44, m(TargetType44.Unary), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.arg.types.in.lambda))),(compiler.misc.inapplicable.method: kindname.method, TargetType44, m(TargetType44.Binary), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.arg.types.in.lambda)))}
2 errors
--- a/test/langtools/tools/javac/lambda/TargetType52.out Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/tools/javac/lambda/TargetType52.out Mon Oct 09 11:38:46 2017 -0700
@@ -1,2 +1,2 @@
-TargetType52.java:17:9: compiler.err.cant.apply.symbol: kindname.method, m, TargetType52.FI<? extends java.lang.CharSequence,? extends java.util.ArrayList<? extends java.lang.CharSequence>>, @525, kindname.class, TargetType52, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.no.suitable.functional.intf.inst: TargetType52.FI<java.lang.CharSequence,java.util.ArrayList<? extends java.lang.CharSequence>>))
+TargetType52.java:17:9: compiler.err.cant.apply.symbol: kindname.method, m, TargetType52.FI<? extends java.lang.CharSequence,? extends java.util.ArrayList<? extends java.lang.CharSequence>>, @11, kindname.class, TargetType52, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.no.suitable.functional.intf.inst: TargetType52.FI<java.lang.CharSequence,java.util.ArrayList<? extends java.lang.CharSequence>>))
1 error
--- a/test/langtools/tools/javac/lambda/TargetType60.out Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/tools/javac/lambda/TargetType60.out Mon Oct 09 11:38:46 2017 -0700
@@ -1,6 +1,6 @@
TargetType60.java:54:21: compiler.err.ref.ambiguous: g, kindname.method, g(TargetType60.Sam0), TargetType60, kindname.method, <U>g(TargetType60.Sam1<U>), TargetType60
TargetType60.java:55:21: compiler.err.ref.ambiguous: g, kindname.method, <U>g(TargetType60.Sam1<U>), TargetType60, kindname.method, <U>g(TargetType60.Sam2<U,java.lang.String>), TargetType60
-TargetType60.java:61:27: compiler.err.cant.apply.symbols: kindname.method, u, @1639,{(compiler.misc.inapplicable.method: kindname.method, TargetType60, <U>u(TargetType60.Sam1<U>), (compiler.misc.infer.no.conforming.assignment.exists: U, (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, n2, TargetType60,java.lang.String, U, kindname.class, TargetType60, (compiler.misc.arg.length.mismatch))))),(compiler.misc.inapplicable.method: kindname.method, TargetType60, <U>u(TargetType60.Sam2<U,java.lang.String>), (compiler.misc.infer.no.conforming.assignment.exists: U, (compiler.misc.invalid.mref: kindname.method, (compiler.misc.bad.instance.method.in.unbound.lookup: kindname.method, n2(TargetType60,java.lang.String)))))}
+TargetType60.java:61:27: compiler.err.cant.apply.symbols: kindname.method, u, @29,{(compiler.misc.inapplicable.method: kindname.method, TargetType60, <U>u(TargetType60.Sam1<U>), (compiler.misc.infer.no.conforming.assignment.exists: U, (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, n2, TargetType60,java.lang.String, U, kindname.class, TargetType60, (compiler.misc.arg.length.mismatch))))),(compiler.misc.inapplicable.method: kindname.method, TargetType60, <U>u(TargetType60.Sam2<U,java.lang.String>), (compiler.misc.infer.no.conforming.assignment.exists: U, (compiler.misc.invalid.mref: kindname.method, (compiler.misc.bad.instance.method.in.unbound.lookup: kindname.method, n2(TargetType60,java.lang.String)))))}
TargetType60.java:62:27: compiler.err.ref.ambiguous: u, kindname.method, <U>u(TargetType60.Sam1<U>), TargetType60, kindname.method, <U>u(TargetType60.Sam2<U,java.lang.String>), TargetType60
TargetType60.java:63:27: compiler.err.ref.ambiguous: u, kindname.method, <U>u(TargetType60.Sam1<U>), TargetType60, kindname.method, <U>u(TargetType60.Sam2<U,java.lang.String>), TargetType60
5 errors
--- a/test/langtools/tools/javac/lambda/funcInterfaces/LambdaTest2_neg1.out Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/tools/javac/lambda/funcInterfaces/LambdaTest2_neg1.out Mon Oct 09 11:38:46 2017 -0700
@@ -1,2 +1,2 @@
-LambdaTest2_neg1.java:15:13: compiler.err.cant.apply.symbol: kindname.method, methodQooRoo, QooRoo<java.lang.Integer,java.lang.Integer,java.lang.Void>, @531, kindname.class, LambdaTest2_neg1, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf.1: QooRoo, (compiler.misc.incompatible.abstracts: kindname.interface, QooRoo)))
+LambdaTest2_neg1.java:15:13: compiler.err.cant.apply.symbol: kindname.method, methodQooRoo, QooRoo<java.lang.Integer,java.lang.Integer,java.lang.Void>, @27, kindname.class, LambdaTest2_neg1, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf.1: QooRoo, (compiler.misc.incompatible.abstracts: kindname.interface, QooRoo)))
1 error
--- a/test/langtools/tools/javac/lambda/typeInference/InferenceTest_neg1_2.out Mon Oct 09 10:42:27 2017 +0530
+++ b/test/langtools/tools/javac/lambda/typeInference/InferenceTest_neg1_2.out Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,5 @@
InferenceTest_neg1_2.java:14:13: compiler.err.ref.ambiguous: method, kindname.method, method(InferenceTest_neg1_2.SAM4<java.lang.Double,java.lang.String>), InferenceTest_neg1_2, kindname.method, method(InferenceTest_neg1_2.SAM5<java.lang.Integer>), InferenceTest_neg1_2
InferenceTest_neg1_2.java:15:13: compiler.err.ref.ambiguous: method, kindname.method, method(InferenceTest_neg1_2.SAM4<java.lang.Double,java.lang.String>), InferenceTest_neg1_2, kindname.method, method(InferenceTest_neg1_2.SAM5<java.lang.Integer>), InferenceTest_neg1_2
InferenceTest_neg1_2.java:16:13: compiler.err.ref.ambiguous: method, kindname.method, method(InferenceTest_neg1_2.SAM4<java.lang.Double,java.lang.String>), InferenceTest_neg1_2, kindname.method, method(InferenceTest_neg1_2.SAM5<java.lang.Integer>), InferenceTest_neg1_2
-InferenceTest_neg1_2.java:16:20: compiler.err.cant.apply.symbol: kindname.method, method, InferenceTest_neg1_2.SAM4<java.lang.Double,java.lang.String>, @597, kindname.class, InferenceTest_neg1_2, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: int, java.lang.String)))
+InferenceTest_neg1_2.java:16:20: compiler.err.cant.apply.symbol: kindname.method, method, InferenceTest_neg1_2.SAM4<java.lang.Double,java.lang.String>, @21, kindname.class, InferenceTest_neg1_2, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: int, java.lang.String)))
4 errors
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/tree/VarTree.java Mon Oct 09 11:38:46 2017 -0700
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8188225
+ * @summary Check that variables of type var have a consistent model
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ */
+
+import com.sun.source.tree.CompilationUnitTree;
+import com.sun.tools.javac.api.JavacTaskImpl;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.ToolProvider;
+
+import com.sun.source.tree.VariableTree;
+import com.sun.source.util.TreeScanner;
+import com.sun.source.util.Trees;
+
+public class VarTree {
+ private final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
+
+ public static void main(String... args) throws Exception {
+ VarTree test = new VarTree();
+ test.run("|var testVar = 0;| ",
+ "int testVar = 0");
+ test.run("|var testVar = 0;| undef undef;",
+ "int testVar = 0");
+ test.run("|final var testVar = 0;| ",
+ "final int testVar = 0");
+ test.run("for (|var testVar| : java.util.Arrays.asList(0, 1)) {}",
+ "java.lang.Integer testVar");
+ test.run("for (|final var testVar| : java.util.Arrays.asList(0, 1)) {}",
+ "final java.lang.Integer testVar");
+ test.run("java.util.function.Consumer<String> c = |testVar| -> {};",
+ "java.lang.String testVar");
+ test.run("java.util.function.Consumer<String> c = (|testVar|) -> {};",
+ "java.lang.String testVar");
+ }
+
+ void run(String code, String expected) throws IOException {
+ String[] parts = code.split("\\|");
+
+ if (parts.length != 3) {
+ throw new IllegalStateException("Incorrect number of markers.");
+ }
+
+ String prefix = "public class Test { void test() { ";
+ String src = prefix + parts[0] + parts[1] + parts[2] + " } }";
+
+ JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, d -> {},
+ List.of("--should-stop:at=FLOW"),
+ null, Arrays.asList(new MyFileObject(src)));
+
+ Iterable<? extends CompilationUnitTree> units = ct.parse();
+ ct.analyze();
+
+ Trees trees = Trees.instance(ct);
+
+ for (CompilationUnitTree cut : units) {
+ new TreeScanner<Void, Void>() {
+ @Override
+ public Void visitVariable(VariableTree node, Void p) {
+ if (node.getName().contentEquals("testVar")) {
+ if (!expected.equals(node.toString())) {
+ throw new AssertionError("Unexpected tree: " + node.toString());
+ }
+
+ int start = (int) trees.getSourcePositions().getStartPosition(cut, node);
+ int end = (int) trees.getSourcePositions().getEndPosition(cut, node);
+
+ String snip = src.substring(start, end);
+
+ if (start != prefix.length() + parts[0].length() || end != prefix.length() + parts[0].length() + parts[1].length()) {
+ throw new AssertionError("Unexpected span: " + snip);
+ }
+
+ int typeStart = (int) trees.getSourcePositions().getStartPosition(cut, node.getType());
+ int typeEnd = (int) trees.getSourcePositions().getEndPosition(cut, node.getType());
+
+ if (typeStart != (-1) && typeEnd != (-1)) {
+ throw new AssertionError("Unexpected type position: " + typeStart + ", " + typeEnd);
+ }
+ }
+ return super.visitVariable(node, p);
+ }
+
+ }.scan(cut, null);
+ }
+ }
+ class MyFileObject extends SimpleJavaFileObject {
+
+ private String text;
+
+ public MyFileObject(String text) {
+ super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+ this.text = text;
+ }
+
+ @Override
+ public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+ return text;
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/nashorn/script/basic/JDK-8147076.js Mon Oct 09 11:38:46 2017 -0700
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8147076: LinkerCallSite.ARGLIMIT is used incorrectly
+ *
+ * @test
+ * @run
+ */
+
+function nonvarargs(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10,
+ p11, p12, p13, p14, p15, p16, p17, p18, p19, p20,
+ p21, p22, p23, p24, p25, p26, p27, p28, p29, p30,
+ p31, p32, p33, p34, p35, p36, p37, p38, p39, p40,
+ p41, p42, p43, p44, p45, p46, p47, p48, p49, p50,
+ p51, p52, p53, p54, p55, p56, p57, p58, p59, p60,
+ p61, p62, p63, p64, p65, p66, p67, p68, p69, p70,
+ p71, p72, p73, p74, p75, p76, p77, p78, p79, p80,
+ p81, p82, p83, p84, p85, p86, p87, p88, p89, p90,
+ p91, p92, p93, p94, p95, p96, p97, p98, p99, p100,
+ p101, p102, p103, p104, p105, p106, p107, p108, p109, p110,
+ p111, p112, p113, p114, p115, p116, p117, p118, p119, p120,
+ p121, p122, p123, p124, p125) {
+ //eval() is just to make sure this-object and callee are passed as parameters
+ eval();
+ print("non-vararg invocation if arguments <= 125");
+}
+
+nonvarargs(1.1,2.2,3.3,4.4,5.5,6.6,7.7,8.8,9.9,10.10,11.11,12.12,13.13,14.14,15.15,16.16,17.17,18.18,19.19,20.20,
+ 21.21,22.22,23.23,24.24,25.25,26.26,27.27,28.28,29.29,30.30,31.31,32.32,33.33,34.34,35.35,36.36,37.37,38.38,39.39,40.40,
+ 41.41,42.42,43.43,44.44,45.45,46.46,47.47,48.48,49.49,50.50,51.51,52.52,53.53,54.54,55.55,56.56,57.57,58.58,59.59,60.60,
+ 61.61,62.62,63.63,64.64,65.65,66.66,67.67,68.68,69.69,70.70,71.71,72.72,73.73,74.74,75.75,76.76,77.77,78.78,79.79,80.80,
+ 81.81,82.82,83.83,84.84,85.85,86.86,87.87,88.88,89.89,90.90,91.91,92.92,93.93,94.94,95.95,96.96,97.97,98.98,99.99,100.100,
+ 101.101,102.102,103.103,104.104,105.105,106.106,107.107,108.108,109.109,110.110,111.111,112.112,113.113,114.114,115.115,
+ 116.116,117.117,118.118,119.119,120.120,121.121,122.122,123.123,124.124,125.125);
+
+
+
+function varargs(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10,
+ p11, p12, p13, p14, p15, p16, p17, p18, p19, p20,
+ p21, p22, p23, p24, p25, p26, p27, p28, p29, p30,
+ p31, p32, p33, p34, p35, p36, p37, p38, p39, p40,
+ p41, p42, p43, p44, p45, p46, p47, p48, p49, p50,
+ p51, p52, p53, p54, p55, p56, p57, p58, p59, p60,
+ p61, p62, p63, p64, p65, p66, p67, p68, p69, p70,
+ p71, p72, p73, p74, p75, p76, p77, p78, p79, p80,
+ p81, p82, p83, p84, p85, p86, p87, p88, p89, p90,
+ p91, p92, p93, p94, p95, p96, p97, p98, p99, p100,
+ p101, p102, p103, p104, p105, p106, p107, p108, p109, p110,
+ p111, p112, p113, p114, p115, p116, p117, p118, p119, p120,
+ p121, p122, p123, p124, p125, p126) {
+ //eval() is just to make sure this-object and callee are passed as parameters
+ eval();
+ print("vararg invocation if arguments > 125");
+}
+
+varargs(1.1,2.2,3.3,4.4,5.5,6.6,7.7,8.8,9.9,10.10,11.11,12.12,13.13,14.14,15.15,16.16,17.17,18.18,19.19,20.20,
+ 21.21,22.22,23.23,24.24,25.25,26.26,27.27,28.28,29.29,30.30,31.31,32.32,33.33,34.34,35.35,36.36,37.37,38.38,39.39,40.40,
+ 41.41,42.42,43.43,44.44,45.45,46.46,47.47,48.48,49.49,50.50,51.51,52.52,53.53,54.54,55.55,56.56,57.57,58.58,59.59,60.60,
+ 61.61,62.62,63.63,64.64,65.65,66.66,67.67,68.68,69.69,70.70,71.71,72.72,73.73,74.74,75.75,76.76,77.77,78.78,79.79,80.80,
+ 81.81,82.82,83.83,84.84,85.85,86.86,87.87,88.88,89.89,90.90,91.91,92.92,93.93,94.94,95.95,96.96,97.97,98.98,99.99,100.100,
+ 101.101,102.102,103.103,104.104,105.105,106.106,107.107,108.108,109.109,110.110,111.111,112.112,113.113,114.114,115.115,
+ 116.116,117.117,118.118,119.119,120.120,121.121,122.122,123.123,124.124,125.125,126.126);
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/nashorn/script/basic/JDK-8147076.js.EXPECTED Mon Oct 09 11:38:46 2017 -0700
@@ -0,0 +1,2 @@
+non-vararg invocation if arguments <= 125
+vararg invocation if arguments > 125
--- a/test/nashorn/script/trusted/JDK-8006529.js Mon Oct 09 10:42:27 2017 +0530
+++ b/test/nashorn/script/trusted/JDK-8006529.js Mon Oct 09 11:38:46 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -256,9 +256,9 @@
// eval, but at least the parent doesn't have to be vararg.
testFirstFn("(function f() { function g() { eval() } })", 'usesSelfSymbol', 'needsParentScope', 'needsCallee', 'hasScopeBlock', 'allVarsInScope')
-// Function with 250 named parameters is ordinary
-testFirstFn("function f(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23, p24, p25, p26, p27, p28, p29, p30, p31, p32, p33, p34, p35, p36, p37, p38, p39, p40, p41, p42, p43, p44, p45, p46, p47, p48, p49, p50, p51, p52, p53, p54, p55, p56, p57, p58, p59, p60, p61, p62, p63, p64, p65, p66, p67, p68, p69, p70, p71, p72, p73, p74, p75, p76, p77, p78, p79, p80, p81, p82, p83, p84, p85, p86, p87, p88, p89, p90, p91, p92, p93, p94, p95, p96, p97, p98, p99, p100, p101, p102, p103, p104, p105, p106, p107, p108, p109, p110, p111, p112, p113, p114, p115, p116, p117, p118, p119, p120, p121, p122, p123, p124, p125, p126, p127, p128, p129, p130, p131, p132, p133, p134, p135, p136, p137, p138, p139, p140, p141, p142, p143, p144, p145, p146, p147, p148, p149, p150, p151, p152, p153, p154, p155, p156, p157, p158, p159, p160, p161, p162, p163, p164, p165, p166, p167, p168, p169, p170, p171, p172, p173, p174, p175, p176, p177, p178, p179, p180, p181, p182, p183, p184, p185, p186, p187, p188, p189, p190, p191, p192, p193, p194, p195, p196, p197, p198, p199, p200, p201, p202, p203, p204, p205, p206, p207, p208, p209, p210, p211, p212, p213, p214, p215, p216, p217, p218, p219, p220, p221, p222, p223, p224, p225, p226, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p238, p239, p240, p241, p242, p243, p244, p245, p246, p247, p248, p249, p250) { p250 = p249 }")
+// Function with 125 named parameters is ordinary
+testFirstFn("function f(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23, p24, p25, p26, p27, p28, p29, p30, p31, p32, p33, p34, p35, p36, p37, p38, p39, p40, p41, p42, p43, p44, p45, p46, p47, p48, p49, p50, p51, p52, p53, p54, p55, p56, p57, p58, p59, p60, p61, p62, p63, p64, p65, p66, p67, p68, p69, p70, p71, p72, p73, p74, p75, p76, p77, p78, p79, p80, p81, p82, p83, p84, p85, p86, p87, p88, p89, p90, p91, p92, p93, p94, p95, p96, p97, p98, p99, p100, p101, p102, p103, p104, p105, p106, p107, p108, p109, p110, p111, p112, p113, p114, p115, p116, p117, p118, p119, p120, p121, p122, p123, p124, p125) { p125 = p124 }")
-// Function with 251 named parameters is variable arguments
+// Function with 126 named parameters is variable arguments
// NOTE: hasScopeBlock should be optimized away. Implementation of JDK-8038942 should take care of it.
-testFirstFn("function f(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23, p24, p25, p26, p27, p28, p29, p30, p31, p32, p33, p34, p35, p36, p37, p38, p39, p40, p41, p42, p43, p44, p45, p46, p47, p48, p49, p50, p51, p52, p53, p54, p55, p56, p57, p58, p59, p60, p61, p62, p63, p64, p65, p66, p67, p68, p69, p70, p71, p72, p73, p74, p75, p76, p77, p78, p79, p80, p81, p82, p83, p84, p85, p86, p87, p88, p89, p90, p91, p92, p93, p94, p95, p96, p97, p98, p99, p100, p101, p102, p103, p104, p105, p106, p107, p108, p109, p110, p111, p112, p113, p114, p115, p116, p117, p118, p119, p120, p121, p122, p123, p124, p125, p126, p127, p128, p129, p130, p131, p132, p133, p134, p135, p136, p137, p138, p139, p140, p141, p142, p143, p144, p145, p146, p147, p148, p149, p150, p151, p152, p153, p154, p155, p156, p157, p158, p159, p160, p161, p162, p163, p164, p165, p166, p167, p168, p169, p170, p171, p172, p173, p174, p175, p176, p177, p178, p179, p180, p181, p182, p183, p184, p185, p186, p187, p188, p189, p190, p191, p192, p193, p194, p195, p196, p197, p198, p199, p200, p201, p202, p203, p204, p205, p206, p207, p208, p209, p210, p211, p212, p213, p214, p215, p216, p217, p218, p219, p220, p221, p222, p223, p224, p225, p226, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p238, p239, p240, p241, p242, p243, p244, p245, p246, p247, p248, p249, p250, p251) { p250 = p251 }", 'isVarArg', 'hasScopeBlock')
+testFirstFn("function f(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23, p24, p25, p26, p27, p28, p29, p30, p31, p32, p33, p34, p35, p36, p37, p38, p39, p40, p41, p42, p43, p44, p45, p46, p47, p48, p49, p50, p51, p52, p53, p54, p55, p56, p57, p58, p59, p60, p61, p62, p63, p64, p65, p66, p67, p68, p69, p70, p71, p72, p73, p74, p75, p76, p77, p78, p79, p80, p81, p82, p83, p84, p85, p86, p87, p88, p89, p90, p91, p92, p93, p94, p95, p96, p97, p98, p99, p100, p101, p102, p103, p104, p105, p106, p107, p108, p109, p110, p111, p112, p113, p114, p115, p116, p117, p118, p119, p120, p121, p122, p123, p124, p125, p126) { p125 = p126 }", 'isVarArg', 'hasScopeBlock')