--- a/bin/unshuffle_list.txt Tue Sep 26 10:46:23 2017 +0530
+++ b/bin/unshuffle_list.txt Thu Sep 28 09:13:27 2017 -0700
@@ -88,7 +88,6 @@
src/jdk.naming.rmi : jdk/src/jdk.naming.rmi
src/jdk.net : jdk/src/jdk.net
src/jdk.pack : jdk/src/jdk.pack
-src/jdk.policytool : jdk/src/jdk.policytool
src/jdk.rmic : corba/src/jdk.rmic jdk/src/jdk.rmic
src/jdk.scripting.nashorn : nashorn/src/jdk.scripting.nashorn
src/jdk.scripting.nashorn.shell : nashorn/src/jdk.scripting.nashorn.shell
--- a/doc/nashorn/genshelldoc.js Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * Generate HTML documentation for shell tool. Re-run this tool to regenerate
- * html doc when you change options.
- *
- * Usage:
- *
- * jjs -scripting genshelldoc.js > shell.html
- */
-
-var Options = Packages.jdk.nashorn.internal.runtime.options.Options;
-var title = "Nashorn command line shell tool";
-
-print(<<PREFIX
-<html>
-<head>
-<title>
-${title}
-</title>
-</head>
-<body>
-<h1>Usage</h1>
-<p>
-<code>
-<b>jjs <options> <script-files> [ -- <script-arguments> ]</b>
-</code>
-</p>
-
-<h1>${title} options</h1>
-
-<table border="0">
-<tr>
-<th>name</th>
-<th>type</th>
-<th>default</th>
-<th>description</th>
-</tr>
-PREFIX);
-
-for each (opt in Options.validOptions) {
-
-var isTimezone = (opt.type == "timezone");
-var defValue = opt.defaultValue;
-if (defValue == null) {
- defValue = "<none>";
-}
-
-if (isTimezone) {
- // don't output current user's timezone
- defValue = "<default-timezone>"
-}
-
-print(<<ROW
- <tr>
- <td><b>${opt.name} ${opt.shortName == null? "" : opt.shortName}</b></td>
- <td>${opt.type}</td>
- <td>${defValue}</td>
- <td>${opt.description}</td>
- </tr>
-ROW);
-
-}
-
-print(<<SUFFIX
-</table>
-</body>
-</html>
-SUFFIX);
--- a/make/BuildNashorn.gmk Tue Sep 26 10:46:23 2017 +0530
+++ b/make/BuildNashorn.gmk Thu Sep 28 09:13:27 2017 -0700
@@ -41,7 +41,7 @@
$(eval $(call SetupJavaCompiler, GENERATE_NEWBYTECODE_DEBUG, \
JVM := $(JAVA_JAVAC), \
JAVAC := $(NEW_JAVAC), \
- FLAGS := -g -source 9 -target 9 --upgrade-module-path "$(JDK_OUTPUTDIR)/modules/" \
+ FLAGS := -g -source 10 -target 10 --upgrade-module-path "$(JDK_OUTPUTDIR)/modules/" \
--system none --module-source-path $(call GetModuleSrcPath), \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
--- a/make/Bundles.gmk Tue Sep 26 10:46:23 2017 +0530
+++ b/make/Bundles.gmk Thu Sep 28 09:13:27 2017 -0700
@@ -56,7 +56,7 @@
$$(eval $1_$$d_RELATIVE_FILES := $$$$(patsubst $$d/%, %, \
$$$$(filter $$d/%, $$$$($1_FILES)))) \
$$(eval $1_$$d_LIST_FILE := \
- $(SUPPORT_OUTPUTDIR)/bundles/_$1_$$$$(subst /,_,$$$$(patsubst $(OUTPUT_ROOT)/%,%,$$d)_files)) \
+ $(SUPPORT_OUTPUTDIR)/bundles/_$1_$$$$(subst /,_,$$$$(patsubst $(OUTPUTDIR)/%,%,$$d)_files)) \
)
ifneq ($$(filter %.tar.gz, $$($1_BUNDLE_NAME)), )
--- a/make/CopyImportModules.gmk Tue Sep 26 10:46:23 2017 +0530
+++ b/make/CopyImportModules.gmk Thu Sep 28 09:13:27 2017 -0700
@@ -62,10 +62,10 @@
FILES := $(filter %$(SHARED_LIBRARY_SUFFIX), $(call CacheFind, $(LIBS_DIR))), \
))
- # Use relative links if the import dir is inside the OUTPUT_ROOT, otherwise
+ # Use relative links if the import dir is inside the OUTPUTDIR, otherwise
# copy to avoid having automated systems following symlinks when deleting files,
# or risk invalidating the build output from external changes.
- ifeq ($(filter $(OUTPUT_ROOT)/%, $(LIBS_DIR)), )
+ ifeq ($(filter $(OUTPUTDIR)/%, $(LIBS_DIR)), )
LINK_MACRO := install-file
LOG_ACTION := Copying
else
--- a/make/CreateBuildJdkCopy.gmk Tue Sep 26 10:46:23 2017 +0530
+++ b/make/CreateBuildJdkCopy.gmk Thu Sep 28 09:13:27 2017 -0700
@@ -54,7 +54,7 @@
################################################################################
$(eval $(call SetupCopyFiles, COPY_SUPPORT_HEADERS, \
- SRC := $(BUILD_OUTPUT), \
+ SRC := $(OUTPUTDIR), \
DEST := $(BUILDJDK_OUTPUTDIR), \
FILES := $(call CacheFind, $(wildcard \
$(addprefix $(SUPPORT_OUTPUTDIR)/headers/, $(MODULES_TO_COPY)))), \
@@ -65,7 +65,7 @@
################################################################################
$(eval $(call SetupCopyFiles, COPY_JDK_LIB_FILES, \
- SRC := $(BUILD_OUTPUT), \
+ SRC := $(OUTPUTDIR), \
DEST := $(BUILDJDK_OUTPUTDIR), \
FILES := $(JDK_OUTPUTDIR)/lib/tzdb.dat, \
))
--- a/make/CreateJmods.gmk Tue Sep 26 10:46:23 2017 +0530
+++ b/make/CreateJmods.gmk Thu Sep 28 09:13:27 2017 -0700
@@ -130,7 +130,7 @@
# Create jmods in a temp dir and then move them into place to keep the
# module path in $(IMAGES_OUTPUTDIR)/jmods valid at all times.
$(JMODS_DIR)/$(MODULE).jmod: $(DEPS)
- $(call LogWarn, Creating $(patsubst $(OUTPUT_ROOT)/%, %, $@))
+ $(call LogWarn, Creating $(patsubst $(OUTPUTDIR)/%, %, $@))
$(call MakeDir, $(JMODS_DIR) $(JMODS_TEMPDIR))
$(RM) $@ $(JMODS_TEMPDIR)/$(notdir $@)
$(JMOD) create \
--- a/make/Docs.gmk Tue Sep 26 10:46:23 2017 +0530
+++ b/make/Docs.gmk Thu Sep 28 09:13:27 2017 -0700
@@ -532,7 +532,7 @@
# Optional target which bundles all generated javadocs into a zip archive.
JAVADOC_ZIP_NAME := jdk-$(VERSION_STRING)-docs.zip
-JAVADOC_ZIP_FILE := $(OUTPUT_ROOT)/bundles/$(JAVADOC_ZIP_NAME)
+JAVADOC_ZIP_FILE := $(OUTPUTDIR)/bundles/$(JAVADOC_ZIP_NAME)
$(eval $(call SetupZipArchive, BUILD_JAVADOC_ZIP, \
SRC := $(DOCS_OUTPUTDIR), \
--- a/make/GenerateLinkOptData.gmk Tue Sep 26 10:46:23 2017 +0530
+++ b/make/GenerateLinkOptData.gmk Thu Sep 28 09:13:27 2017 -0700
@@ -59,8 +59,8 @@
$(CLASSLIST_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXE_SUFFIX) $(CLASSLIST_JAR)
$(call MakeDir, $(LINK_OPT_DIR))
- $(call LogInfo, Generating $(patsubst $(OUTPUT_ROOT)/%, %, $@))
- $(call LogInfo, Generating $(patsubst $(OUTPUT_ROOT)/%, %, $(JLI_TRACE_FILE)))
+ $(call LogInfo, Generating $(patsubst $(OUTPUTDIR)/%, %, $@))
+ $(call LogInfo, Generating $(patsubst $(OUTPUTDIR)/%, %, $(JLI_TRACE_FILE)))
$(FIXPATH) $(INTERIM_IMAGE_DIR)/bin/java -XX:DumpLoadedClassList=$@ \
-Djava.lang.invoke.MethodHandle.TRACE_RESOLVE=true \
-cp $(SUPPORT_OUTPUTDIR)/classlist.jar \
--- a/make/Images.gmk Tue Sep 26 10:46:23 2017 +0530
+++ b/make/Images.gmk Thu Sep 28 09:13:27 2017 -0700
@@ -223,7 +223,6 @@
jstack.1 \
jstat.1 \
jstatd.1 \
- policytool.1 \
rmic.1 \
schemagen.1 \
serialver.1 \
@@ -248,38 +247,38 @@
endif
$(JRE_IMAGE_DIR)/man/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/%
- $(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
+ $(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%,%,$@))
$(install-file)
$(JDK_IMAGE_DIR)/man/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/%
- $(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
+ $(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%,%,$@))
$(install-file)
$(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
- $(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
+ $(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%,%,$@))
$(install-file)
$(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
- $(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
+ $(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%,%,$@))
$(install-file)
ifeq ($(OPENJDK_TARGET_OS), solaris)
$(JRE_IMAGE_DIR)/man/ja/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
- $(call LogInfo, Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@))
+ $(call LogInfo, Converting $(patsubst $(OUTPUTDIR)/%,%,$@))
$(install-file)
$(JDK_IMAGE_DIR)/man/ja/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
- $(call LogInfo, Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@))
+ $(call LogInfo, Converting $(patsubst $(OUTPUTDIR)/%,%,$@))
$(install-file)
endif
ifneq ($(findstring $(OPENJDK_TARGET_OS), linux macosx), )
$(JRE_IMAGE_DIR)/man/ja:
- $(call LogInfo, Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@))
+ $(call LogInfo, Creating $(patsubst $(OUTPUTDIR)/%,%,$@))
$(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
$(JDK_IMAGE_DIR)/man/ja:
- $(call LogInfo, Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@))
+ $(call LogInfo, Creating $(patsubst $(OUTPUTDIR)/%,%,$@))
$(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
endif
@@ -313,7 +312,7 @@
# src.zip
$(JDK_IMAGE_DIR)/lib/src.zip: $(SUPPORT_OUTPUTDIR)/src.zip
- $(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
+ $(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%,%,$@))
$(install-file)
JDK_TARGETS += $(JDK_IMAGE_DIR)/lib/src.zip
@@ -355,14 +354,14 @@
GCOV_FIND_EXPR := -type f -name "*.gcno"
$(eval $(call SetupCopyFiles,COPY_HOTSPOT_GCOV_GCNO, \
- SRC := $(OUTPUT_ROOT), \
+ SRC := $(OUTPUTDIR), \
DEST := $(SYMBOLS_IMAGE_DIR)/gcov, \
FILES := $(shell $(FIND) $(HOTSPOT_OUTPUTDIR) $(GCOV_FIND_EXPR))))
SYMBOLS_TARGETS += $(COPY_HOTSPOT_GCOV_GCNO)
$(eval $(call SetupCopyFiles,COPY_JDK_GCOV_GCNO, \
- SRC := $(OUTPUT_ROOT), \
+ SRC := $(OUTPUTDIR), \
DEST := $(SYMBOLS_IMAGE_DIR)/gcov, \
FILES := $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/native $(GCOV_FIND_EXPR))))
--- a/make/Init.gmk Tue Sep 26 10:46:23 2017 +0530
+++ b/make/Init.gmk Thu Sep 28 09:13:27 2017 -0700
@@ -265,7 +265,7 @@
else
$(ECHO) "Re-running configure using default settings"
endif
- ( cd $(OUTPUT_ROOT) && PATH="$(ORIGINAL_PATH)" \
+ ( cd $(OUTPUTDIR) && PATH="$(ORIGINAL_PATH)" \
$(BASH) $(CONFIGURE_CMD) $(CONFIGURE_COMMAND_LINE) )
##############################################################################
--- a/make/InitSupport.gmk Tue Sep 26 10:46:23 2017 +0530
+++ b/make/InitSupport.gmk Thu Sep 28 09:13:27 2017 -0700
@@ -349,8 +349,8 @@
include $(TOPDIR)/make/common/MakeBase.gmk
# Define basic logging setup
- BUILD_LOG := $(OUTPUT_ROOT)/build.log
- BUILD_PROFILE_LOG := $(OUTPUT_ROOT)/build-profile.log
+ BUILD_LOG := $(OUTPUTDIR)/build.log
+ BUILD_PROFILE_LOG := $(OUTPUTDIR)/build-profile.log
BUILD_LOG_PIPE := > >($(TEE) -a $(BUILD_LOG)) 2> >($(TEE) -a $(BUILD_LOG) >&2) && wait
@@ -383,7 +383,7 @@
# FAIL can be set to false to have the return value of compare be ignored.
define ParseCompareBuild
ifneq ($$(COMPARE_BUILD), )
- COMPARE_BUILD_OUTPUT_ROOT := $(TOPDIR)/build/compare-build/$(CONF_NAME)
+ COMPARE_BUILD_OUTPUTDIR := $(TOPDIR)/build/compare-build/$(CONF_NAME)
COMPARE_BUILD_FAIL := true
ifneq ($$(findstring :, $$(COMPARE_BUILD)), )
@@ -443,16 +443,16 @@
# Move the first build away temporarily
$(RM) -r $(TOPDIR)/build/.compare-build-temp
$(MKDIR) -p $(TOPDIR)/build/.compare-build-temp
- $(MV) $(OUTPUT_ROOT) $(TOPDIR)/build/.compare-build-temp
+ $(MV) $(OUTPUTDIR) $(TOPDIR)/build/.compare-build-temp
# Restore an old compare-build, or create a new compare-build directory.
- if test -d $(COMPARE_BUILD_OUTPUT_ROOT); then \
- $(MV) $(COMPARE_BUILD_OUTPUT_ROOT) $(OUTPUT_ROOT); \
+ if test -d $(COMPARE_BUILD_OUTPUTDIR); then \
+ $(MV) $(COMPARE_BUILD_OUTPUTDIR) $(OUTPUTDIR); \
else \
- $(MKDIR) -p $(OUTPUT_ROOT); \
+ $(MKDIR) -p $(OUTPUTDIR); \
fi
# Re-run configure with the same arguments (and possibly some additional),
# must be done after patching.
- ( cd $(OUTPUT_ROOT) && PATH="$(ORIGINAL_PATH)" \
+ ( cd $(OUTPUTDIR) && PATH="$(ORIGINAL_PATH)" \
$(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE) $(COMPARE_BUILD_CONF))
endef
@@ -462,8 +462,8 @@
$(if $(COMPARE_BUILD_PATCH), $(PATCH) -R -p1 < $(COMPARE_BUILD_PATCH))
# Move this build away and restore the original build
$(MKDIR) -p $(TOPDIR)/build/compare-build
- $(MV) $(OUTPUT_ROOT) $(COMPARE_BUILD_OUTPUT_ROOT)
- $(MV) $(TOPDIR)/build/.compare-build-temp/$(CONF_NAME) $(OUTPUT_ROOT)
+ $(MV) $(OUTPUTDIR) $(COMPARE_BUILD_OUTPUTDIR)
+ $(MV) $(TOPDIR)/build/.compare-build-temp/$(CONF_NAME) $(OUTPUTDIR)
$(RM) -r $(TOPDIR)/build/.compare-build-temp
endef
@@ -472,11 +472,11 @@
# Compare first and second build. Ignore any error code from compare.sh.
$(ECHO) "Comparing between comparison rebuild (this/new) and baseline (other/old)"
$(if $(COMPARE_BUILD_COMP_DIR), \
- +(cd $(COMPARE_BUILD_OUTPUT_ROOT) && ./compare.sh $(COMPARE_BUILD_COMP_OPTS) \
- -2dirs $(COMPARE_BUILD_OUTPUT_ROOT)/$(COMPARE_BUILD_COMP_DIR) \
- $(OUTPUT_ROOT)/$(COMPARE_BUILD_COMP_DIR) $(COMPARE_BUILD_IGNORE_RESULT)), \
- +(cd $(COMPARE_BUILD_OUTPUT_ROOT) && ./compare.sh $(COMPARE_BUILD_COMP_OPTS) \
- -o $(OUTPUT_ROOT) $(COMPARE_BUILD_IGNORE_RESULT)) \
+ +(cd $(COMPARE_BUILD_OUTPUTDIR) && ./compare.sh $(COMPARE_BUILD_COMP_OPTS) \
+ -2dirs $(COMPARE_BUILD_OUTPUTDIR)/$(COMPARE_BUILD_COMP_DIR) \
+ $(OUTPUTDIR)/$(COMPARE_BUILD_COMP_DIR) $(COMPARE_BUILD_IGNORE_RESULT)), \
+ +(cd $(COMPARE_BUILD_OUTPUTDIR) && ./compare.sh $(COMPARE_BUILD_COMP_OPTS) \
+ -o $(OUTPUTDIR) $(COMPARE_BUILD_IGNORE_RESULT)) \
)
endef
--- a/make/Jprt.gmk Tue Sep 26 10:46:23 2017 +0530
+++ b/make/Jprt.gmk Thu Sep 28 09:13:27 2017 -0700
@@ -94,7 +94,7 @@
# Just fake the main bundle to satisfy JPRT
jprt_bundle: $(JPRT_TARGET)
@$(call TargetEnter)
- $(MKDIR) -p $(BUILD_OUTPUT)/bundles
+ $(MKDIR) -p $(OUTPUTDIR)/bundles
$(CD) $(TOPDIR) && $(TAR) cf - README | $(GZIP) > \
$(JPRT_ARCHIVE_BUNDLE)
@$(call TargetExit)
--- a/make/MacBundles.gmk Tue Sep 26 10:46:23 2017 +0530
+++ b/make/MacBundles.gmk Thu Sep 28 09:13:27 2017 -0700
@@ -57,23 +57,23 @@
# Copy empty directories (jre/lib/applet).
$(JDK_MACOSX_CONTENTS_DIR)/Home/%: $(JDK_IMAGE_DIR)/%
- $(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
+ $(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%,%,$@))
$(MKDIR) -p $(@D)
if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi
$(JRE_MACOSX_CONTENTS_DIR)/Home/%: $(JRE_IMAGE_DIR)/%
- $(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
+ $(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%,%,$@))
$(MKDIR) -p $(@D)
if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi
$(JDK_MACOSX_CONTENTS_DIR)/MacOS/libjli.dylib:
- $(call LogInfo, Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@))
+ $(call LogInfo, Creating link $(patsubst $(OUTPUTDIR)/%,%,$@))
$(MKDIR) -p $(@D)
$(RM) $@
$(LN) -s ../Home/lib/jli/libjli.dylib $@
$(JRE_MACOSX_CONTENTS_DIR)/MacOS/libjli.dylib:
- $(call LogInfo, Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@))
+ $(call LogInfo, Creating link $(patsubst $(OUTPUTDIR)/%,%,$@))
$(MKDIR) -p $(@D)
$(RM) $@
$(LN) -s ../Home/lib/jli/libjli.dylib $@
--- a/make/Main.gmk Tue Sep 26 10:46:23 2017 +0530
+++ b/make/Main.gmk Thu Sep 28 09:13:27 2017 -0700
@@ -928,7 +928,7 @@
demos: demos-jdk
-# The "exploded image" is a locally runnable JDK in $(BUILD_OUTPUT)/jdk.
+# The "exploded image" is a locally runnable JDK in $(OUTPUTDIR)/jdk.
exploded-image-base: $(ALL_MODULES)
exploded-image: exploded-image-base release-file
# When cross compiling, no need to optimize the exploded image since it won't
@@ -957,7 +957,7 @@
mac-bundles: mac-bundles-jdk
-# The $(BUILD_OUTPUT)/images directory contain the resulting deliverables,
+# The $(OUTPUTDIR)/images directory contain the resulting deliverables,
# and in line with this, our targets for creating these are named *-image[s].
# This target builds the product images, e.g. the JRE and JDK image
@@ -1048,7 +1048,7 @@
# Remove everything, except the output from configure.
clean: $(CLEAN_DIR_TARGETS)
- ($(CD) $(OUTPUT_ROOT) && $(RM) -r build*.log*)
+ ($(CD) $(OUTPUTDIR) && $(RM) -r build*.log*)
$(ECHO) Cleaned all build artifacts.
clean-docs:
@@ -1081,14 +1081,14 @@
# Remove everything, including configure configuration. If the output
# directory was created by configure and now becomes empty, remove it as well.
dist-clean: clean
- ($(CD) $(OUTPUT_ROOT) && \
+ ($(CD) $(OUTPUTDIR) && \
$(RM) -r *spec.gmk $(CONFIGURESUPPORT_OUTPUTDIR) Makefile compare.sh ide)
- $(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \
- if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \
+ $(if $(filter $(CONF_NAME),$(notdir $(OUTPUTDIR))), \
+ if test "x`$(LS) $(OUTPUTDIR)`" != x; then \
$(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \
else \
($(CD) $(TOPDIR) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" \
- && $(RM) -r $(OUTPUT_ROOT)) \
+ && $(RM) -r $(OUTPUTDIR)) \
fi \
)
$(ECHO) Cleaned everything, you will have to re-run configure.
--- a/make/MainSupport.gmk Tue Sep 26 10:46:23 2017 +0530
+++ b/make/MainSupport.gmk Thu Sep 28 09:13:27 2017 -0700
@@ -36,7 +36,7 @@
($(CD) $(TOPDIR)/test && $(MAKE) $(MAKE_ARGS) -j1 -k MAKEFLAGS= \
JT_HOME=$(JT_HOME) PRODUCT_HOME=$(strip $2) \
TEST_IMAGE_DIR=$(TEST_IMAGE_DIR) \
- ALT_OUTPUTDIR=$(OUTPUT_ROOT) TEST_JOBS=$(TEST_JOBS) \
+ ALT_OUTPUTDIR=$(OUTPUTDIR) TEST_JOBS=$(TEST_JOBS) \
JT_JAVA=$(BOOT_JDK) JIB_JAR=$(JIB_JAR) \
JOBS=$(JOBS) $1) || true
endef
@@ -54,7 +54,7 @@
define CleanDir
@$(PRINTF) "Cleaning $(strip $1) build artifacts ..."
@$(PRINTF) "\n" $(LOG_DEBUG)
- ($(CD) $(OUTPUT_ROOT) && $(RM) -r $1)
+ ($(CD) $(OUTPUTDIR) && $(RM) -r $1)
@$(PRINTF) " done\n"
endef
--- a/make/ReleaseFile.gmk Tue Sep 26 10:46:23 2017 +0530
+++ b/make/ReleaseFile.gmk Thu Sep 28 09:13:27 2017 -0700
@@ -54,7 +54,7 @@
# Param 1 - The file containing the MODULES list
define prepare-info-file
- $(call LogInfo, Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@))
+ $(call LogInfo, Generating $(patsubst $(OUTPUTDIR)/%,%,$@))
$(call MakeDir, $(@D))
$(RM) $@
endef
--- a/make/RunTests.gmk Tue Sep 26 10:46:23 2017 +0530
+++ b/make/RunTests.gmk Thu Sep 28 09:13:27 2017 -0700
@@ -38,8 +38,8 @@
# Hook to include the corresponding custom file, if present.
$(eval $(call IncludeCustomExtension, , RunTests.gmk))
-TEST_RESULTS_DIR := $(BUILD_OUTPUT)/test-results
-TEST_SUPPORT_DIR := $(BUILD_OUTPUT)/test-support
+TEST_RESULTS_DIR := $(OUTPUTDIR)/test-results
+TEST_SUPPORT_DIR := $(OUTPUTDIR)/test-support
################################################################################
@@ -392,20 +392,27 @@
$$(call LogWarn, Finished running test '$$($1_TEST)')
$$(call LogWarn, Test report is stored in $$(strip \
$$(subst $$(TOPDIR)/, , $$($1_TEST_RESULTS_DIR))))
- $$(eval $1_PASSED := $$(shell $$(AWK) '{ gsub(/[,;]/, ""); \
- for (i=1; i<=NF; i++) { if ($$$$i == "passed:") \
- print $$$$(i+1) } }' $$($1_RESULT_FILE)))
- $$(if $$($1_PASSED), , $$(eval $1_PASSED := 0))
- $$(eval $1_FAILED := $$(shell $$(AWK) '{gsub(/[,;]/, ""); \
- for (i=1; i<=NF; i++) { if ($$$$i == "failed:") \
- print $$$$(i+1) } }' $$($1_RESULT_FILE)))
- $$(if $$($1_FAILED), , $$(eval $1_FAILED := 0))
- $$(eval $1_ERROR := $$(shell $$(AWK) '{gsub(/[,;]/, ""); \
- for (i=1; i<=NF; i++) { if ($$$$i == "error:") \
- print $$$$(i+1) } }' $$($1_RESULT_FILE)))
- $$(if $$($1_ERROR), , $$(eval $1_ERROR := 0))
- $$(eval $1_TOTAL := $$(shell \
- $$(EXPR) $$($1_PASSED) + $$($1_FAILED) + $$($1_ERROR)))
+ $$(if $$(wildcard $$($1_RESULT_FILE)), \
+ $$(eval $1_PASSED := $$(shell $$(AWK) '{ gsub(/[,;]/, ""); \
+ for (i=1; i<=NF; i++) { if ($$$$i == "passed:") \
+ print $$$$(i+1) } }' $$($1_RESULT_FILE))) \
+ $$(if $$($1_PASSED), , $$(eval $1_PASSED := 0)) \
+ $$(eval $1_FAILED := $$(shell $$(AWK) '{gsub(/[,;]/, ""); \
+ for (i=1; i<=NF; i++) { if ($$$$i == "failed:") \
+ print $$$$(i+1) } }' $$($1_RESULT_FILE))) \
+ $$(if $$($1_FAILED), , $$(eval $1_FAILED := 0)) \
+ $$(eval $1_ERROR := $$(shell $$(AWK) '{gsub(/[,;]/, ""); \
+ for (i=1; i<=NF; i++) { if ($$$$i == "error:") \
+ print $$$$(i+1) } }' $$($1_RESULT_FILE))) \
+ $$(if $$($1_ERROR), , $$(eval $1_ERROR := 0)) \
+ $$(eval $1_TOTAL := $$(shell \
+ $$(EXPR) $$($1_PASSED) + $$($1_FAILED) + $$($1_ERROR))) \
+ , \
+ $$(eval $1_PASSED := 0) \
+ $$(eval $1_FAILED := 0) \
+ $$(eval $1_ERROR := 1) \
+ $$(eval $1_TOTAL := 1) \
+ )
$1: run-test-$1 parse-test-$1
--- a/make/autoconf/Makefile.in Tue Sep 26 10:46:23 2017 +0530
+++ b/make/autoconf/Makefile.in Thu Sep 28 09:13:27 2017 -0700
@@ -23,5 +23,5 @@
# This Makefile was generated by configure @DATE_WHEN_CONFIGURED@
# GENERATED FILE, DO NOT EDIT
-SPEC:=@OUTPUT_ROOT@/spec.gmk
+SPEC:=@OUTPUTDIR@/spec.gmk
include @TOPDIR@/Makefile
--- a/make/autoconf/basics.m4 Tue Sep 26 10:46:23 2017 +0530
+++ b/make/autoconf/basics.m4 Thu Sep 28 09:13:27 2017 -0700
@@ -568,8 +568,6 @@
# We can only call BASIC_FIXUP_PATH after BASIC_CHECK_PATHS_WINDOWS.
BASIC_FIXUP_PATH(CURDIR)
BASIC_FIXUP_PATH(TOPDIR)
- # SRC_ROOT is a traditional alias for TOPDIR.
- SRC_ROOT=$TOPDIR
# Calculate a canonical version of TOPDIR for string comparisons
CANONICAL_TOPDIR=$TOPDIR
@@ -770,13 +768,13 @@
[ CONF_NAME=${with_conf_name} ])
AC_ARG_WITH(output-base-dir, [AS_HELP_STRING([--with-output-base-dir],
[override the default output base directory @<:@./build@:>@])],
- [ OUTPUT_BASE=${with_output_base_dir} ], [ OUTPUT_BASE="$SRC_ROOT/build" ] )
+ [ OUTPUT_BASE=${with_output_base_dir} ], [ OUTPUT_BASE="$TOPDIR/build" ] )
# Test from where we are running configure, in or outside of src root.
AC_MSG_CHECKING([where to store configuration])
- if test "x$CURDIR" = "x$SRC_ROOT" || test "x$CURDIR" = "x$SRC_ROOT/common" \
- || test "x$CURDIR" = "x$SRC_ROOT/make/autoconf" \
- || test "x$CURDIR" = "x$SRC_ROOT/make" ; then
+ if test "x$CURDIR" = "x$TOPDIR" || test "x$CURDIR" = "x$TOPDIR/common" \
+ || test "x$CURDIR" = "x$TOPDIR/make/autoconf" \
+ || test "x$CURDIR" = "x$TOPDIR/make" ; then
# We are running configure from the src root.
# Create a default ./build/target-variant-debuglevel output root.
if test "x${CONF_NAME}" = x; then
@@ -785,10 +783,10 @@
else
AC_MSG_RESULT([in build directory with custom name])
fi
- OUTPUT_ROOT="${OUTPUT_BASE}/${CONF_NAME}"
- $MKDIR -p "$OUTPUT_ROOT"
- if test ! -d "$OUTPUT_ROOT"; then
- AC_MSG_ERROR([Could not create build directory $OUTPUT_ROOT])
+ OUTPUTDIR="${OUTPUT_BASE}/${CONF_NAME}"
+ $MKDIR -p "$OUTPUTDIR"
+ if test ! -d "$OUTPUTDIR"; then
+ AC_MSG_ERROR([Could not create build directory $OUTPUTDIR])
fi
else
# We are running configure from outside of the src dir.
@@ -796,18 +794,18 @@
# If configuration is situated in normal build directory, just use the build
# directory name as configuration name, otherwise use the complete path.
if test "x${CONF_NAME}" = x; then
- CONF_NAME=`$ECHO $CURDIR | $SED -e "s!^${SRC_ROOT}/build/!!"`
+ CONF_NAME=`$ECHO $CURDIR | $SED -e "s!^${TOPDIR}/build/!!"`
fi
- OUTPUT_ROOT="$CURDIR"
+ OUTPUTDIR="$CURDIR"
AC_MSG_RESULT([in current directory])
# WARNING: This might be a bad thing to do. You need to be sure you want to
# have a configuration in this directory. Do some sanity checks!
- if test ! -e "$OUTPUT_ROOT/spec.gmk"; then
+ if test ! -e "$OUTPUTDIR/spec.gmk"; then
# If we have a spec.gmk, we have run here before and we are OK. Otherwise, check for
# other files
- files_present=`$LS $OUTPUT_ROOT`
+ files_present=`$LS $OUTPUTDIR`
# Configure has already touched config.log and confdefs.h in the current dir when this check
# is performed.
filtered_files=`$ECHO "$files_present" \
@@ -822,7 +820,7 @@
AC_MSG_NOTICE([(as opposed to creating a configuration in <src_root>/build/<conf-name>).])
AC_MSG_NOTICE([However, this directory is not empty. This is not allowed, since it could])
AC_MSG_NOTICE([seriously mess up just about everything.])
- AC_MSG_NOTICE([Try 'cd $SRC_ROOT' and restart configure])
+ AC_MSG_NOTICE([Try 'cd $TOPDIR' and restart configure])
AC_MSG_NOTICE([(or create a new empty directory and cd to it).])
AC_MSG_ERROR([Will not continue creating configuration in $CURDIR])
fi
@@ -831,29 +829,29 @@
AC_MSG_CHECKING([what configuration name to use])
AC_MSG_RESULT([$CONF_NAME])
- BASIC_FIXUP_PATH(OUTPUT_ROOT)
+ BASIC_FIXUP_PATH(OUTPUTDIR)
- CONFIGURESUPPORT_OUTPUTDIR="$OUTPUT_ROOT/configure-support"
+ CONFIGURESUPPORT_OUTPUTDIR="$OUTPUTDIR/configure-support"
$MKDIR -p "$CONFIGURESUPPORT_OUTPUTDIR"
- SPEC="$OUTPUT_ROOT/spec.gmk"
+ SPEC="$OUTPUTDIR/spec.gmk"
AC_SUBST(SPEC)
AC_SUBST(CONF_NAME)
- AC_SUBST(OUTPUT_ROOT)
+ AC_SUBST(OUTPUTDIR)
AC_SUBST(CONFIGURESUPPORT_OUTPUTDIR)
# The spec.gmk file contains all variables for the make system.
- AC_CONFIG_FILES([$OUTPUT_ROOT/spec.gmk:$AUTOCONF_DIR/spec.gmk.in])
+ AC_CONFIG_FILES([$OUTPUTDIR/spec.gmk:$AUTOCONF_DIR/spec.gmk.in])
# The bootcycle-spec.gmk file contains support for boot cycle builds.
- AC_CONFIG_FILES([$OUTPUT_ROOT/bootcycle-spec.gmk:$AUTOCONF_DIR/bootcycle-spec.gmk.in])
+ AC_CONFIG_FILES([$OUTPUTDIR/bootcycle-spec.gmk:$AUTOCONF_DIR/bootcycle-spec.gmk.in])
# The buildjdk-spec.gmk file contains support for building a buildjdk when cross compiling.
- AC_CONFIG_FILES([$OUTPUT_ROOT/buildjdk-spec.gmk:$AUTOCONF_DIR/buildjdk-spec.gmk.in])
+ AC_CONFIG_FILES([$OUTPUTDIR/buildjdk-spec.gmk:$AUTOCONF_DIR/buildjdk-spec.gmk.in])
# The compare.sh is used to compare the build output to other builds.
- AC_CONFIG_FILES([$OUTPUT_ROOT/compare.sh:$AUTOCONF_DIR/compare.sh.in])
+ AC_CONFIG_FILES([$OUTPUTDIR/compare.sh:$AUTOCONF_DIR/compare.sh.in])
# The generated Makefile knows where the spec.gmk is and where the source is.
- # You can run make from the OUTPUT_ROOT, or from the top-level Makefile
+ # You can run make from the OUTPUTDIR, or from the top-level Makefile
# which will look for generated configurations
- AC_CONFIG_FILES([$OUTPUT_ROOT/Makefile:$AUTOCONF_DIR/Makefile.in])
+ AC_CONFIG_FILES([$OUTPUTDIR/Makefile:$AUTOCONF_DIR/Makefile.in])
])
#%%% Simple tools %%%
@@ -1173,7 +1171,7 @@
AC_DEFUN_ONCE([BASIC_CHECK_SRC_PERMS],
[
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
- file_to_test="$SRC_ROOT/LICENSE"
+ file_to_test="$TOPDIR/LICENSE"
if test `$STAT -c '%a' "$file_to_test"` -lt 400; then
AC_MSG_ERROR([Bad file permissions on src files. This is usually caused by cloning the repositories with a non cygwin hg in a directory not created in cygwin.])
fi
@@ -1186,7 +1184,7 @@
BASIC_CHECK_LEFTOVER_OVERRIDDEN
AC_MSG_CHECKING([if build directory is on local disk])
- BASIC_CHECK_DIR_ON_LOCAL_DISK($OUTPUT_ROOT,
+ BASIC_CHECK_DIR_ON_LOCAL_DISK($OUTPUTDIR,
[OUTPUT_DIR_IS_LOCAL="yes"],
[OUTPUT_DIR_IS_LOCAL="no"])
AC_MSG_RESULT($OUTPUT_DIR_IS_LOCAL)
@@ -1198,7 +1196,7 @@
# Before generating output files, test if they exist. If they do, this is a reconfigure.
# Since we can't properly handle the dependencies for this, warn the user about the situation
- if test -e $OUTPUT_ROOT/spec.gmk; then
+ if test -e $OUTPUTDIR/spec.gmk; then
IS_RECONFIGURE=yes
else
IS_RECONFIGURE=no
@@ -1269,18 +1267,18 @@
fi
# Rotate our log file (configure.log)
- if test -e "$OUTPUT_ROOT/configure.log.old"; then
- $RM -f "$OUTPUT_ROOT/configure.log.old"
+ if test -e "$OUTPUTDIR/configure.log.old"; then
+ $RM -f "$OUTPUTDIR/configure.log.old"
fi
- if test -e "$OUTPUT_ROOT/configure.log"; then
- $MV -f "$OUTPUT_ROOT/configure.log" "$OUTPUT_ROOT/configure.log.old" 2> /dev/null
+ if test -e "$OUTPUTDIR/configure.log"; then
+ $MV -f "$OUTPUTDIR/configure.log" "$OUTPUTDIR/configure.log.old" 2> /dev/null
fi
# Move configure.log from current directory to the build output root
if test -e ./configure.log; then
- $MV -f ./configure.log "$OUTPUT_ROOT/configure.log" 2> /dev/null
+ $MV -f ./configure.log "$OUTPUTDIR/configure.log" 2> /dev/null
fi
# Make the compare script executable
- $CHMOD +x $OUTPUT_ROOT/compare.sh
+ $CHMOD +x $OUTPUTDIR/compare.sh
])
--- a/make/autoconf/basics_windows.m4 Tue Sep 26 10:46:23 2017 +0530
+++ b/make/autoconf/basics_windows.m4 Thu Sep 28 09:13:27 2017 -0700
@@ -382,7 +382,7 @@
FIXPATH=
if test "x$OPENJDK_BUILD_OS" = xwindows; then
AC_MSG_CHECKING([if fixpath can be created])
- FIXPATH_SRC="$SRC_ROOT/make/src/native/fixpath.c"
+ FIXPATH_SRC="$TOPDIR/make/src/native/fixpath.c"
FIXPATH_BIN="$CONFIGURESUPPORT_OUTPUTDIR/bin/fixpath.exe"
FIXPATH_DIR="$CONFIGURESUPPORT_OUTPUTDIR/fixpath"
if test "x$OPENJDK_BUILD_OS_ENV" = xwindows.cygwin; then
--- a/make/autoconf/boot-jdk.m4 Tue Sep 26 10:46:23 2017 +0530
+++ b/make/autoconf/boot-jdk.m4 Thu Sep 28 09:13:27 2017 -0700
@@ -77,10 +77,10 @@
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- [FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`]
+ [FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`]
if test "x$FOUND_CORRECT_VERSION" = x; then
AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring])
- AC_MSG_NOTICE([(Your Boot JDK must be version 8 or 9)])
+ AC_MSG_NOTICE([(Your Boot JDK must be version 8, 9 or 10)])
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -469,10 +469,10 @@
BUILD_JDK_VERSION=`"$BUILD_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- [FOUND_CORRECT_VERSION=`echo $BUILD_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"'`]
+ [FOUND_CORRECT_VERSION=`echo $BUILD_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"'`]
if test "x$FOUND_CORRECT_VERSION" = x; then
AC_MSG_NOTICE([Potential Build JDK found at $BUILD_JDK is incorrect JDK version ($BUILD_JDK_VERSION); ignoring])
- AC_MSG_NOTICE([(Your Build JDK must be version 9)])
+ AC_MSG_NOTICE([(Your Build JDK must be version 10)])
BUILD_JDK_FOUND=no
else
# We're done!
--- a/make/autoconf/bootcycle-spec.gmk.in Tue Sep 26 10:46:23 2017 +0530
+++ b/make/autoconf/bootcycle-spec.gmk.in Thu Sep 28 09:13:27 2017 -0700
@@ -48,9 +48,9 @@
BOOT_JDK := $(JDK_IMAGE_DIR)
# The bootcycle build has a different output directory
-OLD_BUILD_OUTPUT:=@BUILD_OUTPUT@
-BUILD_OUTPUT:=$(OLD_BUILD_OUTPUT)/bootcycle-build
-SJAVAC_SERVER_DIR:=$(patsubst $(OLD_BUILD_OUTPUT)%, $(BUILD_OUTPUT)%, $(SJAVAC_SERVER_DIR))
+OLD_OUTPUTDIR:=@OUTPUTDIR@
+OUTPUTDIR:=$(OLD_OUTPUTDIR)/bootcycle-build
+SJAVAC_SERVER_DIR:=$(patsubst $(OLD_OUTPUTDIR)%, $(OUTPUTDIR)%, $(SJAVAC_SERVER_DIR))
JAVA_CMD:=$(BOOT_JDK)/bin/java
JAVAC_CMD:=$(BOOT_JDK)/bin/javac
--- a/make/autoconf/buildjdk-spec.gmk.in Tue Sep 26 10:46:23 2017 +0530
+++ b/make/autoconf/buildjdk-spec.gmk.in Thu Sep 28 09:13:27 2017 -0700
@@ -43,10 +43,10 @@
SYSROOT_LDFLAGS := @BUILD_SYSROOT_LDFLAGS@
# These directories should not be moved to BUILDJDK_OUTPUTDIR
-HOTSPOT_OUTPUTDIR := $(patsubst $(BUILD_OUTPUT)%,$(BUILDJDK_OUTPUTDIR)%,$(HOTSPOT_OUTPUTDIR))
-SUPPORT_OUTPUTDIR := $(patsubst $(BUILD_OUTPUT)%,$(BUILDJDK_OUTPUTDIR)%,$(SUPPORT_OUTPUTDIR))
-JDK_OUTPUTDIR := $(patsubst $(BUILD_OUTPUT)%,$(BUILDJDK_OUTPUTDIR)%,$(JDK_OUTPUTDIR))
-IMAGES_OUTPUTDIR := $(patsubst $(BUILD_OUTPUT)%,$(BUILDJDK_OUTPUTDIR)%,$(IMAGES_OUTPUTDIR))
+HOTSPOT_OUTPUTDIR := $(patsubst $(OUTPUTDIR)%,$(BUILDJDK_OUTPUTDIR)%,$(HOTSPOT_OUTPUTDIR))
+SUPPORT_OUTPUTDIR := $(patsubst $(OUTPUTDIR)%,$(BUILDJDK_OUTPUTDIR)%,$(SUPPORT_OUTPUTDIR))
+JDK_OUTPUTDIR := $(patsubst $(OUTPUTDIR)%,$(BUILDJDK_OUTPUTDIR)%,$(JDK_OUTPUTDIR))
+IMAGES_OUTPUTDIR := $(patsubst $(OUTPUTDIR)%,$(BUILDJDK_OUTPUTDIR)%,$(IMAGES_OUTPUTDIR))
OPENJDK_BUILD_CPU_LEGACY := @OPENJDK_BUILD_CPU_LEGACY@
OPENJDK_BUILD_CPU_LEGACY_LIB := @OPENJDK_BUILD_CPU_LEGACY_LIB@
--- a/make/autoconf/compare.sh.in Tue Sep 26 10:46:23 2017 +0530
+++ b/make/autoconf/compare.sh.in Thu Sep 28 09:13:27 2017 -0700
@@ -69,15 +69,15 @@
export UNPACK200="@FIXPATH@ @BOOT_JDK@/bin/unpack200"
export UNARCHIVE="@UNZIP@ -q -o"
-export SRC_ROOT="@TOPDIR@"
-export OUTPUT_ROOT="@OUTPUT_ROOT@"
+export TOPDIR="@TOPDIR@"
+export OUTPUTDIR="@OUTPUTDIR@"
if [ "@COMPILE_TYPE@" != "cross" ]; then
- export JAVAP="@FIXPATH@ $OUTPUT_ROOT/jdk/bin/javap @JAVA_TOOL_FLAGS_SMALL@"
- export JIMAGE="@FIXPATH@ $OUTPUT_ROOT/jdk/bin/jimage"
+ export JAVAP="@FIXPATH@ $OUTPUTDIR/jdk/bin/javap @JAVA_TOOL_FLAGS_SMALL@"
+ export JIMAGE="@FIXPATH@ $OUTPUTDIR/jdk/bin/jimage"
elif [ "@CREATE_BUILDJDK@" = "true" ]; then
- export JAVAP="@FIXPATH@ $OUTPUT_ROOT/buildjdk/jdk/bin/javap @JAVA_TOOL_FLAGS_SMALL@"
- export JIMAGE="@FIXPATH@ $OUTPUT_ROOT/buildjdk/jdk/bin/jimage"
+ export JAVAP="@FIXPATH@ $OUTPUTDIR/buildjdk/jdk/bin/javap @JAVA_TOOL_FLAGS_SMALL@"
+ export JIMAGE="@FIXPATH@ $OUTPUTDIR/buildjdk/jdk/bin/jimage"
else
export JAVAP="@FIXPATH@ @BUILD_JDK@/bin/javap @JAVA_TOOL_FLAGS_SMALL@"
export JIMAGE="@FIXPATH@ @BUILD_JDK@/bin/jimage"
@@ -88,16 +88,16 @@
fi
# Now locate the main script and run it.
-REAL_COMPARE_SCRIPT="$SRC_ROOT/make/scripts/compare.sh"
+REAL_COMPARE_SCRIPT="$TOPDIR/make/scripts/compare.sh"
if [ ! -e "$REAL_COMPARE_SCRIPT" ]; then
echo "Error: Cannot locate compare script, it should have been in $REAL_COMPARE_SCRIPT"
exit 1
fi
# Rotate logs
-$RM $OUTPUT_ROOT/compare.log.old 2> /dev/null
-$MV $OUTPUT_ROOT/compare.log $OUTPUT_ROOT/compare.log.old 2> /dev/null
+$RM $OUTPUTDIR/compare.log.old 2> /dev/null
+$MV $OUTPUTDIR/compare.log $OUTPUTDIR/compare.log.old 2> /dev/null
export SCRIPT_DIR="$( cd "$( dirname "$0" )" > /dev/null && pwd )"
-$BASH $SRC_ROOT/make/scripts/logger.sh $OUTPUT_ROOT/compare.log $BASH "$REAL_COMPARE_SCRIPT" "$@"
+$BASH $TOPDIR/make/scripts/logger.sh $OUTPUTDIR/compare.log $BASH "$REAL_COMPARE_SCRIPT" "$@"
--- a/make/autoconf/flags.m4 Tue Sep 26 10:46:23 2017 +0530
+++ b/make/autoconf/flags.m4 Thu Sep 28 09:13:27 2017 -0700
@@ -1311,9 +1311,10 @@
$2LDFLAGS_JDKLIB="${$2LDFLAGS_JDK}"
$2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} ${SHARED_LIBRARY_FLAGS}"
+ $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} ${LDFLAGS_NO_EXEC_STACK}"
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
$2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} \
- -libpath:${OUTPUT_ROOT}/support/modules_libs/java.base"
+ -libpath:${OUTPUTDIR}/support/modules_libs/java.base"
$2JDKLIB_LIBS=""
else
$2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} \
@@ -1388,6 +1389,7 @@
AC_SUBST($2JDKEXE_LIBS)
AC_SUBST($2LDFLAGS_CXX_JDK)
AC_SUBST($2LDFLAGS_HASH_STYLE)
+ AC_SUBST($2LDFLAGS_NO_EXEC_STACK)
AC_SUBST($2JVM_CFLAGS)
AC_SUBST($2JVM_LDFLAGS)
--- a/make/autoconf/generated-configure.sh Tue Sep 26 10:46:23 2017 +0530
+++ b/make/autoconf/generated-configure.sh Thu Sep 28 09:13:27 2017 -0700
@@ -723,6 +723,7 @@
OPENJDK_BUILD_JVM_ASFLAGS
OPENJDK_BUILD_JVM_LDFLAGS
OPENJDK_BUILD_JVM_CFLAGS
+OPENJDK_BUILD_LDFLAGS_NO_EXEC_STACK
OPENJDK_BUILD_LDFLAGS_HASH_STYLE
OPENJDK_BUILD_LDFLAGS_CXX_JDK
OPENJDK_BUILD_JDKEXE_LIBS
@@ -738,6 +739,7 @@
JVM_ASFLAGS
JVM_LDFLAGS
JVM_CFLAGS
+LDFLAGS_NO_EXEC_STACK
LDFLAGS_HASH_STYLE
LDFLAGS_CXX_JDK
JDKEXE_LIBS
@@ -870,13 +872,6 @@
IMPORT_MODULES_LIBS
IMPORT_MODULES_CMDS
IMPORT_MODULES_CLASSES
-BUILD_OUTPUT
-NASHORN_TOPDIR
-HOTSPOT_TOPDIR
-JAXWS_TOPDIR
-JAXP_TOPDIR
-CORBA_TOPDIR
-LANGTOOLS_TOPDIR
EXTERNAL_BUILDJDK
BUILD_JDK
CREATE_BUILDJDK
@@ -958,7 +953,7 @@
MAKE
PKGHANDLER
CONFIGURESUPPORT_OUTPUTDIR
-OUTPUT_ROOT
+OUTPUTDIR
CONF_NAME
SPEC
SDKROOT
@@ -1162,17 +1157,6 @@
with_version_patch
with_boot_jdk
with_build_jdk
-with_add_source_root
-with_override_source_root
-with_adds_and_overrides
-with_override_langtools
-with_override_corba
-with_override_jaxp
-with_override_jaxws
-with_override_hotspot
-with_override_nashorn
-with_override_jdk
-with_import_hotspot
with_import_modules
enable_static_build
with_toolchain_type
@@ -2093,31 +2077,6 @@
--with-boot-jdk path to Boot JDK (used to bootstrap build) [probed]
--with-build-jdk path to JDK of same version as is being built[the
newly built JDK]
- --with-add-source-root Deprecated. Option is kept for backwards
- compatibility and is ignored
- --with-override-source-root
- Deprecated. Option is kept for backwards
- compatibility and is ignored
- --with-adds-and-overrides
- Deprecated. Option is kept for backwards
- compatibility and is ignored
- --with-override-langtools
- Deprecated. Option is kept for backwards
- compatibility and is ignored
- --with-override-corba Deprecated. Option is kept for backwards
- compatibility and is ignored
- --with-override-jaxp Deprecated. Option is kept for backwards
- compatibility and is ignored
- --with-override-jaxws Deprecated. Option is kept for backwards
- compatibility and is ignored
- --with-override-hotspot Deprecated. Option is kept for backwards
- compatibility and is ignored
- --with-override-nashorn Deprecated. Option is kept for backwards
- compatibility and is ignored
- --with-override-jdk Deprecated. Option is kept for backwards
- compatibility and is ignored
- --with-import_hotspot Deprecated. Option is kept for backwards
- compatibility and is ignored
--with-import-modules import a set of prebuilt modules either as a zip
file or an exploded directory
--with-toolchain-type the toolchain type (or family) to use, use '--help'
@@ -4890,7 +4849,7 @@
#
-# Copyright (c) 2011, 2016, 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
@@ -4916,10 +4875,6 @@
-
-
-
-
################################################################################
# Define a mechanism for importing extra prebuilt modules
#
@@ -5162,7 +5117,7 @@
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1505235832
+DATE_WHEN_GENERATED=1506397140
###############################################################################
#
@@ -16850,8 +16805,6 @@
fi
fi
- # SRC_ROOT is a traditional alias for TOPDIR.
- SRC_ROOT=$TOPDIR
# Calculate a canonical version of TOPDIR for string comparisons
CANONICAL_TOPDIR=$TOPDIR
@@ -17605,16 +17558,16 @@
if test "${with_output_base_dir+set}" = set; then :
withval=$with_output_base_dir; OUTPUT_BASE=${with_output_base_dir}
else
- OUTPUT_BASE="$SRC_ROOT/build"
+ OUTPUT_BASE="$TOPDIR/build"
fi
# Test from where we are running configure, in or outside of src root.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking where to store configuration" >&5
$as_echo_n "checking where to store configuration... " >&6; }
- if test "x$CURDIR" = "x$SRC_ROOT" || test "x$CURDIR" = "x$SRC_ROOT/common" \
- || test "x$CURDIR" = "x$SRC_ROOT/make/autoconf" \
- || test "x$CURDIR" = "x$SRC_ROOT/make" ; then
+ if test "x$CURDIR" = "x$TOPDIR" || test "x$CURDIR" = "x$TOPDIR/common" \
+ || test "x$CURDIR" = "x$TOPDIR/make/autoconf" \
+ || test "x$CURDIR" = "x$TOPDIR/make" ; then
# We are running configure from the src root.
# Create a default ./build/target-variant-debuglevel output root.
if test "x${CONF_NAME}" = x; then
@@ -17625,10 +17578,10 @@
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: in build directory with custom name" >&5
$as_echo "in build directory with custom name" >&6; }
fi
- OUTPUT_ROOT="${OUTPUT_BASE}/${CONF_NAME}"
- $MKDIR -p "$OUTPUT_ROOT"
- if test ! -d "$OUTPUT_ROOT"; then
- as_fn_error $? "Could not create build directory $OUTPUT_ROOT" "$LINENO" 5
+ OUTPUTDIR="${OUTPUT_BASE}/${CONF_NAME}"
+ $MKDIR -p "$OUTPUTDIR"
+ if test ! -d "$OUTPUTDIR"; then
+ as_fn_error $? "Could not create build directory $OUTPUTDIR" "$LINENO" 5
fi
else
# We are running configure from outside of the src dir.
@@ -17636,19 +17589,19 @@
# If configuration is situated in normal build directory, just use the build
# directory name as configuration name, otherwise use the complete path.
if test "x${CONF_NAME}" = x; then
- CONF_NAME=`$ECHO $CURDIR | $SED -e "s!^${SRC_ROOT}/build/!!"`
- fi
- OUTPUT_ROOT="$CURDIR"
+ CONF_NAME=`$ECHO $CURDIR | $SED -e "s!^${TOPDIR}/build/!!"`
+ fi
+ OUTPUTDIR="$CURDIR"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: in current directory" >&5
$as_echo "in current directory" >&6; }
# WARNING: This might be a bad thing to do. You need to be sure you want to
# have a configuration in this directory. Do some sanity checks!
- if test ! -e "$OUTPUT_ROOT/spec.gmk"; then
+ if test ! -e "$OUTPUTDIR/spec.gmk"; then
# If we have a spec.gmk, we have run here before and we are OK. Otherwise, check for
# other files
- files_present=`$LS $OUTPUT_ROOT`
+ files_present=`$LS $OUTPUTDIR`
# Configure has already touched config.log and confdefs.h in the current dir when this check
# is performed.
filtered_files=`$ECHO "$files_present" \
@@ -17668,8 +17621,8 @@
$as_echo "$as_me: However, this directory is not empty. This is not allowed, since it could" >&6;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: seriously mess up just about everything." >&5
$as_echo "$as_me: seriously mess up just about everything." >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: Try 'cd $SRC_ROOT' and restart configure" >&5
-$as_echo "$as_me: Try 'cd $SRC_ROOT' and restart configure" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Try 'cd $TOPDIR' and restart configure" >&5
+$as_echo "$as_me: Try 'cd $TOPDIR' and restart configure" >&6;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: (or create a new empty directory and cd to it)." >&5
$as_echo "$as_me: (or create a new empty directory and cd to it)." >&6;}
as_fn_error $? "Will not continue creating configuration in $CURDIR" "$LINENO" 5
@@ -17684,161 +17637,161 @@
# Only process if variable expands to non-empty
- if test "x$OUTPUT_ROOT" != x; then
- if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
-
- # Input might be given as Windows format, start by converting to
- # unix format.
- path="$OUTPUT_ROOT"
- new_path=`$CYGPATH -u "$path"`
-
- # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
- # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
- # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
- # "foo.exe" is OK but "foo" is an error.
- #
- # This test is therefore slightly more accurate than "test -f" to check for file precense.
- # It is also a way to make sure we got the proper file name for the real test later on.
- test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
- if test "x$test_shortpath" = x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: The path of OUTPUT_ROOT, which resolves as \"$path\", is invalid." >&5
-$as_echo "$as_me: The path of OUTPUT_ROOT, which resolves as \"$path\", is invalid." >&6;}
- as_fn_error $? "Cannot locate the the path of OUTPUT_ROOT" "$LINENO" 5
- fi
-
- # Call helper function which possibly converts this using DOS-style short mode.
- # If so, the updated path is stored in $new_path.
-
- input_path="$new_path"
- # Check if we need to convert this using DOS-style short mode. If the path
- # contains just simple characters, use it. Otherwise (spaces, weird characters),
- # take no chances and rewrite it.
- # Note: m4 eats our [], so we need to use [ and ] instead.
- has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
- if test "x$has_forbidden_chars" != x; then
- # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
- shortmode_path=`$CYGPATH -s -m -a "$input_path"`
- path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
- if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
- # Going to short mode and back again did indeed matter. Since short mode is
- # case insensitive, let's make it lowercase to improve readability.
- shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- # Now convert it back to Unix-style (cygpath)
- input_path=`$CYGPATH -u "$shortmode_path"`
- new_path="$input_path"
- fi
- fi
-
- test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
- if test "x$test_cygdrive_prefix" = x; then
- # As a simple fix, exclude /usr/bin since it's not a real path.
- if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
- # The path is in a Cygwin special directory (e.g. /home). We need this converted to
- # a path prefixed by /cygdrive for fixpath to work.
- new_path="$CYGWIN_ROOT_PATH$input_path"
- fi
- fi
-
-
- if test "x$path" != "x$new_path"; then
- OUTPUT_ROOT="$new_path"
- { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting OUTPUT_ROOT to \"$new_path\"" >&5
-$as_echo "$as_me: Rewriting OUTPUT_ROOT to \"$new_path\"" >&6;}
- fi
-
- elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
-
- path="$OUTPUT_ROOT"
- has_colon=`$ECHO $path | $GREP ^.:`
- new_path="$path"
- if test "x$has_colon" = x; then
- # Not in mixed or Windows style, start by that.
- new_path=`cmd //c echo $path`
- fi
-
-
- input_path="$new_path"
- # Check if we need to convert this using DOS-style short mode. If the path
- # contains just simple characters, use it. Otherwise (spaces, weird characters),
- # take no chances and rewrite it.
- # Note: m4 eats our [], so we need to use [ and ] instead.
- has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
- if test "x$has_forbidden_chars" != x; then
- # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
- new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- fi
-
-
- windows_path="$new_path"
- if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
- unix_path=`$CYGPATH -u "$windows_path"`
- new_path="$unix_path"
- elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
- unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
- new_path="$unix_path"
- fi
-
- if test "x$path" != "x$new_path"; then
- OUTPUT_ROOT="$new_path"
- { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting OUTPUT_ROOT to \"$new_path\"" >&5
-$as_echo "$as_me: Rewriting OUTPUT_ROOT to \"$new_path\"" >&6;}
- fi
-
- # Save the first 10 bytes of this path to the storage, so fixpath can work.
- all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
-
- else
- # We're on a unix platform. Hooray! :)
- path="$OUTPUT_ROOT"
- has_space=`$ECHO "$path" | $GREP " "`
- if test "x$has_space" != x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: The path of OUTPUT_ROOT, which resolves as \"$path\", is invalid." >&5
-$as_echo "$as_me: The path of OUTPUT_ROOT, which resolves as \"$path\", is invalid." >&6;}
- as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
- fi
-
- # Use eval to expand a potential ~
- eval path="$path"
- if test ! -f "$path" && test ! -d "$path"; then
- as_fn_error $? "The path of OUTPUT_ROOT, which resolves as \"$path\", is not found." "$LINENO" 5
- fi
-
- if test -d "$path"; then
- OUTPUT_ROOT="`cd "$path"; $THEPWDCMD -L`"
- else
- dir="`$DIRNAME "$path"`"
- base="`$BASENAME "$path"`"
- OUTPUT_ROOT="`cd "$dir"; $THEPWDCMD -L`/$base"
- fi
- fi
- fi
-
-
- CONFIGURESUPPORT_OUTPUTDIR="$OUTPUT_ROOT/configure-support"
+ if test "x$OUTPUTDIR" != x; then
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+ # Input might be given as Windows format, start by converting to
+ # unix format.
+ path="$OUTPUTDIR"
+ new_path=`$CYGPATH -u "$path"`
+
+ # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+ # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+ # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+ # "foo.exe" is OK but "foo" is an error.
+ #
+ # This test is therefore slightly more accurate than "test -f" to check for file precense.
+ # It is also a way to make sure we got the proper file name for the real test later on.
+ test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+ if test "x$test_shortpath" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of OUTPUTDIR, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of OUTPUTDIR, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Cannot locate the the path of OUTPUTDIR" "$LINENO" 5
+ fi
+
+ # Call helper function which possibly converts this using DOS-style short mode.
+ # If so, the updated path is stored in $new_path.
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+ path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+ if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+ # Going to short mode and back again did indeed matter. Since short mode is
+ # case insensitive, let's make it lowercase to improve readability.
+ shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ # Now convert it back to Unix-style (cygpath)
+ input_path=`$CYGPATH -u "$shortmode_path"`
+ new_path="$input_path"
+ fi
+ fi
+
+ test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+ if test "x$test_cygdrive_prefix" = x; then
+ # As a simple fix, exclude /usr/bin since it's not a real path.
+ if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+ # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+ # a path prefixed by /cygdrive for fixpath to work.
+ new_path="$CYGWIN_ROOT_PATH$input_path"
+ fi
+ fi
+
+
+ if test "x$path" != "x$new_path"; then
+ OUTPUTDIR="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting OUTPUTDIR to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting OUTPUTDIR to \"$new_path\"" >&6;}
+ fi
+
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+ path="$OUTPUTDIR"
+ has_colon=`$ECHO $path | $GREP ^.:`
+ new_path="$path"
+ if test "x$has_colon" = x; then
+ # Not in mixed or Windows style, start by that.
+ new_path=`cmd //c echo $path`
+ fi
+
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ fi
+
+
+ windows_path="$new_path"
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ unix_path=`$CYGPATH -u "$windows_path"`
+ new_path="$unix_path"
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+ new_path="$unix_path"
+ fi
+
+ if test "x$path" != "x$new_path"; then
+ OUTPUTDIR="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting OUTPUTDIR to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting OUTPUTDIR to \"$new_path\"" >&6;}
+ fi
+
+ # Save the first 10 bytes of this path to the storage, so fixpath can work.
+ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+ else
+ # We're on a unix platform. Hooray! :)
+ path="$OUTPUTDIR"
+ has_space=`$ECHO "$path" | $GREP " "`
+ if test "x$has_space" != x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of OUTPUTDIR, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of OUTPUTDIR, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+ fi
+
+ # Use eval to expand a potential ~
+ eval path="$path"
+ if test ! -f "$path" && test ! -d "$path"; then
+ as_fn_error $? "The path of OUTPUTDIR, which resolves as \"$path\", is not found." "$LINENO" 5
+ fi
+
+ if test -d "$path"; then
+ OUTPUTDIR="`cd "$path"; $THEPWDCMD -L`"
+ else
+ dir="`$DIRNAME "$path"`"
+ base="`$BASENAME "$path"`"
+ OUTPUTDIR="`cd "$dir"; $THEPWDCMD -L`/$base"
+ fi
+ fi
+ fi
+
+
+ CONFIGURESUPPORT_OUTPUTDIR="$OUTPUTDIR/configure-support"
$MKDIR -p "$CONFIGURESUPPORT_OUTPUTDIR"
- SPEC="$OUTPUT_ROOT/spec.gmk"
+ SPEC="$OUTPUTDIR/spec.gmk"
# The spec.gmk file contains all variables for the make system.
- ac_config_files="$ac_config_files $OUTPUT_ROOT/spec.gmk:$AUTOCONF_DIR/spec.gmk.in"
+ ac_config_files="$ac_config_files $OUTPUTDIR/spec.gmk:$AUTOCONF_DIR/spec.gmk.in"
# The bootcycle-spec.gmk file contains support for boot cycle builds.
- ac_config_files="$ac_config_files $OUTPUT_ROOT/bootcycle-spec.gmk:$AUTOCONF_DIR/bootcycle-spec.gmk.in"
+ ac_config_files="$ac_config_files $OUTPUTDIR/bootcycle-spec.gmk:$AUTOCONF_DIR/bootcycle-spec.gmk.in"
# The buildjdk-spec.gmk file contains support for building a buildjdk when cross compiling.
- ac_config_files="$ac_config_files $OUTPUT_ROOT/buildjdk-spec.gmk:$AUTOCONF_DIR/buildjdk-spec.gmk.in"
+ ac_config_files="$ac_config_files $OUTPUTDIR/buildjdk-spec.gmk:$AUTOCONF_DIR/buildjdk-spec.gmk.in"
# The compare.sh is used to compare the build output to other builds.
- ac_config_files="$ac_config_files $OUTPUT_ROOT/compare.sh:$AUTOCONF_DIR/compare.sh.in"
+ ac_config_files="$ac_config_files $OUTPUTDIR/compare.sh:$AUTOCONF_DIR/compare.sh.in"
# The generated Makefile knows where the spec.gmk is and where the source is.
- # You can run make from the OUTPUT_ROOT, or from the top-level Makefile
+ # You can run make from the OUTPUTDIR, or from the top-level Makefile
# which will look for generated configurations
- ac_config_files="$ac_config_files $OUTPUT_ROOT/Makefile:$AUTOCONF_DIR/Makefile.in"
+ ac_config_files="$ac_config_files $OUTPUTDIR/Makefile:$AUTOCONF_DIR/Makefile.in"
@@ -25129,8 +25082,20 @@
withval=$with_cacerts_file;
fi
- if test "x$with_cacerts_file" != x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cacerts file" >&5
+$as_echo_n "checking for cacerts file... " >&6; }
+ if test "x$with_cacerts_file" == x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: default" >&5
+$as_echo "default" >&6; }
+ else
CACERTS_FILE=$with_cacerts_file
+ if test ! -f "$CACERTS_FILE"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: fail" >&5
+$as_echo "fail" >&6; }
+ as_fn_error $? "Specified cacerts file \"$CACERTS_FILE\" does not exist" "$LINENO" 5
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CACERTS_FILE" >&5
+$as_echo "$CACERTS_FILE" >&6; }
fi
@@ -25700,12 +25665,12 @@
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -25902,12 +25867,12 @@
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -26092,12 +26057,12 @@
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -26281,12 +26246,12 @@
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -26470,12 +26435,12 @@
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -26650,12 +26615,12 @@
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -26981,12 +26946,12 @@
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -27312,12 +27277,12 @@
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -27530,12 +27495,12 @@
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -27713,12 +27678,12 @@
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -27924,12 +27889,12 @@
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -28107,12 +28072,12 @@
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -28318,12 +28283,12 @@
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -28501,12 +28466,12 @@
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -28712,12 +28677,12 @@
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -28895,12 +28860,12 @@
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -29093,12 +29058,12 @@
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -29274,12 +29239,12 @@
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -29473,12 +29438,12 @@
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -29654,12 +29619,12 @@
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -29852,12 +29817,12 @@
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -30033,12 +29998,12 @@
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -30232,12 +30197,12 @@
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -30413,12 +30378,12 @@
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -30593,12 +30558,12 @@
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
BOOT_JDK_FOUND=no
else
# We're done! :-)
@@ -31568,12 +31533,12 @@
BUILD_JDK_VERSION=`"$BUILD_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
- FOUND_CORRECT_VERSION=`echo $BUILD_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"'`
+ FOUND_CORRECT_VERSION=`echo $BUILD_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"'`
if test "x$FOUND_CORRECT_VERSION" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Potential Build JDK found at $BUILD_JDK is incorrect JDK version ($BUILD_JDK_VERSION); ignoring" >&5
$as_echo "$as_me: Potential Build JDK found at $BUILD_JDK is incorrect JDK version ($BUILD_JDK_VERSION); ignoring" >&6;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Build JDK must be version 9)" >&5
-$as_echo "$as_me: (Your Build JDK must be version 9)" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Build JDK must be version 10)" >&5
+$as_echo "$as_me: (Your Build JDK must be version 10)" >&6;}
BUILD_JDK_FOUND=no
else
# We're done!
@@ -31769,130 +31734,11 @@
###############################################################################
+ OUTPUTDIR="$OUTPUTDIR"
+
+ JDK_OUTPUTDIR="$OUTPUTDIR/jdk"
+
# Where are the sources.
- LANGTOOLS_TOPDIR="$SRC_ROOT/langtools"
- CORBA_TOPDIR="$SRC_ROOT/corba"
- JAXP_TOPDIR="$SRC_ROOT/jaxp"
- JAXWS_TOPDIR="$SRC_ROOT/jaxws"
- HOTSPOT_TOPDIR="$SRC_ROOT/hotspot"
- NASHORN_TOPDIR="$SRC_ROOT/nashorn"
- JDK_TOPDIR="$SRC_ROOT/jdk"
-
-
-
-
-
-
-
-
-
- # This feature is no longer supported.
-
-
-
-# Check whether --with-add-source-root was given.
-if test "${with_add_source_root+set}" = set; then :
- withval=$with_add_source_root; { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Option --with-add-source-root is deprecated and will be ignored." >&5
-$as_echo "$as_me: WARNING: Option --with-add-source-root is deprecated and will be ignored." >&2;}
-fi
-
-
-
-
-# Check whether --with-override-source-root was given.
-if test "${with_override_source_root+set}" = set; then :
- withval=$with_override_source_root; { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Option --with-override-source-root is deprecated and will be ignored." >&5
-$as_echo "$as_me: WARNING: Option --with-override-source-root is deprecated and will be ignored." >&2;}
-fi
-
-
-
-
-# Check whether --with-adds-and-overrides was given.
-if test "${with_adds_and_overrides+set}" = set; then :
- withval=$with_adds_and_overrides; { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Option --with-adds-and-overrides is deprecated and will be ignored." >&5
-$as_echo "$as_me: WARNING: Option --with-adds-and-overrides is deprecated and will be ignored." >&2;}
-fi
-
-
-
-
-# Check whether --with-override-langtools was given.
-if test "${with_override_langtools+set}" = set; then :
- withval=$with_override_langtools; { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Option --with-override-langtools is deprecated and will be ignored." >&5
-$as_echo "$as_me: WARNING: Option --with-override-langtools is deprecated and will be ignored." >&2;}
-fi
-
-
-
-
-# Check whether --with-override-corba was given.
-if test "${with_override_corba+set}" = set; then :
- withval=$with_override_corba; { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Option --with-override-corba is deprecated and will be ignored." >&5
-$as_echo "$as_me: WARNING: Option --with-override-corba is deprecated and will be ignored." >&2;}
-fi
-
-
-
-
-# Check whether --with-override-jaxp was given.
-if test "${with_override_jaxp+set}" = set; then :
- withval=$with_override_jaxp; { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Option --with-override-jaxp is deprecated and will be ignored." >&5
-$as_echo "$as_me: WARNING: Option --with-override-jaxp is deprecated and will be ignored." >&2;}
-fi
-
-
-
-
-# Check whether --with-override-jaxws was given.
-if test "${with_override_jaxws+set}" = set; then :
- withval=$with_override_jaxws; { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Option --with-override-jaxws is deprecated and will be ignored." >&5
-$as_echo "$as_me: WARNING: Option --with-override-jaxws is deprecated and will be ignored." >&2;}
-fi
-
-
-
-
-# Check whether --with-override-hotspot was given.
-if test "${with_override_hotspot+set}" = set; then :
- withval=$with_override_hotspot; { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Option --with-override-hotspot is deprecated and will be ignored." >&5
-$as_echo "$as_me: WARNING: Option --with-override-hotspot is deprecated and will be ignored." >&2;}
-fi
-
-
-
-
-# Check whether --with-override-nashorn was given.
-if test "${with_override_nashorn+set}" = set; then :
- withval=$with_override_nashorn; { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Option --with-override-nashorn is deprecated and will be ignored." >&5
-$as_echo "$as_me: WARNING: Option --with-override-nashorn is deprecated and will be ignored." >&2;}
-fi
-
-
-
-
-# Check whether --with-override-jdk was given.
-if test "${with_override_jdk+set}" = set; then :
- withval=$with_override_jdk; { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Option --with-override-jdk is deprecated and will be ignored." >&5
-$as_echo "$as_me: WARNING: Option --with-override-jdk is deprecated and will be ignored." >&2;}
-fi
-
-
-
-
- BUILD_OUTPUT="$OUTPUT_ROOT"
-
- JDK_OUTPUTDIR="$OUTPUT_ROOT/jdk"
-
-
-
-# Check whether --with-import_hotspot was given.
-if test "${with_import_hotspot+set}" = set; then :
- withval=$with_import_hotspot; { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Option --with-import_hotspot is deprecated and will be ignored." >&5
-$as_echo "$as_me: WARNING: Option --with-import_hotspot is deprecated and will be ignored." >&2;}
-fi
-
-
@@ -48915,6 +48761,138 @@
elif test "x$with_jtreg" != xyes && test "x$with_jtreg" != x; then
# An explicit path is specified, use it.
JT_HOME="$with_jtreg"
+
+ # Only process if variable expands to non-empty
+
+ if test "x$JT_HOME" != x; then
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+ # Input might be given as Windows format, start by converting to
+ # unix format.
+ path="$JT_HOME"
+ new_path=`$CYGPATH -u "$path"`
+
+ # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+ # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+ # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+ # "foo.exe" is OK but "foo" is an error.
+ #
+ # This test is therefore slightly more accurate than "test -f" to check for file precense.
+ # It is also a way to make sure we got the proper file name for the real test later on.
+ test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+ if test "x$test_shortpath" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of JT_HOME, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of JT_HOME, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Cannot locate the the path of JT_HOME" "$LINENO" 5
+ fi
+
+ # Call helper function which possibly converts this using DOS-style short mode.
+ # If so, the updated path is stored in $new_path.
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+ path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+ if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+ # Going to short mode and back again did indeed matter. Since short mode is
+ # case insensitive, let's make it lowercase to improve readability.
+ shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ # Now convert it back to Unix-style (cygpath)
+ input_path=`$CYGPATH -u "$shortmode_path"`
+ new_path="$input_path"
+ fi
+ fi
+
+ test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+ if test "x$test_cygdrive_prefix" = x; then
+ # As a simple fix, exclude /usr/bin since it's not a real path.
+ if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+ # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+ # a path prefixed by /cygdrive for fixpath to work.
+ new_path="$CYGWIN_ROOT_PATH$input_path"
+ fi
+ fi
+
+
+ if test "x$path" != "x$new_path"; then
+ JT_HOME="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting JT_HOME to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting JT_HOME to \"$new_path\"" >&6;}
+ fi
+
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+ path="$JT_HOME"
+ has_colon=`$ECHO $path | $GREP ^.:`
+ new_path="$path"
+ if test "x$has_colon" = x; then
+ # Not in mixed or Windows style, start by that.
+ new_path=`cmd //c echo $path`
+ fi
+
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ fi
+
+
+ windows_path="$new_path"
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ unix_path=`$CYGPATH -u "$windows_path"`
+ new_path="$unix_path"
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+ new_path="$unix_path"
+ fi
+
+ if test "x$path" != "x$new_path"; then
+ JT_HOME="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting JT_HOME to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting JT_HOME to \"$new_path\"" >&6;}
+ fi
+
+ # Save the first 10 bytes of this path to the storage, so fixpath can work.
+ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+ else
+ # We're on a unix platform. Hooray! :)
+ path="$JT_HOME"
+ has_space=`$ECHO "$path" | $GREP " "`
+ if test "x$has_space" != x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of JT_HOME, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of JT_HOME, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+ fi
+
+ # Use eval to expand a potential ~
+ eval path="$path"
+ if test ! -f "$path" && test ! -d "$path"; then
+ as_fn_error $? "The path of JT_HOME, which resolves as \"$path\", is not found." "$LINENO" 5
+ fi
+
+ if test -d "$path"; then
+ JT_HOME="`cd "$path"; $THEPWDCMD -L`"
+ else
+ dir="`$DIRNAME "$path"`"
+ base="`$BASENAME "$path"`"
+ JT_HOME="`cd "$dir"; $THEPWDCMD -L`/$base"
+ fi
+ fi
+ fi
+
if test ! -d "$JT_HOME"; then
as_fn_error $? "jtreg home directory from --with-jtreg=$with_jtreg does not exist" "$LINENO" 5
fi
@@ -52048,9 +52026,10 @@
LDFLAGS_JDKLIB="${LDFLAGS_JDK}"
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} ${SHARED_LIBRARY_FLAGS}"
+ LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} ${LDFLAGS_NO_EXEC_STACK}"
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
JAVA_BASE_LDFLAGS="${JAVA_BASE_LDFLAGS} \
- -libpath:${OUTPUT_ROOT}/support/modules_libs/java.base"
+ -libpath:${OUTPUTDIR}/support/modules_libs/java.base"
JDKLIB_LIBS=""
else
JAVA_BASE_LDFLAGS="${JAVA_BASE_LDFLAGS} \
@@ -52133,6 +52112,7 @@
+
# Special extras...
if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
if test "x$OPENJDK_BUILD_CPU_ARCH" = "xsparc"; then
@@ -52927,9 +52907,10 @@
OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDK}"
OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} ${SHARED_LIBRARY_FLAGS}"
+ OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} ${LDFLAGS_NO_EXEC_STACK}"
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
OPENJDK_BUILD_JAVA_BASE_LDFLAGS="${OPENJDK_BUILD_JAVA_BASE_LDFLAGS} \
- -libpath:${OUTPUT_ROOT}/support/modules_libs/java.base"
+ -libpath:${OUTPUTDIR}/support/modules_libs/java.base"
OPENJDK_BUILD_JDKLIB_LIBS=""
else
OPENJDK_BUILD_JAVA_BASE_LDFLAGS="${OPENJDK_BUILD_JAVA_BASE_LDFLAGS} \
@@ -53012,6 +52993,7 @@
+
# Tests are only ever compiled for TARGET
# Flags for compiling test libraries
CFLAGS_TESTLIB="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA"
@@ -54311,7 +54293,7 @@
if test "x$OPENJDK_BUILD_OS" = xwindows; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if fixpath can be created" >&5
$as_echo_n "checking if fixpath can be created... " >&6; }
- FIXPATH_SRC="$SRC_ROOT/make/src/native/fixpath.c"
+ FIXPATH_SRC="$TOPDIR/make/src/native/fixpath.c"
FIXPATH_BIN="$CONFIGURESUPPORT_OUTPUTDIR/bin/fixpath.exe"
FIXPATH_DIR="$CONFIGURESUPPORT_OUTPUTDIR/fixpath"
if test "x$OPENJDK_BUILD_OS_ENV" = xwindows.cygwin; then
@@ -67681,7 +67663,7 @@
# Check for some common pitfalls
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
- file_to_test="$SRC_ROOT/LICENSE"
+ file_to_test="$TOPDIR/LICENSE"
if test `$STAT -c '%a' "$file_to_test"` -lt 400; then
as_fn_error $? "Bad file permissions on src files. This is usually caused by cloning the repositories with a non cygwin hg in a directory not created in cygwin." "$LINENO" 5
fi
@@ -67717,7 +67699,7 @@
OUTPUT_DIR_IS_LOCAL="yes"
fi
else
- if $DF -l $OUTPUT_ROOT > /dev/null 2>&1; then
+ if $DF -l $OUTPUTDIR > /dev/null 2>&1; then
OUTPUT_DIR_IS_LOCAL="yes"
else
OUTPUT_DIR_IS_LOCAL="no"
@@ -67734,7 +67716,7 @@
# Before generating output files, test if they exist. If they do, this is a reconfigure.
# Since we can't properly handle the dependencies for this, warn the user about the situation
- if test -e $OUTPUT_ROOT/spec.gmk; then
+ if test -e $OUTPUTDIR/spec.gmk; then
IS_RECONFIGURE=yes
else
IS_RECONFIGURE=no
@@ -68484,11 +68466,11 @@
for ac_config_target in $ac_config_targets
do
case $ac_config_target in
- "$OUTPUT_ROOT/spec.gmk") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/spec.gmk:$AUTOCONF_DIR/spec.gmk.in" ;;
- "$OUTPUT_ROOT/bootcycle-spec.gmk") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/bootcycle-spec.gmk:$AUTOCONF_DIR/bootcycle-spec.gmk.in" ;;
- "$OUTPUT_ROOT/buildjdk-spec.gmk") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/buildjdk-spec.gmk:$AUTOCONF_DIR/buildjdk-spec.gmk.in" ;;
- "$OUTPUT_ROOT/compare.sh") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/compare.sh:$AUTOCONF_DIR/compare.sh.in" ;;
- "$OUTPUT_ROOT/Makefile") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/Makefile:$AUTOCONF_DIR/Makefile.in" ;;
+ "$OUTPUTDIR/spec.gmk") CONFIG_FILES="$CONFIG_FILES $OUTPUTDIR/spec.gmk:$AUTOCONF_DIR/spec.gmk.in" ;;
+ "$OUTPUTDIR/bootcycle-spec.gmk") CONFIG_FILES="$CONFIG_FILES $OUTPUTDIR/bootcycle-spec.gmk:$AUTOCONF_DIR/bootcycle-spec.gmk.in" ;;
+ "$OUTPUTDIR/buildjdk-spec.gmk") CONFIG_FILES="$CONFIG_FILES $OUTPUTDIR/buildjdk-spec.gmk:$AUTOCONF_DIR/buildjdk-spec.gmk.in" ;;
+ "$OUTPUTDIR/compare.sh") CONFIG_FILES="$CONFIG_FILES $OUTPUTDIR/compare.sh:$AUTOCONF_DIR/compare.sh.in" ;;
+ "$OUTPUTDIR/Makefile") CONFIG_FILES="$CONFIG_FILES $OUTPUTDIR/Makefile:$AUTOCONF_DIR/Makefile.in" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
@@ -68948,20 +68930,20 @@
fi
# Rotate our log file (configure.log)
- if test -e "$OUTPUT_ROOT/configure.log.old"; then
- $RM -f "$OUTPUT_ROOT/configure.log.old"
- fi
- if test -e "$OUTPUT_ROOT/configure.log"; then
- $MV -f "$OUTPUT_ROOT/configure.log" "$OUTPUT_ROOT/configure.log.old" 2> /dev/null
+ if test -e "$OUTPUTDIR/configure.log.old"; then
+ $RM -f "$OUTPUTDIR/configure.log.old"
+ fi
+ if test -e "$OUTPUTDIR/configure.log"; then
+ $MV -f "$OUTPUTDIR/configure.log" "$OUTPUTDIR/configure.log.old" 2> /dev/null
fi
# Move configure.log from current directory to the build output root
if test -e ./configure.log; then
- $MV -f ./configure.log "$OUTPUT_ROOT/configure.log" 2> /dev/null
+ $MV -f ./configure.log "$OUTPUTDIR/configure.log" 2> /dev/null
fi
# Make the compare script executable
- $CHMOD +x $OUTPUT_ROOT/compare.sh
+ $CHMOD +x $OUTPUTDIR/compare.sh
# Finally output some useful information to the user
@@ -68972,15 +68954,15 @@
printf "====================================================\n"
if test "x$no_create" != "xyes"; then
if test "x$IS_RECONFIGURE" != "xyes"; then
- printf "A new configuration has been successfully created in\n%s\n" "$OUTPUT_ROOT"
- else
- printf "The existing configuration has been successfully updated in\n%s\n" "$OUTPUT_ROOT"
+ printf "A new configuration has been successfully created in\n%s\n" "$OUTPUTDIR"
+ else
+ printf "The existing configuration has been successfully updated in\n%s\n" "$OUTPUTDIR"
fi
else
if test "x$IS_RECONFIGURE" != "xyes"; then
printf "A configuration has been successfully checked but not created\n"
else
- printf "The existing configuration has been successfully checked in\n%s\n" "$OUTPUT_ROOT"
+ printf "The existing configuration has been successfully checked in\n%s\n" "$OUTPUTDIR"
fi
fi
if test "x$CONFIGURE_COMMAND_LINE" != x; then
--- a/make/autoconf/help.m4 Tue Sep 26 10:46:23 2017 +0530
+++ b/make/autoconf/help.m4 Thu Sep 28 09:13:27 2017 -0700
@@ -206,15 +206,15 @@
printf "====================================================\n"
if test "x$no_create" != "xyes"; then
if test "x$IS_RECONFIGURE" != "xyes"; then
- printf "A new configuration has been successfully created in\n%s\n" "$OUTPUT_ROOT"
+ printf "A new configuration has been successfully created in\n%s\n" "$OUTPUTDIR"
else
- printf "The existing configuration has been successfully updated in\n%s\n" "$OUTPUT_ROOT"
+ printf "The existing configuration has been successfully updated in\n%s\n" "$OUTPUTDIR"
fi
else
if test "x$IS_RECONFIGURE" != "xyes"; then
printf "A configuration has been successfully checked but not created\n"
else
- printf "The existing configuration has been successfully checked in\n%s\n" "$OUTPUT_ROOT"
+ printf "The existing configuration has been successfully checked in\n%s\n" "$OUTPUTDIR"
fi
fi
if test "x$CONFIGURE_COMMAND_LINE" != x; then
--- a/make/autoconf/jdk-options.m4 Tue Sep 26 10:46:23 2017 +0530
+++ b/make/autoconf/jdk-options.m4 Thu Sep 28 09:13:27 2017 -0700
@@ -206,8 +206,16 @@
# Choose cacerts source file
AC_ARG_WITH(cacerts-file, [AS_HELP_STRING([--with-cacerts-file],
[specify alternative cacerts file])])
- if test "x$with_cacerts_file" != x; then
+ AC_MSG_CHECKING([for cacerts file])
+ if test "x$with_cacerts_file" == x; then
+ AC_MSG_RESULT([default])
+ else
CACERTS_FILE=$with_cacerts_file
+ if test ! -f "$CACERTS_FILE"; then
+ AC_MSG_RESULT([fail])
+ AC_MSG_ERROR([Specified cacerts file "$CACERTS_FILE" does not exist])
+ fi
+ AC_MSG_RESULT([$CACERTS_FILE])
fi
AC_SUBST(CACERTS_FILE)
--- a/make/autoconf/source-dirs.m4 Tue Sep 26 10:46:23 2017 +0530
+++ b/make/autoconf/source-dirs.m4 Thu Sep 28 09:13:27 2017 -0700
@@ -25,9 +25,9 @@
AC_DEFUN_ONCE([SRCDIRS_SETUP_DIRS],
[
- BUILD_OUTPUT="$OUTPUT_ROOT"
- AC_SUBST(BUILD_OUTPUT)
- JDK_OUTPUTDIR="$OUTPUT_ROOT/jdk"
+ OUTPUTDIR="$OUTPUTDIR"
+ AC_SUBST(OUTPUTDIR)
+ JDK_OUTPUTDIR="$OUTPUTDIR/jdk"
# Where are the sources.
AC_SUBST(TOPDIR)
--- a/make/autoconf/spec.gmk.in Tue Sep 26 10:46:23 2017 +0530
+++ b/make/autoconf/spec.gmk.in Thu Sep 28 09:13:27 2017 -0700
@@ -125,14 +125,12 @@
SYSROOT_CFLAGS := @SYSROOT_CFLAGS@
SYSROOT_LDFLAGS := @SYSROOT_LDFLAGS@
-# The top-level directory of the forest (SRC_ROOT is a traditional alias)
+# The top-level directory of the source repository
TOPDIR:=@TOPDIR@
# These two versions of TOPDIR are used in string comparisons
ORIGINAL_TOPDIR:=@ORIGINAL_TOPDIR@
CANONICAL_TOPDIR:=@CANONICAL_TOPDIR@
-SRC_ROOT:=@TOPDIR@
-OUTPUT_ROOT:=@OUTPUT_ROOT@
IMPORT_MODULES_CLASSES:=@IMPORT_MODULES_CLASSES@
IMPORT_MODULES_CMDS:=@IMPORT_MODULES_CMDS@
@@ -244,29 +242,22 @@
# JDK_OUTPUTDIR specifies where a working jvm is built.
# You can run $(JDK_OUTPUTDIR)/bin/java
-# Though the layout of the contents of $(JDK_OUTPUTDIR) is not
-# yet the same as a default installation.
-#
-# When you run "make install" it will create the standardized
-# layout for the jdk and the jre inside the IMAGES_OUTPUTDIR subdir.
-# Then it will copy the contents of the jdk into the installation
-# directory.
-BUILD_OUTPUT:=@BUILD_OUTPUT@
+OUTPUTDIR := @OUTPUTDIR@
# Colon left out to be able to override IMAGES_OUTPUTDIR for bootcycle-images
-SUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/support
-BUILDTOOLS_OUTPUTDIR=$(BUILD_OUTPUT)/buildtools
+SUPPORT_OUTPUTDIR=$(OUTPUTDIR)/support
+BUILDTOOLS_OUTPUTDIR=$(OUTPUTDIR)/buildtools
-HOTSPOT_OUTPUTDIR=$(BUILD_OUTPUT)/hotspot
-JDK_OUTPUTDIR=$(BUILD_OUTPUT)/jdk
-IMAGES_OUTPUTDIR=$(BUILD_OUTPUT)/images
-BUNDLES_OUTPUTDIR=$(BUILD_OUTPUT)/bundles
-TESTMAKE_OUTPUTDIR=$(BUILD_OUTPUT)/test-make
-MAKESUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/make-support
+HOTSPOT_OUTPUTDIR=$(OUTPUTDIR)/hotspot
+JDK_OUTPUTDIR=$(OUTPUTDIR)/jdk
+IMAGES_OUTPUTDIR=$(OUTPUTDIR)/images
+BUNDLES_OUTPUTDIR=$(OUTPUTDIR)/bundles
+TESTMAKE_OUTPUTDIR=$(OUTPUTDIR)/test-make
+MAKESUPPORT_OUTPUTDIR=$(OUTPUTDIR)/make-support
# This does not get overridden in a bootcycle build
CONFIGURESUPPORT_OUTPUTDIR:=@CONFIGURESUPPORT_OUTPUTDIR@
-BUILDJDK_OUTPUTDIR=$(BUILD_OUTPUT)/buildjdk
+BUILDJDK_OUTPUTDIR=$(OUTPUTDIR)/buildjdk
BUILD_FAILURE_HANDLER := @BUILD_FAILURE_HANDLER@
@@ -396,6 +387,7 @@
CXXFLAGS_JDKEXE:=@CXXFLAGS_JDKEXE@
LDFLAGS_HASH_STYLE := @LDFLAGS_HASH_STYLE@
+LDFLAGS_NO_EXEC_STACK := @LDFLAGS_NO_EXEC_STACK@
JVM_CFLAGS := @JVM_CFLAGS@
JVM_CFLAGS_SYMBOLS := @JVM_CFLAGS_SYMBOLS@
--- a/make/autoconf/toolchain.m4 Tue Sep 26 10:46:23 2017 +0530
+++ b/make/autoconf/toolchain.m4 Thu Sep 28 09:13:27 2017 -0700
@@ -935,6 +935,7 @@
elif test "x$with_jtreg" != xyes && test "x$with_jtreg" != x; then
# An explicit path is specified, use it.
JT_HOME="$with_jtreg"
+ BASIC_FIXUP_PATH([JT_HOME])
if test ! -d "$JT_HOME"; then
AC_MSG_ERROR([jtreg home directory from --with-jtreg=$with_jtreg does not exist])
fi
--- a/make/common/JarArchive.gmk Tue Sep 26 10:46:23 2017 +0530
+++ b/make/common/JarArchive.gmk Thu Sep 28 09:13:27 2017 -0700
@@ -211,7 +211,7 @@
$1_SUPDATE_CONTENTS=$(JAR) $$($1_JAR_UPDATE_OPTIONS) $$@ @$$($1_BIN)/_the.$$($1_JARNAME)_contents $$(NEWLINE)
# Use a slightly shorter name for logging, but with enough path to identify this jar.
- $1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_JAR))
+ $1_NAME:=$$(subst $$(OUTPUTDIR)/,,$$($1_JAR))
ifneq (,$$($1_CHECK_COMPRESS_JAR))
$1_JAR_CREATE_OPTIONS := c0fm
--- a/make/common/MakeBase.gmk Tue Sep 26 10:46:23 2017 +0530
+++ b/make/common/MakeBase.gmk Thu Sep 28 09:13:27 2017 -0700
@@ -82,7 +82,7 @@
### Functions for timers
# Store the build times in this directory.
-BUILDTIMESDIR=$(OUTPUT_ROOT)/make-support/build-times
+BUILDTIMESDIR=$(OUTPUTDIR)/make-support/build-times
# Record starting time for build of a sub repository.
define RecordStartTime
@@ -155,7 +155,7 @@
$(strip $(shell $(CAT) $(TOPDIR)/make/common/support/ListPathsSafely-pre-compress.incl)))
compress_paths += \
$(subst $(TOPDIR),X97, \
- $(subst $(OUTPUT_ROOT),X98, \
+ $(subst $(OUTPUTDIR),X98, \
$(subst X,X00, \
$(subst $(SPACE),\n,$(strip $1)))))
$(eval compress_paths += \
@@ -163,7 +163,7 @@
decompress_paths=$(SED) -f $(TOPDIR)/make/common/support/ListPathsSafely-uncompress.sed \
-e 's|X99|\\n|g' \
- -e 's|X98|$(OUTPUT_ROOT)|g' -e 's|X97|$(TOPDIR)|g' \
+ -e 's|X98|$(OUTPUTDIR)|g' -e 's|X97|$(TOPDIR)|g' \
-e 's|X00|X|g'
ListPathsSafely_IfPrintf = \
@@ -359,11 +359,11 @@
ifeq ($$(IS_GNU_TIME), yes)
SHELL := $$(BASH) $$(TOPDIR)/make/scripts/shell-profiler.sh \
gnutime $$(TIME) \
- $$(OUTPUT_ROOT)/build-profile.log $$(SHELL)
+ $$(OUTPUTDIR)/build-profile.log $$(SHELL)
else ifneq ($$(FLOCK), )
SHELL := $$(BASH) $$(TOPDIR)/make/scripts/shell-profiler.sh \
flock $$(FLOCK) \
- $$(OUTPUT_ROOT)/build-profile.log $$(SHELL)
+ $$(OUTPUTDIR)/build-profile.log $$(SHELL)
endif
endif
@@ -707,7 +707,7 @@
# 4 : Macro to call for copy operation
# 5 : Action text to log
$2: $1
- $$(call LogInfo, $(strip $5) $$(patsubst $(OUTPUT_ROOT)/%,%,$$@))
+ $$(call LogInfo, $(strip $5) $$(patsubst $(OUTPUTDIR)/%,%,$$@))
$$($$(strip $4))
$3 += $2
@@ -937,8 +937,8 @@
$(call WriteFile, $2, $(strip $1).cmdline) \
( $(strip $2) > >($(TEE) $(strip $1).log) 2> >($(TEE) $(strip $1).log >&2) || \
( exitcode=$(DOLLAR)? && \
- $(CP) $(strip $1).log $(MAKESUPPORT_OUTPUTDIR)/failure-logs/$(subst /,_,$(patsubst $(BUILD_OUTPUT)/%,%,$(strip $1))).log && \
- $(CP) $(strip $1).cmdline $(MAKESUPPORT_OUTPUTDIR)/failure-logs/$(subst /,_,$(patsubst $(BUILD_OUTPUT)/%,%,$(strip $1))).cmdline && \
+ $(CP) $(strip $1).log $(MAKESUPPORT_OUTPUTDIR)/failure-logs/$(subst /,_,$(patsubst $(OUTPUTDIR)/%,%,$(strip $1))).log && \
+ $(CP) $(strip $1).cmdline $(MAKESUPPORT_OUTPUTDIR)/failure-logs/$(subst /,_,$(patsubst $(OUTPUTDIR)/%,%,$(strip $1))).cmdline && \
exit $(DOLLAR)exitcode ) )
################################################################################
--- a/make/common/Modules.gmk Tue Sep 26 10:46:23 2017 +0530
+++ b/make/common/Modules.gmk Thu Sep 28 09:13:27 2017 -0700
@@ -58,7 +58,6 @@
java.rmi \
java.security.sasl \
java.xml \
- jdk.httpserver \
jdk.internal.vm.ci \
jdk.management \
jdk.management.agent \
@@ -112,6 +111,7 @@
jdk.crypto.cryptoki \
jdk.crypto.ec \
jdk.dynalink \
+ jdk.httpserver \
jdk.incubator.httpclient \
jdk.jsobject \
jdk.localedata \
@@ -173,7 +173,6 @@
jdk.naming.rmi \
jdk.net \
jdk.pack \
- jdk.policytool \
jdk.rmic \
jdk.scripting.nashorn \
jdk.sctp \
--- a/make/common/NativeCompilation.gmk Tue Sep 26 10:46:23 2017 +0530
+++ b/make/common/NativeCompilation.gmk Thu Sep 28 09:13:27 2017 -0700
@@ -751,10 +751,10 @@
# This is a rough heuristic and may not always print accurate information.
$$($1_BUILD_INFO): $$($1_SRCS) $$($1_COMPILE_VARDEPS_FILE)
ifeq ($$(wildcard $$($1_TARGET)),)
- $(ECHO) 'Creating $$(subst $$(BUILD_OUTPUT)/,,$$($1_TARGET)) from $$(words \
+ $(ECHO) 'Creating $$(subst $$(OUTPUTDIR)/,,$$($1_TARGET)) from $$(words \
$$(filter-out %.vardeps, $$?)) file(s)'
else
- $(ECHO) $$(strip 'Updating $$(subst $$(BUILD_OUTPUT)/,,$$($1_TARGET))' \
+ $(ECHO) $$(strip 'Updating $$(subst $$(OUTPUTDIR)/,,$$($1_TARGET))' \
$$(if $$(filter-out %.vardeps, $$?), \
'due to $$(words $$(filter-out %.vardeps, $$?)) file(s)', \
$$(if $$(filter %.vardeps, $$?), 'due to makefile changes')))
@@ -946,9 +946,9 @@
ifeq ($$(TOOLCHAIN_TYPE), clang)
# There is no strlen function in make, but checking path depth is a
# reasonable approximation.
- ifneq ($$(word 10, $$(subst /, ,$$(OUTPUT_ROOT))), )
+ ifneq ($$(word 10, $$(subst /, ,$$(OUTPUTDIR))), )
$1_LINK_OBJS_RELATIVE := true
- $1_ALL_OBJS_RELATIVE := $$(patsubst $$(OUTPUT_ROOT)/%, %, $$($1_ALL_OBJS))
+ $1_ALL_OBJS_RELATIVE := $$(patsubst $$(OUTPUTDIR)/%, %, $$($1_ALL_OBJS))
endif
endif
endif
@@ -976,7 +976,7 @@
$$($1_STRIP_CMD)
else
$$(call ExecuteWithLog, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_link, \
- $$(if $$($1_LINK_OBJS_RELATIVE), $$(CD) $$(OUTPUT_ROOT) ; ) \
+ $$(if $$($1_LINK_OBJS_RELATIVE), $$(CD) $$(OUTPUTDIR) ; ) \
$$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $$($1_SYSROOT_LDFLAGS) \
$(LD_OUT_OPTION)$$@ $$($1_LD_OBJ_ARG) $$($1_RES) $$($1_LIBS) \
$$($1_EXTRA_LIBS)) ; \
--- a/make/common/ZipArchive.gmk Tue Sep 26 10:46:23 2017 +0530
+++ b/make/common/ZipArchive.gmk Thu Sep 28 09:13:27 2017 -0700
@@ -95,7 +95,7 @@
endif
# Use a slightly shorter name for logging, but with enough path to identify this zip.
- $1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_ZIP))
+ $1_NAME:=$$(subst $$(OUTPUTDIR)/,,$$($1_ZIP))
# Now $1_ALL_SRCS should contain all sources that are going to be put into the zip.
# I.e. the zip -i and -x options should match the filtering done in the makefile.
--- a/make/copy/Copy-java.base.gmk Tue Sep 26 10:46:23 2017 +0530
+++ b/make/copy/Copy-java.base.gmk Thu Sep 28 09:13:27 2017 -0700
@@ -208,7 +208,7 @@
CACERTS_DST := $(LIB_DST_DIR)/security/cacerts
$(CACERTS_DST): $(CACERTS_FILE)
- $(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%, %, $@))
+ $(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%, %, $@))
$(call install-file)
TARGETS += $(CACERTS_DST)
--- a/make/devkit/Makefile Tue Sep 26 10:46:23 2017 +0530
+++ b/make/devkit/Makefile Thu Sep 28 09:13:27 2017 -0700
@@ -75,12 +75,12 @@
$(foreach p,$(filter-out $(me),$(platforms)),$(eval $(p) : $$(me)))
endif
-OUTPUT_ROOT = $(abspath ../../build/devkit)
-RESULT = $(OUTPUT_ROOT)/result
+OUTPUTDIR = $(abspath ../../build/devkit)
+RESULT = $(OUTPUTDIR)/result
submakevars = HOST=$@ BUILD=$(me) \
RESULT=$(RESULT) PREFIX=$(RESULT)/$@ \
- OUTPUT_ROOT=$(OUTPUT_ROOT)
+ OUTPUTDIR=$(OUTPUTDIR)
$(platforms) :
@echo 'Building compilers for $@'
@echo 'Targets: $(platforms)'
--- a/make/devkit/Tools.gmk Tue Sep 26 10:46:23 2017 +0530
+++ b/make/devkit/Tools.gmk Thu Sep 28 09:13:27 2017 -0700
@@ -121,13 +121,13 @@
endif
# Define directories
-RESULT := $(OUTPUT_ROOT)/result
-BUILDDIR := $(OUTPUT_ROOT)/$(HOST)/$(TARGET)
+RESULT := $(OUTPUTDIR)/result
+BUILDDIR := $(OUTPUTDIR)/$(HOST)/$(TARGET)
PREFIX := $(RESULT)/$(HOST)
TARGETDIR := $(PREFIX)/$(TARGET)
SYSROOT := $(TARGETDIR)/sysroot
-DOWNLOAD := $(OUTPUT_ROOT)/download
-SRCDIR := $(OUTPUT_ROOT)/src
+DOWNLOAD := $(OUTPUTDIR)/download
+SRCDIR := $(OUTPUTDIR)/src
# Marker file for unpacking rpms
rpms := $(SYSROOT)/rpms_unpacked
--- a/make/gensrc/Gensrc-jdk.charsets.gmk Tue Sep 26 10:46:23 2017 +0530
+++ b/make/gensrc/Gensrc-jdk.charsets.gmk Thu Sep 28 09:13:27 2017 -0700
@@ -72,7 +72,7 @@
$(CHARSET_GENSRC_JAVA_DIR_CS)/sjis0213.dat: $(CHARSET_DATA_DIR)/sjis0213.map \
$(BUILD_TOOLS_JDK)
- $(call LogInfo, Generating $(patsubst $(OUTPUT_ROOT)/%, %, $@))
+ $(call LogInfo, Generating $(patsubst $(OUTPUTDIR)/%, %, $@))
$(call MakeDir, $(@D))
$(TOOL_CHARSETMAPPING) '$<' '$@' sjis0213
--- a/make/gensrc/GensrcIcons.gmk Tue Sep 26 10:46:23 2017 +0530
+++ b/make/gensrc/GensrcIcons.gmk Thu Sep 28 09:13:27 2017 -0700
@@ -117,7 +117,7 @@
$(GENSRC_OSX_ICONS): $(GENSRC_OSX_ICONS_SRC) $(BUILD_TOOLS_JDK)
- $(call LogInfo, Generating $(patsubst $(OUTPUT_ROOT)/%, %, $@))
+ $(call LogInfo, Generating $(patsubst $(OUTPUTDIR)/%, %, $@))
$(call MakeDir, $(@D))
$(RM) $@ $@.tmp
$(ECHO) "static unsigned char sAWTIconData[] = { " >> $@.tmp
--- a/make/hotspot/ide/CreateVSProject.gmk Tue Sep 26 10:46:23 2017 +0530
+++ b/make/hotspot/ide/CreateVSProject.gmk Thu Sep 28 09:13:27 2017 -0700
@@ -99,7 +99,7 @@
# Run the ProjectCreator tool
PROJECT_CREATOR_TOOL := $(JAVA_SMALL) -cp $(TOOLS_OUTPUTDIR) build.tools.projectcreator.ProjectCreator
- IDE_OUTPUTDIR := $(BUILD_OUTPUT)/ide/hotspot-visualstudio
+ IDE_OUTPUTDIR := $(OUTPUTDIR)/ide/hotspot-visualstudio
VCPROJ_FILE := $(IDE_OUTPUTDIR)/jvm.vcxproj
--- a/make/hotspot/lib/CompileLibjsig.gmk Tue Sep 26 10:46:23 2017 +0530
+++ b/make/hotspot/lib/CompileLibjsig.gmk Thu Sep 28 09:13:27 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
@@ -36,7 +36,7 @@
ifeq ($(STATIC_BUILD), false)
ifeq ($(OPENJDK_TARGET_OS), linux)
LIBJSIG_CFLAGS := -fPIC -D_GNU_SOURCE -D_REENTRANT $(EXTRA_CFLAGS)
- LIBJSIG_LDFLAGS := $(LDFLAGS_HASH_STYLE) $(EXTRA_CFLAGS)
+ LIBJSIG_LDFLAGS := $(LDFLAGS_HASH_STYLE) ${LDFLAGS_NO_EXEC_STACK} $(EXTRA_CFLAGS)
LIBJSIG_LIBS := $(LIBDL)
# NOTE: The old build compiled this library without -soname.
--- a/make/langtools/intellij/langtools.iml Tue Sep 26 10:46:23 2017 +0530
+++ b/make/langtools/intellij/langtools.iml Thu Sep 28 09:13:27 2017 -0700
@@ -22,11 +22,7 @@
<sourceFolder url="file://$MODULE_DIR$/src/jdk.jshell" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/jdk.javadoc" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/build" />
- <excludeFolder url="file://$MODULE_DIR$/make" />
- <excludeFolder url="file://$MODULE_DIR$/src" />
- <excludeFolder url="file://$MODULE_DIR$/test" />
</content>
- <content url="file://$MODULE_DIR$/test/langtools"/>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="inheritedJdk" />
</component>
--- a/make/langtools/src/classes/build/tools/symbolgenerator/TransitiveDependencies.java Tue Sep 26 10:46:23 2017 +0530
+++ b/make/langtools/src/classes/build/tools/symbolgenerator/TransitiveDependencies.java Thu Sep 28 09:13:27 2017 -0700
@@ -57,8 +57,8 @@
}
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
- List<String> options = Arrays.asList("-source", "9",
- "-target", "9",
+ List<String> options = Arrays.asList("-source", "10",
+ "-target", "10",
"-proc:only",
"--system", "none",
"--module-source-path", args[0],
--- a/make/launcher/Launcher-jdk.policytool.gmk Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-#
-# Copyright (c) 2011, 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.
-#
-
-include LauncherCommon.gmk
-
-ifeq ($(ENABLE_HEADLESS_ONLY), false)
- $(eval $(call SetupBuildLauncher, policytool, \
- MAIN_CLASS := sun.security.tools.policytool.PolicyTool, \
- LIBS_unix := $(X_LIBS), \
- ))
-endif
--- a/make/mapfiles/libjava/mapfile-vers Tue Sep 26 10:46:23 2017 +0530
+++ b/make/mapfiles/libjava/mapfile-vers Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 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
@@ -74,17 +74,16 @@
JNU_ThrowStringIndexOutOfBoundsException;
JNU_ToString;
+ Java_java_io_FileDescriptor_close;
Java_java_io_FileDescriptor_initIDs;
Java_java_io_FileDescriptor_sync;
Java_java_io_FileDescriptor_getAppend;
Java_java_io_FileInputStream_available0;
- Java_java_io_FileInputStream_close0;
Java_java_io_FileInputStream_initIDs;
Java_java_io_FileInputStream_open0;
Java_java_io_FileInputStream_read0;
Java_java_io_FileInputStream_readBytes;
Java_java_io_FileInputStream_skip0;
- Java_java_io_FileOutputStream_close0;
Java_java_io_FileOutputStream_initIDs;
Java_java_io_FileOutputStream_open0;
Java_java_io_FileOutputStream_write;
@@ -95,7 +94,6 @@
Java_java_io_ObjectOutputStream_floatsToBytes;
Java_java_io_ObjectStreamClass_hasStaticInitializer;
Java_java_io_ObjectStreamClass_initNative;
- Java_java_io_RandomAccessFile_close0;
Java_java_io_RandomAccessFile_getFilePointer;
Java_java_io_RandomAccessFile_initIDs;
Java_java_io_RandomAccessFile_length;
--- a/make/nashorn/build-benchmark.xml Tue Sep 26 10:46:23 2017 +0530
+++ b/make/nashorn/build-benchmark.xml Thu Sep 28 09:13:27 2017 -0700
@@ -219,7 +219,8 @@
<target name="-define-nashorn-task">
<ant dir="${nashorntask.dir}" inheritAll="false"/>
- <taskdef name="nashorn" classname="jdk.nashorn.ant.NashornTask" classpath="${nashorntask.dir}/dist/nashorntask.jar"/>
+ <taskdef name="nashorn" classname="jdk.nashorn.ant.NashornTask"
+ classpath="${nashorntask.dist.dir}/nashorntask.jar"/>
</target>
<!--
--- a/make/nashorn/build.xml Tue Sep 26 10:46:23 2017 +0530
+++ b/make/nashorn/build.xml Thu Sep 28 09:13:27 2017 -0700
@@ -174,8 +174,6 @@
<target name="compile" depends="prepare" description="Compiles nashorn">
<javac srcdir="${dynalink.module.src.dir}"
destdir="${dynalink.module.classes.dir}"
- source="${javac.source}"
- target="${javac.target}"
debug="${javac.debug}"
encoding="${javac.encoding}"
includeantruntime="false" fork="true">
@@ -190,8 +188,6 @@
</delete>
<javac srcdir="${nashorn.module.src.dir}"
destdir="${nashorn.module.classes.dir}"
- source="${javac.source}"
- target="${javac.target}"
debug="${javac.debug}"
encoding="${javac.encoding}"
includeantruntime="false" fork="true">
@@ -207,8 +203,6 @@
</delete>
<javac srcdir="${nashorn.shell.module.src.dir}"
destdir="${nashorn.shell.module.classes.dir}"
- source="${javac.source}"
- target="${javac.target}"
debug="${javac.debug}"
encoding="${javac.encoding}"
includeantruntime="false" fork="true">
@@ -271,17 +265,16 @@
<target name="javadoc" depends="jar">
<javadoc destdir="${dist.javadoc.dir}" use="yes"
windowtitle="${nashorn.product.name} ${nashorn.version}"
- additionalparam="-quiet" failonerror="true" useexternalfile="true">
+ additionalparam="-quiet" failonerror="true" useexternalfile="true">
+ <arg value="--patch-module"/>
+ <arg value="jdk.scripting.nashorn=${basedir}/${nashorn.module.src.dir}"/>
+ <arg value="--patch-module"/>
+ <arg value="jdk.dynalink=${basedir}/${dynalink.module.src.dir}"/>
<arg value="--module-source-path"/>
- <arg value="${nashorn.module.src.dir}"/>
- <arg value="--module-source-path"/>
- <arg value="${dynalink.module.src.dir}"/>
+ <arg value="."/>
<arg value="${javadoc.option}"/>
- <classpath>
- <pathelement location="${build.classes.dir}"/>
- </classpath>
+ <fileset dir="${nashorn.module.src.dir}" includes="**/*.java"/>
<fileset dir="${dynalink.module.src.dir}" includes="**/*.java"/>
- <fileset dir="${nashorn.module.src.dir}" includes="**/*.java"/>
<link href="http://docs.oracle.com/javase/8/docs/api/"/>
</javadoc>
</target>
@@ -290,14 +283,15 @@
<target name="nashornapi" depends="jar">
<mkdir dir="${dist.nashornapi.javadoc.dir}"/>
<javadoc destdir="${dist.nashornapi.javadoc.dir}" use="yes"
- extdirs="${nashorn.ext.path}" windowtitle="${nashorn.product.name} ${nashorn.version}"
+ windowtitle="${nashorn.product.name} ${nashorn.version}"
additionalparam="-quiet" failonerror="true" useexternalfile="true">
+ <arg value="--patch-module"/>
+ <arg value="jdk.scripting.nashorn=${basedir}/${nashorn.module.src.dir}"/>
+ <arg value="--patch-module"/>
+ <arg value="jdk.dynalink=${basedir}/${dynalink.module.src.dir}"/>
<arg value="--module-source-path"/>
- <arg value="${nashorn.module.src.dir}"/>
+ <arg value="."/>
<arg value="${javadoc.option}"/>
- <classpath>
- <pathelement location="${build.classes.dir}"/>
- </classpath>
<fileset dir="${nashorn.module.src.dir}" includes="jdk/nashorn/api/**/*.java"/>
<link href="http://docs.oracle.com/javase/8/docs/api/"/>
</javadoc>
@@ -309,30 +303,22 @@
<javadoc destdir="${dist.dynalinkapi.javadoc.dir}" use="yes"
windowtitle="Dynalink"
additionalparam="-quiet" failonerror="true" useexternalfile="true">
+ <arg value="--patch-module"/>
+ <arg value="jdk.scripting.nashorn=${basedir}/${nashorn.module.src.dir}"/>
+ <arg value="--patch-module"/>
+ <arg value="jdk.dynalink=${basedir}/${dynalink.module.src.dir}"/>
<arg value="--module-source-path"/>
- <arg value="${dynalink.module.src.dir}"/>
+ <arg value="."/>
<arg value="${javadoc.option}"/>
- <classpath>
- <pathelement location="${build.classes.dir}"/>
- </classpath>
- <fileset dir="${dynalink.module.src.dir}" includes="**/*.java" excludes="jdk/dynalink/internal/*.java"/>
+ <fileset dir="${dynalink.module.src.dir}" includes="**/*.java"/>
<link href="http://docs.oracle.com/javase/8/docs/api/"/>
</javadoc>
</target>
<target name="javadocapi" depends="nashornapi, dynalinkapi"/>
- <!-- generate shell.html for shell tool documentation -->
- <target name="shelldoc" depends="jar">
- <java classname="${nashorn.shell.tool}" dir="${basedir}" output="${dist.dir}/shell.html" failonerror="true" fork="true">
- <jvmarg line="${nashorn.override.option}"/>
- <arg value="-scripting"/>
- <arg value="docs/genshelldoc.js"/>
- </java>
- </target>
-
<!-- generate all docs -->
- <target name="docs" depends="javadoc, shelldoc"/>
+ <target name="docs" depends="javadoc"/>
<!-- create .zip and .tar.gz for nashorn binaries and scripts. -->
<target name="dist" depends="jar">
@@ -350,8 +336,6 @@
<javac srcdir="${test.src.dir}"
destdir="${build.test.classes.dir}"
classpath="${javac.test.classpath}"
- source="${javac.source}"
- target="${javac.target}"
debug="${javac.debug}"
encoding="${javac.encoding}"
includeantruntime="false" fork="true">
@@ -359,7 +343,7 @@
<compilerarg value="-Xlint:unchecked"/>
<compilerarg value="-Xlint:deprecation"/>
<compilerarg value="-Xdiags:verbose"/>
- <compilerarg line="${test.module.imports}"/>
+ <compilerarg line="${test.module.imports.compile.time}"/>
</javac>
<copy todir="${build.test.classes.dir}/META-INF/services">
@@ -614,7 +598,7 @@
</testng>
</target>
- <target name="test" depends="prepare, test-pessimistic, test-optimistic"/>
+ <target name="test" depends="prepare, javadoc, test-pessimistic, test-optimistic"/>
<target name="test-optimistic" depends="jar, -test-classes-all,-test-classes-single, check-testng, check-external-tests, compile-test, generate-security-config" if="testng.available">
<echo message="Running test suite in OPTIMISTIC mode..."/>
@@ -752,7 +736,7 @@
<target name="run" depends="jar"
description="Run the shell with a sample script">
- <java classname="${nashorn.shell.tool}" fork="true" dir="samples">
+ <java classname="${nashorn.shell.tool}" fork="true" dir="${basedir}/src/sample/nashorn">
<jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
<arg value="-dump-on-error"/>
<arg value="test.js"/>
@@ -761,7 +745,7 @@
<target name="debug" depends="jar"
description="Debug the shell with a sample script">
- <java classname="${nashorn.shell.tool}" fork="true" dir="samples">
+ <java classname="${nashorn.shell.tool}" fork="true" dir="${basedir}/src/sample/nashorn">
<jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
<arg value="--print-code"/>
<arg value="--verify-code"/>
--- a/make/nashorn/buildtools/nasgen/project.properties Tue Sep 26 10:46:23 2017 +0530
+++ b/make/nashorn/buildtools/nasgen/project.properties Thu Sep 28 09:13:27 2017 -0700
@@ -24,8 +24,6 @@
# source and target levels
build.compiler=modern
-javac.source=1.7
-javac.target=1.7
# This directory is removed when the project is cleaned:
nasgen.build.dir=../../../../build/nashorn/nasgen
--- a/make/nashorn/buildtools/nashorntask/build.xml Tue Sep 26 10:46:23 2017 +0530
+++ b/make/nashorn/buildtools/nashorntask/build.xml Thu Sep 28 09:13:27 2017 -0700
@@ -27,18 +27,18 @@
</target>
<target name="prepare" depends="init">
- <mkdir dir="${build.classes.dir}"/>
- <mkdir dir="${dist.dir}"/>
+ <mkdir dir="${nashorntask.build.classes.dir}"/>
+ <mkdir dir="${nashorntask.dist.dir}"/>
</target>
<target name="clean" depends="init">
- <delete dir="${build.dir}"/>
- <delete dir="${dist.dir}"/>
+ <delete dir="${nashorntask.build.dir}"/>
+ <delete dir="${nashorntask.dist.dir}"/>
</target>
<target name="compile" depends="prepare" description="Compiles the nashorn ant tag sources">
<javac srcdir="${src.dir}"
- destdir="${build.classes.dir}"
+ destdir="${nashorntask.build.classes.dir}"
debug="${javac.debug}"
includeantruntime="true">
<compilerarg value="-Xlint:unchecked"/>
@@ -47,7 +47,7 @@
</target>
<target name="jar" depends="compile" description="Creates nashorntask.jar">
- <jar jarfile="${dist.jar}" basedir="${build.classes.dir}"/>
+ <jar jarfile="${nashorntask.dist.jar}" basedir="${nashorntask.build.classes.dir}"/>
</target>
<target name="dist" depends="jar"/>
--- a/make/nashorn/buildtools/nashorntask/project.properties Tue Sep 26 10:46:23 2017 +0530
+++ b/make/nashorn/buildtools/nashorntask/project.properties Thu Sep 28 09:13:27 2017 -0700
@@ -24,17 +24,15 @@
# source and target levels
build.compiler=modern
-javac.source=1.8
-javac.target=1.8
-
-build.classes.dir=${build.dir}/classes
# This directory is removed when the project is cleaned:
-build.dir=build
+nashorntask.build.dir=../../../../build/nashorn/nashorntask
+nashorntask.build.classes.dir=${nashorntask.build.dir}/classes
+
# This directory is removed when the project is cleaned:
-dist.dir=dist
-dist.jar=${dist.dir}/nashorntask.jar
-dist.javadoc.dir=${dist.dir}/javadoc
+nashorntask.dist.dir=${nashorntask.build.dir}/dist
+nashorntask.dist.jar=${nashorntask.dist.dir}/nashorntask.jar
+nashorntask.dist.javadoc.dir=${nashorntask.dist.dir}/javadoc
javac.debug=true
src.dir=src
--- a/make/nashorn/project.properties Tue Sep 26 10:46:23 2017 +0530
+++ b/make/nashorn/project.properties Thu Sep 28 09:13:27 2017 -0700
@@ -32,8 +32,6 @@
# source and target levels
build.compiler=modern
-javac.source=1.9
-javac.target=1.9
javadoc.option=\
-tag "implSpec:a:Implementation Requirements:" \
@@ -60,7 +58,8 @@
--patch-module jdk.dynalink=${build.classes.dir}/jdk.dynalink
# project directory of <nashorn> ant task
-nashorntask.dir=buildtools/nashorntask
+nashorntask.dir=${nashorn.make.dir}/buildtools/nashorntask
+nashorntask.dist.dir=${build.dir}/nashorntask/dist
# nashorn Shell tool
nashorn.shell.tool=jdk.nashorn.tools.Shell
@@ -145,7 +144,7 @@
${file.reference.bsh.jar}${path.separator}\
${file.reference.snakeyaml.jar}
-test.module.imports=\
+test.module.imports.compile.time=\
--add-exports jdk.scripting.nashorn/jdk.nashorn.internal.ir=ALL-UNNAMED \
--add-exports jdk.scripting.nashorn/jdk.nashorn.internal.codegen=ALL-UNNAMED \
--add-exports jdk.scripting.nashorn/jdk.nashorn.internal.parser=ALL-UNNAMED \
@@ -158,7 +157,10 @@
--add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime.regexp=ALL-UNNAMED \
--add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime.regexp.joni=ALL-UNNAMED \
--add-exports jdk.scripting.nashorn/jdk.nashorn.tools=ALL-UNNAMED \
- --add-exports java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED \
+ --add-exports java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED
+
+test.module.imports.runtime=\
+ ${test.module.imports.compile.time} \
--add-opens jdk.scripting.nashorn/jdk.nashorn.internal.runtime=ALL-UNNAMED \
--add-opens jdk.scripting.nashorn/jdk.nashorn.internal.runtime.doubleconv=ALL-UNNAMED
@@ -358,7 +360,7 @@
run.test.jvmargs.common=\
-server \
- ${test.module.imports} \
+ ${test.module.imports.runtime} \
${run.test.jvmargs.external} \
--add-modules jdk.scripting.nashorn.shell \
${nashorn.override.option} \
--- a/make/scripts/compare.sh Tue Sep 26 10:46:23 2017 +0530
+++ b/make/scripts/compare.sh Thu Sep 28 09:13:27 2017 -0700
@@ -29,7 +29,7 @@
################################################################################
# Check that we are run via the wrapper generated by configure
-if [ -z "$SRC_ROOT" ]; then
+if [ -z "$TOPDIR" ]; then
echo "Error: You must run this script using build/[conf]/compare.sh"
exit 1
fi
@@ -56,7 +56,7 @@
STAT_PRINT_SIZE="-c %s"
fi
-COMPARE_EXCEPTIONS_INCLUDE="$SRC_ROOT/make/scripts/compare_exceptions.sh.incl"
+COMPARE_EXCEPTIONS_INCLUDE="$TOPDIR/make/scripts/compare_exceptions.sh.incl"
if [ ! -e "$COMPARE_EXCEPTIONS_INCLUDE" ]; then
echo "Error: Cannot locate the exceptions file, it should have been here: $COMPARE_EXCEPTIONS_INCLUDE"
exit 1
--- a/make/scripts/compare_exceptions.sh.incl Tue Sep 26 10:46:23 2017 +0530
+++ b/make/scripts/compare_exceptions.sh.incl Thu Sep 28 09:13:27 2017 -0700
@@ -86,7 +86,6 @@
./bin/keytool
./bin/orbd
./bin/pack200
- ./bin/policytool
./bin/rmic
./bin/rmid
./bin/rmiregistry
@@ -219,7 +218,6 @@
./bin/keytool
./bin/orbd
./bin/pack200
- ./bin/policytool
./bin/rmic
./bin/rmid
./bin/rmiregistry
@@ -329,7 +327,6 @@
./bin/keytool
./bin/orbd
./bin/pack200
- ./bin/policytool
./bin/rmic
./bin/rmid
./bin/rmiregistry
@@ -422,7 +419,6 @@
./bin/ktab.exe
./bin/orbd.exe
./bin/pack200.exe
- ./bin/policytool.exe
./bin/rmic.exe
./bin/rmid.exe
./bin/rmiregistry.exe
@@ -512,7 +508,6 @@
./bin/keytool
./bin/orbd
./bin/pack200
- ./bin/policytool
./bin/rmic
./bin/rmid
./bin/rmiregistry
--- a/make/test/JtregNativeHotspot.gmk Tue Sep 26 10:46:23 2017 +0530
+++ b/make/test/JtregNativeHotspot.gmk Thu Sep 28 09:13:27 2017 -0700
@@ -117,7 +117,7 @@
BUILD_HOTSPOT_JTREG_EXECUTABLES_CFLAGS_exeFPRegs := -MT
endif
-BUILD_HOTSPOT_JTREG_OUTPUT_DIR := $(BUILD_OUTPUT)/support/test/hotspot/jtreg/native
+BUILD_HOTSPOT_JTREG_OUTPUT_DIR := $(OUTPUTDIR)/support/test/hotspot/jtreg/native
BUILD_HOTSPOT_JTREG_IMAGE_DIR := $(TEST_IMAGE_DIR)/hotspot/jtreg
--- a/make/test/JtregNativeJdk.gmk Tue Sep 26 10:46:23 2017 +0530
+++ b/make/test/JtregNativeJdk.gmk Thu Sep 28 09:13:27 2017 -0700
@@ -47,7 +47,7 @@
$(TOPDIR)/test/jdk/java/lang/String/nativeEncoding \
#
-BUILD_JDK_JTREG_OUTPUT_DIR := $(BUILD_OUTPUT)/support/test/jdk/jtreg/native
+BUILD_JDK_JTREG_OUTPUT_DIR := $(OUTPUTDIR)/support/test/jdk/jtreg/native
BUILD_JDK_JTREG_IMAGE_DIR := $(TEST_IMAGE_DIR)/jdk/jtreg
--- a/src/bsd/doc/man/ja/policytool.1 Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-." Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
-." DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-."
-." This code is free software; you can redistribute it and/or modify it
-." under the terms of the GNU General Public License version 2 only, as
-." published by the Free Software Foundation.
-."
-." 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.
-."
-.TH policytool 1 "07 May 2011"
-
-.LP
--- a/src/bsd/doc/man/jarsigner.1 Tue Sep 26 10:46:23 2017 +0530
+++ b/src/bsd/doc/man/jarsigner.1 Thu Sep 28 09:13:27 2017 -0700
@@ -149,7 +149,7 @@
.PP
Applications can choose different types of keystore implementations from different providers, with the \f3getInstance\fR factory method in the \f3KeyStore\fR class\&. A keystore type defines the storage and data format of the keystore information and the algorithms used to protect private keys in the keystore and the integrity of the keystore itself\&. Keystore implementations of different types are not compatible\&.
.PP
-The \f3jarsigner\fR and \f3policytool\fR commands can read file-based keystores from any location that can be specified using a URL\&. In addition, these commands can read non-file-based keystores such as those provided by MSCAPI on Windows and PKCS11 on all platforms\&.
+The \f3jarsigner\fR command can read file-based keystores from any location that can be specified using a URL\&. In addition, the command can read non-file-based keystores such as those provided by MSCAPI on Windows and PKCS11 on all platforms\&.
.PP
For the \f3jarsigner\fR and \f3keytool\fR commands, you can specify a keystore type at the command line with the \f3-storetype\fR option\&. For Policy Tool, you can specify a keystore type with the \fIEdit\fR command in the \fIKeyStore\fR menu\&.
.PP
--- a/src/bsd/doc/man/keytool.1 Tue Sep 26 10:46:23 2017 +0530
+++ b/src/bsd/doc/man/keytool.1 Thu Sep 28 09:13:27 2017 -0700
@@ -1231,7 +1231,7 @@
Applications can choose different types of keystore implementations from different providers, using the \f3getInstance\fR factory method supplied in the \f3KeyStore\fR class\&. A keystore type defines the storage and data format of the keystore information, and the algorithms used to protect private/secret keys in the keystore and the integrity of the keystore\&. Keystore implementations of different types are not compatible\&.
-The \f3keytool\fR command works on any file-based keystore implementation\&. It treats the keystore location that is passed to it at the command line as a file name and converts it to a \f3FileInputStream\fR, from which it loads the keystore information\&.)The \f3jarsigner\fR and \f3policytool\fR commands can read a keystore from any location that can be specified with a URL\&.
+The \f3keytool\fR command works on any file-based keystore implementation\&. It treats the keystore location that is passed to it at the command line as a file name and converts it to a \f3FileInputStream\fR, from which it loads the keystore information\&.)The \f3jarsigner\fR command can read a keystore from any location that can be specified with a URL\&.
For \f3keytool\fR and \f3jarsigner\fR, you can specify a keystore type at the command line, with the \f3-storetype\fR option\&. For Policy Tool, you can specify a keystore type with the \fIKeystore\fR menu\&.
--- a/src/bsd/doc/man/policytool.1 Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-'\" t
-.\" Copyright (c) 2001, 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.
-.\"
-.\" 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.
-.\"
-.\" Arch: generic
-.\" Software: JDK 8
-.\" Date: 03 March 2015
-.\" SectDesc: Security Tools
-.\" Title: policytool.1
-.\"
-.if n .pl 99999
-.TH policytool 1 "03 March 2015" "JDK 8" "Security Tools"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-
-.SH NAME
-policytool \- Reads and writes a plain text policy file based on user input through the utility GUI\&.
-.SH SYNOPSIS
-.sp
-.nf
-
-\fBpolicytool\fR [ \fB\-file\fR ] [ \fIfilename\fR ]
-.fi
-.sp
-.TP
--file
-.br
-Directs the \f3policytool\fR command to load a policy file\&.
-.TP
-\fIfilename\fR
-The name of the file to be loaded\&.
-.PP
-\fIExamples\fR:
-.PP
-Run the policy tool administrator utility:
-.sp
-.nf
-\f3policytool\fP
-.fi
-.nf
-\f3\fP
-.fi
-.sp
-Run the \f3policytool\fR command and load the specified file:
-.sp
-.nf
-\f3policytool \-file \fImypolicyfile\fR\fP
-.fi
-.nf
-\f3\fP
-.fi
-.sp
-.SH DESCRIPTION
-The \f3policytool\fR command calls an administrator\&'s GUI that enables system administrators to manage the contents of local policy files\&. A policy file is a plain-text file with a \f3\&.policy\fR extension, that maps remote requestors by domain, to permission objects\&. For details, see Default Policy Implementation and Policy File Syntax at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/PolicyFiles\&.html
-.SH OPTIONS
-.TP
--file
-.br
-Directs the \f3policytool\fR command to load a policy file\&.
-.SH SEE\ ALSO
-.TP 0.2i
-\(bu
-Default Policy Implementation and Policy File Syntax at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/PolicyFiles\&.html
-.TP 0.2i
-\(bu
-Policy File Creation and Management at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/PolicyGuide\&.html
-.TP 0.2i
-\(bu
-Permissions in Java SE Development Kit (JDK) at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/permissions\&.html
-.TP 0.2i
-\(bu
-Java Security Overview at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/overview/jsoverview\&.html
-.TP 0.2i
-\(bu
-Java Cryptography Architecture (JCA) Reference Guide at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/crypto/CryptoSpec\&.html
-.RE
-.br
-'pl 8.5i
-'bp
--- a/src/bsd/doc/man/serialver.1 Tue Sep 26 10:46:23 2017 +0530
+++ b/src/bsd/doc/man/serialver.1 Thu Sep 28 09:13:27 2017 -0700
@@ -100,9 +100,6 @@
.SH SEE\ ALSO
.TP 0.2i
\(bu
-policytool(1)
-.TP 0.2i
-\(bu
The \f3java\&.io\&.ObjectStream\fR class description at http://docs\&.oracle\&.com/javase/8/docs/api/java/io/ObjectStreamClass\&.html
.RE
.br
--- a/src/demo/share/jfc/Font2DTest/README.txt Tue Sep 26 10:46:23 2017 +0530
+++ b/src/demo/share/jfc/Font2DTest/README.txt Thu Sep 28 09:13:27 2017 -0700
@@ -31,7 +31,7 @@
The program will run without these properties set,
but some of its features will be limited.
-To enable all features, please add these permissions with policytool.
+To enable all features, please add these permissions.
-----------------------------------------------------------------------
Introduction
--- a/src/hotspot/share/prims/whitebox.cpp Tue Sep 26 10:46:23 2017 +0530
+++ b/src/hotspot/share/prims/whitebox.cpp Thu Sep 28 09:13:27 2017 -0700
@@ -73,6 +73,9 @@
#include "utilities/nativeCallStack.hpp"
#endif // INCLUDE_NMT
+#ifdef LINUX
+#include "utilities/elfFile.hpp"
+#endif
#define SIZE_T_MAX_VALUE ((size_t) -1)
@@ -1823,6 +1826,20 @@
DirectivesStack::pop(count);
WB_END
+// Checks that the library libfile has the noexecstack bit set.
+WB_ENTRY(jboolean, WB_CheckLibSpecifiesNoexecstack(JNIEnv* env, jobject o, jstring libfile))
+ jboolean ret = false;
+#ifdef LINUX
+ // Can't be in VM when we call JNI.
+ ThreadToNativeFromVM ttnfv(thread);
+ const char* lf = env->GetStringUTFChars(libfile, NULL);
+ CHECK_JNI_EXCEPTION_(env, 0);
+ ret = (jboolean) ElfFile::specifies_noexecstack(lf);
+ env->ReleaseStringUTFChars(libfile, lf);
+#endif
+ return ret;
+WB_END
+
#define CC (char*)
static JNINativeMethod methods[] = {
@@ -2027,6 +2044,8 @@
(void*)&WB_GetConcurrentGCPhases},
{CC"requestConcurrentGCPhase0", CC"(Ljava/lang/String;)Z",
(void*)&WB_RequestConcurrentGCPhase},
+ {CC"checkLibSpecifiesNoexecstack", CC"(Ljava/lang/String;)Z",
+ (void*)&WB_CheckLibSpecifiesNoexecstack},
};
#undef CC
--- a/src/java.base/share/classes/java/io/FileInputStream.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/java/io/FileInputStream.java Thu Sep 28 09:13:27 2017 -0700
@@ -341,7 +341,7 @@
fd.closeAll(new Closeable() {
public void close() throws IOException {
- close0();
+ fd.close();
}
});
}
@@ -403,7 +403,6 @@
private static native void initIDs();
- private native void close0() throws IOException;
static {
initIDs();
--- a/src/java.base/share/classes/java/io/FileOutputStream.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/java/io/FileOutputStream.java Thu Sep 28 09:13:27 2017 -0700
@@ -365,7 +365,7 @@
fd.closeAll(new Closeable() {
public void close() throws IOException {
- close0();
+ fd.close();
}
});
}
@@ -458,8 +458,6 @@
}
}
- private native void close0() throws IOException;
-
private static native void initIDs();
static {
--- a/src/java.base/share/classes/java/io/RandomAccessFile.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/java/io/RandomAccessFile.java Thu Sep 28 09:13:27 2017 -0700
@@ -648,7 +648,7 @@
fd.closeAll(new Closeable() {
public void close() throws IOException {
- close0();
+ fd.close();
}
});
}
@@ -1177,8 +1177,6 @@
private static native void initIDs();
- private native void close0() throws IOException;
-
static {
initIDs();
SharedSecrets.setJavaIORandomAccessFileAccess(new JavaIORandomAccessFileAccess()
--- a/src/java.base/share/classes/java/lang/ClassLoader.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/java/lang/ClassLoader.java Thu Sep 28 09:13:27 2017 -0700
@@ -2160,10 +2160,12 @@
* if a package of the given {@code name} is already
* defined by this class loader
*
+ *
* @since 1.2
* @revised 9
* @spec JPMS
*
+ * @jvms 5.3 Run-time package
* @see <a href="{@docRoot}/../specs/jar/jar.html#sealing">
* The JAR File Specification: Package Sealing</a>
*/
@@ -2186,17 +2188,19 @@
}
/**
- * Returns a {@code Package} of the given <a href="#name">name</a> that has been
- * defined by this class loader.
+ * Returns a {@code Package} of the given <a href="#name">name</a> that
+ * has been defined by this class loader.
*
* @param name The <a href="#name">package name</a>
*
- * @return The {@code Package} of the given name defined by this class loader,
- * or {@code null} if not found
+ * @return The {@code Package} of the given name that has been defined
+ * by this class loader, or {@code null} if not found
*
* @throws NullPointerException
* if {@code name} is {@code null}.
*
+ * @jvms 5.3 Run-time package
+ *
* @since 9
* @spec JPMS
*/
@@ -2211,14 +2215,18 @@
}
/**
- * Returns all of the {@code Package}s defined by this class loader.
- * The returned array has no duplicated {@code Package}s of the same name.
+ * Returns all of the {@code Package}s that have been defined by
+ * this class loader. The returned array has no duplicated {@code Package}s
+ * of the same name.
*
* @apiNote This method returns an array rather than a {@code Set} or {@code Stream}
* for consistency with the existing {@link #getPackages} method.
*
- * @return The array of {@code Package} objects defined by this class loader;
- * or an zero length array if no package has been defined by this class loader.
+ * @return The array of {@code Package} objects that have been defined by
+ * this class loader; or an zero length array if no package has been
+ * defined by this class loader.
+ *
+ * @jvms 5.3 Run-time package
*
* @since 9
* @spec JPMS
@@ -2244,7 +2252,7 @@
* @param name
* The <a href="#name">package name</a>
*
- * @return The {@code Package} corresponding to the given name defined by
+ * @return The {@code Package} of the given name that has been defined by
* this class loader or its ancestors, or {@code null} if not found.
*
* @throws NullPointerException
@@ -2263,6 +2271,8 @@
* {@link ClassLoader#getDefinedPackage} method which returns
* a {@code Package} for the specified class loader.
*
+ * @see ClassLoader#getDefinedPackage(String)
+ *
* @since 1.2
* @revised 9
* @spec JPMS
@@ -2281,10 +2291,10 @@
}
/**
- * Returns all of the {@code Package}s defined by this class loader
- * and its ancestors. The returned array may contain more than one
- * {@code Package} object of the same package name, each defined by
- * a different class loader in the class loader hierarchy.
+ * Returns all of the {@code Package}s that have been defined by
+ * this class loader and its ancestors. The returned array may contain
+ * more than one {@code Package} object of the same package name, each
+ * defined by a different class loader in the class loader hierarchy.
*
* @apiNote The {@link #getPlatformClassLoader() platform class loader}
* may delegate to the application class loader. In other words,
@@ -2294,8 +2304,10 @@
* when invoked on the platform class loader, this method will not
* return any packages defined to the application class loader.
*
- * @return The array of {@code Package} objects defined by this
- * class loader and its ancestors
+ * @return The array of {@code Package} objects that have been defined by
+ * this class loader and its ancestors
+ *
+ * @see ClassLoader#getDefinedPackages()
*
* @since 1.2
* @revised 9
--- a/src/java.base/share/classes/java/lang/ProcessHandleImpl.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/java/lang/ProcessHandleImpl.java Thu Sep 28 09:13:27 2017 -0700
@@ -151,9 +151,9 @@
} catch (InterruptedException ie) {
// ignore and retry
}
- startTime = isAlive0(pid); // recheck if is alive
- if (origStart > 0 && startTime != origStart) {
- // start time changed, pid is not the same process
+ startTime = isAlive0(pid); // recheck if it is alive
+ if (startTime > 0 && origStart > 0 && startTime != origStart) {
+ // start time changed (and is not zero), pid is not the same process
break;
}
}
--- a/src/java.base/share/classes/java/lang/invoke/CallSite.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/java/lang/invoke/CallSite.java Thu Sep 28 09:13:27 2017 -0700
@@ -344,13 +344,21 @@
break;
default:
final int NON_SPREAD_ARG_COUNT = 3; // (caller, name, type)
- if (NON_SPREAD_ARG_COUNT + argv.length > MethodType.MAX_MH_ARITY)
- throw new BootstrapMethodError("too many bootstrap method arguments");
-
- MethodType invocationType = MethodType.genericMethodType(NON_SPREAD_ARG_COUNT + argv.length);
- MethodHandle typedBSM = bootstrapMethod.asType(invocationType);
- MethodHandle spreader = invocationType.invokers().spreadInvoker(NON_SPREAD_ARG_COUNT);
- binding = spreader.invokeExact(typedBSM, (Object) caller, (Object) name, (Object) type, argv);
+ final int MAX_SAFE_SIZE = MethodType.MAX_MH_ARITY / 2 - NON_SPREAD_ARG_COUNT;
+ if (argv.length >= MAX_SAFE_SIZE) {
+ // to be on the safe side, use invokeWithArguments which handles jumbo lists
+ Object[] newargv = new Object[NON_SPREAD_ARG_COUNT + argv.length];
+ newargv[0] = caller;
+ newargv[1] = name;
+ newargv[2] = type;
+ System.arraycopy(argv, 0, newargv, NON_SPREAD_ARG_COUNT, argv.length);
+ binding = bootstrapMethod.invokeWithArguments(newargv);
+ } else {
+ MethodType invocationType = MethodType.genericMethodType(NON_SPREAD_ARG_COUNT + argv.length);
+ MethodHandle typedBSM = bootstrapMethod.asType(invocationType);
+ MethodHandle spreader = invocationType.invokers().spreadInvoker(NON_SPREAD_ARG_COUNT);
+ binding = spreader.invokeExact(typedBSM, (Object) caller, (Object) name, (Object) type, argv);
+ }
}
}
if (binding instanceof CallSite) {
--- a/src/java.base/share/classes/java/lang/invoke/DelegatingMethodHandle.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/java/lang/invoke/DelegatingMethodHandle.java Thu Sep 28 09:13:27 2017 -0700
@@ -28,6 +28,7 @@
import java.util.Arrays;
import static java.lang.invoke.LambdaForm.*;
import static java.lang.invoke.LambdaForm.Kind.*;
+import static java.lang.invoke.MethodHandleNatives.Constants.REF_invokeVirtual;
import static java.lang.invoke.MethodHandleStatics.*;
/**
@@ -158,8 +159,11 @@
static final NamedFunction NF_getTarget;
static {
try {
- NF_getTarget = new NamedFunction(DelegatingMethodHandle.class
- .getDeclaredMethod("getTarget"));
+ MemberName member = new MemberName(DelegatingMethodHandle.class, "getTarget",
+ MethodType.methodType(MethodHandle.class), REF_invokeVirtual);
+ NF_getTarget = new NamedFunction(
+ MemberName.getFactory()
+ .resolveOrFail(REF_invokeVirtual, member, DelegatingMethodHandle.class, NoSuchMethodException.class));
} catch (ReflectiveOperationException ex) {
throw newInternalError(ex);
}
--- a/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java Thu Sep 28 09:13:27 2017 -0700
@@ -753,42 +753,38 @@
return nf;
}
+ private static final MethodType OBJ_OBJ_TYPE = MethodType.methodType(Object.class, Object.class);
+
+ private static final MethodType LONG_OBJ_TYPE = MethodType.methodType(long.class, Object.class);
+
private static NamedFunction createFunction(byte func) {
try {
switch (func) {
case NF_internalMemberName:
- return new NamedFunction(DirectMethodHandle.class
- .getDeclaredMethod("internalMemberName", Object.class));
+ return getNamedFunction("internalMemberName", OBJ_OBJ_TYPE);
case NF_internalMemberNameEnsureInit:
- return new NamedFunction(DirectMethodHandle.class
- .getDeclaredMethod("internalMemberNameEnsureInit", Object.class));
+ return getNamedFunction("internalMemberNameEnsureInit", OBJ_OBJ_TYPE);
case NF_ensureInitialized:
- return new NamedFunction(DirectMethodHandle.class
- .getDeclaredMethod("ensureInitialized", Object.class));
+ return getNamedFunction("ensureInitialized", MethodType.methodType(void.class, Object.class));
case NF_fieldOffset:
- return new NamedFunction(DirectMethodHandle.class
- .getDeclaredMethod("fieldOffset", Object.class));
+ return getNamedFunction("fieldOffset", LONG_OBJ_TYPE);
case NF_checkBase:
- return new NamedFunction(DirectMethodHandle.class
- .getDeclaredMethod("checkBase", Object.class));
+ return getNamedFunction("checkBase", OBJ_OBJ_TYPE);
case NF_staticBase:
- return new NamedFunction(DirectMethodHandle.class
- .getDeclaredMethod("staticBase", Object.class));
+ return getNamedFunction("staticBase", OBJ_OBJ_TYPE);
case NF_staticOffset:
- return new NamedFunction(DirectMethodHandle.class
- .getDeclaredMethod("staticOffset", Object.class));
+ return getNamedFunction("staticOffset", LONG_OBJ_TYPE);
case NF_checkCast:
- return new NamedFunction(DirectMethodHandle.class
- .getDeclaredMethod("checkCast", Object.class, Object.class));
+ return getNamedFunction("checkCast", MethodType.methodType(Object.class, Object.class, Object.class));
case NF_allocateInstance:
- return new NamedFunction(DirectMethodHandle.class
- .getDeclaredMethod("allocateInstance", Object.class));
+ return getNamedFunction("allocateInstance", OBJ_OBJ_TYPE);
case NF_constructorMethod:
- return new NamedFunction(DirectMethodHandle.class
- .getDeclaredMethod("constructorMethod", Object.class));
+ return getNamedFunction("constructorMethod", OBJ_OBJ_TYPE);
case NF_UNSAFE:
- return new NamedFunction(new MemberName(MethodHandleStatics.class
- .getDeclaredField("UNSAFE")));
+ MemberName member = new MemberName(MethodHandleStatics.class, "UNSAFE", Unsafe.class, REF_getField);
+ return new NamedFunction(
+ MemberName.getFactory()
+ .resolveOrFail(REF_getField, member, DirectMethodHandle.class, NoSuchMethodException.class));
default:
throw newInternalError("Unknown function: " + func);
}
@@ -797,6 +793,15 @@
}
}
+ private static NamedFunction getNamedFunction(String name, MethodType type)
+ throws ReflectiveOperationException
+ {
+ MemberName member = new MemberName(DirectMethodHandle.class, name, type, REF_invokeStatic);
+ return new NamedFunction(
+ MemberName.getFactory()
+ .resolveOrFail(REF_invokeStatic, member, DirectMethodHandle.class, NoSuchMethodException.class));
+ }
+
static {
// The Holder class will contain pre-generated DirectMethodHandles resolved
// speculatively using MemberName.getFactory().resolveOrNull. However, that
--- a/src/java.base/share/classes/java/lang/invoke/Invokers.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/java/lang/invoke/Invokers.java Thu Sep 28 09:13:27 2017 -0700
@@ -611,23 +611,17 @@
try {
switch (func) {
case NF_checkExactType:
- return new NamedFunction(Invokers.class
- .getDeclaredMethod("checkExactType", MethodHandle.class, MethodType.class));
+ return getNamedFunction("checkExactType", MethodType.methodType(void.class, MethodHandle.class, MethodType.class));
case NF_checkGenericType:
- return new NamedFunction(Invokers.class
- .getDeclaredMethod("checkGenericType", MethodHandle.class, MethodType.class));
+ return getNamedFunction("checkGenericType", MethodType.methodType(MethodHandle.class, MethodHandle.class, MethodType.class));
case NF_getCallSiteTarget:
- return new NamedFunction(Invokers.class
- .getDeclaredMethod("getCallSiteTarget", CallSite.class));
+ return getNamedFunction("getCallSiteTarget", MethodType.methodType(MethodHandle.class, CallSite.class));
case NF_checkCustomized:
- return new NamedFunction(Invokers.class
- .getDeclaredMethod("checkCustomized", MethodHandle.class));
+ return getNamedFunction("checkCustomized", MethodType.methodType(void.class, MethodHandle.class));
case NF_checkVarHandleGenericType:
- return new NamedFunction(Invokers.class
- .getDeclaredMethod("checkVarHandleGenericType", VarHandle.class, VarHandle.AccessDescriptor.class));
+ return getNamedFunction("checkVarHandleGenericType", MethodType.methodType(MethodHandle.class, VarHandle.class, VarHandle.AccessDescriptor.class));
case NF_checkVarHandleExactType:
- return new NamedFunction(Invokers.class
- .getDeclaredMethod("checkVarHandleExactType", VarHandle.class, VarHandle.AccessDescriptor.class));
+ return getNamedFunction("checkVarHandleExactType", MethodType.methodType(MethodHandle.class, VarHandle.class, VarHandle.AccessDescriptor.class));
default:
throw newInternalError("Unknown function: " + func);
}
@@ -636,6 +630,15 @@
}
}
+ private static NamedFunction getNamedFunction(String name, MethodType type)
+ throws ReflectiveOperationException
+ {
+ MemberName member = new MemberName(Invokers.class, name, type, REF_invokeStatic);
+ return new NamedFunction(
+ MemberName.getFactory()
+ .resolveOrFail(REF_invokeStatic, member, Invokers.class, NoSuchMethodException.class));
+ }
+
private static class Lazy {
private static final MethodHandle MH_asSpreader;
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandle.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandle.java Thu Sep 28 09:13:27 2017 -0700
@@ -584,10 +584,10 @@
/*non-public*/ static native @PolymorphicSignature Object linkToInterface(Object... args) throws Throwable;
/**
- * Performs a variable arity invocation, passing the arguments in the given list
+ * Performs a variable arity invocation, passing the arguments in the given array
* to the method handle, as if via an inexact {@link #invoke invoke} from a call site
- * which mentions only the type {@code Object}, and whose arity is the length
- * of the argument list.
+ * which mentions only the type {@code Object}, and whose actual argument count is the length
+ * of the argument array.
* <p>
* Specifically, execution proceeds as if by the following steps,
* although the methods are not guaranteed to be called if the JVM
@@ -595,36 +595,104 @@
* <ul>
* <li>Determine the length of the argument array as {@code N}.
* For a null reference, {@code N=0}. </li>
- * <li>Determine the general type {@code TN} of {@code N} arguments as
- * as {@code TN=MethodType.genericMethodType(N)}.</li>
+ * <li>Collect the {@code N} elements of the array as a logical
+ * argument list, each argument statically typed as an {@code Object}. </li>
+ * <li>Determine, as {@code M}, the parameter count of the type of this
+ * method handle. </li>
+ * <li>Determine the general type {@code TN} of {@code N} arguments or
+ * {@code M} arguments, if smaller than {@code N}, as
+ * {@code TN=MethodType.genericMethodType(Math.min(N, M))}.</li>
+ * <li>If {@code N} is greater than {@code M}, perform the following
+ * checks and actions to shorten the logical argument list: <ul>
+ * <li>Check that this method handle has variable arity with a
+ * {@linkplain MethodType#lastParameterType trailing parameter}
+ * of some array type {@code A[]}. If not, fail with a
+ * {@code WrongMethodTypeException}. </li>
+ * <li>Collect the trailing elements (there are {@code N-M+1} of them)
+ * from the logical argument list into a single array of
+ * type {@code A[]}, using {@code asType} conversions to
+ * convert each trailing argument to type {@code A}. </li>
+ * <li>If any of these conversions proves impossible, fail with either
+ * a {@code ClassCastException} if any trailing element cannot be
+ * cast to {@code A} or a {@code NullPointerException} if any
+ * trailing element is {@code null} and {@code A} is not a reference
+ * type. </li>
+ * <li>Replace the logical arguments gathered into the array of
+ * type {@code A[]} with the array itself, thus shortening
+ * the argument list to length {@code M}. This final argument
+ * retains the static type {@code A[]}.</li>
+ * <li>Adjust the type {@code TN} by changing the {@code N}th
+ * parameter type from {@code Object} to {@code A[]}.
+ * </ul>
* <li>Force the original target method handle {@code MH0} to the
* required type, as {@code MH1 = MH0.asType(TN)}. </li>
- * <li>Spread the array into {@code N} separate arguments {@code A0, ...}. </li>
+ * <li>Spread the argument list into {@code N} separate arguments {@code A0, ...}. </li>
* <li>Invoke the type-adjusted method handle on the unpacked arguments:
* MH1.invokeExact(A0, ...). </li>
* <li>Take the return value as an {@code Object} reference. </li>
* </ul>
* <p>
+ * If the target method handle has variable arity, and the argument list is longer
+ * than that arity, the excess arguments, starting at the position of the trailing
+ * array argument, will be gathered (if possible, as if by {@code asType} conversions)
+ * into an array of the appropriate type, and invocation will proceed on the
+ * shortened argument list.
+ * In this way, <em>jumbo argument lists</em> which would spread into more
+ * than 254 slots can still be processed uniformly.
+ * <p>
+ * Unlike the {@link #invoke(Object...) generic} invocation mode, which can
+ * "recycle" an array argument, passing it directly to the target method,
+ * this invocation mode <em>always</em> creates a new array parameter, even
+ * if the original array passed to {@code invokeWithArguments} would have
+ * been acceptable as a direct argument to the target method.
+ * Even if the number {@code M} of actual arguments is the arity {@code N},
+ * and the last argument is dynamically a suitable array of type {@code A[]},
+ * it will still be boxed into a new one-element array, since the call
+ * site statically types the argument as {@code Object}, not an array type.
+ * This is not a special rule for this method, but rather a regular effect
+ * of the {@linkplain #asVarargsCollector rules for variable-arity invocation}.
+ * <p>
* Because of the action of the {@code asType} step, the following argument
* conversions are applied as necessary:
* <ul>
* <li>reference casting
* <li>unboxing
* <li>widening primitive conversions
+ * <li>variable arity conversion
* </ul>
* <p>
* The result returned by the call is boxed if it is a primitive,
* or forced to null if the return type is void.
* <p>
- * This call is equivalent to the following code:
+ * Unlike the signature polymorphic methods {@code invokeExact} and {@code invoke},
+ * {@code invokeWithArguments} can be accessed normally via the Core Reflection API and JNI.
+ * It can therefore be used as a bridge between native or reflective code and method handles.
+ * @apiNote
+ * This call is approximately equivalent to the following code:
* <blockquote><pre>{@code
+ * // for jumbo argument lists, adapt varargs explicitly:
+ * int N = (arguments == null? 0: arguments.length);
+ * int M = this.type.parameterCount();
+ * int MAX_SAFE = 127; // 127 longs require 254 slots, which is OK
+ * if (N > MAX_SAFE && N > M && this.isVarargsCollector()) {
+ * Class<?> arrayType = this.type().lastParameterType();
+ * Class<?> elemType = arrayType.getComponentType();
+ * if (elemType != null) {
+ * Object args2 = Array.newInstance(elemType, M);
+ * MethodHandle arraySetter = MethodHandles.arrayElementSetter(arrayType);
+ * for (int i = 0; i < M; i++) {
+ * arraySetter.invoke(args2, i, arguments[M-1 + i]);
+ * }
+ * arguments = Arrays.copyOf(arguments, M);
+ * arguments[M-1] = args2;
+ * return this.asFixedArity().invokeWithArguments(arguments);
+ * }
+ * } // done with explicit varargs processing
+ *
+ * // Handle fixed arity and non-jumbo variable arity invocation.
* MethodHandle invoker = MethodHandles.spreadInvoker(this.type(), 0);
* Object result = invoker.invokeExact(this, arguments);
* }</pre></blockquote>
- * <p>
- * Unlike the signature polymorphic methods {@code invokeExact} and {@code invoke},
- * {@code invokeWithArguments} can be accessed normally via the Core Reflection API and JNI.
- * It can therefore be used as a bridge between native or reflective code and method handles.
*
* @param arguments the arguments to pass to the target
* @return the result returned by the target
@@ -634,20 +702,24 @@
* @see MethodHandles#spreadInvoker
*/
public Object invokeWithArguments(Object... arguments) throws Throwable {
+ // Note: Jumbo argument lists are handled in the variable-arity subclass.
MethodType invocationType = MethodType.genericMethodType(arguments == null ? 0 : arguments.length);
return invocationType.invokers().spreadInvoker(0).invokeExact(asType(invocationType), arguments);
}
/**
- * Performs a variable arity invocation, passing the arguments in the given array
+ * Performs a variable arity invocation, passing the arguments in the given list
* to the method handle, as if via an inexact {@link #invoke invoke} from a call site
- * which mentions only the type {@code Object}, and whose arity is the length
- * of the argument array.
+ * which mentions only the type {@code Object}, and whose actual argument count is the length
+ * of the argument list.
* <p>
* This method is also equivalent to the following code:
* <blockquote><pre>{@code
* invokeWithArguments(arguments.toArray())
* }</pre></blockquote>
+ * <p>
+ * Jumbo-sized lists are acceptable if this method handle has variable arity.
+ * See {@link #invokeWithArguments(Object[])} for details.
*
* @param arguments the arguments to pass to the target
* @return the result returned by the target
@@ -987,6 +1059,16 @@
* disturbing its variable arity property:
* {@code mh.asType(mh.type().changeParameterType(0,int.class))
* .withVarargs(mh.isVarargsCollector())}
+ * <p>
+ * This call is approximately equivalent to the following code:
+ * <blockquote><pre>{@code
+ * if (makeVarargs == isVarargsCollector())
+ * return this;
+ * else if (makeVarargs)
+ * return asVarargsCollector(type().lastParameterType());
+ * else
+ * return return asFixedArity();
+ * }</pre></blockquote>
* @param makeVarargs true if the return method handle should have variable arity behavior
* @return a method handle of the same type, with possibly adjusted variable arity behavior
* @throws IllegalArgumentException if {@code makeVarargs} is true and
@@ -995,11 +1077,10 @@
* @see #asVarargsCollector
* @see #asFixedArity
*/
- public MethodHandle withVarargs(boolean makeVarargs) {
- if (!makeVarargs) {
- return asFixedArity();
- } else if (!isVarargsCollector()) {
- return asVarargsCollector(type().lastParameterType());
+ public MethodHandle withVarargs(boolean makeVarargs) {
+ assert(!isVarargsCollector()); // subclass responsibility
+ if (makeVarargs) {
+ return asVarargsCollector(type().lastParameterType());
} else {
return this;
}
@@ -1026,8 +1107,9 @@
* <p>
* (The array may also be a shared constant when {@code arrayLength} is zero.)
* <p>
- * (<em>Note:</em> The {@code arrayType} is often identical to the last
- * parameter type of the original target.
+ * (<em>Note:</em> The {@code arrayType} is often identical to the
+ * {@linkplain MethodType#lastParameterType last parameter type}
+ * of the original target.
* It is an explicit argument for symmetry with {@code asSpreader}, and also
* to allow the target to use a simple {@code Object} as its last parameter type.)
* <p>
@@ -1168,7 +1250,9 @@
* {@code invoke} and {@code asType} requests can lead to
* trailing positional arguments being collected into target's
* trailing parameter.
- * Also, the last parameter type of the adapter will be
+ * Also, the
+ * {@linkplain MethodType#lastParameterType last parameter type}
+ * of the adapter will be
* {@code arrayType}, even if the target has a different
* last parameter type.
* <p>
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java Thu Sep 28 09:13:27 2017 -0700
@@ -524,6 +524,12 @@
}
@Override
+ public MethodHandle withVarargs(boolean makeVarargs) {
+ if (makeVarargs) return this;
+ return asFixedArity();
+ }
+
+ @Override
public MethodHandle asTypeUncached(MethodType newType) {
MethodType type = this.type();
int collectArg = type.parameterCount() - 1;
@@ -561,6 +567,49 @@
: Arrays.asList(this, newType);
return true;
}
+
+ @Override
+ public Object invokeWithArguments(Object... arguments) throws Throwable {
+ MethodType type = this.type();
+ int argc;
+ final int MAX_SAFE = 127; // 127 longs require 254 slots, which is safe to spread
+ if (arguments == null
+ || (argc = arguments.length) <= MAX_SAFE
+ || argc < type.parameterCount()) {
+ return super.invokeWithArguments(arguments);
+ }
+
+ // a jumbo invocation requires more explicit reboxing of the trailing arguments
+ int uncollected = type.parameterCount() - 1;
+ Class<?> elemType = arrayType.getComponentType();
+ int collected = argc - uncollected;
+ Object collArgs = (elemType == Object.class)
+ ? new Object[collected] : Array.newInstance(elemType, collected);
+ if (!elemType.isPrimitive()) {
+ // simple cast: just do some casting
+ try {
+ System.arraycopy(arguments, uncollected, collArgs, 0, collected);
+ } catch (ArrayStoreException ex) {
+ return super.invokeWithArguments(arguments);
+ }
+ } else {
+ // corner case of flat array requires reflection (or specialized copy loop)
+ MethodHandle arraySetter = MethodHandles.arrayElementSetter(arrayType);
+ try {
+ for (int i = 0; i < collected; i++) {
+ arraySetter.invoke(collArgs, i, arguments[uncollected + i]);
+ }
+ } catch (WrongMethodTypeException|ClassCastException ex) {
+ return super.invokeWithArguments(arguments);
+ }
+ }
+
+ // chop the jumbo list down to size and call in non-varargs mode
+ Object[] newArgs = new Object[uncollected + 1];
+ System.arraycopy(arguments, 0, newArgs, 0, uncollected);
+ newArgs[uncollected] = collArgs;
+ return asFixedArity().invokeWithArguments(newArgs);
+ }
}
/** Factory method: Spread selected argument. */
--- a/src/java.base/share/classes/java/lang/invoke/MethodType.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/java/lang/invoke/MethodType.java Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -759,7 +759,23 @@
return Collections.unmodifiableList(Arrays.asList(ptypes.clone()));
}
- /*non-public*/ Class<?> lastParameterType() {
+ /**
+ * Returns the last parameter type of this method type.
+ * If this type has no parameters, the sentinel value
+ * {@code void.class} is returned instead.
+ * @apiNote
+ * <p>
+ * The sentinel value is chosen so that reflective queries can be
+ * made directly against the result value.
+ * The sentinel value cannot be confused with a real parameter,
+ * since {@code void} is never acceptable as a parameter type.
+ * For variable arity invocation modes, the expression
+ * {@link Class#getComponentType lastParameterType().getComponentType()}
+ * is useful to query the type of the "varargs" parameter.
+ * @return the last parameter type if any, else {@code void.class}
+ * @since 10
+ */
+ public Class<?> lastParameterType() {
int len = ptypes.length;
return len == 0 ? void.class : ptypes[len-1];
}
--- a/src/java.base/share/classes/java/lang/invoke/package-info.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/java/lang/invoke/package-info.java Thu Sep 28 09:13:27 2017 -0700
@@ -81,12 +81,19 @@
* in which dynamic call site occurs </li>
* <li>a {@code String}, the method name mentioned in the call site </li>
* <li>a {@code MethodType}, the resolved type descriptor of the call </li>
- * <li>optionally, between 1 and 251 additional static arguments taken from the constant pool </li>
+ * <li>optionally, any number of additional static arguments taken from the constant pool </li>
* </ul>
- * Invocation is as if by
- * {@link java.lang.invoke.MethodHandle#invoke MethodHandle.invoke}.
- * The returned result must be a {@link java.lang.invoke.CallSite CallSite}
- * (or a subclass), otherwise a
+ * <p>
+ * In all cases, bootstrap method invocation is as if by
+ * {@link java.lang.invoke.MethodHandle#invokeWithArguments MethodHandle.invokeWithArguments},
+ * (This is also equivalent to
+ * {@linkplain java.lang.invoke.MethodHandle#invoke generic invocation}
+ * if the number of arguments is small enough.)
+ * <p>
+ * For an {@code invokedynamic} instruction, the
+ * returned result must be convertible to a non-null reference to a
+ * {@link java.lang.invoke.CallSite CallSite}.
+ * If the returned result cannot be converted to the expected type,
* {@link java.lang.BootstrapMethodError BootstrapMethodError} is thrown.
* The type of the call site's target must be exactly equal to the type
* derived from the dynamic call site's type descriptor and passed to
@@ -150,10 +157,12 @@
* If the {@code invokedynamic} instruction specifies one or more static arguments,
* those values will be passed as additional arguments to the method handle.
* (Note that because there is a limit of 255 arguments to any method,
- * at most 251 extra arguments can be supplied, since the bootstrap method
+ * at most 251 extra arguments can be supplied to a non-varargs bootstrap method,
+ * since the bootstrap method
* handle itself and its first three arguments must also be stacked.)
- * The bootstrap method will be invoked as if by either {@code MethodHandle.invoke}
- * or {@code invokeWithArguments}. (There is no way to tell the difference.)
+ * The bootstrap method will be invoked as if by {@code MethodHandle.invokeWithArguments}.
+ * A variable-arity bootstrap method can accept thousands of static arguments,
+ * subject only by limits imposed by the class-file format.
* <p>
* The normal argument conversion rules for {@code MethodHandle.invoke} apply to all stacked arguments.
* For example, if a pushed value is a primitive type, it may be converted to a reference by boxing conversion.
@@ -194,9 +203,9 @@
* </tbody>
* </table>
* The last example assumes that the extra arguments are of type
- * {@code CONSTANT_String} and {@code CONSTANT_Integer}, respectively.
+ * {@code String} and {@code Integer} (or {@code int}), respectively.
* The second-to-last example assumes that all extra arguments are of type
- * {@code CONSTANT_String}.
+ * {@code String}.
* The other examples work with all types of extra arguments.
* <p>
* As noted above, the actual method type of the bootstrap method can vary.
@@ -220,7 +229,7 @@
* to safely and compactly encode metadata.
* In principle, the name and extra arguments are redundant,
* since each call site could be given its own unique bootstrap method.
- * Such a practice is likely to produce large class files and constant pools.
+ * Such a practice would be likely to produce large class files and constant pools.
*
* @author John Rose, JSR 292 EG
* @since 1.7
--- a/src/java.base/share/classes/java/util/zip/ZipFile.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/java/util/zip/ZipFile.java Thu Sep 28 09:13:27 2017 -0700
@@ -1122,30 +1122,36 @@
zerror("zip comment read failed");
}
}
- if (end.cenlen == ZIP64_MAGICVAL ||
- end.cenoff == ZIP64_MAGICVAL ||
- end.centot == ZIP64_MAGICCOUNT)
- {
- // need to find the zip64 end;
- try {
- byte[] loc64 = new byte[ZIP64_LOCHDR];
- if (readFullyAt(loc64, 0, loc64.length, end.endpos - ZIP64_LOCHDR)
- != loc64.length || GETSIG(loc64) != ZIP64_LOCSIG) {
- return end;
- }
- long end64pos = ZIP64_LOCOFF(loc64);
- byte[] end64buf = new byte[ZIP64_ENDHDR];
- if (readFullyAt(end64buf, 0, end64buf.length, end64pos)
- != end64buf.length || GETSIG(end64buf) != ZIP64_ENDSIG) {
- return end;
- }
- // end64 found, re-calcualte everything.
- end.cenlen = ZIP64_ENDSIZ(end64buf);
- end.cenoff = ZIP64_ENDOFF(end64buf);
- end.centot = (int)ZIP64_ENDTOT(end64buf); // assume total < 2g
- end.endpos = end64pos;
- } catch (IOException x) {} // no zip64 loc/end
- }
+ // must check for a zip64 end record; it is always permitted to be present
+ try {
+ byte[] loc64 = new byte[ZIP64_LOCHDR];
+ if (end.endpos < ZIP64_LOCHDR ||
+ readFullyAt(loc64, 0, loc64.length, end.endpos - ZIP64_LOCHDR)
+ != loc64.length || GETSIG(loc64) != ZIP64_LOCSIG) {
+ return end;
+ }
+ long end64pos = ZIP64_LOCOFF(loc64);
+ byte[] end64buf = new byte[ZIP64_ENDHDR];
+ if (readFullyAt(end64buf, 0, end64buf.length, end64pos)
+ != end64buf.length || GETSIG(end64buf) != ZIP64_ENDSIG) {
+ return end;
+ }
+ // end64 candidate found,
+ long cenlen64 = ZIP64_ENDSIZ(end64buf);
+ long cenoff64 = ZIP64_ENDOFF(end64buf);
+ long centot64 = ZIP64_ENDTOT(end64buf);
+ // double-check
+ if (cenlen64 != end.cenlen && end.cenlen != ZIP64_MAGICVAL ||
+ cenoff64 != end.cenoff && end.cenoff != ZIP64_MAGICVAL ||
+ centot64 != end.centot && end.centot != ZIP64_MAGICCOUNT) {
+ return end;
+ }
+ // to use the end64 values
+ end.cenlen = cenlen64;
+ end.cenoff = cenoff64;
+ end.centot = (int)centot64; // assume total < 2g
+ end.endpos = end64pos;
+ } catch (IOException x) {} // no zip64 loc/end
return end;
}
}
--- a/src/java.base/share/classes/jdk/internal/misc/JavaIOFileDescriptorAccess.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/jdk/internal/misc/JavaIOFileDescriptorAccess.java Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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,12 +31,13 @@
*/
public interface JavaIOFileDescriptorAccess {
- public void set(FileDescriptor obj, int fd);
- public int get(FileDescriptor fd);
- public void setAppend(FileDescriptor obj, boolean append);
- public boolean getAppend(FileDescriptor obj);
+ public void set(FileDescriptor fdo, int fd);
+ public int get(FileDescriptor fdo);
+ public void setAppend(FileDescriptor fdo, boolean append);
+ public boolean getAppend(FileDescriptor fdo);
+ public void close(FileDescriptor fdo);
// Only valid on Windows
- public void setHandle(FileDescriptor obj, long handle);
- public long getHandle(FileDescriptor obj);
+ public void setHandle(FileDescriptor fdo, long handle);
+ public long getHandle(FileDescriptor fdo);
}
--- a/src/java.base/share/classes/module-info.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/module-info.java Thu Sep 28 09:13:27 2017 -0700
@@ -271,7 +271,6 @@
java.rmi,
java.security.jgss,
jdk.crypto.cryptoki,
- jdk.policytool,
jdk.security.auth;
exports sun.security.provider.certpath to
java.naming;
@@ -294,7 +293,6 @@
jdk.crypto.ec,
jdk.crypto.cryptoki,
jdk.jartool,
- jdk.policytool,
jdk.security.auth,
jdk.security.jgss;
exports sun.security.x509 to
--- a/src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2016, 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
@@ -144,7 +144,7 @@
//
((java.io.Closeable)parent).close();
} else {
- nd.close(fd);
+ fdAccess.close(fd);
}
}
--- a/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java Thu Sep 28 09:13:27 2017 -0700
@@ -1802,7 +1802,12 @@
try {
readRecord(true);
} catch (SocketTimeoutException e) {
- // if time out, ignore the exception and continue
+ if ((debug != null) && Debug.isOn("ssl")) {
+ System.out.println(
+ Thread.currentThread().getName() +
+ ", received Exception: " + e);
+ }
+ fatal((byte)(-1), "Did not receive close_notify from peer", e);
}
}
} catch (IOException e) {
--- a/src/java.base/share/classes/sun/security/util/ManifestDigester.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/sun/security/util/ManifestDigester.java Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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 java.security.*;
import java.util.HashMap;
import java.io.ByteArrayOutputStream;
+import static java.nio.charset.StandardCharsets.UTF_8;
/**
* This class is used to compute digests on sections of the Manifest.
@@ -112,8 +113,6 @@
rawBytes = bytes;
entries = new HashMap<>();
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
Position pos = new Position();
if (!findSection(0, pos))
@@ -131,50 +130,41 @@
if (len > 6) {
if (isNameAttr(bytes, start)) {
- StringBuilder nameBuf = new StringBuilder(sectionLen);
-
- try {
- nameBuf.append(
- new String(bytes, start+6, len-6, "UTF8"));
+ ByteArrayOutputStream nameBuf = new ByteArrayOutputStream();
+ nameBuf.write(bytes, start+6, len-6);
- int i = start + len;
- if ((i-start) < sectionLen) {
- if (bytes[i] == '\r') {
- i += 2;
- } else {
- i += 1;
- }
+ int i = start + len;
+ if ((i-start) < sectionLen) {
+ if (bytes[i] == '\r') {
+ i += 2;
+ } else {
+ i += 1;
}
+ }
- while ((i-start) < sectionLen) {
- if (bytes[i++] == ' ') {
- // name is wrapped
- int wrapStart = i;
- while (((i-start) < sectionLen)
- && (bytes[i++] != '\n'));
- if (bytes[i-1] != '\n')
- return; // XXX: exception?
- int wrapLen;
- if (bytes[i-2] == '\r')
- wrapLen = i-wrapStart-2;
- else
- wrapLen = i-wrapStart-1;
+ while ((i-start) < sectionLen) {
+ if (bytes[i++] == ' ') {
+ // name is wrapped
+ int wrapStart = i;
+ while (((i-start) < sectionLen)
+ && (bytes[i++] != '\n'));
+ if (bytes[i-1] != '\n')
+ return; // XXX: exception?
+ int wrapLen;
+ if (bytes[i-2] == '\r')
+ wrapLen = i-wrapStart-2;
+ else
+ wrapLen = i-wrapStart-1;
- nameBuf.append(new String(bytes, wrapStart,
- wrapLen, "UTF8"));
- } else {
- break;
- }
+ nameBuf.write(bytes, wrapStart, wrapLen);
+ } else {
+ break;
}
+ }
- entries.put(nameBuf.toString(),
- new Entry(start, sectionLen, sectionLenWithBlank,
+ entries.put(new String(nameBuf.toByteArray(), UTF_8),
+ new Entry(start, sectionLen, sectionLenWithBlank,
rawBytes));
-
- } catch (java.io.UnsupportedEncodingException uee) {
- throw new IllegalStateException(
- "UTF8 not available on platform");
- }
}
}
start = pos.startOfNext;
--- a/src/java.base/share/classes/sun/security/util/PolicyUtil.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/sun/security/util/PolicyUtil.java Thu Sep 28 09:13:27 2017 -0700
@@ -64,7 +64,7 @@
}
/**
- * this is intended for use by policytool and the policy parser to
+ * this is intended for use by the policy parser to
* instantiate a KeyStore from the information in the GUI/policy file
*/
public static KeyStore getKeyStore
--- a/src/java.base/share/lib/security/default.policy Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/lib/security/default.policy Thu Sep 28 09:13:27 2017 -0700
@@ -142,6 +142,10 @@
permission java.security.AllPermission;
};
+grant codeBase "jrt:/jdk.httpserver" {
+ permission java.security.AllPermission;
+};
+
grant codeBase "jrt:/jdk.internal.le" {
permission java.security.AllPermission;
};
--- a/src/java.base/share/native/libjli/java.c Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/native/libjli/java.c Thu Sep 28 09:13:27 2017 -0700
@@ -1517,6 +1517,7 @@
}
str = (*env)->CallStaticObjectMethod(env, cls,
makePlatformStringMID, USE_STDERR, ary);
+ CHECK_EXCEPTION_RETURN_VALUE(0);
(*env)->DeleteLocalRef(env, ary);
return str;
}
@@ -1585,13 +1586,16 @@
GetApplicationClass(JNIEnv *env)
{
jmethodID mid;
+ jclass appClass;
jclass cls = GetLauncherHelperClass(env);
NULL_CHECK0(cls);
NULL_CHECK0(mid = (*env)->GetStaticMethodID(env, cls,
"getApplicationClass",
"()Ljava/lang/Class;"));
- return (*env)->CallStaticObjectMethod(env, cls, mid);
+ appClass = (*env)->CallStaticObjectMethod(env, cls, mid);
+ CHECK_EXCEPTION_RETURN_VALUE(0);
+ return appClass;
}
static char* expandWildcardOnLongOpt(char* arg) {
--- a/src/java.base/unix/classes/java/io/FileDescriptor.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/unix/classes/java/io/FileDescriptor.java Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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
@@ -33,16 +33,13 @@
/**
* Instances of the file descriptor class serve as an opaque handle
* to the underlying machine-specific structure representing an open
- * file, an open socket, or another source or sink of bytes. The
- * main practical use for a file descriptor is to create a
- * <code>FileInputStream</code> or <code>FileOutputStream</code> to
- * contain it.
+ * file, an open socket, or another source or sink of bytes.
+ * The main practical use for a file descriptor is to create a
+ * {@link FileInputStream} or {@link FileOutputStream} to contain it.
* <p>
* Applications should not create their own file descriptors.
*
* @author Pavani Diwanji
- * @see java.io.FileInputStream
- * @see java.io.FileOutputStream
* @since 1.0
*/
public final class FileDescriptor {
@@ -58,6 +55,45 @@
*/
private boolean append;
+ static {
+ initIDs();
+ }
+
+ // Set up JavaIOFileDescriptorAccess in SharedSecrets
+ static {
+ SharedSecrets.setJavaIOFileDescriptorAccess(
+ new JavaIOFileDescriptorAccess() {
+ public void set(FileDescriptor fdo, int fd) {
+ fdo.fd = fd;
+ }
+
+ public int get(FileDescriptor fdo) {
+ return fdo.fd;
+ }
+
+ public void setAppend(FileDescriptor fdo, boolean append) {
+ fdo.append = append;
+ }
+
+ public boolean getAppend(FileDescriptor fdo) {
+ return fdo.append;
+ }
+
+ public void close(FileDescriptor fdo) {
+ fdo.close();
+ }
+
+ public void setHandle(FileDescriptor fdo, long handle) {
+ throw new UnsupportedOperationException();
+ }
+
+ public long getHandle(FileDescriptor fdo) {
+ throw new UnsupportedOperationException();
+ }
+ }
+ );
+ }
+
/**
* Constructs an (invalid) FileDescriptor
* object.
@@ -74,7 +110,7 @@
/**
* A handle to the standard input stream. Usually, this file
* descriptor is not used directly, but rather via the input stream
- * known as <code>System.in</code>.
+ * known as {@code System.in}.
*
* @see java.lang.System#in
*/
@@ -83,7 +119,7 @@
/**
* A handle to the standard output stream. Usually, this file
* descriptor is not used directly, but rather via the output stream
- * known as <code>System.out</code>.
+ * known as {@code System.out}.
* @see java.lang.System#out
*/
public static final FileDescriptor out = new FileDescriptor(1);
@@ -91,7 +127,7 @@
/**
* A handle to the standard error stream. Usually, this file
* descriptor is not used directly, but rather via the output stream
- * known as <code>System.err</code>.
+ * known as {@code System.err}.
*
* @see java.lang.System#err
*/
@@ -100,9 +136,9 @@
/**
* Tests if this file descriptor object is valid.
*
- * @return <code>true</code> if the file descriptor object represents a
+ * @return {@code true} if the file descriptor object represents a
* valid, open file, socket, or other active I/O connection;
- * <code>false</code> otherwise.
+ * {@code false} otherwise.
*/
public boolean valid() {
return fd != -1;
@@ -141,46 +177,18 @@
/* This routine initializes JNI field offsets for the class */
private static native void initIDs();
- static {
- initIDs();
- }
-
- // Set up JavaIOFileDescriptorAccess in SharedSecrets
- static {
- SharedSecrets.setJavaIOFileDescriptorAccess(
- new JavaIOFileDescriptorAccess() {
- public void set(FileDescriptor obj, int fd) {
- obj.fd = fd;
- }
-
- public int get(FileDescriptor obj) {
- return obj.fd;
- }
-
- public void setAppend(FileDescriptor obj, boolean append) {
- obj.append = append;
- }
-
- public boolean getAppend(FileDescriptor obj) {
- return obj.append;
- }
-
- public void setHandle(FileDescriptor obj, long handle) {
- throw new UnsupportedOperationException();
- }
-
- public long getHandle(FileDescriptor obj) {
- throw new UnsupportedOperationException();
- }
- }
- );
- }
-
/**
* Returns true, if the file was opened for appending.
*/
private static native boolean getAppend(int fd);
+ /**
+ * Close the raw file descriptor or handle, if it has not already been closed
+ * and set the fd and handle to -1.
+ * Package private to allow it to be used in java.io.
+ */
+ native void close();
+
/*
* Package private methods to track referents.
* If multiple streams point to the same FileDescriptor, we cycle
--- a/src/java.base/unix/classes/sun/nio/ch/FileDispatcherImpl.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/unix/classes/sun/nio/ch/FileDispatcherImpl.java Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2016, 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
@@ -28,6 +28,9 @@
import java.io.FileDescriptor;
import java.io.IOException;
+import jdk.internal.misc.JavaIOFileDescriptorAccess;
+import jdk.internal.misc.SharedSecrets;
+
class FileDispatcherImpl extends FileDispatcher {
static {
@@ -35,6 +38,9 @@
init();
}
+ private static final JavaIOFileDescriptorAccess fdAccess =
+ SharedSecrets.getJavaIOFileDescriptorAccess();
+
FileDispatcherImpl() {
}
@@ -95,7 +101,7 @@
}
void close(FileDescriptor fd) throws IOException {
- close0(fd);
+ fdAccess.close(fd);
}
void preClose(FileDescriptor fd) throws IOException {
@@ -153,6 +159,8 @@
static native void release0(FileDescriptor fd, long pos, long size)
throws IOException;
+ // Shared with SocketDispatcher and DatagramDispatcher but
+ // NOT used by FileDispatcherImpl
static native void close0(FileDescriptor fd) throws IOException;
static native void preClose0(FileDescriptor fd) throws IOException;
--- a/src/java.base/unix/native/libjava/FileDescriptor_md.c Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/unix/native/libjava/FileDescriptor_md.c Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -70,3 +70,9 @@
int flags = fcntl(fd, F_GETFL);
return ((flags & O_APPEND) == 0) ? JNI_FALSE : JNI_TRUE;
}
+
+// instance method close0 for FileDescriptor
+JNIEXPORT void JNICALL
+Java_java_io_FileDescriptor_close(JNIEnv *env, jobject this) {
+ fileDescriptorClose(env, this);
+}
--- a/src/java.base/unix/native/libjava/FileInputStream_md.c Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * 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.
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-#include "jni.h"
-#include "jni_util.h"
-#include "jvm.h"
-#include "io_util.h"
-#include "io_util_md.h"
-
-#include "java_io_FileInputStream.h"
-
-extern jfieldID fis_fd; /* id for jobject 'fd' in java.io.FileInputStream */
-
-/*********************************************************************
- * Platform specific implementation of input stream native methods
- */
-
-JNIEXPORT void JNICALL
-Java_java_io_FileInputStream_close0(JNIEnv *env, jobject this) {
- fileClose(env, this, fis_fd);
-}
--- a/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c Thu Sep 28 09:13:27 2017 -0700
@@ -662,7 +662,7 @@
return -1;
}
- // Validate the pid before returning the info in case /proc/pid is racy
+ // Validate the pid before returning the info
if (kill(pid, 0) < 0) {
return -1;
}
--- a/src/java.base/unix/native/libjava/RandomAccessFile_md.c Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * 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.
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-#include "jni.h"
-#include "jni_util.h"
-#include "jvm.h"
-#include "io_util.h"
-#include "io_util_md.h"
-
-#include "java_io_RandomAccessFile.h"
-
-extern jfieldID raf_fd; /* id for jobject 'fd' in java.io.RandomAccessFile */
-
-/*********************************************************************
- * Platform specific implementation of input stream native methods
- */
-
-JNIEXPORT void JNICALL
-Java_java_io_RandomAccessFile_close0(JNIEnv *env, jobject this) {
- fileClose(env, this, raf_fd);
-}
--- a/src/java.base/unix/native/libjava/io_util_md.c Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/unix/native/libjava/io_util_md.c Thu Sep 28 09:13:27 2017 -0700
@@ -124,19 +124,31 @@
void
fileClose(JNIEnv *env, jobject this, jfieldID fid)
{
- FD fd = GET_FD(this, fid);
- if (fd == -1) {
+ jobject fileDescriptor = (*env)->GetObjectField(env, (this), (fid));
+ if (fileDescriptor == NULL) {
return;
}
+ fileDescriptorClose(env, fileDescriptor);
+}
+// Function to close the fd held by this FileDescriptor and set fd to -1.
+void
+fileDescriptorClose(JNIEnv *env, jobject this)
+{
+ FD fd = (*env)->GetIntField(env, this, IO_fd_fdID);
+ if ((*env)->ExceptionOccurred(env)) {
+ return;
+ }
/* Set the fd to -1 before closing it so that the timing window
* of other threads using the wrong fd (closed but recycled fd,
* that gets re-opened with some other filename) is reduced.
* Practically the chance of its occurance is low, however, we are
* taking extra precaution over here.
*/
- SET_FD(this, -1, fid);
-
+ (*env)->SetIntField(env, this, IO_fd_fdID, -1);
+ if ((*env)->ExceptionOccurred(env)) {
+ return;
+ }
/*
* Don't close file descriptors 0, 1, or 2. If we close these stream
* then a subsequent file open or socket will use them. Instead we
@@ -145,7 +157,7 @@
if (fd >= STDIN_FILENO && fd <= STDERR_FILENO) {
int devnull = open("/dev/null", O_WRONLY);
if (devnull < 0) {
- SET_FD(this, fd, fid); // restore fd
+ (*env)->SetIntField(env, this, IO_fd_fdID, fd);
JNU_ThrowIOExceptionWithLastError(env, "open /dev/null failed");
} else {
dup2(devnull, fd);
--- a/src/java.base/unix/native/libjava/io_util_md.h Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/unix/native/libjava/io_util_md.h Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, 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
@@ -103,6 +103,7 @@
* IO helper function(s)
*/
void fileClose(JNIEnv *env, jobject this, jfieldID fid);
+void fileDescriptorClose(JNIEnv *env, jobject this);
#ifdef MACOSX
jstring newStringPlatform(JNIEnv *env, const char* str);
--- a/src/java.base/unix/native/libnet/PlainSocketImpl.c Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/unix/native/libnet/PlainSocketImpl.c Thu Sep 28 09:13:27 2017 -0700
@@ -679,14 +679,16 @@
}
/* ECONNABORTED or EWOULDBLOCK error so adjust timeout if there is one. */
- currNanoTime = JVM_NanoTime(env, 0);
- nanoTimeout -= (currNanoTime - prevNanoTime);
- if (nanoTimeout < NET_NSEC_PER_MSEC) {
- JNU_ThrowByName(env, JNU_JAVANETPKG "SocketTimeoutException",
- "Accept timed out");
- return;
+ if (nanoTimeout >= NET_NSEC_PER_MSEC) {
+ currNanoTime = JVM_NanoTime(env, 0);
+ nanoTimeout -= (currNanoTime - prevNanoTime);
+ if (nanoTimeout < NET_NSEC_PER_MSEC) {
+ JNU_ThrowByName(env, JNU_JAVANETPKG "SocketTimeoutException",
+ "Accept timed out");
+ return;
+ }
+ prevNanoTime = currNanoTime;
}
- prevNanoTime = currNanoTime;
}
if (newfd < 0) {
--- a/src/java.base/windows/classes/java/io/FileDescriptor.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/windows/classes/java/io/FileDescriptor.java Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, 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
@@ -32,12 +32,12 @@
/**
* Instances of the file descriptor class serve as an opaque handle
- * to the underlying machine-specific structure representing an
- * open file, an open socket, or another source or sink of bytes.
+ * to the underlying machine-specific structure representing an open
+ * file, an open socket, or another source or sink of bytes.
* The main practical use for a file descriptor is to create a
* {@link FileInputStream} or {@link FileOutputStream} to contain it.
- *
- * <p>Applications should not create their own file descriptors.
+ * <p>
+ * Applications should not create their own file descriptors.
*
* @author Pavani Diwanji
* @since 1.0
@@ -57,15 +57,6 @@
*/
private boolean append;
- /**
- * Constructs an (invalid) FileDescriptor
- * object.
- */
- public /**/ FileDescriptor() {
- fd = -1;
- handle = -1;
- }
-
static {
initIDs();
}
@@ -73,32 +64,45 @@
// Set up JavaIOFileDescriptorAccess in SharedSecrets
static {
SharedSecrets.setJavaIOFileDescriptorAccess(
- new JavaIOFileDescriptorAccess() {
- public void set(FileDescriptor obj, int fd) {
- obj.fd = fd;
- }
+ new JavaIOFileDescriptorAccess() {
+ public void set(FileDescriptor fdo, int fd) {
+ fdo.fd = fd;
+ }
- public int get(FileDescriptor obj) {
- return obj.fd;
- }
+ public int get(FileDescriptor fdo) {
+ return fdo.fd;
+ }
- public void setAppend(FileDescriptor obj, boolean append) {
- obj.append = append;
- }
+ public void setAppend(FileDescriptor fdo, boolean append) {
+ fdo.append = append;
+ }
+
+ public boolean getAppend(FileDescriptor fdo) {
+ return fdo.append;
+ }
- public boolean getAppend(FileDescriptor obj) {
- return obj.append;
- }
+ public void close(FileDescriptor fdo) {
+ fdo.close();
+ }
- public void setHandle(FileDescriptor obj, long handle) {
- obj.handle = handle;
+ public void setHandle(FileDescriptor fdo, long handle) {
+ fdo.handle = handle;
+ }
+
+ public long getHandle(FileDescriptor fdo) {
+ return fdo.handle;
+ }
}
+ );
+ }
- public long getHandle(FileDescriptor obj) {
- return obj.handle;
- }
- }
- );
+ /**
+ * Constructs an (invalid) FileDescriptor
+ * object.
+ */
+ public FileDescriptor() {
+ fd = -1;
+ handle = -1;
}
/**
@@ -135,7 +139,7 @@
* {@code false} otherwise.
*/
public boolean valid() {
- return ((handle != -1) || (fd != -1));
+ return (handle != -1) || (fd != -1);
}
/**
@@ -179,6 +183,13 @@
return desc;
}
+ /**
+ * Close the raw file descriptor or handle, if it has not already been closed
+ * and set the fd and handle to -1.
+ * Package private to allow it to be used in java.io.
+ */
+ native void close();
+
/*
* Package private methods to track referents.
* If multiple streams point to the same FileDescriptor, we cycle
--- a/src/java.base/windows/classes/sun/nio/ch/FileDispatcherImpl.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/windows/classes/sun/nio/ch/FileDispatcherImpl.java Thu Sep 28 09:13:27 2017 -0700
@@ -104,7 +104,7 @@
}
void close(FileDescriptor fd) throws IOException {
- close0(fd);
+ fdAccess.close(fd);
}
FileDescriptor duplicateForMapping(FileDescriptor fd) throws IOException {
--- a/src/java.base/windows/native/libjava/FileDescriptor_md.c Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/windows/native/libjava/FileDescriptor_md.c Thu Sep 28 09:13:27 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
@@ -72,3 +72,9 @@
JNU_ThrowByName(env, "java/io/SyncFailedException", "sync failed");
}
}
+
+// instance method close0 for FileDescriptor
+JNIEXPORT void JNICALL
+Java_java_io_FileDescriptor_close(JNIEnv *env, jobject this) {
+ fileDescriptorClose(env, this);
+}
--- a/src/java.base/windows/native/libjava/FileInputStream_md.c Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
- * 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.
- */
-
-#include "jni.h"
-#include "jni_util.h"
-#include "jvm.h"
-
-#include "io_util.h"
-#include "io_util_md.h"
-
-#include "java_io_FileInputStream.h"
-
-extern jfieldID fis_fd; /* id for jobject 'fd' in java.io.FileInputStream */
-
-/*********************************************************************
- * Platform specific implementation of input stream native methods
- */
-
-JNIEXPORT void JNICALL
-Java_java_io_FileInputStream_close0(JNIEnv *env, jobject this) {
- handleClose(env, this, fis_fd);
-}
--- a/src/java.base/windows/native/libjava/RandomAccessFile_md.c Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
- * 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.
- */
-
-#include "jni.h"
-#include "jni_util.h"
-#include "jvm.h"
-
-#include "io_util.h"
-#include "io_util_md.h"
-
-#include "java_io_RandomAccessFile.h"
-
-extern jfieldID raf_fd; /* id for jobject 'fd' in java.io.RandomAccessFile */
-
-/*********************************************************************
- * Platform specific implementation of input stream native methods
- */
-
-JNIEXPORT void JNICALL
-Java_java_io_RandomAccessFile_close0(JNIEnv *env, jobject this) {
- handleClose(env, this, raf_fd);
-}
--- a/src/java.base/windows/native/libjava/io_util_md.c Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/windows/native/libjava/io_util_md.c Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -535,14 +535,28 @@
return writeInternal(fd, buf, len, JNI_TRUE);
}
-jint
+void
handleClose(JNIEnv *env, jobject this, jfieldID fid)
{
- FD fd = GET_FD(this, fid);
+ jobject fileDescriptor = (*env)->GetObjectField(env, (this), (fid));
+ if (fileDescriptor == NULL) {
+ return;
+ }
+ fileDescriptorClose(env, fileDescriptor);
+}
+
+// Function to close the fd held by this FileDescriptor and set fd to -1.
+void
+fileDescriptorClose(JNIEnv *env, jobject this)
+{
+ FD fd = (*env)->GetLongField(env, this, IO_handle_fdID);
+ if ((*env)->ExceptionOccurred(env)) {
+ return;
+ }
HANDLE h = (HANDLE)fd;
if (h == INVALID_HANDLE_VALUE) {
- return 0;
+ return;
}
/* Set the fd to -1 before closing it so that the timing window
@@ -551,12 +565,14 @@
* Practically the chance of its occurance is low, however, we are
* taking extra precaution over here.
*/
- SET_FD(this, -1, fid);
+ (*env)->SetLongField(env, this, IO_handle_fdID, -1);
+ if ((*env)->ExceptionOccurred(env)) {
+ return;
+ }
if (CloseHandle(h) == 0) { /* Returns zero on failure */
JNU_ThrowIOExceptionWithLastError(env, "close failed");
}
- return 0;
}
jlong
--- a/src/java.base/windows/native/libjava/io_util_md.h Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/windows/native/libjava/io_util_md.h Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, 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
@@ -48,7 +48,8 @@
JNIEXPORT jint handleRead(FD fd, void *buf, jint len);
jint handleWrite(FD fd, const void *buf, jint len);
jint handleAppend(FD fd, const void *buf, jint len);
-jint handleClose(JNIEnv *env, jobject this, jfieldID fid);
+void handleClose(JNIEnv *env, jobject this, jfieldID fid);
+void fileDescriptorClose(JNIEnv *env, jobject this);
jlong handleLseek(FD fd, jlong offset, jint whence);
/*
--- a/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java Thu Sep 28 09:13:27 2017 -0700
@@ -216,8 +216,9 @@
* Character#isJavaIdentifierStart(int)} returns {@code true},
* followed only by characters for which {@link
* Character#isJavaIdentifierPart(int)} returns {@code true}.
- * This pattern matches regular identifiers, keywords, and the
- * literals {@code "true"}, {@code "false"}, and {@code "null"}.
+ * This pattern matches regular identifiers, keywords, restricted
+ * keywords, and the literals {@code "true"}, {@code "false"}, and
+ * {@code "null"}.
* The method returns {@code false} for all other strings.
*
* @param name the string to check
@@ -251,10 +252,13 @@
* qualified name in the latest source version. Unlike {@link
* #isIdentifier isIdentifier}, this method returns {@code false}
* for keywords, boolean literals, and the null literal.
+ * This method returns {@code true} for <i>restricted
+ * keywords</i>.
*
* @param name the string to check
* @return {@code true} if this string is a
* syntactically valid name, {@code false} otherwise.
+ * @jls 3.9 Keywords
* @jls 6.2 Names and Identifiers
*/
public static boolean isName(CharSequence name) {
@@ -266,11 +270,14 @@
* qualified name in the given source version. Unlike {@link
* #isIdentifier isIdentifier}, this method returns {@code false}
* for keywords, boolean literals, and the null literal.
+ * This method returns {@code true} for <i>restricted
+ * keywords</i>.
*
* @param name the string to check
* @param version the version to use
* @return {@code true} if this string is a
* syntactically valid name, {@code false} otherwise.
+ * @jls 3.9 Keywords
* @jls 6.2 Names and Identifiers
* @since 9
*/
@@ -287,6 +294,8 @@
/**
* Returns whether or not {@code s} is a keyword, boolean literal,
* or null literal in the latest source version.
+ * This method returns {@code false} for <i>restricted
+ * keywords</i>.
*
* @param s the string to check
* @return {@code true} if {@code s} is a keyword, or boolean
@@ -302,6 +311,8 @@
/**
* Returns whether or not {@code s} is a keyword, boolean literal,
* or null literal in the given source version.
+ * This method returns {@code false} for <i>restricted
+ * keywords</i>.
*
* @param s the string to check
* @param version the version to use
--- a/src/java.compiler/share/classes/javax/lang/model/element/ModuleElement.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.compiler/share/classes/javax/lang/model/element/ModuleElement.java Thu Sep 28 09:13:27 2017 -0700
@@ -87,7 +87,7 @@
*
* @return {@code true} if this is an open module and {@code
* false} otherwise
- */ // TODO: add @jls to unnamed module section
+ */
boolean isOpen();
/**
@@ -96,7 +96,9 @@
*
* @return {@code true} if this is an unnamed module and {@code
* false} otherwise
- */ // TODO: add @jls to unnamed module section
+ *
+ * @jls 7.7.5 Unnamed Modules
+ */
boolean isUnnamed();
/**
--- a/src/java.desktop/share/classes/java/awt/EventQueue.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.desktop/share/classes/java/awt/EventQueue.java Thu Sep 28 09:13:27 2017 -0700
@@ -191,6 +191,8 @@
return eventLog;
}
+ private static boolean fxAppThreadIsDispatchThread;
+
static {
AWTAccessor.setEventQueueAccessor(
new AWTAccessor.EventQueueAccessor() {
@@ -227,6 +229,13 @@
return eventQueue.getMostRecentEventTimeImpl();
}
});
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ fxAppThreadIsDispatchThread =
+ "true".equals(System.getProperty("javafx.embed.singleThread"));
+ return null;
+ }
+ });
}
/**
@@ -854,9 +863,15 @@
private AWTEvent getCurrentEventImpl() {
pushPopLock.lock();
try {
+ if (fxAppThreadIsDispatchThread) {
+ return (currentEvent != null)
+ ? currentEvent.get()
+ : null;
+ } else {
return (Thread.currentThread() == dispatchThread)
- ? currentEvent.get()
- : null;
+ ? currentEvent.get()
+ : null;
+ }
} finally {
pushPopLock.unlock();
}
@@ -1247,7 +1262,7 @@
private void setCurrentEventAndMostRecentTimeImpl(AWTEvent e) {
pushPopLock.lock();
try {
- if (Thread.currentThread() != dispatchThread) {
+ if (!fxAppThreadIsDispatchThread && Thread.currentThread() != dispatchThread) {
return;
}
--- a/src/java.desktop/windows/native/libawt/windows/WPrinterJob.cpp Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.desktop/windows/native/libawt/windows/WPrinterJob.cpp Thu Sep 28 09:13:27 2017 -0700
@@ -898,11 +898,25 @@
defIndices[1] = pDevMode->dmMediaType;
}
- if (pDevMode->dmFields & DM_YRESOLUTION) {
- defIndices[2] = pDevMode->dmYResolution;
+ /*
+ * For some printer like Brother HL-2240D series
+ * pDevMode->dmYResolution is not set in pDevMode->dmFields
+ * even though pDevMode->dmYResolution is populated
+ * via ::DocumentProperties API, so for this case
+ * we populate the resolution index in default array
+ */
+ if (pDevMode->dmFields & DM_YRESOLUTION || pDevMode->dmYResolution > 0) {
+ defIndices[2] = pDevMode->dmYResolution;
}
- if (pDevMode->dmFields & DM_PRINTQUALITY) {
+ /*
+ * For some printer like Brother HL-2240D series
+ * pDevMode->dmPrintQuality is not set in pDevMode->dmFields
+ * even though pDevMode->dmPrintQuality is populated
+ * via ::DocumentProperties API, so for this case
+ * we populate the print quality index in default array
+ */
+ if (pDevMode->dmFields & DM_PRINTQUALITY || pDevMode->dmPrintQuality != 0) {
defIndices[3] = pDevMode->dmPrintQuality;
}
--- a/src/java.security.jgss/share/classes/sun/security/jgss/krb5/CipherHelper.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.security.jgss/share/classes/sun/security/jgss/krb5/CipherHelper.java Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -44,6 +44,7 @@
import sun.security.krb5.internal.crypto.Aes128;
import sun.security.krb5.internal.crypto.Aes256;
import sun.security.krb5.internal.crypto.ArcFourHmac;
+import sun.security.krb5.internal.crypto.EType;
class CipherHelper {
@@ -77,10 +78,6 @@
private int sgnAlg, sealAlg;
private byte[] keybytes;
- // new token format from draft-ietf-krb-wg-gssapi-cfx-07
- // proto is used to determine new GSS token format for "newer" etypes
- private int proto = 0;
-
CipherHelper(EncryptionKey key) throws GSSException {
etype = key.getEType();
keybytes = key.getBytes();
@@ -106,7 +103,6 @@
case EncryptedData.ETYPE_AES256_CTS_HMAC_SHA1_96:
sgnAlg = -1;
sealAlg = -1;
- proto = 1;
break;
default:
@@ -123,8 +119,10 @@
return sealAlg;
}
+ // new token format from draft-ietf-krb-wg-gssapi-cfx-07
+ // proto is used to determine new GSS token format for "newer" etypes
int getProto() {
- return proto;
+ return EType.isNewer(etype) ? 1 : 0;
}
int getEType() {
--- a/src/java.security.jgss/share/classes/sun/security/krb5/internal/PAData.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/PAData.java Thu Sep 28 09:13:27 2017 -0700
@@ -1,4 +1,5 @@
/*
+ * 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
@@ -30,7 +31,7 @@
package sun.security.krb5.internal;
-import sun.security.krb5.KrbException;
+import sun.security.krb5.internal.crypto.EType;
import sun.security.util.*;
import sun.security.krb5.Asn1Exception;
import java.io.IOException;
@@ -172,8 +173,8 @@
while (d2.data.available() > 0) {
DerValue value = d2.data.getDerValue();
ETypeInfo2 tmp = new ETypeInfo2(value);
- if (tmp.getParams() == null) {
- // we don't support non-null s2kparams
+ if (EType.isNewer(tmp.getEType()) || tmp.getParams() == null) {
+ // we don't support non-null s2kparams for old etypes
return tmp.getEType();
}
}
@@ -239,8 +240,9 @@
while (d2.data.available() > 0) {
DerValue value = d2.data.getDerValue();
ETypeInfo2 tmp = new ETypeInfo2(value);
- if (tmp.getParams() == null && tmp.getEType() == eType) {
- // we don't support non-null s2kparams
+ if (tmp.getEType() == eType &&
+ (EType.isNewer(eType) || tmp.getParams() == null)) {
+ // we don't support non-null s2kparams for old etypes
return new SaltAndParams(tmp.getSalt(), tmp.getParams());
}
}
--- a/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/EType.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/EType.java Thu Sep 28 09:13:27 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
@@ -301,6 +301,26 @@
return isSupported(eTypeConst, enabledETypes);
}
+ /**
+ * https://tools.ietf.org/html/rfc4120#section-3.1.3:
+ *
+ * A "newer" enctype is any enctype first officially
+ * specified concurrently with or subsequent to the issue of this RFC.
+ * The enctypes DES, 3DES, or RC4 and any defined in [RFC1510] are not
+ * "newer" enctypes.
+ *
+ * @param eTypeConst the encryption type
+ * @return true if "newer"
+ */
+ public static boolean isNewer(int eTypeConst) {
+ return eTypeConst != EncryptedData.ETYPE_DES_CBC_CRC &&
+ eTypeConst != EncryptedData.ETYPE_DES_CBC_MD4 &&
+ eTypeConst != EncryptedData.ETYPE_DES_CBC_MD5 &&
+ eTypeConst != EncryptedData.ETYPE_DES3_CBC_HMAC_SHA1_KD &&
+ eTypeConst != EncryptedData.ETYPE_ARCFOUR_HMAC &&
+ eTypeConst != EncryptedData.ETYPE_ARCFOUR_HMAC_EXP;
+ }
+
public static String toString(int type) {
switch (type) {
case 0:
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Flags.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Flags.java Thu Sep 28 09:13:27 2017 -0700
@@ -308,6 +308,11 @@
*/
public static final long HAS_RESOURCE = 1L<<56;
+ /**
+ * Flag for synthesized default constructors of anonymous classes that have an enclosing expression.
+ */
+ public static final long ANONCONSTR_BASED = 1L<<57;
+
/** Modifier masks.
*/
public static final int
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Kinds.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Kinds.java Thu Sep 28 09:13:27 2017 -0700
@@ -71,6 +71,7 @@
HIDDEN(Category.RESOLUTION_TARGET), // not overloaded non-target
STATICERR(Category.RESOLUTION_TARGET), // overloaded? target
MISSING_ENCL(Category.RESOLUTION), // not overloaded non-target
+ BAD_VAR(Category.RESOLUTION), // not overloaded non-target
ABSENT_VAR(Category.RESOLUTION_TARGET, KindName.VAR), // not overloaded non-target
WRONG_MTHS(Category.RESOLUTION_TARGET, KindName.METHOD), // overloaded target
WRONG_MTH(Category.RESOLUTION_TARGET, KindName.METHOD), // not overloaded target
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java Thu Sep 28 09:13:27 2017 -0700
@@ -227,6 +227,7 @@
return compareTo(JDK1_8) <= 0;
}
public boolean allowPrivateInterfaceMethods() { return compareTo(JDK1_9) >= 0; }
+ public boolean allowLocalVariableTypeInference() { return compareTo(JDK1_10) >= 0; }
public static SourceVersion toSourceVersion(Source source) {
switch(source) {
case JDK1_2:
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java Thu Sep 28 09:13:27 2017 -0700
@@ -1616,6 +1616,7 @@
public TypeVar(Name name, Symbol owner, Type lower) {
super(null, TypeMetadata.EMPTY);
+ Assert.checkNonNull(lower);
tsym = new TypeVariableSymbol(0, name, this, owner);
this.bound = null;
this.lower = lower;
@@ -1628,6 +1629,7 @@
public TypeVar(TypeSymbol tsym, Type bound, Type lower,
TypeMetadata metadata) {
super(tsym, metadata);
+ Assert.checkNonNull(lower);
this.bound = bound;
this.lower = lower;
}
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java Thu Sep 28 09:13:27 2017 -0700
@@ -1247,7 +1247,9 @@
final TypeAnnotationPosition pos =
TypeAnnotationPosition.localVariable(currentLambda,
tree.pos);
- separateAnnotationsKinds(tree.vartype, tree.sym.type, tree.sym, pos);
+ if (!tree.isImplicitlyTyped()) {
+ separateAnnotationsKinds(tree.vartype, tree.sym.type, tree.sym, pos);
+ }
} else if (tree.sym.getKind() == ElementKind.EXCEPTION_PARAMETER) {
final TypeAnnotationPosition pos =
TypeAnnotationPosition.exceptionParameter(currentLambda,
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java Thu Sep 28 09:13:27 2017 -0700
@@ -190,6 +190,245 @@
}
// </editor-fold>
+ // <editor-fold defaultstate="collapsed" desc="projections">
+
+ /**
+ * A projection kind. See {@link TypeProjection}
+ */
+ enum ProjectionKind {
+ UPWARDS() {
+ @Override
+ ProjectionKind complement() {
+ return DOWNWARDS;
+ }
+ },
+ DOWNWARDS() {
+ @Override
+ ProjectionKind complement() {
+ return UPWARDS;
+ }
+ };
+
+ abstract ProjectionKind complement();
+ }
+
+ /**
+ * This visitor performs upwards and downwards projections on types.
+ *
+ * A projection is defined as a function that takes a type T, a set of type variables V and that
+ * produces another type S.
+ *
+ * An upwards projection maps a type T into a type S such that (i) T has no variables in V,
+ * and (ii) S is an upper bound of T.
+ *
+ * A downwards projection maps a type T into a type S such that (i) T has no variables in V,
+ * and (ii) S is a lower bound of T.
+ *
+ * Note that projections are only allowed to touch variables in V. Theferore it is possible for
+ * a projection to leave its input type unchanged if it does not contain any variables in V.
+ *
+ * Moreover, note that while an upwards projection is always defined (every type as an upper bound),
+ * a downwards projection is not always defined.
+ *
+ * Examples:
+ *
+ * {@code upwards(List<#CAP1>, [#CAP1]) = List<? extends String>, where #CAP1 <: String }
+ * {@code downwards(List<#CAP2>, [#CAP2]) = List<? super String>, where #CAP2 :> String }
+ * {@code upwards(List<#CAP1>, [#CAP2]) = List<#CAP1> }
+ * {@code downwards(List<#CAP1>, [#CAP1]) = not defined }
+ */
+ class TypeProjection extends StructuralTypeMapping<ProjectionKind> {
+
+ List<Type> vars;
+ Set<Type> seen = new HashSet<>();
+
+ public TypeProjection(List<Type> vars) {
+ this.vars = vars;
+ }
+
+ @Override
+ public Type visitClassType(ClassType t, ProjectionKind pkind) {
+ if (t.isCompound()) {
+ List<Type> components = directSupertypes(t);
+ List<Type> components1 = components.map(c -> c.map(this, pkind));
+ if (components == components1) return t;
+ else return makeIntersectionType(components1);
+ } else {
+ Type outer = t.getEnclosingType();
+ Type outer1 = visit(outer, pkind);
+ List<Type> typarams = t.getTypeArguments();
+ List<Type> typarams1 = typarams.map(ta -> mapTypeArgument(ta, pkind));
+ if (typarams1.stream().anyMatch(ta -> ta.hasTag(BOT))) {
+ //not defined
+ return syms.botType;
+ }
+ if (outer1 == outer && typarams1 == typarams) return t;
+ else return new ClassType(outer1, typarams1, t.tsym, t.getMetadata()) {
+ @Override
+ protected boolean needsStripping() {
+ return true;
+ }
+ };
+ }
+ }
+
+ protected Type makeWildcard(Type upper, Type lower) {
+ BoundKind bk;
+ Type bound;
+ if (upper.hasTag(BOT)) {
+ upper = syms.objectType;
+ }
+ boolean isUpperObject = isSameType(upper, syms.objectType);
+ if (!lower.hasTag(BOT) && isUpperObject) {
+ bound = lower;
+ bk = SUPER;
+ } else {
+ bound = upper;
+ bk = isUpperObject ? UNBOUND : EXTENDS;
+ }
+ return new WildcardType(bound, bk, syms.boundClass);
+ }
+
+ @Override
+ public Type visitTypeVar(TypeVar t, ProjectionKind pkind) {
+ if (vars.contains(t)) {
+ try {
+ if (seen.add(t)) {
+ final Type bound;
+ switch (pkind) {
+ case UPWARDS:
+ bound = t.getUpperBound();
+ break;
+ case DOWNWARDS:
+ bound = (t.getLowerBound() == null) ?
+ syms.botType :
+ t.getLowerBound();
+ break;
+ default:
+ Assert.error();
+ return null;
+ }
+ return bound.map(this, pkind);
+ } else {
+ //cycle
+ return syms.objectType;
+ }
+ } finally {
+ seen.remove(t);
+ }
+ } else {
+ return t;
+ }
+ }
+
+ @Override
+ public Type visitWildcardType(WildcardType wt, ProjectionKind pkind) {
+ switch (pkind) {
+ case UPWARDS:
+ return wt.isExtendsBound() ?
+ wt.type.map(this, pkind) :
+ syms.objectType;
+ case DOWNWARDS:
+ return wt.isSuperBound() ?
+ wt.type.map(this, pkind) :
+ syms.botType;
+ default:
+ Assert.error();
+ return null;
+ }
+ }
+
+ private Type mapTypeArgument(Type t, ProjectionKind pkind) {
+ if (!t.containsAny(vars)) {
+ return t;
+ } else if (!t.hasTag(WILDCARD) && pkind == ProjectionKind.DOWNWARDS) {
+ //not defined
+ return syms.botType;
+ } else {
+ Type upper = t.map(this, pkind);
+ Type lower = t.map(this, pkind.complement());
+ return makeWildcard(upper, lower);
+ }
+ }
+ }
+
+ /**
+ * Computes an upward projection of given type, and vars. See {@link TypeProjection}.
+ *
+ * @param t the type to be projected
+ * @param vars the set of type variables to be mapped
+ * @return the type obtained as result of the projection
+ */
+ public Type upward(Type t, List<Type> vars) {
+ return t.map(new TypeProjection(vars), ProjectionKind.UPWARDS);
+ }
+
+ /**
+ * Computes the set of captured variables mentioned in a given type. See {@link CaptureScanner}.
+ * This routine is typically used to computed the input set of variables to be used during
+ * an upwards projection (see {@link Types#upward(Type, List)}).
+ *
+ * @param t the type where occurrences of captured variables have to be found
+ * @return the set of captured variables found in t
+ */
+ public List<Type> captures(Type t) {
+ CaptureScanner cs = new CaptureScanner();
+ Set<Type> captures = new HashSet<>();
+ cs.visit(t, captures);
+ return List.from(captures);
+ }
+
+ /**
+ * This visitor scans a type recursively looking for occurrences of captured type variables.
+ */
+ class CaptureScanner extends SimpleVisitor<Void, Set<Type>> {
+
+ @Override
+ public Void visitType(Type t, Set<Type> types) {
+ return null;
+ }
+
+ @Override
+ public Void visitClassType(ClassType t, Set<Type> seen) {
+ if (t.isCompound()) {
+ directSupertypes(t).forEach(s -> visit(s, seen));
+ } else {
+ t.allparams().forEach(ta -> visit(ta, seen));
+ }
+ return null;
+ }
+
+ @Override
+ public Void visitArrayType(ArrayType t, Set<Type> seen) {
+ return visit(t.elemtype, seen);
+ }
+
+ @Override
+ public Void visitWildcardType(WildcardType t, Set<Type> seen) {
+ visit(t.type, seen);
+ return null;
+ }
+
+ @Override
+ public Void visitTypeVar(TypeVar t, Set<Type> seen) {
+ if ((t.tsym.flags() & Flags.SYNTHETIC) != 0 && seen.add(t)) {
+ visit(t.getUpperBound(), seen);
+ }
+ return null;
+ }
+
+ @Override
+ public Void visitCapturedType(CapturedType t, Set<Type> seen) {
+ if (seen.add(t)) {
+ visit(t.getUpperBound(), seen);
+ visit(t.getLowerBound(), seen);
+ }
+ return null;
+ }
+ }
+
+ // </editor-fold>
+
// <editor-fold defaultstate="collapsed" desc="isUnbounded">
/**
* Checks that all the arguments to a class are unbounded
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java Thu Sep 28 09:13:27 2017 -0700
@@ -83,6 +83,7 @@
import static com.sun.tools.javac.code.Flags.GENERATEDCONSTR;
import static com.sun.tools.javac.code.TypeTag.CLASS;
import static com.sun.tools.javac.tree.JCTree.Tag.APPLY;
+import static com.sun.tools.javac.tree.JCTree.Tag.FOREACHLOOP;
import static com.sun.tools.javac.tree.JCTree.Tag.LABELLED;
import static com.sun.tools.javac.tree.JCTree.Tag.METHODDEF;
import static com.sun.tools.javac.tree.JCTree.Tag.NEWCLASS;
@@ -139,7 +140,8 @@
enum AnalyzerMode {
DIAMOND("diamond", Source::allowDiamond),
LAMBDA("lambda", Source::allowLambda),
- METHOD("method", Source::allowGraphInference);
+ METHOD("method", Source::allowGraphInference),
+ LOCAL("local", Source::allowLocalVariableTypeInference);
final String opt;
final Predicate<Source> sourceFilter;
@@ -341,11 +343,91 @@
}
}
+ /**
+ * Base class for local variable inference analyzers.
+ */
+ abstract class RedundantLocalVarTypeAnalyzerBase<X extends JCStatement> extends StatementAnalyzer<X, X> {
+
+ RedundantLocalVarTypeAnalyzerBase(JCTree.Tag tag) {
+ super(AnalyzerMode.LOCAL, tag);
+ }
+
+ /**
+ * Map a variable tree into a new declaration using implicit type.
+ */
+ JCVariableDecl mapVar(JCVariableDecl oldTree, JCVariableDecl newTree){
+ newTree.vartype = null;
+ return newTree;
+ }
+
+ /**
+ * Analyze results of local variable inference.
+ */
+ void processVar(JCVariableDecl oldTree, JCVariableDecl newTree, boolean hasErrors){
+ if (!hasErrors) {
+ if (types.isSameType(oldTree.type, newTree.type)) {
+ log.warning(oldTree, Warnings.LocalRedundantType);
+ }
+ }
+ }
+ }
+
+ /**
+ * This analyzer checks if a local variable declaration has redundant type.
+ */
+ class RedundantLocalVarTypeAnalyzer extends RedundantLocalVarTypeAnalyzerBase<JCVariableDecl> {
+
+ RedundantLocalVarTypeAnalyzer() {
+ super(VARDEF);
+ }
+
+ boolean match(JCVariableDecl tree){
+ return tree.sym.owner.kind == Kind.MTH &&
+ tree.init != null && !tree.isImplicitlyTyped() &&
+ attr.canInferLocalVarType(tree) == null;
+ }
+ @Override
+ JCVariableDecl map(JCVariableDecl oldTree, JCVariableDecl newTree){
+ return mapVar(oldTree, newTree);
+ }
+ @Override
+ void process(JCVariableDecl oldTree, JCVariableDecl newTree, boolean hasErrors){
+ processVar(oldTree, newTree, hasErrors);
+ }
+ }
+
+ /**
+ * This analyzer checks if a for each variable declaration has redundant type.
+ */
+ class RedundantLocalVarTypeAnalyzerForEach extends RedundantLocalVarTypeAnalyzerBase<JCEnhancedForLoop> {
+
+ RedundantLocalVarTypeAnalyzerForEach() {
+ super(FOREACHLOOP);
+ }
+
+ @Override
+ boolean match(JCEnhancedForLoop tree){
+ return !tree.var.isImplicitlyTyped();
+ }
+ @Override
+ JCEnhancedForLoop map(JCEnhancedForLoop oldTree, JCEnhancedForLoop newTree){
+ newTree.var = mapVar(oldTree.var, newTree.var);
+ newTree.body = make.Block(0, List.nil()); //ignore body for analysis purpose
+ return newTree;
+ }
+ @Override
+ void process(JCEnhancedForLoop oldTree, JCEnhancedForLoop newTree, boolean hasErrors){
+ processVar(oldTree.var, newTree.var, hasErrors);
+ }
+ }
+
@SuppressWarnings({"unchecked", "rawtypes"})
StatementAnalyzer<JCTree, JCTree>[] analyzers = new StatementAnalyzer[] {
new DiamondInitializer(),
new LambdaAnalyzer(),
- new RedundantTypeArgAnalyzer()
+ new RedundantTypeArgAnalyzer(),
+ new RedundantLocalVarTypeAnalyzer(),
+ new RedundantLocalVarTypeAnalyzerForEach()
};
/**
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java Thu Sep 28 09:13:27 2017 -0700
@@ -28,9 +28,11 @@
import com.sun.tools.javac.code.*;
import com.sun.tools.javac.code.Attribute.Compound;
import com.sun.tools.javac.code.Attribute.TypeCompound;
+import com.sun.tools.javac.code.Kinds.KindSelector;
import com.sun.tools.javac.code.Scope.WriteableScope;
import com.sun.tools.javac.code.Symbol.*;
import com.sun.tools.javac.code.TypeMetadata.Entry.Kind;
+import com.sun.tools.javac.comp.Check.CheckContext;
import com.sun.tools.javac.resources.CompilerProperties.Errors;
import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.tree.JCTree.*;
@@ -602,7 +604,7 @@
}
private Attribute getAnnotationEnumValue(Type expectedElementType, JCExpression tree, Env<AttrContext> env) {
- Type result = attr.attribExpr(tree, env, expectedElementType);
+ Type result = attr.attribTree(tree, env, annotationValueInfo(expectedElementType));
Symbol sym = TreeInfo.symbol(tree);
if (sym == null ||
TreeInfo.nonstaticSelect(tree) ||
@@ -616,7 +618,7 @@
}
private Attribute getAnnotationClassValue(Type expectedElementType, JCExpression tree, Env<AttrContext> env) {
- Type result = attr.attribExpr(tree, env, expectedElementType);
+ Type result = attr.attribTree(tree, env, annotationValueInfo(expectedElementType));
if (result.isErroneous()) {
// Does it look like an unresolved class literal?
if (TreeInfo.name(tree) == names._class &&
@@ -642,7 +644,7 @@
}
private Attribute getAnnotationPrimitiveValue(Type expectedElementType, JCExpression tree, Env<AttrContext> env) {
- Type result = attr.attribExpr(tree, env, expectedElementType);
+ Type result = attr.attribTree(tree, env, annotationValueInfo(expectedElementType));
if (result.isErroneous())
return new Attribute.Error(result.getOriginalType());
if (result.constValue() == null) {
@@ -653,6 +655,22 @@
return new Attribute.Constant(expectedElementType, result.constValue());
}
+ private Attr.ResultInfo annotationValueInfo(Type pt) {
+ return attr.unknownExprInfo.dup(pt, new AnnotationValueContext(attr.unknownExprInfo.checkContext));
+ }
+
+ class AnnotationValueContext extends Check.NestedCheckContext {
+ AnnotationValueContext(CheckContext enclosingContext) {
+ super(enclosingContext);
+ }
+
+ @Override
+ public boolean compatible(Type found, Type req, Warner warn) {
+ //handle non-final implicitly-typed vars (will be rejected later on)
+ return found.hasTag(TypeTag.NONE) || super.compatible(found, req, warn);
+ }
+ }
+
private Attribute getAnnotationArrayValue(Type expectedElementType, JCExpression tree, Env<AttrContext> env) {
// Special case, implicit array
if (!tree.hasTag(NEWARRAY)) {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Thu Sep 28 09:13:27 2017 -0700
@@ -36,7 +36,6 @@
import com.sun.source.tree.TreeVisitor;
import com.sun.source.util.SimpleTreeVisitor;
import com.sun.tools.javac.code.*;
-import com.sun.tools.javac.code.Directive.RequiresFlag;
import com.sun.tools.javac.code.Lint.LintCategory;
import com.sun.tools.javac.code.Scope.WriteableScope;
import com.sun.tools.javac.code.Symbol.*;
@@ -46,7 +45,6 @@
import com.sun.tools.javac.comp.ArgumentAttr.LocalCacheContext;
import com.sun.tools.javac.comp.Check.CheckContext;
import com.sun.tools.javac.comp.DeferredAttr.AttrMode;
-import com.sun.tools.javac.comp.Infer.FreeTypeListener;
import com.sun.tools.javac.jvm.*;
import static com.sun.tools.javac.resources.CompilerProperties.Fragments.Diamond;
import static com.sun.tools.javac.resources.CompilerProperties.Fragments.DiamondInvalidArg;
@@ -830,6 +828,10 @@
final JavaFileObject prevSource = log.useSource(env.toplevel.sourcefile);
try {
Type itype = attribExpr(variable.init, env, type);
+ if (variable.isImplicitlyTyped()) {
+ //fixup local variable type
+ type = variable.type = variable.sym.type = chk.checkLocalVarType(variable, itype.baseType(), variable.name);
+ }
if (itype.constValue() != null) {
return coerce(itype, type).constValue();
} else {
@@ -1108,6 +1110,21 @@
// parameters have already been entered
env.info.scope.enter(tree.sym);
} else {
+ if (tree.isImplicitlyTyped() && (tree.getModifiers().flags & PARAMETER) == 0) {
+ if (tree.init == null) {
+ //cannot use 'var' without initializer
+ log.error(tree, Errors.CantInferLocalVarType(tree.name, Fragments.LocalMissingInit));
+ tree.vartype = make.Erroneous();
+ } else {
+ Fragment msg = canInferLocalVarType(tree);
+ if (msg != null) {
+ //cannot use 'var' with initializer which require an explicit target
+ //(e.g. lambda, method reference, array initializer).
+ log.error(tree, Errors.CantInferLocalVarType(tree.name, msg));
+ tree.vartype = make.Erroneous();
+ }
+ }
+ }
try {
annotate.blockAnnotations();
memberEnter.memberEnter(tree, env);
@@ -1131,7 +1148,7 @@
boolean isImplicitLambdaParameter = env.tree.hasTag(LAMBDA) &&
((JCLambda)env.tree).paramKind == JCLambda.ParameterKind.IMPLICIT &&
(tree.sym.flags() & PARAMETER) != 0;
- chk.validate(tree.vartype, env, !isImplicitLambdaParameter);
+ chk.validate(tree.vartype, env, !isImplicitLambdaParameter && !tree.isImplicitlyTyped());
try {
v.getConstValue(); // ensure compile-time constant initializer is evaluated
@@ -1152,6 +1169,10 @@
// marking the variable as undefined.
initEnv.info.enclVar = v;
attribExpr(tree.init, initEnv, v.type);
+ if (tree.isImplicitlyTyped()) {
+ //fixup local variable type
+ v.type = chk.checkLocalVarType(tree, tree.init.type.baseType(), tree.name);
+ }
}
}
result = tree.type = v.type;
@@ -1161,6 +1182,71 @@
}
}
+ Fragment canInferLocalVarType(JCVariableDecl tree) {
+ LocalInitScanner lis = new LocalInitScanner();
+ lis.scan(tree.init);
+ return lis.badInferenceMsg;
+ }
+
+ static class LocalInitScanner extends TreeScanner {
+ Fragment badInferenceMsg = null;
+ boolean needsTarget = true;
+
+ @Override
+ public void visitNewArray(JCNewArray tree) {
+ if (tree.elemtype == null && needsTarget) {
+ badInferenceMsg = Fragments.LocalArrayMissingTarget;
+ }
+ }
+
+ @Override
+ public void visitLambda(JCLambda tree) {
+ if (needsTarget) {
+ badInferenceMsg = Fragments.LocalLambdaMissingTarget;
+ }
+ }
+
+ @Override
+ public void visitTypeCast(JCTypeCast tree) {
+ boolean prevNeedsTarget = needsTarget;
+ try {
+ needsTarget = false;
+ super.visitTypeCast(tree);
+ } finally {
+ needsTarget = prevNeedsTarget;
+ }
+ }
+
+ @Override
+ public void visitReference(JCMemberReference tree) {
+ if (needsTarget) {
+ badInferenceMsg = Fragments.LocalMrefMissingTarget;
+ }
+ }
+
+ @Override
+ public void visitNewClass(JCNewClass tree) {
+ boolean prevNeedsTarget = needsTarget;
+ try {
+ needsTarget = false;
+ super.visitNewClass(tree);
+ } finally {
+ needsTarget = prevNeedsTarget;
+ }
+ }
+
+ @Override
+ public void visitApply(JCMethodInvocation tree) {
+ boolean prevNeedsTarget = needsTarget;
+ try {
+ needsTarget = false;
+ super.visitApply(tree);
+ } finally {
+ needsTarget = prevNeedsTarget;
+ }
+ }
+ }
+
public void visitSkip(JCSkip tree) {
result = null;
}
@@ -1243,7 +1329,6 @@
//attributing the for-each expression; we mimick this by attributing
//the for-each expression first (against original scope).
Type exprType = types.cvarUpperBound(attribExpr(tree.expr, loopEnv));
- attribStat(tree.var, loopEnv);
chk.checkNonVoid(tree.pos(), exprType);
Type elemtype = types.elemtype(exprType); // perhaps expr is an array?
if (elemtype == null) {
@@ -1261,6 +1346,15 @@
: types.wildUpperBound(iterableParams.head);
}
}
+ 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);
+ }
+ }
+ attribStat(tree.var, loopEnv);
chk.checkType(tree.expr.pos(), elemtype, tree.var.sym.type);
loopEnv.tree = tree; // before, we were not in loop!
attribStat(tree.body, loopEnv);
@@ -2305,9 +2399,7 @@
// prefix it to the constructor arguments
// and delete it from the new expression
if (tree.encl != null && !clazztype.tsym.isInterface()) {
- tree.args = tree.args.prepend(makeNullCheck(tree.encl));
finalargtypes = argtypes.prepend(tree.encl.type);
- tree.encl = null;
} else {
finalargtypes = argtypes;
}
@@ -2381,7 +2473,8 @@
if (pt().hasTag(ARRAY)) {
elemtype = types.elemtype(pt());
} else {
- if (!pt().hasTag(ERROR)) {
+ if (!pt().hasTag(ERROR) &&
+ (env.info.enclVar == null || !env.info.enclVar.type.isErroneous())) {
log.error(tree.pos(),
Errors.IllegalInitializerForType(pt()));
}
@@ -2406,7 +2499,7 @@
@Override
public void visitLambda(final JCLambda that) {
if (pt().isErroneous() || (pt().hasTag(NONE) && pt() != Type.recoveryType)) {
- if (pt().hasTag(NONE)) {
+ if (pt().hasTag(NONE) && (env.info.enclVar == null || !env.info.enclVar.type.isErroneous())) {
//lambda only allowed in assignment or method invocation/cast context
log.error(that.pos(), Errors.UnexpectedLambda);
}
@@ -2839,7 +2932,7 @@
@Override
public void visitReference(final JCMemberReference that) {
if (pt().isErroneous() || (pt().hasTag(NONE) && pt() != Type.recoveryType)) {
- if (pt().hasTag(NONE)) {
+ if (pt().hasTag(NONE) && (env.info.enclVar == null || !env.info.enclVar.type.isErroneous())) {
//method reference only allowed in assignment or method invocation/cast context
log.error(that.pos(), Errors.UnexpectedMref);
}
@@ -3813,6 +3906,14 @@
break;
case VAR:
VarSymbol v = (VarSymbol)sym;
+
+ if (env.info.enclVar != null
+ && v.type.hasTag(NONE)) {
+ //self reference to implicitly typed variable declaration
+ log.error(TreeInfo.positionFor(v, env.enclClass), Errors.CantInferLocalVarType(v.name, Fragments.LocalSelfRef));
+ return v.type = types.createErrorType(v.type);
+ }
+
// Test (4): if symbol is an instance field of a raw type,
// which is being assigned to, issue an unchecked warning if
// its type changes under erasure.
@@ -4137,6 +4238,9 @@
public void visitTypeArray(JCArrayTypeTree tree) {
Type etype = attribType(tree.elemtype, env);
Type type = new ArrayType(etype, syms.arrayClass);
+ if (etype.isErroneous()) {
+ type = types.createErrorType(type);
+ }
result = check(tree, type, KindSelector.TYP, resultInfo);
}
@@ -4778,7 +4882,7 @@
}
public void visitVarDef(final JCVariableDecl tree) {
//System.err.println("validateTypeAnnotations.visitVarDef " + tree);
- if (tree.sym != null && tree.sym.type != null)
+ if (tree.sym != null && tree.sym.type != null && !tree.isImplicitlyTyped())
validateAnnotatedType(tree.vartype, tree.sym.type);
scan(tree.mods);
scan(tree.vartype);
@@ -4906,17 +5010,16 @@
repeat = false;
} else if (enclTr.hasTag(JCTree.Tag.WILDCARD)) {
JCWildcard wc = (JCWildcard) enclTr;
- if (wc.getKind() == JCTree.Kind.EXTENDS_WILDCARD) {
- validateAnnotatedType(wc.getBound(), ((WildcardType)enclTy).getExtendsBound());
- } else if (wc.getKind() == JCTree.Kind.SUPER_WILDCARD) {
- validateAnnotatedType(wc.getBound(), ((WildcardType)enclTy).getSuperBound());
+ if (wc.getKind() == JCTree.Kind.EXTENDS_WILDCARD ||
+ wc.getKind() == JCTree.Kind.SUPER_WILDCARD) {
+ validateAnnotatedType(wc.getBound(), wc.getBound().type);
} else {
// Nothing to do for UNBOUND
}
repeat = false;
} else if (enclTr.hasTag(TYPEARRAY)) {
JCArrayTypeTree art = (JCArrayTypeTree) enclTr;
- validateAnnotatedType(art.getType(), ((ArrayType)enclTy).getComponentType());
+ validateAnnotatedType(art.getType(), art.elemtype.type);
repeat = false;
} else if (enclTr.hasTag(TYPEUNION)) {
JCTypeUnion ut = (JCTypeUnion) enclTr;
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java Thu Sep 28 09:13:27 2017 -0700
@@ -843,26 +843,30 @@
List<Type> checkDiamondDenotable(ClassType t) {
ListBuffer<Type> buf = new ListBuffer<>();
for (Type arg : t.allparams()) {
- if (!diamondTypeChecker.visit(arg, null)) {
+ if (!checkDenotable(arg)) {
buf.append(arg);
}
}
return buf.toList();
}
+
+ boolean checkDenotable(Type t) {
+ return denotableChecker.visit(t, null);
+ }
// where
/** diamondTypeChecker: A type visitor that descends down the given type looking for non-denotable
* types. The visit methods return false as soon as a non-denotable type is encountered and true
* otherwise.
*/
- private static final Types.SimpleVisitor<Boolean, Void> diamondTypeChecker = new Types.SimpleVisitor<Boolean, Void>() {
+ private static final Types.SimpleVisitor<Boolean, Void> denotableChecker = new Types.SimpleVisitor<Boolean, Void>() {
@Override
public Boolean visitType(Type t, Void s) {
return true;
}
@Override
public Boolean visitClassType(ClassType t, Void s) {
- if (t.isCompound()) {
+ if (t.isUnion() || t.isIntersection()) {
return false;
}
for (Type targ : t.allparams()) {
@@ -878,7 +882,7 @@
/* Any type variable mentioned in the inferred type must have been declared as a type parameter
(i.e cannot have been produced by inference (18.4))
*/
- return t.tsym.owner.type.getTypeArguments().contains(t);
+ return (t.tsym.flags() & SYNTHETIC) == 0;
}
@Override
@@ -941,6 +945,17 @@
(allowPrivateSafeVarargs ? PRIVATE : 0) )) != 0);
}
+ Type checkLocalVarType(DiagnosticPosition pos, Type t, Name name) {
+ //upward project the initializer type
+ t = types.upward(t, types.captures(t));
+ //check that resulting type is not the null type
+ if (t.hasTag(BOT)) {
+ log.error(pos, Errors.CantInferLocalVarType(name, Fragments.LocalCantInferNull));
+ return types.createErrorType(t);
+ }
+ return t;
+ }
+
Type checkMethod(final Type mtype,
final Symbol sym,
final Env<AttrContext> env,
@@ -965,6 +980,10 @@
formals = formals.tail.tail;
nonInferred = nonInferred.tail.tail;
}
+ if ((sym.flags() & ANONCONSTR_BASED) != 0) {
+ formals = formals.tail;
+ nonInferred = nonInferred.tail;
+ }
List<JCExpression> args = argtrees;
if (args != null) {
//this is null when type-checking a method reference
@@ -3155,7 +3174,10 @@
if (s.kind == PCK)
return true;
} else if (target == names.TYPE_USE) {
- if (s.kind == TYP || s.kind == VAR ||
+ if (s.kind == VAR && s.owner.kind == MTH && s.type.hasTag(NONE)) {
+ //cannot type annotate implictly typed locals
+ return false;
+ } else if (s.kind == TYP || s.kind == VAR ||
(s.kind == MTH && !s.isConstructor() &&
!s.type.getReturnType().hasTag(VOID)) ||
(s.kind == MTH && s.isConstructor())) {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java Thu Sep 28 09:13:27 2017 -0700
@@ -529,7 +529,7 @@
List<Type> upperBounds = uv.getBounds(InferenceBound.UPPER);
if (Type.containsAny(upperBounds, vars)) {
TypeSymbol fresh_tvar = new TypeVariableSymbol(Flags.SYNTHETIC, uv.qtype.tsym.name, null, uv.qtype.tsym.owner);
- fresh_tvar.type = new TypeVar(fresh_tvar, types.makeIntersectionType(uv.getBounds(InferenceBound.UPPER)), null);
+ fresh_tvar.type = new TypeVar(fresh_tvar, types.makeIntersectionType(uv.getBounds(InferenceBound.UPPER)), syms.botType);
todo.append(uv);
uv.setInst(fresh_tvar.type);
} else if (upperBounds.nonEmpty()) {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java Thu Sep 28 09:13:27 2017 -0700
@@ -259,7 +259,7 @@
try {
if (TreeInfo.isEnumInit(tree)) {
attr.attribIdentAsEnumType(localEnv, (JCIdent)tree.vartype);
- } else {
+ } else if (!tree.isImplicitlyTyped()) {
attr.attribType(tree.vartype, localEnv);
if (TreeInfo.isReceiverParam(tree))
checkReceiver(tree, localEnv);
@@ -279,8 +279,8 @@
tree.vartype.type = atype.makeVarargs();
}
WriteableScope enclScope = enter.enterScope(env);
- VarSymbol v =
- new VarSymbol(0, tree.name, tree.vartype.type, enclScope.owner);
+ Type vartype = tree.isImplicitlyTyped() ? Type.noType : tree.vartype.type;
+ VarSymbol v = new VarSymbol(0, tree.name, vartype, enclScope.owner);
v.flags_field = chk.checkFlags(tree.pos(), tree.mods.flags, v, tree);
tree.sym = v;
if (tree.init != null) {
@@ -298,7 +298,9 @@
}
annotate.annotateLater(tree.mods.annotations, localEnv, v, tree.pos());
- annotate.queueScanTreeAndTypeAnnotate(tree.vartype, localEnv, v, tree.pos());
+ if (!tree.isImplicitlyTyped()) {
+ annotate.queueScanTreeAndTypeAnnotate(tree.vartype, localEnv, v, tree.pos());
+ }
v.pos = tree.pos;
}
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java Thu Sep 28 09:13:27 2017 -0700
@@ -105,6 +105,7 @@
public final boolean allowModules;
public final boolean checkVarargsAccessAfterResolution;
private final boolean compactMethodDiags;
+ private final boolean allowLocalVariableTypeInference;
final EnumSet<VerboseResolutionMode> verboseResolutionMode;
WriteableScope polymorphicSignatureScope;
@@ -136,6 +137,7 @@
Target target = Target.instance(context);
allowMethodHandles = target.hasMethodHandles();
allowFunctionalInterfaceMostSpecific = source.allowFunctionalInterfaceMostSpecific();
+ allowLocalVariableTypeInference = source.allowLocalVariableTypeInference();
checkVarargsAccessAfterResolution =
source.allowPostApplicabilityVarargsAccessCheck();
polymorphicSignatureScope = WriteableScope.create(syms.noSymbol);
@@ -2325,6 +2327,10 @@
* (a subset of VAL, TYP, PCK).
*/
Symbol findIdent(Env<AttrContext> env, Name name, KindSelector kind) {
+ return checkVarType(findIdentInternal(env, name, kind), name);
+ }
+
+ Symbol findIdentInternal(Env<AttrContext> env, Name name, KindSelector kind) {
Symbol bestSoFar = typeNotFound;
Symbol sym;
@@ -2354,6 +2360,11 @@
*/
Symbol findIdentInPackage(Env<AttrContext> env, TypeSymbol pck,
Name name, KindSelector kind) {
+ return checkVarType(findIdentInPackageInternal(env, pck, name, kind), name);
+ }
+
+ Symbol findIdentInPackageInternal(Env<AttrContext> env, TypeSymbol pck,
+ Name name, KindSelector kind) {
Name fullname = TypeSymbol.formFullName(name, pck);
Symbol bestSoFar = typeNotFound;
if (kind.contains(KindSelector.TYP)) {
@@ -2383,6 +2394,11 @@
*/
Symbol findIdentInType(Env<AttrContext> env, Type site,
Name name, KindSelector kind) {
+ return checkVarType(findIdentInTypeInternal(env, site, name, kind), name);
+ }
+
+ Symbol findIdentInTypeInternal(Env<AttrContext> env, Type site,
+ Name name, KindSelector kind) {
Symbol bestSoFar = typeNotFound;
Symbol sym;
if (kind.contains(KindSelector.VAL)) {
@@ -2399,6 +2415,14 @@
return bestSoFar;
}
+ private Symbol checkVarType(Symbol bestSoFar, Name name) {
+ if (allowLocalVariableTypeInference && name.equals(names.var) &&
+ (bestSoFar.kind == TYP || bestSoFar.kind == ABSENT_TYP)) {
+ bestSoFar = new BadVarTypeError();
+ }
+ return bestSoFar;
+ }
+
/* ***************************************************************************
* Access checking
* The following methods convert ResolveErrors to ErrorSymbols, issuing
@@ -3774,6 +3798,17 @@
}
}
+ class BadVarTypeError extends ResolveError {
+ BadVarTypeError() {
+ super(Kind.BAD_VAR, "bad var use");
+ }
+
+ @Override
+ JCDiagnostic getDiagnostic(DiagnosticType dkind, DiagnosticPosition pos, Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) {
+ return diags.create(dkind, log.currentSource(), pos, "illegal.ref.to.var.type", name);
+ }
+ }
+
/**
* InvalidSymbolError error class indicating that a symbol matching a
* given name does not exists in a given site.
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java Thu Sep 28 09:13:27 2017 -0700
@@ -72,6 +72,7 @@
private Enter enter;
private Types types;
private Annotate annotate;
+ private Attr attr;
private final Resolve resolve;
private final CompileStates compileStates;
@@ -96,6 +97,7 @@
allowInterfaceBridges = source.allowDefaultMethods();
allowGraphInference = source.allowGraphInference();
annotate = Annotate.instance(context);
+ attr = Attr.instance(context);
}
/** A hashtable mapping bridge methods to the pair of methods they bridge.
@@ -693,8 +695,14 @@
}
public void visitNewClass(JCNewClass tree) {
- if (tree.encl != null)
- tree.encl = translate(tree.encl, erasure(tree.encl.type));
+ if (tree.encl != null) {
+ if (tree.def == null) {
+ tree.encl = translate(tree.encl, erasure(tree.encl.type));
+ } else {
+ tree.args = tree.args.prepend(attr.makeNullCheck(tree.encl));
+ tree.encl = null;
+ }
+ }
Type erasedConstructorType = tree.constructorType != null ?
erasure(tree.constructorType) :
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java Thu Sep 28 09:13:27 2017 -0700
@@ -1030,6 +1030,9 @@
if (c.name.isEmpty()) {
flags |= ANONCONSTR;
}
+ if (based) {
+ flags |= ANONCONSTR_BASED;
+ }
Type mType = new MethodType(argtypes, null, thrown, c);
Type initType = typarams.nonEmpty() ?
new ForAll(typarams, mType) :
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java Thu Sep 28 09:13:27 2017 -0700
@@ -179,6 +179,7 @@
this.allowAnnotationsAfterTypeParams = source.allowAnnotationsAfterTypeParams();
this.allowUnderscoreIdentifier = source.allowUnderscoreIdentifier();
this.allowPrivateInterfaceMethods = source.allowPrivateInterfaceMethods();
+ this.allowLocalVariableTypeInference = source.allowLocalVariableTypeInference();
this.keepDocComments = keepDocComments;
this.parseModuleInfo = parseModuleInfo;
docComments = newDocCommentTable(keepDocComments, fac);
@@ -270,11 +271,14 @@
*/
boolean allowThisIdent;
+ /** Switch: is local variable inference allowed?
+ */
+ boolean allowLocalVariableTypeInference;
+
/** The type of the method receiver, as specified by a first "this" parameter.
*/
JCVariableDecl receiverParam;
-
/** When terms are parsed, the mode determines which is expected:
* mode = EXPR : an expression
* mode = TYPE : a type
@@ -808,12 +812,16 @@
* parsing annotations.
*/
public JCExpression parseType() {
- List<JCAnnotation> annotations = typeAnnotationsOpt();
- return parseType(annotations);
+ return parseType(false);
}
- public JCExpression parseType(List<JCAnnotation> annotations) {
- JCExpression result = unannotatedType();
+ public JCExpression parseType(boolean allowVar) {
+ List<JCAnnotation> annotations = typeAnnotationsOpt();
+ return parseType(allowVar, annotations);
+ }
+
+ public JCExpression parseType(boolean allowVar, List<JCAnnotation> annotations) {
+ JCExpression result = unannotatedType(allowVar);
if (annotations.nonEmpty()) {
result = insertAnnotationsToMostInner(result, annotations, false);
@@ -822,10 +830,18 @@
return result;
}
- public JCExpression unannotatedType() {
- return term(TYPE);
+ public JCExpression unannotatedType(boolean allowVar) {
+ JCExpression result = term(TYPE);
+
+ if (!allowVar && isRestrictedLocalVarTypeName(result)) {
+ syntaxError(result.pos, "var.not.allowed.here");
+ }
+
+ return result;
}
+
+
protected JCExpression term(int newmode) {
int prevmode = mode;
mode = newmode;
@@ -1152,11 +1168,11 @@
accept(LPAREN);
mode = TYPE;
int pos1 = pos;
- List<JCExpression> targets = List.of(t = term3());
+ List<JCExpression> targets = List.of(t = parseType());
while (token.kind == AMP) {
checkIntersectionTypesInCast();
accept(AMP);
- targets = targets.prepend(term3());
+ targets = targets.prepend(parseType());
}
if (targets.length() > 1) {
t = toP(F.at(pos1).TypeIntersection(targets.reverse()));
@@ -1912,7 +1928,7 @@
*/
JCExpression typeArgument() {
List<JCAnnotation> annotations = typeAnnotationsOpt();
- if (token.kind != QUES) return parseType(annotations);
+ if (token.kind != QUES) return parseType(false, annotations);
int pos = token.pos;
nextToken();
JCExpression result;
@@ -2425,13 +2441,8 @@
token.kind == ENUM) {
return List.of(classOrInterfaceOrEnumDeclaration(mods, dc));
} else {
- JCExpression t = parseType();
- ListBuffer<JCStatement> stats =
- variableDeclarators(mods, t, new ListBuffer<JCStatement>());
- // A "LocalVariableDeclarationStatement" subsumes the terminating semicolon
- accept(SEMI);
- storeEnd(stats.last(), S.prevToken().endPos);
- return stats.toList();
+ JCExpression t = parseType(true);
+ return localVariableDeclarations(mods, t);
}
}
case ABSTRACT: case STRICTFP: {
@@ -2458,12 +2469,7 @@
pos = token.pos;
JCModifiers mods = F.at(Position.NOPOS).Modifiers(0);
F.at(pos);
- ListBuffer<JCStatement> stats =
- variableDeclarators(mods, t, new ListBuffer<JCStatement>());
- // A "LocalVariableDeclarationStatement" subsumes the terminating semicolon
- accept(SEMI);
- storeEnd(stats.last(), S.prevToken().endPos);
- return stats.toList();
+ return localVariableDeclarations(mods, t);
} else {
// This Exec is an "ExpressionStatement"; it subsumes the terminating semicolon
t = checkExprStat(t);
@@ -2473,6 +2479,15 @@
}
}
}
+ //where
+ private List<JCStatement> localVariableDeclarations(JCModifiers mods, JCExpression type) {
+ ListBuffer<JCStatement> stats =
+ variableDeclarators(mods, type, new ListBuffer<>(), true);
+ // A "LocalVariableDeclarationStatement" subsumes the terminating semicolon
+ accept(SEMI);
+ storeEnd(stats.last(), S.prevToken().endPos);
+ return stats.toList();
+ }
/** Statement =
* Block
@@ -2766,11 +2781,11 @@
ListBuffer<JCStatement> stats = new ListBuffer<>();
int pos = token.pos;
if (token.kind == FINAL || token.kind == MONKEYS_AT) {
- return variableDeclarators(optFinal(0), parseType(), stats).toList();
+ return variableDeclarators(optFinal(0), parseType(true), stats, true).toList();
} else {
JCExpression t = term(EXPR | TYPE);
if ((lastmode & TYPE) != 0 && LAX_IDENTIFIER.accepts(token.kind)) {
- return variableDeclarators(modifiersOpt(), t, stats).toList();
+ return variableDeclarators(modifiersOpt(), t, stats, true).toList();
} else if ((lastmode & TYPE) != 0 && token.kind == COLON) {
error(pos, "bad.initializer", "for-loop");
return List.of((JCStatement)F.at(pos).VarDef(null, null, t, null));
@@ -2989,9 +3004,10 @@
*/
public <T extends ListBuffer<? super JCVariableDecl>> T variableDeclarators(JCModifiers mods,
JCExpression type,
- T vdefs)
+ T vdefs,
+ boolean localDecl)
{
- return variableDeclaratorsRest(token.pos, mods, type, ident(), false, null, vdefs);
+ return variableDeclaratorsRest(token.pos, mods, type, ident(), false, null, vdefs, localDecl);
}
/** VariableDeclaratorsRest = VariableDeclaratorRest { "," VariableDeclarator }
@@ -3006,14 +3022,20 @@
Name name,
boolean reqInit,
Comment dc,
- T vdefs)
+ T vdefs,
+ boolean localDecl)
{
- vdefs.append(variableDeclaratorRest(pos, mods, type, name, reqInit, dc));
+ JCVariableDecl head = variableDeclaratorRest(pos, mods, type, name, reqInit, dc, localDecl);
+ boolean implicit = allowLocalVariableTypeInference && head.vartype == null;
+ vdefs.append(head);
while (token.kind == COMMA) {
+ if (implicit) {
+ reportSyntaxError(pos, "var.not.allowed.compound");
+ }
// All but last of multiple declarators subsume a comma
storeEnd((JCTree)vdefs.last(), token.endPos);
nextToken();
- vdefs.append(variableDeclarator(mods, type, reqInit, dc));
+ vdefs.append(variableDeclarator(mods, type, reqInit, dc, localDecl));
}
return vdefs;
}
@@ -3021,8 +3043,8 @@
/** VariableDeclarator = Ident VariableDeclaratorRest
* ConstantDeclarator = Ident ConstantDeclaratorRest
*/
- JCVariableDecl variableDeclarator(JCModifiers mods, JCExpression type, boolean reqInit, Comment dc) {
- return variableDeclaratorRest(token.pos, mods, type, ident(), reqInit, dc);
+ JCVariableDecl variableDeclarator(JCModifiers mods, JCExpression type, boolean reqInit, Comment dc, boolean localDecl) {
+ return variableDeclaratorRest(token.pos, mods, type, ident(), reqInit, dc, localDecl);
}
/** VariableDeclaratorRest = BracketsOpt ["=" VariableInitializer]
@@ -3032,7 +3054,7 @@
* @param dc The documentation comment for the variable declarations, or null.
*/
JCVariableDecl variableDeclaratorRest(int pos, JCModifiers mods, JCExpression type, Name name,
- boolean reqInit, Comment dc) {
+ boolean reqInit, Comment dc, boolean localDecl) {
type = bracketsOpt(type);
JCExpression init = null;
if (token.kind == EQ) {
@@ -3040,12 +3062,40 @@
init = variableInitializer();
}
else if (reqInit) syntaxError(token.pos, "expected", EQ);
+ JCTree elemType = TreeInfo.innermostType(type, true);
+ if (allowLocalVariableTypeInference && elemType.hasTag(IDENT)) {
+ Name typeName = ((JCIdent)elemType).name;
+ if (isRestrictedLocalVarTypeName(typeName)) {
+ if (type.hasTag(TYPEARRAY)) {
+ //error - 'var' and arrays
+ reportSyntaxError(pos, "var.not.allowed.array");
+ } else {
+ //implicit type
+ type = null;
+ }
+ }
+ }
JCVariableDecl result =
toP(F.at(pos).VarDef(mods, name, type, init));
attach(result, dc);
return result;
}
+ boolean isRestrictedLocalVarTypeName(JCExpression e) {
+ switch (e.getTag()) {
+ case IDENT:
+ return isRestrictedLocalVarTypeName(((JCIdent)e).name);
+ case TYPEARRAY:
+ return isRestrictedLocalVarTypeName(((JCArrayTypeTree)e).elemtype);
+ default:
+ return false;
+ }
+ }
+
+ boolean isRestrictedLocalVarTypeName(Name name) {
+ return allowLocalVariableTypeInference && name == names.var;
+ }
+
/** VariableDeclaratorId = Ident BracketsOpt
*/
JCVariableDecl variableDeclaratorId(JCModifiers mods, JCExpression type) {
@@ -3111,13 +3161,13 @@
int startPos = token.pos;
if (token.kind == FINAL || token.kind == MONKEYS_AT) {
JCModifiers mods = optFinal(Flags.FINAL);
- JCExpression t = parseType();
- return variableDeclaratorRest(token.pos, mods, t, ident(), true, null);
+ JCExpression t = parseType(true);
+ return variableDeclaratorRest(token.pos, mods, t, ident(), true, null, true);
}
JCExpression t = term(EXPR | TYPE);
if ((lastmode & TYPE) != 0 && LAX_IDENTIFIER.accepts(token.kind)) {
JCModifiers mods = toP(F.at(startPos).Modifiers(Flags.FINAL));
- return variableDeclaratorRest(token.pos, mods, t, ident(), true, null);
+ return variableDeclaratorRest(token.pos, mods, t, ident(), true, null, true);
} else {
checkVariableInTryWithResources(startPos);
if (!t.hasTag(IDENT) && !t.hasTag(SELECT)) {
@@ -3152,10 +3202,9 @@
nextToken();
JCExpression pid = qualident(false);
accept(SEMI);
- JCPackageDecl pd = F.at(packagePos).PackageDecl(annotations, pid);
+ JCPackageDecl pd = toP(F.at(packagePos).PackageDecl(annotations, pid));
attach(pd, firstToken.comment(CommentStyle.JAVADOC));
consumedToplevelDoc = true;
- storeEnd(pd, token.pos);
defs.append(pd);
}
@@ -3398,7 +3447,7 @@
protected JCClassDecl classDeclaration(JCModifiers mods, Comment dc) {
int pos = token.pos;
accept(CLASS);
- Name name = ident();
+ Name name = typeName();
List<JCTypeParameter> typarams = typeParametersOpt();
@@ -3419,6 +3468,15 @@
return result;
}
+ Name typeName() {
+ int pos = token.pos;
+ Name name = ident();
+ if (isRestrictedLocalVarTypeName(name)) {
+ reportSyntaxError(pos, "var.not.allowed", name);
+ }
+ return name;
+ }
+
/** InterfaceDeclaration = INTERFACE Ident TypeParametersOpt
* [EXTENDS TypeList] InterfaceBody
* @param mods The modifiers starting the interface declaration
@@ -3427,7 +3485,8 @@
protected JCClassDecl interfaceDeclaration(JCModifiers mods, Comment dc) {
int pos = token.pos;
accept(INTERFACE);
- Name name = ident();
+
+ Name name = typeName();
List<JCTypeParameter> typarams = typeParametersOpt();
@@ -3450,7 +3509,8 @@
protected JCClassDecl enumDeclaration(JCModifiers mods, Comment dc) {
int pos = token.pos;
accept(ENUM);
- Name name = ident();
+
+ Name name = typeName();
List<JCExpression> implementing = List.nil();
if (token.kind == IMPLEMENTS) {
@@ -3648,7 +3708,7 @@
nextToken();
} else {
// method returns types are un-annotated types
- type = unannotatedType();
+ type = unannotatedType(false);
}
if (token.kind == LPAREN && !isInterface && type.hasTag(IDENT)) {
if (isInterface || tk.name() != className)
@@ -3668,7 +3728,7 @@
} else if (!isVoid && typarams.isEmpty()) {
List<JCTree> defs =
variableDeclaratorsRest(pos, mods, type, name, isInterface, dc,
- new ListBuffer<JCTree>()).toList();
+ new ListBuffer<JCTree>(), false).toList();
accept(SEMI);
storeEnd(defs.last(), S.prevToken().endPos);
return defs;
@@ -3810,7 +3870,7 @@
JCTypeParameter typeParameter() {
int pos = token.pos;
List<JCAnnotation> annos = typeAnnotationsOpt();
- Name name = ident();
+ Name name = typeName();
ListBuffer<JCExpression> bounds = new ListBuffer<>();
if (token.kind == EXTENDS) {
nextToken();
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties Thu Sep 28 09:13:27 2017 -0700
@@ -1190,6 +1190,47 @@
compiler.err.undef.label=\
undefined label: {0}
+# 0: name (type)
+compiler.err.illegal.ref.to.var.type=\
+ illegal reference to restricted type ''{0}''
+
+# 0: token
+compiler.err.var.not.allowed=\
+ ''{0}'' not allowed here\n\
+ as of release 10, ''{0}'' is a restricted local variable type and cannot be used for type declarations
+
+# 0: name (variable), 1: message segment
+compiler.err.cant.infer.local.var.type=\
+ cannot infer type for local variable {0}\n\
+ ({1})
+
+compiler.err.var.not.allowed.here=\
+ ''var'' is not allowed here
+
+compiler.err.var.not.allowed.array=\
+ ''var'' is not allowed as an element type of an array
+
+compiler.err.var.not.allowed.compound=\
+ ''var'' is not allowed in a compound declaration
+
+compiler.misc.local.cant.infer.null=\
+ variable initializer is ''null''
+
+compiler.misc.local.missing.init=\
+ cannot use ''var'' on variable without initializer
+
+compiler.misc.local.lambda.missing.target=\
+ lambda expression needs an explicit target-type
+
+compiler.misc.local.mref.missing.target=\
+ method reference needs an explicit target-type
+
+compiler.misc.local.array.missing.target=\
+ array initializer needs an explicit target-type
+
+compiler.misc.local.self.ref=\
+ cannot use ''var'' on self-referencing variable
+
# 0: message segment, 1: unused
compiler.err.cant.apply.diamond=\
cannot infer type arguments for {0}
@@ -1873,6 +1914,9 @@
compiler.warn.diamond.redundant.args=\
Redundant type arguments in new expression (use diamond operator instead).
+compiler.warn.local.redundant.type=\
+ Redundant type for local variable (replace explicit type with ''var'').
+
compiler.warn.potential.lambda.found=\
This anonymous inner class creation can be turned into a lambda expression.
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java Thu Sep 28 09:13:27 2017 -0700
@@ -946,6 +946,10 @@
}
}
+ public boolean isImplicitlyTyped() {
+ return vartype == null;
+ }
+
@Override
public void accept(Visitor v) { v.visitVarDef(this); }
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/Pretty.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/Pretty.java Thu Sep 28 09:13:27 2017 -0700
@@ -1359,7 +1359,7 @@
// Prints the inner element type of a nested array
private void printBaseElementType(JCTree tree) throws IOException {
- printExpr(TreeInfo.innermostType(tree));
+ printExpr(TreeInfo.innermostType(tree, false));
}
// prints the brackets of a nested array in reverse order
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java Thu Sep 28 09:13:27 2017 -0700
@@ -1136,7 +1136,7 @@
* For an array that contains an annotated type, return that annotated type.
* TODO: currently only used by Pretty. Describe behavior better.
*/
- public static JCTree innermostType(JCTree type) {
+ public static JCTree innermostType(JCTree type, boolean skipAnnos) {
JCTree lastAnnotatedType = null;
JCTree cur = type;
loop: while (true) {
@@ -1157,7 +1157,7 @@
break loop;
}
}
- if (lastAnnotatedType!=null) {
+ if (!skipAnnos && lastAnnotatedType!=null) {
return lastAnnotatedType;
} else {
return cur;
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java Thu Sep 28 09:13:27 2017 -0700
@@ -63,6 +63,7 @@
public final Name _default;
public final Name _super;
public final Name _this;
+ public final Name var;
public final Name exports;
public final Name opens;
public final Name module;
@@ -224,6 +225,7 @@
_default = fromString("default");
_super = fromString("super");
_this = fromString("this");
+ var = fromString("var");
exports = fromString("exports");
opens = fromString("opens");
module = fromString("module");
--- a/src/jdk.compiler/share/classes/module-info.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/module-info.java Thu Sep 28 09:13:27 2017 -0700
@@ -106,7 +106,8 @@
exports com.sun.tools.javac.jvm to
jdk.javadoc;
exports com.sun.tools.javac.main to
- jdk.javadoc;
+ jdk.javadoc,
+ jdk.jshell;
exports com.sun.tools.javac.model to
jdk.javadoc;
exports com.sun.tools.javac.parser to
--- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java Thu Sep 28 09:13:27 2017 -0700
@@ -1212,7 +1212,6 @@
CallbackHandler myHandler = getCallbackHandler(handler);
if (myHandler == null) {
- // XXX PolicyTool is dependent on this message text
throw new LoginException
("no password provided, and no callback handler " +
"available for retrieving password");
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.jartool/share/classes/jdk/security/jarsigner/package-info.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+/**
+ * This package defines APIs for signing jar files.
+ */
+package jdk.security.jarsigner;
--- a/src/jdk.jartool/share/classes/module-info.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.jartool/share/classes/module-info.java Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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 @@
* Defines tools for manipulating Java Archive (JAR) files,
* including the <em>{@index jar jar tool}</em> and
* <em>{@index jarsigner jarsigner tool}</em> tools.
+ * This module also defines APIs for signing JAR files.
*
* <p> This module provides the equivalent of command-line access to
* <em>jar</em> via the {@link java.util.spi.ToolProvider ToolProvider} SPI.
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java Thu Sep 28 09:13:27 2017 -0700
@@ -39,6 +39,7 @@
import javax.lang.model.type.TypeVariable;
import javax.lang.model.util.SimpleTypeVisitor9;
+import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.toolkit.Content;
@@ -199,55 +200,61 @@
*/
protected void addParameters(ExecutableElement member,
boolean includeAnnotations, Content htmltree, int indentSize) {
- htmltree.addContent(Contents.ZERO_WIDTH_SPACE);
- htmltree.addContent("(");
+ Content paramTree = new ContentBuilder();
String sep = "";
List<? extends VariableElement> parameters = member.getParameters();
CharSequence indent = makeSpace(indentSize + 1);
TypeMirror rcvrType = member.getReceiverType();
if (includeAnnotations && rcvrType != null && utils.isAnnotated(rcvrType)) {
List<? extends AnnotationMirror> annotationMirrors = rcvrType.getAnnotationMirrors();
- addReceiverAnnotations(member, rcvrType, annotationMirrors, htmltree);
+ addReceiverAnnotations(member, rcvrType, annotationMirrors, paramTree);
sep = "," + DocletConstants.NL + indent;
}
int paramstart;
for (paramstart = 0; paramstart < parameters.size(); paramstart++) {
- htmltree.addContent(sep);
+ paramTree.addContent(sep);
VariableElement param = parameters.get(paramstart);
if (param.getKind() != ElementKind.INSTANCE_INIT) {
if (includeAnnotations) {
boolean foundAnnotations =
writer.addAnnotationInfo(indent.length(),
- member, param, htmltree);
+ member, param, paramTree);
if (foundAnnotations) {
- htmltree.addContent(DocletConstants.NL);
- htmltree.addContent(indent);
+ paramTree.addContent(DocletConstants.NL);
+ paramTree.addContent(indent);
}
}
addParam(member, param,
- (paramstart == parameters.size() - 1) && member.isVarArgs(), htmltree);
+ (paramstart == parameters.size() - 1) && member.isVarArgs(), paramTree);
break;
}
}
for (int i = paramstart + 1; i < parameters.size(); i++) {
- htmltree.addContent(",");
- htmltree.addContent(DocletConstants.NL);
- htmltree.addContent(indent);
+ paramTree.addContent(",");
+ paramTree.addContent(DocletConstants.NL);
+ paramTree.addContent(indent);
if (includeAnnotations) {
boolean foundAnnotations =
writer.addAnnotationInfo(indent.length(), member, parameters.get(i),
- htmltree);
+ paramTree);
if (foundAnnotations) {
- htmltree.addContent(DocletConstants.NL);
- htmltree.addContent(indent);
+ paramTree.addContent(DocletConstants.NL);
+ paramTree.addContent(indent);
}
}
addParam(member, parameters.get(i), (i == parameters.size() - 1) && member.isVarArgs(),
- htmltree);
+ paramTree);
}
- htmltree.addContent(")");
+ if (paramTree.isEmpty()) {
+ htmltree.addContent("()");
+ } else {
+ htmltree.addContent(Contents.ZERO_WIDTH_SPACE);
+ htmltree.addContent("(");
+ htmltree.addContent(paramTree);
+ paramTree.addContent(")");
+ }
}
/**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java Thu Sep 28 09:13:27 2017 -0700
@@ -364,7 +364,7 @@
List<? extends DocTree> tags;
Content span = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(element));
HtmlTree div = new HtmlTree(HtmlTag.DIV);
- div.addStyle(HtmlStyle.block);
+ div.addStyle(HtmlStyle.deprecationBlock);
if (utils.isDeprecated(element)) {
div.addContent(span);
tags = utils.getBlockTags(element, DocTree.Kind.DEPRECATED);
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java Thu Sep 28 09:13:27 2017 -0700
@@ -355,7 +355,7 @@
writer.getTagletWriterInstance(false));
if (!output.isEmpty()) {
Content deprecatedContent = output;
- Content div = HtmlTree.DIV(HtmlStyle.block, deprecatedContent);
+ Content div = HtmlTree.DIV(HtmlStyle.deprecationBlock, deprecatedContent);
contentTree.addContent(div);
}
}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java Thu Sep 28 09:13:27 2017 -0700
@@ -278,7 +278,8 @@
*/
@Override
public void addAnnotationTypeSignature(String modifiers, Content annotationInfoTree) {
- annotationInfoTree.addContent(new HtmlTree(HtmlTag.BR));
+ Content hr = new HtmlTree(HtmlTag.HR);
+ annotationInfoTree.addContent(hr);
Content pre = new HtmlTree(HtmlTag.PRE);
addAnnotationInfo(annotationType, pre);
pre.addContent(modifiers);
@@ -324,13 +325,11 @@
*/
@Override
public void addAnnotationTypeDeprecationInfo(Content annotationInfoTree) {
- Content hr = new HtmlTree(HtmlTag.HR);
- annotationInfoTree.addContent(hr);
List<? extends DocTree> deprs = utils.getBlockTags(annotationType, DocTree.Kind.DEPRECATED);
if (utils.isDeprecated(annotationType)) {
CommentHelper ch = utils.getCommentHelper(annotationType);
Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(annotationType));
- Content div = HtmlTree.DIV(HtmlStyle.block, deprLabel);
+ Content div = HtmlTree.DIV(HtmlStyle.deprecationBlock, deprLabel);
if (!deprs.isEmpty()) {
List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0));
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java Thu Sep 28 09:13:27 2017 -0700
@@ -293,7 +293,8 @@
*/
@Override
public void addClassSignature(String modifiers, Content classInfoTree) {
- classInfoTree.addContent(new HtmlTree(HtmlTag.BR));
+ Content hr = new HtmlTree(HtmlTag.HR);
+ classInfoTree.addContent(hr);
Content pre = new HtmlTree(HtmlTag.PRE);
addAnnotationInfo(typeElement, pre);
pre.addContent(modifiers);
@@ -606,12 +607,10 @@
*/
@Override
public void addClassDeprecationInfo(Content classInfoTree) {
- Content hr = new HtmlTree(HtmlTag.HR);
- classInfoTree.addContent(hr);
List<? extends DocTree> deprs = utils.getBlockTags(typeElement, DocTree.Kind.DEPRECATED);
if (utils.isDeprecated(typeElement)) {
Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(typeElement));
- Content div = HtmlTree.DIV(HtmlStyle.block, deprLabel);
+ Content div = HtmlTree.DIV(HtmlStyle.deprecationBlock, deprLabel);
if (!deprs.isEmpty()) {
CommentHelper ch = utils.getCommentHelper(typeElement);
DocTree dt = deprs.get(0);
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/LinkFactoryImpl.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/LinkFactoryImpl.java Thu Sep 28 09:13:27 2017 -0700
@@ -139,11 +139,6 @@
}
@Override
- protected Content getTypeAnnotationLink(LinkInfo linkInfo, AnnotationMirror annotation) {
- throw new RuntimeException("Not implemented yet!");
- }
-
- @Override
public Content getTypeAnnotationLinks(LinkInfo linkInfo) {
Utils utils = ((LinkInfoImpl)linkInfo).utils;
ContentBuilder links = new ContentBuilder();
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java Thu Sep 28 09:13:27 2017 -0700
@@ -929,7 +929,7 @@
if (utils.isDeprecated(mdle)) {
CommentHelper ch = utils.getCommentHelper(mdle);
HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
- deprDiv.addStyle(HtmlStyle.deprecatedContent);
+ deprDiv.addStyle(HtmlStyle.deprecationBlock);
Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(mdle));
deprDiv.addContent(deprPhrase);
if (!deprs.isEmpty()) {
@@ -1064,7 +1064,7 @@
if (utils.isDeprecated(pkg)) {
deprs = utils.getDeprecatedTrees(pkg);
HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
- deprDiv.addStyle(HtmlStyle.deprecatedContent);
+ deprDiv.addStyle(HtmlStyle.deprecationBlock);
Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(pkg));
deprDiv.addContent(deprPhrase);
if (!deprs.isEmpty()) {
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java Thu Sep 28 09:13:27 2017 -0700
@@ -171,7 +171,7 @@
if (utils.isDeprecated(packageElement)) {
CommentHelper ch = utils.getCommentHelper(packageElement);
HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
- deprDiv.addStyle(HtmlStyle.deprecatedContent);
+ deprDiv.addStyle(HtmlStyle.deprecationBlock);
Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(packageElement));
deprDiv.addContent(deprPhrase);
if (!deprs.isEmpty()) {
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java Thu Sep 28 09:13:27 2017 -0700
@@ -53,9 +53,9 @@
constantsSummary,
constantValuesContainer,
contentContainer,
- deprecatedContent,
deprecatedLabel,
deprecatedSummary,
+ deprecationBlock,
deprecationComment,
description,
descfrmTypeLabel,
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeBuilder.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeBuilder.java Thu Sep 28 09:13:27 2017 -0700
@@ -147,8 +147,8 @@
throws DocletException {
Content annotationInfoTree = writer.getAnnotationInfoTreeHeader();
+ buildAnnotationTypeSignature(annotationInfoTree);
buildDeprecationInfo(annotationInfoTree);
- buildAnnotationTypeSignature(annotationInfoTree);
buildAnnotationTypeDescription(annotationInfoTree);
buildAnnotationTypeTagInfo(annotationInfoTree);
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ClassBuilder.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ClassBuilder.java Thu Sep 28 09:13:27 2017 -0700
@@ -175,8 +175,8 @@
buildInterfaceUsageInfo(classInfoTree);
buildNestedClassInfo(classInfoTree);
buildFunctionalInterfaceInfo(classInfoTree);
+ buildClassSignature(classInfoTree);
buildDeprecationInfo(classInfoTree);
- buildClassSignature(classInfoTree);
buildClassDescription(classInfoTree);
buildClassTagInfo(classInfoTree);
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css Thu Sep 28 09:13:27 2017 -0700
@@ -645,6 +645,17 @@
.deprecationComment, .emphasizedPhrase, .interfaceName {
font-style:italic;
}
+.deprecationBlock {
+ font-size:14px;
+ font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif;
+ border-style:solid;
+ border-width:thin;
+ border-radius:10px;
+ padding:10px;
+ margin-bottom:10px;
+ margin-right:10px;
+ display:inline-block;
+}
div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase,
div.block div.block span.interfaceName {
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/links/LinkFactory.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/links/LinkFactory.java Thu Sep 28 09:13:27 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
@@ -223,8 +223,6 @@
*/
protected abstract Content getTypeParameterLink(LinkInfo linkInfo, TypeMirror typeParam);
- protected abstract Content getTypeAnnotationLink(LinkInfo linkInfo, AnnotationMirror annotation);
-
/**
* Return the links to the type parameters.
*
@@ -282,23 +280,5 @@
return links;
}
- public Content getTypeAnnotationLinks(LinkInfo linkInfo) {
- Utils utils = ((LinkInfoImpl)linkInfo).utils;
- Content links = newContent();
- if (!utils.isAnnotated(linkInfo.type))
- return links;
-
- List<? extends AnnotationMirror> annotations = linkInfo.type.getAnnotationMirrors();
- boolean needSpace = false;
- for (AnnotationMirror anno : annotations) {
- if (needSpace) {
- links.addContent(" ");
- }
- links.addContent(getTypeAnnotationLink(linkInfo, anno));
- needSpace = true;
- }
-
- links.addContent(" ");
- return links;
- }
+ public abstract Content getTypeAnnotationLinks(LinkInfo linkInfo);
}
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsConfiguration.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsConfiguration.java Thu Sep 28 09:13:27 2017 -0700
@@ -285,7 +285,9 @@
String mn = mref.descriptor().name();
URI location = mref.location().orElseThrow(FileNotFoundException::new);
ModuleDescriptor md = mref.descriptor();
- Module.Builder builder = new Module.Builder(md, system.find(mn).isPresent());
+ // is this module from the system module path?
+ URI loc = system.find(mn).flatMap(ModuleReference::location).orElse(null);
+ boolean isSystem = location.equals(loc);
final ClassFileReader reader;
if (location.getScheme().equals("jrt")) {
@@ -293,7 +295,7 @@
} else {
reader = ClassFileReader.newInstance(Paths.get(location), version);
}
-
+ Module.Builder builder = new Module.Builder(md, isSystem);
builder.classes(reader);
builder.location(location);
--- a/src/jdk.jshell/share/classes/jdk/jshell/Eval.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.jshell/share/classes/jdk/jshell/Eval.java Thu Sep 28 09:13:27 2017 -0700
@@ -40,6 +40,7 @@
import com.sun.source.tree.IdentifierTree;
import com.sun.source.tree.MethodTree;
import com.sun.source.tree.ModifiersTree;
+import com.sun.source.tree.NewClassTree;
import com.sun.source.tree.Tree;
import com.sun.source.tree.VariableTree;
import com.sun.tools.javac.tree.JCTree;
@@ -59,6 +60,7 @@
import jdk.jshell.TaskFactory.BaseTask;
import jdk.jshell.TaskFactory.CompileTask;
import jdk.jshell.TaskFactory.ParseTask;
+import jdk.jshell.Wrap.CompoundWrap;
import jdk.jshell.Wrap.Range;
import jdk.jshell.Snippet.Status;
import jdk.jshell.spi.ExecutionControl.ClassBytecodes;
@@ -274,26 +276,119 @@
for (Tree unitTree : units) {
VariableTree vt = (VariableTree) unitTree;
String name = vt.getName().toString();
- String typeName = EvalPretty.prettyExpr((JCTree) vt.getType(), false);
- Tree baseType = vt.getType();
+ String typeName;
+ String fullTypeName;
TreeDependencyScanner tds = new TreeDependencyScanner();
- tds.scan(baseType); // Not dependent on initializer
+ Wrap typeWrap;
+ Wrap anonDeclareWrap = null;
+ Wrap winit = null;
StringBuilder sbBrackets = new StringBuilder();
- while (baseType instanceof ArrayTypeTree) {
- //TODO handle annotations too
- baseType = ((ArrayTypeTree) baseType).getType();
- sbBrackets.append("[]");
+ Tree baseType = vt.getType();
+ if (baseType != null) {
+ tds.scan(baseType); // Not dependent on initializer
+ fullTypeName = typeName = EvalPretty.prettyExpr((JCTree) vt.getType(), false);
+ while (baseType instanceof ArrayTypeTree) {
+ //TODO handle annotations too
+ baseType = ((ArrayTypeTree) baseType).getType();
+ sbBrackets.append("[]");
+ }
+ Range rtype = dis.treeToRange(baseType);
+ typeWrap = Wrap.rangeWrap(compileSource, rtype);
+ } else {
+ Tree init = vt.getInitializer();
+ if (init != null) {
+ Range rinit = dis.treeToRange(init);
+ String initCode = rinit.part(compileSource);
+ ExpressionInfo ei =
+ ExpressionToTypeInfo.localVariableTypeForInitializer(initCode, state);
+ typeName = ei == null ? "java.lang.Object" : ei.typeName;
+ fullTypeName = ei == null ? "java.lang.Object" : ei.fullTypeName;
+ if (ei != null && init.getKind() == Tree.Kind.NEW_CLASS &&
+ ((NewClassTree) init).getClassBody() != null) {
+ NewClassTree nct = (NewClassTree) init;
+ StringBuilder constructor = new StringBuilder();
+ constructor.append(fullTypeName).append("(");
+ String sep = "";
+ if (ei.enclosingInstanceType != null) {
+ constructor.append(ei.enclosingInstanceType);
+ constructor.append(" encl");
+ sep = ", ";
+ }
+ int idx = 0;
+ for (String type : ei.parameterTypes) {
+ constructor.append(sep);
+ constructor.append(type);
+ constructor.append(" ");
+ constructor.append("arg" + idx++);
+ sep = ", ";
+ }
+ if (ei.enclosingInstanceType != null) {
+ constructor.append(") { encl.super (");
+ } else {
+ constructor.append(") { super (");
+ }
+ sep = "";
+ for (int i = 0; i < idx; i++) {
+ constructor.append(sep);
+ constructor.append("arg" + i++);
+ sep = ", ";
+ }
+ constructor.append("); }");
+ List<? extends Tree> members = nct.getClassBody().getMembers();
+ Range bodyRange = dis.treeListToRange(members);
+ Wrap bodyWrap;
+
+ if (bodyRange != null) {
+ bodyWrap = Wrap.rangeWrap(compileSource, bodyRange);
+ } else {
+ bodyWrap = Wrap.simpleWrap(" ");
+ }
+
+ Range argRange = dis.treeListToRange(nct.getArguments());
+ Wrap argWrap;
+
+ if (argRange != null) {
+ argWrap = Wrap.rangeWrap(compileSource, argRange);
+ } else {
+ argWrap = Wrap.simpleWrap(" ");
+ }
+
+ if (ei.enclosingInstanceType != null) {
+ Range enclosingRanges =
+ dis.treeToRange(nct.getEnclosingExpression());
+ Wrap enclosingWrap = Wrap.rangeWrap(compileSource, enclosingRanges);
+ argWrap = argRange != null ? new CompoundWrap(enclosingWrap,
+ Wrap.simpleWrap(","),
+ argWrap)
+ : enclosingWrap;
+ }
+ Wrap hwrap = Wrap.simpleWrap("public static class " + fullTypeName +
+ (ei.isClass ? " extends " : " implements ") +
+ typeName + " { " + constructor);
+ anonDeclareWrap = new CompoundWrap(hwrap, bodyWrap, Wrap.simpleWrap("}"));
+ winit = new CompoundWrap("new " + fullTypeName + "(", argWrap, ")");
+
+ String superType = typeName;
+
+ typeName = fullTypeName;
+ fullTypeName = ei.isClass ? "<anonymous class extending " + superType + ">"
+ : "<anonymous class implementing " + superType + ">";
+ }
+ tds.scan(init);
+ } else {
+ fullTypeName = typeName = "java.lang.Object";
+ }
+ typeWrap = Wrap.identityWrap(typeName);
}
- Range rtype = dis.treeToRange(baseType);
Range runit = dis.treeToRange(vt);
runit = new Range(runit.begin, runit.end - 1);
ExpressionTree it = vt.getInitializer();
- Range rinit = null;
int nameMax = runit.end - 1;
SubKind subkind;
if (it != null) {
subkind = SubKind.VAR_DECLARATION_WITH_INITIALIZER_SUBKIND;
- rinit = dis.treeToRange(it);
+ Range rinit = dis.treeToRange(it);
+ winit = winit == null ? Wrap.rangeWrap(compileSource, rinit) : winit;
nameMax = rinit.begin - 1;
} else {
subkind = SubKind.VAR_DECLARATION_SUBKIND;
@@ -304,10 +399,11 @@
}
int nameEnd = nameStart + name.length();
Range rname = new Range(nameStart, nameEnd);
- Wrap guts = Wrap.varWrap(compileSource, rtype, sbBrackets.toString(), rname, rinit);
- DiagList modDiag = modifierDiagnostics(vt.getModifiers(), dis, true);
+ Wrap guts = Wrap.varWrap(compileSource, typeWrap, sbBrackets.toString(), rname,
+ winit, anonDeclareWrap);
+ DiagList modDiag = modifierDiagnostics(vt.getModifiers(), dis, true);
Snippet snip = new VarSnippet(state.keyMap.keyForVariable(name), userSource, guts,
- name, subkind, typeName,
+ name, subkind, fullTypeName,
tds.declareReferences(), modDiag);
snippets.add(snip);
}
--- a/src/jdk.jshell/share/classes/jdk/jshell/ExpressionToTypeInfo.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.jshell/share/classes/jdk/jshell/ExpressionToTypeInfo.java Thu Sep 28 09:13:27 2017 -0700
@@ -29,14 +29,20 @@
import com.sun.source.tree.ClassTree;
import com.sun.source.tree.CompilationUnitTree;
import com.sun.source.tree.ConditionalExpressionTree;
+import com.sun.source.tree.ExpressionStatementTree;
import com.sun.source.tree.ExpressionTree;
+import com.sun.source.tree.MethodInvocationTree;
import com.sun.source.tree.MethodTree;
+import com.sun.source.tree.NewClassTree;
import com.sun.source.tree.Tree;
+import com.sun.source.tree.Tree.Kind;
+import com.sun.source.tree.VariableTree;
import com.sun.source.util.TreePath;
import com.sun.source.util.TreePathScanner;
import com.sun.tools.javac.code.Symtab;
import com.sun.tools.javac.code.Type;
import com.sun.tools.javac.code.Types;
+import com.sun.tools.javac.util.List;
import jdk.jshell.TaskFactory.AnalyzeTask;
/**
@@ -63,6 +69,10 @@
public static class ExpressionInfo {
ExpressionTree tree;
String typeName;
+ String fullTypeName;
+ List<String> parameterTypes;
+ String enclosingInstanceType;
+ boolean isClass;
boolean isNonVoid;
}
@@ -111,6 +121,16 @@
return null;
}
}
+
+ @Override
+ public TreePath visitVariable(VariableTree node, Boolean isTargetContext) {
+ if (isTargetContext) {
+ throw new Result(getCurrentPath());
+ } else {
+ return null;
+ }
+ }
+
}
private Type pathToType(TreePath tp) {
@@ -156,6 +176,30 @@
}
}
+ /**
+ * Entry method: get expression info corresponding to a local variable declaration if its type
+ * has been inferred automatically from the given initializer.
+ * @param code the initializer as a string
+ * @param state a JShell instance
+ * @return type information
+ */
+ public static ExpressionInfo localVariableTypeForInitializer(String code, JShell state) {
+ if (code == null || code.isEmpty()) {
+ return null;
+ }
+ try {
+ OuterWrap codeWrap = state.outerMap.wrapInTrialClass(Wrap.methodWrap("var $$$ = " + code));
+ AnalyzeTask at = state.taskFactory.new AnalyzeTask(codeWrap);
+ CompilationUnitTree cu = at.firstCuTree();
+ if (at.hasErrors() || cu == null) {
+ return null;
+ }
+ return new ExpressionToTypeInfo(at, cu, state).typeOfExpression();
+ } catch (Exception ex) {
+ return null;
+ }
+ }
+
private ExpressionInfo typeOfExpression() {
return treeToInfo(findExpressionPath());
}
@@ -172,9 +216,11 @@
private ExpressionInfo treeToInfo(TreePath tp) {
if (tp != null) {
Tree tree = tp.getLeaf();
- if (tree instanceof ExpressionTree) {
+ boolean isExpression = tree instanceof ExpressionTree;
+ if (isExpression || tree.getKind() == Kind.VARIABLE) {
ExpressionInfo ei = new ExpressionInfo();
- ei.tree = (ExpressionTree) tree;
+ if (isExpression)
+ ei.tree = (ExpressionTree) tree;
Type type = pathToType(tp, tree);
if (type != null) {
switch (type.getKind()) {
@@ -189,27 +235,56 @@
break;
default: {
ei.isNonVoid = true;
- ei.typeName = varTypeName(type);
- if (ei.typeName == null) {
- ei.typeName = OBJECT_TYPE_NAME;
- }
+ ei.typeName = varTypeName(type, false);
+ ei.fullTypeName = varTypeName(type, true);
break;
}
}
}
+ if (tree.getKind() == Tree.Kind.VARIABLE) {
+ Tree init = ((VariableTree) tree).getInitializer();
+ if (init.getKind() == Tree.Kind.NEW_CLASS &&
+ ((NewClassTree) init).getClassBody() != null) {
+ NewClassTree nct = (NewClassTree) init;
+ ClassTree clazz = nct.getClassBody();
+ MethodTree constructor = (MethodTree) clazz.getMembers().get(0);
+ ExpressionStatementTree superCallStatement =
+ (ExpressionStatementTree) constructor.getBody().getStatements().get(0);
+ MethodInvocationTree superCall =
+ (MethodInvocationTree) superCallStatement.getExpression();
+ TreePath superCallPath =
+ at.trees().getPath(tp.getCompilationUnit(), superCall.getMethodSelect());
+ Type constrType = pathToType(superCallPath);
+ ei.parameterTypes = constrType.getParameterTypes()
+ .stream()
+ .map(t -> varTypeName(t, false))
+ .collect(List.collector());
+ if (nct.getEnclosingExpression() != null) {
+ TreePath enclPath = new TreePath(tp, nct.getEnclosingExpression());
+ ei.enclosingInstanceType = varTypeName(pathToType(enclPath), false);
+ }
+ ei.isClass = at.task.getTypes().directSupertypes(type).size() == 1;
+ }
+ }
return ei;
}
}
return null;
}
- private String varTypeName(Type type) {
+ private String varTypeName(Type type, boolean printIntersectionTypes) {
try {
- TypePrinter tp = new VarTypePrinter(at.messages(),
- state.maps::fullClassNameAndPackageToClass, syms, types);
- return tp.toString(type);
+ TypePrinter tp = new TypePrinter(at.messages(),
+ state.maps::fullClassNameAndPackageToClass, printIntersectionTypes);
+ List<Type> captures = types.captures(type);
+ String res = tp.toString(types.upward(type, captures));
+
+ if (res == null)
+ res = OBJECT_TYPE_NAME;
+
+ return res;
} catch (Exception ex) {
- return null;
+ return OBJECT_TYPE_NAME;
}
}
--- a/src/jdk.jshell/share/classes/jdk/jshell/ReplParser.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.jshell/share/classes/jdk/jshell/ReplParser.java Thu Sep 28 09:13:27 2017 -0700
@@ -232,7 +232,7 @@
//mods.flags |= Flags.STATIC;
List<JCTree> defs
= variableDeclaratorsRest(pos, mods, t, name, false, dc,
- new ListBuffer<JCTree>()).toList();
+ new ListBuffer<JCTree>(), true).toList();
accept(SEMI);
storeEnd(defs.last(), S.prevToken().endPos);
return defs;
--- a/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java Thu Sep 28 09:13:27 2017 -0700
@@ -134,6 +134,8 @@
import static java.util.stream.Collectors.joining;
+import javax.lang.model.type.IntersectionType;
+
/**
* The concrete implementation of SourceCodeAnalysis.
* @author Robert Field
@@ -715,6 +717,13 @@
return Collections.emptyList();
switch (site.getKind()) {
+ case INTERSECTION: {
+ List<Element> result = new ArrayList<>();
+ for (TypeMirror bound : ((IntersectionType) site).getBounds()) {
+ result.addAll(membersOf(at, bound, shouldGenerateDotClassItem));
+ }
+ return result;
+ }
case DECLARED: {
TypeElement element = (TypeElement) at.getTypes().asElement(site);
List<Element> result = new ArrayList<>();
--- a/src/jdk.jshell/share/classes/jdk/jshell/TaskFactory.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.jshell/share/classes/jdk/jshell/TaskFactory.java Thu Sep 28 09:13:27 2017 -0700
@@ -61,7 +61,20 @@
import javax.tools.FileObject;
import jdk.jshell.MemoryFileManager.SourceMemoryJavaFileObject;
import java.lang.Runtime.Version;
+import java.nio.CharBuffer;
import com.sun.source.tree.Tree.Kind;
+import com.sun.tools.javac.code.Kinds;
+import com.sun.tools.javac.code.Symbol.ClassSymbol;
+import com.sun.tools.javac.code.Symbol.VarSymbol;
+import com.sun.tools.javac.parser.Parser;
+import com.sun.tools.javac.tree.JCTree.JCClassDecl;
+import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
+import com.sun.tools.javac.tree.JCTree.JCExpression;
+import com.sun.tools.javac.tree.JCTree.JCTypeCast;
+import com.sun.tools.javac.tree.JCTree.Tag;
+import com.sun.tools.javac.util.Context.Factory;
+import com.sun.tools.javac.util.Log.DiscardDiagnosticHandler;
+import jdk.jshell.Snippet.Status;
/**
* The primary interface to the compiler API. Parsing, analysis, and
@@ -355,6 +368,7 @@
Iterable<? extends JavaFileObject> compilationUnits = inputs
.map(in -> sh.sourceToFileObject(fileManager, in))
.collect(Collectors.toList());
+ JShellJavaCompiler.preRegister(context, state);
this.task = (JavacTaskImpl) ((JavacTool) compiler).getTask(null,
fileManager, diagnostics, options, null,
compilationUnits, context);
@@ -464,4 +478,57 @@
}
}
+ private static final class JShellJavaCompiler extends com.sun.tools.javac.main.JavaCompiler {
+
+ public static void preRegister(Context c, JShell state) {
+ c.put(compilerKey, (Factory<com.sun.tools.javac.main.JavaCompiler>) i -> new JShellJavaCompiler(i, state));
+ }
+
+ private final JShell state;
+
+ public JShellJavaCompiler(Context context, JShell state) {
+ super(context);
+ this.state = state;
+ }
+
+ @Override
+ public void processAnnotations(com.sun.tools.javac.util.List<JCCompilationUnit> roots, Collection<String> classnames) {
+ super.processAnnotations(roots, classnames);
+ state.maps
+ .snippetList()
+ .stream()
+ .filter(s -> s.status() == Status.VALID)
+ .filter(s -> s.kind() == Snippet.Kind.VAR)
+ .filter(s -> s.subKind() == Snippet.SubKind.VAR_DECLARATION_WITH_INITIALIZER_SUBKIND)
+ .forEach(s -> setVariableType(roots, (VarSnippet) s));
+ }
+
+ private void setVariableType(com.sun.tools.javac.util.List<JCCompilationUnit> roots, VarSnippet s) {
+ ClassSymbol clazz = syms.getClass(syms.unnamedModule, names.fromString(s.classFullName()));
+ if (clazz == null || !clazz.isCompleted())
+ return;
+ VarSymbol field = (VarSymbol) clazz.members().findFirst(names.fromString(s.name()), sym -> sym.kind == Kinds.Kind.VAR);
+ if (field != null) {
+ JavaFileObject prev = log.useSource(null);
+ DiscardDiagnosticHandler h = new DiscardDiagnosticHandler(log);
+ try {
+ String typeName = s.typeName();
+ CharBuffer buf = CharBuffer.wrap(("(" + typeName +")x\u0000").toCharArray(), 0, typeName.length() + 3);
+ Parser parser = parserFactory.newParser(buf, false, false, false);
+ JCExpression expr = parser.parseExpression();
+ if (expr.hasTag(Tag.TYPECAST)) {
+ JCTypeCast tree = (JCTypeCast) expr;
+ if (tree.clazz.hasTag(Tag.TYPEINTERSECTION)) {
+ field.type = attr.attribType(tree.clazz,
+ ((JCClassDecl) roots.head.getTypeDecls().head).sym);
+ }
+ }
+ } finally {
+ log.popDiagnosticHandler(h);
+ log.useSource(prev);
+ }
+ }
+ }
+ }
+
}
--- a/src/jdk.jshell/share/classes/jdk/jshell/TreeDissector.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.jshell/share/classes/jdk/jshell/TreeDissector.java Thu Sep 28 09:13:27 2017 -0700
@@ -227,7 +227,7 @@
Type typeImpl = (Type) type;
try {
TypePrinter tp = new TypePrinter(at.messages(),
- state.maps::fullClassNameAndPackageToClass);
+ state.maps::fullClassNameAndPackageToClass, true);
return tp.toString(typeImpl);
} catch (Exception ex) {
return null;
--- a/src/jdk.jshell/share/classes/jdk/jshell/TypePrinter.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.jshell/share/classes/jdk/jshell/TypePrinter.java Thu Sep 28 09:13:27 2017 -0700
@@ -32,9 +32,11 @@
import com.sun.tools.javac.code.Symbol.PackageSymbol;
import com.sun.tools.javac.code.Type;
import com.sun.tools.javac.code.Type.ClassType;
+import com.sun.tools.javac.code.Type.IntersectionClassType;
import com.sun.tools.javac.util.JavacMessages;
import java.util.Locale;
import java.util.function.BinaryOperator;
+import java.util.stream.Collectors;
/**
* Print types in source form.
@@ -45,10 +47,14 @@
private final JavacMessages messages;
private final BinaryOperator<String> fullClassNameAndPackageToClass;
+ private final boolean printEnhancedTypes;
- TypePrinter(JavacMessages messages, BinaryOperator<String> fullClassNameAndPackageToClass) {
+ TypePrinter(JavacMessages messages,
+ BinaryOperator<String> fullClassNameAndPackageToClass,
+ boolean printEnhancedTypes) {
this.messages = messages;
this.fullClassNameAndPackageToClass = fullClassNameAndPackageToClass;
+ this.printEnhancedTypes = printEnhancedTypes;
}
String toString(Type t) {
@@ -92,8 +98,18 @@
protected String className(ClassType t, boolean longform, Locale locale) {
Symbol sym = t.tsym;
if (sym.name.length() == 0 && (sym.flags() & COMPOUND) != 0) {
- return OBJECT;
+ if (printEnhancedTypes) {
+ return ((IntersectionClassType) t).getExplicitComponents()
+ .stream()
+ .map(i -> visit(i, locale))
+ .collect(Collectors.joining("&"));
+ } else {
+ return OBJECT;
+ }
} else if (sym.name.length() == 0) {
+ if (printEnhancedTypes) {
+ return t.tsym.flatName().toString().substring(t.tsym.outermostClass().flatName().length());
+ }
// Anonymous
String s;
ClassType norm = (ClassType) t.tsym.type;
--- a/src/jdk.jshell/share/classes/jdk/jshell/VarTypePrinter.java Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,265 +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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.jshell;
-
-import java.util.HashSet;
-import com.sun.tools.javac.code.Type;
-import com.sun.tools.javac.code.Type.ClassType;
-import com.sun.tools.javac.util.JavacMessages;
-import java.util.Locale;
-import java.util.Set;
-import java.util.function.BinaryOperator;
-import com.sun.tools.javac.code.BoundKind;
-import com.sun.tools.javac.code.Flags;
-import com.sun.tools.javac.code.Symtab;
-import com.sun.tools.javac.code.Type.CapturedType;
-import com.sun.tools.javac.code.Type.StructuralTypeMapping;
-import com.sun.tools.javac.code.Type.TypeVar;
-import com.sun.tools.javac.code.Type.WildcardType;
-import com.sun.tools.javac.code.Types;
-import com.sun.tools.javac.code.Types.SimpleVisitor;
-import com.sun.tools.javac.util.List;
-import static com.sun.tools.javac.code.BoundKind.EXTENDS;
-import static com.sun.tools.javac.code.BoundKind.SUPER;
-import static com.sun.tools.javac.code.BoundKind.UNBOUND;
-import static com.sun.tools.javac.code.Type.ArrayType;
-import static com.sun.tools.javac.code.TypeTag.BOT;
-import static com.sun.tools.javac.code.TypeTag.WILDCARD;
-
-/**
- * Print variable types in source form.
- * TypeProjection and CaptureScanner are copied from Types in the JEP-286
- * Sandbox by Maurizio. The checks for Non-Denotable in TypePrinter are
- * cribbed from denotableChecker of the same source.
- *
- * @author Maurizio Cimadamore
- * @author Robert Field
- */
-class VarTypePrinter extends TypePrinter {
- private static final String WILD = "?";
-
- private final Symtab syms;
- private final Types types;
-
- VarTypePrinter(JavacMessages messages, BinaryOperator<String> fullClassNameAndPackageToClass,
- Symtab syms, Types types) {
- super(messages, fullClassNameAndPackageToClass);
- this.syms = syms;
- this.types = types;
- }
-
- @Override
- String toString(Type t) {
- return super.toString(upward(t));
- }
-
- @Override
- public String visitTypeVar(TypeVar t, Locale locale) {
- /* Any type variable mentioned in the inferred type must have been declared as a type parameter
- (i.e cannot have been produced by inference (18.4))
- */
- // and beyond that, there are no global type vars, so if there are any
- // type variables left, they need to be eliminated
- return WILD; // Non-denotable
- }
-
- @Override
- public String visitCapturedType(CapturedType t, Locale locale) {
- /* Any type variable mentioned in the inferred type must have been declared as a type parameter
- (i.e cannot have been produced by capture conversion (5.1.10))
- */
- return WILD; // Non-denotable
- }
-
- public Type upward(Type t) {
- List<Type> captures = captures(t);
- return upward(t, captures);
- }
-
- /************* Following from JEP-286 Types.java ***********/
-
- public Type upward(Type t, List<Type> vars) {
- return t.map(new TypeProjection(vars), true);
- }
-
- public List<Type> captures(Type t) {
- CaptureScanner cs = new CaptureScanner();
- Set<Type> captures = new HashSet<>();
- cs.visit(t, captures);
- return List.from(captures);
- }
-
- class CaptureScanner extends SimpleVisitor<Void, Set<Type>> {
-
- @Override
- public Void visitType(Type t, Set<Type> types) {
- return null;
- }
-
- @Override
- public Void visitClassType(ClassType t, Set<Type> seen) {
- if (t.isCompound()) {
- types.directSupertypes(t).forEach(s -> visit(s, seen));
- } else {
- t.allparams().forEach(ta -> visit(ta, seen));
- }
- return null;
- }
-
- @Override
- public Void visitArrayType(ArrayType t, Set<Type> seen) {
- return visit(t.elemtype, seen);
- }
-
- @Override
- public Void visitWildcardType(WildcardType t, Set<Type> seen) {
- visit(t.type, seen);
- return null;
- }
-
- @Override
- public Void visitTypeVar(TypeVar t, Set<Type> seen) {
- if ((t.tsym.flags() & Flags.SYNTHETIC) != 0 && seen.add(t)) {
- visit(t.getUpperBound(), seen);
- }
- return null;
- }
-
- @Override
- public Void visitCapturedType(CapturedType t, Set<Type> seen) {
- if (seen.add(t)) {
- visit(t.getUpperBound(), seen);
- visit(t.getLowerBound(), seen);
- }
- return null;
- }
- }
-
- class TypeProjection extends StructuralTypeMapping<Boolean> {
-
- List<Type> vars;
- Set<Type> seen = new HashSet<>();
-
- public TypeProjection(List<Type> vars) {
- this.vars = vars;
- }
-
- @Override
- public Type visitClassType(ClassType t, Boolean upward) {
- if (upward && !t.isCompound() && t.tsym.name.isEmpty()) {
- //lift anonymous class type to first supertype (class or interface)
- return types.directSupertypes(t).last();
- } else if (t.isCompound()) {
- List<Type> components = types.directSupertypes(t);
- List<Type> components1 = components.map(c -> c.map(this, upward));
- if (components == components1) return t;
- else return types.makeIntersectionType(components1);
- } else {
- Type outer = t.getEnclosingType();
- Type outer1 = visit(outer, upward);
- List<Type> typarams = t.getTypeArguments();
- List<Type> typarams1 = typarams.map(ta -> mapTypeArgument(ta, upward));
- if (typarams1.stream().anyMatch(ta -> ta.hasTag(BOT))) {
- //not defined
- return syms.botType;
- }
- if (outer1 == outer && typarams1 == typarams) return t;
- else return new ClassType(outer1, typarams1, t.tsym, t.getMetadata()) {
- @Override
- protected boolean needsStripping() {
- return true;
- }
- };
- }
- }
-
- protected Type makeWildcard(Type upper, Type lower) {
- BoundKind bk;
- Type bound;
- if (upper.hasTag(BOT)) {
- upper = syms.objectType;
- }
- boolean isUpperObject = types.isSameType(upper, syms.objectType);
- if (!lower.hasTag(BOT) && isUpperObject) {
- bound = lower;
- bk = SUPER;
- } else {
- bound = upper;
- bk = isUpperObject ? UNBOUND : EXTENDS;
- }
- return new WildcardType(bound, bk, syms.boundClass);
- }
-
- @Override
- public Type visitTypeVar(TypeVar t, Boolean upward) {
- if (vars.contains(t)) {
- try {
- if (seen.add(t)) {
- return (upward ?
- t.getUpperBound() :
- (t.getLowerBound() == null) ?
- syms.botType :
- t.getLowerBound())
- .map(this, upward);
- } else {
- //cycle
- return syms.objectType;
- }
- } finally {
- seen.remove(t);
- }
- } else {
- return t;
- }
- }
-
- @Override
- public Type visitWildcardType(WildcardType wt, Boolean upward) {
- if (upward) {
- return wt.isExtendsBound() ?
- wt.type.map(this, upward) :
- syms.objectType;
- } else {
- return wt.isSuperBound() ?
- wt.type.map(this, upward) :
- syms.botType;
- }
- }
-
- private Type mapTypeArgument(Type t, boolean upward) {
- if (!t.containsAny(vars)) {
- return t;
- } else if (!t.hasTag(WILDCARD) && !upward) {
- //not defined
- return syms.botType;
- } else {
- Type upper = t.map(this, upward);
- Type lower = t.map(this, !upward);
- return makeWildcard(upper, lower);
- }
- }
- }
-}
--- a/src/jdk.jshell/share/classes/jdk/jshell/Wrap.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.jshell/share/classes/jdk/jshell/Wrap.java Thu Sep 28 09:13:27 2017 -0700
@@ -74,16 +74,15 @@
* @param rdecl Type name and name
* @return
*/
- public static Wrap varWrap(String source, Range rtype, String brackets, Range rname, Range rinit) {
+ public static Wrap varWrap(String source, Wrap wtype, String brackets,
+ Range rname, Wrap winit, Wrap anonDeclareWrap) {
RangeWrap wname = new RangeWrap(source, rname);
- RangeWrap wtype = new RangeWrap(source, rtype);
Wrap wVarDecl = new VarDeclareWrap(wtype, brackets, wname);
Wrap wmeth;
- if (rinit == null) {
+ if (winit == null) {
wmeth = new CompoundWrap(new NoWrap(" "), " return null;\n");
} else {
- RangeWrap winit = new RangeWrap(source, rinit);
// int x = y
// int x_ = y; return x = x_;
// decl + "_ = " + init ; + "return " + name + "=" + name + "_ ;"
@@ -93,7 +92,8 @@
);
}
Wrap wInitMeth = new DoitMethodWrap(wmeth);
- return new CompoundWrap(wVarDecl, wInitMeth);
+ return anonDeclareWrap != null ? new CompoundWrap(wVarDecl, wInitMeth, anonDeclareWrap)
+ : new CompoundWrap(wVarDecl, wInitMeth);
}
public static Wrap tempVarWrap(String source, String typename, String name) {
@@ -112,6 +112,14 @@
return new NoWrap(source);
}
+ public static Wrap identityWrap(String source) {
+ return new NoWrap(source);
+ }
+
+ public static Wrap rangeWrap(String source, Range range) {
+ return new RangeWrap(source, range);
+ }
+
public static Wrap classMemberWrap(String source) {
Wrap w = new NoWrap(source);
return new CompoundWrap(" public static\n ", w);
--- a/src/jdk.policytool/share/classes/module-info.java Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2014, 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.
- */
-
-/**
- * Defines the GUI tool for managing policy files
- * called <em>{@index policytool policytool}</em>.
- *
- * <dl style="font-family:'DejaVu Sans', Arial, Helvetica, sans serif">
- * <dt class="simpleTagLabel">Tool Guides:
- * <dd>{@extLink policytool_tool_reference policytool}
- * </dl>
- *
- * @since 9
- * @deprecated
- */
-@Deprecated(since="9", forRemoval=true)
-module jdk.policytool {
- requires java.desktop;
- requires java.logging;
- requires java.management;
- requires java.security.jgss;
- requires java.sql;
- requires jdk.net;
- requires jdk.security.jgss;
-}
--- a/src/jdk.policytool/share/classes/sun/security/tools/policytool/PolicyTool.java Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,4588 +0,0 @@
-/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.security.tools.policytool;
-
-import java.io.*;
-import java.util.LinkedList;
-import java.util.ListIterator;
-import java.util.Vector;
-import java.util.Enumeration;
-import java.net.URL;
-import java.net.MalformedURLException;
-import java.lang.reflect.*;
-import java.text.Collator;
-import java.text.MessageFormat;
-import sun.security.util.PropertyExpander;
-import sun.security.util.PropertyExpander.ExpandException;
-import java.awt.Component;
-import java.awt.Container;
-import java.awt.Dimension;
-import java.awt.FileDialog;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.Point;
-import java.awt.Toolkit;
-import java.awt.Window;
-import java.awt.event.*;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateException;
-import java.security.*;
-import sun.security.provider.*;
-import sun.security.util.PolicyUtil;
-import javax.security.auth.x500.X500Principal;
-import javax.swing.*;
-import javax.swing.border.EmptyBorder;
-
-/**
- * PolicyTool may be used by users and administrators to configure the
- * overall java security policy (currently stored in the policy file).
- * Using PolicyTool administrators may add and remove policies from
- * the policy file. <p>
- *
- * @see java.security.Policy
- * @since 1.2
- * @deprecated {@code policytool} has been deprecated for removal because it
- * is rarely used, and it provides little value over editing policy
- * files using a text editor.
- */
-
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public class PolicyTool {
-
- // for i18n
- static final java.util.ResourceBundle rb =
- java.util.ResourceBundle.getBundle(
- "sun.security.tools.policytool.Resources");
- static final Collator collator = Collator.getInstance();
- static {
- // this is for case insensitive string comparisons
- collator.setStrength(Collator.PRIMARY);
-
- // Support for Apple menu bar
- if (System.getProperty("apple.laf.useScreenMenuBar") == null) {
- System.setProperty("apple.laf.useScreenMenuBar", "true");
- }
- System.setProperty("apple.awt.application.name", getMessage("Policy.Tool"));
-
- // Apply the system L&F if not specified with a system property.
- if (System.getProperty("swing.defaultlaf") == null) {
- try {
- UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
- } catch (Exception e) {
- // ignore
- }
- }
- }
-
- // anyone can add warnings
- Vector<String> warnings;
- boolean newWarning = false;
-
- // set to true if policy modified.
- // this way upon exit we know if to ask the user to save changes
- boolean modified = false;
-
- private static final boolean testing = false;
- private static final Class<?>[] TWOPARAMS = { String.class, String.class };
- private static final Class<?>[] ONEPARAMS = { String.class };
- private static final Class<?>[] NOPARAMS = {};
- /*
- * All of the policy entries are read in from the
- * policy file and stored here. Updates to the policy entries
- * using addEntry() and removeEntry() are made here. To ultimately save
- * the policy entries back to the policy file, the SavePolicy button
- * must be clicked.
- **/
- private static String policyFileName = null;
- private Vector<PolicyEntry> policyEntries = null;
- private PolicyParser parser = null;
-
- /* The public key alias information is stored here. */
- private KeyStore keyStore = null;
- private String keyStoreName = " ";
- private String keyStoreType = " ";
- private String keyStoreProvider = " ";
- private String keyStorePwdURL = " ";
-
- /* standard PKCS11 KeyStore type */
- private static final String P11KEYSTORE = "PKCS11";
-
- /* reserved word for PKCS11 KeyStores */
- private static final String NONE = "NONE";
-
- /**
- * default constructor
- */
- private PolicyTool() {
- policyEntries = new Vector<PolicyEntry>();
- parser = new PolicyParser();
- warnings = new Vector<String>();
- }
-
- /**
- * get the PolicyFileName
- */
- String getPolicyFileName() {
- return policyFileName;
- }
-
- /**
- * set the PolicyFileName
- */
- void setPolicyFileName(String policyFileName) {
- PolicyTool.policyFileName = policyFileName;
- }
-
- /**
- * clear keyStore info
- */
- void clearKeyStoreInfo() {
- this.keyStoreName = null;
- this.keyStoreType = null;
- this.keyStoreProvider = null;
- this.keyStorePwdURL = null;
-
- this.keyStore = null;
- }
-
- /**
- * get the keyStore URL name
- */
- String getKeyStoreName() {
- return keyStoreName;
- }
-
- /**
- * get the keyStore Type
- */
- String getKeyStoreType() {
- return keyStoreType;
- }
-
- /**
- * get the keyStore Provider
- */
- String getKeyStoreProvider() {
- return keyStoreProvider;
- }
-
- /**
- * get the keyStore password URL
- */
- String getKeyStorePwdURL() {
- return keyStorePwdURL;
- }
-
- /**
- * Open and read a policy file
- */
- void openPolicy(String filename) throws FileNotFoundException,
- PolicyParser.ParsingException,
- KeyStoreException,
- CertificateException,
- InstantiationException,
- MalformedURLException,
- IOException,
- NoSuchAlgorithmException,
- IllegalAccessException,
- NoSuchMethodException,
- UnrecoverableKeyException,
- NoSuchProviderException,
- ClassNotFoundException,
- PropertyExpander.ExpandException,
- InvocationTargetException {
-
- newWarning = false;
-
- // start fresh - blow away the current state
- policyEntries = new Vector<PolicyEntry>();
- parser = new PolicyParser();
- warnings = new Vector<String>();
- setPolicyFileName(null);
- clearKeyStoreInfo();
-
- // see if user is opening a NEW policy file
- if (filename == null) {
- modified = false;
- return;
- }
-
- // Read in the policy entries from the file and
- // populate the parser vector table. The parser vector
- // table only holds the entries as strings, so it only
- // guarantees that the policies are syntactically
- // correct.
- setPolicyFileName(filename);
- parser.read(new FileReader(filename));
-
- // open the keystore
- openKeyStore(parser.getKeyStoreUrl(), parser.getKeyStoreType(),
- parser.getKeyStoreProvider(), parser.getStorePassURL());
-
- // Update the local vector with the same policy entries.
- // This guarantees that the policy entries are not only
- // syntactically correct, but semantically valid as well.
- Enumeration<PolicyParser.GrantEntry> enum_ = parser.grantElements();
- while (enum_.hasMoreElements()) {
- PolicyParser.GrantEntry ge = enum_.nextElement();
-
- // see if all the signers have public keys
- if (ge.signedBy != null) {
-
- String signers[] = parseSigners(ge.signedBy);
- for (int i = 0; i < signers.length; i++) {
- PublicKey pubKey = getPublicKeyAlias(signers[i]);
- if (pubKey == null) {
- newWarning = true;
- MessageFormat form = new MessageFormat(getMessage
- ("Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured."));
- Object[] source = {signers[i]};
- warnings.addElement(form.format(source));
- }
- }
- }
-
- // check to see if the Principals are valid
- ListIterator<PolicyParser.PrincipalEntry> prinList =
- ge.principals.listIterator(0);
- while (prinList.hasNext()) {
- PolicyParser.PrincipalEntry pe = prinList.next();
- try {
- verifyPrincipal(pe.getPrincipalClass(),
- pe.getPrincipalName());
- } catch (ClassNotFoundException fnfe) {
- newWarning = true;
- MessageFormat form = new MessageFormat(getMessage
- ("Warning.Class.not.found.class"));
- Object[] source = {pe.getPrincipalClass()};
- warnings.addElement(form.format(source));
- }
- }
-
- // check to see if the Permissions are valid
- Enumeration<PolicyParser.PermissionEntry> perms =
- ge.permissionElements();
- while (perms.hasMoreElements()) {
- PolicyParser.PermissionEntry pe = perms.nextElement();
- try {
- verifyPermission(pe.permission, pe.name, pe.action);
- } catch (ClassNotFoundException fnfe) {
- newWarning = true;
- MessageFormat form = new MessageFormat(getMessage
- ("Warning.Class.not.found.class"));
- Object[] source = {pe.permission};
- warnings.addElement(form.format(source));
- } catch (InvocationTargetException ite) {
- newWarning = true;
- MessageFormat form = new MessageFormat(getMessage
- ("Warning.Invalid.argument.s.for.constructor.arg"));
- Object[] source = {pe.permission};
- warnings.addElement(form.format(source));
- }
-
- // see if all the permission signers have public keys
- if (pe.signedBy != null) {
-
- String signers[] = parseSigners(pe.signedBy);
-
- for (int i = 0; i < signers.length; i++) {
- PublicKey pubKey = getPublicKeyAlias(signers[i]);
- if (pubKey == null) {
- newWarning = true;
- MessageFormat form = new MessageFormat(getMessage
- ("Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured."));
- Object[] source = {signers[i]};
- warnings.addElement(form.format(source));
- }
- }
- }
- }
- PolicyEntry pEntry = new PolicyEntry(this, ge);
- policyEntries.addElement(pEntry);
- }
-
- // just read in the policy -- nothing has been modified yet
- modified = false;
- }
-
-
- /**
- * Save a policy to a file
- */
- void savePolicy(String filename)
- throws FileNotFoundException, IOException {
- // save the policy entries to a file
- parser.setKeyStoreUrl(keyStoreName);
- parser.setKeyStoreType(keyStoreType);
- parser.setKeyStoreProvider(keyStoreProvider);
- parser.setStorePassURL(keyStorePwdURL);
- parser.write(new FileWriter(filename));
- modified = false;
- }
-
- /**
- * Open the KeyStore
- */
- void openKeyStore(String name,
- String type,
- String provider,
- String pwdURL) throws KeyStoreException,
- NoSuchAlgorithmException,
- UnrecoverableKeyException,
- IOException,
- CertificateException,
- NoSuchProviderException,
- ExpandException {
-
- if (name == null && type == null &&
- provider == null && pwdURL == null) {
-
- // policy did not specify a keystore during open
- // or use wants to reset keystore values
-
- this.keyStoreName = null;
- this.keyStoreType = null;
- this.keyStoreProvider = null;
- this.keyStorePwdURL = null;
-
- // caller will set (tool.modified = true) if appropriate
-
- return;
- }
-
- URL policyURL = null;
- if (policyFileName != null) {
- File pfile = new File(policyFileName);
- policyURL = new URL("file:" + pfile.getCanonicalPath());
- }
-
- // although PolicyUtil.getKeyStore may properly handle
- // defaults and property expansion, we do it here so that
- // if the call is successful, we can set the proper values
- // (PolicyUtil.getKeyStore does not return expanded values)
-
- if (name != null && name.length() > 0) {
- name = PropertyExpander.expand(name).replace
- (File.separatorChar, '/');
- }
- if (type == null || type.length() == 0) {
- type = KeyStore.getDefaultType();
- }
- if (pwdURL != null && pwdURL.length() > 0) {
- pwdURL = PropertyExpander.expand(pwdURL).replace
- (File.separatorChar, '/');
- }
-
- try {
- this.keyStore = PolicyUtil.getKeyStore(policyURL,
- name,
- type,
- provider,
- pwdURL,
- null);
- } catch (IOException ioe) {
-
- // copied from sun.security.pkcs11.SunPKCS11
- String MSG = "no password provided, and no callback handler " +
- "available for retrieving password";
-
- Throwable cause = ioe.getCause();
- if (cause != null &&
- cause instanceof javax.security.auth.login.LoginException &&
- MSG.equals(cause.getMessage())) {
-
- // throw a more friendly exception message
- throw new IOException(MSG);
- } else {
- throw ioe;
- }
- }
-
- this.keyStoreName = name;
- this.keyStoreType = type;
- this.keyStoreProvider = provider;
- this.keyStorePwdURL = pwdURL;
-
- // caller will set (tool.modified = true)
- }
-
- /**
- * Add a Grant entry to the overall policy at the specified index.
- * A policy entry consists of a CodeSource.
- */
- boolean addEntry(PolicyEntry pe, int index) {
-
- if (index < 0) {
- // new entry -- just add it to the end
- policyEntries.addElement(pe);
- parser.add(pe.getGrantEntry());
- } else {
- // existing entry -- replace old one
- PolicyEntry origPe = policyEntries.elementAt(index);
- parser.replace(origPe.getGrantEntry(), pe.getGrantEntry());
- policyEntries.setElementAt(pe, index);
- }
- return true;
- }
-
- /**
- * Add a Principal entry to an existing PolicyEntry at the specified index.
- * A Principal entry consists of a class, and name.
- *
- * If the principal already exists, it is not added again.
- */
- boolean addPrinEntry(PolicyEntry pe,
- PolicyParser.PrincipalEntry newPrin,
- int index) {
-
- // first add the principal to the Policy Parser entry
- PolicyParser.GrantEntry grantEntry = pe.getGrantEntry();
- if (grantEntry.contains(newPrin) == true)
- return false;
-
- LinkedList<PolicyParser.PrincipalEntry> prinList =
- grantEntry.principals;
- if (index != -1)
- prinList.set(index, newPrin);
- else
- prinList.add(newPrin);
-
- modified = true;
- return true;
- }
-
- /**
- * Add a Permission entry to an existing PolicyEntry at the specified index.
- * A Permission entry consists of a permission, name, and actions.
- *
- * If the permission already exists, it is not added again.
- */
- boolean addPermEntry(PolicyEntry pe,
- PolicyParser.PermissionEntry newPerm,
- int index) {
-
- // first add the permission to the Policy Parser Vector
- PolicyParser.GrantEntry grantEntry = pe.getGrantEntry();
- if (grantEntry.contains(newPerm) == true)
- return false;
-
- Vector<PolicyParser.PermissionEntry> permList =
- grantEntry.permissionEntries;
- if (index != -1)
- permList.setElementAt(newPerm, index);
- else
- permList.addElement(newPerm);
-
- modified = true;
- return true;
- }
-
- /**
- * Remove a Permission entry from an existing PolicyEntry.
- */
- boolean removePermEntry(PolicyEntry pe,
- PolicyParser.PermissionEntry perm) {
-
- // remove the Permission from the GrantEntry
- PolicyParser.GrantEntry ppge = pe.getGrantEntry();
- modified = ppge.remove(perm);
- return modified;
- }
-
- /**
- * remove an entry from the overall policy
- */
- boolean removeEntry(PolicyEntry pe) {
-
- parser.remove(pe.getGrantEntry());
- modified = true;
- return (policyEntries.removeElement(pe));
- }
-
- /**
- * retrieve all Policy Entries
- */
- PolicyEntry[] getEntry() {
-
- if (policyEntries.size() > 0) {
- PolicyEntry entries[] = new PolicyEntry[policyEntries.size()];
- for (int i = 0; i < policyEntries.size(); i++)
- entries[i] = policyEntries.elementAt(i);
- return entries;
- }
- return null;
- }
-
- /**
- * Retrieve the public key mapped to a particular name.
- * If the key has expired, a KeyException is thrown.
- */
- PublicKey getPublicKeyAlias(String name) throws KeyStoreException {
- if (keyStore == null) {
- return null;
- }
-
- Certificate cert = keyStore.getCertificate(name);
- if (cert == null) {
- return null;
- }
- PublicKey pubKey = cert.getPublicKey();
- return pubKey;
- }
-
- /**
- * Retrieve all the alias names stored in the certificate database
- */
- String[] getPublicKeyAlias() throws KeyStoreException {
-
- int numAliases = 0;
- String aliases[] = null;
-
- if (keyStore == null) {
- return null;
- }
- Enumeration<String> enum_ = keyStore.aliases();
-
- // first count the number of elements
- while (enum_.hasMoreElements()) {
- enum_.nextElement();
- numAliases++;
- }
-
- if (numAliases > 0) {
- // now copy them into an array
- aliases = new String[numAliases];
- numAliases = 0;
- enum_ = keyStore.aliases();
- while (enum_.hasMoreElements()) {
- aliases[numAliases] = new String(enum_.nextElement());
- numAliases++;
- }
- }
- return aliases;
- }
-
- /**
- * This method parses a single string of signers separated by commas
- * ("jordan, duke, pippen") into an array of individual strings.
- */
- String[] parseSigners(String signedBy) {
-
- String signers[] = null;
- int numSigners = 1;
- int signedByIndex = 0;
- int commaIndex = 0;
- int signerNum = 0;
-
- // first pass thru "signedBy" counts the number of signers
- while (commaIndex >= 0) {
- commaIndex = signedBy.indexOf(',', signedByIndex);
- if (commaIndex >= 0) {
- numSigners++;
- signedByIndex = commaIndex + 1;
- }
- }
- signers = new String[numSigners];
-
- // second pass thru "signedBy" transfers signers to array
- commaIndex = 0;
- signedByIndex = 0;
- while (commaIndex >= 0) {
- if ((commaIndex = signedBy.indexOf(',', signedByIndex)) >= 0) {
- // transfer signer and ignore trailing part of the string
- signers[signerNum] =
- signedBy.substring(signedByIndex, commaIndex).trim();
- signerNum++;
- signedByIndex = commaIndex + 1;
- } else {
- // we are at the end of the string -- transfer signer
- signers[signerNum] = signedBy.substring(signedByIndex).trim();
- }
- }
- return signers;
- }
-
- /**
- * Check to see if the Principal contents are OK
- */
- void verifyPrincipal(String type, String name)
- throws ClassNotFoundException,
- InstantiationException
- {
- if (type.equals(PolicyParser.PrincipalEntry.WILDCARD_CLASS) ||
- type.equals(PolicyParser.PrincipalEntry.REPLACE_NAME)) {
- return;
- }
- Class<?> pc = Class.forName(type, true,
- Thread.currentThread().getContextClassLoader());
- if (!Principal.class.isAssignableFrom(pc)) {
- MessageFormat form = new MessageFormat(getMessage
- ("Illegal.Principal.Type.type"));
- Object[] source = {type};
- throw new InstantiationException(form.format(source));
- }
-
- if (X500Principal.class.getName().equals(pc.getName())) {
- // PolicyParser checks validity of X500Principal name
- // - PolicyTool needs to as well so that it doesn't store
- // an invalid name that can't be read in later
- //
- // this can throw an IllegalArgumentException
- X500Principal newP = new X500Principal(name);
- }
- }
-
- /**
- * Check to see if the Permission contents are OK
- */
- @SuppressWarnings("fallthrough")
- void verifyPermission(String type,
- String name,
- String actions)
- throws ClassNotFoundException,
- InstantiationException,
- IllegalAccessException,
- NoSuchMethodException,
- InvocationTargetException
- {
-
- //XXX we might want to keep a hash of created factories...
- Class<?> pc = Class.forName(type, true,
- Thread.currentThread().getContextClassLoader());
- Constructor<?> c = null;
- Vector<String> objects = new Vector<>(2);
- if (name != null) objects.add(name);
- if (actions != null) objects.add(actions);
- switch (objects.size()) {
- case 0:
- try {
- c = pc.getConstructor(NOPARAMS);
- break;
- } catch (NoSuchMethodException ex) {
- // proceed to the one-param constructor
- objects.add(null);
- }
- /* fall through */
- case 1:
- try {
- c = pc.getConstructor(ONEPARAMS);
- break;
- } catch (NoSuchMethodException ex) {
- // proceed to the two-param constructor
- objects.add(null);
- }
- /* fall through */
- case 2:
- c = pc.getConstructor(TWOPARAMS);
- break;
- }
- Object parameters[] = objects.toArray();
- Permission p = (Permission)c.newInstance(parameters);
- }
-
- /*
- * Parse command line arguments.
- */
- static void parseArgs(String args[]) {
- /* parse flags */
- int n = 0;
-
- for (n=0; (n < args.length) && args[n].startsWith("-"); n++) {
-
- String flags = args[n];
-
- if (collator.compare(flags, "-file") == 0) {
- if (++n == args.length) usage();
- policyFileName = args[n];
- } else {
- MessageFormat form = new MessageFormat(getMessage
- ("Illegal.option.option"));
- Object[] source = { flags };
- System.err.println(form.format(source));
- usage();
- }
- }
- }
-
- static void usage() {
- System.out.println(getMessage("Usage.policytool.options."));
- System.out.println();
- System.out.println(getMessage
- (".file.file.policy.file.location"));
- System.out.println();
-
- System.exit(1);
- }
-
- /**
- * run the PolicyTool
- */
- public static void main(String args[]) {
- System.out.println("Note: The policytool tool has been deprecated and" +
- " is planned to be removed in a future release.\n");
- parseArgs(args);
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- ToolWindow tw = new ToolWindow(new PolicyTool());
- tw.displayToolWindow(args);
- }
- });
- }
-
- // split instr to words according to capitalization,
- // like, AWTControl -> A W T Control
- // this method is for easy pronounciation
- static String splitToWords(String instr) {
- return instr.replaceAll("([A-Z])", " $1");
- }
-
- /**
- * Returns the message corresponding to the key in the bundle.
- * This is preferred over {@link #getString} because it removes
- * any mnemonic '&' character in the string.
- *
- * @param key the key
- *
- * @return the message
- */
- static String getMessage(String key) {
- return removeMnemonicAmpersand(rb.getString(key));
- }
-
-
- /**
- * Returns the mnemonic for a message.
- *
- * @param key the key
- *
- * @return the mnemonic <code>int</code>
- */
- static int getMnemonicInt(String key) {
- String message = rb.getString(key);
- return (findMnemonicInt(message));
- }
-
- /**
- * Returns the mnemonic display index for a message.
- *
- * @param key the key
- *
- * @return the mnemonic display index
- */
- static int getDisplayedMnemonicIndex(String key) {
- String message = rb.getString(key);
- return (findMnemonicIndex(message));
- }
-
- /**
- * Finds the mnemonic character in a message.
- *
- * The mnemonic character is the first character followed by the first
- * <code>&</code> that is not followed by another <code>&</code>.
- *
- * @return the mnemonic as an <code>int</code>, or <code>0</code> if it
- * can't be found.
- */
- private static int findMnemonicInt(String s) {
- for (int i = 0; i < s.length() - 1; i++) {
- if (s.charAt(i) == '&') {
- if (s.charAt(i + 1) != '&') {
- return KeyEvent.getExtendedKeyCodeForChar(s.charAt(i + 1));
- } else {
- i++;
- }
- }
- }
- return 0;
- }
-
- /**
- * Finds the index of the mnemonic character in a message.
- *
- * The mnemonic character is the first character followed by the first
- * <code>&</code> that is not followed by another <code>&</code>.
- *
- * @return the mnemonic character index as an <code>int</code>, or <code>-1</code> if it
- * can't be found.
- */
- private static int findMnemonicIndex(String s) {
- for (int i = 0; i < s.length() - 1; i++) {
- if (s.charAt(i) == '&') {
- if (s.charAt(i + 1) != '&') {
- // Return the index of the '&' since it will be removed
- return i;
- } else {
- i++;
- }
- }
- }
- return -1;
- }
-
- /**
- * Removes the mnemonic identifier (<code>&</code>) from a string unless
- * it's escaped by <code>&&</code> or placed at the end.
- *
- * @param message the message
- *
- * @return a message with the mnemonic identifier removed
- */
- private static String removeMnemonicAmpersand(String message) {
- StringBuilder s = new StringBuilder();
- for (int i = 0; i < message.length(); i++) {
- char current = message.charAt(i);
- if (current != '&' || i == message.length() - 1
- || message.charAt(i + 1) == '&') {
- s.append(current);
- }
- }
- return s.toString();
- }
-}
-
-/**
- * Each entry in the policy configuration file is represented by a
- * PolicyEntry object.
- *
- * A PolicyEntry is a (CodeSource,Permission) pair. The
- * CodeSource contains the (URL, PublicKey) that together identify
- * where the Java bytecodes come from and who (if anyone) signed
- * them. The URL could refer to localhost. The URL could also be
- * null, meaning that this policy entry is given to all comers, as
- * long as they match the signer field. The signer could be null,
- * meaning the code is not signed.
- *
- * The Permission contains the (Type, Name, Action) triplet.
- *
- */
-@SuppressWarnings({"deprecation",
- "removal"}) // PolicyTool
-class PolicyEntry {
-
- private CodeSource codesource;
- private PolicyTool tool;
- private PolicyParser.GrantEntry grantEntry;
- private boolean testing = false;
-
- /**
- * Create a PolicyEntry object from the information read in
- * from a policy file.
- */
- PolicyEntry(PolicyTool tool, PolicyParser.GrantEntry ge)
- throws MalformedURLException, NoSuchMethodException,
- ClassNotFoundException, InstantiationException, IllegalAccessException,
- InvocationTargetException, CertificateException,
- IOException, NoSuchAlgorithmException, UnrecoverableKeyException {
-
- this.tool = tool;
-
- URL location = null;
-
- // construct the CodeSource
- if (ge.codeBase != null)
- location = new URL(ge.codeBase);
- this.codesource = new CodeSource(location,
- (java.security.cert.Certificate[]) null);
-
- if (testing) {
- System.out.println("Adding Policy Entry:");
- System.out.println(" CodeBase = " + location);
- System.out.println(" Signers = " + ge.signedBy);
- System.out.println(" with " + ge.principals.size() +
- " Principals");
- }
-
- this.grantEntry = ge;
- }
-
- /**
- * get the codesource associated with this PolicyEntry
- */
- CodeSource getCodeSource() {
- return codesource;
- }
-
- /**
- * get the GrantEntry associated with this PolicyEntry
- */
- PolicyParser.GrantEntry getGrantEntry() {
- return grantEntry;
- }
-
- /**
- * convert the header portion, i.e. codebase, signer, principals, of
- * this policy entry into a string
- */
- String headerToString() {
- String pString = principalsToString();
- if (pString.length() == 0) {
- return codebaseToString();
- } else {
- return codebaseToString() + ", " + pString;
- }
- }
-
- /**
- * convert the Codebase/signer portion of this policy entry into a string
- */
- String codebaseToString() {
-
- String stringEntry = new String();
-
- if (grantEntry.codeBase != null &&
- grantEntry.codeBase.equals("") == false)
- stringEntry = stringEntry.concat
- ("CodeBase \"" +
- grantEntry.codeBase +
- "\"");
-
- if (grantEntry.signedBy != null &&
- grantEntry.signedBy.equals("") == false)
- stringEntry = ((stringEntry.length() > 0) ?
- stringEntry.concat(", SignedBy \"" +
- grantEntry.signedBy +
- "\"") :
- stringEntry.concat("SignedBy \"" +
- grantEntry.signedBy +
- "\""));
-
- if (stringEntry.length() == 0)
- return new String("CodeBase <ALL>");
- return stringEntry;
- }
-
- /**
- * convert the Principals portion of this policy entry into a string
- */
- String principalsToString() {
- String result = "";
- if ((grantEntry.principals != null) &&
- (!grantEntry.principals.isEmpty())) {
- StringBuilder sb = new StringBuilder(200);
- ListIterator<PolicyParser.PrincipalEntry> list =
- grantEntry.principals.listIterator();
- while (list.hasNext()) {
- PolicyParser.PrincipalEntry pppe = list.next();
- sb.append(" Principal ").append(pppe.getDisplayClass())
- .append(' ')
- .append(pppe.getDisplayName(true));
- if (list.hasNext()) sb.append(", ");
- }
- result = sb.toString();
- }
- return result;
- }
-
- /**
- * convert this policy entry into a PolicyParser.PermissionEntry
- */
- PolicyParser.PermissionEntry toPermissionEntry(Permission perm) {
-
- String actions = null;
-
- // get the actions
- if (perm.getActions() != null &&
- perm.getActions().trim() != "")
- actions = perm.getActions();
-
- PolicyParser.PermissionEntry pe = new PolicyParser.PermissionEntry
- (perm.getClass().getName(),
- perm.getName(),
- actions);
- return pe;
- }
-}
-
-/**
- * The main window for the PolicyTool
- */
-@SuppressWarnings({"deprecation",
- "removal"}) // PolicyTool
-class ToolWindow extends JFrame {
- // use serialVersionUID from JDK 1.2.2 for interoperability
- private static final long serialVersionUID = 5682568601210376777L;
-
- /* ESCAPE key */
- static final KeyStroke escKey = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
-
- /* external paddings */
- public static final Insets TOP_PADDING = new Insets(25,0,0,0);
- public static final Insets BOTTOM_PADDING = new Insets(0,0,25,0);
- public static final Insets LITE_BOTTOM_PADDING = new Insets(0,0,10,0);
- public static final Insets LR_PADDING = new Insets(0,10,0,10);
- public static final Insets TOP_BOTTOM_PADDING = new Insets(15, 0, 15, 0);
- public static final Insets L_TOP_BOTTOM_PADDING = new Insets(5,10,15,0);
- public static final Insets LR_TOP_BOTTOM_PADDING = new Insets(15, 4, 15, 4);
- public static final Insets LR_BOTTOM_PADDING = new Insets(0,10,5,10);
- public static final Insets L_BOTTOM_PADDING = new Insets(0,10,5,0);
- public static final Insets R_BOTTOM_PADDING = new Insets(0, 0, 25, 5);
- public static final Insets R_PADDING = new Insets(0, 0, 0, 5);
-
- /* buttons and menus */
- public static final String NEW_POLICY_FILE = "New";
- public static final String OPEN_POLICY_FILE = "Open";
- public static final String SAVE_POLICY_FILE = "Save";
- public static final String SAVE_AS_POLICY_FILE = "Save.As";
- public static final String VIEW_WARNINGS = "View.Warning.Log";
- public static final String QUIT = "Exit";
- public static final String ADD_POLICY_ENTRY = "Add.Policy.Entry";
- public static final String EDIT_POLICY_ENTRY = "Edit.Policy.Entry";
- public static final String REMOVE_POLICY_ENTRY = "Remove.Policy.Entry";
- public static final String EDIT_KEYSTORE = "Edit";
- public static final String ADD_PUBKEY_ALIAS = "Add.Public.Key.Alias";
- public static final String REMOVE_PUBKEY_ALIAS = "Remove.Public.Key.Alias";
-
- /* gridbag index for components in the main window (MW) */
- public static final int MW_FILENAME_LABEL = 0;
- public static final int MW_FILENAME_TEXTFIELD = 1;
- public static final int MW_PANEL = 2;
- public static final int MW_ADD_BUTTON = 0;
- public static final int MW_EDIT_BUTTON = 1;
- public static final int MW_REMOVE_BUTTON = 2;
- public static final int MW_POLICY_LIST = 3; // follows MW_PANEL
-
- /* The preferred height of JTextField should match JComboBox. */
- static final int TEXTFIELD_HEIGHT = new JComboBox<>().getPreferredSize().height;
-
- private PolicyTool tool;
-
- /**
- * Constructor
- */
- ToolWindow(PolicyTool tool) {
- this.tool = tool;
- }
-
- /**
- * Don't call getComponent directly on the window
- */
- public Component getComponent(int n) {
- Component c = getContentPane().getComponent(n);
- if (c instanceof JScrollPane) {
- c = ((JScrollPane)c).getViewport().getView();
- }
- return c;
- }
-
- /**
- * Initialize the PolicyTool window with the necessary components
- */
- private void initWindow() {
- // The ToolWindowListener will handle closing the window.
- setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
-
- // create the top menu bar
- JMenuBar menuBar = new JMenuBar();
-
- // create a File menu
- JMenu menu = new JMenu();
- configureButton(menu, "File");
- ActionListener actionListener = new FileMenuListener(tool, this);
- addMenuItem(menu, NEW_POLICY_FILE, actionListener, "N");
- addMenuItem(menu, OPEN_POLICY_FILE, actionListener, "O");
- addMenuItem(menu, SAVE_POLICY_FILE, actionListener, "S");
- addMenuItem(menu, SAVE_AS_POLICY_FILE, actionListener, null);
- addMenuItem(menu, VIEW_WARNINGS, actionListener, null);
- addMenuItem(menu, QUIT, actionListener, null);
- menuBar.add(menu);
-
- // create a KeyStore menu
- menu = new JMenu();
- configureButton(menu, "KeyStore");
- actionListener = new MainWindowListener(tool, this);
- addMenuItem(menu, EDIT_KEYSTORE, actionListener, null);
- menuBar.add(menu);
- setJMenuBar(menuBar);
-
- // Create some space around components
- ((JPanel)getContentPane()).setBorder(new EmptyBorder(6, 6, 6, 6));
-
- // policy entry listing
- JLabel label = new JLabel(PolicyTool.getMessage("Policy.File."));
- addNewComponent(this, label, MW_FILENAME_LABEL,
- 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
- LR_TOP_BOTTOM_PADDING);
- JTextField tf = new JTextField(50);
- tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
- tf.getAccessibleContext().setAccessibleName(
- PolicyTool.getMessage("Policy.File."));
- tf.setEditable(false);
- addNewComponent(this, tf, MW_FILENAME_TEXTFIELD,
- 1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
- LR_TOP_BOTTOM_PADDING);
-
-
- // add ADD/REMOVE/EDIT buttons in a new panel
- JPanel panel = new JPanel();
- panel.setLayout(new GridBagLayout());
-
- JButton button = new JButton();
- configureButton(button, ADD_POLICY_ENTRY);
- button.addActionListener(new MainWindowListener(tool, this));
- addNewComponent(panel, button, MW_ADD_BUTTON,
- 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
- LR_PADDING);
-
- button = new JButton();
- configureButton(button, EDIT_POLICY_ENTRY);
- button.addActionListener(new MainWindowListener(tool, this));
- addNewComponent(panel, button, MW_EDIT_BUTTON,
- 1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
- LR_PADDING);
-
- button = new JButton();
- configureButton(button, REMOVE_POLICY_ENTRY);
- button.addActionListener(new MainWindowListener(tool, this));
- addNewComponent(panel, button, MW_REMOVE_BUTTON,
- 2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
- LR_PADDING);
-
- addNewComponent(this, panel, MW_PANEL,
- 0, 2, 2, 1, 0.0, 0.0, GridBagConstraints.BOTH,
- BOTTOM_PADDING);
-
-
- String policyFile = tool.getPolicyFileName();
- if (policyFile == null) {
- String userHome;
- userHome = java.security.AccessController.doPrivileged(
- (PrivilegedAction<String>) () -> System.getProperty("user.home"));
- policyFile = userHome + File.separatorChar + ".java.policy";
- }
-
- try {
- // open the policy file
- tool.openPolicy(policyFile);
-
- // display the policy entries via the policy list textarea
- DefaultListModel<String> listModel = new DefaultListModel<>();
- JList<String> list = new JList<>(listModel);
- list.setVisibleRowCount(15);
- list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- list.addMouseListener(new PolicyListListener(tool, this));
- PolicyEntry entries[] = tool.getEntry();
- if (entries != null) {
- for (int i = 0; i < entries.length; i++) {
- listModel.addElement(entries[i].headerToString());
- }
- }
- JTextField newFilename = (JTextField)
- getComponent(MW_FILENAME_TEXTFIELD);
- newFilename.setText(policyFile);
- initPolicyList(list);
-
- } catch (FileNotFoundException fnfe) {
- // add blank policy listing
- JList<String> list = new JList<>(new DefaultListModel<>());
- list.setVisibleRowCount(15);
- list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- list.addMouseListener(new PolicyListListener(tool, this));
- initPolicyList(list);
- tool.setPolicyFileName(null);
- tool.modified = false;
-
- // just add warning
- tool.warnings.addElement(fnfe.toString());
-
- } catch (Exception e) {
- // add blank policy listing
- JList<String> list = new JList<>(new DefaultListModel<>());
- list.setVisibleRowCount(15);
- list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- list.addMouseListener(new PolicyListListener(tool, this));
- initPolicyList(list);
- tool.setPolicyFileName(null);
- tool.modified = false;
-
- // display the error
- MessageFormat form = new MessageFormat(PolicyTool.getMessage
- ("Could.not.open.policy.file.policyFile.e.toString."));
- Object[] source = {policyFile, e.toString()};
- displayErrorDialog(null, form.format(source));
- }
- }
-
-
- // Platform specific modifier (control / command).
- private int shortCutModifier = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
-
- private void addMenuItem(JMenu menu, String key, ActionListener actionListener, String accelerator) {
- JMenuItem menuItem = new JMenuItem();
- configureButton(menuItem, key);
-
- if (PolicyTool.rb.containsKey(key + ".accelerator")) {
- // Accelerator from resources takes precedence
- accelerator = PolicyTool.getMessage(key + ".accelerator");
- }
-
- if (accelerator != null && !accelerator.isEmpty()) {
- KeyStroke keyStroke;
- if (accelerator.length() == 1) {
- keyStroke = KeyStroke.getKeyStroke(KeyEvent.getExtendedKeyCodeForChar(accelerator.charAt(0)),
- shortCutModifier);
- } else {
- keyStroke = KeyStroke.getKeyStroke(accelerator);
- }
- menuItem.setAccelerator(keyStroke);
- }
-
- menuItem.addActionListener(actionListener);
- menu.add(menuItem);
- }
-
- static void configureButton(AbstractButton button, String key) {
- button.setText(PolicyTool.getMessage(key));
- button.setActionCommand(key);
-
- int mnemonicInt = PolicyTool.getMnemonicInt(key);
- if (mnemonicInt > 0) {
- button.setMnemonic(mnemonicInt);
- button.setDisplayedMnemonicIndex(PolicyTool.getDisplayedMnemonicIndex(key));
- }
- }
-
- static void configureLabelFor(JLabel label, JComponent component, String key) {
- label.setText(PolicyTool.getMessage(key));
- label.setLabelFor(component);
-
- int mnemonicInt = PolicyTool.getMnemonicInt(key);
- if (mnemonicInt > 0) {
- label.setDisplayedMnemonic(mnemonicInt);
- label.setDisplayedMnemonicIndex(PolicyTool.getDisplayedMnemonicIndex(key));
- }
- }
-
-
- /**
- * Add a component to the PolicyTool window
- */
- void addNewComponent(Container container, JComponent component,
- int index, int gridx, int gridy, int gridwidth, int gridheight,
- double weightx, double weighty, int fill, Insets is) {
-
- if (container instanceof JFrame) {
- container = ((JFrame)container).getContentPane();
- } else if (container instanceof JDialog) {
- container = ((JDialog)container).getContentPane();
- }
-
- // add the component at the specified gridbag index
- container.add(component, index);
-
- // set the constraints
- GridBagLayout gbl = (GridBagLayout)container.getLayout();
- GridBagConstraints gbc = new GridBagConstraints();
- gbc.gridx = gridx;
- gbc.gridy = gridy;
- gbc.gridwidth = gridwidth;
- gbc.gridheight = gridheight;
- gbc.weightx = weightx;
- gbc.weighty = weighty;
- gbc.fill = fill;
- if (is != null) gbc.insets = is;
- gbl.setConstraints(component, gbc);
- }
-
-
- /**
- * Add a component to the PolicyTool window without external padding
- */
- void addNewComponent(Container container, JComponent component,
- int index, int gridx, int gridy, int gridwidth, int gridheight,
- double weightx, double weighty, int fill) {
-
- // delegate with "null" external padding
- addNewComponent(container, component, index, gridx, gridy,
- gridwidth, gridheight, weightx, weighty,
- fill, null);
- }
-
-
- /**
- * Init the policy_entry_list TEXTAREA component in the
- * PolicyTool window
- */
- void initPolicyList(JList<String> policyList) {
-
- // add the policy list to the window
- //policyList.setPreferredSize(new Dimension(500, 350));
- JScrollPane scrollPane = new JScrollPane(policyList);
- addNewComponent(this, scrollPane, MW_POLICY_LIST,
- 0, 3, 2, 1, 1.0, 1.0, GridBagConstraints.BOTH);
- }
-
- /**
- * Replace the policy_entry_list TEXTAREA component in the
- * PolicyTool window with an updated one.
- */
- void replacePolicyList(JList<String> policyList) {
-
- // remove the original list of Policy Entries
- // and add the new list of entries
- @SuppressWarnings("unchecked")
- JList<String> list = (JList<String>)getComponent(MW_POLICY_LIST);
- list.setModel(policyList.getModel());
- }
-
- /**
- * display the main PolicyTool window
- */
- void displayToolWindow(String args[]) {
-
- setTitle(PolicyTool.getMessage("Policy.Tool"));
- setResizable(true);
- addWindowListener(new ToolWindowListener(tool, this));
- //setBounds(135, 80, 500, 500);
- getContentPane().setLayout(new GridBagLayout());
-
- initWindow();
- pack();
- setLocationRelativeTo(null);
-
- // display it
- setVisible(true);
-
- if (tool.newWarning == true) {
- displayStatusDialog(this, PolicyTool.getMessage
- ("Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information."));
- }
- }
-
- /**
- * displays a dialog box describing an error which occurred.
- */
- void displayErrorDialog(Window w, String error) {
- ToolDialog ed = new ToolDialog
- (PolicyTool.getMessage("Error"), tool, this, true);
-
- ed.setLayout(new GridBagLayout());
-
- JLabel label = new JLabel(error);
- addNewComponent(ed, label, 0,
- 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH);
-
- JButton okButton = new JButton(PolicyTool.getMessage("OK"));
- ActionListener okListener = new ErrorOKButtonListener(ed);
- okButton.addActionListener(okListener);
- addNewComponent(ed, okButton, 1,
- 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL);
-
- ed.getRootPane().setDefaultButton(okButton);
- ed.getRootPane().registerKeyboardAction(okListener, escKey, JComponent.WHEN_IN_FOCUSED_WINDOW);
-
- ed.pack();
- ed.setLocationRelativeTo(w);
- ed.setVisible(true);
- }
-
- /**
- * displays a dialog box describing an error which occurred.
- */
- void displayErrorDialog(Window w, Throwable t) {
- if (t instanceof NoDisplayException) {
- return;
- }
- if (t.getClass() == Exception.class) {
- // Exception is usually thrown inside policytool for user
- // interaction error. There is no need to show the type.
- displayErrorDialog(w, t.getLocalizedMessage());
- } else {
- displayErrorDialog(w, t.toString());
- }
- }
-
- /**
- * displays a dialog box describing the status of an event
- */
- void displayStatusDialog(Window w, String status) {
- ToolDialog sd = new ToolDialog
- (PolicyTool.getMessage("Status"), tool, this, true);
-
- // find the location of the PolicyTool gui
- Point location = ((w == null) ?
- getLocationOnScreen() : w.getLocationOnScreen());
- //sd.setBounds(location.x + 50, location.y + 50, 500, 100);
- sd.setLayout(new GridBagLayout());
-
- JLabel label = new JLabel(status);
- addNewComponent(sd, label, 0,
- 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH);
-
- JButton okButton = new JButton(PolicyTool.getMessage("OK"));
- ActionListener okListener = new StatusOKButtonListener(sd);
- okButton.addActionListener(okListener);
- addNewComponent(sd, okButton, 1,
- 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL);
-
- sd.getRootPane().setDefaultButton(okButton);
- sd.getRootPane().registerKeyboardAction(okListener, escKey, JComponent.WHEN_IN_FOCUSED_WINDOW);
-
- sd.pack();
- sd.setLocationRelativeTo(w);
- sd.setVisible(true);
- }
-
- /**
- * display the warning log
- */
- void displayWarningLog(Window w) {
-
- ToolDialog wd = new ToolDialog
- (PolicyTool.getMessage("Warning"), tool, this, true);
-
- // find the location of the PolicyTool gui
- Point location = ((w == null) ?
- getLocationOnScreen() : w.getLocationOnScreen());
- //wd.setBounds(location.x + 50, location.y + 50, 500, 100);
- wd.setLayout(new GridBagLayout());
-
- JTextArea ta = new JTextArea();
- ta.setEditable(false);
- for (int i = 0; i < tool.warnings.size(); i++) {
- ta.append(tool.warnings.elementAt(i));
- ta.append(PolicyTool.getMessage("NEWLINE"));
- }
- addNewComponent(wd, ta, 0,
- 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
- BOTTOM_PADDING);
- ta.setFocusable(false);
-
- JButton okButton = new JButton(PolicyTool.getMessage("OK"));
- ActionListener okListener = new CancelButtonListener(wd);
- okButton.addActionListener(okListener);
- addNewComponent(wd, okButton, 1,
- 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
- LR_PADDING);
-
- wd.getRootPane().setDefaultButton(okButton);
- wd.getRootPane().registerKeyboardAction(okListener, escKey, JComponent.WHEN_IN_FOCUSED_WINDOW);
-
- wd.pack();
- wd.setLocationRelativeTo(w);
- wd.setVisible(true);
- }
-
- char displayYesNoDialog(Window w, String title, String prompt, String yes, String no) {
-
- final ToolDialog tw = new ToolDialog
- (title, tool, this, true);
- Point location = ((w == null) ?
- getLocationOnScreen() : w.getLocationOnScreen());
- //tw.setBounds(location.x + 75, location.y + 100, 400, 150);
- tw.setLayout(new GridBagLayout());
-
- JTextArea ta = new JTextArea(prompt, 10, 50);
- ta.setEditable(false);
- ta.setLineWrap(true);
- ta.setWrapStyleWord(true);
- JScrollPane scrollPane = new JScrollPane(ta,
- JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
- JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- addNewComponent(tw, scrollPane, 0,
- 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH);
- ta.setFocusable(false);
-
- JPanel panel = new JPanel();
- panel.setLayout(new GridBagLayout());
-
- // StringBuffer to store button press. Must be final.
- final StringBuffer chooseResult = new StringBuffer();
-
- JButton button = new JButton(yes);
- button.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- chooseResult.append('Y');
- tw.setVisible(false);
- tw.dispose();
- }
- });
- addNewComponent(panel, button, 0,
- 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
- LR_PADDING);
-
- button = new JButton(no);
- button.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- chooseResult.append('N');
- tw.setVisible(false);
- tw.dispose();
- }
- });
- addNewComponent(panel, button, 1,
- 1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
- LR_PADDING);
-
- addNewComponent(tw, panel, 1,
- 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL);
-
- tw.pack();
- tw.setLocationRelativeTo(w);
- tw.setVisible(true);
- if (chooseResult.length() > 0) {
- return chooseResult.charAt(0);
- } else {
- // I did encounter this once, don't why.
- return 'N';
- }
- }
-
-}
-
-/**
- * General dialog window
- */
-@SuppressWarnings({"deprecation",
- "removal"}) // PolicyTool
-class ToolDialog extends JDialog {
- // use serialVersionUID from JDK 1.2.2 for interoperability
- private static final long serialVersionUID = -372244357011301190L;
-
- /* ESCAPE key */
- static final KeyStroke escKey = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
-
- /* necessary constants */
- public static final int NOACTION = 0;
- public static final int QUIT = 1;
- public static final int NEW = 2;
- public static final int OPEN = 3;
-
- /* popup menus */
- public static final String PERM =
- PolicyTool.getMessage
- ("Permission.");
-
- public static final String PRIN_TYPE =
- PolicyTool.getMessage("Principal.Type.");
- public static final String PRIN_NAME =
- PolicyTool.getMessage("Principal.Name.");
-
- /* more popu menus */
- public static final String PERM_NAME =
- PolicyTool.getMessage
- ("Target.Name.");
-
- /* and more popup menus */
- public static final String PERM_ACTIONS =
- PolicyTool.getMessage
- ("Actions.");
-
- /* gridbag index for display PolicyEntry (PE) components */
- public static final int PE_CODEBASE_LABEL = 0;
- public static final int PE_CODEBASE_TEXTFIELD = 1;
- public static final int PE_SIGNEDBY_LABEL = 2;
- public static final int PE_SIGNEDBY_TEXTFIELD = 3;
-
- public static final int PE_PANEL0 = 4;
- public static final int PE_ADD_PRIN_BUTTON = 0;
- public static final int PE_EDIT_PRIN_BUTTON = 1;
- public static final int PE_REMOVE_PRIN_BUTTON = 2;
-
- public static final int PE_PRIN_LABEL = 5;
- public static final int PE_PRIN_LIST = 6;
-
- public static final int PE_PANEL1 = 7;
- public static final int PE_ADD_PERM_BUTTON = 0;
- public static final int PE_EDIT_PERM_BUTTON = 1;
- public static final int PE_REMOVE_PERM_BUTTON = 2;
-
- public static final int PE_PERM_LIST = 8;
-
- public static final int PE_PANEL2 = 9;
- public static final int PE_CANCEL_BUTTON = 1;
- public static final int PE_DONE_BUTTON = 0;
-
- /* the gridbag index for components in the Principal Dialog (PRD) */
- public static final int PRD_DESC_LABEL = 0;
- public static final int PRD_PRIN_CHOICE = 1;
- public static final int PRD_PRIN_TEXTFIELD = 2;
- public static final int PRD_NAME_LABEL = 3;
- public static final int PRD_NAME_TEXTFIELD = 4;
- public static final int PRD_CANCEL_BUTTON = 6;
- public static final int PRD_OK_BUTTON = 5;
-
- /* the gridbag index for components in the Permission Dialog (PD) */
- public static final int PD_DESC_LABEL = 0;
- public static final int PD_PERM_CHOICE = 1;
- public static final int PD_PERM_TEXTFIELD = 2;
- public static final int PD_NAME_CHOICE = 3;
- public static final int PD_NAME_TEXTFIELD = 4;
- public static final int PD_ACTIONS_CHOICE = 5;
- public static final int PD_ACTIONS_TEXTFIELD = 6;
- public static final int PD_SIGNEDBY_LABEL = 7;
- public static final int PD_SIGNEDBY_TEXTFIELD = 8;
- public static final int PD_CANCEL_BUTTON = 10;
- public static final int PD_OK_BUTTON = 9;
-
- /* modes for KeyStore */
- public static final int EDIT_KEYSTORE = 0;
-
- /* the gridbag index for components in the Change KeyStore Dialog (KSD) */
- public static final int KSD_NAME_LABEL = 0;
- public static final int KSD_NAME_TEXTFIELD = 1;
- public static final int KSD_TYPE_LABEL = 2;
- public static final int KSD_TYPE_TEXTFIELD = 3;
- public static final int KSD_PROVIDER_LABEL = 4;
- public static final int KSD_PROVIDER_TEXTFIELD = 5;
- public static final int KSD_PWD_URL_LABEL = 6;
- public static final int KSD_PWD_URL_TEXTFIELD = 7;
- public static final int KSD_CANCEL_BUTTON = 9;
- public static final int KSD_OK_BUTTON = 8;
-
- /* the gridbag index for components in the User Save Changes Dialog (USC) */
- public static final int USC_LABEL = 0;
- public static final int USC_PANEL = 1;
- public static final int USC_YES_BUTTON = 0;
- public static final int USC_NO_BUTTON = 1;
- public static final int USC_CANCEL_BUTTON = 2;
-
- /* gridbag index for the ConfirmRemovePolicyEntryDialog (CRPE) */
- public static final int CRPE_LABEL1 = 0;
- public static final int CRPE_LABEL2 = 1;
- public static final int CRPE_PANEL = 2;
- public static final int CRPE_PANEL_OK = 0;
- public static final int CRPE_PANEL_CANCEL = 1;
-
- /* some private static finals */
- private static final int PERMISSION = 0;
- private static final int PERMISSION_NAME = 1;
- private static final int PERMISSION_ACTIONS = 2;
- private static final int PERMISSION_SIGNEDBY = 3;
- private static final int PRINCIPAL_TYPE = 4;
- private static final int PRINCIPAL_NAME = 5;
-
- /* The preferred height of JTextField should match JComboBox. */
- static final int TEXTFIELD_HEIGHT = new JComboBox<>().getPreferredSize().height;
-
- public static java.util.ArrayList<Perm> PERM_ARRAY;
- public static java.util.ArrayList<Prin> PRIN_ARRAY;
- PolicyTool tool;
- ToolWindow tw;
-
- static {
-
- // set up permission objects
-
- PERM_ARRAY = new java.util.ArrayList<Perm>();
- PERM_ARRAY.add(new AllPerm());
- PERM_ARRAY.add(new AudioPerm());
- PERM_ARRAY.add(new AuthPerm());
- PERM_ARRAY.add(new AWTPerm());
- PERM_ARRAY.add(new DelegationPerm());
- PERM_ARRAY.add(new FilePerm());
- PERM_ARRAY.add(new URLPerm());
- PERM_ARRAY.add(new InqSecContextPerm());
- PERM_ARRAY.add(new LogPerm());
- PERM_ARRAY.add(new MgmtPerm());
- PERM_ARRAY.add(new MBeanPerm());
- PERM_ARRAY.add(new MBeanSvrPerm());
- PERM_ARRAY.add(new MBeanTrustPerm());
- PERM_ARRAY.add(new NetPerm());
- PERM_ARRAY.add(new NetworkPerm());
- PERM_ARRAY.add(new PrivCredPerm());
- PERM_ARRAY.add(new PropPerm());
- PERM_ARRAY.add(new ReflectPerm());
- PERM_ARRAY.add(new RuntimePerm());
- PERM_ARRAY.add(new SecurityPerm());
- PERM_ARRAY.add(new SerialPerm());
- PERM_ARRAY.add(new ServicePerm());
- PERM_ARRAY.add(new SocketPerm());
- PERM_ARRAY.add(new SQLPerm());
- PERM_ARRAY.add(new SSLPerm());
- PERM_ARRAY.add(new SubjDelegPerm());
-
- // set up principal objects
-
- PRIN_ARRAY = new java.util.ArrayList<Prin>();
- PRIN_ARRAY.add(new KrbPrin());
- PRIN_ARRAY.add(new X500Prin());
- }
-
- ToolDialog(String title, PolicyTool tool, ToolWindow tw, boolean modal) {
- super(tw, modal);
- setTitle(title);
- this.tool = tool;
- this.tw = tw;
- addWindowListener(new ChildWindowListener(this));
-
- // Create some space around components
- ((JPanel)getContentPane()).setBorder(new EmptyBorder(6, 6, 6, 6));
- }
-
- /**
- * Don't call getComponent directly on the window
- */
- public Component getComponent(int n) {
- Component c = getContentPane().getComponent(n);
- if (c instanceof JScrollPane) {
- c = ((JScrollPane)c).getViewport().getView();
- }
- return c;
- }
-
- /**
- * get the Perm instance based on either the (shortened) class name
- * or the fully qualified class name
- */
- static Perm getPerm(String clazz, boolean fullClassName) {
- for (int i = 0; i < PERM_ARRAY.size(); i++) {
- Perm next = PERM_ARRAY.get(i);
- if (fullClassName) {
- if (next.getName().equals(clazz)) {
- return next;
- }
- } else {
- if (next.getSimpleName().equals(clazz)) {
- return next;
- }
- }
- }
- return null;
- }
-
- /**
- * get the Prin instance based on either the (shortened) class name
- * or the fully qualified class name
- */
- static Prin getPrin(String clazz, boolean fullClassName) {
- for (int i = 0; i < PRIN_ARRAY.size(); i++) {
- Prin next = PRIN_ARRAY.get(i);
- if (fullClassName) {
- if (next.getName().equals(clazz)) {
- return next;
- }
- } else {
- if (next.getSimpleName().equals(clazz)) {
- return next;
- }
- }
- }
- return null;
- }
-
- /**
- * pop up a dialog so the user can enter info to add a new PolicyEntry
- * - if edit is TRUE, then the user is editing an existing entry
- * and we should display the original info as well.
- *
- * - the other reason we need the 'edit' boolean is we need to know
- * when we are adding a NEW policy entry. in this case, we can
- * not simply update the existing entry, because it doesn't exist.
- * we ONLY update the GUI listing/info, and then when the user
- * finally clicks 'OK' or 'DONE', then we can collect that info
- * and add it to the policy.
- */
- void displayPolicyEntryDialog(boolean edit) {
-
- int listIndex = 0;
- PolicyEntry entries[] = null;
- TaggedList prinList = new TaggedList(3, false);
- prinList.getAccessibleContext().setAccessibleName(
- PolicyTool.getMessage("Principal.List"));
- prinList.addMouseListener
- (new EditPrinButtonListener(tool, tw, this, edit));
- TaggedList permList = new TaggedList(10, false);
- permList.getAccessibleContext().setAccessibleName(
- PolicyTool.getMessage("Permission.List"));
- permList.addMouseListener
- (new EditPermButtonListener(tool, tw, this, edit));
-
- // find where the PolicyTool gui is
- Point location = tw.getLocationOnScreen();
- //setBounds(location.x + 75, location.y + 200, 650, 500);
- setLayout(new GridBagLayout());
- setResizable(true);
-
- if (edit) {
- // get the selected item
- entries = tool.getEntry();
- @SuppressWarnings("unchecked")
- JList<String> policyList = (JList<String>)tw.getComponent(ToolWindow.MW_POLICY_LIST);
- listIndex = policyList.getSelectedIndex();
-
- // get principal list
- LinkedList<PolicyParser.PrincipalEntry> principals =
- entries[listIndex].getGrantEntry().principals;
- for (int i = 0; i < principals.size(); i++) {
- String prinString = null;
- PolicyParser.PrincipalEntry nextPrin = principals.get(i);
- prinList.addTaggedItem(PrincipalEntryToUserFriendlyString(nextPrin), nextPrin);
- }
-
- // get permission list
- Vector<PolicyParser.PermissionEntry> permissions =
- entries[listIndex].getGrantEntry().permissionEntries;
- for (int i = 0; i < permissions.size(); i++) {
- String permString = null;
- PolicyParser.PermissionEntry nextPerm =
- permissions.elementAt(i);
- permList.addTaggedItem(ToolDialog.PermissionEntryToUserFriendlyString(nextPerm), nextPerm);
- }
- }
-
- // codebase label and textfield
- JLabel label = new JLabel();
- tw.addNewComponent(this, label, PE_CODEBASE_LABEL,
- 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
- ToolWindow.R_PADDING);
- JTextField tf;
- tf = (edit ?
- new JTextField(entries[listIndex].getGrantEntry().codeBase) :
- new JTextField());
- ToolWindow.configureLabelFor(label, tf, "CodeBase.");
- tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
- tf.getAccessibleContext().setAccessibleName(
- PolicyTool.getMessage("Code.Base"));
- tw.addNewComponent(this, tf, PE_CODEBASE_TEXTFIELD,
- 1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH);
-
- // signedby label and textfield
- label = new JLabel();
- tw.addNewComponent(this, label, PE_SIGNEDBY_LABEL,
- 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
- ToolWindow.R_PADDING);
- tf = (edit ?
- new JTextField(entries[listIndex].getGrantEntry().signedBy) :
- new JTextField());
- ToolWindow.configureLabelFor(label, tf, "SignedBy.");
- tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
- tf.getAccessibleContext().setAccessibleName(
- PolicyTool.getMessage("Signed.By."));
- tw.addNewComponent(this, tf, PE_SIGNEDBY_TEXTFIELD,
- 1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH);
-
- // panel for principal buttons
- JPanel panel = new JPanel();
- panel.setLayout(new GridBagLayout());
-
- JButton button = new JButton();
- ToolWindow.configureButton(button, "Add.Principal");
- button.addActionListener
- (new AddPrinButtonListener(tool, tw, this, edit));
- tw.addNewComponent(panel, button, PE_ADD_PRIN_BUTTON,
- 0, 0, 1, 1, 100.0, 0.0, GridBagConstraints.HORIZONTAL);
-
- button = new JButton();
- ToolWindow.configureButton(button, "Edit.Principal");
- button.addActionListener(new EditPrinButtonListener
- (tool, tw, this, edit));
- tw.addNewComponent(panel, button, PE_EDIT_PRIN_BUTTON,
- 1, 0, 1, 1, 100.0, 0.0, GridBagConstraints.HORIZONTAL);
-
- button = new JButton();
- ToolWindow.configureButton(button, "Remove.Principal");
- button.addActionListener(new RemovePrinButtonListener
- (tool, tw, this, edit));
- tw.addNewComponent(panel, button, PE_REMOVE_PRIN_BUTTON,
- 2, 0, 1, 1, 100.0, 0.0, GridBagConstraints.HORIZONTAL);
-
- tw.addNewComponent(this, panel, PE_PANEL0,
- 1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.HORIZONTAL,
- ToolWindow.LITE_BOTTOM_PADDING);
-
- // principal label and list
- label = new JLabel();
- tw.addNewComponent(this, label, PE_PRIN_LABEL,
- 0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
- ToolWindow.R_BOTTOM_PADDING);
- JScrollPane scrollPane = new JScrollPane(prinList);
- ToolWindow.configureLabelFor(label, scrollPane, "Principals.");
- tw.addNewComponent(this, scrollPane, PE_PRIN_LIST,
- 1, 3, 3, 1, 0.0, prinList.getVisibleRowCount(), GridBagConstraints.BOTH,
- ToolWindow.BOTTOM_PADDING);
-
- // panel for permission buttons
- panel = new JPanel();
- panel.setLayout(new GridBagLayout());
-
- button = new JButton();
- ToolWindow.configureButton(button, ".Add.Permission");
- button.addActionListener(new AddPermButtonListener
- (tool, tw, this, edit));
- tw.addNewComponent(panel, button, PE_ADD_PERM_BUTTON,
- 0, 0, 1, 1, 100.0, 0.0, GridBagConstraints.HORIZONTAL);
-
- button = new JButton();
- ToolWindow.configureButton(button, ".Edit.Permission");
- button.addActionListener(new EditPermButtonListener
- (tool, tw, this, edit));
- tw.addNewComponent(panel, button, PE_EDIT_PERM_BUTTON,
- 1, 0, 1, 1, 100.0, 0.0, GridBagConstraints.HORIZONTAL);
-
-
- button = new JButton();
- ToolWindow.configureButton(button, "Remove.Permission");
- button.addActionListener(new RemovePermButtonListener
- (tool, tw, this, edit));
- tw.addNewComponent(panel, button, PE_REMOVE_PERM_BUTTON,
- 2, 0, 1, 1, 100.0, 0.0, GridBagConstraints.HORIZONTAL);
-
- tw.addNewComponent(this, panel, PE_PANEL1,
- 0, 4, 2, 1, 0.0, 0.0, GridBagConstraints.HORIZONTAL,
- ToolWindow.LITE_BOTTOM_PADDING);
-
- // permission list
- scrollPane = new JScrollPane(permList);
- tw.addNewComponent(this, scrollPane, PE_PERM_LIST,
- 0, 5, 3, 1, 0.0, permList.getVisibleRowCount(), GridBagConstraints.BOTH,
- ToolWindow.BOTTOM_PADDING);
-
-
- // panel for Done and Cancel buttons
- panel = new JPanel();
- panel.setLayout(new GridBagLayout());
-
- // Done Button
- JButton okButton = new JButton(PolicyTool.getMessage("Done"));
- okButton.addActionListener
- (new AddEntryDoneButtonListener(tool, tw, this, edit));
- tw.addNewComponent(panel, okButton, PE_DONE_BUTTON,
- 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
- ToolWindow.LR_PADDING);
-
- // Cancel Button
- JButton cancelButton = new JButton(PolicyTool.getMessage("Cancel"));
- ActionListener cancelListener = new CancelButtonListener(this);
- cancelButton.addActionListener(cancelListener);
- tw.addNewComponent(panel, cancelButton, PE_CANCEL_BUTTON,
- 1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
- ToolWindow.LR_PADDING);
-
- // add the panel
- tw.addNewComponent(this, panel, PE_PANEL2,
- 0, 6, 2, 1, 0.0, 0.0, GridBagConstraints.VERTICAL);
-
- getRootPane().setDefaultButton(okButton);
- getRootPane().registerKeyboardAction(cancelListener, escKey, JComponent.WHEN_IN_FOCUSED_WINDOW);
-
- pack();
- setLocationRelativeTo(tw);
- setVisible(true);
- }
-
- /**
- * Read all the Policy information data in the dialog box
- * and construct a PolicyEntry object with it.
- */
- PolicyEntry getPolicyEntryFromDialog()
- throws InvalidParameterException, MalformedURLException,
- NoSuchMethodException, ClassNotFoundException, InstantiationException,
- IllegalAccessException, InvocationTargetException,
- CertificateException, IOException, Exception {
-
- // get the Codebase
- JTextField tf = (JTextField)getComponent(PE_CODEBASE_TEXTFIELD);
- String codebase = null;
- if (tf.getText().trim().equals("") == false)
- codebase = new String(tf.getText().trim());
-
- // get the SignedBy
- tf = (JTextField)getComponent(PE_SIGNEDBY_TEXTFIELD);
- String signedby = null;
- if (tf.getText().trim().equals("") == false)
- signedby = new String(tf.getText().trim());
-
- // construct a new GrantEntry
- PolicyParser.GrantEntry ge =
- new PolicyParser.GrantEntry(signedby, codebase);
-
- // get the new Principals
- LinkedList<PolicyParser.PrincipalEntry> prins = new LinkedList<>();
- TaggedList prinList = (TaggedList)getComponent(PE_PRIN_LIST);
- for (int i = 0; i < prinList.getModel().getSize(); i++) {
- prins.add((PolicyParser.PrincipalEntry)prinList.getObject(i));
- }
- ge.principals = prins;
-
- // get the new Permissions
- Vector<PolicyParser.PermissionEntry> perms = new Vector<>();
- TaggedList permList = (TaggedList)getComponent(PE_PERM_LIST);
- for (int i = 0; i < permList.getModel().getSize(); i++) {
- perms.addElement((PolicyParser.PermissionEntry)permList.getObject(i));
- }
- ge.permissionEntries = perms;
-
- // construct a new PolicyEntry object
- PolicyEntry entry = new PolicyEntry(tool, ge);
-
- return entry;
- }
-
- /**
- * display a dialog box for the user to enter KeyStore information
- */
- void keyStoreDialog(int mode) {
-
- // find where the PolicyTool gui is
- Point location = tw.getLocationOnScreen();
- //setBounds(location.x + 25, location.y + 100, 500, 300);
- setLayout(new GridBagLayout());
-
- if (mode == EDIT_KEYSTORE) {
-
- // KeyStore label and textfield
- JLabel label = new JLabel();
- tw.addNewComponent(this, label, KSD_NAME_LABEL,
- 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
- ToolWindow.R_BOTTOM_PADDING);
- JTextField tf = new JTextField(tool.getKeyStoreName(), 30);
- ToolWindow.configureLabelFor(label, tf, "KeyStore.URL.");
- tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
-
- // URL to U R L, so that accessibility reader will pronounce well
- tf.getAccessibleContext().setAccessibleName(
- PolicyTool.getMessage("KeyStore.U.R.L."));
- tw.addNewComponent(this, tf, KSD_NAME_TEXTFIELD,
- 1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH,
- ToolWindow.BOTTOM_PADDING);
-
- // KeyStore type and textfield
- label = new JLabel();
- tw.addNewComponent(this, label, KSD_TYPE_LABEL,
- 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
- ToolWindow.R_BOTTOM_PADDING);
- tf = new JTextField(tool.getKeyStoreType(), 30);
- ToolWindow.configureLabelFor(label, tf, "KeyStore.Type.");
- tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
- tf.getAccessibleContext().setAccessibleName(
- PolicyTool.getMessage("KeyStore.Type."));
- tw.addNewComponent(this, tf, KSD_TYPE_TEXTFIELD,
- 1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH,
- ToolWindow.BOTTOM_PADDING);
-
- // KeyStore provider and textfield
- label = new JLabel();
- tw.addNewComponent(this, label, KSD_PROVIDER_LABEL,
- 0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
- ToolWindow.R_BOTTOM_PADDING);
- tf = new JTextField(tool.getKeyStoreProvider(), 30);
- ToolWindow.configureLabelFor(label, tf, "KeyStore.Provider.");
- tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
- tf.getAccessibleContext().setAccessibleName(
- PolicyTool.getMessage("KeyStore.Provider."));
- tw.addNewComponent(this, tf, KSD_PROVIDER_TEXTFIELD,
- 1, 2, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH,
- ToolWindow.BOTTOM_PADDING);
-
- // KeyStore password URL and textfield
- label = new JLabel();
- tw.addNewComponent(this, label, KSD_PWD_URL_LABEL,
- 0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
- ToolWindow.R_BOTTOM_PADDING);
- tf = new JTextField(tool.getKeyStorePwdURL(), 30);
- ToolWindow.configureLabelFor(label, tf, "KeyStore.Password.URL.");
- tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
- tf.getAccessibleContext().setAccessibleName(
- PolicyTool.getMessage("KeyStore.Password.U.R.L."));
- tw.addNewComponent(this, tf, KSD_PWD_URL_TEXTFIELD,
- 1, 3, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH,
- ToolWindow.BOTTOM_PADDING);
-
- // OK button
- JButton okButton = new JButton(PolicyTool.getMessage("OK"));
- okButton.addActionListener
- (new ChangeKeyStoreOKButtonListener(tool, tw, this));
- tw.addNewComponent(this, okButton, KSD_OK_BUTTON,
- 0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL);
-
- // cancel button
- JButton cancelButton = new JButton(PolicyTool.getMessage("Cancel"));
- ActionListener cancelListener = new CancelButtonListener(this);
- cancelButton.addActionListener(cancelListener);
- tw.addNewComponent(this, cancelButton, KSD_CANCEL_BUTTON,
- 1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL);
-
- getRootPane().setDefaultButton(okButton);
- getRootPane().registerKeyboardAction(cancelListener, escKey, JComponent.WHEN_IN_FOCUSED_WINDOW);
- }
-
- pack();
- setLocationRelativeTo(tw);
- setVisible(true);
- }
-
- /**
- * display a dialog box for the user to input Principal info
- *
- * if editPolicyEntry is false, then we are adding Principals to
- * a new PolicyEntry, and we only update the GUI listing
- * with the new Principal.
- *
- * if edit is true, then we are editing an existing Policy entry.
- */
- void displayPrincipalDialog(boolean editPolicyEntry, boolean edit) {
-
- PolicyParser.PrincipalEntry editMe = null;
-
- // get the Principal selected from the Principal List
- TaggedList prinList = (TaggedList)getComponent(PE_PRIN_LIST);
- int prinIndex = prinList.getSelectedIndex();
-
- if (edit) {
- editMe = (PolicyParser.PrincipalEntry)prinList.getObject(prinIndex);
- }
-
- ToolDialog newTD = new ToolDialog
- (PolicyTool.getMessage("Principals"), tool, tw, true);
- newTD.addWindowListener(new ChildWindowListener(newTD));
-
- // find where the PolicyTool gui is
- Point location = getLocationOnScreen();
- //newTD.setBounds(location.x + 50, location.y + 100, 650, 190);
- newTD.setLayout(new GridBagLayout());
- newTD.setResizable(true);
-
- // description label
- JLabel label = (edit ?
- new JLabel(PolicyTool.getMessage(".Edit.Principal.")) :
- new JLabel(PolicyTool.getMessage(".Add.New.Principal.")));
- tw.addNewComponent(newTD, label, PRD_DESC_LABEL,
- 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
- ToolWindow.TOP_BOTTOM_PADDING);
-
- // principal choice
- JComboBox<String> choice = new JComboBox<>();
- choice.addItem(PRIN_TYPE);
- choice.getAccessibleContext().setAccessibleName(PRIN_TYPE);
- for (int i = 0; i < PRIN_ARRAY.size(); i++) {
- Prin next = PRIN_ARRAY.get(i);
- choice.addItem(next.getSimpleName());
- }
-
- if (edit) {
- if (PolicyParser.PrincipalEntry.WILDCARD_CLASS.equals
- (editMe.getPrincipalClass())) {
- choice.setSelectedItem(PRIN_TYPE);
- } else {
- Prin inputPrin = getPrin(editMe.getPrincipalClass(), true);
- if (inputPrin != null) {
- choice.setSelectedItem(inputPrin.getSimpleName());
- }
- }
- }
- // Add listener after selected item is set
- choice.addItemListener(new PrincipalTypeMenuListener(newTD));
-
- tw.addNewComponent(newTD, choice, PRD_PRIN_CHOICE,
- 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
- ToolWindow.LR_PADDING);
-
- // principal textfield
- JTextField tf;
- tf = (edit ?
- new JTextField(editMe.getDisplayClass(), 30) :
- new JTextField(30));
- tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
- tf.getAccessibleContext().setAccessibleName(PRIN_TYPE);
- tw.addNewComponent(newTD, tf, PRD_PRIN_TEXTFIELD,
- 1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH,
- ToolWindow.LR_PADDING);
-
- // name label and textfield
- label = new JLabel(PRIN_NAME);
- tf = (edit ?
- new JTextField(editMe.getDisplayName(), 40) :
- new JTextField(40));
- tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
- tf.getAccessibleContext().setAccessibleName(PRIN_NAME);
-
- tw.addNewComponent(newTD, label, PRD_NAME_LABEL,
- 0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
- ToolWindow.LR_PADDING);
- tw.addNewComponent(newTD, tf, PRD_NAME_TEXTFIELD,
- 1, 2, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH,
- ToolWindow.LR_PADDING);
-
- // OK button
- JButton okButton = new JButton(PolicyTool.getMessage("OK"));
- okButton.addActionListener(
- new NewPolicyPrinOKButtonListener
- (tool, tw, this, newTD, edit));
- tw.addNewComponent(newTD, okButton, PRD_OK_BUTTON,
- 0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
- ToolWindow.TOP_BOTTOM_PADDING);
- // cancel button
- JButton cancelButton = new JButton(PolicyTool.getMessage("Cancel"));
- ActionListener cancelListener = new CancelButtonListener(newTD);
- cancelButton.addActionListener(cancelListener);
- tw.addNewComponent(newTD, cancelButton, PRD_CANCEL_BUTTON,
- 1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
- ToolWindow.TOP_BOTTOM_PADDING);
-
- newTD.getRootPane().setDefaultButton(okButton);
- newTD.getRootPane().registerKeyboardAction(cancelListener, escKey, JComponent.WHEN_IN_FOCUSED_WINDOW);
-
- newTD.pack();
- newTD.setLocationRelativeTo(tw);
- newTD.setVisible(true);
- }
-
- /**
- * display a dialog box for the user to input Permission info
- *
- * if editPolicyEntry is false, then we are adding Permissions to
- * a new PolicyEntry, and we only update the GUI listing
- * with the new Permission.
- *
- * if edit is true, then we are editing an existing Permission entry.
- */
- void displayPermissionDialog(boolean editPolicyEntry, boolean edit) {
-
- PolicyParser.PermissionEntry editMe = null;
-
- // get the Permission selected from the Permission List
- TaggedList permList = (TaggedList)getComponent(PE_PERM_LIST);
- int permIndex = permList.getSelectedIndex();
-
- if (edit) {
- editMe = (PolicyParser.PermissionEntry)permList.getObject(permIndex);
- }
-
- ToolDialog newTD = new ToolDialog
- (PolicyTool.getMessage("Permissions"), tool, tw, true);
- newTD.addWindowListener(new ChildWindowListener(newTD));
-
- // find where the PolicyTool gui is
- Point location = getLocationOnScreen();
- //newTD.setBounds(location.x + 50, location.y + 100, 700, 250);
- newTD.setLayout(new GridBagLayout());
- newTD.setResizable(true);
-
- // description label
- JLabel label = (edit ?
- new JLabel(PolicyTool.getMessage(".Edit.Permission.")) :
- new JLabel(PolicyTool.getMessage(".Add.New.Permission.")));
- tw.addNewComponent(newTD, label, PD_DESC_LABEL,
- 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
- ToolWindow.TOP_BOTTOM_PADDING);
-
- // permission choice (added in alphabetical order)
- JComboBox<String> choice = new JComboBox<>();
- choice.addItem(PERM);
- choice.getAccessibleContext().setAccessibleName(PERM);
- for (int i = 0; i < PERM_ARRAY.size(); i++) {
- Perm next = PERM_ARRAY.get(i);
- choice.addItem(next.getSimpleName());
- }
- tw.addNewComponent(newTD, choice, PD_PERM_CHOICE,
- 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
- ToolWindow.LR_BOTTOM_PADDING);
-
- // permission textfield
- JTextField tf;
- tf = (edit ? new JTextField(editMe.permission, 30) : new JTextField(30));
- tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
- tf.getAccessibleContext().setAccessibleName(PERM);
- if (edit) {
- Perm inputPerm = getPerm(editMe.permission, true);
- if (inputPerm != null) {
- choice.setSelectedItem(inputPerm.getSimpleName());
- }
- }
- tw.addNewComponent(newTD, tf, PD_PERM_TEXTFIELD,
- 1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH,
- ToolWindow.LR_BOTTOM_PADDING);
- choice.addItemListener(new PermissionMenuListener(newTD));
-
- // name label and textfield
- choice = new JComboBox<>();
- choice.addItem(PERM_NAME);
- choice.getAccessibleContext().setAccessibleName(PERM_NAME);
- tf = (edit ? new JTextField(editMe.name, 40) : new JTextField(40));
- tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
- tf.getAccessibleContext().setAccessibleName(PERM_NAME);
- if (edit) {
- setPermissionNames(getPerm(editMe.permission, true), choice, tf);
- }
- tw.addNewComponent(newTD, choice, PD_NAME_CHOICE,
- 0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
- ToolWindow.LR_BOTTOM_PADDING);
- tw.addNewComponent(newTD, tf, PD_NAME_TEXTFIELD,
- 1, 2, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH,
- ToolWindow.LR_BOTTOM_PADDING);
- choice.addItemListener(new PermissionNameMenuListener(newTD));
-
- // actions label and textfield
- choice = new JComboBox<>();
- choice.addItem(PERM_ACTIONS);
- choice.getAccessibleContext().setAccessibleName(PERM_ACTIONS);
- tf = (edit ? new JTextField(editMe.action, 40) : new JTextField(40));
- tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
- tf.getAccessibleContext().setAccessibleName(PERM_ACTIONS);
- if (edit) {
- setPermissionActions(getPerm(editMe.permission, true), choice, tf);
- }
- tw.addNewComponent(newTD, choice, PD_ACTIONS_CHOICE,
- 0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
- ToolWindow.LR_BOTTOM_PADDING);
- tw.addNewComponent(newTD, tf, PD_ACTIONS_TEXTFIELD,
- 1, 3, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH,
- ToolWindow.LR_BOTTOM_PADDING);
- choice.addItemListener(new PermissionActionsMenuListener(newTD));
-
- // signedby label and textfield
- label = new JLabel(PolicyTool.getMessage("Signed.By."));
- tw.addNewComponent(newTD, label, PD_SIGNEDBY_LABEL,
- 0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
- ToolWindow.LR_BOTTOM_PADDING);
- tf = (edit ? new JTextField(editMe.signedBy, 40) : new JTextField(40));
- tf.setPreferredSize(new Dimension(tf.getPreferredSize().width, TEXTFIELD_HEIGHT));
- tf.getAccessibleContext().setAccessibleName(
- PolicyTool.getMessage("Signed.By."));
- tw.addNewComponent(newTD, tf, PD_SIGNEDBY_TEXTFIELD,
- 1, 4, 1, 1, 1.0, 0.0, GridBagConstraints.BOTH,
- ToolWindow.LR_BOTTOM_PADDING);
-
- // OK button
- JButton okButton = new JButton(PolicyTool.getMessage("OK"));
- okButton.addActionListener(
- new NewPolicyPermOKButtonListener
- (tool, tw, this, newTD, edit));
- tw.addNewComponent(newTD, okButton, PD_OK_BUTTON,
- 0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
- ToolWindow.TOP_BOTTOM_PADDING);
-
- // cancel button
- JButton cancelButton = new JButton(PolicyTool.getMessage("Cancel"));
- ActionListener cancelListener = new CancelButtonListener(newTD);
- cancelButton.addActionListener(cancelListener);
- tw.addNewComponent(newTD, cancelButton, PD_CANCEL_BUTTON,
- 1, 5, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
- ToolWindow.TOP_BOTTOM_PADDING);
-
- newTD.getRootPane().setDefaultButton(okButton);
- newTD.getRootPane().registerKeyboardAction(cancelListener, escKey, JComponent.WHEN_IN_FOCUSED_WINDOW);
-
- newTD.pack();
- newTD.setLocationRelativeTo(tw);
- newTD.setVisible(true);
- }
-
- /**
- * construct a Principal object from the Principal Info Dialog Box
- */
- PolicyParser.PrincipalEntry getPrinFromDialog() throws Exception {
-
- JTextField tf = (JTextField)getComponent(PRD_PRIN_TEXTFIELD);
- String pclass = new String(tf.getText().trim());
- tf = (JTextField)getComponent(PRD_NAME_TEXTFIELD);
- String pname = new String(tf.getText().trim());
- if (pclass.equals("*")) {
- pclass = PolicyParser.PrincipalEntry.WILDCARD_CLASS;
- }
- if (pname.equals("*")) {
- pname = PolicyParser.PrincipalEntry.WILDCARD_NAME;
- }
-
- PolicyParser.PrincipalEntry pppe = null;
-
- if ((pclass.equals(PolicyParser.PrincipalEntry.WILDCARD_CLASS)) &&
- (!pname.equals(PolicyParser.PrincipalEntry.WILDCARD_NAME))) {
- throw new Exception
- (PolicyTool.getMessage("Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name"));
- } else if (pname.equals("")) {
- throw new Exception
- (PolicyTool.getMessage("Cannot.Specify.Principal.without.a.Name"));
- } else if (pclass.equals("")) {
- // make this consistent with what PolicyParser does
- // when it sees an empty principal class
- pclass = PolicyParser.PrincipalEntry.REPLACE_NAME;
- tool.warnings.addElement(
- "Warning: Principal name '" + pname +
- "' specified without a Principal class.\n" +
- "\t'" + pname + "' will be interpreted " +
- "as a key store alias.\n" +
- "\tThe final principal class will be " +
- X500Principal.class.getName() + ".\n" +
- "\tThe final principal name will be " +
- "determined by the following:\n" +
- "\n" +
- "\tIf the key store entry identified by '"
- + pname + "'\n" +
- "\tis a key entry, then the principal name will be\n" +
- "\tthe subject distinguished name from the first\n" +
- "\tcertificate in the entry's certificate chain.\n" +
- "\n" +
- "\tIf the key store entry identified by '" +
- pname + "'\n" +
- "\tis a trusted certificate entry, then the\n" +
- "\tprincipal name will be the subject distinguished\n" +
- "\tname from the trusted public key certificate.");
- tw.displayStatusDialog(this,
- "'" + pname + "' will be interpreted as a key " +
- "store alias. View Warning Log for details.");
- }
- return new PolicyParser.PrincipalEntry(pclass, pname);
- }
-
-
- /**
- * construct a Permission object from the Permission Info Dialog Box
- */
- PolicyParser.PermissionEntry getPermFromDialog() {
-
- JTextField tf = (JTextField)getComponent(PD_PERM_TEXTFIELD);
- String permission = new String(tf.getText().trim());
- tf = (JTextField)getComponent(PD_NAME_TEXTFIELD);
- String name = null;
- if (tf.getText().trim().equals("") == false)
- name = new String(tf.getText().trim());
- if (permission.equals("") ||
- (!permission.equals(AllPermission.class.getName()) && name == null)) {
- throw new InvalidParameterException(PolicyTool.getMessage
- ("Permission.and.Target.Name.must.have.a.value"));
- }
-
- // When the permission is FilePermission, we need to check the name
- // to make sure it's not escaped. We believe --
- //
- // String name.lastIndexOf("\\\\")
- // ---------------- ------------------------
- // c:\foo\bar -1, legal
- // c:\\foo\\bar 2, illegal
- // \\server\share 0, legal
- // \\\\server\share 2, illegal
-
- if (permission.equals(FilePermission.class.getName())
- && name.lastIndexOf("\\\\") > 0) {
- char result = tw.displayYesNoDialog(this,
- PolicyTool.getMessage("Warning"),
- PolicyTool.getMessage(
- "Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes"),
- PolicyTool.getMessage("Retain"),
- PolicyTool.getMessage("Edit")
- );
- if (result != 'Y') {
- // an invisible exception
- throw new NoDisplayException();
- }
- }
- // get the Actions
- tf = (JTextField)getComponent(PD_ACTIONS_TEXTFIELD);
- String actions = null;
- if (tf.getText().trim().equals("") == false)
- actions = new String(tf.getText().trim());
-
- // get the Signed By
- tf = (JTextField)getComponent(PD_SIGNEDBY_TEXTFIELD);
- String signedBy = null;
- if (tf.getText().trim().equals("") == false)
- signedBy = new String(tf.getText().trim());
-
- PolicyParser.PermissionEntry pppe = new PolicyParser.PermissionEntry
- (permission, name, actions);
- pppe.signedBy = signedBy;
-
- // see if the signers have public keys
- if (signedBy != null) {
- String signers[] = tool.parseSigners(pppe.signedBy);
- for (int i = 0; i < signers.length; i++) {
- try {
- PublicKey pubKey = tool.getPublicKeyAlias(signers[i]);
- if (pubKey == null) {
- MessageFormat form = new MessageFormat
- (PolicyTool.getMessage
- ("Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured."));
- Object[] source = {signers[i]};
- tool.warnings.addElement(form.format(source));
- tw.displayStatusDialog(this, form.format(source));
- }
- } catch (Exception e) {
- tw.displayErrorDialog(this, e);
- }
- }
- }
- return pppe;
- }
-
- /**
- * confirm that the user REALLY wants to remove the Policy Entry
- */
- void displayConfirmRemovePolicyEntry() {
-
- // find the entry to be removed
- @SuppressWarnings("unchecked")
- JList<String> list = (JList<String>)tw.getComponent(ToolWindow.MW_POLICY_LIST);
- int index = list.getSelectedIndex();
- PolicyEntry entries[] = tool.getEntry();
-
- // find where the PolicyTool gui is
- Point location = tw.getLocationOnScreen();
- //setBounds(location.x + 25, location.y + 100, 600, 400);
- setLayout(new GridBagLayout());
-
- // ask the user do they really want to do this?
- JLabel label = new JLabel
- (PolicyTool.getMessage("Remove.this.Policy.Entry."));
- tw.addNewComponent(this, label, CRPE_LABEL1,
- 0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.BOTH,
- ToolWindow.BOTTOM_PADDING);
-
- // display the policy entry
- label = new JLabel(entries[index].codebaseToString());
- tw.addNewComponent(this, label, CRPE_LABEL2,
- 0, 1, 2, 1, 0.0, 0.0, GridBagConstraints.BOTH);
- label = new JLabel(entries[index].principalsToString().trim());
- tw.addNewComponent(this, label, CRPE_LABEL2+1,
- 0, 2, 2, 1, 0.0, 0.0, GridBagConstraints.BOTH);
- Vector<PolicyParser.PermissionEntry> perms =
- entries[index].getGrantEntry().permissionEntries;
- for (int i = 0; i < perms.size(); i++) {
- PolicyParser.PermissionEntry nextPerm = perms.elementAt(i);
- String permString = ToolDialog.PermissionEntryToUserFriendlyString(nextPerm);
- label = new JLabel(" " + permString);
- if (i == (perms.size()-1)) {
- tw.addNewComponent(this, label, CRPE_LABEL2 + 2 + i,
- 1, 3 + i, 1, 1, 0.0, 0.0,
- GridBagConstraints.BOTH,
- ToolWindow.BOTTOM_PADDING);
- } else {
- tw.addNewComponent(this, label, CRPE_LABEL2 + 2 + i,
- 1, 3 + i, 1, 1, 0.0, 0.0,
- GridBagConstraints.BOTH);
- }
- }
-
-
- // add OK/CANCEL buttons in a new panel
- JPanel panel = new JPanel();
- panel.setLayout(new GridBagLayout());
-
- // OK button
- JButton okButton = new JButton(PolicyTool.getMessage("OK"));
- okButton.addActionListener
- (new ConfirmRemovePolicyEntryOKButtonListener(tool, tw, this));
- tw.addNewComponent(panel, okButton, CRPE_PANEL_OK,
- 0, 0, 1, 1, 0.0, 0.0,
- GridBagConstraints.VERTICAL, ToolWindow.LR_PADDING);
-
- // cancel button
- JButton cancelButton = new JButton(PolicyTool.getMessage("Cancel"));
- ActionListener cancelListener = new CancelButtonListener(this);
- cancelButton.addActionListener(cancelListener);
- tw.addNewComponent(panel, cancelButton, CRPE_PANEL_CANCEL,
- 1, 0, 1, 1, 0.0, 0.0,
- GridBagConstraints.VERTICAL, ToolWindow.LR_PADDING);
-
- tw.addNewComponent(this, panel, CRPE_LABEL2 + 2 + perms.size(),
- 0, 3 + perms.size(), 2, 1, 0.0, 0.0,
- GridBagConstraints.VERTICAL, ToolWindow.TOP_BOTTOM_PADDING);
-
- getRootPane().setDefaultButton(okButton);
- getRootPane().registerKeyboardAction(cancelListener, escKey, JComponent.WHEN_IN_FOCUSED_WINDOW);
-
- pack();
- setLocationRelativeTo(tw);
- setVisible(true);
- }
-
- /**
- * perform SAVE AS
- */
- void displaySaveAsDialog(int nextEvent) {
-
- // pop up a dialog box for the user to enter a filename.
- FileDialog fd = new FileDialog
- (tw, PolicyTool.getMessage("Save.As"), FileDialog.SAVE);
- fd.addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
- e.getWindow().setVisible(false);
- }
- });
- fd.setVisible(true);
-
- // see if the user hit cancel
- if (fd.getFile() == null ||
- fd.getFile().equals(""))
- return;
-
- // get the entered filename
- File saveAsFile = new File(fd.getDirectory(), fd.getFile());
- String filename = saveAsFile.getPath();
- fd.dispose();
-
- try {
- // save the policy entries to a file
- tool.savePolicy(filename);
-
- // display status
- MessageFormat form = new MessageFormat(PolicyTool.getMessage
- ("Policy.successfully.written.to.filename"));
- Object[] source = {filename};
- tw.displayStatusDialog(null, form.format(source));
-
- // display the new policy filename
- JTextField newFilename = (JTextField)tw.getComponent
- (ToolWindow.MW_FILENAME_TEXTFIELD);
- newFilename.setText(filename);
- tw.setVisible(true);
-
- // now continue with the originally requested command
- // (QUIT, NEW, or OPEN)
- userSaveContinue(tool, tw, this, nextEvent);
-
- } catch (FileNotFoundException fnfe) {
- if (filename == null || filename.equals("")) {
- tw.displayErrorDialog(null, new FileNotFoundException
- (PolicyTool.getMessage("null.filename")));
- } else {
- tw.displayErrorDialog(null, fnfe);
- }
- } catch (Exception ee) {
- tw.displayErrorDialog(null, ee);
- }
- }
-
- /**
- * ask user if they want to save changes
- */
- void displayUserSave(int select) {
-
- if (tool.modified == true) {
-
- // find where the PolicyTool gui is
- Point location = tw.getLocationOnScreen();
- //setBounds(location.x + 75, location.y + 100, 400, 150);
- setLayout(new GridBagLayout());
-
- JLabel label = new JLabel
- (PolicyTool.getMessage("Save.changes."));
- tw.addNewComponent(this, label, USC_LABEL,
- 0, 0, 3, 1, 0.0, 0.0, GridBagConstraints.BOTH,
- ToolWindow.L_TOP_BOTTOM_PADDING);
-
- JPanel panel = new JPanel();
- panel.setLayout(new GridBagLayout());
-
- JButton yesButton = new JButton();
- ToolWindow.configureButton(yesButton, "Yes");
- yesButton.addActionListener
- (new UserSaveYesButtonListener(this, tool, tw, select));
- tw.addNewComponent(panel, yesButton, USC_YES_BUTTON,
- 0, 0, 1, 1, 0.0, 0.0,
- GridBagConstraints.VERTICAL,
- ToolWindow.LR_BOTTOM_PADDING);
- JButton noButton = new JButton();
- ToolWindow.configureButton(noButton, "No");
- noButton.addActionListener
- (new UserSaveNoButtonListener(this, tool, tw, select));
- tw.addNewComponent(panel, noButton, USC_NO_BUTTON,
- 1, 0, 1, 1, 0.0, 0.0,
- GridBagConstraints.VERTICAL,
- ToolWindow.LR_BOTTOM_PADDING);
- JButton cancelButton = new JButton();
- ToolWindow.configureButton(cancelButton, "Cancel");
- ActionListener cancelListener = new CancelButtonListener(this);
- cancelButton.addActionListener(cancelListener);
- tw.addNewComponent(panel, cancelButton, USC_CANCEL_BUTTON,
- 2, 0, 1, 1, 0.0, 0.0,
- GridBagConstraints.VERTICAL,
- ToolWindow.LR_BOTTOM_PADDING);
-
- tw.addNewComponent(this, panel, USC_PANEL,
- 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH);
-
- getRootPane().registerKeyboardAction(cancelListener, escKey, JComponent.WHEN_IN_FOCUSED_WINDOW);
-
- pack();
- setLocationRelativeTo(tw);
- setVisible(true);
- } else {
- // just do the original request (QUIT, NEW, or OPEN)
- userSaveContinue(tool, tw, this, select);
- }
- }
-
- /**
- * when the user sees the 'YES', 'NO', 'CANCEL' buttons on the
- * displayUserSave dialog, and the click on one of them,
- * we need to continue the originally requested action
- * (either QUITting, opening NEW policy file, or OPENing an existing
- * policy file. do that now.
- */
- @SuppressWarnings("fallthrough")
- void userSaveContinue(PolicyTool tool, ToolWindow tw,
- ToolDialog us, int select) {
-
- // now either QUIT, open a NEW policy file, or OPEN an existing policy
- switch(select) {
- case ToolDialog.QUIT:
-
- tw.setVisible(false);
- tw.dispose();
- System.exit(0);
-
- case ToolDialog.NEW:
-
- try {
- tool.openPolicy(null);
- } catch (Exception ee) {
- tool.modified = false;
- tw.displayErrorDialog(null, ee);
- }
-
- // display the policy entries via the policy list textarea
- JList<String> list = new JList<>(new DefaultListModel<>());
- list.setVisibleRowCount(15);
- list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- list.addMouseListener(new PolicyListListener(tool, tw));
- tw.replacePolicyList(list);
-
- // display null policy filename and keystore
- JTextField newFilename = (JTextField)tw.getComponent(
- ToolWindow.MW_FILENAME_TEXTFIELD);
- newFilename.setText("");
- tw.setVisible(true);
- break;
-
- case ToolDialog.OPEN:
-
- // pop up a dialog box for the user to enter a filename.
- FileDialog fd = new FileDialog
- (tw, PolicyTool.getMessage("Open"), FileDialog.LOAD);
- fd.addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
- e.getWindow().setVisible(false);
- }
- });
- fd.setVisible(true);
-
- // see if the user hit 'cancel'
- if (fd.getFile() == null ||
- fd.getFile().equals(""))
- return;
-
- // get the entered filename
- String policyFile = new File(fd.getDirectory(), fd.getFile()).getPath();
-
- try {
- // open the policy file
- tool.openPolicy(policyFile);
-
- // display the policy entries via the policy list textarea
- DefaultListModel<String> listModel = new DefaultListModel<>();
- list = new JList<>(listModel);
- list.setVisibleRowCount(15);
- list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- list.addMouseListener(new PolicyListListener(tool, tw));
- PolicyEntry entries[] = tool.getEntry();
- if (entries != null) {
- for (int i = 0; i < entries.length; i++) {
- listModel.addElement(entries[i].headerToString());
- }
- }
- tw.replacePolicyList(list);
- tool.modified = false;
-
- // display the new policy filename
- newFilename = (JTextField)tw.getComponent(
- ToolWindow.MW_FILENAME_TEXTFIELD);
- newFilename.setText(policyFile);
- tw.setVisible(true);
-
- // inform user of warnings
- if (tool.newWarning == true) {
- tw.displayStatusDialog(null, PolicyTool.getMessage
- ("Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information."));
- }
-
- } catch (Exception e) {
- // add blank policy listing
- list = new JList<>(new DefaultListModel<>());
- list.setVisibleRowCount(15);
- list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- list.addMouseListener(new PolicyListListener(tool, tw));
- tw.replacePolicyList(list);
- tool.setPolicyFileName(null);
- tool.modified = false;
-
- // display a null policy filename
- newFilename = (JTextField)tw.getComponent(
- ToolWindow.MW_FILENAME_TEXTFIELD);
- newFilename.setText("");
- tw.setVisible(true);
-
- // display the error
- MessageFormat form = new MessageFormat(PolicyTool.getMessage
- ("Could.not.open.policy.file.policyFile.e.toString."));
- Object[] source = {policyFile, e.toString()};
- tw.displayErrorDialog(null, form.format(source));
- }
- break;
- }
- }
-
- /**
- * Return a Menu list of names for a given permission
- *
- * If inputPerm's TARGETS are null, then this means TARGETS are
- * not allowed to be entered (and the TextField is set to be
- * non-editable).
- *
- * If TARGETS are valid but there are no standard ones
- * (user must enter them by hand) then the TARGETS array may be empty
- * (and of course non-null).
- */
- void setPermissionNames(Perm inputPerm, JComboBox<String> names, JTextField field) {
- names.removeAllItems();
- names.addItem(PERM_NAME);
-
- if (inputPerm == null) {
- // custom permission
- field.setEditable(true);
- } else if (inputPerm.TARGETS == null) {
- // standard permission with no targets
- field.setEditable(false);
- } else {
- // standard permission with standard targets
- field.setEditable(true);
- for (int i = 0; i < inputPerm.TARGETS.length; i++) {
- names.addItem(inputPerm.TARGETS[i]);
- }
- }
- }
-
- /**
- * Return a Menu list of actions for a given permission
- *
- * If inputPerm's ACTIONS are null, then this means ACTIONS are
- * not allowed to be entered (and the TextField is set to be
- * non-editable). This is typically true for BasicPermissions.
- *
- * If ACTIONS are valid but there are no standard ones
- * (user must enter them by hand) then the ACTIONS array may be empty
- * (and of course non-null).
- */
- void setPermissionActions(Perm inputPerm, JComboBox<String> actions, JTextField field) {
- actions.removeAllItems();
- actions.addItem(PERM_ACTIONS);
-
- if (inputPerm == null) {
- // custom permission
- field.setEditable(true);
- } else if (inputPerm.ACTIONS == null) {
- // standard permission with no actions
- field.setEditable(false);
- } else {
- // standard permission with standard actions
- field.setEditable(true);
- for (int i = 0; i < inputPerm.ACTIONS.length; i++) {
- actions.addItem(inputPerm.ACTIONS[i]);
- }
- }
- }
-
- static String PermissionEntryToUserFriendlyString(PolicyParser.PermissionEntry pppe) {
- String result = pppe.permission;
- if (pppe.name != null) {
- result += " " + pppe.name;
- }
- if (pppe.action != null) {
- result += ", \"" + pppe.action + "\"";
- }
- if (pppe.signedBy != null) {
- result += ", signedBy " + pppe.signedBy;
- }
- return result;
- }
-
- static String PrincipalEntryToUserFriendlyString(PolicyParser.PrincipalEntry pppe) {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- pppe.write(pw);
- return sw.toString();
- }
-}
-
-/**
- * Event handler for the PolicyTool window
- */
-@SuppressWarnings({"deprecation",
- "removal"}) // PolicyTool
-class ToolWindowListener implements WindowListener {
-
- private PolicyTool tool;
- private ToolWindow tw;
-
- ToolWindowListener(PolicyTool tool, ToolWindow tw) {
- this.tool = tool;
- this.tw = tw;
- }
-
- public void windowOpened(WindowEvent we) {
- }
-
- public void windowClosing(WindowEvent we) {
- // Closing the window acts the same as choosing Menu->Exit.
-
- // ask user if they want to save changes
- ToolDialog td = new ToolDialog(PolicyTool.getMessage("Save.Changes"), tool, tw, true);
- td.displayUserSave(ToolDialog.QUIT);
-
- // the above method will perform the QUIT as long as the
- // user does not CANCEL the request
- }
-
- public void windowClosed(WindowEvent we) {
- System.exit(0);
- }
-
- public void windowIconified(WindowEvent we) {
- }
-
- public void windowDeiconified(WindowEvent we) {
- }
-
- public void windowActivated(WindowEvent we) {
- }
-
- public void windowDeactivated(WindowEvent we) {
- }
-}
-
-/**
- * Event handler for the Policy List
- */
-@SuppressWarnings({"deprecation",
- "removal"}) // PolicyTool
-class PolicyListListener extends MouseAdapter implements ActionListener {
-
- private PolicyTool tool;
- private ToolWindow tw;
-
- PolicyListListener(PolicyTool tool, ToolWindow tw) {
- this.tool = tool;
- this.tw = tw;
-
- }
-
- public void actionPerformed(ActionEvent e) {
-
- // display the permission list for a policy entry
- ToolDialog td = new ToolDialog
- (PolicyTool.getMessage("Policy.Entry"), tool, tw, true);
- td.displayPolicyEntryDialog(true);
- }
-
- public void mouseClicked(MouseEvent evt) {
- if (evt.getClickCount() == 2) {
- actionPerformed(null);
- }
- }
-}
-
-/**
- * Event handler for the File Menu
- */
-@SuppressWarnings({"deprecation",
- "removal"}) // PolicyTool
-class FileMenuListener implements ActionListener {
-
- private PolicyTool tool;
- private ToolWindow tw;
-
- FileMenuListener(PolicyTool tool, ToolWindow tw) {
- this.tool = tool;
- this.tw = tw;
- }
-
- public void actionPerformed(ActionEvent e) {
-
- if (PolicyTool.collator.compare(e.getActionCommand(),
- ToolWindow.QUIT) == 0) {
-
- // ask user if they want to save changes
- ToolDialog td = new ToolDialog
- (PolicyTool.getMessage("Save.Changes"), tool, tw, true);
- td.displayUserSave(ToolDialog.QUIT);
-
- // the above method will perform the QUIT as long as the
- // user does not CANCEL the request
-
- } else if (PolicyTool.collator.compare(e.getActionCommand(),
- ToolWindow.NEW_POLICY_FILE) == 0) {
-
- // ask user if they want to save changes
- ToolDialog td = new ToolDialog
- (PolicyTool.getMessage("Save.Changes"), tool, tw, true);
- td.displayUserSave(ToolDialog.NEW);
-
- // the above method will perform the NEW as long as the
- // user does not CANCEL the request
-
- } else if (PolicyTool.collator.compare(e.getActionCommand(),
- ToolWindow.OPEN_POLICY_FILE) == 0) {
-
- // ask user if they want to save changes
- ToolDialog td = new ToolDialog
- (PolicyTool.getMessage("Save.Changes"), tool, tw, true);
- td.displayUserSave(ToolDialog.OPEN);
-
- // the above method will perform the OPEN as long as the
- // user does not CANCEL the request
-
- } else if (PolicyTool.collator.compare(e.getActionCommand(),
- ToolWindow.SAVE_POLICY_FILE) == 0) {
-
- // get the previously entered filename
- String filename = ((JTextField)tw.getComponent(
- ToolWindow.MW_FILENAME_TEXTFIELD)).getText();
-
- // if there is no filename, do a SAVE_AS
- if (filename == null || filename.length() == 0) {
- // user wants to SAVE AS
- ToolDialog td = new ToolDialog
- (PolicyTool.getMessage("Save.As"), tool, tw, true);
- td.displaySaveAsDialog(ToolDialog.NOACTION);
- } else {
- try {
- // save the policy entries to a file
- tool.savePolicy(filename);
-
- // display status
- MessageFormat form = new MessageFormat
- (PolicyTool.getMessage
- ("Policy.successfully.written.to.filename"));
- Object[] source = {filename};
- tw.displayStatusDialog(null, form.format(source));
- } catch (FileNotFoundException fnfe) {
- if (filename == null || filename.equals("")) {
- tw.displayErrorDialog(null, new FileNotFoundException
- (PolicyTool.getMessage("null.filename")));
- } else {
- tw.displayErrorDialog(null, fnfe);
- }
- } catch (Exception ee) {
- tw.displayErrorDialog(null, ee);
- }
- }
- } else if (PolicyTool.collator.compare(e.getActionCommand(),
- ToolWindow.SAVE_AS_POLICY_FILE) == 0) {
-
- // user wants to SAVE AS
- ToolDialog td = new ToolDialog
- (PolicyTool.getMessage("Save.As"), tool, tw, true);
- td.displaySaveAsDialog(ToolDialog.NOACTION);
-
- } else if (PolicyTool.collator.compare(e.getActionCommand(),
- ToolWindow.VIEW_WARNINGS) == 0) {
- tw.displayWarningLog(null);
- }
- }
-}
-
-/**
- * Event handler for the main window buttons and Edit Menu
- */
-@SuppressWarnings({"deprecation",
- "removal"}) // PolicyTool
-class MainWindowListener implements ActionListener {
-
- private PolicyTool tool;
- private ToolWindow tw;
-
- MainWindowListener(PolicyTool tool, ToolWindow tw) {
- this.tool = tool;
- this.tw = tw;
- }
-
- public void actionPerformed(ActionEvent e) {
-
- if (PolicyTool.collator.compare(e.getActionCommand(),
- ToolWindow.ADD_POLICY_ENTRY) == 0) {
-
- // display a dialog box for the user to enter policy info
- ToolDialog td = new ToolDialog
- (PolicyTool.getMessage("Policy.Entry"), tool, tw, true);
- td.displayPolicyEntryDialog(false);
-
- } else if (PolicyTool.collator.compare(e.getActionCommand(),
- ToolWindow.REMOVE_POLICY_ENTRY) == 0) {
-
- // get the selected entry
- @SuppressWarnings("unchecked")
- JList<String> list = (JList<String>)tw.getComponent(ToolWindow.MW_POLICY_LIST);
- int index = list.getSelectedIndex();
- if (index < 0) {
- tw.displayErrorDialog(null, new Exception
- (PolicyTool.getMessage("No.Policy.Entry.selected")));
- return;
- }
-
- // ask the user if they really want to remove the policy entry
- ToolDialog td = new ToolDialog(PolicyTool.getMessage
- ("Remove.Policy.Entry"), tool, tw, true);
- td.displayConfirmRemovePolicyEntry();
-
- } else if (PolicyTool.collator.compare(e.getActionCommand(),
- ToolWindow.EDIT_POLICY_ENTRY) == 0) {
-
- // get the selected entry
- @SuppressWarnings("unchecked")
- JList<String> list = (JList<String>)tw.getComponent(ToolWindow.MW_POLICY_LIST);
- int index = list.getSelectedIndex();
- if (index < 0) {
- tw.displayErrorDialog(null, new Exception
- (PolicyTool.getMessage("No.Policy.Entry.selected")));
- return;
- }
-
- // display the permission list for a policy entry
- ToolDialog td = new ToolDialog
- (PolicyTool.getMessage("Policy.Entry"), tool, tw, true);
- td.displayPolicyEntryDialog(true);
-
- } else if (PolicyTool.collator.compare(e.getActionCommand(),
- ToolWindow.EDIT_KEYSTORE) == 0) {
-
- // display a dialog box for the user to enter keystore info
- ToolDialog td = new ToolDialog
- (PolicyTool.getMessage("KeyStore"), tool, tw, true);
- td.keyStoreDialog(ToolDialog.EDIT_KEYSTORE);
- }
- }
-}
-
-/**
- * Event handler for AddEntryDoneButton button
- *
- * -- if edit is TRUE, then we are EDITing an existing PolicyEntry
- * and we need to update both the policy and the GUI listing.
- * if edit is FALSE, then we are ADDing a new PolicyEntry,
- * so we only need to update the GUI listing.
- */
-@SuppressWarnings({"deprecation",
- "removal"}) // PolicyTool
-class AddEntryDoneButtonListener implements ActionListener {
-
- private PolicyTool tool;
- private ToolWindow tw;
- private ToolDialog td;
- private boolean edit;
-
- AddEntryDoneButtonListener(PolicyTool tool, ToolWindow tw,
- ToolDialog td, boolean edit) {
- this.tool = tool;
- this.tw = tw;
- this.td = td;
- this.edit = edit;
- }
-
- public void actionPerformed(ActionEvent e) {
-
- try {
- // get a PolicyEntry object from the dialog policy info
- PolicyEntry newEntry = td.getPolicyEntryFromDialog();
- PolicyParser.GrantEntry newGe = newEntry.getGrantEntry();
-
- // see if all the signers have public keys
- if (newGe.signedBy != null) {
- String signers[] = tool.parseSigners(newGe.signedBy);
- for (int i = 0; i < signers.length; i++) {
- PublicKey pubKey = tool.getPublicKeyAlias(signers[i]);
- if (pubKey == null) {
- MessageFormat form = new MessageFormat
- (PolicyTool.getMessage
- ("Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured."));
- Object[] source = {signers[i]};
- tool.warnings.addElement(form.format(source));
- tw.displayStatusDialog(td, form.format(source));
- }
- }
- }
-
- // add the entry
- @SuppressWarnings("unchecked")
- JList<String> policyList = (JList<String>)tw.getComponent(ToolWindow.MW_POLICY_LIST);
- if (edit) {
- int listIndex = policyList.getSelectedIndex();
- tool.addEntry(newEntry, listIndex);
- String newCodeBaseStr = newEntry.headerToString();
- if (PolicyTool.collator.compare
- (newCodeBaseStr, policyList.getModel().getElementAt(listIndex)) != 0)
- tool.modified = true;
- ((DefaultListModel<String>)policyList.getModel()).set(listIndex, newCodeBaseStr);
- } else {
- tool.addEntry(newEntry, -1);
- ((DefaultListModel<String>)policyList.getModel()).addElement(newEntry.headerToString());
- tool.modified = true;
- }
- td.setVisible(false);
- td.dispose();
-
- } catch (Exception eee) {
- tw.displayErrorDialog(td, eee);
- }
- }
-}
-
-/**
- * Event handler for ChangeKeyStoreOKButton button
- */
-@SuppressWarnings({"deprecation",
- "removal"}) // PolicyTool
-class ChangeKeyStoreOKButtonListener implements ActionListener {
-
- private PolicyTool tool;
- private ToolWindow tw;
- private ToolDialog td;
-
- ChangeKeyStoreOKButtonListener(PolicyTool tool, ToolWindow tw,
- ToolDialog td) {
- this.tool = tool;
- this.tw = tw;
- this.td = td;
- }
-
- public void actionPerformed(ActionEvent e) {
-
- String URLString = ((JTextField)td.getComponent(
- ToolDialog.KSD_NAME_TEXTFIELD)).getText().trim();
- String type = ((JTextField)td.getComponent(
- ToolDialog.KSD_TYPE_TEXTFIELD)).getText().trim();
- String provider = ((JTextField)td.getComponent(
- ToolDialog.KSD_PROVIDER_TEXTFIELD)).getText().trim();
- String pwdURL = ((JTextField)td.getComponent(
- ToolDialog.KSD_PWD_URL_TEXTFIELD)).getText().trim();
-
- try {
- tool.openKeyStore
- ((URLString.length() == 0 ? null : URLString),
- (type.length() == 0 ? null : type),
- (provider.length() == 0 ? null : provider),
- (pwdURL.length() == 0 ? null : pwdURL));
- tool.modified = true;
- } catch (Exception ex) {
- MessageFormat form = new MessageFormat(PolicyTool.getMessage
- ("Unable.to.open.KeyStore.ex.toString."));
- Object[] source = {ex.toString()};
- tw.displayErrorDialog(td, form.format(source));
- return;
- }
-
- td.dispose();
- }
-}
-
-/**
- * Event handler for AddPrinButton button
- */
-@SuppressWarnings({"deprecation",
- "removal"}) // PolicyTool
-class AddPrinButtonListener implements ActionListener {
-
- private PolicyTool tool;
- private ToolWindow tw;
- private ToolDialog td;
- private boolean editPolicyEntry;
-
- AddPrinButtonListener(PolicyTool tool, ToolWindow tw,
- ToolDialog td, boolean editPolicyEntry) {
- this.tool = tool;
- this.tw = tw;
- this.td = td;
- this.editPolicyEntry = editPolicyEntry;
- }
-
- public void actionPerformed(ActionEvent e) {
-
- // display a dialog box for the user to enter principal info
- td.displayPrincipalDialog(editPolicyEntry, false);
- }
-}
-
-/**
- * Event handler for AddPermButton button
- */
-@SuppressWarnings({"deprecation",
- "removal"}) // PolicyTool
-class AddPermButtonListener implements ActionListener {
-
- private PolicyTool tool;
- private ToolWindow tw;
- private ToolDialog td;
- private boolean editPolicyEntry;
-
- AddPermButtonListener(PolicyTool tool, ToolWindow tw,
- ToolDialog td, boolean editPolicyEntry) {
- this.tool = tool;
- this.tw = tw;
- this.td = td;
- this.editPolicyEntry = editPolicyEntry;
- }
-
- public void actionPerformed(ActionEvent e) {
-
- // display a dialog box for the user to enter permission info
- td.displayPermissionDialog(editPolicyEntry, false);
- }
-}
-
-/**
- * Event handler for AddPrinOKButton button
- */
-@SuppressWarnings({"deprecation",
- "removal"}) // PolicyTool
-class NewPolicyPrinOKButtonListener implements ActionListener {
-
- private PolicyTool tool;
- private ToolWindow tw;
- private ToolDialog listDialog;
- private ToolDialog infoDialog;
- private boolean edit;
-
- NewPolicyPrinOKButtonListener(PolicyTool tool,
- ToolWindow tw,
- ToolDialog listDialog,
- ToolDialog infoDialog,
- boolean edit) {
- this.tool = tool;
- this.tw = tw;
- this.listDialog = listDialog;
- this.infoDialog = infoDialog;
- this.edit = edit;
- }
-
- public void actionPerformed(ActionEvent e) {
-
- try {
- // read in the new principal info from Dialog Box
- PolicyParser.PrincipalEntry pppe =
- infoDialog.getPrinFromDialog();
- if (pppe != null) {
- try {
- tool.verifyPrincipal(pppe.getPrincipalClass(),
- pppe.getPrincipalName());
- } catch (ClassNotFoundException cnfe) {
- MessageFormat form = new MessageFormat
- (PolicyTool.getMessage
- ("Warning.Class.not.found.class"));
- Object[] source = {pppe.getPrincipalClass()};
- tool.warnings.addElement(form.format(source));
- tw.displayStatusDialog(infoDialog, form.format(source));
- }
-
- // add the principal to the GUI principal list
- TaggedList prinList =
- (TaggedList)listDialog.getComponent(ToolDialog.PE_PRIN_LIST);
-
- String prinString = ToolDialog.PrincipalEntryToUserFriendlyString(pppe);
- if (edit) {
- // if editing, replace the original principal
- int index = prinList.getSelectedIndex();
- prinList.replaceTaggedItem(prinString, pppe, index);
- } else {
- // if adding, just add it to the end
- prinList.addTaggedItem(prinString, pppe);
- }
- }
- infoDialog.dispose();
- } catch (Exception ee) {
- tw.displayErrorDialog(infoDialog, ee);
- }
- }
-}
-
-/**
- * Event handler for AddPermOKButton button
- */
-@SuppressWarnings({"deprecation",
- "removal"}) // PolicyTool
-class NewPolicyPermOKButtonListener implements ActionListener {
-
- private PolicyTool tool;
- private ToolWindow tw;
- private ToolDialog listDialog;
- private ToolDialog infoDialog;
- private boolean edit;
-
- NewPolicyPermOKButtonListener(PolicyTool tool,
- ToolWindow tw,
- ToolDialog listDialog,
- ToolDialog infoDialog,
- boolean edit) {
- this.tool = tool;
- this.tw = tw;
- this.listDialog = listDialog;
- this.infoDialog = infoDialog;
- this.edit = edit;
- }
-
- public void actionPerformed(ActionEvent e) {
-
- try {
- // read in the new permission info from Dialog Box
- PolicyParser.PermissionEntry pppe =
- infoDialog.getPermFromDialog();
-
- try {
- tool.verifyPermission(pppe.permission, pppe.name, pppe.action);
- } catch (ClassNotFoundException cnfe) {
- MessageFormat form = new MessageFormat(PolicyTool.getMessage
- ("Warning.Class.not.found.class"));
- Object[] source = {pppe.permission};
- tool.warnings.addElement(form.format(source));
- tw.displayStatusDialog(infoDialog, form.format(source));
- }
-
- // add the permission to the GUI permission list
- TaggedList permList =
- (TaggedList)listDialog.getComponent(ToolDialog.PE_PERM_LIST);
-
- String permString = ToolDialog.PermissionEntryToUserFriendlyString(pppe);
- if (edit) {
- // if editing, replace the original permission
- int which = permList.getSelectedIndex();
- permList.replaceTaggedItem(permString, pppe, which);
- } else {
- // if adding, just add it to the end
- permList.addTaggedItem(permString, pppe);
- }
- infoDialog.dispose();
-
- } catch (InvocationTargetException ite) {
- tw.displayErrorDialog(infoDialog, ite.getTargetException());
- } catch (Exception ee) {
- tw.displayErrorDialog(infoDialog, ee);
- }
- }
-}
-
-/**
- * Event handler for RemovePrinButton button
- */
-@SuppressWarnings({"deprecation",
- "removal"}) // PolicyTool
-class RemovePrinButtonListener implements ActionListener {
-
- private PolicyTool tool;
- private ToolWindow tw;
- private ToolDialog td;
- private boolean edit;
-
- RemovePrinButtonListener(PolicyTool tool, ToolWindow tw,
- ToolDialog td, boolean edit) {
- this.tool = tool;
- this.tw = tw;
- this.td = td;
- this.edit = edit;
- }
-
- public void actionPerformed(ActionEvent e) {
-
- // get the Principal selected from the Principal List
- TaggedList prinList = (TaggedList)td.getComponent(
- ToolDialog.PE_PRIN_LIST);
- int prinIndex = prinList.getSelectedIndex();
-
- if (prinIndex < 0) {
- tw.displayErrorDialog(td, new Exception
- (PolicyTool.getMessage("No.principal.selected")));
- return;
- }
- // remove the principal from the display
- prinList.removeTaggedItem(prinIndex);
- }
-}
-
-/**
- * Event handler for RemovePermButton button
- */
-@SuppressWarnings({"deprecation",
- "removal"}) // PolicyTool
-class RemovePermButtonListener implements ActionListener {
-
- private PolicyTool tool;
- private ToolWindow tw;
- private ToolDialog td;
- private boolean edit;
-
- RemovePermButtonListener(PolicyTool tool, ToolWindow tw,
- ToolDialog td, boolean edit) {
- this.tool = tool;
- this.tw = tw;
- this.td = td;
- this.edit = edit;
- }
-
- public void actionPerformed(ActionEvent e) {
-
- // get the Permission selected from the Permission List
- TaggedList permList = (TaggedList)td.getComponent(
- ToolDialog.PE_PERM_LIST);
- int permIndex = permList.getSelectedIndex();
-
- if (permIndex < 0) {
- tw.displayErrorDialog(td, new Exception
- (PolicyTool.getMessage("No.permission.selected")));
- return;
- }
- // remove the permission from the display
- permList.removeTaggedItem(permIndex);
-
- }
-}
-
-/**
- * Event handler for Edit Principal button
- *
- * We need the editPolicyEntry boolean to tell us if the user is
- * adding a new PolicyEntry at this time, or editing an existing entry.
- * If the user is adding a new PolicyEntry, we ONLY update the
- * GUI listing. If the user is editing an existing PolicyEntry, we
- * update both the GUI listing and the actual PolicyEntry.
- */
-@SuppressWarnings({"deprecation",
- "removal"}) // PolicyTool
-class EditPrinButtonListener extends MouseAdapter implements ActionListener {
-
- private PolicyTool tool;
- private ToolWindow tw;
- private ToolDialog td;
- private boolean editPolicyEntry;
-
- EditPrinButtonListener(PolicyTool tool, ToolWindow tw,
- ToolDialog td, boolean editPolicyEntry) {
- this.tool = tool;
- this.tw = tw;
- this.td = td;
- this.editPolicyEntry = editPolicyEntry;
- }
-
- public void actionPerformed(ActionEvent e) {
-
- // get the Principal selected from the Principal List
- TaggedList list = (TaggedList)td.getComponent(
- ToolDialog.PE_PRIN_LIST);
- int prinIndex = list.getSelectedIndex();
-
- if (prinIndex < 0) {
- tw.displayErrorDialog(td, new Exception
- (PolicyTool.getMessage("No.principal.selected")));
- return;
- }
- td.displayPrincipalDialog(editPolicyEntry, true);
- }
-
- public void mouseClicked(MouseEvent evt) {
- if (evt.getClickCount() == 2) {
- actionPerformed(null);
- }
- }
-}
-
-/**
- * Event handler for Edit Permission button
- *
- * We need the editPolicyEntry boolean to tell us if the user is
- * adding a new PolicyEntry at this time, or editing an existing entry.
- * If the user is adding a new PolicyEntry, we ONLY update the
- * GUI listing. If the user is editing an existing PolicyEntry, we
- * update both the GUI listing and the actual PolicyEntry.
- */
-@SuppressWarnings({"deprecation",
- "removal"}) // PolicyTool
-class EditPermButtonListener extends MouseAdapter implements ActionListener {
-
- private PolicyTool tool;
- private ToolWindow tw;
- private ToolDialog td;
- private boolean editPolicyEntry;
-
- EditPermButtonListener(PolicyTool tool, ToolWindow tw,
- ToolDialog td, boolean editPolicyEntry) {
- this.tool = tool;
- this.tw = tw;
- this.td = td;
- this.editPolicyEntry = editPolicyEntry;
- }
-
- public void actionPerformed(ActionEvent e) {
-
- // get the Permission selected from the Permission List
- @SuppressWarnings("unchecked")
- JList<String> list = (JList<String>)td.getComponent(ToolDialog.PE_PERM_LIST);
- int permIndex = list.getSelectedIndex();
-
- if (permIndex < 0) {
- tw.displayErrorDialog(td, new Exception
- (PolicyTool.getMessage("No.permission.selected")));
- return;
- }
- td.displayPermissionDialog(editPolicyEntry, true);
- }
-
- public void mouseClicked(MouseEvent evt) {
- if (evt.getClickCount() == 2) {
- actionPerformed(null);
- }
- }
-}
-
-/**
- * Event handler for Principal Popup Menu
- */
-@SuppressWarnings({"deprecation",
- "removal"}) // PolicyTool
-class PrincipalTypeMenuListener implements ItemListener {
-
- private ToolDialog td;
-
- PrincipalTypeMenuListener(ToolDialog td) {
- this.td = td;
- }
-
- public void itemStateChanged(ItemEvent e) {
- if (e.getStateChange() == ItemEvent.DESELECTED) {
- // We're only interested in SELECTED events
- return;
- }
-
- @SuppressWarnings("unchecked")
- JComboBox<String> prin = (JComboBox<String>)td.getComponent(ToolDialog.PRD_PRIN_CHOICE);
- JTextField prinField = (JTextField)td.getComponent(
- ToolDialog.PRD_PRIN_TEXTFIELD);
- JTextField nameField = (JTextField)td.getComponent(
- ToolDialog.PRD_NAME_TEXTFIELD);
-
- prin.getAccessibleContext().setAccessibleName(
- PolicyTool.splitToWords((String)e.getItem()));
- if (((String)e.getItem()).equals(ToolDialog.PRIN_TYPE)) {
- // ignore if they choose "Principal Type:" item
- if (prinField.getText() != null &&
- prinField.getText().length() > 0) {
- Prin inputPrin = ToolDialog.getPrin(prinField.getText(), true);
- prin.setSelectedItem(inputPrin.getSimpleName());
- }
- return;
- }
-
- // if you change the principal, clear the name
- if (prinField.getText().indexOf((String)e.getItem()) == -1) {
- nameField.setText("");
- }
-
- // set the text in the textfield and also modify the
- // pull-down choice menus to reflect the correct possible
- // set of names and actions
- Prin inputPrin = ToolDialog.getPrin((String)e.getItem(), false);
- if (inputPrin != null) {
- prinField.setText(inputPrin.getName());
- }
- }
-}
-
-/**
- * Event handler for Permission Popup Menu
- */
-@SuppressWarnings({"deprecation",
- "removal"}) // PolicyTool
-class PermissionMenuListener implements ItemListener {
-
- private ToolDialog td;
-
- PermissionMenuListener(ToolDialog td) {
- this.td = td;
- }
-
- public void itemStateChanged(ItemEvent e) {
- if (e.getStateChange() == ItemEvent.DESELECTED) {
- // We're only interested in SELECTED events
- return;
- }
-
- @SuppressWarnings("unchecked")
- JComboBox<String> perms = (JComboBox<String>)td.getComponent(
- ToolDialog.PD_PERM_CHOICE);
- @SuppressWarnings("unchecked")
- JComboBox<String> names = (JComboBox<String>)td.getComponent(
- ToolDialog.PD_NAME_CHOICE);
- @SuppressWarnings("unchecked")
- JComboBox<String> actions = (JComboBox<String>)td.getComponent(
- ToolDialog.PD_ACTIONS_CHOICE);
- JTextField nameField = (JTextField)td.getComponent(
- ToolDialog.PD_NAME_TEXTFIELD);
- JTextField actionsField = (JTextField)td.getComponent(
- ToolDialog.PD_ACTIONS_TEXTFIELD);
- JTextField permField = (JTextField)td.getComponent(
- ToolDialog.PD_PERM_TEXTFIELD);
- JTextField signedbyField = (JTextField)td.getComponent(
- ToolDialog.PD_SIGNEDBY_TEXTFIELD);
-
- perms.getAccessibleContext().setAccessibleName(
- PolicyTool.splitToWords((String)e.getItem()));
-
- // ignore if they choose the 'Permission:' item
- if (PolicyTool.collator.compare((String)e.getItem(),
- ToolDialog.PERM) == 0) {
- if (permField.getText() != null &&
- permField.getText().length() > 0) {
-
- Perm inputPerm = ToolDialog.getPerm(permField.getText(), true);
- if (inputPerm != null) {
- perms.setSelectedItem(inputPerm.getSimpleName());
- }
- }
- return;
- }
-
- // if you change the permission, clear the name, actions, and signedBy
- if (permField.getText().indexOf((String)e.getItem()) == -1) {
- nameField.setText("");
- actionsField.setText("");
- signedbyField.setText("");
- }
-
- // set the text in the textfield and also modify the
- // pull-down choice menus to reflect the correct possible
- // set of names and actions
-
- Perm inputPerm = ToolDialog.getPerm((String)e.getItem(), false);
- if (inputPerm == null) {
- permField.setText("");
- } else {
- permField.setText(inputPerm.getName());
- }
- td.setPermissionNames(inputPerm, names, nameField);
- td.setPermissionActions(inputPerm, actions, actionsField);
- }
-}
-
-/**
- * Event handler for Permission Name Popup Menu
- */
-@SuppressWarnings({"deprecation",
- "removal"}) // PolicyTool
-class PermissionNameMenuListener implements ItemListener {
-
- private ToolDialog td;
-
- PermissionNameMenuListener(ToolDialog td) {
- this.td = td;
- }
-
- public void itemStateChanged(ItemEvent e) {
- if (e.getStateChange() == ItemEvent.DESELECTED) {
- // We're only interested in SELECTED events
- return;
- }
-
- @SuppressWarnings("unchecked")
- JComboBox<String> names = (JComboBox<String>)td.getComponent(ToolDialog.PD_NAME_CHOICE);
- names.getAccessibleContext().setAccessibleName(
- PolicyTool.splitToWords((String)e.getItem()));
-
- if (((String)e.getItem()).indexOf(ToolDialog.PERM_NAME) != -1)
- return;
-
- JTextField tf = (JTextField)td.getComponent(ToolDialog.PD_NAME_TEXTFIELD);
- tf.setText((String)e.getItem());
- }
-}
-
-/**
- * Event handler for Permission Actions Popup Menu
- */
-class PermissionActionsMenuListener implements ItemListener {
-
- private ToolDialog td;
-
- PermissionActionsMenuListener(ToolDialog td) {
- this.td = td;
- }
-
- public void itemStateChanged(ItemEvent e) {
- if (e.getStateChange() == ItemEvent.DESELECTED) {
- // We're only interested in SELECTED events
- return;
- }
-
- @SuppressWarnings("unchecked")
- JComboBox<String> actions = (JComboBox<String>)td.getComponent(
- ToolDialog.PD_ACTIONS_CHOICE);
- actions.getAccessibleContext().setAccessibleName((String)e.getItem());
-
- if (((String)e.getItem()).indexOf(ToolDialog.PERM_ACTIONS) != -1)
- return;
-
- JTextField tf = (JTextField)td.getComponent(
- ToolDialog.PD_ACTIONS_TEXTFIELD);
- if (tf.getText() == null || tf.getText().equals("")) {
- tf.setText((String)e.getItem());
- } else {
- if (tf.getText().indexOf((String)e.getItem()) == -1)
- tf.setText(tf.getText() + ", " + (String)e.getItem());
- }
- }
-}
-
-/**
- * Event handler for all the children dialogs/windows
- */
-class ChildWindowListener implements WindowListener {
-
- private ToolDialog td;
-
- ChildWindowListener(ToolDialog td) {
- this.td = td;
- }
-
- public void windowOpened(WindowEvent we) {
- }
-
- public void windowClosing(WindowEvent we) {
- // same as pressing the "cancel" button
- td.setVisible(false);
- td.dispose();
- }
-
- public void windowClosed(WindowEvent we) {
- }
-
- public void windowIconified(WindowEvent we) {
- }
-
- public void windowDeiconified(WindowEvent we) {
- }
-
- public void windowActivated(WindowEvent we) {
- }
-
- public void windowDeactivated(WindowEvent we) {
- }
-}
-
-/**
- * Event handler for CancelButton button
- */
-class CancelButtonListener implements ActionListener {
-
- private ToolDialog td;
-
- CancelButtonListener(ToolDialog td) {
- this.td = td;
- }
-
- public void actionPerformed(ActionEvent e) {
- td.setVisible(false);
- td.dispose();
- }
-}
-
-/**
- * Event handler for ErrorOKButton button
- */
-class ErrorOKButtonListener implements ActionListener {
-
- private ToolDialog ed;
-
- ErrorOKButtonListener(ToolDialog ed) {
- this.ed = ed;
- }
-
- public void actionPerformed(ActionEvent e) {
- ed.setVisible(false);
- ed.dispose();
- }
-}
-
-/**
- * Event handler for StatusOKButton button
- */
-class StatusOKButtonListener implements ActionListener {
-
- private ToolDialog sd;
-
- StatusOKButtonListener(ToolDialog sd) {
- this.sd = sd;
- }
-
- public void actionPerformed(ActionEvent e) {
- sd.setVisible(false);
- sd.dispose();
- }
-}
-
-/**
- * Event handler for UserSaveYes button
- */
-@SuppressWarnings({"deprecation",
- "removal"}) // PolicyTool
-class UserSaveYesButtonListener implements ActionListener {
-
- private ToolDialog us;
- private PolicyTool tool;
- private ToolWindow tw;
- private int select;
-
- UserSaveYesButtonListener(ToolDialog us, PolicyTool tool,
- ToolWindow tw, int select) {
- this.us = us;
- this.tool = tool;
- this.tw = tw;
- this.select = select;
- }
-
- public void actionPerformed(ActionEvent e) {
-
- // first get rid of the window
- us.setVisible(false);
- us.dispose();
-
- try {
- String filename = ((JTextField)tw.getComponent(
- ToolWindow.MW_FILENAME_TEXTFIELD)).getText();
- if (filename == null || filename.equals("")) {
- us.displaySaveAsDialog(select);
-
- // the above dialog will continue with the originally
- // requested command if necessary
- } else {
- // save the policy entries to a file
- tool.savePolicy(filename);
-
- // display status
- MessageFormat form = new MessageFormat
- (PolicyTool.getMessage
- ("Policy.successfully.written.to.filename"));
- Object[] source = {filename};
- tw.displayStatusDialog(null, form.format(source));
-
- // now continue with the originally requested command
- // (QUIT, NEW, or OPEN)
- us.userSaveContinue(tool, tw, us, select);
- }
- } catch (Exception ee) {
- // error -- just report it and bail
- tw.displayErrorDialog(null, ee);
- }
- }
-}
-
-/**
- * Event handler for UserSaveNoButton
- */
-@SuppressWarnings({"deprecation",
- "removal"}) // PolicyTool
-class UserSaveNoButtonListener implements ActionListener {
-
- private PolicyTool tool;
- private ToolWindow tw;
- private ToolDialog us;
- private int select;
-
- UserSaveNoButtonListener(ToolDialog us, PolicyTool tool,
- ToolWindow tw, int select) {
- this.us = us;
- this.tool = tool;
- this.tw = tw;
- this.select = select;
- }
-
- public void actionPerformed(ActionEvent e) {
- us.setVisible(false);
- us.dispose();
-
- // now continue with the originally requested command
- // (QUIT, NEW, or OPEN)
- us.userSaveContinue(tool, tw, us, select);
- }
-}
-
-/**
- * Event handler for UserSaveCancelButton
- */
-class UserSaveCancelButtonListener implements ActionListener {
-
- private ToolDialog us;
-
- UserSaveCancelButtonListener(ToolDialog us) {
- this.us = us;
- }
-
- public void actionPerformed(ActionEvent e) {
- us.setVisible(false);
- us.dispose();
-
- // do NOT continue with the originally requested command
- // (QUIT, NEW, or OPEN)
- }
-}
-
-/**
- * Event handler for ConfirmRemovePolicyEntryOKButtonListener
- */
-@SuppressWarnings({"deprecation",
- "removal"}) // PolicyTool
-class ConfirmRemovePolicyEntryOKButtonListener implements ActionListener {
-
- private PolicyTool tool;
- private ToolWindow tw;
- private ToolDialog us;
-
- ConfirmRemovePolicyEntryOKButtonListener(PolicyTool tool,
- ToolWindow tw, ToolDialog us) {
- this.tool = tool;
- this.tw = tw;
- this.us = us;
- }
-
- public void actionPerformed(ActionEvent e) {
- // remove the entry
- @SuppressWarnings("unchecked")
- JList<String> list = (JList<String>)tw.getComponent(ToolWindow.MW_POLICY_LIST);
- int index = list.getSelectedIndex();
- PolicyEntry entries[] = tool.getEntry();
- tool.removeEntry(entries[index]);
-
- // redraw the window listing
- DefaultListModel<String> listModel = new DefaultListModel<>();
- list = new JList<>(listModel);
- list.setVisibleRowCount(15);
- list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- list.addMouseListener(new PolicyListListener(tool, tw));
- entries = tool.getEntry();
- if (entries != null) {
- for (int i = 0; i < entries.length; i++) {
- listModel.addElement(entries[i].headerToString());
- }
- }
- tw.replacePolicyList(list);
- us.setVisible(false);
- us.dispose();
- }
-}
-
-/**
- * Just a special name, so that the codes dealing with this exception knows
- * it's special, and does not pop out a warning box.
- */
-class NoDisplayException extends RuntimeException {
- private static final long serialVersionUID = -4611761427108719794L;
-}
-
-/**
- * This is a java.awt.List that bind an Object to each String it holds.
- */
-class TaggedList extends JList<String> {
- private static final long serialVersionUID = -5676238110427785853L;
-
- private java.util.List<Object> data = new LinkedList<>();
- public TaggedList(int i, boolean b) {
- super(new DefaultListModel<>());
- setVisibleRowCount(i);
- setSelectionMode(b ? ListSelectionModel.MULTIPLE_INTERVAL_SELECTION : ListSelectionModel.SINGLE_SELECTION);
- }
-
- public Object getObject(int index) {
- return data.get(index);
- }
-
- public void addTaggedItem(String string, Object object) {
- ((DefaultListModel<String>)getModel()).addElement(string);
- data.add(object);
- }
-
- public void replaceTaggedItem(String string, Object object, int index) {
- ((DefaultListModel<String>)getModel()).set(index, string);
- data.set(index, object);
- }
-
- public void removeTaggedItem(int index) {
- ((DefaultListModel<String>)getModel()).remove(index);
- data.remove(index);
- }
-}
-
-/**
- * Convenience Principal Classes
- */
-
-class Prin {
- final Class<? extends Principal> CLASS;
-
- Prin(Class<? extends Principal> clazz) {
- this.CLASS = clazz;
- }
-
- String getName() {
- return CLASS.getName();
- }
-
- String getSimpleName() {
- return CLASS.getSimpleName();
- }
-}
-
-class KrbPrin extends Prin {
- KrbPrin() {
- super(javax.security.auth.kerberos.KerberosPrincipal.class);
- }
-}
-
-class X500Prin extends Prin {
- X500Prin() {
- super(javax.security.auth.x500.X500Principal.class);
- }
-}
-
-/**
- * Convenience Permission Classes
- */
-
-class Perm {
- final Class<? extends Permission> CLASS;
- final String[] TARGETS;
- final String[] ACTIONS;
-
- Perm(Class<? extends Permission> clazz,
- String[] targets, String[] actions) {
-
- this.CLASS = clazz;
- this.TARGETS = targets;
- this.ACTIONS = actions;
- }
-
- String getName() {
- return CLASS.getName();
- }
-
- String getSimpleName() {
- return CLASS.getSimpleName();
- }
-}
-
-class AllPerm extends Perm {
- AllPerm() {
- super(java.security.AllPermission.class, null, null);
- }
-}
-
-class AudioPerm extends Perm {
- AudioPerm() {
- super(javax.sound.sampled.AudioPermission.class,
- new String[] {
- "play",
- "record"
- },
- null);
- }
-}
-
-@SuppressWarnings({"deprecation",
- "removal"}) // PolicyTool
-class AuthPerm extends Perm {
- AuthPerm() {
- super(javax.security.auth.AuthPermission.class,
- new String[] {
- "doAs",
- "doAsPrivileged",
- "getSubject",
- "getSubjectFromDomainCombiner",
- "setReadOnly",
- "modifyPrincipals",
- "modifyPublicCredentials",
- "modifyPrivateCredentials",
- "refreshCredential",
- "destroyCredential",
- "createLoginContext.<" + PolicyTool.getMessage("name") + ">",
- "getLoginConfiguration",
- "setLoginConfiguration",
- "createLoginConfiguration.<" +
- PolicyTool.getMessage("configuration.type") + ">",
- "refreshLoginConfiguration"
- },
- null);
- }
-}
-
-class AWTPerm extends Perm {
- AWTPerm() {
- super(java.awt.AWTPermission.class,
- new String[] {
- "accessClipboard",
- "accessEventQueue",
- "accessSystemTray",
- "createRobot",
- "fullScreenExclusive",
- "listenToAllAWTEvents",
- "readDisplayPixels",
- "replaceKeyboardFocusManager",
- "setAppletStub",
- "setWindowAlwaysOnTop",
- "showWindowWithoutWarningBanner",
- "toolkitModality",
- "watchMousePointer"
- },
- null);
- }
-}
-
-class DelegationPerm extends Perm {
- DelegationPerm() {
- super(javax.security.auth.kerberos.DelegationPermission.class,
- new String[] {
- // allow user input
- },
- null);
- }
-}
-
-class FilePerm extends Perm {
- FilePerm() {
- super(java.io.FilePermission.class,
- new String[] {
- "<<ALL FILES>>"
- },
- new String[] {
- "read",
- "write",
- "delete",
- "execute"
- });
- }
-}
-
-@SuppressWarnings({"deprecation",
- "removal"}) // PolicyTool
-class URLPerm extends Perm {
- URLPerm() {
- super(java.net.URLPermission.class,
- new String[] {
- "<"+ PolicyTool.getMessage("url") + ">",
- },
- new String[] {
- "<" + PolicyTool.getMessage("method.list") + ">:<"
- + PolicyTool.getMessage("request.headers.list") + ">",
- });
- }
-}
-
-class InqSecContextPerm extends Perm {
- InqSecContextPerm() {
- super(com.sun.security.jgss.InquireSecContextPermission.class,
- new String[] {
- "KRB5_GET_SESSION_KEY",
- "KRB5_GET_TKT_FLAGS",
- "KRB5_GET_AUTHZ_DATA",
- "KRB5_GET_AUTHTIME"
- },
- null);
- }
-}
-
-class LogPerm extends Perm {
- LogPerm() {
- super(java.util.logging.LoggingPermission.class,
- new String[] {
- "control"
- },
- null);
- }
-}
-
-class MgmtPerm extends Perm {
- MgmtPerm() {
- super(java.lang.management.ManagementPermission.class,
- new String[] {
- "control",
- "monitor"
- },
- null);
- }
-}
-
-class MBeanPerm extends Perm {
- MBeanPerm() {
- super(javax.management.MBeanPermission.class,
- new String[] {
- // allow user input
- },
- new String[] {
- "addNotificationListener",
- "getAttribute",
- "getClassLoader",
- "getClassLoaderFor",
- "getClassLoaderRepository",
- "getDomains",
- "getMBeanInfo",
- "getObjectInstance",
- "instantiate",
- "invoke",
- "isInstanceOf",
- "queryMBeans",
- "queryNames",
- "registerMBean",
- "removeNotificationListener",
- "setAttribute",
- "unregisterMBean"
- });
- }
-}
-
-class MBeanSvrPerm extends Perm {
- MBeanSvrPerm() {
- super(javax.management.MBeanServerPermission.class,
- new String[] {
- "createMBeanServer",
- "findMBeanServer",
- "newMBeanServer",
- "releaseMBeanServer"
- },
- null);
- }
-}
-
-class MBeanTrustPerm extends Perm {
- MBeanTrustPerm() {
- super(javax.management.MBeanTrustPermission.class,
- new String[] {
- "register"
- },
- null);
- }
-}
-
-class NetPerm extends Perm {
- NetPerm() {
- super(java.net.NetPermission.class,
- new String[] {
- "allowHttpTrace",
- "setDefaultAuthenticator",
- "requestPasswordAuthentication",
- "specifyStreamHandler",
- "getNetworkInformation",
- "setProxySelector",
- "getProxySelector",
- "setCookieHandler",
- "getCookieHandler",
- "setResponseCache",
- "getResponseCache"
- },
- null);
- }
-}
-
-class NetworkPerm extends Perm {
- NetworkPerm() {
- super(jdk.net.NetworkPermission.class,
- new String[] {
- "setOption.SO_FLOW_SLA",
- "getOption.SO_FLOW_SLA"
- },
- null);
- }
-}
-
-class PrivCredPerm extends Perm {
- PrivCredPerm() {
- super(javax.security.auth.PrivateCredentialPermission.class,
- new String[] {
- // allow user input
- },
- new String[] {
- "read"
- });
- }
-}
-
-class PropPerm extends Perm {
- PropPerm() {
- super(java.util.PropertyPermission.class,
- new String[] {
- // allow user input
- },
- new String[] {
- "read",
- "write"
- });
- }
-}
-
-class ReflectPerm extends Perm {
- ReflectPerm() {
- super(java.lang.reflect.ReflectPermission.class,
- new String[] {
- "suppressAccessChecks"
- },
- null);
- }
-}
-
-@SuppressWarnings({"deprecation",
- "removal"}) // PolicyTool
-class RuntimePerm extends Perm {
- RuntimePerm() {
- super(java.lang.RuntimePermission.class,
- new String[] {
- "createClassLoader",
- "getClassLoader",
- "setContextClassLoader",
- "enableContextClassLoaderOverride",
- "setSecurityManager",
- "createSecurityManager",
- "getenv.<" +
- PolicyTool.getMessage("environment.variable.name") + ">",
- "exitVM",
- "shutdownHooks",
- "setFactory",
- "setIO",
- "modifyThread",
- "stopThread",
- "modifyThreadGroup",
- "getProtectionDomain",
- "readFileDescriptor",
- "writeFileDescriptor",
- "loadLibrary.<" +
- PolicyTool.getMessage("library.name") + ">",
- "accessClassInPackage.<" +
- PolicyTool.getMessage("package.name")+">",
- "defineClassInPackage.<" +
- PolicyTool.getMessage("package.name")+">",
- "accessDeclaredMembers",
- "queuePrintJob",
- "getStackTrace",
- "setDefaultUncaughtExceptionHandler",
- "preferences",
- "usePolicy",
- // "inheritedChannel"
- },
- null);
- }
-}
-
-@SuppressWarnings({"deprecation",
- "removal"}) // PolicyTool
-class SecurityPerm extends Perm {
- SecurityPerm() {
- super(java.security.SecurityPermission.class,
- new String[] {
- "createAccessControlContext",
- "getDomainCombiner",
- "getPolicy",
- "setPolicy",
- "createPolicy.<" +
- PolicyTool.getMessage("policy.type") + ">",
- "getProperty.<" +
- PolicyTool.getMessage("property.name") + ">",
- "setProperty.<" +
- PolicyTool.getMessage("property.name") + ">",
- "insertProvider.<" +
- PolicyTool.getMessage("provider.name") + ">",
- "removeProvider.<" +
- PolicyTool.getMessage("provider.name") + ">",
- //"setSystemScope",
- //"setIdentityPublicKey",
- //"setIdentityInfo",
- //"addIdentityCertificate",
- //"removeIdentityCertificate",
- //"printIdentity",
- "clearProviderProperties.<" +
- PolicyTool.getMessage("provider.name") + ">",
- "putProviderProperty.<" +
- PolicyTool.getMessage("provider.name") + ">",
- "removeProviderProperty.<" +
- PolicyTool.getMessage("provider.name") + ">",
- //"getSignerPrivateKey",
- //"setSignerKeyPair"
- },
- null);
- }
-}
-
-class SerialPerm extends Perm {
- SerialPerm() {
- super(java.io.SerializablePermission.class,
- new String[] {
- "enableSubclassImplementation",
- "enableSubstitution"
- },
- null);
- }
-}
-
-class ServicePerm extends Perm {
- ServicePerm() {
- super(javax.security.auth.kerberos.ServicePermission.class,
- new String[] {
- // allow user input
- },
- new String[] {
- "initiate",
- "accept"
- });
- }
-}
-
-class SocketPerm extends Perm {
- SocketPerm() {
- super(java.net.SocketPermission.class,
- new String[] {
- // allow user input
- },
- new String[] {
- "accept",
- "connect",
- "listen",
- "resolve"
- });
- }
-}
-
-class SQLPerm extends Perm {
- SQLPerm() {
- super(java.sql.SQLPermission.class,
- new String[] {
- "setLog",
- "callAbort",
- "setSyncFactory",
- "setNetworkTimeout",
- },
- null);
- }
-}
-
-class SSLPerm extends Perm {
- SSLPerm() {
- super(javax.net.ssl.SSLPermission.class,
- new String[] {
- "setHostnameVerifier",
- "getSSLSessionContext"
- },
- null);
- }
-}
-
-class SubjDelegPerm extends Perm {
- SubjDelegPerm() {
- super(javax.management.remote.SubjectDelegationPermission.class,
- new String[] {
- // allow user input
- },
- null);
- }
-}
--- a/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources.java Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,164 +0,0 @@
-/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.security.tools.policytool;
-
-/**
- * <p> This class represents the <code>ResourceBundle</code>
- * for the policytool.
- *
- */
-public class Resources extends java.util.ListResourceBundle {
-
- private static final Object[][] contents = {
- {"NEWLINE", "\n"},
- {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
- "Warning: A public key for alias {0} does not exist. Make sure a KeyStore is properly configured."},
- {"Warning.Class.not.found.class", "Warning: Class not found: {0}"},
- {"Warning.Invalid.argument.s.for.constructor.arg",
- "Warning: Invalid argument(s) for constructor: {0}"},
- {"Illegal.Principal.Type.type", "Illegal Principal Type: {0}"},
- {"Illegal.option.option", "Illegal option: {0}"},
- {"Usage.policytool.options.", "Usage: policytool [options]"},
- {".file.file.policy.file.location",
- " [-file <file>] policy file location"},
- {"New", "&New"},
- {"Open", "&Open..."},
- {"Save", "&Save"},
- {"Save.As", "Save &As..."},
- {"View.Warning.Log", "View &Warning Log"},
- {"Exit", "E&xit"},
- {"Add.Policy.Entry", "&Add Policy Entry"},
- {"Edit.Policy.Entry", "&Edit Policy Entry"},
- {"Remove.Policy.Entry", "&Remove Policy Entry"},
- {"Edit", "&Edit"},
- {"Retain", "Retain"},
-
- {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
- "Warning: File name may include escaped backslash characters. " +
- "It is not necessary to escape backslash characters " +
- "(the tool escapes characters as necessary when writing " +
- "the policy contents to the persistent store).\n\n" +
- "Click on Retain to retain the entered name, or click on " +
- "Edit to edit the name."},
-
- {"Add.Public.Key.Alias", "Add Public Key Alias"},
- {"Remove.Public.Key.Alias", "Remove Public Key Alias"},
- {"File", "&File"},
- {"KeyStore", "&KeyStore"},
- {"Policy.File.", "Policy File:"},
- {"Could.not.open.policy.file.policyFile.e.toString.",
- "Could not open policy file: {0}: {1}"},
- {"Policy.Tool", "Policy Tool"},
- {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
- "Errors have occurred while opening the policy configuration. View the Warning Log for more information."},
- {"Error", "Error"},
- {"OK", "OK"},
- {"Status", "Status"},
- {"Warning", "Warning"},
- {"Permission.",
- "Permission: "},
- {"Principal.Type.", "Principal Type:"},
- {"Principal.Name.", "Principal Name:"},
- {"Target.Name.",
- "Target Name: "},
- {"Actions.",
- "Actions: "},
- {"OK.to.overwrite.existing.file.filename.",
- "OK to overwrite existing file {0}?"},
- {"Cancel", "Cancel"},
- {"CodeBase.", "&CodeBase:"},
- {"SignedBy.", "&SignedBy:"},
- {"Add.Principal", "&Add Principal"},
- {"Edit.Principal", "&Edit Principal"},
- {"Remove.Principal", "&Remove Principal"},
- {"Principals.", "&Principals:"},
- {".Add.Permission", " A&dd Permission"},
- {".Edit.Permission", " Ed&it Permission"},
- {"Remove.Permission", "Re&move Permission"},
- {"Done", "Done"},
- {"KeyStore.URL.", "KeyStore &URL:"},
- {"KeyStore.Type.", "KeyStore &Type:"},
- {"KeyStore.Provider.", "KeyStore &Provider:"},
- {"KeyStore.Password.URL.", "KeyStore Pass&word URL:"},
- {"Principals", "Principals"},
- {".Edit.Principal.", " Edit Principal:"},
- {".Add.New.Principal.", " Add New Principal:"},
- {"Permissions", "Permissions"},
- {".Edit.Permission.", " Edit Permission:"},
- {".Add.New.Permission.", " Add New Permission:"},
- {"Signed.By.", "Signed By:"},
- {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
- "Cannot Specify Principal with a Wildcard Class without a Wildcard Name"},
- {"Cannot.Specify.Principal.without.a.Name",
- "Cannot Specify Principal without a Name"},
- {"Permission.and.Target.Name.must.have.a.value",
- "Permission and Target Name must have a value"},
- {"Remove.this.Policy.Entry.", "Remove this Policy Entry?"},
- {"Overwrite.File", "Overwrite File"},
- {"Policy.successfully.written.to.filename",
- "Policy successfully written to {0}"},
- {"null.filename", "null filename"},
- {"Save.changes.", "Save changes?"},
- {"Yes", "&Yes"},
- {"No", "&No"},
- {"Policy.Entry", "Policy Entry"},
- {"Save.Changes", "Save Changes"},
- {"No.Policy.Entry.selected", "No Policy Entry selected"},
- {"Unable.to.open.KeyStore.ex.toString.",
- "Unable to open KeyStore: {0}"},
- {"No.principal.selected", "No principal selected"},
- {"No.permission.selected", "No permission selected"},
- {"name", "name"},
- {"configuration.type", "configuration type"},
- {"environment.variable.name", "environment variable name"},
- {"library.name", "library name"},
- {"package.name", "package name"},
- {"policy.type", "policy type"},
- {"property.name", "property name"},
- {"provider.name", "provider name"},
- {"url", "url"},
- {"method.list", "method list"},
- {"request.headers.list", "request headers list"},
- {"Principal.List", "Principal List"},
- {"Permission.List", "Permission List"},
- {"Code.Base", "Code Base"},
- {"KeyStore.U.R.L.", "KeyStore U R L:"},
- {"KeyStore.Password.U.R.L.", "KeyStore Password U R L:"}
- };
-
-
- /**
- * Returns the contents of this <code>ResourceBundle</code>.
- *
- * <p>
- *
- * @return the contents of this <code>ResourceBundle</code>.
- */
- @Override
- public Object[][] getContents() {
- return contents;
- }
-}
--- a/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_de.java Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2000, 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 sun.security.tools.policytool;
-
-/**
- * <p> This class represents the <code>ResourceBundle</code>
- * for the policytool.
- *
- */
-public class Resources_de extends java.util.ListResourceBundle {
-
- private static final Object[][] contents = {
- {"NEWLINE", "\n"},
- {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
- "Warnung: Kein Public Key f\u00FCr Alias {0} vorhanden. Vergewissern Sie sich, dass der KeyStore ordnungsgem\u00E4\u00DF konfiguriert ist."},
- {"Warning.Class.not.found.class", "Warnung: Klasse nicht gefunden: {0}"},
- {"Warning.Invalid.argument.s.for.constructor.arg",
- "Warnung: Ung\u00FCltige(s) Argument(e) f\u00FCr Constructor: {0}"},
- {"Illegal.Principal.Type.type", "Ung\u00FCltiger Principal-Typ: {0}"},
- {"Illegal.option.option", "Ung\u00FCltige Option: {0}"},
- {"Usage.policytool.options.", "Verwendung: policytool [Optionen]"},
- {".file.file.policy.file.location",
- " [-file <Datei>] Policy-Dateiverzeichnis"},
- {"New", "&Neu"},
- {"Open", "&\u00D6ffnen..."},
- {"Save", "&Speichern"},
- {"Save.As", "Speichern &unter..."},
- {"View.Warning.Log", "&Warnungslog anzeigen"},
- {"Exit", "B&eenden"},
- {"Add.Policy.Entry", "Policy-Eintrag &hinzuf\u00FCgen"},
- {"Edit.Policy.Entry", "Policy-Eintrag &bearbeiten"},
- {"Remove.Policy.Entry", "Policy-Eintrag &entfernen"},
- {"Edit", "&Bearbeiten"},
- {"Retain", "Beibehalten"},
-
- {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
- "Warnung: M\u00F6glicherweise enth\u00E4lt der Dateiname Escapezeichen mit Backslash. Es ist nicht notwendig, Backslash-Zeichen zu escapen (das Tool f\u00FChrt dies automatisch beim Schreiben des Policy-Contents in den persistenten Speicher aus).\n\nKlicken Sie auf \"Beibehalten\", um den eingegebenen Namen beizubehalten oder auf \"Bearbeiten\", um den Namen zu bearbeiten."},
-
- {"Add.Public.Key.Alias", "Public Key-Alias hinzuf\u00FCgen"},
- {"Remove.Public.Key.Alias", "Public Key-Alias entfernen"},
- {"File", "&Datei"},
- {"KeyStore", "&KeyStore"},
- {"Policy.File.", "Policy-Datei:"},
- {"Could.not.open.policy.file.policyFile.e.toString.",
- "Policy-Datei konnte nicht ge\u00F6ffnet werden: {0}: {1}"},
- {"Policy.Tool", "Policy-Tool"},
- {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
- "Beim \u00D6ffnen der Policy-Konfiguration sind Fehler aufgetreten. Weitere Informationen finden Sie im Warnungslog."},
- {"Error", "Fehler"},
- {"OK", "OK"},
- {"Status", "Status"},
- {"Warning", "Warnung"},
- {"Permission.",
- "Berechtigung: "},
- {"Principal.Type.", "Principal-Typ:"},
- {"Principal.Name.", "Principal-Name:"},
- {"Target.Name.",
- "Zielname: "},
- {"Actions.",
- "Aktionen: "},
- {"OK.to.overwrite.existing.file.filename.",
- "Vorhandene Datei {0} \u00FCberschreiben?"},
- {"Cancel", "Abbrechen"},
- {"CodeBase.", "&CodeBase:"},
- {"SignedBy.", "&SignedBy:"},
- {"Add.Principal", "Principal &hinzuf\u00FCgen"},
- {"Edit.Principal", "Principal &bearbeiten"},
- {"Remove.Principal", "Principal ent&fernen"},
- {"Principals.", "&Principals:"},
- {".Add.Permission", " B&erechtigung hinzuf\u00FCgen"},
- {".Edit.Permission", " Be&rechtigung bearbeiten"},
- {"Remove.Permission", "Berec&htigung entfernen"},
- {"Done", "Fertig"},
- {"KeyStore.URL.", "KeyStore-&URL:"},
- {"KeyStore.Type.", "KeyStore-&Typ:"},
- {"KeyStore.Provider.", "KeyStore-&Provider:"},
- {"KeyStore.Password.URL.", "KeyStore-Kenn&wort-URL:"},
- {"Principals", "Principals"},
- {".Edit.Principal.", " Principal bearbeiten:"},
- {".Add.New.Principal.", " Neuen Principal hinzuf\u00FCgen:"},
- {"Permissions", "Berechtigungen"},
- {".Edit.Permission.", " Berechtigung bearbeiten:"},
- {".Add.New.Permission.", " Neue Berechtigung hinzuf\u00FCgen:"},
- {"Signed.By.", "Signiert von:"},
- {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
- "Principal kann nicht mit einer Platzhalterklasse ohne Platzhalternamen angegeben werden"},
- {"Cannot.Specify.Principal.without.a.Name",
- "Principal kann nicht ohne einen Namen angegeben werden"},
- {"Permission.and.Target.Name.must.have.a.value",
- "Berechtigung und Zielname m\u00FCssen einen Wert haben"},
- {"Remove.this.Policy.Entry.", "Diesen Policy-Eintrag entfernen?"},
- {"Overwrite.File", "Datei \u00FCberschreiben"},
- {"Policy.successfully.written.to.filename",
- "Policy erfolgreich in {0} geschrieben"},
- {"null.filename", "Null-Dateiname"},
- {"Save.changes.", "\u00C4nderungen speichern?"},
- {"Yes", "&Ja"},
- {"No", "&Nein"},
- {"Policy.Entry", "Policy-Eintrag"},
- {"Save.Changes", "\u00C4nderungen speichern"},
- {"No.Policy.Entry.selected", "Kein Policy-Eintrag ausgew\u00E4hlt"},
- {"Unable.to.open.KeyStore.ex.toString.",
- "KeyStore kann nicht ge\u00F6ffnet werden: {0}"},
- {"No.principal.selected", "Kein Principal ausgew\u00E4hlt"},
- {"No.permission.selected", "Keine Berechtigung ausgew\u00E4hlt"},
- {"name", "Name"},
- {"configuration.type", "Konfigurationstyp"},
- {"environment.variable.name", "Umgebungsvariablenname"},
- {"library.name", "Library-Name"},
- {"package.name", "Packagename"},
- {"policy.type", "Policy-Typ"},
- {"property.name", "Eigenschaftsname"},
- {"provider.name", "Providername"},
- {"url", "URL"},
- {"method.list", "Methodenliste"},
- {"request.headers.list", "Headerliste anfordern"},
- {"Principal.List", "Principal-Liste"},
- {"Permission.List", "Berechtigungsliste"},
- {"Code.Base", "Codebase"},
- {"KeyStore.U.R.L.", "KeyStore-URL:"},
- {"KeyStore.Password.U.R.L.", "KeyStore-Kennwort-URL:"}
- };
-
-
- /**
- * Returns the contents of this <code>ResourceBundle</code>.
- *
- * <p>
- *
- * @return the contents of this <code>ResourceBundle</code>.
- */
- @Override
- public Object[][] getContents() {
- return contents;
- }
-}
--- a/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_es.java Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2000, 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 sun.security.tools.policytool;
-
-/**
- * <p> This class represents the <code>ResourceBundle</code>
- * for the policytool.
- *
- */
-public class Resources_es extends java.util.ListResourceBundle {
-
- private static final Object[][] contents = {
- {"NEWLINE", "\n"},
- {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
- "Advertencia: no hay clave p\u00FAblica para el alias {0}. Aseg\u00FArese de que se ha configurado correctamente un almac\u00E9n de claves."},
- {"Warning.Class.not.found.class", "Advertencia: no se ha encontrado la clase: {0}"},
- {"Warning.Invalid.argument.s.for.constructor.arg",
- "Advertencia: argumento(s) no v\u00E1lido(s) para el constructor: {0}"},
- {"Illegal.Principal.Type.type", "Tipo de principal no permitido: {0}"},
- {"Illegal.option.option", "Opci\u00F3n no permitida: {0}"},
- {"Usage.policytool.options.", "Sintaxis: policytool [opciones]"},
- {".file.file.policy.file.location",
- " [-file <archivo>] ubicaci\u00F3n del archivo de normas"},
- {"New", "&Nueva"},
- {"Open", "&Abrir..."},
- {"Save", "&Guardar"},
- {"Save.As", "Guardar &como..."},
- {"View.Warning.Log", "Ver &log de advertencias"},
- {"Exit", "&Salir"},
- {"Add.Policy.Entry", "Agregar &entrada de pol\u00EDtica"},
- {"Edit.Policy.Entry", "E&ditar entrada de pol\u00EDtica"},
- {"Remove.Policy.Entry", "&Eliminar entrada de pol\u00EDtica"},
- {"Edit", "&Editar"},
- {"Retain", "Mantener"},
-
- {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
- "Advertencia: el nombre del archivo puede contener caracteres de barra invertida de escape. No es necesario utilizar barras invertidas de escape (la herramienta aplica caracteres de escape seg\u00FAn sea necesario al escribir el contenido de las pol\u00EDticas en el almac\u00E9n persistente).\n\nHaga clic en Mantener para conservar el nombre introducido o en Editar para modificarlo."},
-
- {"Add.Public.Key.Alias", "Agregar Alias de Clave P\u00FAblico"},
- {"Remove.Public.Key.Alias", "Eliminar Alias de Clave P\u00FAblico"},
- {"File", "&Archivo"},
- {"KeyStore", "Al&mac\u00E9n de claves"},
- {"Policy.File.", "Archivo de Pol\u00EDtica:"},
- {"Could.not.open.policy.file.policyFile.e.toString.",
- "No se ha podido abrir el archivo de pol\u00EDtica: {0}: {1}"},
- {"Policy.Tool", "Herramienta de Pol\u00EDticas"},
- {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
- "Ha habido errores al abrir la configuraci\u00F3n de pol\u00EDticas. V\u00E9ase el log de advertencias para obtener m\u00E1s informaci\u00F3n."},
- {"Error", "Error"},
- {"OK", "Aceptar"},
- {"Status", "Estado"},
- {"Warning", "Advertencia"},
- {"Permission.",
- "Permiso: "},
- {"Principal.Type.", "Tipo de Principal:"},
- {"Principal.Name.", "Nombre de Principal:"},
- {"Target.Name.",
- "Nombre de Destino: "},
- {"Actions.",
- "Acciones: "},
- {"OK.to.overwrite.existing.file.filename.",
- "\u00BFSobrescribir el archivo existente {0}?"},
- {"Cancel", "Cancelar"},
- {"CodeBase.", "&CodeBase:"},
- {"SignedBy.", "&SignedBy:"},
- {"Add.Principal", "&Agregar principal"},
- {"Edit.Principal", "&Editar principal"},
- {"Remove.Principal", "Elimina&r principal"},
- {"Principals.", "&Principales:"},
- {".Add.Permission", "A&gregar permiso"},
- {".Edit.Permission", "Ed&itar permiso"},
- {"Remove.Permission", "Eli&minar permiso"},
- {"Done", "Listo"},
- {"KeyStore.URL.", "&URL de almac\u00E9n de claves:"},
- {"KeyStore.Type.", "&Tipo de almac\u00E9n de claves:"},
- {"KeyStore.Provider.", "&Proveedor de almac\u00E9n de claves:"},
- {"KeyStore.Password.URL.", "URL de Contra&se\u00F1a de almac\u00E9n de claves:"},
- {"Principals", "Principales"},
- {".Edit.Principal.", " Editar Principal:"},
- {".Add.New.Principal.", " Agregar Nuevo Principal:"},
- {"Permissions", "Permisos"},
- {".Edit.Permission.", " Editar Permiso:"},
- {".Add.New.Permission.", " Agregar Permiso Nuevo:"},
- {"Signed.By.", "Firmado Por:"},
- {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
- "No se puede especificar un principal con una clase de comod\u00EDn sin un nombre de comod\u00EDn"},
- {"Cannot.Specify.Principal.without.a.Name",
- "No se puede especificar el principal sin un nombre"},
- {"Permission.and.Target.Name.must.have.a.value",
- "Permiso y Nombre de Destino deben tener un valor"},
- {"Remove.this.Policy.Entry.", "\u00BFEliminar esta entrada de pol\u00EDtica?"},
- {"Overwrite.File", "Sobrescribir Archivo"},
- {"Policy.successfully.written.to.filename",
- "Pol\u00EDtica escrita correctamente en {0}"},
- {"null.filename", "nombre de archivo nulo"},
- {"Save.changes.", "\u00BFGuardar los cambios?"},
- {"Yes", "&S\u00ED"},
- {"No", "&No"},
- {"Policy.Entry", "Entrada de Pol\u00EDtica"},
- {"Save.Changes", "Guardar Cambios"},
- {"No.Policy.Entry.selected", "No se ha seleccionado la entrada de pol\u00EDtica"},
- {"Unable.to.open.KeyStore.ex.toString.",
- "No se ha podido abrir el almac\u00E9n de claves: {0}"},
- {"No.principal.selected", "No se ha seleccionado un principal"},
- {"No.permission.selected", "No se ha seleccionado un permiso"},
- {"name", "nombre"},
- {"configuration.type", "tipo de configuraci\u00F3n"},
- {"environment.variable.name", "nombre de variable de entorno"},
- {"library.name", "nombre de la biblioteca"},
- {"package.name", "nombre del paquete"},
- {"policy.type", "tipo de pol\u00EDtica"},
- {"property.name", "nombre de la propiedad"},
- {"provider.name", "nombre del proveedor"},
- {"url", "url"},
- {"method.list", "lista de m\u00E9todos"},
- {"request.headers.list", "lista de cabeceras de solicitudes"},
- {"Principal.List", "Lista de Principales"},
- {"Permission.List", "Lista de Permisos"},
- {"Code.Base", "Base de C\u00F3digo"},
- {"KeyStore.U.R.L.", "URL de Almac\u00E9n de Claves:"},
- {"KeyStore.Password.U.R.L.", "URL de Contrase\u00F1a de Almac\u00E9n de Claves:"}
- };
-
-
- /**
- * Returns the contents of this <code>ResourceBundle</code>.
- *
- * <p>
- *
- * @return the contents of this <code>ResourceBundle</code>.
- */
- @Override
- public Object[][] getContents() {
- return contents;
- }
-}
--- a/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_fr.java Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2000, 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 sun.security.tools.policytool;
-
-/**
- * <p> This class represents the <code>ResourceBundle</code>
- * for the policytool.
- *
- */
-public class Resources_fr extends java.util.ListResourceBundle {
-
- private static final Object[][] contents = {
- {"NEWLINE", "\n"},
- {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
- "Avertissement\u00A0: il n''existe pas de cl\u00E9 publique pour l''alias {0}. V\u00E9rifiez que le fichier de cl\u00E9s d''acc\u00E8s est correctement configur\u00E9."},
- {"Warning.Class.not.found.class", "Avertissement : classe introuvable - {0}"},
- {"Warning.Invalid.argument.s.for.constructor.arg",
- "Avertissement\u00A0: arguments non valides pour le constructeur\u00A0- {0}"},
- {"Illegal.Principal.Type.type", "Type de principal non admis : {0}"},
- {"Illegal.option.option", "Option non admise : {0}"},
- {"Usage.policytool.options.", "Syntaxe : policytool [options]"},
- {".file.file.policy.file.location",
- " [-file <file>] emplacement du fichier de r\u00E8gles"},
- {"New", "&Nouveau"},
- {"Open", "&Ouvrir..."},
- {"Save", "Enregi&strer"},
- {"Save.As", "Enregistrer so&us..."},
- {"View.Warning.Log", "Affic&her le journal des avertissements"},
- {"Exit", "&Quitter"},
- {"Add.Policy.Entry", "&Ajouter une r\u00E8gle"},
- {"Edit.Policy.Entry", "Modifi&er une r\u00E8gle"},
- {"Remove.Policy.Entry", "Enlever une &r\u00E8gle"},
- {"Edit", "Modifi&er"},
- {"Retain", "Conserver"},
-
- {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
- "Avertissement : il se peut que le nom de fichier contienne des barres obliques inverses avec caract\u00E8re d'\u00E9chappement. Il n'est pas n\u00E9cessaire d'ajouter un caract\u00E8re d'\u00E9chappement aux barres obliques inverses. L'outil proc\u00E8de \u00E0 l'\u00E9chappement si n\u00E9cessaire lorsqu'il \u00E9crit le contenu des r\u00E8gles dans la zone de stockage persistant.\n\nCliquez sur Conserver pour garder le nom saisi ou sur Modifier pour le remplacer."},
-
- {"Add.Public.Key.Alias", "Ajouter un alias de cl\u00E9 publique"},
- {"Remove.Public.Key.Alias", "Enlever un alias de cl\u00E9 publique"},
- {"File", "&Fichier"},
- {"KeyStore", "Fichier &de cl\u00E9s"},
- {"Policy.File.", "Fichier de r\u00E8gles :"},
- {"Could.not.open.policy.file.policyFile.e.toString.",
- "Impossible d''ouvrir le fichier de r\u00E8gles\u00A0: {0}: {1}"},
- {"Policy.Tool", "Policy Tool"},
- {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
- "Des erreurs se sont produites \u00E0 l'ouverture de la configuration de r\u00E8gles. Pour plus d'informations, consultez le journal des avertissements."},
- {"Error", "Erreur"},
- {"OK", "OK"},
- {"Status", "Statut"},
- {"Warning", "Avertissement"},
- {"Permission.",
- "Droit : "},
- {"Principal.Type.", "Type de principal :"},
- {"Principal.Name.", "Nom de principal :"},
- {"Target.Name.",
- "Nom de cible : "},
- {"Actions.",
- "Actions : "},
- {"OK.to.overwrite.existing.file.filename.",
- "Remplacer le fichier existant {0} ?"},
- {"Cancel", "Annuler"},
- {"CodeBase.", "Base de &code :"},
- {"SignedBy.", "&Sign\u00E9 par :"},
- {"Add.Principal", "&Ajouter un principal"},
- {"Edit.Principal", "Modifi&er un principal"},
- {"Remove.Principal", "Enleve&r un principal"},
- {"Principals.", "&Principaux :"},
- {".Add.Permission", " Ajouter un &droit"},
- {".Edit.Permission", " Mod&ifier un droit"},
- {"Remove.Permission", "Enlever un dr&oit"},
- {"Done", "Termin\u00E9"},
- {"KeyStore.URL.", "&URL du fichier de cl\u00E9s :"},
- {"KeyStore.Type.", "&Type du fichier de cl\u00E9s :"},
- {"KeyStore.Provider.", "Four&nisseur du fichier de cl\u00E9s :"},
- {"KeyStore.Password.URL.", "UR&L du mot de passe du fichier de cl\u00E9s :"},
- {"Principals", "Principaux"},
- {".Edit.Principal.", " Modifier un principal :"},
- {".Add.New.Principal.", " Ajouter un principal :"},
- {"Permissions", "Droits"},
- {".Edit.Permission.", " Modifier un droit :"},
- {".Add.New.Permission.", " Ajouter un droit :"},
- {"Signed.By.", "Sign\u00E9 par :"},
- {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
- "Impossible de sp\u00E9cifier un principal avec une classe g\u00E9n\u00E9rique sans nom g\u00E9n\u00E9rique"},
- {"Cannot.Specify.Principal.without.a.Name",
- "Impossible de sp\u00E9cifier un principal sans nom"},
- {"Permission.and.Target.Name.must.have.a.value",
- "Le droit et le nom de cible doivent avoir une valeur"},
- {"Remove.this.Policy.Entry.", "Enlever cette r\u00E8gle ?"},
- {"Overwrite.File", "Remplacer le fichier"},
- {"Policy.successfully.written.to.filename",
- "R\u00E8gle \u00E9crite dans {0}"},
- {"null.filename", "nom de fichier NULL"},
- {"Save.changes.", "Enregistrer les modifications ?"},
- {"Yes", "&Oui"},
- {"No", "&Non"},
- {"Policy.Entry", "R\u00E8gle"},
- {"Save.Changes", "Enregistrer les modifications"},
- {"No.Policy.Entry.selected", "Aucune r\u00E8gle s\u00E9lectionn\u00E9e"},
- {"Unable.to.open.KeyStore.ex.toString.",
- "Impossible d''ouvrir le fichier de cl\u00E9s d''acc\u00E8s : {0}"},
- {"No.principal.selected", "Aucun principal s\u00E9lectionn\u00E9"},
- {"No.permission.selected", "Aucun droit s\u00E9lectionn\u00E9"},
- {"name", "nom"},
- {"configuration.type", "type de configuration"},
- {"environment.variable.name", "Nom de variable d'environnement"},
- {"library.name", "nom de biblioth\u00E8que"},
- {"package.name", "nom de package"},
- {"policy.type", "type de r\u00E8gle"},
- {"property.name", "nom de propri\u00E9t\u00E9"},
- {"provider.name", "nom du fournisseur"},
- {"url", "url"},
- {"method.list", "liste des m\u00E9thodes"},
- {"request.headers.list", "liste des en-t\u00EAtes de demande"},
- {"Principal.List", "Liste de principaux"},
- {"Permission.List", "Liste de droits"},
- {"Code.Base", "Base de code"},
- {"KeyStore.U.R.L.", "URL du fichier de cl\u00E9s :"},
- {"KeyStore.Password.U.R.L.", "URL du mot de passe du fichier de cl\u00E9s :"}
- };
-
-
- /**
- * Returns the contents of this <code>ResourceBundle</code>.
- *
- * <p>
- *
- * @return the contents of this <code>ResourceBundle</code>.
- */
- @Override
- public Object[][] getContents() {
- return contents;
- }
-}
--- a/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_it.java Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2000, 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 sun.security.tools.policytool;
-
-/**
- * <p> This class represents the <code>ResourceBundle</code>
- * for the policytool.
- *
- */
-public class Resources_it extends java.util.ListResourceBundle {
-
- private static final Object[][] contents = {
- {"NEWLINE", "\n"},
- {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
- "Avvertenza: non esiste una chiave pubblica per l''alias {0}. Verificare che il keystore sia configurato correttamente."},
- {"Warning.Class.not.found.class", "Avvertenza: classe non trovata: {0}"},
- {"Warning.Invalid.argument.s.for.constructor.arg",
- "Avvertenza: argomento o argomenti non validi per il costruttore {0}"},
- {"Illegal.Principal.Type.type", "Tipo principal non valido: {0}"},
- {"Illegal.option.option", "Opzione non valida: {0}"},
- {"Usage.policytool.options.", "Uso: policytool [opzioni]"},
- {".file.file.policy.file.location",
- " [-file <file>] posizione del file dei criteri"},
- {"New", "&Nuovo"},
- {"Open", "&Apri..."},
- {"Save", "&Salva"},
- {"Save.As", "Sal&va con nome..."},
- {"View.Warning.Log", "Visuali&zza registro avvertenze"},
- {"Exit", "&Esci"},
- {"Add.Policy.Entry", "Aggi&ungi voce criteri"},
- {"Edit.Policy.Entry", "&Modifica voce criteri"},
- {"Remove.Policy.Entry", "&Rimuovi voce criteri"},
- {"Edit", "&Modifica"},
- {"Retain", "Mantieni"},
-
- {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
- "Avvertenza: il nome file pu\u00F2 includere barre rovesciate con escape. Non \u00E8 necessario eseguire l'escape delle barre rovesciate (se necessario lo strumento esegue l'escape dei caratteri al momento della scrittura del contenuto dei criteri nell'area di memorizzazione persistente).\n\nFare click su Mantieni per conservare il nome immesso, oppure su Modifica per modificare il nome."},
-
- {"Add.Public.Key.Alias", "Aggiungi alias chiave pubblica"},
- {"Remove.Public.Key.Alias", "Rimuovi alias chiave pubblica"},
- {"File", "&File"},
- {"KeyStore", "&Keystore"},
- {"Policy.File.", "File dei criteri:"},
- {"Could.not.open.policy.file.policyFile.e.toString.",
- "Impossibile aprire il file di criteri {0}: {1}"},
- {"Policy.Tool", "Strumento criteri"},
- {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
- "Si sono verificati errori durante l'apertura della configurazione dei criteri. Consultare il registro delle avvertenze per ulteriori informazioni."},
- {"Error", "Errore"},
- {"OK", "OK"},
- {"Status", "Stato"},
- {"Warning", "Avvertenza"},
- {"Permission.",
- "Autorizzazione: "},
- {"Principal.Type.", "Tipo principal:"},
- {"Principal.Name.", "Nome principal:"},
- {"Target.Name.",
- "Nome destinazione: "},
- {"Actions.",
- "Azioni: "},
- {"OK.to.overwrite.existing.file.filename.",
- "OK per sovrascrivere il file {0}?"},
- {"Cancel", "Annulla"},
- {"CodeBase.", "&CodeBase:"},
- {"SignedBy.", "&SignedBy:"},
- {"Add.Principal", "&Aggiungi principal"},
- {"Edit.Principal", "&Modifica principal"},
- {"Remove.Principal", "&Rimuovi principal"},
- {"Principals.", "&Principal:"},
- {".Add.Permission", " Aggiu&ngi autorizzazione"},
- {".Edit.Permission", " Mo&difica autorizzazione"},
- {"Remove.Permission", "R&imuovi autorizzazione"},
- {"Done", "Fine"},
- {"KeyStore.URL.", "&URL keystore:"},
- {"KeyStore.Type.", "&Tipo keystore:"},
- {"KeyStore.Provider.", "Pro&vider keystore:"},
- {"KeyStore.Password.URL.", "URL pass&word keystore:"},
- {"Principals", "Principal:"},
- {".Edit.Principal.", " Modifica principal:"},
- {".Add.New.Principal.", " Aggiungi nuovo principal:"},
- {"Permissions", "Autorizzazioni"},
- {".Edit.Permission.", " Modifica autorizzazione:"},
- {".Add.New.Permission.", " Aggiungi nuova autorizzazione:"},
- {"Signed.By.", "Firmato da:"},
- {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
- "Impossibile specificare principal con una classe carattere jolly senza un nome carattere jolly"},
- {"Cannot.Specify.Principal.without.a.Name",
- "Impossibile specificare principal senza un nome"},
- {"Permission.and.Target.Name.must.have.a.value",
- "L'autorizzazione e il nome destinazione non possono essere nulli"},
- {"Remove.this.Policy.Entry.", "Rimuovere questa voce dei criteri?"},
- {"Overwrite.File", "Sovrascrivi file"},
- {"Policy.successfully.written.to.filename",
- "I criteri sono stati scritti in {0}"},
- {"null.filename", "nome file nullo"},
- {"Save.changes.", "Salvare le modifiche?"},
- {"Yes", "&S\u00EC"},
- {"No", "&No"},
- {"Policy.Entry", "Voce dei criteri"},
- {"Save.Changes", "Salva le modifiche"},
- {"No.Policy.Entry.selected", "Nessuna voce dei criteri selezionata"},
- {"Unable.to.open.KeyStore.ex.toString.",
- "Impossibile aprire il keystore: {0}"},
- {"No.principal.selected", "Nessun principal selezionato"},
- {"No.permission.selected", "Nessuna autorizzazione selezionata"},
- {"name", "nome"},
- {"configuration.type", "tipo di configurazione"},
- {"environment.variable.name", "nome variabile ambiente"},
- {"library.name", "nome libreria"},
- {"package.name", "nome package"},
- {"policy.type", "tipo di criteri"},
- {"property.name", "nome propriet\u00E0"},
- {"provider.name", "nome provider"},
- {"url", "url"},
- {"method.list", "lista metodi"},
- {"request.headers.list", "lista intestazioni di richiesta"},
- {"Principal.List", "Lista principal"},
- {"Permission.List", "Lista autorizzazioni"},
- {"Code.Base", "Codebase"},
- {"KeyStore.U.R.L.", "URL keystore:"},
- {"KeyStore.Password.U.R.L.", "URL password keystore:"}
- };
-
-
- /**
- * Returns the contents of this <code>ResourceBundle</code>.
- *
- * <p>
- *
- * @return the contents of this <code>ResourceBundle</code>.
- */
- @Override
- public Object[][] getContents() {
- return contents;
- }
-}
--- a/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_ja.java Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2000, 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 sun.security.tools.policytool;
-
-/**
- * <p> This class represents the <code>ResourceBundle</code>
- * for the policytool.
- *
- */
-public class Resources_ja extends java.util.ListResourceBundle {
-
- private static final Object[][] contents = {
- {"NEWLINE", "\n"},
- {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
- "\u8B66\u544A: \u5225\u540D{0}\u306E\u516C\u958B\u9375\u304C\u5B58\u5728\u3057\u307E\u305B\u3093\u3002\u30AD\u30FC\u30B9\u30C8\u30A2\u304C\u6B63\u3057\u304F\u69CB\u6210\u3055\u308C\u3066\u3044\u308B\u3053\u3068\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002"},
- {"Warning.Class.not.found.class", "\u8B66\u544A: \u30AF\u30E9\u30B9\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: {0}"},
- {"Warning.Invalid.argument.s.for.constructor.arg",
- "\u8B66\u544A: \u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF\u306E\u5F15\u6570\u304C\u7121\u52B9\u3067\u3059: {0}"},
- {"Illegal.Principal.Type.type", "\u4E0D\u6B63\u306A\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u30BF\u30A4\u30D7: {0}"},
- {"Illegal.option.option", "\u4E0D\u6B63\u306A\u30AA\u30D7\u30B7\u30E7\u30F3: {0}"},
- {"Usage.policytool.options.", "\u4F7F\u7528\u65B9\u6CD5: policytool [options]"},
- {".file.file.policy.file.location",
- " [-file <file>] \u30DD\u30EA\u30B7\u30FC\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u5834\u6240"},
- {"New", "\u65B0\u898F(&N)"},
- {"Open", "\u958B\u304F(&O)..."},
- {"Save", "\u4FDD\u5B58(&S)"},
- {"Save.As", "\u5225\u540D\u4FDD\u5B58(&A)..."},
- {"View.Warning.Log", "\u8B66\u544A\u30ED\u30B0\u306E\u8868\u793A(&W)"},
- {"Exit", "\u7D42\u4E86(&X)"},
- {"Add.Policy.Entry", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30A8\u30F3\u30C8\u30EA\u306E\u8FFD\u52A0(&A)"},
- {"Edit.Policy.Entry", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30A8\u30F3\u30C8\u30EA\u306E\u7DE8\u96C6(&E)"},
- {"Remove.Policy.Entry", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30A8\u30F3\u30C8\u30EA\u306E\u524A\u9664(&R)"},
- {"Edit", "\u7DE8\u96C6(&E)"},
- {"Retain", "\u4FDD\u6301"},
-
- {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
- "\u8B66\u544A: \u30D5\u30A1\u30A4\u30EB\u540D\u306B\u30A8\u30B9\u30B1\u30FC\u30D7\u3055\u308C\u305F\u30D0\u30C3\u30AF\u30B9\u30E9\u30C3\u30B7\u30E5\u6587\u5B57\u304C\u542B\u307E\u308C\u3066\u3044\u308B\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002\u30D0\u30C3\u30AF\u30B9\u30E9\u30C3\u30B7\u30E5\u6587\u5B57\u3092\u30A8\u30B9\u30B1\u30FC\u30D7\u3059\u308B\u5FC5\u8981\u306F\u3042\u308A\u307E\u305B\u3093(\u30C4\u30FC\u30EB\u306F\u30DD\u30EA\u30B7\u30FC\u5185\u5BB9\u3092\u6C38\u7D9A\u30B9\u30C8\u30A2\u306B\u66F8\u304D\u8FBC\u3080\u3068\u304D\u306B\u3001\u5FC5\u8981\u306B\u5FDC\u3058\u3066\u6587\u5B57\u3092\u30A8\u30B9\u30B1\u30FC\u30D7\u3057\u307E\u3059)\u3002\n\n\u5165\u529B\u6E08\u306E\u540D\u524D\u3092\u4FDD\u6301\u3059\u308B\u306B\u306F\u300C\u4FDD\u6301\u300D\u3092\u30AF\u30EA\u30C3\u30AF\u3057\u3001\u540D\u524D\u3092\u7DE8\u96C6\u3059\u308B\u306B\u306F\u300C\u7DE8\u96C6\u300D\u3092\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u304F\u3060\u3055\u3044\u3002"},
-
- {"Add.Public.Key.Alias", "\u516C\u958B\u9375\u306E\u5225\u540D\u306E\u8FFD\u52A0"},
- {"Remove.Public.Key.Alias", "\u516C\u958B\u9375\u306E\u5225\u540D\u3092\u524A\u9664"},
- {"File", "\u30D5\u30A1\u30A4\u30EB(&F)"},
- {"KeyStore", "\u30AD\u30FC\u30B9\u30C8\u30A2(&K)"},
- {"Policy.File.", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30D5\u30A1\u30A4\u30EB:"},
- {"Could.not.open.policy.file.policyFile.e.toString.",
- "\u30DD\u30EA\u30B7\u30FC\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u958B\u3051\u307E\u305B\u3093\u3067\u3057\u305F: {0}: {1}"},
- {"Policy.Tool", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30C4\u30FC\u30EB"},
- {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
- "\u30DD\u30EA\u30B7\u30FC\u69CB\u6210\u3092\u958B\u304F\u3068\u304D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u8A73\u7D30\u306F\u8B66\u544A\u30ED\u30B0\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002"},
- {"Error", "\u30A8\u30E9\u30FC"},
- {"OK", "OK"},
- {"Status", "\u72B6\u614B"},
- {"Warning", "\u8B66\u544A"},
- {"Permission.",
- "\u30A2\u30AF\u30BB\u30B9\u6A29: "},
- {"Principal.Type.", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u30BF\u30A4\u30D7:"},
- {"Principal.Name.", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u540D\u524D:"},
- {"Target.Name.",
- "\u30BF\u30FC\u30B2\u30C3\u30C8\u540D: "},
- {"Actions.",
- "\u30A2\u30AF\u30B7\u30E7\u30F3: "},
- {"OK.to.overwrite.existing.file.filename.",
- "\u65E2\u5B58\u306E\u30D5\u30A1\u30A4\u30EB{0}\u306B\u4E0A\u66F8\u304D\u3057\u307E\u3059\u304B\u3002"},
- {"Cancel", "\u53D6\u6D88"},
- {"CodeBase.", "CodeBase(&C):"},
- {"SignedBy.", "SignedBy(&S):"},
- {"Add.Principal", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u8FFD\u52A0(&A)"},
- {"Edit.Principal", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u7DE8\u96C6(&E)"},
- {"Remove.Principal", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u524A\u9664(&R)"},
- {"Principals.", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB(&P):"},
- {".Add.Permission", " \u30A2\u30AF\u30BB\u30B9\u6A29\u306E\u8FFD\u52A0(&D)"},
- {".Edit.Permission", " \u30A2\u30AF\u30BB\u30B9\u6A29\u306E\u7DE8\u96C6(&I)"},
- {"Remove.Permission", "\u30A2\u30AF\u30BB\u30B9\u6A29\u306E\u524A\u9664(&M)"},
- {"Done", "\u5B8C\u4E86"},
- {"KeyStore.URL.", "\u30AD\u30FC\u30B9\u30C8\u30A2URL(&U):"},
- {"KeyStore.Type.", "\u30AD\u30FC\u30B9\u30C8\u30A2\u306E\u30BF\u30A4\u30D7(&T):"},
- {"KeyStore.Provider.", "\u30AD\u30FC\u30B9\u30C8\u30A2\u30FB\u30D7\u30ED\u30D0\u30A4\u30C0(&P):"},
- {"KeyStore.Password.URL.", "\u30AD\u30FC\u30B9\u30C8\u30A2\u30FB\u30D1\u30B9\u30EF\u30FC\u30C9URL(&W):"},
- {"Principals", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB"},
- {".Edit.Principal.", " \u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u7DE8\u96C6:"},
- {".Add.New.Principal.", " \u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u65B0\u898F\u8FFD\u52A0:"},
- {"Permissions", "\u30A2\u30AF\u30BB\u30B9\u6A29"},
- {".Edit.Permission.", " \u30A2\u30AF\u30BB\u30B9\u6A29\u306E\u7DE8\u96C6:"},
- {".Add.New.Permission.", " \u65B0\u898F\u30A2\u30AF\u30BB\u30B9\u6A29\u306E\u8FFD\u52A0:"},
- {"Signed.By.", "\u7F72\u540D\u8005:"},
- {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
- "\u30EF\u30A4\u30EB\u30C9\u30AB\u30FC\u30C9\u540D\u306E\u306A\u3044\u30EF\u30A4\u30EB\u30C9\u30AB\u30FC\u30C9\u30FB\u30AF\u30E9\u30B9\u3092\u4F7F\u7528\u3057\u3066\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u3092\u6307\u5B9A\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093"},
- {"Cannot.Specify.Principal.without.a.Name",
- "\u540D\u524D\u3092\u4F7F\u7528\u305B\u305A\u306B\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u3092\u6307\u5B9A\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093"},
- {"Permission.and.Target.Name.must.have.a.value",
- "\u30A2\u30AF\u30BB\u30B9\u6A29\u3068\u30BF\u30FC\u30B2\u30C3\u30C8\u540D\u306F\u3001\u5024\u3092\u4FDD\u6301\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059"},
- {"Remove.this.Policy.Entry.", "\u3053\u306E\u30DD\u30EA\u30B7\u30FC\u30FB\u30A8\u30F3\u30C8\u30EA\u3092\u524A\u9664\u3057\u307E\u3059\u304B\u3002"},
- {"Overwrite.File", "\u30D5\u30A1\u30A4\u30EB\u3092\u4E0A\u66F8\u304D\u3057\u307E\u3059"},
- {"Policy.successfully.written.to.filename",
- "\u30DD\u30EA\u30B7\u30FC\u306E{0}\u3078\u306E\u66F8\u8FBC\u307F\u306B\u6210\u529F\u3057\u307E\u3057\u305F"},
- {"null.filename", "\u30D5\u30A1\u30A4\u30EB\u540D\u304Cnull\u3067\u3059"},
- {"Save.changes.", "\u5909\u66F4\u3092\u4FDD\u5B58\u3057\u307E\u3059\u304B\u3002"},
- {"Yes", "\u306F\u3044(&Y)"},
- {"No", "\u3044\u3044\u3048(&N)"},
- {"Policy.Entry", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30A8\u30F3\u30C8\u30EA"},
- {"Save.Changes", "\u5909\u66F4\u3092\u4FDD\u5B58\u3057\u307E\u3059"},
- {"No.Policy.Entry.selected", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30A8\u30F3\u30C8\u30EA\u304C\u9078\u629E\u3055\u308C\u3066\u3044\u307E\u305B\u3093"},
- {"Unable.to.open.KeyStore.ex.toString.",
- "\u30AD\u30FC\u30B9\u30C8\u30A2{0}\u3092\u958B\u3051\u307E\u305B\u3093"},
- {"No.principal.selected", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u304C\u9078\u629E\u3055\u308C\u3066\u3044\u307E\u305B\u3093"},
- {"No.permission.selected", "\u30A2\u30AF\u30BB\u30B9\u6A29\u304C\u9078\u629E\u3055\u308C\u3066\u3044\u307E\u305B\u3093"},
- {"name", "\u540D\u524D"},
- {"configuration.type", "\u69CB\u6210\u30BF\u30A4\u30D7"},
- {"environment.variable.name", "\u74B0\u5883\u5909\u6570\u540D"},
- {"library.name", "\u30E9\u30A4\u30D6\u30E9\u30EA\u540D"},
- {"package.name", "\u30D1\u30C3\u30B1\u30FC\u30B8\u540D"},
- {"policy.type", "\u30DD\u30EA\u30B7\u30FC\u30FB\u30BF\u30A4\u30D7"},
- {"property.name", "\u30D7\u30ED\u30D1\u30C6\u30A3\u540D"},
- {"provider.name", "\u30D7\u30ED\u30D0\u30A4\u30C0\u540D"},
- {"url", "URL"},
- {"method.list", "\u30E1\u30BD\u30C3\u30C9\u30FB\u30EA\u30B9\u30C8"},
- {"request.headers.list", "\u30EA\u30AF\u30A8\u30B9\u30C8\u30FB\u30D8\u30C3\u30C0\u30FC\u30FB\u30EA\u30B9\u30C8"},
- {"Principal.List", "\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u306E\u30EA\u30B9\u30C8"},
- {"Permission.List", "\u30A2\u30AF\u30BB\u30B9\u6A29\u306E\u30EA\u30B9\u30C8"},
- {"Code.Base", "\u30B3\u30FC\u30C9\u30FB\u30D9\u30FC\u30B9"},
- {"KeyStore.U.R.L.", "\u30AD\u30FC\u30B9\u30C8\u30A2U R L:"},
- {"KeyStore.Password.U.R.L.", "\u30AD\u30FC\u30B9\u30C8\u30A2\u30FB\u30D1\u30B9\u30EF\u30FC\u30C9U R L:"}
- };
-
-
- /**
- * Returns the contents of this <code>ResourceBundle</code>.
- *
- * <p>
- *
- * @return the contents of this <code>ResourceBundle</code>.
- */
- @Override
- public Object[][] getContents() {
- return contents;
- }
-}
--- a/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_ko.java Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2000, 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 sun.security.tools.policytool;
-
-/**
- * <p> This class represents the <code>ResourceBundle</code>
- * for the policytool.
- *
- */
-public class Resources_ko extends java.util.ListResourceBundle {
-
- private static final Object[][] contents = {
- {"NEWLINE", "\n"},
- {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
- "\uACBD\uACE0: {0} \uBCC4\uCE6D\uC5D0 \uB300\uD55C \uACF5\uC6A9 \uD0A4\uAC00 \uC874\uC7AC\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. \uD0A4 \uC800\uC7A5\uC18C\uAC00 \uC81C\uB300\uB85C \uAD6C\uC131\uB418\uC5B4 \uC788\uB294\uC9C0 \uD655\uC778\uD558\uC2ED\uC2DC\uC624."},
- {"Warning.Class.not.found.class", "\uACBD\uACE0: \uD074\uB798\uC2A4\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC74C: {0}"},
- {"Warning.Invalid.argument.s.for.constructor.arg",
- "\uACBD\uACE0: \uC0DD\uC131\uC790\uC5D0 \uB300\uD574 \uBD80\uC801\uD569\uD55C \uC778\uC218: {0}"},
- {"Illegal.Principal.Type.type", "\uC798\uBABB\uB41C \uC8FC\uCCB4 \uC720\uD615: {0}"},
- {"Illegal.option.option", "\uC798\uBABB\uB41C \uC635\uC158: {0}"},
- {"Usage.policytool.options.", "\uC0AC\uC6A9\uBC95: policytool [options]"},
- {".file.file.policy.file.location",
- " [-file <file>] \uC815\uCC45 \uD30C\uC77C \uC704\uCE58"},
- {"New", "\uC0C8\uB85C \uB9CC\uB4E4\uAE30(&N)"},
- {"Open", "\uC5F4\uAE30(&O)..."},
- {"Save", "\uC800\uC7A5(&S)"},
- {"Save.As", "\uB2E4\uB978 \uC774\uB984\uC73C\uB85C \uC800\uC7A5(&A)..."},
- {"View.Warning.Log", "\uACBD\uACE0 \uB85C\uADF8 \uBCF4\uAE30(&W)"},
- {"Exit", "\uC885\uB8CC(&X)"},
- {"Add.Policy.Entry", "\uC815\uCC45 \uD56D\uBAA9 \uCD94\uAC00(&A)"},
- {"Edit.Policy.Entry", "\uC815\uCC45 \uD56D\uBAA9 \uD3B8\uC9D1(&E)"},
- {"Remove.Policy.Entry", "\uC815\uCC45 \uD56D\uBAA9 \uC81C\uAC70(&R)"},
- {"Edit", "\uD3B8\uC9D1(&E)"},
- {"Retain", "\uC720\uC9C0"},
-
- {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
- "\uACBD\uACE0: \uD30C\uC77C \uC774\uB984\uC5D0 \uC774\uC2A4\uCF00\uC774\uD504\uB41C \uBC31\uC2AC\uB798\uC2DC \uBB38\uC790\uAC00 \uD3EC\uD568\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4. \uBC31\uC2AC\uB798\uC2DC \uBB38\uC790\uB294 \uC774\uC2A4\uCF00\uC774\uD504\uD560 \uD544\uC694\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4. \uC601\uAD6C \uC800\uC7A5\uC18C\uC5D0 \uC815\uCC45 \uCF58\uD150\uCE20\uB97C \uC4F8 \uB54C \uD544\uC694\uC5D0 \uB530\uB77C \uC790\uB3D9\uC73C\uB85C \uBB38\uC790\uAC00 \uC774\uC2A4\uCF00\uC774\uD504\uB429\uB2C8\uB2E4.\n\n\uC785\uB825\uB41C \uC774\uB984\uC744 \uADF8\uB300\uB85C \uC720\uC9C0\uD558\uB824\uBA74 [\uC720\uC9C0]\uB97C \uB204\uB974\uACE0, \uC774\uB984\uC744 \uD3B8\uC9D1\uD558\uB824\uBA74 [\uD3B8\uC9D1]\uC744 \uB204\uB974\uC2ED\uC2DC\uC624."},
-
- {"Add.Public.Key.Alias", "\uACF5\uC6A9 \uD0A4 \uBCC4\uCE6D \uCD94\uAC00"},
- {"Remove.Public.Key.Alias", "\uACF5\uC6A9 \uD0A4 \uBCC4\uCE6D \uC81C\uAC70"},
- {"File", "\uD30C\uC77C(&F)"},
- {"KeyStore", "\uD0A4 \uC800\uC7A5\uC18C(&K)"},
- {"Policy.File.", "\uC815\uCC45 \uD30C\uC77C:"},
- {"Could.not.open.policy.file.policyFile.e.toString.",
- "\uC815\uCC45 \uD30C\uC77C\uC744 \uC5F4 \uC218 \uC5C6\uC74C: {0}: {1}"},
- {"Policy.Tool", "\uC815\uCC45 \uD234"},
- {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
- "\uC815\uCC45 \uAD6C\uC131\uC744 \uC5EC\uB294 \uC911 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. \uC790\uC138\uD55C \uB0B4\uC6A9\uC740 \uACBD\uACE0 \uB85C\uADF8\uB97C \uD655\uC778\uD558\uC2ED\uC2DC\uC624."},
- {"Error", "\uC624\uB958"},
- {"OK", "\uD655\uC778"},
- {"Status", "\uC0C1\uD0DC"},
- {"Warning", "\uACBD\uACE0"},
- {"Permission.",
- "\uAD8C\uD55C: "},
- {"Principal.Type.", "\uC8FC\uCCB4 \uC720\uD615:"},
- {"Principal.Name.", "\uC8FC\uCCB4 \uC774\uB984:"},
- {"Target.Name.",
- "\uB300\uC0C1 \uC774\uB984: "},
- {"Actions.",
- "\uC791\uC5C5: "},
- {"OK.to.overwrite.existing.file.filename.",
- "\uAE30\uC874 \uD30C\uC77C {0}\uC744(\uB97C) \uACB9\uCCD0 \uC4F0\uACA0\uC2B5\uB2C8\uAE4C?"},
- {"Cancel", "\uCDE8\uC18C"},
- {"CodeBase.", "CodeBase(&C)"},
- {"SignedBy.", "SignedBy(&S):"},
- {"Add.Principal", "\uC8FC\uCCB4 \uCD94\uAC00(&A)"},
- {"Edit.Principal", "\uC8FC\uCCB4 \uD3B8\uC9D1(&E)"},
- {"Remove.Principal", "\uC8FC\uCCB4 \uC81C\uAC70(&R)"},
- {"Principals.", "\uC8FC\uCCB4(&P):"},
- {".Add.Permission", " \uAD8C\uD55C \uCD94\uAC00(&D)"},
- {".Edit.Permission", " \uAD8C\uD55C \uD3B8\uC9D1(&I)"},
- {"Remove.Permission", "\uAD8C\uD55C \uC81C\uAC70(&M)"},
- {"Done", "\uC644\uB8CC"},
- {"KeyStore.URL.", "\uD0A4 \uC800\uC7A5\uC18C URL(&U):"},
- {"KeyStore.Type.", "\uD0A4 \uC800\uC7A5\uC18C \uC720\uD615(&T):"},
- {"KeyStore.Provider.", "\uD0A4 \uC800\uC7A5\uC18C \uC81C\uACF5\uC790(&P):"},
- {"KeyStore.Password.URL.", "\uD0A4 \uC800\uC7A5\uC18C \uBE44\uBC00\uBC88\uD638 URL(&W):"},
- {"Principals", "\uC8FC\uCCB4"},
- {".Edit.Principal.", " \uC8FC\uCCB4 \uD3B8\uC9D1:"},
- {".Add.New.Principal.", " \uC0C8 \uC8FC\uCCB4 \uCD94\uAC00:"},
- {"Permissions", "\uAD8C\uD55C"},
- {".Edit.Permission.", " \uAD8C\uD55C \uD3B8\uC9D1:"},
- {".Add.New.Permission.", " \uC0C8 \uAD8C\uD55C \uCD94\uAC00:"},
- {"Signed.By.", "\uC11C\uBA85\uC790:"},
- {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
- "\uC640\uC77C\uB4DC \uCE74\uB4DC \uBB38\uC790 \uC774\uB984 \uC5C6\uC774 \uC640\uC77C\uB4DC \uCE74\uB4DC \uBB38\uC790 \uD074\uB798\uC2A4\uB97C \uC0AC\uC6A9\uD558\uB294 \uC8FC\uCCB4\uB97C \uC9C0\uC815\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."},
- {"Cannot.Specify.Principal.without.a.Name",
- "\uC774\uB984 \uC5C6\uC774 \uC8FC\uCCB4\uB97C \uC9C0\uC815\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."},
- {"Permission.and.Target.Name.must.have.a.value",
- "\uAD8C\uD55C\uACFC \uB300\uC0C1 \uC774\uB984\uC758 \uAC12\uC774 \uC788\uC5B4\uC57C \uD569\uB2C8\uB2E4."},
- {"Remove.this.Policy.Entry.", "\uC774 \uC815\uCC45 \uD56D\uBAA9\uC744 \uC81C\uAC70\uD558\uACA0\uC2B5\uB2C8\uAE4C?"},
- {"Overwrite.File", "\uD30C\uC77C \uACB9\uCCD0\uC4F0\uAE30"},
- {"Policy.successfully.written.to.filename",
- "{0}\uC5D0 \uC131\uACF5\uC801\uC73C\uB85C \uC815\uCC45\uC744 \uC37C\uC2B5\uB2C8\uB2E4."},
- {"null.filename", "\uB110 \uD30C\uC77C \uC774\uB984"},
- {"Save.changes.", "\uBCC0\uACBD\uC0AC\uD56D\uC744 \uC800\uC7A5\uD558\uACA0\uC2B5\uB2C8\uAE4C?"},
- {"Yes", "\uC608(&Y)"},
- {"No", "\uC544\uB2C8\uC624(&N)"},
- {"Policy.Entry", "\uC815\uCC45 \uD56D\uBAA9"},
- {"Save.Changes", "\uBCC0\uACBD\uC0AC\uD56D \uC800\uC7A5"},
- {"No.Policy.Entry.selected", "\uC120\uD0DD\uB41C \uC815\uCC45 \uD56D\uBAA9\uC774 \uC5C6\uC2B5\uB2C8\uB2E4."},
- {"Unable.to.open.KeyStore.ex.toString.",
- "\uD0A4 \uC800\uC7A5\uC18C\uB97C \uC5F4 \uC218 \uC5C6\uC74C: {0}"},
- {"No.principal.selected", "\uC120\uD0DD\uB41C \uC8FC\uCCB4\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4."},
- {"No.permission.selected", "\uC120\uD0DD\uB41C \uAD8C\uD55C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4."},
- {"name", "\uC774\uB984"},
- {"configuration.type", "\uAD6C\uC131 \uC720\uD615"},
- {"environment.variable.name", "\uD658\uACBD \uBCC0\uC218 \uC774\uB984"},
- {"library.name", "\uB77C\uC774\uBE0C\uB7EC\uB9AC \uC774\uB984"},
- {"package.name", "\uD328\uD0A4\uC9C0 \uC774\uB984"},
- {"policy.type", "\uC815\uCC45 \uC720\uD615"},
- {"property.name", "\uC18D\uC131 \uC774\uB984"},
- {"provider.name", "\uC81C\uACF5\uC790 \uC774\uB984"},
- {"url", "URL"},
- {"method.list", "\uBA54\uC18C\uB4DC \uBAA9\uB85D"},
- {"request.headers.list", "\uC694\uCCAD \uD5E4\uB354 \uBAA9\uB85D"},
- {"Principal.List", "\uC8FC\uCCB4 \uBAA9\uB85D"},
- {"Permission.List", "\uAD8C\uD55C \uBAA9\uB85D"},
- {"Code.Base", "\uCF54\uB4DC \uBCA0\uC774\uC2A4"},
- {"KeyStore.U.R.L.", "\uD0A4 \uC800\uC7A5\uC18C URL:"},
- {"KeyStore.Password.U.R.L.", "\uD0A4 \uC800\uC7A5\uC18C \uBE44\uBC00\uBC88\uD638 URL:"}
- };
-
-
- /**
- * Returns the contents of this <code>ResourceBundle</code>.
- *
- * <p>
- *
- * @return the contents of this <code>ResourceBundle</code>.
- */
- @Override
- public Object[][] getContents() {
- return contents;
- }
-}
--- a/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_pt_BR.java Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2000, 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 sun.security.tools.policytool;
-
-/**
- * <p> This class represents the <code>ResourceBundle</code>
- * for the policytool.
- *
- */
-public class Resources_pt_BR extends java.util.ListResourceBundle {
-
- private static final Object[][] contents = {
- {"NEWLINE", "\n"},
- {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
- "Advert\u00EAncia: N\u00E3o existe uma chave p\u00FAblica para o alias {0}. Certifique-se de que um KeyStore esteja configurado adequadamente."},
- {"Warning.Class.not.found.class", "Advert\u00EAncia: Classe n\u00E3o encontrada: {0}"},
- {"Warning.Invalid.argument.s.for.constructor.arg",
- "Advert\u00EAncia: Argumento(s) inv\u00E1lido(s) para o construtor: {0}"},
- {"Illegal.Principal.Type.type", "Tipo Principal Inv\u00E1lido: {0}"},
- {"Illegal.option.option", "Op\u00E7\u00E3o inv\u00E1lida: {0}"},
- {"Usage.policytool.options.", "Uso: policytool [op\u00E7\u00F5es]"},
- {".file.file.policy.file.location",
- " [-file <arquivo>] localiza\u00E7\u00E3o do arquivo de pol\u00EDtica"},
- {"New", "&Novo"},
- {"Open", "&Abrir..."},
- {"Save", "&Salvar"},
- {"Save.As", "Salvar c&omo..."},
- {"View.Warning.Log", "E&xibir Log de Advert\u00EAncias"},
- {"Exit", "S&air"},
- {"Add.Policy.Entry", "&Adicionar Entrada de Pol\u00EDtica"},
- {"Edit.Policy.Entry", "&Editar Entrada de Pol\u00EDtica"},
- {"Remove.Policy.Entry", "&Remover Entrada de Pol\u00EDtica"},
- {"Edit", "&Editar"},
- {"Retain", "Reter"},
-
- {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
- "Advert\u00EAncia: O nome do arquivo pode conter caracteres de escape barra invertida. N\u00E3o \u00E9 necess\u00E1rio fazer o escape dos caracteres de barra invertida (a ferramenta faz o escape dos caracteres conforme necess\u00E1rio ao gravar o conte\u00FAdo da pol\u00EDtica no armazenamento persistente).\n\nClique em Reter para reter o nome da entrada ou clique em Editar para edit\u00E1-lo."},
-
- {"Add.Public.Key.Alias", "Adicionar Alias de Chave P\u00FAblica"},
- {"Remove.Public.Key.Alias", "Remover Alias de Chave P\u00FAblica"},
- {"File", "&Arquivo"},
- {"KeyStore", "&KeyStore"},
- {"Policy.File.", "Arquivo de Pol\u00EDtica:"},
- {"Could.not.open.policy.file.policyFile.e.toString.",
- "N\u00E3o foi poss\u00EDvel abrir o arquivo de pol\u00EDtica: {0}: {1}"},
- {"Policy.Tool", "Ferramenta de Pol\u00EDtica"},
- {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
- "Erros durante a abertura da configura\u00E7\u00E3o da pol\u00EDtica. Consulte o Log de Advert\u00EAncias para obter mais informa\u00E7\u00F5es."},
- {"Error", "Erro"},
- {"OK", "OK"},
- {"Status", "Status"},
- {"Warning", "Advert\u00EAncia"},
- {"Permission.",
- "Permiss\u00E3o: "},
- {"Principal.Type.", "Tipo do Principal:"},
- {"Principal.Name.", "Nome do Principal:"},
- {"Target.Name.",
- "Nome do Alvo: "},
- {"Actions.",
- "A\u00E7\u00F5es: "},
- {"OK.to.overwrite.existing.file.filename.",
- "Est\u00E1 correto substituir o arquivo existente {0}?"},
- {"Cancel", "Cancelar"},
- {"CodeBase.", "&CodeBase:"},
- {"SignedBy.", "&SignedBy:"},
- {"Add.Principal", "&Adicionar Principal"},
- {"Edit.Principal", "&Editar Principal"},
- {"Remove.Principal", "&Remover Principal"},
- {"Principals.", "&Principais:"},
- {".Add.Permission", " A&dicionar Permiss\u00E3o"},
- {".Edit.Permission", " Ed&itar Permiss\u00E3o"},
- {"Remove.Permission", "Re&mover Permiss\u00E3o"},
- {"Done", "Conclu\u00EDdo"},
- {"KeyStore.URL.", "&URL do KeyStore:"},
- {"KeyStore.Type.", "&Tipo de KeyStore:"},
- {"KeyStore.Provider.", "&Fornecedor de KeyStore:"},
- {"KeyStore.Password.URL.", "URL da Senha do Ke&yStore:"},
- {"Principals", "Principais"},
- {".Edit.Principal.", " Editar Principal:"},
- {".Add.New.Principal.", " Adicionar Novo Principal:"},
- {"Permissions", "Permiss\u00F5es"},
- {".Edit.Permission.", " Editar Permiss\u00E3o:"},
- {".Add.New.Permission.", " Adicionar Nova Permiss\u00E3o:"},
- {"Signed.By.", "Assinado por:"},
- {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
- "N\u00E3o \u00E9 Poss\u00EDvel Especificar um Principal com uma Classe de Curinga sem um Nome de Curinga"},
- {"Cannot.Specify.Principal.without.a.Name",
- "N\u00E3o \u00E9 Poss\u00EDvel Especificar um Principal sem um Nome"},
- {"Permission.and.Target.Name.must.have.a.value",
- "O Nome de Destino e a Permiss\u00E3o devem ter um Valor"},
- {"Remove.this.Policy.Entry.", "Remover esta Entrada de Pol\u00EDtica?"},
- {"Overwrite.File", "Substituir Arquivo"},
- {"Policy.successfully.written.to.filename",
- "Pol\u00EDtica gravada com \u00EAxito em {0}"},
- {"null.filename", "nome de arquivo nulo"},
- {"Save.changes.", "Salvar altera\u00E7\u00F5es?"},
- {"Yes", "&Sim"},
- {"No", "&N\u00E3o"},
- {"Policy.Entry", "Entrada de Pol\u00EDtica"},
- {"Save.Changes", "Salvar Altera\u00E7\u00F5es"},
- {"No.Policy.Entry.selected", "Nenhuma Entrada de Pol\u00EDtica Selecionada"},
- {"Unable.to.open.KeyStore.ex.toString.",
- "N\u00E3o \u00E9 poss\u00EDvel abrir a KeyStore: {0}"},
- {"No.principal.selected", "Nenhum principal selecionado"},
- {"No.permission.selected", "Nenhuma permiss\u00E3o selecionada"},
- {"name", "nome"},
- {"configuration.type", "tipo de configura\u00E7\u00E3o"},
- {"environment.variable.name", "nome da vari\u00E1vel de ambiente"},
- {"library.name", "nome da biblioteca"},
- {"package.name", "nome do pacote"},
- {"policy.type", "tipo de pol\u00EDtica"},
- {"property.name", "nome da propriedade"},
- {"provider.name", "nome do fornecedor"},
- {"url", "url"},
- {"method.list", "lista de m\u00E9todos"},
- {"request.headers.list", "solicitar lista de cabe\u00E7alhos"},
- {"Principal.List", "Lista de Principais"},
- {"Permission.List", "Lista de Permiss\u00F5es"},
- {"Code.Base", "Base de C\u00F3digo"},
- {"KeyStore.U.R.L.", "U R L da KeyStore:"},
- {"KeyStore.Password.U.R.L.", "U R L da Senha do KeyStore:"}
- };
-
-
- /**
- * Returns the contents of this <code>ResourceBundle</code>.
- *
- * <p>
- *
- * @return the contents of this <code>ResourceBundle</code>.
- */
- @Override
- public Object[][] getContents() {
- return contents;
- }
-}
--- a/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_sv.java Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-/*
- * 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.security.tools.policytool;
-
-/**
- * <p> This class represents the <code>ResourceBundle</code>
- * for the policytool.
- *
- */
-public class Resources_sv extends java.util.ListResourceBundle {
-
- private static final Object[][] contents = {
- {"NEWLINE", "\n"},
- {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
- "Varning! Det finns ingen \u00F6ppen nyckel f\u00F6r aliaset {0}. Kontrollera att det aktuella nyckellagret \u00E4r korrekt konfigurerat."},
- {"Warning.Class.not.found.class", "Varning! Klassen hittades inte: {0}"},
- {"Warning.Invalid.argument.s.for.constructor.arg",
- "Varning! Ogiltiga argument f\u00F6r konstruktor: {0}"},
- {"Illegal.Principal.Type.type", "Otill\u00E5ten identitetshavaretyp: {0}"},
- {"Illegal.option.option", "Otill\u00E5tet alternativ: {0}"},
- {"Usage.policytool.options.", "Syntax: policytool [alternativ]"},
- {".file.file.policy.file.location",
- " [-file <fil>] policyfiladress"},
- {"New", "&Nytt"},
- {"Open", "&\u00D6ppna..."},
- {"Save", "S¶"},
- {"Save.As", "Spara &som..."},
- {"View.Warning.Log", "Visa varningslo&gg"},
- {"Exit", "A&vsluta"},
- {"Add.Policy.Entry", "&L\u00E4gg till policypost"},
- {"Edit.Policy.Entry", "&Redigera policypost"},
- {"Remove.Policy.Entry", "&Ta bort policypost"},
- {"Edit", "&Redigera"},
- {"Retain", "Beh\u00E5ll"},
-
- {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
- "Varning! Filnamnet kan inneh\u00E5lla omv\u00E4nda snedstreck inom citattecken. Citattecken kr\u00E4vs inte f\u00F6r omv\u00E4nda snedstreck (verktyget hanterar detta n\u00E4r policyinneh\u00E5llet skrivs till det best\u00E4ndiga lagret).\n\nKlicka p\u00E5 Beh\u00E5ll f\u00F6r att beh\u00E5lla det angivna namnet, eller klicka p\u00E5 Redigera f\u00F6r att \u00E4ndra det."},
-
- {"Add.Public.Key.Alias", "L\u00E4gg till alias till \u00F6ppen nyckel"},
- {"Remove.Public.Key.Alias", "Ta bort alias f\u00F6r \u00F6ppen nyckel"},
- {"File", "&Arkiv"},
- {"KeyStore", "&KeyStore"},
- {"Policy.File.", "Policyfil:"},
- {"Could.not.open.policy.file.policyFile.e.toString.",
- "Kan inte \u00F6ppna policyfilen: {0}: {1}"},
- {"Policy.Tool", "Policyverktyg"},
- {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
- "Ett fel intr\u00E4ffade n\u00E4r policykonfigurationen skulle \u00F6ppnas. Se varningsloggen f\u00F6r mer information."},
- {"Error", "Fel"},
- {"OK", "OK"},
- {"Status", "Status"},
- {"Warning", "Varning"},
- {"Permission.",
- "Beh\u00F6righet: "},
- {"Principal.Type.", "Identitetshavaretyp:"},
- {"Principal.Name.", "Identitetshavare:"},
- {"Target.Name.",
- "M\u00E5l: "},
- {"Actions.",
- "\u00C5tg\u00E4rder: "},
- {"OK.to.overwrite.existing.file.filename.",
- "Ska den befintliga filen {0} skrivas \u00F6ver?"},
- {"Cancel", "Avbryt"},
- {"CodeBase.", "&CodeBase:"},
- {"SignedBy.", "&SignedBy:"},
- {"Add.Principal", "&L\u00E4gg till identitetshavare"},
- {"Edit.Principal", "&Redigera identitetshavare"},
- {"Remove.Principal", "&Ta bort identitetshavare"},
- {"Principals.", "Identitetshavare:"},
- {".Add.Permission", " L&\u00E4gg till beh\u00F6righet"},
- {".Edit.Permission", " Re&digera beh\u00F6righet"},
- {"Remove.Permission", "Ta &bort beh\u00F6righet"},
- {"Done", "Utf\u00F6rd"},
- {"KeyStore.URL.", "Nyckellager-&URL:"},
- {"KeyStore.Type.", "Nyckellager&typ:"},
- {"KeyStore.Provider.", "Nyckellager&leverant\u00F6r:"},
- {"KeyStore.Password.URL.", "L\u00F6sen&ords-URL till nyckellager:"},
- {"Principals", "Identitetshavare"},
- {".Edit.Principal.", " Redigera identitetshavare:"},
- {".Add.New.Principal.", " L\u00E4gg till ny identitetshavare:"},
- {"Permissions", "Beh\u00F6righeter"},
- {".Edit.Permission.", " Redigera beh\u00F6righet:"},
- {".Add.New.Permission.", " L\u00E4gg till ny beh\u00F6righet:"},
- {"Signed.By.", "Signerad av:"},
- {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
- "Kan inte specificera identitetshavare med jokerteckenklass utan jokerteckennamn"},
- {"Cannot.Specify.Principal.without.a.Name",
- "Kan inte specificera identitetshavare utan namn"},
- {"Permission.and.Target.Name.must.have.a.value",
- "Beh\u00F6righet och m\u00E5lnamn m\u00E5ste ha ett v\u00E4rde"},
- {"Remove.this.Policy.Entry.", "Vill du ta bort den h\u00E4r policyposten?"},
- {"Overwrite.File", "Skriv \u00F6ver fil"},
- {"Policy.successfully.written.to.filename",
- "Policy har skrivits till {0}"},
- {"null.filename", "nullfilnamn"},
- {"Save.changes.", "Vill du spara \u00E4ndringarna?"},
- {"Yes", "&Ja"},
- {"No", "&Nej"},
- {"Policy.Entry", "Policyfel"},
- {"Save.Changes", "Spara \u00E4ndringar"},
- {"No.Policy.Entry.selected", "Ingen policypost har valts"},
- {"Unable.to.open.KeyStore.ex.toString.",
- "Kan inte \u00F6ppna nyckellagret: {0}"},
- {"No.principal.selected", "Ingen identitetshavare har valts"},
- {"No.permission.selected", "Ingen beh\u00F6righet har valts"},
- {"name", "namn"},
- {"configuration.type", "konfigurationstyp"},
- {"environment.variable.name", "variabelnamn f\u00F6r milj\u00F6"},
- {"library.name", "biblioteksnamn"},
- {"package.name", "paketnamn"},
- {"policy.type", "policytyp"},
- {"property.name", "egenskapsnamn"},
- {"provider.name", "leverant\u00F6rsnamn"},
- {"url", "url"},
- {"method.list", "metodlista"},
- {"request.headers.list", "lista \u00F6ver beg\u00E4randehuvuden"},
- {"Principal.List", "Lista \u00F6ver identitetshavare"},
- {"Permission.List", "Beh\u00F6righetslista"},
- {"Code.Base", "Kodbas"},
- {"KeyStore.U.R.L.", "URL f\u00F6r nyckellager:"},
- {"KeyStore.Password.U.R.L.", "URL f\u00F6r l\u00F6senord till nyckellager:"}
- };
-
-
- /**
- * Returns the contents of this <code>ResourceBundle</code>.
- *
- * <p>
- *
- * @return the contents of this <code>ResourceBundle</code>.
- */
- @Override
- public Object[][] getContents() {
- return contents;
- }
-}
--- a/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_zh_CN.java Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2000, 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 sun.security.tools.policytool;
-
-/**
- * <p> This class represents the <code>ResourceBundle</code>
- * for the policytool.
- *
- */
-public class Resources_zh_CN extends java.util.ListResourceBundle {
-
- private static final Object[][] contents = {
- {"NEWLINE", "\n"},
- {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
- "\u8B66\u544A: \u522B\u540D {0} \u7684\u516C\u5171\u5BC6\u94A5\u4E0D\u5B58\u5728\u3002\u8BF7\u786E\u4FDD\u5DF2\u6B63\u786E\u914D\u7F6E\u5BC6\u94A5\u5E93\u3002"},
- {"Warning.Class.not.found.class", "\u8B66\u544A: \u627E\u4E0D\u5230\u7C7B: {0}"},
- {"Warning.Invalid.argument.s.for.constructor.arg",
- "\u8B66\u544A: \u6784\u9020\u5668\u7684\u53C2\u6570\u65E0\u6548: {0}"},
- {"Illegal.Principal.Type.type", "\u975E\u6CD5\u7684\u4E3B\u7528\u6237\u7C7B\u578B: {0}"},
- {"Illegal.option.option", "\u975E\u6CD5\u9009\u9879: {0}"},
- {"Usage.policytool.options.", "\u7528\u6CD5: policytool [\u9009\u9879]"},
- {".file.file.policy.file.location",
- " [-file <file>] \u7B56\u7565\u6587\u4EF6\u4F4D\u7F6E"},
- {"New", "\u65B0\u5EFA(&N)"},
- {"Open", "\u6253\u5F00(&O)..."},
- {"Save", "\u4FDD\u5B58(&S)"},
- {"Save.As", "\u53E6\u5B58\u4E3A(&A)..."},
- {"View.Warning.Log", "\u67E5\u770B\u8B66\u544A\u65E5\u5FD7(&W)"},
- {"Exit", "\u9000\u51FA(&X)"},
- {"Add.Policy.Entry", "\u6DFB\u52A0\u7B56\u7565\u6761\u76EE(&A)"},
- {"Edit.Policy.Entry", "\u7F16\u8F91\u7B56\u7565\u6761\u76EE(&E)"},
- {"Remove.Policy.Entry", "\u5220\u9664\u7B56\u7565\u6761\u76EE(&R)"},
- {"Edit", "\u7F16\u8F91(&E)"},
- {"Retain", "\u4FDD\u7559"},
-
- {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
- "\u8B66\u544A: \u6587\u4EF6\u540D\u5305\u542B\u8F6C\u4E49\u7684\u53CD\u659C\u6760\u5B57\u7B26\u3002\u4E0D\u9700\u8981\u5BF9\u53CD\u659C\u6760\u5B57\u7B26\u8FDB\u884C\u8F6C\u4E49 (\u8BE5\u5DE5\u5177\u5728\u5C06\u7B56\u7565\u5185\u5BB9\u5199\u5165\u6C38\u4E45\u5B58\u50A8\u65F6\u4F1A\u6839\u636E\u9700\u8981\u5BF9\u5B57\u7B26\u8FDB\u884C\u8F6C\u4E49)\u3002\n\n\u5355\u51FB\u201C\u4FDD\u7559\u201D\u53EF\u4FDD\u7559\u8F93\u5165\u7684\u540D\u79F0, \u6216\u8005\u5355\u51FB\u201C\u7F16\u8F91\u201D\u53EF\u7F16\u8F91\u8BE5\u540D\u79F0\u3002"},
-
- {"Add.Public.Key.Alias", "\u6DFB\u52A0\u516C\u5171\u5BC6\u94A5\u522B\u540D"},
- {"Remove.Public.Key.Alias", "\u5220\u9664\u516C\u5171\u5BC6\u94A5\u522B\u540D"},
- {"File", "\u6587\u4EF6(&F)"},
- {"KeyStore", "\u5BC6\u94A5\u5E93(&K)"},
- {"Policy.File.", "\u7B56\u7565\u6587\u4EF6:"},
- {"Could.not.open.policy.file.policyFile.e.toString.",
- "\u65E0\u6CD5\u6253\u5F00\u7B56\u7565\u6587\u4EF6: {0}: {1}"},
- {"Policy.Tool", "\u7B56\u7565\u5DE5\u5177"},
- {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
- "\u6253\u5F00\u7B56\u7565\u914D\u7F6E\u65F6\u51FA\u9519\u3002\u6709\u5173\u8BE6\u7EC6\u4FE1\u606F, \u8BF7\u67E5\u770B\u8B66\u544A\u65E5\u5FD7\u3002"},
- {"Error", "\u9519\u8BEF"},
- {"OK", "\u786E\u5B9A"},
- {"Status", "\u72B6\u6001"},
- {"Warning", "\u8B66\u544A"},
- {"Permission.",
- "\u6743\u9650: "},
- {"Principal.Type.", "\u4E3B\u7528\u6237\u7C7B\u578B:"},
- {"Principal.Name.", "\u4E3B\u7528\u6237\u540D\u79F0:"},
- {"Target.Name.",
- "\u76EE\u6807\u540D\u79F0: "},
- {"Actions.",
- "\u64CD\u4F5C: "},
- {"OK.to.overwrite.existing.file.filename.",
- "\u786E\u8BA4\u8986\u76D6\u73B0\u6709\u7684\u6587\u4EF6{0}?"},
- {"Cancel", "\u53D6\u6D88"},
- {"CodeBase.", "CodeBase(&C):"},
- {"SignedBy.", "SignedBy(&S):"},
- {"Add.Principal", "\u6DFB\u52A0\u4E3B\u7528\u6237(&A)"},
- {"Edit.Principal", "\u7F16\u8F91\u4E3B\u7528\u6237(&E)"},
- {"Remove.Principal", "\u5220\u9664\u4E3B\u7528\u6237(&R)"},
- {"Principals.", "\u4E3B\u7528\u6237(&P):"},
- {".Add.Permission", " \u6DFB\u52A0\u6743\u9650(&D)"},
- {".Edit.Permission", " \u7F16\u8F91\u6743\u9650(&I)"},
- {"Remove.Permission", "\u5220\u9664\u6743\u9650(&M)"},
- {"Done", "\u5B8C\u6210"},
- {"KeyStore.URL.", "\u5BC6\u94A5\u5E93 URL(&U):"},
- {"KeyStore.Type.", "\u5BC6\u94A5\u5E93\u7C7B\u578B(&T):"},
- {"KeyStore.Provider.", "\u5BC6\u94A5\u5E93\u63D0\u4F9B\u65B9(&P):"},
- {"KeyStore.Password.URL.", "\u5BC6\u94A5\u5E93\u53E3\u4EE4 URL(&W):"},
- {"Principals", "\u4E3B\u7528\u6237"},
- {".Edit.Principal.", " \u7F16\u8F91\u4E3B\u7528\u6237:"},
- {".Add.New.Principal.", " \u6DFB\u52A0\u65B0\u4E3B\u7528\u6237:"},
- {"Permissions", "\u6743\u9650"},
- {".Edit.Permission.", " \u7F16\u8F91\u6743\u9650:"},
- {".Add.New.Permission.", " \u52A0\u5165\u65B0\u7684\u6743\u9650:"},
- {"Signed.By.", "\u7B7E\u7F72\u4EBA: "},
- {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
- "\u6CA1\u6709\u901A\u914D\u7B26\u540D\u79F0, \u65E0\u6CD5\u4F7F\u7528\u901A\u914D\u7B26\u7C7B\u6307\u5B9A\u4E3B\u7528\u6237"},
- {"Cannot.Specify.Principal.without.a.Name",
- "\u6CA1\u6709\u540D\u79F0, \u65E0\u6CD5\u6307\u5B9A\u4E3B\u7528\u6237"},
- {"Permission.and.Target.Name.must.have.a.value",
- "\u6743\u9650\u53CA\u76EE\u6807\u540D\u5FC5\u987B\u6709\u4E00\u4E2A\u503C"},
- {"Remove.this.Policy.Entry.", "\u662F\u5426\u5220\u9664\u6B64\u7B56\u7565\u6761\u76EE?"},
- {"Overwrite.File", "\u8986\u76D6\u6587\u4EF6"},
- {"Policy.successfully.written.to.filename",
- "\u7B56\u7565\u5DF2\u6210\u529F\u5199\u5165\u5230{0}"},
- {"null.filename", "\u7A7A\u6587\u4EF6\u540D"},
- {"Save.changes.", "\u662F\u5426\u4FDD\u5B58\u6240\u505A\u7684\u66F4\u6539?"},
- {"Yes", "\u662F(&Y)"},
- {"No", "\u5426(&N)"},
- {"Policy.Entry", "\u7B56\u7565\u6761\u76EE"},
- {"Save.Changes", "\u4FDD\u5B58\u66F4\u6539"},
- {"No.Policy.Entry.selected", "\u6CA1\u6709\u9009\u62E9\u7B56\u7565\u6761\u76EE"},
- {"Unable.to.open.KeyStore.ex.toString.",
- "\u65E0\u6CD5\u6253\u5F00\u5BC6\u94A5\u5E93: {0}"},
- {"No.principal.selected", "\u672A\u9009\u62E9\u4E3B\u7528\u6237"},
- {"No.permission.selected", "\u6CA1\u6709\u9009\u62E9\u6743\u9650"},
- {"name", "\u540D\u79F0"},
- {"configuration.type", "\u914D\u7F6E\u7C7B\u578B"},
- {"environment.variable.name", "\u73AF\u5883\u53D8\u91CF\u540D"},
- {"library.name", "\u5E93\u540D\u79F0"},
- {"package.name", "\u7A0B\u5E8F\u5305\u540D\u79F0"},
- {"policy.type", "\u7B56\u7565\u7C7B\u578B"},
- {"property.name", "\u5C5E\u6027\u540D\u79F0"},
- {"provider.name", "\u63D0\u4F9B\u65B9\u540D\u79F0"},
- {"url", "URL"},
- {"method.list", "\u65B9\u6CD5\u5217\u8868"},
- {"request.headers.list", "\u8BF7\u6C42\u6807\u5934\u5217\u8868"},
- {"Principal.List", "\u4E3B\u7528\u6237\u5217\u8868"},
- {"Permission.List", "\u6743\u9650\u5217\u8868"},
- {"Code.Base", "\u4EE3\u7801\u5E93"},
- {"KeyStore.U.R.L.", "\u5BC6\u94A5\u5E93 URL:"},
- {"KeyStore.Password.U.R.L.", "\u5BC6\u94A5\u5E93\u53E3\u4EE4 URL:"}
- };
-
-
- /**
- * Returns the contents of this <code>ResourceBundle</code>.
- *
- * <p>
- *
- * @return the contents of this <code>ResourceBundle</code>.
- */
- @Override
- public Object[][] getContents() {
- return contents;
- }
-}
--- a/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_zh_HK.java Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,156 +0,0 @@
-/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.security.tools.policytool;
-
-/**
- * <p> This class represents the <code>ResourceBundle</code>
- * for the policytool.
- *
- */
-public class Resources_zh_HK extends java.util.ListResourceBundle {
-
- private static final Object[][] contents = {
- {"NEWLINE", "\n"},
- {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
- "\u8B66\u544A: \u5225\u540D {0} \u7684\u516C\u958B\u91D1\u9470\u4E0D\u5B58\u5728\u3002\u8ACB\u78BA\u5B9A\u91D1\u9470\u5132\u5B58\u5EAB\u914D\u7F6E\u6B63\u78BA\u3002"},
- {"Warning.Class.not.found.class", "\u8B66\u544A: \u627E\u4E0D\u5230\u985E\u5225 {0}"},
- {"Warning.Invalid.argument.s.for.constructor.arg",
- "\u8B66\u544A: \u7121\u6548\u7684\u5EFA\u69CB\u5B50\u5F15\u6578: {0}"},
- {"Illegal.Principal.Type.type", "\u7121\u6548\u7684 Principal \u985E\u578B: {0}"},
- {"Illegal.option.option", "\u7121\u6548\u7684\u9078\u9805: {0}"},
- {"Usage.policytool.options.", "\u7528\u6CD5: policytool [options]"},
- {".file.file.policy.file.location",
- " [-file <file>] \u539F\u5247\u6A94\u6848\u4F4D\u7F6E"},
- {"New", "\u65B0\u589E"},
- {"Open", "\u958B\u555F"},
- {"Save", "\u5132\u5B58"},
- {"Save.As", "\u53E6\u5B58\u65B0\u6A94"},
- {"View.Warning.Log", "\u6AA2\u8996\u8B66\u544A\u8A18\u9304"},
- {"Exit", "\u7D50\u675F"},
- {"Add.Policy.Entry", "\u65B0\u589E\u539F\u5247\u9805\u76EE"},
- {"Edit.Policy.Entry", "\u7DE8\u8F2F\u539F\u5247\u9805\u76EE"},
- {"Remove.Policy.Entry", "\u79FB\u9664\u539F\u5247\u9805\u76EE"},
- {"Edit", "\u7DE8\u8F2F"},
- {"Retain", "\u4FDD\u7559"},
-
- {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
- "\u8B66\u544A: \u6A94\u6848\u540D\u7A31\u5305\u542B\u9041\u96E2\u53CD\u659C\u7DDA\u5B57\u5143\u3002\u4E0D\u9700\u8981\u9041\u96E2\u53CD\u659C\u7DDA\u5B57\u5143 (\u64B0\u5BEB\u539F\u5247\u5167\u5BB9\u81F3\u6C38\u4E45\u5B58\u653E\u5340\u6642\u9700\u8981\u5DE5\u5177\u9041\u96E2\u5B57\u5143)\u3002\n\n\u6309\u4E00\u4E0B\u300C\u4FDD\u7559\u300D\u4EE5\u4FDD\u7559\u8F38\u5165\u7684\u540D\u7A31\uFF0C\u6216\u6309\u4E00\u4E0B\u300C\u7DE8\u8F2F\u300D\u4EE5\u7DE8\u8F2F\u540D\u7A31\u3002"},
-
- {"Add.Public.Key.Alias", "\u65B0\u589E\u516C\u958B\u91D1\u9470\u5225\u540D"},
- {"Remove.Public.Key.Alias", "\u79FB\u9664\u516C\u958B\u91D1\u9470\u5225\u540D"},
- {"File", "\u6A94\u6848"},
- {"KeyStore", "\u91D1\u9470\u5132\u5B58\u5EAB"},
- {"Policy.File.", "\u539F\u5247\u6A94\u6848: "},
- {"Could.not.open.policy.file.policyFile.e.toString.",
- "\u7121\u6CD5\u958B\u555F\u539F\u5247\u6A94\u6848: {0}: {1}"},
- {"Policy.Tool", "\u539F\u5247\u5DE5\u5177"},
- {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
- "\u958B\u555F\u539F\u5247\u8A18\u7F6E\u6642\u767C\u751F\u932F\u8AA4\u3002\u8ACB\u6AA2\u8996\u8B66\u544A\u8A18\u9304\u4EE5\u53D6\u5F97\u66F4\u591A\u7684\u8CC7\u8A0A"},
- {"Error", "\u932F\u8AA4"},
- {"OK", "\u78BA\u5B9A"},
- {"Status", "\u72C0\u614B"},
- {"Warning", "\u8B66\u544A"},
- {"Permission.",
- "\u6B0A\u9650: "},
- {"Principal.Type.", "Principal \u985E\u578B: "},
- {"Principal.Name.", "Principal \u540D\u7A31: "},
- {"Target.Name.",
- "\u76EE\u6A19\u540D\u7A31: "},
- {"Actions.",
- "\u52D5\u4F5C: "},
- {"OK.to.overwrite.existing.file.filename.",
- "\u78BA\u8A8D\u8986\u5BEB\u73FE\u5B58\u7684\u6A94\u6848 {0}\uFF1F"},
- {"Cancel", "\u53D6\u6D88"},
- {"CodeBase.", "CodeBase:"},
- {"SignedBy.", "SignedBy:"},
- {"Add.Principal", "\u65B0\u589E Principal"},
- {"Edit.Principal", "\u7DE8\u8F2F Principal"},
- {"Remove.Principal", "\u79FB\u9664 Principal"},
- {"Principals.", "Principal:"},
- {".Add.Permission", " \u65B0\u589E\u6B0A\u9650"},
- {".Edit.Permission", " \u7DE8\u8F2F\u6B0A\u9650"},
- {"Remove.Permission", "\u79FB\u9664\u6B0A\u9650"},
- {"Done", "\u5B8C\u6210"},
- {"KeyStore.URL.", "\u91D1\u9470\u5132\u5B58\u5EAB URL: "},
- {"KeyStore.Type.", "\u91D1\u9470\u5132\u5B58\u5EAB\u985E\u578B:"},
- {"KeyStore.Provider.", "\u91D1\u9470\u5132\u5B58\u5EAB\u63D0\u4F9B\u8005:"},
- {"KeyStore.Password.URL.", "\u91D1\u9470\u5132\u5B58\u5EAB\u5BC6\u78BC URL: "},
- {"Principals", "Principal"},
- {".Edit.Principal.", " \u7DE8\u8F2F Principal: "},
- {".Add.New.Principal.", " \u65B0\u589E Principal: "},
- {"Permissions", "\u6B0A\u9650"},
- {".Edit.Permission.", " \u7DE8\u8F2F\u6B0A\u9650:"},
- {".Add.New.Permission.", " \u65B0\u589E\u6B0A\u9650:"},
- {"Signed.By.", "\u7C3D\u7F72\u4EBA: "},
- {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
- "\u6C92\u6709\u842C\u7528\u5B57\u5143\u540D\u7A31\uFF0C\u7121\u6CD5\u6307\u5B9A\u542B\u6709\u842C\u7528\u5B57\u5143\u985E\u5225\u7684 Principal"},
- {"Cannot.Specify.Principal.without.a.Name",
- "\u6C92\u6709\u540D\u7A31\uFF0C\u7121\u6CD5\u6307\u5B9A Principal"},
- {"Permission.and.Target.Name.must.have.a.value",
- "\u6B0A\u9650\u53CA\u76EE\u6A19\u540D\u7A31\u5FC5\u9808\u6709\u4E00\u500B\u503C\u3002"},
- {"Remove.this.Policy.Entry.", "\u79FB\u9664\u9019\u500B\u539F\u5247\u9805\u76EE\uFF1F"},
- {"Overwrite.File", "\u8986\u5BEB\u6A94\u6848"},
- {"Policy.successfully.written.to.filename",
- "\u539F\u5247\u6210\u529F\u5BEB\u5165\u81F3 {0}"},
- {"null.filename", "\u7A7A\u503C\u6A94\u540D"},
- {"Save.changes.", "\u5132\u5B58\u8B8A\u66F4\uFF1F"},
- {"Yes", "\u662F"},
- {"No", "\u5426"},
- {"Policy.Entry", "\u539F\u5247\u9805\u76EE"},
- {"Save.Changes", "\u5132\u5B58\u8B8A\u66F4"},
- {"No.Policy.Entry.selected", "\u6C92\u6709\u9078\u53D6\u539F\u5247\u9805\u76EE"},
- {"Unable.to.open.KeyStore.ex.toString.",
- "\u7121\u6CD5\u958B\u555F\u91D1\u9470\u5132\u5B58\u5EAB: {0}"},
- {"No.principal.selected", "\u672A\u9078\u53D6 Principal"},
- {"No.permission.selected", "\u6C92\u6709\u9078\u53D6\u6B0A\u9650"},
- {"name", "\u540D\u7A31"},
- {"configuration.type", "\u7D44\u614B\u985E\u578B"},
- {"environment.variable.name", "\u74B0\u5883\u8B8A\u6578\u540D\u7A31"},
- {"library.name", "\u7A0B\u5F0F\u5EAB\u540D\u7A31"},
- {"package.name", "\u5957\u88DD\u7A0B\u5F0F\u540D\u7A31"},
- {"policy.type", "\u539F\u5247\u985E\u578B"},
- {"property.name", "\u5C6C\u6027\u540D\u7A31"},
- {"provider.name", "\u63D0\u4F9B\u8005\u540D\u7A31"},
- {"Principal.List", "Principal \u6E05\u55AE"},
- {"Permission.List", "\u6B0A\u9650\u6E05\u55AE"},
- {"Code.Base", "\u4EE3\u78BC\u57FA\u6E96"},
- {"KeyStore.U.R.L.", "\u91D1\u9470\u5132\u5B58\u5EAB URL:"},
- {"KeyStore.Password.U.R.L.", "\u91D1\u9470\u5132\u5B58\u5EAB\u5BC6\u78BC URL:"}
- };
-
-
- /**
- * Returns the contents of this <code>ResourceBundle</code>.
- *
- * <p>
- *
- * @return the contents of this <code>ResourceBundle</code>.
- */
- @Override
- public Object[][] getContents() {
- return contents;
- }
-}
--- a/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_zh_TW.java Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2000, 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 sun.security.tools.policytool;
-
-/**
- * <p> This class represents the <code>ResourceBundle</code>
- * for the policytool.
- *
- */
-public class Resources_zh_TW extends java.util.ListResourceBundle {
-
- private static final Object[][] contents = {
- {"NEWLINE", "\n"},
- {"Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured.",
- "\u8B66\u544A: \u5225\u540D {0} \u7684\u516C\u958B\u91D1\u9470\u4E0D\u5B58\u5728\u3002\u8ACB\u78BA\u5B9A\u91D1\u9470\u5132\u5B58\u5EAB\u8A2D\u5B9A\u6B63\u78BA\u3002"},
- {"Warning.Class.not.found.class", "\u8B66\u544A: \u627E\u4E0D\u5230\u985E\u5225 {0}"},
- {"Warning.Invalid.argument.s.for.constructor.arg",
- "\u8B66\u544A: \u7121\u6548\u7684\u5EFA\u69CB\u5B50\u5F15\u6578: {0}"},
- {"Illegal.Principal.Type.type", "\u7121\u6548\u7684 Principal \u985E\u578B: {0}"},
- {"Illegal.option.option", "\u7121\u6548\u7684\u9078\u9805: {0}"},
- {"Usage.policytool.options.", "\u7528\u6CD5: policytool [options]"},
- {".file.file.policy.file.location",
- " [-file <file>] \u539F\u5247\u6A94\u6848\u4F4D\u7F6E"},
- {"New", "\u65B0\u5EFA(&N)"},
- {"Open", "\u958B\u555F(&O)..."},
- {"Save", "\u5132\u5B58(&S)"},
- {"Save.As", "\u53E6\u5B58\u65B0\u6A94(&A)..."},
- {"View.Warning.Log", "\u6AA2\u8996\u8B66\u544A\u8A18\u9304(&W)"},
- {"Exit", "\u7D50\u675F(&X)"},
- {"Add.Policy.Entry", "\u65B0\u589E\u539F\u5247\u9805\u76EE(&A)"},
- {"Edit.Policy.Entry", "\u7DE8\u8F2F\u539F\u5247\u9805\u76EE(&E)"},
- {"Remove.Policy.Entry", "\u79FB\u9664\u539F\u5247\u9805\u76EE(&R)"},
- {"Edit", "\u7DE8\u8F2F(&E)"},
- {"Retain", "\u4FDD\u7559"},
-
- {"Warning.File.name.may.include.escaped.backslash.characters.It.is.not.necessary.to.escape.backslash.characters.the.tool.escapes",
- "\u8B66\u544A: \u6A94\u6848\u540D\u7A31\u5305\u542B\u9041\u96E2\u53CD\u659C\u7DDA\u5B57\u5143\u3002\u4E0D\u9700\u8981\u9041\u96E2\u53CD\u659C\u7DDA\u5B57\u5143 (\u64B0\u5BEB\u539F\u5247\u5167\u5BB9\u81F3\u6C38\u4E45\u5B58\u653E\u5340\u6642\u9700\u8981\u5DE5\u5177\u9041\u96E2\u5B57\u5143)\u3002\n\n\u6309\u4E00\u4E0B\u300C\u4FDD\u7559\u300D\u4EE5\u4FDD\u7559\u8F38\u5165\u7684\u540D\u7A31\uFF0C\u6216\u6309\u4E00\u4E0B\u300C\u7DE8\u8F2F\u300D\u4EE5\u7DE8\u8F2F\u540D\u7A31\u3002"},
-
- {"Add.Public.Key.Alias", "\u65B0\u589E\u516C\u958B\u91D1\u9470\u5225\u540D"},
- {"Remove.Public.Key.Alias", "\u79FB\u9664\u516C\u958B\u91D1\u9470\u5225\u540D"},
- {"File", "\u6A94\u6848(&F)"},
- {"KeyStore", "\u91D1\u9470\u5132\u5B58\u5EAB(&K)"},
- {"Policy.File.", "\u539F\u5247\u6A94\u6848: "},
- {"Could.not.open.policy.file.policyFile.e.toString.",
- "\u7121\u6CD5\u958B\u555F\u539F\u5247\u6A94\u6848: {0}: {1}"},
- {"Policy.Tool", "\u539F\u5247\u5DE5\u5177"},
- {"Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information.",
- "\u958B\u555F\u539F\u5247\u7D44\u614B\u6642\u767C\u751F\u932F\u8AA4\u3002\u8ACB\u6AA2\u8996\u8B66\u544A\u8A18\u9304\u4EE5\u53D6\u5F97\u66F4\u591A\u7684\u8CC7\u8A0A"},
- {"Error", "\u932F\u8AA4"},
- {"OK", "\u78BA\u5B9A"},
- {"Status", "\u72C0\u614B"},
- {"Warning", "\u8B66\u544A"},
- {"Permission.",
- "\u6B0A\u9650: "},
- {"Principal.Type.", "Principal \u985E\u578B: "},
- {"Principal.Name.", "Principal \u540D\u7A31: "},
- {"Target.Name.",
- "\u76EE\u6A19\u540D\u7A31: "},
- {"Actions.",
- "\u52D5\u4F5C: "},
- {"OK.to.overwrite.existing.file.filename.",
- "\u78BA\u8A8D\u8986\u5BEB\u73FE\u5B58\u7684\u6A94\u6848 {0}\uFF1F"},
- {"Cancel", "\u53D6\u6D88"},
- {"CodeBase.", "CodeBase(&C):"},
- {"SignedBy.", "SignedBy(&S):"},
- {"Add.Principal", "\u65B0\u589E Principal(&A)"},
- {"Edit.Principal", "\u7DE8\u8F2F Principal(&E)"},
- {"Remove.Principal", "\u79FB\u9664 Principal(&R)"},
- {"Principals.", "Principal(&P):"},
- {".Add.Permission", " \u65B0\u589E\u6B0A\u9650(&D)"},
- {".Edit.Permission", " \u7DE8\u8F2F\u6B0A\u9650(&I)"},
- {"Remove.Permission", "\u79FB\u9664\u6B0A\u9650(&M)"},
- {"Done", "\u5B8C\u6210"},
- {"KeyStore.URL.", "\u91D1\u9470\u5132\u5B58\u5EAB URL(&U): "},
- {"KeyStore.Type.", "\u91D1\u9470\u5132\u5B58\u5EAB\u985E\u578B(&T):"},
- {"KeyStore.Provider.", "\u91D1\u9470\u5132\u5B58\u5EAB\u63D0\u4F9B\u8005(&P):"},
- {"KeyStore.Password.URL.", "\u91D1\u9470\u5132\u5B58\u5EAB\u5BC6\u78BC URL(&W): "},
- {"Principals", "Principal"},
- {".Edit.Principal.", " \u7DE8\u8F2F Principal: "},
- {".Add.New.Principal.", " \u65B0\u589E Principal: "},
- {"Permissions", "\u6B0A\u9650"},
- {".Edit.Permission.", " \u7DE8\u8F2F\u6B0A\u9650:"},
- {".Add.New.Permission.", " \u65B0\u589E\u6B0A\u9650:"},
- {"Signed.By.", "\u7C3D\u7F72\u4EBA: "},
- {"Cannot.Specify.Principal.with.a.Wildcard.Class.without.a.Wildcard.Name",
- "\u6C92\u6709\u842C\u7528\u5B57\u5143\u540D\u7A31\uFF0C\u7121\u6CD5\u6307\u5B9A\u542B\u6709\u842C\u7528\u5B57\u5143\u985E\u5225\u7684 Principal"},
- {"Cannot.Specify.Principal.without.a.Name",
- "\u6C92\u6709\u540D\u7A31\uFF0C\u7121\u6CD5\u6307\u5B9A Principal"},
- {"Permission.and.Target.Name.must.have.a.value",
- "\u6B0A\u9650\u53CA\u76EE\u6A19\u540D\u7A31\u5FC5\u9808\u6709\u4E00\u500B\u503C\u3002"},
- {"Remove.this.Policy.Entry.", "\u79FB\u9664\u9019\u500B\u539F\u5247\u9805\u76EE\uFF1F"},
- {"Overwrite.File", "\u8986\u5BEB\u6A94\u6848"},
- {"Policy.successfully.written.to.filename",
- "\u539F\u5247\u6210\u529F\u5BEB\u5165\u81F3 {0}"},
- {"null.filename", "\u7A7A\u503C\u6A94\u540D"},
- {"Save.changes.", "\u5132\u5B58\u8B8A\u66F4\uFF1F"},
- {"Yes", "\u662F(&Y)"},
- {"No", "\u5426(&N)"},
- {"Policy.Entry", "\u539F\u5247\u9805\u76EE"},
- {"Save.Changes", "\u5132\u5B58\u8B8A\u66F4"},
- {"No.Policy.Entry.selected", "\u6C92\u6709\u9078\u53D6\u539F\u5247\u9805\u76EE"},
- {"Unable.to.open.KeyStore.ex.toString.",
- "\u7121\u6CD5\u958B\u555F\u91D1\u9470\u5132\u5B58\u5EAB: {0}"},
- {"No.principal.selected", "\u672A\u9078\u53D6 Principal"},
- {"No.permission.selected", "\u6C92\u6709\u9078\u53D6\u6B0A\u9650"},
- {"name", "\u540D\u7A31"},
- {"configuration.type", "\u7D44\u614B\u985E\u578B"},
- {"environment.variable.name", "\u74B0\u5883\u8B8A\u6578\u540D\u7A31"},
- {"library.name", "\u7A0B\u5F0F\u5EAB\u540D\u7A31"},
- {"package.name", "\u5957\u88DD\u7A0B\u5F0F\u540D\u7A31"},
- {"policy.type", "\u539F\u5247\u985E\u578B"},
- {"property.name", "\u5C6C\u6027\u540D\u7A31"},
- {"provider.name", "\u63D0\u4F9B\u8005\u540D\u7A31"},
- {"url", "URL"},
- {"method.list", "\u65B9\u6CD5\u6E05\u55AE"},
- {"request.headers.list", "\u8981\u6C42\u6A19\u982D\u6E05\u55AE"},
- {"Principal.List", "Principal \u6E05\u55AE"},
- {"Permission.List", "\u6B0A\u9650\u6E05\u55AE"},
- {"Code.Base", "\u4EE3\u78BC\u57FA\u6E96"},
- {"KeyStore.U.R.L.", "\u91D1\u9470\u5132\u5B58\u5EAB URL:"},
- {"KeyStore.Password.U.R.L.", "\u91D1\u9470\u5132\u5B58\u5EAB\u5BC6\u78BC URL:"}
- };
-
-
- /**
- * Returns the contents of this <code>ResourceBundle</code>.
- *
- * <p>
- *
- * @return the contents of this <code>ResourceBundle</code>.
- */
- @Override
- public Object[][] getContents() {
- return contents;
- }
-}
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompilationPhase.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompilationPhase.java Thu Sep 28 09:13:27 2017 -0700
@@ -273,7 +273,8 @@
private static final class LocalVariableTypeCalculationPhase extends CompilationPhase {
@Override
FunctionNode transform(final Compiler compiler, final CompilationPhases phases, final FunctionNode fn) {
- final FunctionNode newFunctionNode = transformFunction(fn, new LocalVariableTypesCalculator(compiler));
+ final FunctionNode newFunctionNode = transformFunction(fn, new LocalVariableTypesCalculator(compiler,
+ compiler.getReturnType()));
final ScriptEnvironment senv = compiler.getScriptEnvironment();
final PrintWriter err = senv.getErr();
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Compiler.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Compiler.java Thu Sep 28 09:13:27 2017 -0700
@@ -619,6 +619,10 @@
return types == null ? null : types.get(fn, pos);
}
+ Type getReturnType() {
+ return types == null || !isOnDemandCompilation() ? Type.UNKNOWN : types.getReturnType();
+ }
+
/**
* Do a compilation job
*
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java Thu Sep 28 09:13:27 2017 -0700
@@ -405,10 +405,15 @@
// variables).
private final Deque<Label> catchLabels = new ArrayDeque<>();
- LocalVariableTypesCalculator(final Compiler compiler) {
+ private LocalVariableTypesCalculator(final Compiler compiler) {
this.compiler = compiler;
}
+ LocalVariableTypesCalculator(final Compiler compiler, final Type returnType) {
+ this(compiler);
+ this.returnType = returnType;
+ }
+
private JumpTarget createJumpTarget(final Label label) {
assert !jumpTargets.containsKey(label);
final JumpTarget jumpTarget = new JumpTarget();
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/TypeMap.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/TypeMap.java Thu Sep 28 09:13:27 2017 -0700
@@ -117,6 +117,15 @@
return null;
}
+ /**
+ * Get the return type required for the call site we're compiling for. This only determines
+ * whether object return type is required or not.
+ * @return Type.OBJECT for call sites with object return types, Type.UNKNOWN for everything else
+ */
+ Type getReturnType() {
+ return returnType.isObject() ? Type.OBJECT : Type.UNKNOWN;
+ }
+
@Override
public String toString() {
return toString("");
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJava.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJava.java Thu Sep 28 09:13:27 2017 -0700
@@ -43,6 +43,7 @@
import jdk.dynalink.linker.support.TypeUtilities;
import jdk.nashorn.api.scripting.JSObject;
import jdk.nashorn.api.scripting.ScriptObjectMirror;
+import jdk.nashorn.api.scripting.ScriptUtils;
import jdk.nashorn.internal.objects.annotations.Attribute;
import jdk.nashorn.internal.objects.annotations.Function;
import jdk.nashorn.internal.objects.annotations.ScriptClass;
@@ -430,9 +431,9 @@
if (objArray == null) {
return null;
} else if (objArray instanceof Collection) {
- return new NativeArray(((Collection<?>)objArray).toArray());
+ return new NativeArray(ScriptUtils.unwrapArray(((Collection<?>)objArray).toArray()));
} else if (objArray instanceof Object[]) {
- return new NativeArray(((Object[])objArray).clone());
+ return new NativeArray(ScriptUtils.unwrapArray(((Object[])objArray).clone()));
} else if (objArray instanceof int[]) {
return new NativeArray(((int[])objArray).clone());
} else if (objArray instanceof double[]) {
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeSymbol.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeSymbol.java Thu Sep 28 09:13:27 2017 -0700
@@ -93,7 +93,7 @@
} else if (self instanceof NativeSymbol) {
return ((NativeSymbol) self).symbol;
} else {
- throw typeError("not.a.symbol");
+ throw typeError("not.a.symbol", ScriptRuntime.safeToString(self));
}
}
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java Thu Sep 28 09:13:27 2017 -0700
@@ -2053,10 +2053,18 @@
if (outer != null) {
restoreBlock(outer);
if (body != null) {
+ List<Statement> statements = new ArrayList<>();
+ for (final Statement var : outer.getStatements()) {
+ if(var instanceof VarNode && !((VarNode)var).isBlockScoped()) {
+ appendStatement(var);
+ }else {
+ statements.add(var);
+ }
+ }
appendStatement(new BlockStatement(forLine, new Block(
outer.getToken(),
body.getFinish(),
- outer.getStatements())));
+ statements)));
}
}
}
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CompiledFunction.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CompiledFunction.java Thu Sep 28 09:13:27 2017 -0700
@@ -537,6 +537,9 @@
final int csParamCount = getParamCount(other);
final boolean csIsVarArg = csParamCount == Integer.MAX_VALUE;
+ if (csIsVarArg && isApplyToCall()) {
+ return false; // apply2call function must be called with exact number of parameters
+ }
final int thisThisIndex = needsCallee() ? 1 : 0; // Index of "this" parameter in this function's type
final int fnParamCountNoCallee = fnParamCount - thisThisIndex;
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java Thu Sep 28 09:13:27 2017 -0700
@@ -804,7 +804,11 @@
* @return the value converted to Integer or Double
*/
public static Number toNarrowestNumber(final long l) {
- return isRepresentableAsInt(l) ? Integer.valueOf((int) l) : Double.valueOf(l);
+ if (isRepresentableAsInt(l)) {
+ return Integer.valueOf((int) l);
+ } else {
+ return Double.valueOf(l);
+ }
}
/**
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Source.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Source.java Thu Sep 28 09:13:27 2017 -0700
@@ -336,6 +336,7 @@
}
}
+ @SuppressWarnings("try")
protected void loadMeta() throws IOException {
if (length == 0 && lastModified == 0) {
final URLConnection c = url.openConnection();
--- a/src/jdk.security.jgss/share/classes/com/sun/security/jgss/package-info.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.security.jgss/share/classes/com/sun/security/jgss/package-info.java Thu Sep 28 09:13:27 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
@@ -23,4 +23,8 @@
* questions.
*/
+/**
+ * This package defines classes and interfaces for the JDK extensions
+ * to the GSS-API.
+ */
package com.sun.security.jgss;
--- a/src/jdk.security.jgss/share/classes/module-info.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.security.jgss/share/classes/module-info.java Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -24,7 +24,7 @@
*/
/**
- * Defines Java extensions to the GSS-API and an implementation of the SASL
+ * Defines JDK extensions to the GSS-API and an implementation of the SASL
* GSSAPI mechanism.
*
* @moduleGraph
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java Thu Sep 28 09:13:27 2017 -0700
@@ -79,6 +79,7 @@
private static final boolean isWindows = AccessController.doPrivileged(
(PrivilegedAction<Boolean>) () -> System.getProperty("os.name")
.startsWith("Windows"));
+ private final boolean forceEnd64;
ZipFileSystem(ZipFileSystemProvider provider,
Path zfpath,
@@ -91,12 +92,13 @@
(String)env.get("encoding") : "UTF-8";
this.noExtt = "false".equals(env.get("zipinfo-time"));
this.useTempFile = TRUE.equals(env.get("useTempFile"));
+ this.forceEnd64 = "true".equals(env.get("forceZIP64End"));
this.provider = provider;
this.zfpath = zfpath;
if (Files.notExists(zfpath)) {
if (createNew) {
try (OutputStream os = Files.newOutputStream(zfpath, CREATE_NEW, WRITE)) {
- new END().write(os, 0);
+ new END().write(os, 0, forceEnd64);
}
} else {
throw new FileSystemNotFoundException(zfpath.toString());
@@ -1000,28 +1002,36 @@
end.cenoff = ENDOFF(buf);
end.comlen = ENDCOM(buf);
end.endpos = pos + i;
- if (end.cenlen == ZIP64_MINVAL ||
- end.cenoff == ZIP64_MINVAL ||
- end.centot == ZIP64_MINVAL32)
- {
- // need to find the zip64 end;
- byte[] loc64 = new byte[ZIP64_LOCHDR];
- if (readFullyAt(loc64, 0, loc64.length, end.endpos - ZIP64_LOCHDR)
- != loc64.length) {
- return end;
- }
- long end64pos = ZIP64_LOCOFF(loc64);
- byte[] end64buf = new byte[ZIP64_ENDHDR];
- if (readFullyAt(end64buf, 0, end64buf.length, end64pos)
- != end64buf.length) {
- return end;
- }
- // end64 found, re-calcualte everything.
- end.cenlen = ZIP64_ENDSIZ(end64buf);
- end.cenoff = ZIP64_ENDOFF(end64buf);
- end.centot = (int)ZIP64_ENDTOT(end64buf); // assume total < 2g
- end.endpos = end64pos;
+ // try if there is zip64 end;
+ byte[] loc64 = new byte[ZIP64_LOCHDR];
+ if (end.endpos < ZIP64_LOCHDR ||
+ readFullyAt(loc64, 0, loc64.length, end.endpos - ZIP64_LOCHDR)
+ != loc64.length ||
+ !locator64SigAt(loc64, 0)) {
+ return end;
+ }
+ long end64pos = ZIP64_LOCOFF(loc64);
+ byte[] end64buf = new byte[ZIP64_ENDHDR];
+ if (readFullyAt(end64buf, 0, end64buf.length, end64pos)
+ != end64buf.length ||
+ !end64SigAt(end64buf, 0)) {
+ return end;
}
+ // end64 found,
+ long cenlen64 = ZIP64_ENDSIZ(end64buf);
+ long cenoff64 = ZIP64_ENDOFF(end64buf);
+ long centot64 = ZIP64_ENDTOT(end64buf);
+ // double-check
+ if (cenlen64 != end.cenlen && end.cenlen != ZIP64_MINVAL ||
+ cenoff64 != end.cenoff && end.cenoff != ZIP64_MINVAL ||
+ centot64 != end.centot && end.centot != ZIP64_MINVAL32) {
+ return end;
+ }
+ // to use the end64 values
+ end.cenlen = cenlen64;
+ end.cenoff = cenoff64;
+ end.centot = (int)centot64; // assume total < 2g
+ end.endpos = end64pos;
return end;
}
}
@@ -1192,7 +1202,7 @@
// sync the zip file system, if there is any udpate
private void sync() throws IOException {
- //System.out.printf("->sync(%s) starting....!%n", toString());
+ // System.out.printf("->sync(%s) starting....!%n", toString());
// check ex-closer
if (!exChClosers.isEmpty()) {
for (ExChannelCloser ecc : exChClosers) {
@@ -1282,7 +1292,7 @@
}
end.centot = elist.size();
end.cenlen = written - end.cenoff;
- end.write(os, written);
+ end.write(os, written, forceEnd64);
}
if (!streams.isEmpty()) {
//
@@ -1712,8 +1722,8 @@
long endpos;
// int disktot;
- void write(OutputStream os, long offset) throws IOException {
- boolean hasZip64 = false;
+ void write(OutputStream os, long offset, boolean forceEnd64) throws IOException {
+ boolean hasZip64 = forceEnd64; // false;
long xlen = cenlen;
long xoff = cenoff;
if (xlen >= ZIP64_MINVAL) {
@@ -1738,8 +1748,8 @@
writeShort(os, 45); // version needed to extract
writeInt(os, 0); // number of this disk
writeInt(os, 0); // central directory start disk
- writeLong(os, centot); // number of directory entires on disk
- writeLong(os, centot); // number of directory entires
+ writeLong(os, centot); // number of directory entries on disk
+ writeLong(os, centot); // number of directory entries
writeLong(os, cenlen); // length of central directory
writeLong(os, cenoff); // offset of central directory
--- a/src/linux/doc/man/ja/policytool.1 Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,177 +0,0 @@
-'\" t
-.\" Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
-.\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-.\"
-.\" This code is free software; you can redistribute it and/or modify it
-.\" under the terms of the GNU General Public License version 2 only, as
-.\" published by the Free Software Foundation.
-.\"
-.\" This code is distributed in the hope that it will be useful, but WITHOUT
-.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-.\" version 2 for more details (a copy is included in the LICENSE file that
-.\" accompanied this code).
-.\"
-.\" You should have received a copy of the GNU General Public License version
-.\" 2 along with this work; if not, write to the Free Software Foundation,
-.\" Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-.\"
-.\" Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-.\" or visit www.oracle.com if you need additional information or have any
-.\" questions.
-.\"
-.\" Title: policytool
-.\" Language: Japanese
-.\" Date: 2015ǯ3·î3Æü
-.\" SectDesc: ¥»¥¥å¥ê¥Æ¥£¡¦¥Ä¡¼¥ë
-.\" Software: JDK 8
-.\" Arch: ÈÆÍÑ
-.\" Part Number: E58103-01
-.\" Doc ID: JSSON
-.\"
-.if n .pl 99999
-.TH "policytool" "1" "2015ǯ3·î3Æü" "JDK 8" "¥»¥¥å¥ê¥Æ¥£¡¦¥Ä¡¼¥ë"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-.SH "̾Á°"
-policytool \- ¥æ¡¼¥Æ¥£¥ê¥Æ¥£GUI·Ðͳ¤Ç¼èÆÀ¤·¤¿¥æ¡¼¥¶¡¼ÆþÎϤ˴ð¤Å¤¤¤Æ¡¢¥×¥ì¡¼¥ó¡¦¥Æ¥¥¹¥È¤Î¥Ý¥ê¥·¡¼¡¦¥Õ¥¡¥¤¥ë¤òÆɤ߽ñ¤¤·¤Þ¤¹¡£
-.SH "³µÍ×"
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBpolicytool\fR [ \fB\-file\fR ] [ \fIfilename\fR ]
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-\-file
-.RS 4
-¥Ý¥ê¥·¡¼¡¦¥Õ¥¡¥¤¥ë¤òÆɤ߹þ¤à¤è¤¦¤Ë\fBpolicytool\fR¤Ë»Ø¼¨¤·¤Þ¤¹¡£
-.RE
-.PP
-\fIfilename\fR
-.RS 4
-¥í¡¼¥É¤¹¤ë¥Õ¥¡¥¤¥ë¤Î̾Á°¡£
-.RE
-.PP
-\fBÎã\fR:
-.PP
-¥Ý¥ê¥·¡¼¡¦¥Ä¡¼¥ë´ÉÍý¥æ¡¼¥Æ¥£¥ê¥Æ¥£¤ò¼Â¹Ô¤·¤Þ¤¹:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBpolicytool\fR
-
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-\fBpolicytool\fR¥³¥Þ¥ó¥É¤ò¼Â¹Ô¤·¡¢»ØÄꤵ¤ì¤¿¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤·¤Þ¤¹:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBpolicytool \-file \fR\fB\fImypolicyfile\fR\fR
-
-.fi
-.if n \{\
-.RE
-.\}
-.SH "ÀâÌÀ"
-.PP
-\fBpolicytool\fR¥³¥Þ¥ó¥É¤Ï¡¢´ÉÍý¼Ô¤ÎGUI¤ò¸Æ¤Ó½Ð¤·¤Þ¤¹¡£¤³¤ì¤Ë¤è¤ê¡¢¥·¥¹¥Æ¥à´ÉÍý¼Ô¤Ï¥í¡¼¥«¥ë¡¦¥Ý¥ê¥·¡¼¡¦¥Õ¥¡¥¤¥ë¤ÎÆâÍƤò´ÉÍý¤Ç¤¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£¥Ý¥ê¥·¡¼¡¦¥Õ¥¡¥¤¥ë¤Ï\fB\&.policy\fR³ÈÄ¥»Ò¤ò»ý¤Ä¥×¥ì¡¼¥ó¥Æ¥¥¹¥È¡¦¥Õ¥¡¥¤¥ë¤Ç¡¢¥É¥á¥¤¥óÊ̤˥ê¥â¡¼¥È¡¦¥ê¥¯¥¨¥¹¥¿¤ò¸¢¸Â¥ª¥Ö¥¸¥§¥¯¥È¤Ë¥Þ¥Ã¥×¤·¤Þ¤¹¡£¾ÜºÙ¤Ï¡¢http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/PolicyFiles\&.html¤Ë¤¢¤ë
-¡ÖDefault Policy Implementation and Policy File Syntax¡×¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤
-.SH "¥ª¥×¥·¥ç¥ó"
-.PP
-\-file
-.RS 4
-¥Ý¥ê¥·¡¼¡¦¥Õ¥¡¥¤¥ë¤òÆɤ߹þ¤à¤è¤¦¤Ë\fBpolicytool\fR¤Ë»Ø¼¨¤·¤Þ¤¹¡£
-.RE
-.SH "´ØÏ¢¹àÌÜ"
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-¡ÖDefault Policy Implementation and Policy File Syntax¡×
-(http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/PolicyFiles\&.html)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-¡ÖPolicy File Creation and Management¡×
-(http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/PolicyGuide\&.html)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-¡ÖPermissions in Java SE Development Kit (JDK)¡×
-(http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/permissions\&.html)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-¡ÖJava Security Overview¡×
-(http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/overview/jsoverview\&.html)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-¡ÖJava Cryptography Architecture (JCA) Reference Guide¡×
-(http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/crypto/CryptoSpec\&.html)
-.RE
-.br
-'pl 8.5i
-'bp
--- a/src/linux/doc/man/jarsigner.1 Tue Sep 26 10:46:23 2017 +0530
+++ b/src/linux/doc/man/jarsigner.1 Thu Sep 28 09:13:27 2017 -0700
@@ -149,7 +149,7 @@
.PP
Applications can choose different types of keystore implementations from different providers, with the \f3getInstance\fR factory method in the \f3KeyStore\fR class\&. A keystore type defines the storage and data format of the keystore information and the algorithms used to protect private keys in the keystore and the integrity of the keystore itself\&. Keystore implementations of different types are not compatible\&.
.PP
-The \f3jarsigner\fR and \f3policytool\fR commands can read file-based keystores from any location that can be specified using a URL\&. In addition, these commands can read non-file-based keystores such as those provided by MSCAPI on Windows and PKCS11 on all platforms\&.
+The \f3jarsigner\fR command can read file-based keystores from any location that can be specified using a URL\&. In addition, the command can read non-file-based keystores such as those provided by MSCAPI on Windows and PKCS11 on all platforms\&.
.PP
For the \f3jarsigner\fR and \f3keytool\fR commands, you can specify a keystore type at the command line with the \f3-storetype\fR option\&. For Policy Tool, you can specify a keystore type with the \fIEdit\fR command in the \fIKeyStore\fR menu\&.
.PP
--- a/src/linux/doc/man/keytool.1 Tue Sep 26 10:46:23 2017 +0530
+++ b/src/linux/doc/man/keytool.1 Thu Sep 28 09:13:27 2017 -0700
@@ -1231,7 +1231,7 @@
Applications can choose different types of keystore implementations from different providers, using the \f3getInstance\fR factory method supplied in the \f3KeyStore\fR class\&. A keystore type defines the storage and data format of the keystore information, and the algorithms used to protect private/secret keys in the keystore and the integrity of the keystore\&. Keystore implementations of different types are not compatible\&.
-The \f3keytool\fR command works on any file-based keystore implementation\&. It treats the keystore location that is passed to it at the command line as a file name and converts it to a \f3FileInputStream\fR, from which it loads the keystore information\&.)The \f3jarsigner\fR and \f3policytool\fR commands can read a keystore from any location that can be specified with a URL\&.
+The \f3keytool\fR command works on any file-based keystore implementation\&. It treats the keystore location that is passed to it at the command line as a file name and converts it to a \f3FileInputStream\fR, from which it loads the keystore information\&.)The \f3jarsigner\fR command can read a keystore from any location that can be specified with a URL\&.
For \f3keytool\fR and \f3jarsigner\fR, you can specify a keystore type at the command line, with the \f3-storetype\fR option\&. For Policy Tool, you can specify a keystore type with the \fIKeystore\fR menu\&.
--- a/src/linux/doc/man/policytool.1 Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-'\" t
-.\" Copyright (c) 2001, 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.
-.\"
-.\" 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.
-.\"
-.\" Arch: generic
-.\" Software: JDK 8
-.\" Date: 03 March 2015
-.\" SectDesc: Security Tools
-.\" Title: policytool.1
-.\"
-.if n .pl 99999
-.TH policytool 1 "03 March 2015" "JDK 8" "Security Tools"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-
-.SH NAME
-policytool \- Reads and writes a plain text policy file based on user input through the utility GUI\&.
-.SH SYNOPSIS
-.sp
-.nf
-
-\fBpolicytool\fR [ \fB\-file\fR ] [ \fIfilename\fR ]
-.fi
-.sp
-.TP
--file
-.br
-Directs the \f3policytool\fR command to load a policy file\&.
-.TP
-\fIfilename\fR
-The name of the file to be loaded\&.
-.PP
-\fIExamples\fR:
-.PP
-Run the policy tool administrator utility:
-.sp
-.nf
-\f3policytool\fP
-.fi
-.nf
-\f3\fP
-.fi
-.sp
-Run the \f3policytool\fR command and load the specified file:
-.sp
-.nf
-\f3policytool \-file \fImypolicyfile\fR\fP
-.fi
-.nf
-\f3\fP
-.fi
-.sp
-.SH DESCRIPTION
-The \f3policytool\fR command calls an administrator\&'s GUI that enables system administrators to manage the contents of local policy files\&. A policy file is a plain-text file with a \f3\&.policy\fR extension, that maps remote requestors by domain, to permission objects\&. For details, see Default Policy Implementation and Policy File Syntax at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/PolicyFiles\&.html
-.SH OPTIONS
-.TP
--file
-.br
-Directs the \f3policytool\fR command to load a policy file\&.
-.SH SEE\ ALSO
-.TP 0.2i
-\(bu
-Default Policy Implementation and Policy File Syntax at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/PolicyFiles\&.html
-.TP 0.2i
-\(bu
-Policy File Creation and Management at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/PolicyGuide\&.html
-.TP 0.2i
-\(bu
-Permissions in Java SE Development Kit (JDK) at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/permissions\&.html
-.TP 0.2i
-\(bu
-Java Security Overview at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/overview/jsoverview\&.html
-.TP 0.2i
-\(bu
-Java Cryptography Architecture (JCA) Reference Guide at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/crypto/CryptoSpec\&.html
-.RE
-.br
-'pl 8.5i
-'bp
--- a/src/linux/doc/man/serialver.1 Tue Sep 26 10:46:23 2017 +0530
+++ b/src/linux/doc/man/serialver.1 Thu Sep 28 09:13:27 2017 -0700
@@ -100,9 +100,6 @@
.SH SEE\ ALSO
.TP 0.2i
\(bu
-policytool(1)
-.TP 0.2i
-\(bu
The \f3java\&.io\&.ObjectStream\fR class description at http://docs\&.oracle\&.com/javase/8/docs/api/java/io/ObjectStreamClass\&.html
.RE
.br
--- a/src/sample/nashorn/autoimports.js Tue Sep 26 10:46:23 2017 +0530
+++ b/src/sample/nashorn/autoimports.js Thu Sep 28 09:13:27 2017 -0700
@@ -1,7 +1,7 @@
# autoimports script requires -scripting mode
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -43,6 +43,12 @@
* script, you can call autoimports to get the exact Java imports you need and replace
* the autoimports load with the generated import statements (to avoid costly init of
* the autoimports script).
+ *
+ * Example usage of autoimports.js in interactive mode:
+ *
+ * jjs -scripting autoimports.js -
+ * jjs> Vector
+ * jjs> [JavaClass java.util.Vector]
*/
(function() {
@@ -99,8 +105,8 @@
Files.walk(root).forEach(function(p) {
if (Files.isRegularFile(p)) {
var str = p.toString();
- if (str.endsWith(".class")) {
- str = str.substring(1);
+ if (str.endsWith(".class") && !str.endsWith("module-info.class")) {
+ str = str.substring("/modules/".length);
var idx = str.indexOf('/');
if (idx != -1) {
str = str.substring(idx + 1);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/sample/nashorn/base64.js Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// Usage: jjs --language=es6 base64.js
+
+const Base64 = Java.type("java.util.Base64");
+const ByteArray = Java.type("byte[]");
+const JString = Java.type("java.lang.String");
+
+function toBase64(s) {
+ const ba = s instanceof ByteArray? s : String(s).bytes;
+ return Base64.encoder.encodeToString(ba);
+}
+
+function fromBase64(s) {
+ const ba = s instanceof ByteArray? s : String(s).bytes;
+ return new JString(Base64.decoder.decode(ba));
+}
+
+print(toBase64`hello world`);
+print(fromBase64(toBase64`hello world`));
--- a/src/sample/nashorn/disassemble.js Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * - Neither the name of Oracle nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-// Usage: jjs disassemble.js -- <.class-file-path>
-
-// Simple .class disassembler that uses bundled ObjectWeb ASM
-// classes in jdk8. WARNING: Bundled ObjectWeb ASM classes are
-// not part of official jdk8 API. It can be changed/removed
-// without notice. So, this script is brittle by design!
-
-// This example demonstrates passing arguments to script
-// from jjs command line, nio and ASM usage.
-
-// classes used
-var FileSystems = Java.type("java.nio.file.FileSystems");
-var Files = Java.type("java.nio.file.Files");
-var System = Java.type("java.lang.System");
-var PrintWriter = Java.type("java.io.PrintWriter");
-
-// WARNING: uses non-API classes of jdk8!
-var ClassReader = Java.type("jdk.internal.org.objectweb.asm.ClassReader");
-var TraceClassVisitor = Java.type("jdk.internal.org.objectweb.asm.util.TraceClassVisitor");
-
-// convert file name to Path instance
-function path(file) {
- return FileSystems.default.getPath(file);
-}
-
-// read all file content as a byte[]
-function readAllBytes(file) {
- return Files.readAllBytes(path(file));
-}
-
-// disassemble .class byte[] and prints output to stdout
-function disassemble(bytecode) {
- var pw = new PrintWriter(System.out);
- new ClassReader(bytecode).accept(new TraceClassVisitor(pw), 0);
-}
-
-// check for command line arg (for .class file name)
-if (arguments.length == 0 || !arguments[0].endsWith('.class')) {
- print("Usage: jjs disassemble -- <.class file>");
- exit(1);
-}
-
-// disassemble the given .class file
-disassemble(readAllBytes(arguments[0]));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/sample/nashorn/dom_tagged_literal.js Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This sample demonstrates the use of es6 tagged template literal to
+ * create a java object. A XML DOM Document object is created from
+ * String using es6 tagged template literal.
+ *
+ * Usage:
+ * jjs --language=es6 dom_tagged_literal.js
+ */
+
+// Java types used
+const BAIS = Java.type("java.io.ByteArrayInputStream")
+const DocBuilderFac = Java.type("javax.xml.parsers.DocumentBuilderFactory")
+const DOMSource = Java.type("javax.xml.transform.dom.DOMSource")
+const StreamResult = Java.type("javax.xml.transform.stream.StreamResult")
+const StringWriter = Java.type("java.io.StringWriter")
+const TransformerFactory = Java.type("javax.xml.transform.TransformerFactory")
+
+function DOM(str) {
+ var docBuilder = DocBuilderFac.newInstance().newDocumentBuilder()
+ docBuilder.validating = false
+ return docBuilder["parse(java.io.InputStream)"](new BAIS(String(str).bytes))
+}
+
+// es6 tagged template literal to create DOM from
+// multi-line XML string
+
+const dom = DOM`
+<foo>
+ <bar title="hello">world</bar>
+</foo>`
+
+// access DOM elements
+const foo = dom.documentElement
+print(foo.tagName)
+const bar = foo.getElementsByTagName("bar").item(0)
+print(bar.tagName)
+print(bar.getAttribute("title"))
+
+// modify DOM
+foo.setAttribute("name", "nashorn")
+foo.appendChild(dom.createElement("test"))
+
+// serialize DOM to XML string
+function domToXML(d) {
+ const transformer = TransformerFactory.newInstance().newTransformer()
+ const res = new StreamResult(new StringWriter())
+ transformer.transform(new DOMSource(d), res)
+ return res.writer.toString()
+}
+
+// serialize DOM to a String & print
+print(domToXML(dom))
--- a/src/sample/nashorn/dynalink/README Tue Sep 26 10:46:23 2017 +0530
+++ b/src/sample/nashorn/dynalink/README Thu Sep 28 09:13:27 2017 -0700
@@ -4,12 +4,6 @@
"xyz_linker.js". These scripts build dynalink linker jar from java code and exec
another jjs process with appropriate classpath set.
-Note: you need to build jdk9 forest and put "images/jdk/bin" in your PATH to use
-these scripts. This is because these scripts use javac to build dynalink jar and
-exec another jjs with classpath set! Alternatively, you can also manually build
-dynalink linker jars and invoke sample scripts by putting linker jar in jjs tool's
-classpath as well.
-
Dynalink samples:
* array_stream_linker.js
--- a/src/sample/nashorn/dynalink/array_stream_linker.js Tue Sep 26 10:46:23 2017 +0530
+++ b/src/sample/nashorn/dynalink/array_stream_linker.js Thu Sep 28 09:13:27 2017 -0700
@@ -1,7 +1,7 @@
#! array stream linker example
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -37,10 +37,12 @@
$EXEC.throwOnError=true
// compile ArrayStreamLinkerExporter
-`javac -cp ../../dist/nashorn.jar ArrayStreamLinkerExporter.java`
+`javac ArrayStreamLinkerExporter.java`
+
+load("jarutil.js");
// make a jar file out of pluggable linker
-`jar cvf array_stream_linker.jar ArrayStreamLinkerExporter*.class META-INF/`
+makeJar("array_stream_linker.jar");
// run a sample script that uses pluggable linker
// but make sure classpath points to the pluggable linker jar!
--- a/src/sample/nashorn/dynalink/buffer_indexing_linker.js Tue Sep 26 10:46:23 2017 +0530
+++ b/src/sample/nashorn/dynalink/buffer_indexing_linker.js Thu Sep 28 09:13:27 2017 -0700
@@ -1,7 +1,7 @@
# buffer indexing linker example
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -37,10 +37,12 @@
$EXEC.throwOnError=true
// compile BufferIndexingLinkerExporter
-`javac -cp ../../dist/nashorn.jar BufferIndexingLinkerExporter.java`
+`javac BufferIndexingLinkerExporter.java`
+
+load("jarutil.js");
// make a jar file out of pluggable linker
-`jar cvf buffer_indexing_linker.jar BufferIndexingLinkerExporter*.class META-INF/`
+makeJar("buffer_indexing_linker.jar");
// run a sample script that uses pluggable linker
// but make sure classpath points to the pluggable linker jar!
--- a/src/sample/nashorn/dynalink/dom_linker.js Tue Sep 26 10:46:23 2017 +0530
+++ b/src/sample/nashorn/dynalink/dom_linker.js Thu Sep 28 09:13:27 2017 -0700
@@ -37,10 +37,12 @@
$EXEC.throwOnError=true
// compile DOMLinkerExporter
-`javac -cp ../../dist/nashorn.jar DOMLinkerExporter.java`
+`javac DOMLinkerExporter.java`
+
+load("jarutil.js");
// make a jar file out of pluggable linker
-`jar cvf dom_linker.jar DOMLinkerExporter*.class META-INF/`
+makeJar("dom_linker.jar");
// run a sample script that uses pluggable linker
// but make sure classpath points to the pluggable linker jar!
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/sample/nashorn/dynalink/jarutil.js Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+function classFiles() {
+ var arr = new java.io.File(".").listFiles(
+ new java.io.FilenameFilter() {
+ accept: function(dir, str) str.endsWith(".class")
+ });
+ var str = "";
+ for (var i in arr) str += " " + arr[i];
+ return str;
+}
+
+function makeJar(name) {
+ $EXEC("jar cvf " + name + " META-INF/ " + classFiles());
+ print($ERR);
+}
--- a/src/sample/nashorn/dynalink/missing_method_linker.js Tue Sep 26 10:46:23 2017 +0530
+++ b/src/sample/nashorn/dynalink/missing_method_linker.js Thu Sep 28 09:13:27 2017 -0700
@@ -1,7 +1,7 @@
#! missing method linker example
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -37,10 +37,12 @@
$EXEC.throwOnError=true
// compile MissingMethodLinkerExporter
-`javac -cp ../../dist/nashorn.jar MissingMethodLinkerExporter.java MissingMethodHandler.java MissingMethodExample.java`
+`javac MissingMethodLinkerExporter.java MissingMethodHandler.java MissingMethodExample.java`
+
+load("jarutil.js");
// make a jar file out of pluggable linker
-`jar cvf missing_method_linker.jar MissingMethod*.class META-INF/`
+makeJar("missing_method_linker.jar");
// run a sample script that uses pluggable linker
// but make sure classpath points to the pluggable linker jar!
--- a/src/sample/nashorn/dynalink/underscore_linker.js Tue Sep 26 10:46:23 2017 +0530
+++ b/src/sample/nashorn/dynalink/underscore_linker.js Thu Sep 28 09:13:27 2017 -0700
@@ -1,7 +1,7 @@
# underscore name translator dynalink linker example
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -37,10 +37,12 @@
$EXEC.throwOnError=true
// compile UnderscoreNameLinkerExporter
-`javac -cp ../../dist/nashorn.jar UnderscoreNameLinkerExporter.java`
+`javac UnderscoreNameLinkerExporter.java`
+
+load('jarutil.js');
// make a jar file out of pluggable linker
-`jar cvf underscore_linker.jar UnderscoreNameLinkerExporter*.class META-INF/`
+makeJar("underscore_linker.jar");
// run a sample script that uses pluggable linker
// but make sure classpath points to the pluggable linker jar!
--- a/src/sample/nashorn/exec.js Tue Sep 26 10:46:23 2017 +0530
+++ b/src/sample/nashorn/exec.js Thu Sep 28 09:13:27 2017 -0700
@@ -38,11 +38,8 @@
// It can also be given a string to use as stdin:
$EXEC("cat", "Hello, world!")
-// Additional arguments can be passed after the stdin argument, as an array of
-// strings, or a sequence of varargs (if there is no stdin, null or undefined
-// can be passed):
-$EXEC("ls", undefined, "-l", "-a")
-$EXEC("ls", undefined, ["-l", "-a"])
+// Arguments can be passed as an array of strings
+$EXEC(["ls","-l","-a"]);
// Output of running external commands is returned from $EXEC:
print($EXEC("ls"))
--- a/src/sample/nashorn/java_completion.js Tue Sep 26 10:46:23 2017 +0530
+++ b/src/sample/nashorn/java_completion.js Thu Sep 28 09:13:27 2017 -0700
@@ -38,4 +38,4 @@
var analysis = repl.sourceCodeAnalysis()
var code = "System."
var suggestions = analysis.completionSuggestions(code, code.length, [0])
-suggestions.forEach(function(s) print(s.continuation))
+suggestions.forEach(function(s) print(s.continuation()))
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/sample/nashorn/pgrep.js Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,42 @@
+#!/usr/bin/jjs --language=es6
+
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// simple process grep tool
+
+java.lang.ProcessHandle.
+ allProcesses().
+ filter(ph => {
+ var cmd = ph.info().commandLine();
+ return cmd.isPresent() && cmd.get().search(arguments[0]) != -1;
+ }).
+ forEach(ph => print(ph.pid() + " " + ph.info().commandLine().get()));
--- a/src/solaris/doc/sun/man/man1/ja/policytool.1 Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,177 +0,0 @@
-'\" t
-.\" Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
-.\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-.\"
-.\" This code is free software; you can redistribute it and/or modify it
-.\" under the terms of the GNU General Public License version 2 only, as
-.\" published by the Free Software Foundation.
-.\"
-.\" This code is distributed in the hope that it will be useful, but WITHOUT
-.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-.\" version 2 for more details (a copy is included in the LICENSE file that
-.\" accompanied this code).
-.\"
-.\" You should have received a copy of the GNU General Public License version
-.\" 2 along with this work; if not, write to the Free Software Foundation,
-.\" Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-.\"
-.\" Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-.\" or visit www.oracle.com if you need additional information or have any
-.\" questions.
-.\"
-.\" Title: policytool
-.\" Language: Japanese
-.\" Date: 2015ǯ3·î3Æü
-.\" SectDesc: ¥»¥¥å¥ê¥Æ¥£¡¦¥Ä¡¼¥ë
-.\" Software: JDK 8
-.\" Arch: ÈÆÍÑ
-.\" Part Number: E58103-01
-.\" Doc ID: JSSON
-.\"
-.if n .pl 99999
-.TH "policytool" "1" "2015ǯ3·î3Æü" "JDK 8" "¥»¥¥å¥ê¥Æ¥£¡¦¥Ä¡¼¥ë"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-.SH "̾Á°"
-policytool \- ¥æ¡¼¥Æ¥£¥ê¥Æ¥£GUI·Ðͳ¤Ç¼èÆÀ¤·¤¿¥æ¡¼¥¶¡¼ÆþÎϤ˴ð¤Å¤¤¤Æ¡¢¥×¥ì¡¼¥ó¡¦¥Æ¥¥¹¥È¤Î¥Ý¥ê¥·¡¼¡¦¥Õ¥¡¥¤¥ë¤òÆɤ߽ñ¤¤·¤Þ¤¹¡£
-.SH "³µÍ×"
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBpolicytool\fR [ \fB\-file\fR ] [ \fIfilename\fR ]
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-\-file
-.RS 4
-¥Ý¥ê¥·¡¼¡¦¥Õ¥¡¥¤¥ë¤òÆɤ߹þ¤à¤è¤¦¤Ë\fBpolicytool\fR¤Ë»Ø¼¨¤·¤Þ¤¹¡£
-.RE
-.PP
-\fIfilename\fR
-.RS 4
-¥í¡¼¥É¤¹¤ë¥Õ¥¡¥¤¥ë¤Î̾Á°¡£
-.RE
-.PP
-\fBÎã\fR:
-.PP
-¥Ý¥ê¥·¡¼¡¦¥Ä¡¼¥ë´ÉÍý¥æ¡¼¥Æ¥£¥ê¥Æ¥£¤ò¼Â¹Ô¤·¤Þ¤¹:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBpolicytool\fR
-
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-\fBpolicytool\fR¥³¥Þ¥ó¥É¤ò¼Â¹Ô¤·¡¢»ØÄꤵ¤ì¤¿¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤·¤Þ¤¹:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBpolicytool \-file \fR\fB\fImypolicyfile\fR\fR
-
-.fi
-.if n \{\
-.RE
-.\}
-.SH "ÀâÌÀ"
-.PP
-\fBpolicytool\fR¥³¥Þ¥ó¥É¤Ï¡¢´ÉÍý¼Ô¤ÎGUI¤ò¸Æ¤Ó½Ð¤·¤Þ¤¹¡£¤³¤ì¤Ë¤è¤ê¡¢¥·¥¹¥Æ¥à´ÉÍý¼Ô¤Ï¥í¡¼¥«¥ë¡¦¥Ý¥ê¥·¡¼¡¦¥Õ¥¡¥¤¥ë¤ÎÆâÍƤò´ÉÍý¤Ç¤¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£¥Ý¥ê¥·¡¼¡¦¥Õ¥¡¥¤¥ë¤Ï\fB\&.policy\fR³ÈÄ¥»Ò¤ò»ý¤Ä¥×¥ì¡¼¥ó¥Æ¥¥¹¥È¡¦¥Õ¥¡¥¤¥ë¤Ç¡¢¥É¥á¥¤¥óÊ̤˥ê¥â¡¼¥È¡¦¥ê¥¯¥¨¥¹¥¿¤ò¸¢¸Â¥ª¥Ö¥¸¥§¥¯¥È¤Ë¥Þ¥Ã¥×¤·¤Þ¤¹¡£¾ÜºÙ¤Ï¡¢http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/PolicyFiles\&.html¤Ë¤¢¤ë
-¡ÖDefault Policy Implementation and Policy File Syntax¡×¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤
-.SH "¥ª¥×¥·¥ç¥ó"
-.PP
-\-file
-.RS 4
-¥Ý¥ê¥·¡¼¡¦¥Õ¥¡¥¤¥ë¤òÆɤ߹þ¤à¤è¤¦¤Ë\fBpolicytool\fR¤Ë»Ø¼¨¤·¤Þ¤¹¡£
-.RE
-.SH "´ØÏ¢¹àÌÜ"
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-¡ÖDefault Policy Implementation and Policy File Syntax¡×
-(http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/PolicyFiles\&.html)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-¡ÖPolicy File Creation and Management¡×
-(http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/PolicyGuide\&.html)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-¡ÖPermissions in Java SE Development Kit (JDK)¡×
-(http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/permissions\&.html)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-¡ÖJava Security Overview¡×
-(http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/overview/jsoverview\&.html)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-¡ÖJava Cryptography Architecture (JCA) Reference Guide¡×
-(http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/crypto/CryptoSpec\&.html)
-.RE
-.br
-'pl 8.5i
-'bp
--- a/src/solaris/doc/sun/man/man1/jarsigner.1 Tue Sep 26 10:46:23 2017 +0530
+++ b/src/solaris/doc/sun/man/man1/jarsigner.1 Thu Sep 28 09:13:27 2017 -0700
@@ -149,7 +149,7 @@
.PP
Applications can choose different types of keystore implementations from different providers, with the \f3getInstance\fR factory method in the \f3KeyStore\fR class\&. A keystore type defines the storage and data format of the keystore information and the algorithms used to protect private keys in the keystore and the integrity of the keystore itself\&. Keystore implementations of different types are not compatible\&.
.PP
-The \f3jarsigner\fR and \f3policytool\fR commands can read file-based keystores from any location that can be specified using a URL\&. In addition, these commands can read non-file-based keystores such as those provided by MSCAPI on Windows and PKCS11 on all platforms\&.
+The \f3jarsigner\fR command can read file-based keystores from any location that can be specified using a URL\&. In addition, the command can read non-file-based keystores such as those provided by MSCAPI on Windows and PKCS11 on all platforms\&.
.PP
For the \f3jarsigner\fR and \f3keytool\fR commands, you can specify a keystore type at the command line with the \f3-storetype\fR option\&. For Policy Tool, you can specify a keystore type with the \fIEdit\fR command in the \fIKeyStore\fR menu\&.
.PP
--- a/src/solaris/doc/sun/man/man1/keytool.1 Tue Sep 26 10:46:23 2017 +0530
+++ b/src/solaris/doc/sun/man/man1/keytool.1 Thu Sep 28 09:13:27 2017 -0700
@@ -1231,7 +1231,7 @@
Applications can choose different types of keystore implementations from different providers, using the \f3getInstance\fR factory method supplied in the \f3KeyStore\fR class\&. A keystore type defines the storage and data format of the keystore information, and the algorithms used to protect private/secret keys in the keystore and the integrity of the keystore\&. Keystore implementations of different types are not compatible\&.
-The \f3keytool\fR command works on any file-based keystore implementation\&. It treats the keystore location that is passed to it at the command line as a file name and converts it to a \f3FileInputStream\fR, from which it loads the keystore information\&.)The \f3jarsigner\fR and \f3policytool\fR commands can read a keystore from any location that can be specified with a URL\&.
+The \f3keytool\fR command works on any file-based keystore implementation\&. It treats the keystore location that is passed to it at the command line as a file name and converts it to a \f3FileInputStream\fR, from which it loads the keystore information\&.)The \f3jarsigner\fR command can read a keystore from any location that can be specified with a URL\&.
For \f3keytool\fR and \f3jarsigner\fR, you can specify a keystore type at the command line, with the \f3-storetype\fR option\&. For Policy Tool, you can specify a keystore type with the \fIKeystore\fR menu\&.
--- a/src/solaris/doc/sun/man/man1/policytool.1 Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-'\" t
-.\" Copyright (c) 2001, 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.
-.\"
-.\" 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.
-.\"
-.\" Arch: generic
-.\" Software: JDK 8
-.\" Date: 03 March 2015
-.\" SectDesc: Security Tools
-.\" Title: policytool.1
-.\"
-.if n .pl 99999
-.TH policytool 1 "03 March 2015" "JDK 8" "Security Tools"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-
-.SH NAME
-policytool \- Reads and writes a plain text policy file based on user input through the utility GUI\&.
-.SH SYNOPSIS
-.sp
-.nf
-
-\fBpolicytool\fR [ \fB\-file\fR ] [ \fIfilename\fR ]
-.fi
-.sp
-.TP
--file
-.br
-Directs the \f3policytool\fR command to load a policy file\&.
-.TP
-\fIfilename\fR
-The name of the file to be loaded\&.
-.PP
-\fIExamples\fR:
-.PP
-Run the policy tool administrator utility:
-.sp
-.nf
-\f3policytool\fP
-.fi
-.nf
-\f3\fP
-.fi
-.sp
-Run the \f3policytool\fR command and load the specified file:
-.sp
-.nf
-\f3policytool \-file \fImypolicyfile\fR\fP
-.fi
-.nf
-\f3\fP
-.fi
-.sp
-.SH DESCRIPTION
-The \f3policytool\fR command calls an administrator\&'s GUI that enables system administrators to manage the contents of local policy files\&. A policy file is a plain-text file with a \f3\&.policy\fR extension, that maps remote requestors by domain, to permission objects\&. For details, see Default Policy Implementation and Policy File Syntax at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/PolicyFiles\&.html
-.SH OPTIONS
-.TP
--file
-.br
-Directs the \f3policytool\fR command to load a policy file\&.
-.SH SEE\ ALSO
-.TP 0.2i
-\(bu
-Default Policy Implementation and Policy File Syntax at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/PolicyFiles\&.html
-.TP 0.2i
-\(bu
-Policy File Creation and Management at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/PolicyGuide\&.html
-.TP 0.2i
-\(bu
-Permissions in Java SE Development Kit (JDK) at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/permissions\&.html
-.TP 0.2i
-\(bu
-Java Security Overview at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/overview/jsoverview\&.html
-.TP 0.2i
-\(bu
-Java Cryptography Architecture (JCA) Reference Guide at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/crypto/CryptoSpec\&.html
-.RE
-.br
-'pl 8.5i
-'bp
--- a/src/solaris/doc/sun/man/man1/serialver.1 Tue Sep 26 10:46:23 2017 +0530
+++ b/src/solaris/doc/sun/man/man1/serialver.1 Thu Sep 28 09:13:27 2017 -0700
@@ -100,9 +100,6 @@
.SH SEE\ ALSO
.TP 0.2i
\(bu
-policytool(1)
-.TP 0.2i
-\(bu
The \f3java\&.io\&.ObjectStream\fR class description at http://docs\&.oracle\&.com/javase/8/docs/api/java/io/ObjectStreamClass\&.html
.RE
.br
--- a/test/TestCommon.gmk Tue Sep 26 10:46:23 2017 +0530
+++ b/test/TestCommon.gmk Thu Sep 28 09:13:27 2017 -0700
@@ -273,7 +273,7 @@
prep:
@$(MKDIR) -p $(ABS_TEST_OUTPUT_DIR)
@$(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)`
- @if [ ! -d $(TEST_ROOT)/../.hg ] ; then \
+ @if [ ! -d $(TEST_ROOT)/../../.hg ] && [ ! -d $(TEST_ROOT)/../../../.hg ]; then \
$(FIND) $(TEST_ROOT) \( -name \*.dll -o -name \*.DLL -o -name \*.so \) \
-exec $(CHMOD) a+rx {} \; ; \
fi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/execstack/TestCheckJDK.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,68 @@
+/*
+ * 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 Testexecstack.java
+ * @summary Searches for all libraries in test VM and checks that they
+ * have the noexecstack bit set.
+ * @requires (os.family == "linux")
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
+ * TestCheckJDK
+ */
+
+import jdk.test.lib.Asserts;
+import sun.hotspot.WhiteBox;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+public class TestCheckJDK {
+ static boolean testPassed = true;
+ private static final WhiteBox WB = WhiteBox.getWhiteBox();
+
+ static void checkExecStack(Path file) {
+ String filename = file.toString();
+ if (filename.endsWith(".so")) {
+ if (!WB.checkLibSpecifiesNoexecstack(filename)) {
+ System.out.println("Library does not have the noexecstack bit set: " + filename);
+ testPassed = false;
+ }
+ }
+ }
+
+ public static void main(String[] args) throws Throwable {
+ String vmInstallDir = System.getProperty("java.home");
+
+ Files.walk(Paths.get(vmInstallDir)).filter(Files::isRegularFile).forEach(TestCheckJDK::checkExecStack);
+
+ Asserts.assertTrue(testPassed,
+ "The tested VM contains libs that don't have the noexecstack " +
+ "bit set. They must be linked with -z,noexecstack.");
+ }
+}
--- a/test/jdk/TEST.groups Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/TEST.groups Thu Sep 28 09:13:27 2017 -0700
@@ -468,7 +468,6 @@
com/sun/tools \
jdk/security/jarsigner \
sun/security/tools/jarsigner \
- sun/security/tools/policytool \
sun/rmi/rmic \
sun/tools \
sun/jvmstat \
@@ -785,8 +784,7 @@
-:needs_jdk
needs_headful = \
- java/util/TimeZone/DefaultTimeZoneTest.java \
- sun/security/tools/policytool
+ java/util/TimeZone/DefaultTimeZoneTest.java
needs_locales = \
-:needs_locales_and_charsets \
--- a/test/jdk/java/lang/ClassLoader/GetDotResource.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/java/lang/ClassLoader/GetDotResource.java Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,19 +26,56 @@
* @bug 4273031
* @summary ClassLoader.getResouce() should be able to
* find resources with leading "." in their names
- * @build GetDotResource
- * @run shell getdotresource.sh
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.*
+ * @run main GetDotResource
*/
-import java.net.URL;
-import java.net.URLClassLoader;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.jar.JarEntry;
+import java.util.jar.JarOutputStream;
+import jdk.testlibrary.ProcessTools;
public class GetDotResource {
- public static void main(String[] args) throws Exception {
+
+ private static final String JAR_FILENAME = "resource.jar";
+ private static final String DOT_FILENAME = ".resource";
+ private static final String CP = JAR_FILENAME + File.pathSeparator
+ + System.getProperty("test.class.path");
+
+ public static void main(String[] args) throws Throwable {
+ if (args.length == 0) {
+ createJar(JAR_FILENAME, DOT_FILENAME);
+
+ ProcessTools.executeTestJava("-cp", CP,
+ GetDotResource.class.getName(),
+ DOT_FILENAME)
+ .outputTo(System.out)
+ .errorTo(System.out)
+ .shouldHaveExitValue(0);
+ } else {
+ runTest(args[0]);
+ }
+ }
+
+ public static void runTest(String dotFileName) throws Exception {
if (GetDotResource.class.getClassLoader().
- getResourceAsStream(".resource") == null)
- throw new Exception("Could not find resource with " +
- "leading . in their names");
+ getResourceAsStream(dotFileName) == null) {
+ throw new Exception("Could not find resource with "
+ + "leading . in their names");
+ }
+ }
+
+ public static void createJar(String jarFileName, String dotFileName)
+ throws IOException {
+ try (FileOutputStream fos = new FileOutputStream(jarFileName);
+ JarOutputStream out = new JarOutputStream(fos))
+ {
+ out.putNextEntry(new JarEntry(dotFileName));
+ out.closeEntry();
+ }
}
}
--- a/test/jdk/java/lang/ClassLoader/getdotresource.sh Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-#! /bin/sh
-
-#
-# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# 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.
-#
-
-if [ x"$TESTJAVA" = x ]; then
- TESTJAVA=$1
- shift
-fi
-if [ x"$TESTCLASSES" = x ]; then TESTCLASSES=.; fi
-if [ x"$TESTSRC" = x ]; then TESTSRC=.; fi
-
-OS=`uname -s`
-case "$OS" in
- Windows* | CYGWIN* )
- PS=";"
- FS="\\"
- ;;
- * )
- PS=":"
- FS="/"
- ;;
-esac
-
-# now start the test
-${TESTJAVA}/bin/java ${TESTVMOPTS} -cp ${TESTSRC}${FS}resource.jar${PS}${TESTCLASSES} GetDotResource
Binary file test/jdk/java/lang/ClassLoader/resource.jar has changed
--- a/test/jdk/java/lang/invoke/BigArityTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/java/lang/invoke/BigArityTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, 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
@@ -22,13 +22,15 @@
*/
/* @test
- * @summary High arity invocations, up to the maximum of 255 arguments
+ * @summary High arity invocations
* @compile BigArityTest.java
* @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions -XX:-VerifyDependencies -esa -DBigArityTest.ITERATION_COUNT=1 test.java.lang.invoke.BigArityTest
*/
package test.java.lang.invoke;
+import org.junit.Test;
+
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
@@ -37,8 +39,8 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.Objects;
+
import static org.junit.Assert.assertEquals;
-import org.junit.Test;
public class BigArityTest {
@@ -63,12 +65,70 @@
static Object hashArguments(Object... args) {
return Objects.hash(args);
}
+ static Object hashArguments(int... args) {
+ Object[] wrappedArgs = new Object[args.length];
+ for (int i = 0; i < args.length; i++) {
+ wrappedArgs[i] = args[i];
+ }
+ return hashArguments(wrappedArgs);
+ }
+ static Object hashArguments(long... args) {
+ Object[] wrappedArgs = new Object[args.length];
+ for (int i = 0; i < args.length; i++) {
+ wrappedArgs[i] = (int) args[i];
+ }
+ return hashArguments(wrappedArgs);
+ }
+
+ static Object hashArguments1(Object o, Object... args) {
+ Object[] arr = new Object[args.length + 1];
+ arr[0] = 0;
+ System.arraycopy(args, 0, arr, 1, args.length);
+ return Objects.hash(arr);
+ }
+ static Object hashArguments1(int i0, int... args) {
+ Object[] wrappedArgs = new Object[args.length + 1];
+ wrappedArgs[0] = i0;
+ for (int i = 0; i < args.length; i++) {
+ wrappedArgs[i + 1] = args[i];
+ }
+ return hashArguments(wrappedArgs);
+ }
+ static Object hashArguments1(long l0, long... args) {
+ Object[] wrappedArgs = new Object[args.length + 1];
+ wrappedArgs[0] = l0;
+ for (int i = 0; i < args.length; i++) {
+ wrappedArgs[i + 1] = (int) args[i];
+ }
+ return hashArguments(wrappedArgs);
+ }
+
static final MethodHandle MH_hashArguments_VA;
+ static final MethodHandle MH_hashArguments_IVA;
+ static final MethodHandle MH_hashArguments_JVA;
+ static final MethodHandle MH_hashArguments1_VA;
+ static final MethodHandle MH_hashArguments1_IVA;
+ static final MethodHandle MH_hashArguments1_JVA;
static {
try {
MH_hashArguments_VA =
MethodHandles.lookup().unreflect(
BigArityTest.class.getDeclaredMethod("hashArguments", Object[].class));
+ MH_hashArguments_IVA =
+ MethodHandles.lookup().unreflect(
+ BigArityTest.class.getDeclaredMethod("hashArguments", int[].class));
+ MH_hashArguments_JVA =
+ MethodHandles.lookup().unreflect(
+ BigArityTest.class.getDeclaredMethod("hashArguments", long[].class));
+ MH_hashArguments1_VA =
+ MethodHandles.lookup().unreflect(
+ BigArityTest.class.getDeclaredMethod("hashArguments1", Object.class, Object[].class));
+ MH_hashArguments1_IVA =
+ MethodHandles.lookup().unreflect(
+ BigArityTest.class.getDeclaredMethod("hashArguments1", int.class, int[].class));
+ MH_hashArguments1_JVA =
+ MethodHandles.lookup().unreflect(
+ BigArityTest.class.getDeclaredMethod("hashArguments1", long.class, long[].class));
} catch (ReflectiveOperationException ex) {
throw new Error(ex);
}
@@ -345,6 +405,28 @@
assertEquals("arity=MAX_ARITY", r0, r);
}
+ @Test
+ public void testInvokeWithArgumentsJumbo() throws Throwable {
+ System.out.println("testing invokeWithArguments on jumbo arities");
+ ArrayList<Integer> arities = new ArrayList<>();
+ for (int arity = 125; arity < 1000; arity += (arity < MAX_ARITY+10 ? 1 : arity/7)) {
+ arities.add(arity);
+ Object[] args = testArgs(arity);
+ Object r0 = Objects.hash(args);
+
+ assertEquals("jumbo arity="+arity, r0, MH_hashArguments_VA.invokeWithArguments(args));
+ assertEquals("jumbo arity="+arity, r0, MH_hashArguments1_VA.invokeWithArguments(args));
+
+ // use primitive typed argument lists also:
+ assertEquals("jumbo int arity="+arity, r0, MH_hashArguments_IVA.invokeWithArguments(args));
+ assertEquals("jumbo int arity="+arity, r0, MH_hashArguments1_IVA.invokeWithArguments(args));
+
+ assertEquals("jumbo long arity="+arity, r0, MH_hashArguments_JVA.invokeWithArguments(args));
+ assertEquals("jumbo long arity="+arity, r0, MH_hashArguments1_JVA.invokeWithArguments(args));
+ }
+ System.out.println(" jumbo arities = "+arities);
+ }
+
static Object[] cat(Object a, Object[] b) {
int alen = 1, blen = b.length;
Object[] c = new Object[alen + blen];
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/invoke/InvokeWithArgumentsTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,135 @@
+/*
+ * 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
+ * @summary basic tests for MethodHandle.invokeWithArguments
+ * @run testng test.java.lang.invoke.InvokeWithArgumentsTest
+ */
+
+package test.java.lang.invoke;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.WrongMethodTypeException;
+
+import static java.lang.invoke.MethodType.methodType;
+
+public class InvokeWithArgumentsTest {
+ static final MethodHandles.Lookup L = MethodHandles.lookup();
+
+ static Object[] arity(Object o1, Object o2, Object... a) {
+ return a;
+ }
+
+ @Test
+ public void testArity() throws Throwable {
+ MethodHandle mh = L.findStatic(L.lookupClass(), "arity",
+ methodType(Object[].class, Object.class, Object.class, Object[].class));
+
+ try {
+ mh.invokeWithArguments("");
+ Assert.fail("WrongMethodTypeException expected");
+ } catch (WrongMethodTypeException e) {}
+ }
+
+ static Object[] passThrough(String... a) {
+ return a;
+ }
+
+ static Object[] pack(Object o, Object... a) {
+ return a;
+ }
+
+ @Test
+ public void testArrayNoPassThrough() throws Throwable {
+ String[] actual = {"A", "B"};
+
+ MethodHandle mh = L.findStatic(L.lookupClass(), "passThrough",
+ methodType(Object[].class, String[].class));
+
+ // Note: the actual array is not preserved, the elements will be
+ // unpacked and then packed into a new array before invoking the method
+ String[] expected = (String[]) mh.invokeWithArguments(actual);
+
+ Assert.assertTrue(actual != expected, "Array should not pass through");
+ Assert.assertEquals(actual, expected, "Array contents should be equal");
+ }
+
+ @Test
+ public void testArrayPack() throws Throwable {
+ String[] actual = new String[]{"A", "B"};
+
+ MethodHandle mh = L.findStatic(L.lookupClass(), "pack",
+ methodType(Object[].class, Object.class, Object[].class));
+
+ // Note: since String[] can be cast to Object, the actual String[] array
+ // will cast to Object become the single element of a new Object[] array
+ Object[] expected = (Object[]) mh.invokeWithArguments("", actual);
+
+ Assert.assertEquals(1, expected.length, "Array should contain just one element");
+ Assert.assertTrue(actual == expected[0], "Array should pass through");
+ }
+
+ static void intArray(int... a) {
+ }
+
+ @Test
+ public void testPrimitiveArrayWithNull() throws Throwable {
+ MethodHandle mh = L.findStatic(L.lookupClass(), "intArray",
+ methodType(void.class, int[].class));
+ try {
+ mh.invokeWithArguments(null, null);
+ Assert.fail("NullPointerException expected");
+ } catch (NullPointerException e) {}
+ }
+
+ @Test
+ public void testPrimitiveArrayWithRef() throws Throwable {
+ MethodHandle mh = L.findStatic(L.lookupClass(), "intArray",
+ methodType(void.class, int[].class));
+ try {
+ mh.invokeWithArguments("A", "B");
+ Assert.fail("ClassCastException expected");
+ } catch (ClassCastException e) {}
+ }
+
+
+ static void numberArray(Number... a) {
+ }
+
+ @Test
+ public void testRefArrayWithCast() throws Throwable {
+ MethodHandle mh = L.findStatic(L.lookupClass(), "numberArray",
+ methodType(void.class, Number[].class));
+ // All numbers, should not throw
+ mh.invokeWithArguments(1, 1.0, 1.0F, 1L);
+
+ try {
+ mh.invokeWithArguments("A");
+ Assert.fail("ClassCastException expected");
+ } catch (ClassCastException e) {}
+ }
+}
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleBaseTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleBaseTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -203,10 +203,8 @@
static List<TestAccessMode> testAccessModesOfType(TestAccessType... ats) {
Stream<TestAccessMode> s = Stream.of(TestAccessMode.values());
- for (TestAccessType at : ats) {
- s = s.filter(e -> e.isOfType(at));
- }
- return s.collect(toList());
+ return s.filter(e -> Stream.of(ats).anyMatch(e::isOfType))
+ .collect(toList());
}
static List<VarHandle.AccessMode> accessModes() {
@@ -215,10 +213,9 @@
static List<VarHandle.AccessMode> accessModesOfType(TestAccessType... ats) {
Stream<TestAccessMode> s = Stream.of(TestAccessMode.values());
- for (TestAccessType at : ats) {
- s = s.filter(e -> e.isOfType(at));
- }
- return s.map(TestAccessMode::toAccessMode).collect(toList());
+ return s.filter(e -> Stream.of(ats).anyMatch(e::isOfType))
+ .map(TestAccessMode::toAccessMode)
+ .collect(toList());
}
static MethodHandle toMethodHandle(VarHandle vh, TestAccessMode tam, MethodType mt) {
--- a/test/jdk/java/net/DatagramSocket/PortUnreachable.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/java/net/DatagramSocket/PortUnreachable.java Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2016, 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
@@ -24,11 +24,11 @@
/**
* @test
* @bug 4361783
- * @key intermittent
* @summary Test to see if ICMP Port Unreachable on non-connected
* DatagramSocket causes a SocketException "socket closed"
* exception on Windows 2000.
*/
+import java.net.BindException;
import java.net.InetAddress;
import java.net.DatagramSocket;
import java.net.DatagramPacket;
@@ -50,7 +50,7 @@
serverPort);
clientSock.send(packet);
- DatagramSocket sock = new DatagramSocket(serverPort);
+ DatagramSocket sock = recreateServerSocket(serverPort);
b = "Greetings from the server".getBytes();
packet = new DatagramPacket(b, b.length, addr, clientPort);
sock.send(packet);
@@ -60,6 +60,29 @@
}
}
+ DatagramSocket recreateServerSocket (int serverPort) throws Exception {
+ DatagramSocket serverSocket = null;
+ int retryCount = 0;
+ System.out.println("Attempting to recreate server socket with port: " +
+ serverPort);
+ while (serverSocket == null) {
+ try {
+ serverSocket = new DatagramSocket(serverPort);
+ } catch (BindException bEx) {
+ if (retryCount++ < 5) {
+ Thread.sleep(500);
+ } else {
+ System.out.println("Give up after 5 retries");
+ throw bEx;
+ }
+ }
+ }
+
+ System.out.println("PortUnreachableTest.recreateServerSocket: returning socket == "
+ + serverSocket.getLocalAddress() + ":" + serverSocket.getLocalPort());
+ return serverSocket;
+ }
+
PortUnreachable() throws Exception {
clientSock = new DatagramSocket();
@@ -103,3 +126,4 @@
}
}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/net/HugeDataTransferTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,881 @@
+/*
+ * 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 8185072
+ * @summary network006 times out in many configs in JDK10-hs nightly
+ * @run main/othervm/manual HugeDataTransferTest 1
+ */
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.net.InetAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.UnknownHostException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Random;
+
+/**
+ * This test makes huge number of data transfers between 2 Java virtual machines
+ * using the TCP/IP protocol, and checks if those data are transfered correctly.
+ * Both client and server VMs run on the same local computer and attach TCP/IP
+ * sockets to the local host, or to the loopback domain
+ * ``<code>localhost</code>'' (having IP address <code>127.0.0.1</code>).
+ *
+ * <p>
+ * In this test, 128 client/server connections are established. Once a
+ * connection is established, client passes a data parcel to server, and server
+ * reads that parcel and checks if it is same as expected (byte-to-byte equality
+ * is desired). Then server passes (some other) parcel to the client, and client
+ * reads and verifies those bytes. This ping-pong game is repeated 128 times;
+ * and after that each pair of sockets checks if there are no extra bytes
+ * accedentally passed through their connection.
+ *
+ * <p>
+ * Parcels lengths and contents are chosen randomly, and average parcel length
+ * is 128 bytes. So totally, each pair of sockets passes ~16Kb of data to each
+ * other, and thus ~32Kb of data are transfered by each sockets pair. Totally,
+ * ~4Mb of data are transfered by all client/server pairs.
+ *
+ * @author vtewari
+ */
+public class HugeDataTransferTest {
+
+ /**
+ * Timeout for TCP/IP sockets (currently set to 1 min).
+ */
+ private static int SO_TIMEOUT;// = 2*60*1000;
+
+ /**
+ * Maximal number of connections this test should open simultaneously.
+ */
+ private final static int MAX_CONNECTIONS = 128;
+
+ /**
+ * Check few more connections to make sure that MAX_CONNECTIONS are safe.
+ */
+ private final static int CONNECTIONS_RESERVE = 10;
+
+ /**
+ * The test used to fail with connection reset by peer set to 50. (and once
+ * in a three if it was set to 10). So now we set it to MAX_CONNECTIONS
+ * (128).
+ */
+ private final static int BACKLOG_QUEUE_LENGTH = MAX_CONNECTIONS;
+
+ /**
+ * Number of parcels to be sent/recieved.
+ */
+ private final static int DATA_PARCELS = 128;
+
+ /**
+ * Maximal length of data parcel to be sent/recieved (it equals to 256 bytes
+ * now).
+ */
+ private final static int MAX_PARCEL = 1 << 8;
+
+ /**
+ * Either actually display optional reports or not.
+ */
+ static private final boolean DEBUG_MODE = false;
+
+ /**
+ * How many IP sockets can we open simultaneously? Check if
+ * <code>MAX_CONNECTIONS</code> connections can be open simultaneously.
+ */
+ private static int detectOSLimitation() {
+ final int CONNECTIONS_TO_TRY = MAX_CONNECTIONS + CONNECTIONS_RESERVE;
+ display("--- Trying to open " + CONNECTIONS_TO_TRY + " connections:");
+
+ InetAddress address;
+ ServerSocket serverSocket;
+ try {
+ address = InetAddress.getLocalHost();
+ int anyPort = 0;
+ int defaultBacklog = BACKLOG_QUEUE_LENGTH;
+ serverSocket = new ServerSocket(anyPort, defaultBacklog, address);
+ } catch (IOException ioe) {
+ throw new Error("FATAL error while loading the test: " + ioe);
+ }
+ display(serverSocket.toString());
+
+ Socket server[] = new Socket[CONNECTIONS_TO_TRY];
+ Socket client[] = new Socket[CONNECTIONS_TO_TRY];
+
+ int i, port = serverSocket.getLocalPort();
+ for (i = 0; i < CONNECTIONS_TO_TRY; i++) {
+ try {
+ client[i] = new Socket(address, port);
+ display(">Open: client[" + i + "] = " + client[i]);
+ server[i] = serverSocket.accept();
+ display(">Open: server[" + i + "] = " + server[i]);
+ } catch (IOException ioe) {
+ display(">OOPS! -- failed to open connection #" + i);
+ break;
+ }
+ }
+ display("> Could open "
+ + (i < CONNECTIONS_TO_TRY ? "only " : "") + i + " connections.");
+ display(">Closing them:");
+ for (int j = 0; j < i; j++) {
+ try {
+ server[j].close();
+ client[j].close();
+ } catch (IOException ioe) {
+ throw new Error("FATAL error while loading the test: " + ioe);
+ }
+ }
+ display(">OK.");
+ int safeConnections = i - CONNECTIONS_RESERVE;
+ if (safeConnections < 1) {
+ safeConnections = 1;
+ }
+ if (safeConnections < MAX_CONNECTIONS) {
+ complain("------------------------- CAUTION: -------------------");
+ complain("While checking the OS limitations, the test found that");
+ complain("only " + i + " TCP/IP socket connections could be safely open");
+ complain("simultaneously. However, possibility to open at least");
+ complain("" + MAX_CONNECTIONS + "+" + CONNECTIONS_RESERVE
+ + " connections were expected.");
+ complain("");
+ complain("So, the test will check only " + safeConnections + " connection"
+ + (safeConnections == 1 ? "" : "s") + " which seem");
+ complain("safe to be open simultaneously.");
+ complain("------------------------------------------------------");
+ }
+ return safeConnections;
+ }
+
+ //----------------------------------------------------------------//
+ /**
+ * Re-calls to the method <code>run(args[],out)</code> actually performing
+ * the test. After <code>run(args[],out)</code> stops, follow JDK-like
+ * convention for exit codes. I.e.: stop with exit status 95 if the test has
+ * passed, or with status 97 if the test has failed.
+ *
+ * @see #run(String[],PrintStream)
+ */
+ public static void main(String args[]) {
+ int exitCode = run(args, System.out);
+ System.exit(exitCode + 95);
+ // JCK-like exit status.
+ }
+
+ public static int run(String args[], PrintStream out) {
+ HugeDataTransferTest.out = out;
+
+ //
+ // Get the Internet address of the local machine.
+ //
+ InetAddress address = null;
+ try {
+ address = InetAddress.getLocalHost();
+ } catch (UnknownHostException exception) {
+ complain(exception.toString());
+ return 2; // FAILED
+ }
+ display("Host: " + address);
+
+ //
+ // Detect if it is safe to open MAX_CONNETIONS simultaneously:
+ //
+ final int CONNECTIONS = detectOSLimitation();
+
+ //
+ // Assign ServerSocket, and start client VM which should open
+ // the prescribed number of CONNECTIONS to that ServerSocket.
+ //
+ ServerSocket serverSocket;
+ try {
+ final int anyPort = 0;
+ final int defaultBacklog = BACKLOG_QUEUE_LENGTH;
+ serverSocket = new ServerSocket(anyPort, defaultBacklog, address);
+ } catch (IOException exception) {
+ complain("Cannot assign a ServerSocket on: " + address);
+ return 2;
+ }
+
+ //
+ // Start the client process on different VM.
+ //
+ String jdkPath = System.getProperty("test.jdk");
+ Path toolName = Paths.get("bin", "java" + (isWindows() ? ".exe" : ""));
+ Path jdkTool = Paths.get(jdkPath, toolName.toString());
+
+ String IPAddress = address.getHostAddress();
+ int localPort = serverSocket.getLocalPort();
+ String arguments = " " + CONNECTIONS + " " + IPAddress + " " + localPort;
+ //String command = args[0] + " " + network006.class.getName() + "$Client " + arguments;
+ String command = jdkTool.toAbsolutePath().toString() + " " + Client.class.getName() + " " + arguments;
+ try {
+ SO_TIMEOUT = Integer.parseInt(args[0]) * 60 * 1000;
+ } catch (NumberFormatException e) {
+ complain("Wrong timeout argument: " + e);
+ return 2;
+ }
+
+ Runtime runtime = Runtime.getRuntime();
+
+ Process client = null;
+ IORedirector redirectOut = null;
+ IORedirector redirectErr = null;
+
+ try {
+ // Start clients on different JVM:
+ client = runtime.exec(command);
+
+ // Provide clients with access to stderr and stdout:
+ InputStream clientOut = client.getInputStream();
+ InputStream clientErr = client.getErrorStream();
+ redirectOut = new IORedirector(clientOut, DEBUG_MODE ? out : null);
+ redirectErr = new IORedirector(clientErr, out);
+ redirectOut.start();
+ redirectErr.start();
+
+ } catch (IOException exception) {
+ complain("Failed to start client: " + exception);
+ return 2;
+ }
+ //
+ // Start the server threads (and let them establish connections):
+ //
+
+ Server server[] = new Server[CONNECTIONS];
+ for (int i = 0; i < CONNECTIONS; i++) {
+ server[i] = new Server(serverSocket);
+ display("Server #" + i + ": " + server[i]);
+ server[i].start();
+ }
+
+ //
+ // Wait for the servers and the clients:
+ //
+ boolean testFailed = false;
+
+ try {
+ client.waitFor();
+ int clientStatus = client.exitValue();
+ display("Client VM exitCode=" + clientStatus);
+
+ // Let I/O redirectors to flush:
+ if (redirectOut.isAlive()) {
+ redirectOut.join();
+ }
+ if (redirectErr.isAlive()) {
+ redirectErr.join();
+ }
+
+ // If client has crashed, also terminate the server (to avoid hangup).
+ if (clientStatus != 95) {
+ complain("Client VM has crashed: exit status=" + clientStatus);
+ testFailed = true;
+ }
+
+ // Client has finished OK; wait for the server.
+ for (int i = 0; i < CONNECTIONS; i++) {
+ display("Server: waiting for #" + i);
+ if (server[i].isAlive()) {
+ display("Server #" + i + ": (joining...)" + server[i]);
+ server[i].join();
+ }
+ if (server[i].exception != null) {
+ if (server[i].message != null) {
+ complain("Server #" + i + "(finished): with message:" + server[i].message);
+ }
+
+ complain("Server #" + i + "(finished): " + server[i].exception);
+ server[i].exception.printStackTrace(out);
+ out.flush();
+// complain("Server #"+i+": "+server[i].exception.getStackTrace());
+ testFailed = true;
+ }
+ }
+
+ } catch (InterruptedException exception) {
+ complain("Test interrupted: " + exception);
+ testFailed = true;
+ }
+
+ if (testFailed) {
+ complain("Test failed.");
+ } else {
+ display("Test passed.");
+ }
+ return testFailed ? 2 : 0;
+ }
+
+ private static boolean isWindows() {
+ return System.getProperty("os.name").toLowerCase().startsWith("win");
+ }
+ //----------------------------------------------------------------//
+ /**
+ * Log stream for error messages and/or (optional) execution trace.
+ */
+ private static PrintStream out;
+
+ /**
+ * Print error message.
+ */
+ private static synchronized void complain(Object message) {
+ out.println("# " + message);
+ out.flush();
+ }
+
+ ;
+
+ /**
+ * Display optional report: comment ca va?
+ */
+ private static synchronized void display(Object report) {
+ if (DEBUG_MODE) {
+ out.println(report.toString());
+ }
+ out.flush(); //todo shouldn't this be inside if??
+ }
+
+ ;
+
+ //----------------------------------------------------------------//
+
+ /**
+ * Server thread should reply to data parcels sent by Client VM.
+ */
+ private static class Server extends Thread {
+
+ /**
+ * The socket is assigned at the Server instantiation.
+ */
+ private ServerSocket serverSocket;
+
+ /**
+ * The socket is assigned at the Server runtime.
+ */
+ private Socket socket;
+
+ /**
+ * Display the server socket.
+ */
+ @Override
+ public String toString() {
+
+ return "ServerSocket: " + serverSocket.toString();
+// + " socket: " + socket.toString();
+ }
+
+ /**
+ * Which port is this socket listening?
+ */
+ int getPort() {
+ return serverSocket.getLocalPort();
+ }
+
+ /**
+ * Find some free port at the given <code>address</code> and attach new
+ * server to hear that port. // lidsten to??
+ */
+ public Server(ServerSocket serverSocket) {
+ this.serverSocket = serverSocket;
+ }
+
+ /**
+ * Exception just arisen while the server was working, or
+ * <code>null</code> if it was OK with the server.
+ */
+ Exception exception = null;
+ String message = null;
+
+ /**
+ * Accept connection, then reply to client's parcels.
+ */
+ @Override
+ public void run() {
+ try {
+ socket = serverSocket.accept();
+ socket.setSoTimeout(SO_TIMEOUT);
+
+ InputStream istream = socket.getInputStream();
+ OutputStream ostream = socket.getOutputStream();
+
+ Random random = new Random(getPort());
+
+ for (int i = 0; i < DATA_PARCELS; i++) {
+ Parcel etalon = new Parcel(random);
+ message = "reading parcel number " + i;
+ Parcel sample = new Parcel(istream); // read
+ if (!sample.equals(etalon)) {
+ complain("Server thread for port #"
+ + getPort() + " got unexpected parcel:\n"
+ + "sample=" + sample + "\n"
+ + "etalon=" + etalon);
+ throw new TestFailure( //received??
+ "server has read unexpected parcel");
+ }
+ message = "sending parcel number " + i;
+ etalon.send(ostream);
+ ostream.flush();
+ }
+
+ int datum = istream.read(); // wait for client close()
+ if (datum >= 0) {
+ throw new TestFailure(
+ "server has read ambigous byte: " + datum);
+ }
+
+ ostream.close(); // implies: socket.close();
+
+ } catch (Exception oops) {
+ exception = oops;
+ }
+ }
+ }
+
+ //----------------------------------------------------------------//
+ /**
+ * Client VM should send data parcels to Server VM and recieve and verify
+ * the server's replies.
+ */
+ private static class Client extends Thread {
+
+ /**
+ * This thread uses the single client socket.
+ */
+ private Socket socket;
+
+ /**
+ * Address and port of this socket.
+ */
+ @Override
+ public String toString() {
+ return socket.toString();
+ }
+
+ /**
+ * Did the thread failed? If yes, what is the failure's reason.
+ */
+ Exception exception = null;
+ String message = null;
+
+ public static java.io.PrintStream complainStream = System.out;
+ public static java.io.PrintStream displayStream = System.err;
+
+ /**
+ * Connect client socket on the given <code>address</code> and
+ * <code>port</code>.
+ */
+ Client(InetAddress address, int port) throws IOException {
+ socket = new Socket(address, port);
+ socket.setSoTimeout(SO_TIMEOUT);
+ }
+
+ /**
+ * What is the port number this socket is listening for?
+ */
+ int getPort() {
+ return socket.getPort();
+ }
+
+ /**
+ * Establish connection, then read/respond <code>DATA_PARCELS</code>
+ * parcels of random data. Set initial seed for pseudo-random numbers
+ * generator to the value of the local port number.
+ *
+ * @see #DATA_PARCELS
+ * @see #getPort()
+ */
+ @Override
+ public void run() {
+ try {
+ InputStream istream = socket.getInputStream();
+ OutputStream ostream = socket.getOutputStream();
+
+ Random random = new Random(getPort());
+ // suggested by Oleg -- to avoid race conditions
+ /* try{
+ Thread.sleep(500);
+ }
+ catch (java.lang.InterruptedException e)
+ {
+ }*/
+
+ for (int i = 0; i < DATA_PARCELS; i++) {
+ Parcel etalon = new Parcel(random);
+ message = "sending parcel number: " + i;
+ etalon.send(ostream);
+ ostream.flush();
+
+ message = "reading parcel number: " + i;
+ Parcel sample = new Parcel(istream); // read
+ if (!sample.equals(etalon)) {
+ complain("Client thread for port #"
+ + getPort() + " got unexpected parcel:\n"
+ + "sample=" + sample + "\n"
+ + "etalon=" + etalon);
+ throw new TestFailure(
+ "parcel context is unexpected to client");
+ }
+ }
+
+ if (istream.available() > 0) {
+ int datum = istream.read();
+ throw new TestFailure(
+ "client has read ambigous byte: " + datum);
+ }
+ ostream.close(); // implies: socket.close()
+
+ } catch (Exception oops) {
+ exception = oops;
+ }
+ }
+
+ /**
+ * Establish lots of connections to server socket, attack servers with
+ * huge data parcels, and check if they reply correctly. The number of
+ * connections to try, the address and port number for the server socket
+ * are passed through <code>args[]</code>, like:
+ * <pre>
+ * java network006$Client connections_to_try address port
+ * </pre>
+ */
+ public static void main(String args[]) {
+ if (DEBUG_MODE) {
+ try {
+ String filename = "Client" + ((args.length == 3) ? args[2] : "new");
+ displayStream = new PrintStream(filename + ".out");
+ complainStream = new PrintStream(filename + ".err");
+ } catch (FileNotFoundException exception) {
+ complain(exception);
+ }
+
+ }
+
+ if (args.length != 3) {
+ complain("Client expects 3 paramenets:");
+ complain(" java " + Client.class.getName() + " connections_to_try address port");
+ exit(1); // FAILED
+ }
+
+ int CONNECTIONS = Integer.parseInt(args[0]);
+ display("Client VM: will try " + CONNECTIONS + " connections.");
+ InetAddress address;
+ try {
+ address = InetAddress.getByName(args[1]);
+ } catch (UnknownHostException exception) {
+ address = null;
+ complain("Client: cannot find host: \"" + args[1] + "\"");
+ exit(4);
+ }
+ display("Client: host to contact: " + address);
+ int port = Integer.parseInt(args[2]);
+ display("Client: port to contact: " + port);
+
+ //
+ // Establish connections, and start client processes:
+ //
+ Client client[] = new Client[CONNECTIONS];
+ for (int i = 0; i < CONNECTIONS; i++) {
+ try {
+ client[i] = new Client(address, port);
+ display("Client #" + i + ": " + client[i]);
+
+ } catch (IOException ioe) {
+ complain("Client #" + i + "(creation): " + ioe);
+ ioe.printStackTrace(complainStream);
+ complainStream.flush();
+// complain("Client #" + i + "(creation): " + ioe.getStackTrace());
+ exit(3);
+ }
+ }
+
+ for (int i = 0; i < CONNECTIONS; i++) {
+ client[i].start();
+ }
+
+ //
+ // Wait until testing is not finished:
+ //
+ int status = 0;
+ for (int i = 0; i < CONNECTIONS; i++) {
+ display("Client: waiting for #" + i);
+ if (client[i].isAlive()) {
+ display("Client #" + i + ": (joining...)" + client[i]);
+
+ try {
+ client[i].join();
+ } catch (InterruptedException ie) {
+ complain("Client #" + i + ": " + ie);
+ status = 3;
+ }
+ }
+ if (client[i].exception != null) {
+ if (client[i].message != null) {
+ complain("Client #" + i + "(finished) with message: " + client[i].message);
+ }
+ complain("Client #" + i + "(finished): " + client[i].exception);
+ client[i].exception.printStackTrace(complainStream);
+ complainStream.flush();
+ if (status == 0) {
+ status = 2;
+ }
+ }
+ }
+
+ exit(status);
+ }
+
+ /**
+ * Print error message.
+ */
+ private static synchronized void complain(Object message) {
+ complainStream.println("# " + message);
+ complainStream.flush();
+ }
+
+ /**
+ * Display execution trace.
+ */
+ private static synchronized void display(Object message) {
+ if (!DEBUG_MODE) {
+ return;
+ }
+ displayStream.println(message.toString());
+ displayStream.flush();
+ }
+
+ /**
+ * Exit with JCK-like status.
+ */
+ private static void exit(int exitCode) {
+ int status = exitCode + 95;
+// display("Client: exiting with code=" + status);
+ System.exit(status);
+ }
+ }
+
+ /**
+ * Two of such threads should redirect <code>out</code> and <code>err</code>
+ * streams of client VM.
+ */
+ private static class IORedirector extends Thread {
+
+ /**
+ * Source stream.
+ */
+ InputStream in;
+ /**
+ * Destination stream.
+ */
+ OutputStream out;
+
+ /**
+ * Redirect <code>in</code> to <code>out</code>.
+ */
+ public IORedirector(InputStream in, OutputStream out) {
+ this.in = in;
+ this.out = out;
+ }
+
+ /**
+ * Read input stream until the EOF, and write everithing to output
+ * stream. If output stream is assigned to <code>null</code>, do not
+ * print anything, but read the input stream anywhere.
+ */
+ @Override
+ public void run() {
+ try {
+ for (;;) {
+ int symbol = in.read();
+ if (symbol < 0) {
+ break; // EOF
+ }
+ if (out != null) {
+ out.write(symbol);
+ }
+ }
+
+ if (out != null) {
+ out.flush();
+ }
+
+ } catch (IOException exception) {
+ throw new TestFailure("IORedirector exception: " + exception);
+ }
+ }
+ }
+
+ //----------------------------------------------------------------//
+ /**
+ * A data parcel to be sent/recieved between Client VM and Server thread.
+ * When data parcel is sent, first 4 bytes are transfered which encode the
+ * <code>int</code> number equal to size of the parcel minus 1. I.e.: if
+ * number of data bytes in the parcel's contents is <code>N</code>, then the
+ * first 4 bytes encode the number <code>N-1</code>. After that, the
+ * parcel's contents bytes are transered.
+ */
+ static class Parcel {
+
+ private final byte[] parcel;
+
+ /**
+ * Display all bytes as integer values from 0 to 255; or return
+ * ``<tt>null</tt>'' if this Parcel is not yet initialized.
+ */
+ @Override
+ public String toString() {
+ if (parcel == null) {
+ return "null";
+ }
+ String s = "{";
+ for (int i = 0; i < parcel.length; i++) {
+ s += (i > 0 ? ", " : "") + ((int) parcel[i] & 0xFF);
+ }
+ return s + "}";
+ }
+
+ /**
+ * Generate new <code>parcel[]</code> array using the given
+ * <code>random</code> numbers generator. Client and Server threads
+ * should use identical <code>random</code> generators, so that those
+ * threads could generate equal data parcels and check the parcel just
+ * transfered.
+ */
+ public Parcel(Random random) {
+ int size = random.nextInt(MAX_PARCEL) + 1;
+ parcel = new byte[size];
+ for (int i = 0; i < size; i++) {
+ parcel[i] = (byte) random.nextInt(256);
+ }
+ }
+
+ ;
+
+ /**
+ * Read exactly <code>size</code> bytes from the <code>istream</code>
+ * if possible, or throw <code>TestFailure</code> if unexpected end of
+ * <code>istream</code> occurs.
+ */
+ private static byte[] readBytes(int size, InputStream istream)
+ throws IOException {
+
+ byte data[] = new byte[size];
+ for (int i = 0; i < size; i++) {
+ int datum = istream.read();
+ if (datum < 0) {
+ throw new TestFailure(
+ "unexpected EOF: have read: " + i + " bytes of " + size);
+ }
+ data[i] = (byte) datum;
+ }
+ return data;
+ }
+
+ /**
+ * Read 4 bytes from <code>istream</code> and threat them to encode size
+ * of data parcel following these 4 bytes.
+ */
+ private static int getSize(InputStream istream) throws IOException {
+ byte data[] = readBytes(4, istream);
+ int data0 = (int) data[0] & 0xFF;
+ int data1 = (int) data[1] & 0xFF;
+ int data2 = (int) data[2] & 0xFF;
+ int data3 = (int) data[3] & 0xFF;
+ int sizeWord = data0 + (data1 << 8) + (data2 << 16) + (data3 << 24);
+ int size = sizeWord + 1;
+ if (size <= 0) {
+ throw new TestFailure("illegal size: " + size);
+ }
+ return size;
+ }
+
+ /**
+ * Send 4 bytes encoding actual size of the parcel just to be
+ * transfered.
+ */
+ private static void putSize(OutputStream ostream, int size)
+ throws IOException {
+
+ if (size <= 0) {
+ throw new TestFailure("illegal size: " + size);
+ }
+
+ int sizeWord = size - 1;
+ byte data[] = new byte[4];
+ data[0] = (byte) sizeWord;
+ data[1] = (byte) (sizeWord >> 8);
+ data[2] = (byte) (sizeWord >> 16);
+ data[3] = (byte) (sizeWord >> 24);
+ ostream.write(data);
+ }
+
+ /**
+ * Recieve data parcel.
+ */
+ public Parcel(InputStream istream) throws IOException {
+ int size = getSize(istream);
+ parcel = readBytes(size, istream);
+ }
+
+ /**
+ * Send <code>this</code> data parcel.
+ */
+ public void send(OutputStream ostream) throws IOException {
+ int size = parcel.length;
+ putSize(ostream, size);
+ ostream.write(parcel);
+ }
+
+ /**
+ * Check byte-to-byte equality between <code>this</code> and the
+ * <code>other</code> parcels.
+ */
+ public boolean equals(Parcel other) {
+ if (this.parcel.length != other.parcel.length) {
+ return false;
+ }
+ int size = parcel.length;
+ for (int i = 0; i < size; i++) {
+ if (this.parcel[i] != other.parcel[i]) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+
+ /**
+ * Server or Client may throw this exception to report the test failure.
+ */
+ static class TestFailure extends RuntimeException {
+
+ /**
+ * Report particular <code>purpose</code> of the test failure.
+ */
+ public TestFailure(String purpose) {
+ super(purpose);
+ }
+ }
+}
--- a/test/jdk/java/net/httpclient/http2/BasicTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/java/net/httpclient/http2/BasicTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -24,7 +24,6 @@
/*
* @test
* @bug 8087112
- * @key intermittent
* @library /lib/testlibrary server
* @build jdk.testlibrary.SimpleSSLContext
* @modules jdk.incubator.httpclient/jdk.incubator.http.internal.common
--- a/test/jdk/java/net/httpclient/websocket/DummyWebSocketServer.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/java/net/httpclient/websocket/DummyWebSocketServer.java Thu Sep 28 09:13:27 2017 -0700
@@ -105,7 +105,7 @@
channel.configureBlocking(true);
StringBuilder request = new StringBuilder();
if (!readRequest(channel, request)) {
- throw new IOException("Bad request");
+ throw new IOException("Bad request:" + request);
}
List<String> strings = asList(request.toString().split("\r\n"));
List<String> response = mapping.apply(strings);
@@ -156,6 +156,7 @@
public void close() {
log.log(INFO, "Stopping: " + getURI());
thread.interrupt();
+ close(ssc);
}
URI getURI() {
@@ -169,19 +170,21 @@
throws IOException
{
ByteBuffer buffer = ByteBuffer.allocate(512);
- int num = channel.read(buffer);
- if (num == -1) {
- return false;
+ while (channel.read(buffer) != -1) {
+ // read the complete HTTP request headers, there should be no body
+ CharBuffer decoded;
+ buffer.flip();
+ try {
+ decoded = ISO_8859_1.newDecoder().decode(buffer);
+ } catch (CharacterCodingException e) {
+ throw new UncheckedIOException(e);
+ }
+ request.append(decoded);
+ if (Pattern.compile("\r\n\r\n").matcher(request).find())
+ return true;
+ buffer.clear();
}
- CharBuffer decoded;
- buffer.flip();
- try {
- decoded = ISO_8859_1.newDecoder().decode(buffer);
- } catch (CharacterCodingException e) {
- throw new UncheckedIOException(e);
- }
- request.append(decoded);
- return Pattern.compile("\r\n\r\n").matcher(request).find();
+ return false;
}
private void writeResponse(SocketChannel channel, List<String> response)
--- a/test/jdk/java/net/httpclient/websocket/LoggingHelper.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/java/net/httpclient/websocket/LoggingHelper.java Thu Sep 28 09:13:27 2017 -0700
@@ -32,7 +32,7 @@
* @run main/othervm/jul=logging.properties ClassUnderTest
*/
public static void setupLogging() {
- String path = System.getProperty("test.src") + File.separator + "logging.properties";
+ String path = System.getProperty("test.src", ".") + File.separator + "logging.properties";
System.setProperty("java.util.logging.config.file", path);
}
}
--- a/test/jdk/java/security/testlibrary/Proc.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/java/security/testlibrary/Proc.java Thu Sep 28 09:13:27 2017 -0700
@@ -323,9 +323,12 @@
br = new BufferedReader(new InputStreamReader(p.getInputStream()));
return this;
}
- String getId(String prefix) {
- if (debug != null) return prefix + "." + debug;
- else return prefix + "." + System.identityHashCode(this);
+ String getId(String suffix) {
+ if (debug != null) {
+ return debug + "." + suffix;
+ } else {
+ return System.identityHashCode(this) + "." + suffix;
+ }
}
// Reads a line from stdout of proc
public String readLine() throws IOException {
@@ -395,9 +398,13 @@
boolean isEmpty = true;
while (true) {
int i = System.in.read();
- if (i == -1) break;
+ if (i == -1) {
+ break;
+ }
isEmpty = false;
- if (i == '\n') break;
+ if (i == '\n') {
+ break;
+ }
if (i != 13) {
// Force it to a char, so only simple ASCII works.
sb.append((char)i);
--- a/test/jdk/java/util/zip/ZipFile/ReadZip.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/java/util/zip/ZipFile/ReadZip.java Thu Sep 28 09:13:27 2017 -0700
@@ -22,19 +22,27 @@
*/
/* @test
- @bug 4241361 4842702 4985614 6646605 5032358 6923692 6233323 8144977
+ @bug 4241361 4842702 4985614 6646605 5032358 6923692 6233323 8144977 8186464
@summary Make sure we can read a zip file.
@key randomness
*/
import java.io.*;
+import java.net.URI;
import java.nio.file.Files;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.NoSuchFileException;
import java.nio.file.StandardCopyOption;
import java.nio.file.StandardOpenOption;
+import java.util.List;
+import java.util.Map;
import java.util.zip.*;
+import static java.nio.charset.StandardCharsets.US_ASCII;
+
public class ReadZip {
private static void unreached (Object o)
throws Exception
@@ -137,8 +145,6 @@
newZip.delete();
}
-
-
// Throw a FNF exception when read a non-existing zip file
try { unreached (new ZipFile(
new File(System.getProperty("test.src", "."),
@@ -146,5 +152,54 @@
+ String.valueOf(new java.util.Random().nextInt())
+ ".zip")));
} catch (NoSuchFileException nsfe) {}
+
+ // read a zip file with ZIP64 end
+ Path path = Paths.get(System.getProperty("test.dir", ""), "end64.zip");
+ try {
+ URI uri = URI.create("jar:" + path.toUri());
+ Map<String, Object> env = Map.of("create", "true", "forceZIP64End", "true");
+ try (FileSystem fs = FileSystems.newFileSystem(uri, env)) {
+ Files.write(fs.getPath("hello"), "hello".getBytes());
+ }
+ try (ZipFile zf = new ZipFile(path.toFile())) {
+ if (!"hello".equals(new String(zf.getInputStream(new ZipEntry("hello"))
+ .readAllBytes(),
+ US_ASCII)))
+ throw new RuntimeException("zipfile: read entry failed");
+ } catch (IOException x) {
+ throw new RuntimeException("zipfile: zip64 end failed");
+ }
+ try (FileSystem fs = FileSystems.newFileSystem(uri, Map.of())) {
+ if (!"hello".equals(new String(Files.readAllBytes(fs.getPath("hello")))))
+ throw new RuntimeException("zipfs: read entry failed");
+ } catch (IOException x) {
+ throw new RuntimeException("zipfile: zip64 end failed");
+ }
+ } finally {
+ Files.deleteIfExists(path);
+ }
+
+ // read a zip file created via "echo hello | zip dst.zip -", which uses
+ // ZIP64 end record
+ if (Files.notExists(Paths.get("/usr/bin/zip")))
+ return;
+ try {
+ Process zip = new ProcessBuilder("zip", path.toString().toString(), "-").start();
+ OutputStream os = zip.getOutputStream();
+ os.write("hello".getBytes(US_ASCII));
+ os.close();
+ zip.waitFor();
+ if (zip.exitValue() == 0 && Files.exists(path)) {
+ try (ZipFile zf = new ZipFile(path.toFile())) {
+ if (!"hello".equals(new String(zf.getInputStream(new ZipEntry("-"))
+ .readAllBytes())))
+ throw new RuntimeException("zipfile: read entry failed");
+ } catch (IOException x) {
+ throw new RuntimeException("zipfile: zip64 end failed");
+ }
+ }
+ } finally {
+ Files.deleteIfExists(path);
+ }
}
}
--- a/test/jdk/javax/net/ssl/DTLS/DTLSBufferOverflowUnderflowTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/DTLS/DTLSBufferOverflowUnderflowTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -30,6 +30,7 @@
* @modules java.security.jgss
* jdk.security.auth
* java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/DTLS/DTLSDataExchangeTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/DTLS/DTLSDataExchangeTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -29,6 +29,7 @@
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/DTLS/DTLSEnginesClosureTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/DTLS/DTLSEnginesClosureTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -29,6 +29,7 @@
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/DTLS/DTLSHandshakeTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/DTLS/DTLSHandshakeTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -29,6 +29,7 @@
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/DTLS/DTLSHandshakeWithReplicatedPacketsTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/DTLS/DTLSHandshakeWithReplicatedPacketsTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -29,6 +29,7 @@
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/DTLS/DTLSIncorrectAppDataTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/DTLS/DTLSIncorrectAppDataTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -29,6 +29,7 @@
* @library /sun/security/krb5/auto /test/lib /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/DTLS/DTLSMFLNTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/DTLS/DTLSMFLNTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -30,6 +30,7 @@
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/DTLS/DTLSNotEnabledRC4Test.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/DTLS/DTLSNotEnabledRC4Test.java Thu Sep 28 09:13:27 2017 -0700
@@ -27,6 +27,7 @@
* @summary Testing DTLS engines do not enable RC4 ciphers by default.
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/DTLS/DTLSRehandshakeTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/DTLS/DTLSRehandshakeTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -29,6 +29,7 @@
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/DTLS/DTLSRehandshakeWithCipherChangeTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/DTLS/DTLSRehandshakeWithCipherChangeTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -29,6 +29,7 @@
* @key randomness
* @library /sun/security/krb5/auto /test/lib /javax/net/ssl/TLSCommon
* @modules java.security.jgss
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/DTLS/DTLSRehandshakeWithDataExTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/DTLS/DTLSRehandshakeWithDataExTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -30,6 +30,7 @@
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/DTLS/DTLSSequenceNumberTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/DTLS/DTLSSequenceNumberTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -30,6 +30,7 @@
* @library /sun/security/krb5/auto /test/lib /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/DTLS/DTLSUnsupportedCiphersTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/DTLS/DTLSUnsupportedCiphersTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -28,6 +28,7 @@
* causes IllegalArgumentException.
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/DTLS/TEST.properties Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/DTLS/TEST.properties Thu Sep 28 09:13:27 2017 -0700
@@ -1,4 +1,5 @@
modules = \
+ java.security.jgss/sun.security.jgss.krb5 \
java.security.jgss/sun.security.krb5:+open \
java.security.jgss/sun.security.krb5.internal.crypto \
java.security.jgss/sun.security.krb5.internal.ccache \
--- a/test/jdk/javax/net/ssl/DTLSv10/DTLSv10BufferOverflowUnderflowTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/DTLSv10/DTLSv10BufferOverflowUnderflowTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -29,6 +29,7 @@
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/DTLSv10/DTLSv10DataExchangeTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/DTLSv10/DTLSv10DataExchangeTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -29,6 +29,7 @@
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/DTLSv10/DTLSv10EnginesClosureTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/DTLSv10/DTLSv10EnginesClosureTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -29,6 +29,7 @@
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/DTLSv10/DTLSv10HandshakeTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/DTLSv10/DTLSv10HandshakeTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -29,6 +29,7 @@
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/DTLSv10/DTLSv10HandshakeWithReplicatedPacketsTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/DTLSv10/DTLSv10HandshakeWithReplicatedPacketsTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -29,6 +29,7 @@
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon /javax/net/ssl/DTLS
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/DTLSv10/DTLSv10IncorrectAppDataTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/DTLSv10/DTLSv10IncorrectAppDataTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -29,6 +29,7 @@
* @library /sun/security/krb5/auto /test/lib /javax/net/ssl/TLSCommon /javax/net/ssl/DTLS
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/DTLSv10/DTLSv10MFLNTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/DTLSv10/DTLSv10MFLNTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -30,6 +30,7 @@
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/DTLSv10/DTLSv10NotEnabledRC4Test.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/DTLSv10/DTLSv10NotEnabledRC4Test.java Thu Sep 28 09:13:27 2017 -0700
@@ -27,6 +27,7 @@
* @summary Testing DTLS engines do not enable RC4 ciphers by default.
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/DTLSv10/DTLSv10RehandshakeTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/DTLSv10/DTLSv10RehandshakeTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -29,6 +29,7 @@
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/DTLSv10/DTLSv10RehandshakeWithCipherChangeTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/DTLSv10/DTLSv10RehandshakeWithCipherChangeTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -29,6 +29,7 @@
* @key randomness
* @library /sun/security/krb5/auto /test/lib /javax/net/ssl/TLSCommon
* @modules java.security.jgss
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/DTLSv10/DTLSv10RehandshakeWithDataExTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/DTLSv10/DTLSv10RehandshakeWithDataExTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -30,6 +30,7 @@
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/DTLSv10/DTLSv10SequenceNumberTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/DTLSv10/DTLSv10SequenceNumberTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -30,6 +30,7 @@
* @library /sun/security/krb5/auto /lib/testlibrary /javax/net/ssl/TLSCommon /javax/net/ssl/DTLS
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/DTLSv10/DTLSv10UnsupportedCiphersTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/DTLSv10/DTLSv10UnsupportedCiphersTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -28,6 +28,7 @@
* causes IllegalArgumentException.
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/DTLSv10/TEST.properties Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/DTLSv10/TEST.properties Thu Sep 28 09:13:27 2017 -0700
@@ -1,4 +1,5 @@
modules = \
+ java.security.jgss/sun.security.jgss.krb5 \
java.security.jgss/sun.security.krb5:+open \
java.security.jgss/sun.security.krb5.internal.crypto \
java.security.jgss/sun.security.krb5.internal.ccache \
--- a/test/jdk/javax/net/ssl/TLS/TEST.properties Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLS/TEST.properties Thu Sep 28 09:13:27 2017 -0700
@@ -1,4 +1,5 @@
modules = \
+ java.security.jgss/sun.security.jgss.krb5 \
java.security.jgss/sun.security.krb5:+open \
java.security.jgss/sun.security.krb5.internal.crypto \
java.security.jgss/sun.security.krb5.internal.ktab \
--- a/test/jdk/javax/net/ssl/TLS/TLSClientPropertyTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLS/TLSClientPropertyTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -28,6 +28,7 @@
* @summary javax/net/ssl/TLS/TLSClientPropertyTest.java needs to be
* updated for JDK-8061210
* @modules java.security.jgss
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/TLS/TLSDataExchangeTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLS/TLSDataExchangeTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -29,6 +29,7 @@
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/TLS/TLSEnginesClosureTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLS/TLSEnginesClosureTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -29,6 +29,7 @@
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/TLS/TLSHandshakeTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLS/TLSHandshakeTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -29,6 +29,7 @@
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/TLS/TLSMFLNTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLS/TLSMFLNTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -30,6 +30,7 @@
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/TLS/TLSNotEnabledRC4Test.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLS/TLSNotEnabledRC4Test.java Thu Sep 28 09:13:27 2017 -0700
@@ -27,6 +27,7 @@
* @summary Testing TLS engines do not enable RC4 ciphers by default.
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/TLS/TLSRehandshakeTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLS/TLSRehandshakeTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -29,6 +29,7 @@
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/TLS/TLSRehandshakeWithCipherChangeTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLS/TLSRehandshakeWithCipherChangeTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -29,6 +29,7 @@
* @key randomness
* @library /sun/security/krb5/auto /test/lib /javax/net/ssl/TLSCommon
* @modules java.security.jgss
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/TLS/TLSRehandshakeWithDataExTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLS/TLSRehandshakeWithDataExTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -30,6 +30,7 @@
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/TLS/TLSUnsupportedCiphersTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLS/TLSUnsupportedCiphersTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -28,6 +28,7 @@
* causes IllegalArgumentException.
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/TLSv1/TEST.properties Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLSv1/TEST.properties Thu Sep 28 09:13:27 2017 -0700
@@ -1,4 +1,5 @@
modules = \
+ java.security.jgss/sun.security.jgss.krb5 \
java.security.jgss/sun.security.krb5:+open \
java.security.jgss/sun.security.krb5.internal.crypto \
java.security.jgss/sun.security.krb5.internal.ccache \
--- a/test/jdk/javax/net/ssl/TLSv1/TLSDataExchangeTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLSv1/TLSDataExchangeTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -29,6 +29,7 @@
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/TLSv1/TLSEnginesClosureTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLSv1/TLSEnginesClosureTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -29,6 +29,7 @@
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/TLSv1/TLSHandshakeTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLSv1/TLSHandshakeTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -29,6 +29,7 @@
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/TLSv1/TLSMFLNTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLSv1/TLSMFLNTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -30,6 +30,7 @@
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/TLSv1/TLSNotEnabledRC4Test.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLSv1/TLSNotEnabledRC4Test.java Thu Sep 28 09:13:27 2017 -0700
@@ -27,6 +27,7 @@
* @summary Testing TLS engines do not enable RC4 ciphers by default.
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/TLSv1/TLSRehandshakeTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLSv1/TLSRehandshakeTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -29,6 +29,7 @@
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/TLSv1/TLSRehandshakeWithCipherChangeTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLSv1/TLSRehandshakeWithCipherChangeTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -29,6 +29,7 @@
* @key randomness
* @library /sun/security/krb5/auto /test/lib /javax/net/ssl/TLSCommon
* @modules java.security.jgss
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/TLSv1/TLSRehandshakeWithDataExTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLSv1/TLSRehandshakeWithDataExTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -30,6 +30,7 @@
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/TLSv1/TLSUnsupportedCiphersTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLSv1/TLSUnsupportedCiphersTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -28,6 +28,7 @@
* causes IllegalArgumentException.
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/TLSv11/EmptyCertificateAuthorities.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLSv11/EmptyCertificateAuthorities.java Thu Sep 28 09:13:27 2017 -0700
@@ -34,6 +34,7 @@
* @summary Support TLS 1.1
* @run main/othervm EmptyCertificateAuthorities
* @modules java.security.jgss
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/TLSv11/ExportableBlockCipher.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLSv11/ExportableBlockCipher.java Thu Sep 28 09:13:27 2017 -0700
@@ -34,6 +34,7 @@
* @summary Support TLS 1.1
* @run main/othervm ExportableBlockCipher
* @modules java.security.jgss
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/TLSv11/ExportableStreamCipher.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLSv11/ExportableStreamCipher.java Thu Sep 28 09:13:27 2017 -0700
@@ -33,6 +33,7 @@
* @bug 4873188
* @summary Support TLS 1.1
* @modules java.security.jgss
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/TLSv11/GenericBlockCipher.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLSv11/GenericBlockCipher.java Thu Sep 28 09:13:27 2017 -0700
@@ -28,6 +28,7 @@
* @bug 4873188
* @summary Support TLS 1.1
* @modules java.security.jgss
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/TLSv11/GenericStreamCipher.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLSv11/GenericStreamCipher.java Thu Sep 28 09:13:27 2017 -0700
@@ -28,6 +28,7 @@
* @bug 4873188
* @summary Support TLS 1.1
* @modules java.security.jgss
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/TLSv11/TEST.properties Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLSv11/TEST.properties Thu Sep 28 09:13:27 2017 -0700
@@ -1,4 +1,5 @@
modules = \
+ java.security.jgss/sun.security.jgss.krb5 \
java.security.jgss/sun.security.krb5:+open \
java.security.jgss/sun.security.krb5.internal.crypto \
java.security.jgss/sun.security.krb5.internal.ccache \
--- a/test/jdk/javax/net/ssl/TLSv11/TLSDataExchangeTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLSv11/TLSDataExchangeTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -29,6 +29,7 @@
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/TLSv11/TLSEnginesClosureTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLSv11/TLSEnginesClosureTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -29,6 +29,7 @@
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/TLSv11/TLSHandshakeTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLSv11/TLSHandshakeTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -29,6 +29,7 @@
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/TLSv11/TLSMFLNTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLSv11/TLSMFLNTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -30,6 +30,7 @@
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/TLSv11/TLSNotEnabledRC4Test.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLSv11/TLSNotEnabledRC4Test.java Thu Sep 28 09:13:27 2017 -0700
@@ -27,6 +27,7 @@
* @summary Testing TLS engines do not enable RC4 ciphers by default.
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/TLSv11/TLSRehandshakeTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLSv11/TLSRehandshakeTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -29,6 +29,7 @@
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/TLSv11/TLSRehandshakeWithCipherChangeTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLSv11/TLSRehandshakeWithCipherChangeTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -29,6 +29,7 @@
* @key randomness
* @library /sun/security/krb5/auto /test/lib /javax/net/ssl/TLSCommon
* @modules java.security.jgss
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/TLSv11/TLSRehandshakeWithDataExTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLSv11/TLSRehandshakeWithDataExTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -30,6 +30,7 @@
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/javax/net/ssl/TLSv11/TLSUnsupportedCiphersTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/javax/net/ssl/TLSv11/TLSUnsupportedCiphersTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -28,6 +28,7 @@
* causes IllegalArgumentException.
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @modules java.security.jgss
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.krb5.internal.ccache
--- a/test/jdk/sun/security/krb5/auto/BasicProc.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/sun/security/krb5/auto/BasicProc.java Thu Sep 28 09:13:27 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
@@ -23,170 +23,312 @@
/*
* @test
- * @bug 8009977
- * @summary A test library to launch multiple Java processes
+ * @bug 8009977 8186884
+ * @summary A test to launch multiple Java processes using either Java GSS
+ * or native GSS
* @library ../../../../java/security/testlibrary/
* @compile -XDignore.symbol.file BasicProc.java
- * @run main/othervm BasicProc
+ * @run main/othervm BasicProc launcher
*/
-import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.nio.file.attribute.PosixFilePermission;
+import java.util.Arrays;
+import java.util.PropertyPermission;
+import java.util.Random;
+import java.util.Set;
+
import org.ietf.jgss.Oid;
+import sun.security.krb5.Config;
import javax.security.auth.PrivateCredentialPermission;
+/**
+ * Run this test automatically and test Java GSS with embedded KDC.
+ *
+ * Run with customized native.krb5.libs to test interop between Java GSS
+ * and native GSS, and native.kdc.path with a native KDC. For example,
+ * run the following command to test interop among Java, default native,
+ * MIT, and Heimdal krb5 libraries with the Heimdal KDC:
+ *
+ * jtreg -Dnative.krb5.libs=j=,
+ * n=,
+ * k=/usr/local/krb5/lib/libgssapi_krb5.so,
+ * h=/space/install/heimdal/lib/libgssapi.so \
+ * -Dnative.kdc.path=/usr/local/heimdal \
+ * BasicProc.java
+ *
+ * Note: The first 4 lines should be concatenated to make a long system
+ * property value with no blank around ",". This comma-separated value
+ * has each element being name=libpath. The special name "j" means the
+ * Java library and libpath is ignored. Otherwise it means a native library,
+ * and libpath (can be empty) will be the value for the sun.security.jgss.lib
+ * system property. If this system property is not set, only the Java
+ * library will be tested.
+ */
+
public class BasicProc {
- static String CONF = "krb5.conf";
- static String KTAB = "ktab";
+ private static final String CONF = "krb5.conf";
+ private static final String KTAB_S = "server.ktab";
+ private static final String KTAB_B = "backend.ktab";
+
+ private static final String HOST = "localhost";
+ private static final String SERVER = "server/" + HOST;
+ private static final String BACKEND = "backend/" + HOST;
+ private static final String USER = "user";
+ private static final char[] PASS = "password".toCharArray();
+ private static final String REALM = "REALM";
+
+ private static final int MSGSIZE = 1024;
+
public static void main(String[] args) throws Exception {
- String HOST = "localhost";
- String SERVER = "server/" + HOST;
- String BACKEND = "backend/" + HOST;
- String USER = "user";
- char[] PASS = "password".toCharArray();
- String REALM = "REALM";
Oid oid = new Oid("1.2.840.113554.1.2.2");
+ byte[] token, msg;
- if (args.length == 0) {
- System.setProperty("java.security.krb5.conf", CONF);
- KDC kdc = KDC.create(REALM, HOST, 0, true);
- kdc.addPrincipal(USER, PASS);
- kdc.addPrincipalRandKey("krbtgt/" + REALM);
- kdc.addPrincipalRandKey(SERVER);
- kdc.addPrincipalRandKey(BACKEND);
+ switch (args[0]) {
+ case "launcher":
+ KDC kdc = KDC.create(REALM, HOST, 0, true);
+ try {
+ kdc.addPrincipal(USER, PASS);
+ kdc.addPrincipalRandKey("krbtgt/" + REALM);
+ kdc.addPrincipalRandKey(SERVER);
+ kdc.addPrincipalRandKey(BACKEND);
+
+ // Native lib might do some name lookup
+ KDC.saveConfig(CONF, kdc,
+ "dns_lookup_kdc = no",
+ "ticket_lifetime = 1h",
+ "dns_lookup_realm = no",
+ "dns_canonicalize_hostname = false",
+ "forwardable = true");
+ System.setProperty("java.security.krb5.conf", CONF);
+ Config.refresh();
+ kdc.writeKtab(KTAB_S, false, SERVER);
+ kdc.writeKtab(KTAB_B, false, BACKEND);
+
+ String[] tmp = System.getProperty("native.krb5.libs", "j=")
+ .split(",");
+
+ // Library paths. The 1st one is always null which means
+ // Java, "" means the default native lib.
+ String[] libs = new String[tmp.length];
+
+ // Names for each lib above. Use in file names.
+ String[] names = new String[tmp.length];
+
+ boolean hasNative = false;
+
+ for (int i = 0; i < tmp.length; i++) {
+ if (tmp[i].isEmpty()) {
+ throw new Exception("Invalid native.krb5.libs");
+ }
+ String[] pair = tmp[i].split("=", 2);
+ names[i] = pair[0];
+ if (!pair[0].equals("j")) {
+ libs[i] = pair.length > 1 ? pair[1] : "";
+ hasNative = true;
+ }
+ }
+
+ if (hasNative) {
+ kdc.kinit(USER, "base.ccache");
+ }
+
+ // Try the same lib first
+ for (int i = 0; i < libs.length; i++) {
+ once(names[i] + names[i] + names[i],
+ libs[i], libs[i], libs[i]);
+ }
- String cwd = System.getProperty("user.dir");
- kdc.writeKtab(KTAB);
- KDC.saveConfig(CONF, kdc, "forwardable = true");
+ for (int i = 0; i < libs.length; i++) {
+ for (int j = 0; j < libs.length; j++) {
+ for (int k = 0; k < libs.length; k++) {
+ if (i != j || i != k) {
+ once(names[i] + names[j] + names[k],
+ libs[i], libs[j], libs[k]);
+ }
+ }
+ }
+ }
+ } finally {
+ kdc.terminate();
+ }
+ break;
+ case "client":
+ Context c = args[1].equals("n") ?
+ Context.fromThinAir() :
+ Context.fromUserPass(USER, PASS, false);
+ c.startAsClient(SERVER, oid);
+ c.x().requestCredDeleg(true);
+ Proc.binOut(c.take(new byte[0])); // AP-REQ
+ token = Proc.binIn(); // AP-REP
+ c.take(token);
+ break;
+ case "server":
+ Context s = args[1].equals("n") ?
+ Context.fromThinAir() :
+ Context.fromUserKtab(SERVER, KTAB_S, true);
+ s.startAsServer(oid);
+ token = Proc.binIn(); // AP-REQ
+ token = s.take(token);
+ Proc.binOut(token); // AP-REP
+ Context s2 = s.delegated();
+ s2.startAsClient(BACKEND, oid);
+ Proc.binOut(s2.take(new byte[0])); // AP-REQ
+ token = Proc.binIn();
+ s2.take(token); // AP-REP
+ Random r = new Random();
+ msg = new byte[MSGSIZE];
+ r.nextBytes(msg);
+ Proc.binOut(s2.wrap(msg, true)); // enc1
+ Proc.binOut(s2.wrap(msg, true)); // enc2
+ Proc.binOut(s2.wrap(msg, true)); // enc3
+ s2.verifyMic(Proc.binIn(), msg); // mic
+ byte[] msg2 = Proc.binIn(); // msg
+ if (!Arrays.equals(msg, msg2)) {
+ throw new Exception("diff msg");
+ }
+ break;
+ case "backend":
+ Context b = args[1].equals("n") ?
+ Context.fromThinAir() :
+ Context.fromUserKtab(BACKEND, KTAB_B, true);
+ b.startAsServer(oid);
+ token = Proc.binIn(); // AP-REQ
+ Proc.binOut(b.take(token)); // AP-REP
+ msg = b.unwrap(Proc.binIn(), true); // enc1
+ if (!Arrays.equals(msg, b.unwrap(Proc.binIn(), true))) { // enc2
+ throw new Exception("diff msg");
+ }
+ if (!Arrays.equals(msg, b.unwrap(Proc.binIn(), true))) { // enc3
+ throw new Exception("diff msg");
+ }
+ Proc.binOut(b.getMic(msg)); // mic
+ Proc.binOut(msg); // msg
+ break;
+ }
+ }
+
+ /**
+ * One test run.
+ *
+ * @param label test label
+ * @param lc lib of client
+ * @param ls lib of server
+ * @param lb lib of backend
+ */
+ private static void once(String label, String lc, String ls, String lb)
+ throws Exception {
- Proc pc = Proc.create("BasicProc")
- .args("client")
- .prop("java.security.krb5.conf", CONF)
- .prop("java.security.manager", "")
- .perm(new java.util.PropertyPermission(
+ Proc pc = proc(lc)
+ .args("client", lc == null ? "j" : "n")
+ .perm(new javax.security.auth.kerberos.ServicePermission(
+ "krbtgt/" + REALM + "@" + REALM, "initiate"))
+ .perm(new javax.security.auth.kerberos.ServicePermission(
+ SERVER + "@" + REALM, "initiate"))
+ .perm(new javax.security.auth.kerberos.DelegationPermission(
+ "\"" + SERVER + "@" + REALM + "\" " +
+ "\"krbtgt/" + REALM + "@" + REALM + "\""))
+ .debug(label + "-C");
+ if (lc == null) {
+ // for Krb5LoginModule::promptForName
+ pc.perm(new PropertyPermission("user.name", "read"));
+ } else {
+ Files.copy(Paths.get("base.ccache"), Paths.get(label + ".ccache"));
+ Files.setPosixFilePermissions(Paths.get(label + ".ccache"),
+ Set.of(PosixFilePermission.OWNER_READ,
+ PosixFilePermission.OWNER_WRITE));
+ pc.env("KRB5CCNAME", label + ".ccache");
+ // Do not try system ktab if ccache fails
+ pc.env("KRB5_KTNAME", "none");
+ }
+ pc.start();
+
+ Proc ps = proc(ls)
+ .args("server", ls == null ? "j" : "n")
+ .perm(new javax.security.auth.kerberos.ServicePermission(
+ SERVER + "@" + REALM, "accept"))
+ .perm(new javax.security.auth.kerberos.ServicePermission(
+ BACKEND + "@" + REALM, "initiate"))
+ .debug(label + "-S");
+ if (ls == null) {
+ ps.perm(new PrivateCredentialPermission(
+ "javax.security.auth.kerberos.KeyTab * \"*\"", "read"))
+ .perm(new java.io.FilePermission(KTAB_S, "read"));
+ } else {
+ ps.env("KRB5_KTNAME", KTAB_S);
+ }
+ ps.start();
+
+ Proc pb = proc(lb)
+ .args("backend", lb == null ? "j" : "n")
+ .perm(new javax.security.auth.kerberos.ServicePermission(
+ BACKEND + "@" + REALM, "accept"))
+ .debug(label + "-B");
+ if (lb == null) {
+ pb.perm(new PrivateCredentialPermission(
+ "javax.security.auth.kerberos.KeyTab * \"*\"", "read"))
+ .perm(new java.io.FilePermission(KTAB_B, "read"));
+ } else {
+ pb.env("KRB5_KTNAME", KTAB_B);
+ }
+ pb.start();
+
+ // Client and server handshake
+ ps.println(pc.readData());
+ pc.println(ps.readData());
+
+ // Server and backend handshake
+ pb.println(ps.readData());
+ ps.println(pb.readData());
+
+ // wrap/unwrap/getMic/verifyMic and plain text
+ pb.println(ps.readData());
+ pb.println(ps.readData());
+ pb.println(ps.readData());
+ ps.println(pb.readData());
+ ps.println(pb.readData());
+
+ if ((pc.waitFor() | ps.waitFor() | pb.waitFor()) != 0) {
+ throw new Exception("Process failed");
+ }
+ }
+
+ /**
+ * A Proc for a child process.
+ *
+ * @param lib the library. Null is Java. "" is default native lib.
+ */
+ private static Proc proc(String lib) throws Exception {
+ Proc p = Proc.create("BasicProc")
+ .prop("java.security.manager", "")
+ .perm(new javax.security.auth.AuthPermission("doAs"));
+ if (lib != null) {
+ p.env("KRB5_CONFIG", CONF)
+ .env("KRB5_TRACE", "/dev/stderr")
+ .prop("sun.security.jgss.native", "true")
+ .prop("sun.security.jgss.lib", lib)
+ .prop("javax.security.auth.useSubjectCredsOnly", "false")
+ .prop("sun.security.nativegss.debug", "true");
+ int pos = lib.lastIndexOf('/');
+ if (pos > 0) {
+ p.env("LD_LIBRARY_PATH", lib.substring(0, pos));
+ p.env("DYLD_LIBRARY_PATH", lib.substring(0, pos));
+ }
+ } else {
+ p.perm(new java.util.PropertyPermission(
"sun.security.krb5.principal", "read"))
- .perm(new javax.security.auth.AuthPermission(
- "modifyPrincipals"))
- .perm(new javax.security.auth.AuthPermission(
- "modifyPrivateCredentials"))
- .perm(new javax.security.auth.AuthPermission("doAs"))
- .perm(new javax.security.auth.kerberos.ServicePermission(
- "krbtgt/" + REALM + "@" + REALM, "initiate"))
- .perm(new javax.security.auth.kerberos.ServicePermission(
- "server/localhost@" + REALM, "initiate"))
- .perm(new javax.security.auth.kerberos.DelegationPermission(
- "\"server/localhost@" + REALM + "\" " +
- "\"krbtgt/" + REALM + "@" + REALM + "\""))
- .debug("C")
- .start();
- Proc ps = Proc.create("BasicProc")
- .args("server")
- .prop("java.security.krb5.conf", CONF)
- .prop("java.security.manager", "")
- .perm(new java.util.PropertyPermission(
- "sun.security.krb5.principal", "read"))
+ // For Krb5LoginModule::login.
.perm(new javax.security.auth.AuthPermission(
"modifyPrincipals"))
.perm(new javax.security.auth.AuthPermission(
"modifyPrivateCredentials"))
- .perm(new javax.security.auth.AuthPermission("doAs"))
- .perm(new PrivateCredentialPermission(
- "javax.security.auth.kerberos.KeyTab * \"*\"",
- "read"))
- .perm(new javax.security.auth.kerberos.ServicePermission(
- "server/localhost@" + REALM, "accept"))
- .perm(new java.io.FilePermission(
- cwd + File.separator + KTAB, "read"))
- .perm(new javax.security.auth.kerberos.ServicePermission(
- "backend/localhost@" + REALM, "initiate"))
- .debug("S")
- .start();
- Proc pb = Proc.create("BasicProc")
- .args("backend")
- .prop("java.security.krb5.conf", CONF)
- .prop("java.security.manager", "")
- .perm(new java.util.PropertyPermission(
- "sun.security.krb5.principal", "read"))
- .perm(new javax.security.auth.AuthPermission(
- "modifyPrincipals"))
- .perm(new javax.security.auth.AuthPermission(
- "modifyPrivateCredentials"))
- .perm(new javax.security.auth.AuthPermission("doAs"))
- .perm(new PrivateCredentialPermission(
- "javax.security.auth.kerberos.KeyTab * \"*\"",
- "read"))
- .perm(new javax.security.auth.kerberos.ServicePermission(
- "backend/localhost@" + REALM, "accept"))
- .perm(new java.io.FilePermission(
- cwd + File.separator + KTAB, "read"))
- .debug("B")
- .start();
-
- // Client and server handshake
- String token = pc.readData();
- ps.println(token);
- token = ps.readData();
- pc.println(token);
- // Server and backend handshake
- token = ps.readData();
- pb.println(token);
- token = pb.readData();
- ps.println(token);
- // wrap/unwrap/getMic/verifyMic and plain text
- token = ps.readData();
- pb.println(token);
- token = pb.readData();
- ps.println(token);
- token = pb.readData();
- ps.println(token);
-
- if ((pc.waitFor() | ps.waitFor() | pb.waitFor()) != 0) {
- throw new Exception();
- }
- } else if (args[0].equals("client")) {
- Context c = Context.fromUserPass(USER, PASS, false);
- c.startAsClient(SERVER, oid);
- c.x().requestCredDeleg(true);
- Proc.binOut(c.take(new byte[0]));
- byte[] token = Proc.binIn();
- c.take(token);
- } else if (args[0].equals("server")) {
- Context s = Context.fromUserKtab(SERVER, KTAB, true);
- s.startAsServer(oid);
- byte[] token = Proc.binIn();
- token = s.take(token);
- Proc.binOut(token);
- Context s2 = s.delegated();
- s2.startAsClient(BACKEND, oid);
- Proc.binOut(s2.take(new byte[0]));
- token = Proc.binIn();
- s2.take(token);
- byte[] msg = "Hello".getBytes();
- Proc.binOut(s2.wrap(msg, true));
- s2.verifyMic(Proc.binIn(), msg);
- String in = Proc.textIn();
- if (!in.equals("Hello")) {
- throw new Exception();
- }
- } else if (args[0].equals("backend")) {
- Context b = Context.fromUserKtab(BACKEND, KTAB, true);
- b.startAsServer(oid);
- byte[] token = Proc.binIn();
- Proc.binOut(b.take(token));
- byte[] msg = b.unwrap(Proc.binIn(), true);
- Proc.binOut(b.getMic(msg));
- Proc.textOut(new String(msg));
+ .prop("sun.security.krb5.debug", "true")
+ .prop("java.security.krb5.conf", CONF);
}
- }
- // create a native server
- private static Proc ns(Proc p) throws Exception {
- return p
- .env("KRB5_CONFIG", CONF)
- .env("KRB5_KTNAME", KTAB)
- .prop("sun.security.jgss.native", "true")
- .prop("javax.security.auth.useSubjectCredsOnly", "false")
- .prop("sun.security.nativegss.debug", "true");
+ return p;
}
}
--- a/test/jdk/sun/security/krb5/auto/Context.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/sun/security/krb5/auto/Context.java Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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,6 +23,7 @@
import com.sun.security.auth.module.Krb5LoginModule;
+import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.security.PrivilegedActionException;
@@ -31,6 +32,11 @@
import java.util.HashMap;
import java.util.Map;
import javax.security.auth.Subject;
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.NameCallback;
+import javax.security.auth.callback.PasswordCallback;
+import javax.security.auth.callback.UnsupportedCallbackException;
import javax.security.auth.kerberos.KerberosKey;
import javax.security.auth.kerberos.KerberosTicket;
import javax.security.auth.login.LoginContext;
@@ -41,9 +47,14 @@
import org.ietf.jgss.GSSName;
import org.ietf.jgss.MessageProp;
import org.ietf.jgss.Oid;
+import sun.security.jgss.krb5.Krb5Util;
+import sun.security.krb5.Credentials;
+import sun.security.krb5.internal.ccache.CredentialsCache;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.security.Principal;
+import java.util.Set;
/**
* Context of a JGSS subject, encapsulating Subject and GSSContext.
@@ -149,24 +160,36 @@
Map<String, String> map = new HashMap<>();
Map<String, Object> shared = new HashMap<>();
+ if (storeKey) {
+ map.put("storeKey", "true");
+ }
+
if (pass != null) {
- map.put("useFirstPass", "true");
- shared.put("javax.security.auth.login.name", user);
- shared.put("javax.security.auth.login.password", pass);
+ krb5.initialize(out.s, new CallbackHandler() {
+ @Override
+ public void handle(Callback[] callbacks)
+ throws IOException, UnsupportedCallbackException {
+ for (Callback cb: callbacks) {
+ if (cb instanceof NameCallback) {
+ ((NameCallback)cb).setName(user);
+ } else if (cb instanceof PasswordCallback) {
+ ((PasswordCallback)cb).setPassword(pass);
+ }
+ }
+ }
+ }, shared, map);
} else {
map.put("doNotPrompt", "true");
map.put("useTicketCache", "true");
if (user != null) {
map.put("principal", user);
}
- }
- if (storeKey) {
- map.put("storeKey", "true");
+ krb5.initialize(out.s, null, shared, map);
}
- krb5.initialize(out.s, null, shared, map);
krb5.login();
krb5.commit();
+
return out;
}
@@ -529,9 +552,23 @@
* @param s2 the receiver
* @throws java.lang.Exception If anything goes wrong
*/
- static public void transmit(final String message, final Context s1,
+ static public void transmit(String message, final Context s1,
+ final Context s2) throws Exception {
+ transmit(message.getBytes(), s1, s2);
+ }
+
+ /**
+ * Transmits a message from one Context to another. The sender wraps the
+ * message and sends it to the receiver. The receiver unwraps it, creates
+ * a MIC of the clear text and sends it back to the sender. The sender
+ * verifies the MIC against the message sent earlier.
+ * @param messageBytes the message
+ * @param s1 the sender
+ * @param s2 the receiver
+ * @throws java.lang.Exception If anything goes wrong
+ */
+ static public void transmit(byte[] messageBytes, final Context s1,
final Context s2) throws Exception {
- final byte[] messageBytes = message.getBytes();
System.out.printf("-------------------- TRANSMIT from %s to %s------------------------\n",
s1.name, s2.name);
byte[] wrapped = s1.wrap(messageBytes, true);
@@ -619,6 +656,32 @@
}
/**
+ * Saves the tickets to a ccache file.
+ *
+ * @param file pathname of the ccache file
+ * @return true if created, false otherwise.
+ */
+ public boolean ccache(String file) throws Exception {
+ Set<KerberosTicket> tickets
+ = s.getPrivateCredentials(KerberosTicket.class);
+ if (tickets != null && !tickets.isEmpty()) {
+ CredentialsCache cc = null;
+ for (KerberosTicket t : tickets) {
+ Credentials cred = Krb5Util.ticketToCreds(t);
+ if (cc == null) {
+ cc = CredentialsCache.create(cred.getClient(), file);
+ }
+ cc.update(cred.toCCacheCreds());
+ }
+ if (cc != null) {
+ cc.save();
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
* Handshake (security context establishment process) between two Contexts
* @param c the initiator
* @param s the acceptor
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sun/security/krb5/auto/DiffSaltParams.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,50 @@
+/*
+ * 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 8186831
+ * @summary Kerberos ignores PA-DATA with a non-null s2kparams
+ * @compile -XDignore.symbol.file DiffSaltParams.java
+ * @run main/othervm -Dsun.security.krb5.debug=true DiffSaltParams
+ */
+
+public class DiffSaltParams {
+
+ public static void main(String[] args) throws Exception {
+
+ OneKDC kdc = new OneKDC(null).writeJAASConf();
+ kdc.addPrincipal("user1", "user1pass".toCharArray(),
+ "hello", new byte[]{0, 0, 1, 0});
+ kdc.addPrincipal("user2", "user2pass".toCharArray(),
+ "hello", null);
+ kdc.addPrincipal("user3", "user3pass".toCharArray(),
+ null, new byte[]{0, 0, 1, 0});
+ kdc.addPrincipal("user4", "user4pass".toCharArray());
+
+ Context.fromUserPass("user1", "user1pass".toCharArray(), true);
+ Context.fromUserPass("user2", "user2pass".toCharArray(), true);
+ Context.fromUserPass("user3", "user3pass".toCharArray(), true);
+ Context.fromUserPass("user4", "user4pass".toCharArray(), true);
+ }
+}
--- a/test/jdk/sun/security/krb5/auto/HttpNegotiateServer.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/sun/security/krb5/auto/HttpNegotiateServer.java Thu Sep 28 09:13:27 2017 -0700
@@ -28,6 +28,7 @@
* java.security.jgss/sun.security.krb5.internal:+open
* java.security.jgss/sun.security.jgss
* java.security.jgss/sun.security.krb5:+open
+ * java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5.internal.ccache
* java.security.jgss/sun.security.krb5.internal.crypto
* java.security.jgss/sun.security.krb5.internal.ktab
--- a/test/jdk/sun/security/krb5/auto/KDC.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/sun/security/krb5/auto/KDC.java Thu Sep 28 09:13:27 2017 -0700
@@ -27,11 +27,12 @@
import java.net.*;
import java.io.*;
import java.lang.reflect.Method;
-import java.security.SecureRandom;
-import java.time.Instant;
-import java.time.temporal.ChronoUnit;
+import java.nio.file.Files;
+import java.nio.file.Paths;
import java.util.*;
import java.util.concurrent.*;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
import sun.security.krb5.*;
import sun.security.krb5.internal.*;
@@ -45,6 +46,11 @@
/**
* A KDC server.
+ *
+ * Note: By setting the system property native.kdc.path to a native
+ * krb5 installation, this class starts a native KDC with the
+ * given realm and host. It can also add new principals and save keytabs.
+ * Other features might not be available.
* <p>
* Features:
* <ol>
@@ -125,19 +131,38 @@
public static final int DEFAULT_LIFETIME = 39600;
public static final int DEFAULT_RENEWTIME = 86400;
- public static String NOT_EXISTING_HOST = "not.existing.host";
+ public static final String NOT_EXISTING_HOST = "not.existing.host";
+
+ // What etypes the KDC supports. Comma-separated strings. Null for all.
+ // Please note native KDCs might use different names.
+ private static final String SUPPORTED_ETYPES
+ = System.getProperty("kdc.supported.enctypes");
+
+ // The native KDC
+ private final NativeKdc nativeKdc;
+
+ // The native KDC process
+ private Process kdcProc = null;
// Under the hood.
- // The random generator to generate random keys (including session keys)
- private static SecureRandom secureRandom = new SecureRandom();
-
// Principal db. principal -> pass. A case-insensitive TreeMap is used
// so that even if the client provides a name with different case, the KDC
// can still locate the principal and give back correct salt.
private TreeMap<String,char[]> passwords = new TreeMap<>
(String.CASE_INSENSITIVE_ORDER);
+ // Non default salts. Precisely, there should be different salts for
+ // different etypes, pretend they are the same at the moment.
+ private TreeMap<String,String> salts = new TreeMap<>
+ (String.CASE_INSENSITIVE_ORDER);
+
+ // Non default s2kparams for newer etypes. Precisely, there should be
+ // different s2kparams for different etypes, pretend they are the same
+ // at the moment.
+ private TreeMap<String,byte[]> s2kparamses = new TreeMap<>
+ (String.CASE_INSENSITIVE_ORDER);
+
// Realm name
private String realm;
// KDC
@@ -218,7 +243,8 @@
static {
if (System.getProperty("jdk.net.hosts.file") == null) {
- String hostsFileName = System.getProperty("test.src", ".") + "/TestHosts";
+ String hostsFileName
+ = System.getProperty("test.src", ".") + "/TestHosts";
System.setProperty("jdk.net.hosts.file", hostsFileName);
}
}
@@ -262,7 +288,8 @@
* @return the running KDC instance
* @throws java.io.IOException for any socket creation error
*/
- public static KDC create(String realm, String kdc, int port, boolean asDaemon) throws IOException {
+ public static KDC create(String realm, String kdc, int port,
+ boolean asDaemon) throws IOException {
return new KDC(realm, kdc, port, asDaemon);
}
@@ -302,26 +329,38 @@
*/
public void writeKtab(String tab, boolean append, String... names)
throws IOException, KrbException {
- KeyTab ktab = append ? KeyTab.getInstance(tab) : KeyTab.create(tab);
+ KeyTab ktab = null;
+ if (nativeKdc == null) {
+ ktab = append ? KeyTab.getInstance(tab) : KeyTab.create(tab);
+ }
Iterable<String> entries =
(names.length != 0) ? Arrays.asList(names): passwords.keySet();
for (String name : entries) {
- char[] pass = passwords.get(name);
- int kvno = 0;
- if (Character.isDigit(pass[pass.length-1])) {
- kvno = pass[pass.length-1] - '0';
+ if (name.indexOf('@') < 0) {
+ name = name + "@" + realm;
}
- PrincipalName pn = new PrincipalName(name,
+ if (nativeKdc == null) {
+ char[] pass = passwords.get(name);
+ int kvno = 0;
+ if (Character.isDigit(pass[pass.length - 1])) {
+ kvno = pass[pass.length - 1] - '0';
+ }
+ PrincipalName pn = new PrincipalName(name,
name.indexOf('/') < 0 ?
- PrincipalName.KRB_NT_UNKNOWN :
- PrincipalName.KRB_NT_SRV_HST);
- ktab.addEntry(pn,
+ PrincipalName.KRB_NT_UNKNOWN :
+ PrincipalName.KRB_NT_SRV_HST);
+ ktab.addEntry(pn,
getSalt(pn),
pass,
kvno,
true);
+ } else {
+ nativeKdc.ktadd(name, tab);
+ }
}
- ktab.save();
+ if (nativeKdc == null) {
+ ktab.save();
+ }
}
/**
@@ -367,10 +406,36 @@
* @param pass the password for the principal
*/
public void addPrincipal(String user, char[] pass) {
+ addPrincipal(user, pass, null, null);
+ }
+
+ /**
+ * Adds a new principal to this realm with a given password.
+ * @param user the principal's name. For a service principal, use the
+ * form of host/f.q.d.n
+ * @param pass the password for the principal
+ * @param salt the salt, or null if a default value will be used
+ * @param s2kparams the s2kparams, or null if a default value will be used
+ */
+ public void addPrincipal(
+ String user, char[] pass, String salt, byte[] s2kparams) {
if (user.indexOf('@') < 0) {
user = user + "@" + realm;
}
- passwords.put(user, pass);
+ if (nativeKdc != null) {
+ if (!user.equals("krbtgt/" + realm)) {
+ nativeKdc.addPrincipal(user, new String(pass));
+ }
+ passwords.put(user, new char[0]);
+ } else {
+ passwords.put(user, pass);
+ if (salt != null) {
+ salts.put(user, salt);
+ }
+ if (s2kparams != null) {
+ s2kparamses.put(user, s2kparams);
+ }
+ }
}
/**
@@ -466,12 +531,11 @@
*/
public static void saveConfig(String file, KDC kdc, Object... more)
throws IOException {
- File f = new File(file);
StringBuffer sb = new StringBuffer();
sb.append("[libdefaults]\ndefault_realm = ");
sb.append(kdc.realm);
sb.append("\n");
- for (Object o: more) {
+ for (Object o : more) {
if (o instanceof String) {
sb.append(o);
sb.append("\n");
@@ -479,14 +543,12 @@
}
sb.append("\n[realms]\n");
sb.append(kdc.realmLine());
- for (Object o: more) {
+ for (Object o : more) {
if (o instanceof KDC) {
- sb.append(((KDC)o).realmLine());
+ sb.append(((KDC) o).realmLine());
}
}
- FileOutputStream fos = new FileOutputStream(f);
- fos.write(sb.toString().getBytes());
- fos.close();
+ Files.write(Paths.get(file), sb.toString().getBytes());
}
/**
@@ -506,6 +568,7 @@
private KDC(String realm, String kdc) {
this.realm = realm;
this.kdc = kdc;
+ this.nativeKdc = null;
}
/**
@@ -513,7 +576,9 @@
*/
protected KDC(String realm, String kdc, int port, boolean asDaemon)
throws IOException {
- this(realm, kdc);
+ this.realm = realm;
+ this.kdc = kdc;
+ this.nativeKdc = NativeKdc.get(this);
startServer(port, asDaemon);
}
/**
@@ -522,8 +587,9 @@
*/
private static char[] randomPassword() {
char[] pass = new char[32];
+ Random r = new Random();
for (int i=0; i<31; i++)
- pass[i] = (char)secureRandom.nextInt();
+ pass[i] = (char)('a' + r.nextInt(26));
// The last char cannot be a number, otherwise, keyForUser()
// believes it's a sign of kvno
pass[31] = 'Z';
@@ -585,6 +651,9 @@
if (p.getRealmString() == null) {
pn = pn + "@" + getRealm();
}
+ if (salts.containsKey(pn)) {
+ return salts.get(pn);
+ }
if (passwords.containsKey(pn)) {
try {
// Find the principal name with correct case.
@@ -602,6 +671,29 @@
}
/**
+ * Returns the s2kparams for the principal given the etype.
+ * @param p principal
+ * @param etype encryption type
+ * @return the s2kparams, might be null
+ */
+ protected byte[] getParams(PrincipalName p, int etype) {
+ switch (etype) {
+ case EncryptedData.ETYPE_AES128_CTS_HMAC_SHA1_96:
+ case EncryptedData.ETYPE_AES256_CTS_HMAC_SHA1_96:
+ String pn = p.toString();
+ if (p.getRealmString() == null) {
+ pn = pn + "@" + getRealm();
+ }
+ if (s2kparamses.containsKey(pn)) {
+ return s2kparamses.get(pn);
+ }
+ return new byte[] {0, 0, 0x10, 0};
+ default:
+ return null;
+ }
+ }
+
+ /**
* Returns the key for a given principal of the given encryption type
* @param p the principal
* @param etype the encryption type
@@ -624,7 +716,7 @@
}
}
return new EncryptionKey(EncryptionKeyDotStringToKey(
- getPassword(p, server), getSalt(p), null, etype),
+ getPassword(p, server), getSalt(p), getParams(p, etype), etype),
etype, kvno);
} catch (KrbException ke) {
throw ke;
@@ -634,6 +726,15 @@
}
/**
+ * Returns a KerberosTime.
+ *
+ * @param offset offset from NOW in milliseconds
+ */
+ private static KerberosTime timeFor(long offset) {
+ return new KerberosTime(new Date().getTime() + offset);
+ }
+
+ /**
* Processes an incoming request and generates a response.
* @param in the request
* @return the response
@@ -664,7 +765,10 @@
" sends TGS-REQ for " +
service + ", " + tgsReq.reqBody.kdcOptions);
KDCReqBody body = tgsReq.reqBody;
- int[] eTypes = KDCReqBodyDotEType(body);
+ int[] eTypes = filterSupported(KDCReqBodyDotEType(body));
+ if (eTypes.length == 0) {
+ throw new KrbException(Krb5.KDC_ERR_ETYPE_NOSUPP);
+ }
int e2 = eTypes[0]; // etype for outgoing session key
int e3 = eTypes[0]; // etype for outgoing ticket
@@ -701,13 +805,14 @@
PAForUserEnc p4u = new PAForUserEnc(
new DerValue(pa.getValue()), null);
forUserCName = p4u.name;
- System.out.println(realm + "> presenting a PA_FOR_USER "
+ System.out.println(realm + "> See PA_FOR_USER "
+ " in the name of " + p4u.name);
}
}
}
if (forUserCName != null) {
- List<String> names = (List<String>)options.get(Option.ALLOW_S4U2SELF);
+ List<String> names = (List<String>)
+ options.get(Option.ALLOW_S4U2SELF);
if (!names.contains(cname.toString())) {
// Mimic the normal KDC behavior. When a server is not
// allowed to send S4U2self, do not send an error.
@@ -728,11 +833,15 @@
EncryptionKey key = generateRandomKey(e2);
// Check time, TODO
+ KerberosTime from = body.from;
KerberosTime till = body.till;
+ if (from == null || from.isZero()) {
+ from = timeFor(0);
+ }
if (till == null) {
throw new KrbException(Krb5.KDC_ERR_NEVER_VALID); // TODO
} else if (till.isZero()) {
- till = new KerberosTime(new Date().getTime() + 1000 * DEFAULT_LIFETIME);
+ till = timeFor(1000 * DEFAULT_LIFETIME);
}
boolean[] bFlags = new boolean[Krb5.TKT_OPTS_MAX+1];
@@ -758,7 +867,7 @@
}
if (body.kdcOptions.get(KDCOptions.RENEWABLE)) {
bFlags[Krb5.TKT_OPTS_RENEWABLE] = true;
- //renew = new KerberosTime(new Date().getTime() + 1000 * 3600 * 24 * 7);
+ //renew = timeFor(1000 * 3600 * 24 * 7);
}
if (body.kdcOptions.get(KDCOptions.PROXIABLE)) {
bFlags[Krb5.TKT_OPTS_PROXIABLE] = true;
@@ -777,7 +886,8 @@
Map<String,List<String>> map = (Map<String,List<String>>)
options.get(Option.ALLOW_S4U2PROXY);
Ticket second = KDCReqBodyDotFirstAdditionalTicket(body);
- EncryptionKey key2 = keyForUser(second.sname, second.encPart.getEType(), true);
+ EncryptionKey key2 = keyForUser(
+ second.sname, second.encPart.getEType(), true);
byte[] bb = second.encPart.decrypt(key2, KeyUsage.KU_TICKET);
DerInputStream derIn = new DerInputStream(bb);
DerValue der = derIn.getDerValue();
@@ -827,8 +937,8 @@
key,
cname,
new TransitedEncoding(1, new byte[0]), // TODO
- new KerberosTime(new Date()),
- body.from,
+ timeFor(0),
+ from,
till, renewTill,
body.addresses != null ? body.addresses
: etp.caddr,
@@ -845,20 +955,21 @@
);
EncTGSRepPart enc_part = new EncTGSRepPart(
key,
- new LastReq(new LastReqEntry[]{
- new LastReqEntry(0, new KerberosTime(new Date().getTime() - 10000))
+ new LastReq(new LastReqEntry[] {
+ new LastReqEntry(0, timeFor(-10000))
}),
body.getNonce(), // TODO: detect replay
- new KerberosTime(new Date().getTime() + 1000 * 3600 * 24),
+ timeFor(1000 * 3600 * 24),
// Next 5 and last MUST be same with ticket
tFlags,
- new KerberosTime(new Date()),
- body.from,
+ timeFor(0),
+ from,
till, renewTill,
service,
body.addresses
);
- EncryptedData edata = new EncryptedData(ckey, enc_part.asn1Encode(), KeyUsage.KU_ENC_TGS_REP_PART_SESSKEY);
+ EncryptedData edata = new EncryptedData(ckey, enc_part.asn1Encode(),
+ KeyUsage.KU_ENC_TGS_REP_PART_SESSKEY);
TGSRep tgsRep = new TGSRep(null,
cname,
t,
@@ -879,7 +990,7 @@
+ " " +ke.returnCodeMessage());
if (kerr == null) {
kerr = new KRBError(null, null, null,
- new KerberosTime(new Date()),
+ timeFor(0),
0,
ke.returnCode(),
body.cname,
@@ -915,17 +1026,12 @@
KDCReqBody body = asReq.reqBody;
- eTypes = KDCReqBodyDotEType(body);
+ eTypes = filterSupported(KDCReqBodyDotEType(body));
+ if (eTypes.length == 0) {
+ throw new KrbException(Krb5.KDC_ERR_ETYPE_NOSUPP);
+ }
int eType = eTypes[0];
- // Maybe server does not support aes256, but a kinit does
- if (!EType.isSupported(eType)) {
- if (eTypes.length < 2) {
- throw new KrbException(Krb5.KDC_ERR_ETYPE_NOSUPP);
- }
- eType = eTypes[1];
- }
-
EncryptionKey ckey = keyForUser(body.cname, eType, false);
EncryptionKey skey = keyForUser(service, eType, true);
@@ -953,31 +1059,32 @@
// Session key
EncryptionKey key = generateRandomKey(eType);
// Check time, TODO
+ KerberosTime from = body.from;
KerberosTime till = body.till;
KerberosTime rtime = body.rtime;
+ if (from == null || from.isZero()) {
+ from = timeFor(0);
+ }
if (till == null) {
throw new KrbException(Krb5.KDC_ERR_NEVER_VALID); // TODO
} else if (till.isZero()) {
- till = new KerberosTime(
- new Date().getTime() + 1000 * DEFAULT_LIFETIME);
- } else if (till.greaterThan(new KerberosTime(Instant.now()
- .plus(1, ChronoUnit.DAYS)))) {
+ till = timeFor(1000 * DEFAULT_LIFETIME);
+ } else if (till.greaterThan(timeFor(24 * 3600 * 1000))) {
// If till is more than 1 day later, make it renewable
- till = new KerberosTime(
- new Date().getTime() + 1000 * DEFAULT_LIFETIME);
+ till = timeFor(1000 * DEFAULT_LIFETIME);
body.kdcOptions.set(KDCOptions.RENEWABLE, true);
if (rtime == null) rtime = till;
}
if (rtime == null && body.kdcOptions.get(KDCOptions.RENEWABLE)) {
- rtime = new KerberosTime(
- new Date().getTime() + 1000 * DEFAULT_RENEWTIME);
+ rtime = timeFor(1000 * DEFAULT_RENEWTIME);
}
//body.from
boolean[] bFlags = new boolean[Krb5.TKT_OPTS_MAX+1];
if (body.kdcOptions.get(KDCOptions.FORWARDABLE)) {
List<String> sensitives = (List<String>)
options.get(Option.SENSITIVE_ACCOUNTS);
- if (sensitives != null && sensitives.contains(body.cname.toString())) {
+ if (sensitives != null
+ && sensitives.contains(body.cname.toString())) {
// Cannot make FORWARDABLE
} else {
bFlags[Krb5.TKT_OPTS_FORWARDABLE] = true;
@@ -985,7 +1092,7 @@
}
if (body.kdcOptions.get(KDCOptions.RENEWABLE)) {
bFlags[Krb5.TKT_OPTS_RENEWABLE] = true;
- //renew = new KerberosTime(new Date().getTime() + 1000 * 3600 * 24 * 7);
+ //renew = timeFor(1000 * 3600 * 24 * 7);
}
if (body.kdcOptions.get(KDCOptions.PROXIABLE)) {
bFlags[Krb5.TKT_OPTS_PROXIABLE] = true;
@@ -1007,7 +1114,8 @@
pas2 = new DerValue[] {
new DerValue(new ETypeInfo2(1, null, null).asn1Encode()),
new DerValue(new ETypeInfo2(1, "", null).asn1Encode()),
- new DerValue(new ETypeInfo2(1, realm, new byte[]{1}).asn1Encode()),
+ new DerValue(new ETypeInfo2(
+ 1, realm, new byte[]{1}).asn1Encode()),
};
pas = new DerValue[] {
new DerValue(new ETypeInfo(1, null).asn1Encode()),
@@ -1017,7 +1125,8 @@
break;
case 2: // we still reject non-null s2kparams and prefer E2 over E
pas2 = new DerValue[] {
- new DerValue(new ETypeInfo2(1, realm, new byte[]{1}).asn1Encode()),
+ new DerValue(new ETypeInfo2(
+ 1, realm, new byte[]{1}).asn1Encode()),
new DerValue(new ETypeInfo2(1, null, null).asn1Encode()),
new DerValue(new ETypeInfo2(1, "", null).asn1Encode()),
};
@@ -1068,7 +1177,7 @@
epas[i],
epas[i] == EncryptedData.ETYPE_ARCFOUR_HMAC ?
null : getSalt(body.cname),
- null).asn1Encode());
+ getParams(body.cname, epas[i])).asn1Encode());
}
boolean allOld = true;
for (int i: eTypes) {
@@ -1110,11 +1219,15 @@
}
} else {
try {
- EncryptedData data = newEncryptedData(new DerValue(inPAs[0].getValue()));
- EncryptionKey pakey = keyForUser(body.cname, data.getEType(), false);
+ EncryptedData data = newEncryptedData(
+ new DerValue(inPAs[0].getValue()));
+ EncryptionKey pakey
+ = keyForUser(body.cname, data.getEType(), false);
data.decrypt(pakey, KeyUsage.KU_PA_ENC_TS);
} catch (Exception e) {
- throw new KrbException(Krb5.KDC_ERR_PREAUTH_FAILED);
+ KrbException ke = new KrbException(Krb5.KDC_ERR_PREAUTH_FAILED);
+ ke.initCause(e);
+ throw ke;
}
bFlags[Krb5.TKT_OPTS_PRE_AUTHENT] = true;
}
@@ -1125,8 +1238,8 @@
key,
body.cname,
new TransitedEncoding(1, new byte[0]),
- new KerberosTime(new Date()),
- body.from,
+ timeFor(0),
+ from,
till, rtime,
body.addresses,
null);
@@ -1137,19 +1250,20 @@
EncASRepPart enc_part = new EncASRepPart(
key,
new LastReq(new LastReqEntry[]{
- new LastReqEntry(0, new KerberosTime(new Date().getTime() - 10000))
+ new LastReqEntry(0, timeFor(-10000))
}),
body.getNonce(), // TODO: detect replay?
- new KerberosTime(new Date().getTime() + 1000 * 3600 * 24),
+ timeFor(1000 * 3600 * 24),
// Next 5 and last MUST be same with ticket
tFlags,
- new KerberosTime(new Date()),
- body.from,
+ timeFor(0),
+ from,
till, rtime,
service,
body.addresses
);
- EncryptedData edata = new EncryptedData(ckey, enc_part.asn1Encode(), KeyUsage.KU_ENC_AS_REP_PART);
+ EncryptedData edata = new EncryptedData(ckey, enc_part.asn1Encode(),
+ KeyUsage.KU_ENC_AS_REP_PART);
ASRep asRep = new ASRep(
outPAs.toArray(new PAData[outPAs.size()]),
body.cname,
@@ -1204,7 +1318,7 @@
eData = temp.toByteArray();
}
kerr = new KRBError(null, null, null,
- new KerberosTime(new Date()),
+ timeFor(0),
0,
ke.returnCode(),
body.cname,
@@ -1216,6 +1330,35 @@
}
}
+ private int[] filterSupported(int[] input) {
+ int count = 0;
+ for (int i = 0; i < input.length; i++) {
+ if (!EType.isSupported(input[i])) {
+ continue;
+ }
+ if (SUPPORTED_ETYPES != null) {
+ boolean supported = false;
+ for (String se : SUPPORTED_ETYPES.split(",")) {
+ if (Config.getType(se) == input[i]) {
+ supported = true;
+ break;
+ }
+ }
+ if (!supported) {
+ continue;
+ }
+ }
+ if (count != i) {
+ input[count] = input[i];
+ }
+ count++;
+ }
+ if (count != input.length) {
+ input = Arrays.copyOf(input, count);
+ }
+ return input;
+ }
+
/**
* Generates a line for a KDC to put inside [realms] of krb5.conf
* @return REALM.NAME = { kdc = host:port etc }
@@ -1240,6 +1383,20 @@
* @throws java.io.IOException for any communication error
*/
protected void startServer(int port, boolean asDaemon) throws IOException {
+ if (nativeKdc != null) {
+ startNativeServer(port, asDaemon);
+ } else {
+ startJavaServer(port, asDaemon);
+ }
+ }
+
+ private void startNativeServer(int port, boolean asDaemon) throws IOException {
+ nativeKdc.prepare();
+ nativeKdc.init();
+ kdcProc = nativeKdc.kdc();
+ }
+
+ private void startJavaServer(int port, boolean asDaemon) throws IOException {
if (port > 0) {
u1 = new DatagramSocket(port, InetAddress.getByName("127.0.0.1"));
t1 = new ServerSocket(port);
@@ -1336,19 +1493,37 @@
}
}
+ public void kinit(String user, String ccache) throws Exception {
+ if (user.indexOf('@') < 0) {
+ user = user + "@" + realm;
+ }
+ if (nativeKdc != null) {
+ nativeKdc.kinit(user, ccache);
+ } else {
+ Context.fromUserPass(user, passwords.get(user), false)
+ .ccache(ccache);
+ }
+ }
+
boolean isReady() {
return udpConsumerReady && tcpConsumerReady && dispatcherReady;
}
public void terminate() {
- try {
- thread1.stop();
- thread2.stop();
- thread3.stop();
- u1.close();
- t1.close();
- } catch (Exception e) {
- // OK
+ if (nativeKdc != null) {
+ System.out.println("Killing kdc...");
+ kdcProc.destroyForcibly();
+ System.out.println("Done");
+ } else {
+ try {
+ thread1.stop();
+ thread2.stop();
+ thread3.stop();
+ u1.close();
+ t1.close();
+ } catch (Exception e) {
+ // OK
+ }
}
}
@@ -1463,6 +1638,266 @@
}
}
+ /**
+ * A native KDC using the binaries in nativePath. Attention:
+ * this is using binaries, not an existing KDC instance.
+ * An implementation of this takes care of configuration,
+ * principal db managing and KDC startup.
+ */
+ static abstract class NativeKdc {
+
+ protected Map<String,String> env;
+ protected String nativePath;
+ protected String base;
+ protected String realm;
+ protected int port;
+
+ NativeKdc(String nativePath, KDC kdc) {
+ if (kdc.port == 0) {
+ kdc.port = 8000 + new java.util.Random().nextInt(10000);
+ }
+ this.nativePath = nativePath;
+ this.realm = kdc.realm;
+ this.port = kdc.port;
+ this.base = Paths.get("" + port).toAbsolutePath().toString();
+ }
+
+ // Add a new principal
+ abstract void addPrincipal(String user, String pass);
+ // Add a keytab entry
+ abstract void ktadd(String user, String ktab);
+ // Initialize KDC
+ abstract void init();
+ // Start kdc
+ abstract Process kdc();
+ // Configuration
+ abstract void prepare();
+ // Fill ccache
+ abstract void kinit(String user, String ccache);
+
+ static NativeKdc get(KDC kdc) {
+ String prop = System.getProperty("native.kdc.path");
+ if (prop == null) {
+ return null;
+ } else if (Files.exists(Paths.get(prop, "sbin/krb5kdc"))) {
+ return new MIT(true, prop, kdc);
+ } else if (Files.exists(Paths.get(prop, "kdc/krb5kdc"))) {
+ return new MIT(false, prop, kdc);
+ } else if (Files.exists(Paths.get(prop, "libexec/kdc"))) {
+ return new Heimdal(prop, kdc);
+ } else {
+ throw new IllegalArgumentException("Strange " + prop);
+ }
+ }
+
+ Process run(boolean wait, String... cmd) {
+ try {
+ System.out.println("Running " + cmd2str(env, cmd));
+ ProcessBuilder pb = new ProcessBuilder();
+ pb.inheritIO();
+ pb.environment().putAll(env);
+ Process p = pb.command(cmd).start();
+ if (wait) {
+ if (p.waitFor() < 0) {
+ throw new RuntimeException("exit code is not null");
+ }
+ return null;
+ } else {
+ return p;
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private String cmd2str(Map<String,String> env, String... cmd) {
+ return env.entrySet().stream().map(e -> e.getKey()+"="+e.getValue())
+ .collect(Collectors.joining(" ")) + " " +
+ Stream.of(cmd).collect(Collectors.joining(" "));
+ }
+ }
+
+ // Heimdal KDC. Build your own and run "make install" to nativePath.
+ static class Heimdal extends NativeKdc {
+
+ Heimdal(String nativePath, KDC kdc) {
+ super(nativePath, kdc);
+ this.env = Map.of(
+ "KRB5_CONFIG", base + "/krb5.conf",
+ "KRB5_TRACE", "/dev/stderr",
+ "DYLD_LIBRARY_PATH", nativePath + "/lib",
+ "LD_LIBRARY_PATH", nativePath + "/lib");
+ }
+
+ @Override
+ public void addPrincipal(String user, String pass) {
+ run(true, nativePath + "/bin/kadmin", "-l", "-r", realm,
+ "add", "-p", pass, "--use-defaults", user);
+ }
+
+ @Override
+ public void ktadd(String user, String ktab) {
+ run(true, nativePath + "/bin/kadmin", "-l", "-r", realm,
+ "ext_keytab", "-k", ktab, user);
+ }
+
+ @Override
+ public void init() {
+ run(true, nativePath + "/bin/kadmin", "-l", "-r", realm,
+ "init", "--realm-max-ticket-life=1day",
+ "--realm-max-renewable-life=1month", realm);
+ }
+
+ @Override
+ public Process kdc() {
+ return run(false, nativePath + "/libexec/kdc",
+ "--addresses=127.0.0.1", "-P", "" + port);
+ }
+
+ @Override
+ public void prepare() {
+ try {
+ Files.createDirectory(Paths.get(base));
+ Files.write(Paths.get(base + "/krb5.conf"), Arrays.asList(
+ "[libdefaults]",
+ "default_realm = " + realm,
+ "default_keytab_name = FILE:" + base + "/krb5.keytab",
+ "forwardable = true",
+ "dns_lookup_kdc = no",
+ "dns_lookup_realm = no",
+ "dns_canonicalize_hostname = false",
+ "\n[realms]",
+ realm + " = {",
+ " kdc = localhost:" + port,
+ "}",
+ "\n[kdc]",
+ "db-dir = " + base,
+ "database = {",
+ " label = {",
+ " dbname = " + base + "/current-db",
+ " realm = " + realm,
+ " mkey_file = " + base + "/mkey.file",
+ " acl_file = " + base + "/heimdal.acl",
+ " log_file = " + base + "/current.log",
+ " }",
+ "}",
+ SUPPORTED_ETYPES == null ? ""
+ : ("\n[kadmin]\ndefault_keys = "
+ + (SUPPORTED_ETYPES + ",")
+ .replaceAll(",", ":pw-salt ")),
+ "\n[logging]",
+ "kdc = 0-/FILE:" + base + "/messages.log",
+ "krb5 = 0-/FILE:" + base + "/messages.log",
+ "default = 0-/FILE:" + base + "/messages.log"
+ ));
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ }
+
+ @Override
+ void kinit(String user, String ccache) {
+ String tmpName = base + "/" + user + "." +
+ System.identityHashCode(this) + ".keytab";
+ ktadd(user, tmpName);
+ run(true, nativePath + "/bin/kinit",
+ "-f", "-t", tmpName, "-c", ccache, user);
+ }
+ }
+
+ // MIT krb5 KDC. Make your own exploded (install == false), or
+ // "make install" into nativePath (install == true).
+ static class MIT extends NativeKdc {
+
+ private boolean install; // "make install" or "make"
+
+ MIT(boolean install, String nativePath, KDC kdc) {
+ super(nativePath, kdc);
+ this.install = install;
+ this.env = Map.of(
+ "KRB5_KDC_PROFILE", base + "/kdc.conf",
+ "KRB5_CONFIG", base + "/krb5.conf",
+ "KRB5_TRACE", "/dev/stderr",
+ "DYLD_LIBRARY_PATH", nativePath + "/lib",
+ "LD_LIBRARY_PATH", nativePath + "/lib");
+ }
+
+ @Override
+ public void addPrincipal(String user, String pass) {
+ run(true, nativePath +
+ (install ? "/sbin/" : "/kadmin/cli/") + "kadmin.local",
+ "-q", "addprinc -pw " + pass + " " + user);
+ }
+
+ @Override
+ public void ktadd(String user, String ktab) {
+ run(true, nativePath +
+ (install ? "/sbin/" : "/kadmin/cli/") + "kadmin.local",
+ "-q", "ktadd -k " + ktab + " -norandkey " + user);
+ }
+
+ @Override
+ public void init() {
+ run(true, nativePath +
+ (install ? "/sbin/" : "/kadmin/dbutil/") + "kdb5_util",
+ "create", "-s", "-W", "-P", "olala");
+ }
+
+ @Override
+ public Process kdc() {
+ return run(false, nativePath +
+ (install ? "/sbin/" : "/kdc/") + "krb5kdc",
+ "-n");
+ }
+
+ @Override
+ public void prepare() {
+ try {
+ Files.createDirectory(Paths.get(base));
+ Files.write(Paths.get(base + "/kdc.conf"), Arrays.asList(
+ "[kdcdefaults]",
+ "\n[realms]",
+ realm + "= {",
+ " kdc_listen = " + this.port,
+ " kdc_tcp_listen = " + this.port,
+ " database_name = " + base + "/principal",
+ " key_stash_file = " + base + "/.k5.ATHENA.MIT.EDU",
+ SUPPORTED_ETYPES == null ? ""
+ : (" supported_enctypes = "
+ + (SUPPORTED_ETYPES + ",")
+ .replaceAll(",", ":normal ")),
+ "}"
+ ));
+ Files.write(Paths.get(base + "/krb5.conf"), Arrays.asList(
+ "[libdefaults]",
+ "default_realm = " + realm,
+ "default_keytab_name = FILE:" + base + "/krb5.keytab",
+ "forwardable = true",
+ "dns_lookup_kdc = no",
+ "dns_lookup_realm = no",
+ "dns_canonicalize_hostname = false",
+ "\n[realms]",
+ realm + " = {",
+ " kdc = localhost:" + port,
+ "}",
+ "\n[logging]",
+ "kdc = FILE:" + base + "/krb5kdc.log"
+ ));
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ }
+
+ @Override
+ void kinit(String user, String ccache) {
+ String tmpName = base + "/" + user + "." +
+ System.identityHashCode(this) + ".keytab";
+ ktadd(user, tmpName);
+ run(true, nativePath +
+ (install ? "/bin/" : "/clients/kinit/") + "kinit",
+ "-f", "-t", tmpName, "-c", ccache, user);
+ }
+ }
// Calling private methods thru reflections
private static final Field getPADataField;
--- a/test/jdk/sun/security/krb5/auto/SSLwithPerms.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/sun/security/krb5/auto/SSLwithPerms.java Thu Sep 28 09:13:27 2017 -0700
@@ -95,6 +95,7 @@
.prop("javax.net.ssl", "handshake")
.prop("sun.security.krb5.debug", "true")
.perm(new SecurityPermission("setProperty.jdk.tls.disabledAlgorithms"))
+ .perm(new java.util.PropertyPermission("user.name", "read"))
.perm(new PropertyPermission("sun.security.krb5.principal", "read"))
.perm(new FilePermission("port", "read"))
.perm(new FilePermission(hostsFileName, "read"))
--- a/test/jdk/sun/security/krb5/auto/TEST.properties Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/sun/security/krb5/auto/TEST.properties Thu Sep 28 09:13:27 2017 -0700
@@ -1,6 +1,7 @@
modules java.base/jdk.internal.misc \
java.base/sun.security.util \
java.security.jgss/sun.security.jgss \
+ java.security.jgss/sun.security.jgss.krb5 \
java.security.jgss/sun.security.krb5:+open \
java.security.jgss/sun.security.krb5.internal:+open \
java.security.jgss/sun.security.krb5.internal.ccache \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketCloseHang.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,271 @@
+/*
+ * 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 8184328
+ * @summary JDK8u131-b34-socketRead0 hang at SSL read
+ * @run main/othervm SSLSocketCloseHang
+ */
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import java.security.*;
+import javax.net.ssl.*;
+
+public class SSLSocketCloseHang {
+
+ /*
+ * =============================================================
+ * Set the various variables needed for the tests, then
+ * specify what tests to run on each side.
+ */
+
+ /*
+ * Should we run the client or server in a separate thread?
+ * Both sides can throw exceptions, but do you have a preference
+ * as to which side should be the main thread.
+ */
+ static boolean separateServerThread = true;
+
+ /*
+ * Where do we find the keystores?
+ */
+ static String pathToStores = "../../../../javax/net/ssl/etc";
+ static String keyStoreFile = "keystore";
+ static String trustStoreFile = "truststore";
+ static String passwd = "passphrase";
+
+ /*
+ * Is the server ready to serve?
+ */
+ volatile static boolean serverReady = false;
+
+ /*
+ * Was the client responsible for closing the socket
+ */
+ volatile static boolean clientClosed = false;
+
+ /*
+ * Turn on SSL debugging?
+ */
+ static boolean debug = false;
+
+ /*
+ * If the client or server is doing some kind of object creation
+ * that the other side depends on, and that thread prematurely
+ * exits, you may experience a hang. The test harness will
+ * terminate all hung threads after its timeout has expired,
+ * currently 3 minutes by default, but you might try to be
+ * smart about it....
+ */
+
+ /*
+ * Define the server side of the test.
+ *
+ * If the server prematurely exits, serverReady will be set to true
+ * to avoid infinite hangs.
+ */
+ void doServerSide() throws Exception {
+ SSLServerSocketFactory sslssf =
+ (SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
+ SSLServerSocket sslServerSocket =
+ (SSLServerSocket) sslssf.createServerSocket(serverPort);
+
+ serverPort = sslServerSocket.getLocalPort();
+
+ /*
+ * Signal Client, we're ready for his connect.
+ */
+ serverReady = true;
+
+ SSLSocket sslSocket = (SSLSocket) sslServerSocket.accept();
+ sslSocket.startHandshake();
+ while (!clientClosed) {
+ Thread.sleep(500);
+ }
+ }
+
+ /*
+ * Define the client side of the test.
+ *
+ * If the server prematurely exits, serverReady will be set to true
+ * to avoid infinite hangs.
+ */
+ void doClientSide() throws Exception {
+ boolean caught = false;
+
+ /*
+ * Wait for server to get started.
+ */
+ System.out.println("waiting on server");
+ while (!serverReady) {
+ Thread.sleep(50);
+ }
+ System.out.println("server ready");
+
+ Socket baseSocket = new Socket("localhost", serverPort);
+ baseSocket.setSoTimeout(100);
+
+ SSLSocketFactory sslsf =
+ (SSLSocketFactory) SSLSocketFactory.getDefault();
+ SSLSocket sslSocket = (SSLSocket)
+ sslsf.createSocket(baseSocket, "localhost", serverPort, false);
+
+ // handshaking
+ sslSocket.startHandshake();
+ System.out.println("handshake done");
+
+ Thread.sleep(500);
+ System.out.println("client closing");
+
+ sslSocket.close();
+ clientClosed = true;
+ System.out.println("client closed");
+ }
+
+ /*
+ * =============================================================
+ * The remainder is just support stuff
+ */
+
+ // use any free port by default
+ volatile int serverPort = 0;
+
+ volatile Exception serverException = null;
+ volatile Exception clientException = null;
+
+ volatile byte[] serverDigest = null;
+
+ public static void main(String[] args) throws Exception {
+ String keyFilename =
+ System.getProperty("test.src", "./") + "/" + pathToStores +
+ "/" + keyStoreFile;
+ String trustFilename =
+ System.getProperty("test.src", "./") + "/" + pathToStores +
+ "/" + trustStoreFile;
+
+ System.setProperty("javax.net.ssl.keyStore", keyFilename);
+ System.setProperty("javax.net.ssl.keyStorePassword", passwd);
+ System.setProperty("javax.net.ssl.trustStore", trustFilename);
+ System.setProperty("javax.net.ssl.trustStorePassword", passwd);
+
+ if (debug)
+ System.setProperty("javax.net.debug", "all");
+
+ /*
+ * Start the tests.
+ */
+ new SSLSocketCloseHang();
+ }
+
+ Thread clientThread = null;
+ Thread serverThread = null;
+
+ /*
+ * Primary constructor, used to drive remainder of the test.
+ *
+ * Fork off the other side, then do your work.
+ */
+ SSLSocketCloseHang() throws Exception {
+ if (separateServerThread) {
+ startServer(true);
+ startClient(false);
+ } else {
+ startClient(true);
+ startServer(false);
+ }
+
+ /*
+ * Wait for other side to close down.
+ */
+ if (separateServerThread) {
+ serverThread.join();
+ } else {
+ clientThread.join();
+ }
+
+ /*
+ * When we get here, the test is pretty much over.
+ *
+ * If the main thread excepted, that propagates back
+ * immediately. If the other thread threw an exception, we
+ * should report back.
+ */
+ if (serverException != null) {
+ System.out.print("Server Exception:");
+ throw serverException;
+ }
+ if (clientException != null) {
+ System.out.print("Client Exception:");
+ throw clientException;
+ }
+ }
+
+ void startServer(boolean newThread) throws Exception {
+ if (newThread) {
+ serverThread = new Thread() {
+ public void run() {
+ try {
+ doServerSide();
+ } catch (Exception e) {
+ /*
+ * Our server thread just died.
+ *
+ * Release the client, if not active already...
+ */
+ System.err.println("Server died...");
+ System.err.println(e);
+ serverReady = true;
+ serverException = e;
+ }
+ }
+ };
+ serverThread.start();
+ } else {
+ doServerSide();
+ }
+ }
+
+ void startClient(boolean newThread) throws Exception {
+ if (newThread) {
+ clientThread = new Thread() {
+ public void run() {
+ try {
+ doClientSide();
+ } catch (Exception e) {
+ /*
+ * Our client thread just died.
+ */
+ System.err.println("Client died...");
+ clientException = e;
+ }
+ }
+ };
+ clientThread.start();
+ } else {
+ doClientSide();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sun/security/tools/jarsigner/LineBrokenMultiByteCharacter.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,185 @@
+/*
+ * 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 6695402
+ * @summary verify signatures of jars containing classes with names
+ * with multi-byte unicode characters broken across lines
+ * @library /test/lib
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.jar.JarFile;
+import java.util.jar.Attributes.Name;
+import java.util.jar.JarEntry;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+
+import jdk.test.lib.SecurityTools;
+import jdk.test.lib.util.JarUtils;
+
+public class LineBrokenMultiByteCharacter {
+
+ /**
+ * this name will break across lines in MANIFEST.MF at the
+ * middle of a two-byte utf-8 encoded character due to its e acute letter
+ * at its exact position.
+ *
+ * because no file with such a name exists {@link JarUtils} will add the
+ * name itself as contents to the jar entry which would have contained a
+ * compiled class in the original bug. For this test, the contents of the
+ * files contained in the jar file is not important as long as they get
+ * signed.
+ *
+ * @see #verifyClassNameLineBroken(JarFile, String)
+ */
+ static final String testClassName =
+ "LineBrokenMultiByteCharacterA1234567890B1234567890C123456789D12\u00E9xyz.class";
+
+ static final String anotherName =
+ "LineBrokenMultiByteCharacterA1234567890B1234567890C123456789D1234567890.class";
+
+ static final String alias = "a";
+ static final String keystoreFileName = "test.jks";
+ static final String manifestFileName = "MANIFEST.MF";
+
+ public static void main(String[] args) throws Exception {
+ prepare();
+
+ testSignJar("test.jar");
+ testSignJarNoManifest("test-no-manifest.jar");
+ testSignJarUpdate("test-update.jar", "test-updated.jar");
+ }
+
+ static void prepare() throws Exception {
+ SecurityTools.keytool("-keystore", keystoreFileName, "-genkeypair",
+ "-storepass", "changeit", "-keypass", "changeit", "-storetype",
+ "JKS", "-alias", alias, "-dname", "CN=X", "-validity", "366")
+ .shouldHaveExitValue(0);
+
+ Files.write(Paths.get(manifestFileName), (Name.
+ MANIFEST_VERSION.toString() + ": 1.0\r\n").getBytes(UTF_8));
+ }
+
+ static void testSignJar(String jarFileName) throws Exception {
+ JarUtils.createJar(jarFileName, manifestFileName, testClassName);
+ verifyJarSignature(jarFileName);
+ }
+
+ static void testSignJarNoManifest(String jarFileName) throws Exception {
+ JarUtils.createJar(jarFileName, testClassName);
+ verifyJarSignature(jarFileName);
+ }
+
+ static void testSignJarUpdate(
+ String initialFileName, String updatedFileName) throws Exception {
+ JarUtils.createJar(initialFileName, manifestFileName, anotherName);
+ SecurityTools.jarsigner("-keystore", keystoreFileName, "-storetype",
+ "JKS", "-storepass", "changeit", "-debug", initialFileName,
+ alias).shouldHaveExitValue(0);
+ JarUtils.updateJar(initialFileName, updatedFileName, testClassName);
+ verifyJarSignature(updatedFileName);
+ }
+
+ static void verifyJarSignature(String jarFileName) throws Exception {
+ // actually sign the jar
+ SecurityTools.jarsigner("-keystore", keystoreFileName, "-storetype",
+ "JKS", "-storepass", "changeit", "-debug", jarFileName, alias)
+ .shouldHaveExitValue(0);
+
+ try (
+ JarFile jar = new JarFile(jarFileName);
+ ) {
+ verifyClassNameLineBroken(jar, testClassName);
+ verifyCodeSigners(jar, jar.getJarEntry(testClassName));
+ }
+ }
+
+ /**
+ * it would be too easy to miss the actual test case by just renaming an
+ * identifier so that the multi-byte encoded character would not any longer
+ * be broken across a line break.
+ *
+ * this check here verifies that the actual test case is tested based on
+ * the manifest and not based on the signature file because at the moment,
+ * the signature file does not even contain the desired entry at all.
+ *
+ * this relies on {@link java.util.jar.Manifest} breaking lines unaware
+ * of bytes that belong to the same multi-byte utf characters.
+ */
+ static void verifyClassNameLineBroken(JarFile jar, String className)
+ throws IOException {
+ byte[] eAcute = "\u00E9".getBytes(UTF_8);
+ byte[] eAcuteBroken =
+ new byte[] {eAcute[0], '\r', '\n', ' ', eAcute[1]};
+
+ if (jar.getManifest().getAttributes(className) == null) {
+ throw new AssertionError(className + " not found in manifest");
+ }
+
+ JarEntry manifestEntry = jar.getJarEntry(JarFile.MANIFEST_NAME);
+ try (
+ InputStream manifestIs = jar.getInputStream(manifestEntry);
+ ) {
+ int bytesMatched = 0;
+ for (int b = manifestIs.read(); b > -1; b = manifestIs.read()) {
+ if ((byte) b == eAcuteBroken[bytesMatched]) {
+ bytesMatched++;
+ if (bytesMatched == eAcuteBroken.length) {
+ break;
+ }
+ } else {
+ bytesMatched = 0;
+ }
+ }
+ if (bytesMatched < eAcuteBroken.length) {
+ throw new AssertionError("self-test failed: multi-byte "
+ + "utf-8 character not broken across lines");
+ }
+ }
+ }
+
+ static void verifyCodeSigners(JarFile jar, JarEntry jarEntry)
+ throws IOException {
+ // codeSigners is initialized only after the entry has been read
+ try (
+ InputStream inputStream = jar.getInputStream(jarEntry);
+ ) {
+ inputStream.readAllBytes();
+ }
+
+ // a check for the presence of code signers is sufficient to check
+ // bug JDK-6695402. no need to also verify the actual code signers
+ // attributes here.
+ if (jarEntry.getCodeSigners() == null
+ || jarEntry.getCodeSigners().length == 0) {
+ throw new AssertionError(
+ "no signing certificate found for " + jarEntry.getName());
+ }
+ }
+
+}
--- a/test/jdk/sun/security/tools/policytool/Alias.html Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-<html>
-<body>
-
-<applet width=100 height=100 code=Alias.class>
-</applet>
-
-This is a multi-stage test. Click on "done" when you have completed
-reading these instructions.<br><br>
-
-<ol>
-<li> PolicyTool will be invoked
-<li> Click on "Add Policy Entry"
-<li> Click on "Add Principal"
-<li> Type "myalias" in the "Principal Name" field
- (leave "Principal Type" empty)
-<li> Click on "OK"
-<li> Confirm there is a message:
- 'myalias' will be interpreted as a key store alias. ...
- Click on "OK"
-<li> Click on "Done"
-<li> Open the "File" menu, and "View Warning Log"
-<li> Confirm there is a warning:
- Warning: Principal name 'myalias' specified without a Principal class.
-<li> Click on "OK"
-<li> Open the "File" menu, and "Save As"
-<li> Save using the file name "p1"
-<li> Click on "OK" in the status message window
-<li> Open the "File" menu and "Open Policy"
-<li> Open the file named "p1"
-<li> If the file opens successfully, the test passed.
- Otherwise, the test failed.
-</ol>
-</body>
-</html>
--- a/test/jdk/sun/security/tools/policytool/Alias.java Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
- * 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 trivial file is only necessary to display instructions and "pass/fail"
-// buttons for a manual test.
-public class Alias extends java.applet.Applet
-{
-}
--- a/test/jdk/sun/security/tools/policytool/Alias.sh Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-#
-# Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 4449491
-# @summary policytool should allow principal type to be empty
-# (keystore alias substitution)
-#
-# @run applet/manual=done Alias.html
-# @run shell Alias.sh
-# @run applet/manual=yesno Alias.html
-
-# set a few environment variables so that the shell-script can run stand-alone
-# in the source directory
-if [ "${TESTSRC}" = "" ] ; then
- TESTSRC="."
-fi
-if [ "${TESTCLASSES}" = "" ] ; then
- TESTCLASSES="."
-fi
-if [ "${TESTJAVA}" = "" ] ; then
- echo "TESTJAVA not set. Test cannot execute."
- echo "FAILED!!!"
- exit 1
-fi
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
- SunOS | Linux | Darwin | AIX )
- NULL=/dev/null
- PS=":"
- FS="/"
- ;;
- CYGWIN* )
- NULL=/dev/null
- PS=";"
- FS="/"
- ;;
- Windows* )
- NULL=NUL
- PS=";"
- FS="\\"
- ;;
- * )
- echo "Unrecognized system!"
- exit 1;
- ;;
-esac
-
-# the test code
-
-echo "HELLO!"
-
-${TESTJAVA}${FS}bin${FS}policytool
-
-exit $?
-
--- a/test/jdk/sun/security/tools/policytool/ChangeUI.html Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-<html>
-<body>
-
-<applet width=100 height=100 code=ChangeUI.class>
-</applet>
-
-<b>ATTENTION:</b> policytool now contains no platform-specific codes anymore and
-should behaves exactly the same across all platforms. This also means:
-<ol>
- <li>You may only need to test it on one platform</li>
- <li>You can create policy files for a platform which is different than
- the platform you are running policytool on</li>
-</ol>
-
-This is a multi-stage test. Click on "done" when you have completed
-reading these instructions.<br><br>
-
-First, policytool will be invoked.<br><br>
-<ol start="0">
-<li>Find (or create) a temporary directory that you have write access to.
-(Example: 'C:\foo\tmp' on Windows or '/tmp' on other systems)
-<li>Add new policy entry
-<li>Add permission:
- <pre>
- Type Target name Actions
- FilePermission c:\\foo\\bar read
- </pre>
- <ol>
- <li>Press OK</li>
- <li>Confirm the file name warning dialog appears</li>
- <li>Choose Retain, confirm the permission edit dialog is closed</li>
- <li>Double click the newly created FilePermission entry to edit it</li>
- <li>Press OK</li>
- <li>Confirm the file name warning dialog appears</li>
- <li>Choose Edit, confirm the permission edit dialog is still opened</li>
- <li>change Target name to c:\foo\bar</li>
- <li>Press OK, no warning dialog is shown</li>
- </ol>
-<li>Add permission:
- <pre>
- Type Target name
- DelegationPermission "me@SOMEWHERE" "you@SOMEWHERE"
- </pre>
- <ol>
- <li>Press OK</li>
- <li>Double click the newly craeted DelegationPermission entry to edit it</li>
- <li>Confirm the target name is still "me@SOMEWHERE" "you@SOMEWHERE"</li>
- <li>Press OK</li>
- </ol>
-<li>Confirm there are 2 entries in the permission list
-<li>Press Done
-<li>Double click the new policy entry to edit it
-<li>Add permission:
- <pre>
- Type
- AllPermission
- </pre>
-<li>Add a new Principal, say, KerberosPrincipal with Principal Name as aaa
-<li>Confirm there is 1 entry in the Principals list
-<li>Confirm there are 3 entries in the permission list
-<li>Press cancel
-<li>Double click the policy entry to edit it
-<li>Confirm there are ZERO entries in the Principals list
-<li>Confirm there are 2 entries in the permission list
-<li>Press cancel
-<li>Save as "/tmp/p"<br>
-(Or use the temporary directory mentioned in Step 0 if it's not '/tmp'.
- For example, "C:\foo\tmp\p" on Windows)
-<li>Confirm that the file created in the previous step looks like
-<pre>
-/* AUTOMATICALLY GENERATED ON Tue Jul 19 16:27:30 CST 2005*/
-/* DO NOT EDIT */
-
-grant {
- permission java.io.FilePermission "c:\\foo\\bar", "read";
- permission javax.security.auth.kerberos.DelegationPermission "\"me@SOMEWHERE\" \"you@SOMEWHERE\"";
-};
-</pre>
-</ol>
-<br><br>
-
-Press "Pass" if ... press "Fail" otherwise.<br><br>
-
-</body>
-</html>
--- a/test/jdk/sun/security/tools/policytool/ChangeUI.java Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * 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 trivial file is only necessary to display instructions and "pass/fail"
-// buttons for a manual test.
-public class ChangeUI extends java.applet.Applet
-{
-}
--- a/test/jdk/sun/security/tools/policytool/ChangeUI.sh Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-#
-# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 6296772 6293981 6290216 8015276
-# @summary FilePermission and DelegationPermission, and cancel button
-#
-# @run applet/manual=done ChangeUI.html
-# @run shell ChangeUI.sh
-# @run applet/manual=yesno ChangeUI.html
-
-# set a few environment variables so that the shell-script can run stand-alone
-# in the source directory
-if [ "${TESTSRC}" = "" ] ; then
- TESTSRC="."
-fi
-if [ "${TESTCLASSES}" = "" ] ; then
- TESTCLASSES="."
-fi
-if [ "${TESTJAVA}" = "" ] ; then
- echo "TESTJAVA not set. Test cannot execute."
- echo "FAILED!!!"
- exit 1
-fi
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
- SunOS | Linux | Darwin | AIX )
- NULL=/dev/null
- PS=":"
- FS="/"
- ;;
- CYGWIN* )
- NULL=/dev/null
- PS=";"
- FS="/"
- ;;
- Windows* )
- NULL=NUL
- PS=";"
- FS="\\"
- ;;
- * )
- echo "Unrecognized system!"
- exit 1;
- ;;
-esac
-
-# the test code
-
-echo "HELLO!"
-
-${TESTJAVA}${FS}bin${FS}policytool
-
-exit $?
-
--- a/test/jdk/sun/security/tools/policytool/OpenPolicy.html Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-<html>
-<body>
-
-<applet width=100 height=100 code=OpenPolicy.class>
-</applet>
-
-This is a multi-stage test. Click on "done" when you have completed
-reading these instructions.<br><br>
-
-First, policytool will be invoked.<br><br>
-
-Pull down 'File' menu and select 'View Warning Log', which shows that
-the default Policy File is not found. On Windows, if the file name
-has the File separator character pointing the wrong way, like:<br><br>
-
-C:\windows/java.policy<br><br>
-
-Then the bug fix failed.
-Otherwise, the bug fix succeeded.
-
-Exit policytool.<br><br>
-
-Press "Pass" if ... press "Fail" otherwise.<br><br>
-
-</body>
-</html>
--- a/test/jdk/sun/security/tools/policytool/OpenPolicy.java Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
- * 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 trivial file is only necessary to display instructions and "pass/fail"
-// buttons for a manual test.
-public class OpenPolicy extends java.applet.Applet
-{
-}
--- a/test/jdk/sun/security/tools/policytool/OpenPolicy.sh Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-#
-# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 4224186
-# @summary missing File.separatorChar when initially opening policy file
-#
-# @run applet/manual=done OpenPolicy.html
-# @run shell OpenPolicy.sh
-# @run applet/manual=yesno OpenPolicy.html
-
-# set a few environment variables so that the shell-script can run stand-alone
-# in the source directory
-if [ "${TESTSRC}" = "" ] ; then
- TESTSRC="."
-fi
-if [ "${TESTCLASSES}" = "" ] ; then
- TESTCLASSES="."
-fi
-if [ "${TESTJAVA}" = "" ] ; then
- echo "TESTJAVA not set. Test cannot execute."
- echo "FAILED!!!"
- exit 1
-fi
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
- SunOS | Linux | Darwin | AIX )
- NULL=/dev/null
- PS=":"
- FS="/"
- ;;
- CYGWIN* )
- NULL=/dev/null
- PS=";"
- FS="/"
- ;;
- Windows* )
- NULL=NUL
- PS=";"
- FS="\\"
- ;;
- * )
- echo "Unrecognized system!"
- exit 1;
- ;;
-esac
-
-# the test code
-
-echo "HELLO!"
-
-${TESTJAVA}${FS}bin${FS}policytool
-
-exit $?
-
--- a/test/jdk/sun/security/tools/policytool/SaveAs.html Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-<html>
-<body>
-
-<applet width=100 height=100 code=SaveAs.class>
-</applet>
-
-This is a multi-stage test. Click on "done" when you have completed
-reading these instructions.<br><br>
-
-First, policytool will be invoked.<br><br>
-
-Then, go to the "File" menu, and select, "New".<br>
-Next, go back to the "File" menu, and select, "Save".<br>
-If you get the "Save As" File window, where you can enter<br>
-a new filename, then the bug fix succeeded.<br>
-If you get a FileNotFoundException, then the bug fix failed.<br><br>
-
-If you are at the "Save As" File window, click on "Cancel"
-and exit policytool.<br>
-Otherwise, if you see an Exception window, click on "OK"
-and exit policytool.<br><br>
-
-Press "Pass" if ... press "Fail" otherwise.<br><br>
-
-</body>
-</html>
--- a/test/jdk/sun/security/tools/policytool/SaveAs.java Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
- * 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 trivial file is only necessary to display instructions and "pass/fail"
-// buttons for a manual test.
-public class SaveAs extends java.applet.Applet
-{
-}
--- a/test/jdk/sun/security/tools/policytool/SaveAs.sh Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-#
-# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 4252583
-# @summary policytool throws FileNotFoundException when user tries to
-# save new policy file
-#
-# @run applet/manual=done SaveAs.html
-# @run shell SaveAs.sh
-# @run applet/manual=yesno SaveAs.html
-
-# set a few environment variables so that the shell-script can run stand-alone
-# in the source directory
-if [ "${TESTSRC}" = "" ] ; then
- TESTSRC="."
-fi
-if [ "${TESTCLASSES}" = "" ] ; then
- TESTCLASSES="."
-fi
-if [ "${TESTJAVA}" = "" ] ; then
- echo "TESTJAVA not set. Test cannot execute."
- echo "FAILED!!!"
- exit 1
-fi
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
- SunOS | Linux | Darwin | AIX )
- NULL=/dev/null
- PS=":"
- FS="/"
- ;;
- CYGWIN* )
- NULL=/dev/null
- PS=";"
- FS="/"
- ;;
- Windows* )
- NULL=NUL
- PS=";"
- FS="\\"
- ;;
- * )
- echo "Unrecognized system!"
- exit 1;
- ;;
-esac
-
-# the test code
-
-echo "HELLO!"
-
-${TESTJAVA}${FS}bin${FS}policytool
-
-exit $?
-
--- a/test/jdk/sun/security/tools/policytool/UpdatePermissions.html Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-<html>
-<body>
-
-<applet width=100 height=100 code=UpdatePermissions.class>
-</applet>
-
-This is a multi-stage test. Click on "done" when you have completed
-reading these instructions.<br><br>
-
-First, policytool will be invoked.<br><br>
-
-Then, follow these steps:<br>
-0) Find (or create) a temporary directory that you have write access to.
-(Example: 'C:\foo\tmp' on Windows or '/tmp' on other systems)<br><br>
-
-1) Click on the "Add Policy Entry" button in the
-main policytool window.<br><br>
-
-2) Click on the "Add Permission" button in the Policy Entry window.<br><br>
-
-3) In the Permission window, pull down the "Permission" menu and
-select "AWTPermission".<br><br>
-
-4) In the Permission window, pull down the "Target Name" menu and
-select "listenToAllAWTEvents".<br><br>
-
-5) Click on the "OK" button in the Permission window.<br><br>
-
-6) Click on the "Done" button in the Policy Entry window.<br><br>
-
-7) In the main policytool window, pull down the "File" menu and
-select "Save As".<br><br>
-
-8) In the SaveAs window, enter "/tmp/ptool.test" as the file name
-and save it. If the file already exists, just replace it.<br>
-(Or use the temporary directory mentioned in Step 0 if it's not '/tmp'.
-For example, "C:\foo\tmp\ptool.test" on Windows)<br><br>
-
-9) Check the content of the file created in the previous step<br><br>
-
-10) check to make sure that the new entry is in the policy file.<br><br>
-
-11) repeat steps 1-10 for:<br>
- AWTPermission: readDisplayPixels<br>
- NetPermission: specifyStreamHandler<br>
- RuntimePermission: setContextClassLoader,
- setSecurityManager,
- shutdownHooks,
- stopThread<br>
- SecurityPermission: createAccessControlContext<br><br>
-
-In the confirmation dialog pop-up, click "OK".<br><br>
-
-Exit policytool. Delete the files created during this test. If the
-temporary directory is also newly created, empty and delete it.<br><br>
-
-Press "Pass" if ... press "Fail" otherwise.<br><br>
-
-</body>
-</html>
--- a/test/jdk/sun/security/tools/policytool/UpdatePermissions.java Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
- * 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 trivial file is only necessary to display instructions and "pass/fail"
-// buttons for a manual test.
-public class UpdatePermissions extends java.applet.Applet
-{
-}
--- a/test/jdk/sun/security/tools/policytool/UpdatePermissions.sh Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-#
-# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 4218206
-# @bug 8015276
-# @summary missing or invalid permission target names in policy tool
-#
-# @run applet/manual=done UpdatePermissions.html
-# @run shell UpdatePermissions.sh
-# @run applet/manual=yesno UpdatePermissions.html
-
-# set a few environment variables so that the shell-script can run stand-alone
-# in the source directory
-if [ "${TESTSRC}" = "" ] ; then
- TESTSRC="."
-fi
-if [ "${TESTCLASSES}" = "" ] ; then
- TESTCLASSES="."
-fi
-if [ "${TESTJAVA}" = "" ] ; then
- echo "TESTJAVA not set. Test cannot execute."
- echo "FAILED!!!"
- exit 1
-fi
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
- SunOS | Linux | Darwin | AIX )
- NULL=/dev/null
- PS=":"
- FS="/"
- ;;
- CYGWIN* )
- NULL=/dev/null
- PS=";"
- FS="/"
- ;;
- Windows* )
- NULL=NUL
- PS=";"
- FS="\\"
- ;;
- * )
- echo "Unrecognized system!"
- exit 1;
- ;;
-esac
-
-# the test code
-
-echo "HELLO!"
-
-${TESTJAVA}${FS}bin${FS}policytool
-
-exit $?
-
--- a/test/jdk/sun/security/tools/policytool/UsePolicy.html Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-<html>
-<body>
-
-<applet width=100 height=100 code=UsePolicy.class>
-</applet>
-
-This is a multi-stage test. Click on "done" when you have completed
-reading these instructions.<br><br>
-
-First, policytool will be invoked.<br><br>
-
-Then, click on the "Add Policy Entry" button.<br>
-Next, click on the "Add Permission" button.<br>
-Pull down the "Permission" menu and select "RuntimePermission".<br>
-Pull down the "Target Name" menu.<br>
-If you see "usePolicy" as a choice, then the bug fix succeeded.<br>
-otherwise, the bug fix failed.<br>
-<br>
-Click on the "Cancel" button on the "Add Permission" window.<br>
-Click on the "Cancel" button on the "Add Policy Entry" window.<br>
-Exit policytool.<br><br>
-
-Press "Pass" if ... press "Fail" otherwise.<br><br>
-
-</body>
-</html>
--- a/test/jdk/sun/security/tools/policytool/UsePolicy.java Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
- * 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 trivial file is only necessary to display instructions and "pass/fail"
-// buttons for a manual test.
-public class UsePolicy extends java.applet.Applet
-{
-}
--- a/test/jdk/sun/security/tools/policytool/UsePolicy.sh Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-#
-# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 4273771
-# @summary Need to add "usePolicy" RuntimePermission to policytool
-#
-# @run applet/manual=done UsePolicy.html
-# @run shell UsePolicy.sh
-# @run applet/manual=yesno UsePolicy.html
-
-# set a few environment variables so that the shell-script can run stand-alone
-# in the source directory
-if [ "${TESTSRC}" = "" ] ; then
- TESTSRC="."
-fi
-if [ "${TESTCLASSES}" = "" ] ; then
- TESTCLASSES="."
-fi
-if [ "${TESTJAVA}" = "" ] ; then
- echo "TESTJAVA not set. Test cannot execute."
- echo "FAILED!!!"
- exit 1
-fi
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
- SunOS | Linux | Darwin | AIX )
- NULL=/dev/null
- PS=":"
- FS="/"
- ;;
- CYGWIN* )
- NULL=/dev/null
- PS=";"
- FS="/"
- ;;
- Windows* )
- NULL=NUL
- PS=";"
- FS="\\"
- ;;
- * )
- echo "Unrecognized system!"
- exit 1;
- ;;
-esac
-
-# the test code
-
-echo "HELLO!"
-
-${TESTJAVA}${FS}bin${FS}policytool
-
-exit $?
-
--- a/test/jdk/sun/security/tools/policytool/i18n.html Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,135 +0,0 @@
-<html>
-<body>
-
-<applet width=100 height=100 code=i18n.class>
-</applet>
-
-This is a multi-stage test. Click on "done" when you have completed
-reading these instructions.<br>
-<p>
-First, policytool will be invoked. During the entire test,
-make sure that all the buttons, menu options, error messages,
-and output messages are comprehensible
-(you can read all the english text fine).
-If at any time an exception is thrown, or if any message
-is incomprehensible, then the test failed. Otherwise,
-the test passed.
-<p>
-<b>Preparation</b>: Find (or create) a temporary directory that you have write
-access to (Example: 'C:\tmp' on Windows or '/tmp' on other systems) and copy
-the files "ks", "good", "bad" from the scratch sub-directory of this test's
-working directory (the -w argument of jtreg) into the temporary directory.
-If 'policy1' or 'policy2' already exists in this directory, remove it.
-<p>
-Press "Pass" if ... press "Fail" otherwise.
-<p>
-<ol>
-<li> Pull down the 'File' and 'KeyStore' menus and check values
-<li> Pull down 'File' menu and select 'View Warning Log'. Confirm FileNotFound.
-<li> Pull down 'File' menu and select 'New'.
-<li> Pull down 'File' menu and select 'View Warning Log'. Confirm empty.
-<li> Click on 'Add Policy Entry' and check pop-up window
-<li> Click on 'Edit Permission' and 'Remove Permission' and check error messages
-<li> Click on 'Add Permission' and check pop-up window
-<li> Pull down 'Permission' menu and check values
-<li> Select 'AWTPermission', pull down 'Target Name' and check values
-<li> Select 'FilePermission', pull down 'Target Name' and 'Actions' and check values.
-<li> Select 'NetPermission', pull down 'Target Name' and check values
-<li> Select 'PropertyPermission', pull down 'Actions' and check values
-<li> Select 'ReflectPermission', pull down 'Target Name' and check values
-<li> Select 'RuntimePermission', pull down 'Target Name' and check values
-<li> Select 'SecurityPermission', pull down 'Target Name' and check values
-<li> Select 'SerializablePermission', pull down 'Target Name' and check values
-<li> Select 'SocketPermission', pull down 'Actions' and check values
-<li> Type "www.example.com" for SocketPermission 'TargetName',
- and "connect" for 'Actions'
-<li> Click OK
-<li> Check new entry
-<li> Click once on new entry
-<li> Click on 'Edit Permission' and confirm values
-<li> Select AudioPermission. Confirm 'Target Name' and 'Actions' cleared.
-<li> Select "play" from Target menu.
-<li> Click OK, confirm changed permission.
-<li> Type "hello" for 'CodeBase', click on 'Done', and check error message
-<li> Clean up the 'CodeBase' textbox
-<li> Type "hello" for 'SignedBy', click on 'Done', and check warning message
-<li> Click on 'Edit Policy Entry' and 'Remove Policy Entry'
- and check error messages
-<li> Select policy entry, click on 'Edit Policy Entry', check pop-up window and close it
-<li> Select policy entry, click on 'Remove Policy Entry',
- and check pop-up window
-<li> Do not remove the entry, click 'Cancel'.
-<li> Pull down 'File' menu and select 'Exit'. Confirm Save option.
- Click 'Cancel'.
-<li> Select 'File' menu value 'Save' and save into file "policy1" in the
- temporary directory. Check status message.<br>
-<li> Select 'File' menu value 'New'
-<li> Click 'Add Policy Entry', type in "hello" for 'SignedBy' field,
- click 'Done'. Confirm warning.
-<li> Select 'File' menu value 'Open' and confirm save option
- (Click 'Cancel', do not save changes)
-<li> Pull down 'File' menu, select 'View Warning Log'
- and confirm KeyStore alias warning
-<li> Pull down 'KeyStore' menu and select 'Edit'
-<li> Enter 'foo' as KeyStore URL, click 'OK', and check error
-<li> Enter KeyStore URL "file:/tmp/ks" (Or use the temporary directory mentioned
- in the preparation if it's not '/tmp'. For example, "file:/C:/tmp/ks" on Windows)
- but leave other fields empty. Click 'OK'. Should succeed.
-<li> Pull down 'KeyStore' menu and select 'Edit'
-<li> Confirm URL and Type values. The Type should be "jks"
-<li> Enter 'foo' as the provider, click 'OK' and check error message.
-<li> Enter 'SUN' as the provider, click 'OK'. Should succeed.
-<li> Pull down 'KeyStore' menu and select 'Edit'
-<li> Confirm URL, Type, and Provider values.
-<li> Enter 'foo' as the password URL, click 'OK' and check error message.
-<li> Enter URL "file:/tmp/bad" (Or use the temporary directory mentioned in
- the preparation if it's not '/tmp'. For example, "file:/C:/tmp/bad" on Windows),
- click 'OK' and check error message.
-<li> Enter URL "file:/tmp/good" (Or use the temporary directory mentioned in
- the preparation if it's not '/tmp'. For example, "file:/C:/tmp/good" on Windows)
- and click 'OK'. Should succeed.
-<li> Pull down 'KeyStore' menu and select 'Edit'
-<li> Confirm URL, Type, Provider, and Password URL values.
-<li> Click OK
-<li> Pull down 'File' menu and select 'Save As' and save into file "policy2"
- in the temporary directory. Confirm status message.<br>
-<li> Pull down 'File' menu and select 'New'.
-<li> Pull down 'File' menu and select 'Open' and open "policy2" in the
- temporary directory.<br>
-<li> Click on 'Add Policy Entry', enter Codebase 'http://foo',
- SignedBy 'bar'. Click on 'Done' and confirm alias warning.
-<li> Double-Click on just created policy entry, confirm edit window appears.
-<li> Change SignedBy to an 'hello'.
-<li> Click on Done and confirm it worked with no warning.
-<li> Double-Click on "SignedBy hello" policy entry and
- confirm edit window appears.
-<li> Click on Edit/Remove Principal, confirm errors.
-<li> Click on 'Add Principal' and check new window.
-<li> Click on 'OK' and confirm error message (no principal name)
-<li> Enter 'hello' as principal name, click OK and
- confirm status message.
-<li> Confirm new principal in Principals list.
-<li> Click on 'Done' (creating policy entry).
-<li> View warning log and confirm X500Principal/KeyStore alias message.
-<li> Confirm principal added to policy entry in main window listing.
-<li> Double click on that entry.
-<li> Enter codebase "file:/foobar".
-<li> Click on 'Add Principal'. Select KerberosPrincipal. enter 'foo' as name.
- Click OK.
-<li> Confirm new principal in list.
-<li> Double-click on new principal. Select X500Principal.
- Confirm name cleared. Type 'foo' as name. Click OK. Confirm error.
- type 'cn=foo' as name. Click OK. should succeed.
-<li> Confirm changed principal in list.
-<li> Click on 'Add Permission', and add a FilePermission, choose a target and
- an action. Click OK.
-<li> Click on 'Done' in Policy Entry window.
-<li> Confirm entries in main window listing.
-<li> Select 'File' menu value 'Exit'
-<li> Save Changes, confirm status message.
-<li> Delete all files created during this test. If the temporary directory
- is also newly created, empty and delete it.</ol>
-<p>
-
-</body>
-</html>
--- a/test/jdk/sun/security/tools/policytool/i18n.java Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
- * 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 trivial file is only necessary to display instructions and "pass/fail"
-// buttons for a manual test.
-public class i18n extends java.applet.Applet
-{
-}
--- a/test/jdk/sun/security/tools/policytool/i18n.sh Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-#
-# Copyright (c) 2000, 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.
-#
-# 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 4348370
-# @bug 8015274
-# @bug 8015276
-# @bug 8016158
-# @summary policytool not i18n compliant
-#
-# @run applet/manual=done i18n.html
-# @run shell/timeout=1200 i18n.sh
-# @run applet/manual=yesno i18n.html
-
-# set a few environment variables so that the shell-script can run stand-alone
-# in the source directory
-if [ "${TESTSRC}" = "" ] ; then
- TESTSRC="."
-fi
-if [ "${TESTCLASSES}" = "" ] ; then
- TESTCLASSES="."
-fi
-if [ "${TESTJAVA}" = "" ] ; then
- echo "TESTJAVA not set. Test cannot execute."
- echo "FAILED!!!"
- exit 1
-fi
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
- SunOS | Linux | Darwin | AIX )
- NULL=/dev/null
- PS=":"
- FS="/"
- ;;
- CYGWIN* )
- NULL=/dev/null
- PS=";"
- FS="/"
- ;;
- Windows* )
- NULL=NUL
- PS=";"
- FS="\\"
- ;;
- * )
- echo "Unrecognized system!"
- exit 1;
- ;;
-esac
-
-# the test code
-
-echo "HELLO!"
-
-echo "Checking for $HOME/.java.policy"
-
-# 8015274
-if [ -f $HOME/.java.policy ]; then
- echo "You have a .java.policy file in your HOME directory"
- echo "The file must be removed before running this test"
- exit 1
-fi
-
-# The keystore type is set to JKS, to match the type expected by i18n.html
-${TESTJAVA}${FS}bin${FS}keytool ${TESTTOOLVMOPTS} -genkeypair -alias hello -dname CN=Hello \
- -storepass changeit -keypass changeit -keystore ks -storetype jks
-echo changeit > good
-echo badpass > bad
-${TESTJAVA}${FS}bin${FS}policytool ${TESTTOOLVMOPTS}
-
-exit $?
-
--- a/test/jdk/sun/security/util/Resources/NewNamesFormat.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/sun/security/util/Resources/NewNamesFormat.java Thu Sep 28 09:13:27 2017 -0700
@@ -27,7 +27,6 @@
* @modules java.base/sun.security.util
* java.base/sun.security.tools.keytool
* jdk.jartool/sun.security.tools.jarsigner
- * jdk.policytool/sun.security.tools.policytool
* @summary security/util/Resources.java needs improvement
*/
@@ -46,7 +45,6 @@
checkRes("sun.security.util.AuthResources");
checkRes("sun.security.tools.jarsigner.Resources");
checkRes("sun.security.tools.keytool.Resources");
- checkRes("sun.security.tools.policytool.Resources");
}
private static void checkRes(String resName) throws Exception {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/launcher/TestXcheckJNIWarnings.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * @test
+ * @bug 8187442
+ * @summary Launching app shouldn't produce any jni warnings.
+ * @modules jdk.compiler
+ * jdk.zipfs
+ * @compile TestXcheckJNIWarnings.java
+ * @run main TestXcheckJNIWarnings
+ */
+public final class TestXcheckJNIWarnings extends TestHelper {
+
+ static void createJarFile(File testJar) throws IOException {
+ StringBuilder tsrc = new StringBuilder();
+ tsrc.append("public static void main(String... args) {\n");
+ tsrc.append(" System.out.println(\"Hello World\");\n");
+ tsrc.append("}\n");
+ createJar(testJar, new File("Foo"), tsrc.toString());
+ }
+
+ public static void main(String... args) throws IOException {
+ File testJarFile = new File("test.jar");
+ createJarFile(testJarFile);
+ TestResult tr = doExec(javaCmd, "-jar", "-Xcheck:jni",
+ testJarFile.getName());
+ if (!tr.isOK()) {
+ System.out.println(tr);
+ throw new RuntimeException("test returned non-positive value");
+ }
+ if (!tr.contains("Hello World")) {
+ System.out.println(tr);
+ throw new RuntimeException("expected output not found");
+ }
+ if (tr.contains("WARNING")) {
+ System.out.println(tr);
+ throw new RuntimeException("WARNING was found in the output");
+ }
+ }
+}
--- a/test/jdk/tools/launcher/VersionCheck.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/jdk/tools/launcher/VersionCheck.java Thu Sep 28 09:13:27 2017 -0700
@@ -110,7 +110,6 @@
"orbd",
"pack200",
"packager",
- "policytool",
"rmic",
"rmid",
"rmiregistry",
--- a/test/langtools/jdk/javadoc/doclet/testClassLinks/TestClassLinks.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testClassLinks/TestClassLinks.java Thu Sep 28 09:13:27 2017 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8163800 8175200
+ * @bug 8163800 8175200 8186332
* @summary The fix for JDK-8072052 shows up other minor incorrect use of styles
* @library ../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
@@ -51,11 +51,11 @@
checkOutput("p/C1.html", true,
"<code><a href=\"../p/C2.html\" title=\"class in p\">C2</a></code>",
- "<code><span class=\"memberNameLink\"><a href=\"../p/C1.html#C1--\">C1</a></span>​()</code>");
+ "<code><span class=\"memberNameLink\"><a href=\"../p/C1.html#C1--\">C1</a></span>()</code>");
checkOutput("p/C2.html", true,
"<code><a href=\"../p/C3.html\" title=\"class in p\">C3</a></code>",
- "<code><span class=\"memberNameLink\"><a href=\"../p/C2.html#C2--\">C2</a></span>​()</code>");
+ "<code><span class=\"memberNameLink\"><a href=\"../p/C2.html#C2--\">C2</a></span>()</code>");
checkOutput("p/C3.html", true,
"<code><a href=\"../p/I1.html\" title=\"interface in p\">I1</a></code>, "
@@ -63,7 +63,7 @@
+ "<code><a href=\"../p/I2.html\" title=\"interface in p\">I2</a></code>, "
+ "<code><a href=\"../p/IT1.html\" title=\"interface in p\">IT1</a><T></code>, "
+ "<code><a href=\"../p/IT2.html\" title=\"interface in p\">IT2</a><java.lang.String></code>",
- "<code><span class=\"memberNameLink\"><a href=\"../p/C3.html#C3--\">C3</a></span>​()</code>");
+ "<code><span class=\"memberNameLink\"><a href=\"../p/C3.html#C3--\">C3</a></span>()</code>");
checkOutput("p/I1.html", true,
"<code><a href=\"../p/C3.html\" title=\"class in p\">C3</a></code>",
--- a/test/langtools/jdk/javadoc/doclet/testConstructors/TestConstructors.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testConstructors/TestConstructors.java Thu Sep 28 09:13:27 2017 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8025524 8031625 8081854 8175200
+ * @bug 8025524 8031625 8081854 8175200 8186332
* @summary Test for constructor name which should be a non-qualified name.
* @author Bhavesh Patel
* @library ../lib
@@ -58,19 +58,19 @@
+ "<a href=\"../pkg1/Outer.html#Outer-int-\"><code>Outer(int)</code></a>, "
+ "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner-int-\"><code>"
+ "NestedInner(int)</code></a>",
- "<a href=\"../pkg1/Outer.html#Outer--\">Outer</a></span>​()",
+ "<a href=\"../pkg1/Outer.html#Outer--\">Outer</a></span>()",
"<a name=\"Outer--\">",
"<a href=\"../pkg1/Outer.html#Outer-int-\">Outer</a></span>​(int i)",
"<a name=\"Outer-int-\">");
checkOutput("pkg1/Outer.Inner.html", true,
- "<a href=\"../pkg1/Outer.Inner.html#Inner--\">Inner</a></span>​()",
+ "<a href=\"../pkg1/Outer.Inner.html#Inner--\">Inner</a></span>()",
"<a name=\"Inner--\">",
"<a href=\"../pkg1/Outer.Inner.html#Inner-int-\">Inner</a></span>​(int i)",
"<a name=\"Inner-int-\">");
checkOutput("pkg1/Outer.Inner.NestedInner.html", true,
- "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner--\">NestedInner</a></span>​()",
+ "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner--\">NestedInner</a></span>()",
"<a name=\"NestedInner--\">",
"<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner-int-\">NestedInner</a></span>​(int i)",
"<a name=\"NestedInner-int-\">");
--- a/test/langtools/jdk/javadoc/doclet/testDeprecatedDocs/TestDeprecatedDocs.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testDeprecatedDocs/TestDeprecatedDocs.java Thu Sep 28 09:13:27 2017 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4927552 8026567 8071982 8162674 8175200 8175218
+ * @bug 4927552 8026567 8071982 8162674 8175200 8175218 8183511 8186332
* @summary <DESC>
* @author jamieh
* @library ../lib
@@ -81,85 +81,85 @@
+ "extends java.lang.Object</pre>",
"<pre>@Deprecated(forRemoval=true)\n"
+ "public int field</pre>\n"
- + "<div class=\"block\"><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=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> </div>",
+ + "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>",
"<pre>@Deprecated\n"
- + "public void method​()</pre>\n"
- + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> </div>");
+ + "public void method()</pre>\n"
+ + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span> </div>");
checkOutput("pkg/TestAnnotationType.html", true,
- "<div class=\"block\"><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"
- + "<br>\n"
+ "<hr>\n"
+ "<pre>@Deprecated(forRemoval=true)\n"
+ "@Documented\n"
- + "public @interface <span class=\"memberNameLabel\">TestAnnotationType</span></pre>",
+ + "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",
"<pre>@Deprecated(forRemoval=true)\n"
+ "static final int field</pre>\n"
- + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This "
+ + "<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>",
"<pre>@Deprecated(forRemoval=true)\n"
+ "int required</pre>\n"
- + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> "
+ + "<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>",
"<pre>java.lang.String optional</pre>\n"
- + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> <span class=\"deprecationComment\">annotation_test2 passes.</span></div>");
+ + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span> <span class=\"deprecationComment\">annotation_test2 passes.</span></div>");
checkOutput("pkg/TestClass.html", true,
- "<div class=\"block\"><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>\n"
- + "<br>\n"
+ "<hr>\n"
+ "<pre>@Deprecated(forRemoval=true)\n"
+ "public class <span class=\"typeNameLabel\">TestClass</span>\n"
- + "extends java.lang.Object</pre>",
+ + "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>",
"<pre>@Deprecated(forRemoval=true)\n"
- + "public TestClass​()</pre>\n"
- + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> "
+ + "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>");
checkOutput("pkg/TestEnum.html", true,
- "<div class=\"block\"><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>\n"
- + "<br>\n"
+ "<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>",
+ + "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>",
"<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=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> "
+ + "<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>");
checkOutput("pkg/TestError.html", true,
- "<div class=\"block\"><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>\n"
- + "<br>\n"
+ "<hr>\n"
+ "<pre>@Deprecated(forRemoval=true)\n"
+ "public class <span class=\"typeNameLabel\">TestError</span>\n"
- + "extends java.lang.Error</pre>");
+ + "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>");
checkOutput("pkg/TestException.html", true,
- "<div class=\"block\"><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>\n"
- + "<br>\n"
+ "<hr>\n"
+ "<pre>@Deprecated(forRemoval=true)\n"
+ "public class <span class=\"typeNameLabel\">TestException</span>\n"
- + "extends java.lang.Exception</pre>");
+ + "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>");
checkOutput("pkg/TestInterface.html", true,
- "<div class=\"block\"><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>\n"
- + "<br>\n"
+ "<hr>\n"
+ "<pre>@Deprecated(forRemoval=true)\n"
+ "public class <span class=\"typeNameLabel\">TestInterface</span>\n"
- + "extends java.lang.Object</pre>");
+ + "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>");
checkOutput("deprecated-list.html", true,
"<ul>\n"
--- a/test/langtools/jdk/javadoc/doclet/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java Thu Sep 28 09:13:27 2017 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6786690 6820360 8025633 8026567 8175200
+ * @bug 6786690 6820360 8025633 8026567 8175200 8183511 8186332
* @summary This test verifies the nesting of definition list tags.
* @author Bhavesh Patel
* @library ../lib
@@ -367,12 +367,12 @@
// Test with -nocomment and -nodeprecated options. The ClassDocs whould
// not display definition lists for any member details.
checkOutput("pkg1/C1.html", expectFound,
- "<pre>public void readObject​()\n" +
+ "<pre>public void readObject()\n" +
" throws java.io.IOException</pre>\n" +
"</li>");
checkOutput("pkg1/C2.html", expectFound,
- "<pre>public C2​()</pre>\n" +
+ "<pre>public C2()</pre>\n" +
"</li>");
checkOutput("pkg1/C1.ModalExclusionType.html", expectFound,
@@ -385,7 +385,7 @@
checkOutput("serialized-form.html", expectFound,
"<pre>boolean " +
"undecorated</pre>\n" +
- "<div class=\"block\"><span class=\"deprecatedLabel\">" +
+ "<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" +
--- a/test/langtools/jdk/javadoc/doclet/testInterface/TestInterface.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testInterface/TestInterface.java Thu Sep 28 09:13:27 2017 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4682448 4947464 5029946 8025633 8026567 8035473 8139101 8175200
+ * @bug 4682448 4947464 5029946 8025633 8026567 8035473 8139101 8175200 8186332
* @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
@@ -64,7 +64,7 @@
checkExit(Exit.OK);
checkOutput("pkg/Interface.html", true,
- "<pre>int method​()</pre>",
+ "<pre>int method()</pre>",
"<pre>static final int field</pre>",
// Make sure known implementing class list is correct and omits type parameters.
"<dl>\n"
@@ -119,7 +119,7 @@
+ "</dl>");
checkOutput("pkg/Interface.html", false,
- "public int method​()",
+ "public int method()",
"public static final int field");
checkOutput("pkg/ClassWithStaticMethod.html", false,
--- a/test/langtools/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java Thu Sep 28 09:13:27 2017 -0700
@@ -24,7 +24,7 @@
/*
* @test
* @bug 7112427 8012295 8025633 8026567 8061305 8081854 8150130 8162363
- * 8167967 8172528 8175200 8178830 8182257
+ * 8167967 8172528 8175200 8178830 8182257 8186332
* @summary Test of the JavaFX doclet features.
* @author jvalenta
* @library ../lib
@@ -58,7 +58,7 @@
+ "<div class=\"block\">Sets the value of the property rate.</div>\n"
+ "<dl>\n"
+ "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>",
- "<pre>public final double getRate​()</pre>\n"
+ "<pre>public final double getRate()</pre>\n"
+ "<div class=\"block\">Gets the value of the property rate.</div>\n"
+ "<dl>\n"
+ "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>",
@@ -78,7 +78,7 @@
"<span class=\"simpleTagLabel\">Property description:</span>",
"<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+ "<a href=\"../pkg1/C.html#setTestMethodProperty--\">"
- + "setTestMethodProperty</a></span>​()</code></th>",
+ + "setTestMethodProperty</a></span>()</code></th>",
"<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+ "<a href=\"../pkg1/C.html#pausedProperty\">paused</a></span></code></th>\n"
+ "<td class=\"colLast\">\n"
@@ -88,7 +88,7 @@
+ "title=\"class in pkg1\">C.BooleanProperty</a> pausedProperty</pre>\n"
+ "<div class=\"block\">Defines if paused. The second line.</div>",
"<h4>isPaused</h4>\n"
- + "<pre>public final double isPaused​()</pre>\n"
+ + "<pre>public final double isPaused()</pre>\n"
+ "<div class=\"block\">Gets the value of the property paused.</div>",
"<h4>setPaused</h4>\n"
+ "<pre>public final void setPaused​(boolean value)</pre>\n"
@@ -99,7 +99,7 @@
+ "<dt><span class=\"simpleTagLabel\">Default value:</span></dt>\n"
+ "<dd>false</dd>",
"<h4>isPaused</h4>\n"
- + "<pre>public final double isPaused​()</pre>\n"
+ + "<pre>public final double isPaused()</pre>\n"
+ "<div class=\"block\">Gets the value of the property paused.</div>\n"
+ "<dl>\n"
+ "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>\n"
@@ -124,7 +124,7 @@
+ "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+ "<dd>JavaFX 8.0</dd>",
"<h4>getRate</h4>\n"
- + "<pre>public final double getRate​()</pre>\n"
+ + "<pre>public final double getRate()</pre>\n"
+ "<div class=\"block\">Gets the value of the property rate.</div>\n"
+ "<dl>\n"
+ "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>\n"
@@ -253,20 +253,20 @@
+ "<tr id=\"i1\" class=\"rowColor\">\n"
+ "<td class=\"colFirst\"><code>java.lang.Object</code></td>\n"
+ "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
- + "<a href=\"../pkg2/Test.html#betaProperty--\">betaProperty</a></span>​()</code></th>\n"
+ + "<a href=\"../pkg2/Test.html#betaProperty--\">betaProperty</a></span>()</code></th>\n"
+ "<td class=\"colLast\"> </td>\n"
+ "</tr>\n"
+ "<tr id=\"i2\" class=\"altColor\">\n"
+ "<td class=\"colFirst\"><code>java.util.List<java.util.Set<? super java.lang.Object>>"
+ "</code></td>\n"
+ "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
- + "<a href=\"../pkg2/Test.html#deltaProperty--\">deltaProperty</a></span>​()</code></th>\n"
+ + "<a href=\"../pkg2/Test.html#deltaProperty--\">deltaProperty</a></span>()</code></th>\n"
+ "<td class=\"colLast\"> </td>\n"
+ "</tr>\n"
+ "<tr id=\"i3\" class=\"rowColor\">\n"
+ "<td class=\"colFirst\"><code>java.util.List<java.lang.String></code></td>\n"
+ "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
- + "<a href=\"../pkg2/Test.html#gammaProperty--\">gammaProperty</a></span>​()</code></th>\n"
+ + "<a href=\"../pkg2/Test.html#gammaProperty--\">gammaProperty</a></span>()</code></th>\n"
+ "<td class=\"colLast\"> </td>"
);
}
--- a/test/langtools/jdk/javadoc/doclet/testLambdaFeature/TestLambdaFeature.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testLambdaFeature/TestLambdaFeature.java Thu Sep 28 09:13:27 2017 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8004893 8022738 8029143 8175200
+ * @bug 8004893 8022738 8029143 8175200 8186332
* @summary Make sure that the lambda feature changes work fine in
* javadoc.
* @author bpatel
@@ -55,7 +55,7 @@
checkOutput("pkg/A.html", true,
"<td class=\"colFirst\"><code>default void</code></td>",
- "<pre>default void defaultMethod​()</pre>",
+ "<pre>default void defaultMethod()</pre>",
"<caption><span id=\"t0\" class=\"activeTableTab\"><span>"
+ "All Methods</span><span class=\"tabEnd\"> </span></span>"
+ "<span id=\"t2\" class=\"tableTab\"><span>"
@@ -83,7 +83,7 @@
checkOutput("pkg/A.html", false,
"<td class=\"colFirst\"><code>default default void</code></td>",
- "<pre>default default void defaultMethod​()</pre>");
+ "<pre>default default void defaultMethod()</pre>");
checkOutput("pkg/B.html", false,
"<td class=\"colFirst\"><code>default void</code></td>",
--- a/test/langtools/jdk/javadoc/doclet/testLiteralCodeInPre/TestLiteralCodeInPre.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testLiteralCodeInPre/TestLiteralCodeInPre.java Thu Sep 28 09:13:27 2017 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8002387 8014636 8078320 8175200
+ * @bug 8002387 8014636 8078320 8175200 8186332
* @summary Improve rendered HTML formatting for {@code}
* @library ../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
@@ -47,19 +47,19 @@
checkExit(Exit.OK);
checkOutput("pkg/Test.html", true,
- "no_pre​()</pre>\n"
+ "no_pre()</pre>\n"
+ "<div class=\"block\">abc<code>def</code>ghi</div>",
- "no_pre_extra_whitespace​()</pre>\n"
+ "no_pre_extra_whitespace()</pre>\n"
+ "<div class=\"block\">abc<code> def </code>ghi</div>",
- "in_pre​()</pre>\n"
+ "in_pre()</pre>\n"
+ "<div class=\"block\"><pre> abc<code> def </code>ghi</pre></div>",
- "pre_after_text​()</pre>\n"
+ "pre_after_text()</pre>\n"
+ "<div class=\"block\">xyz <pre> abc<code> def </code>ghi</pre></div>",
- "after_pre​()</pre>\n"
+ "after_pre()</pre>\n"
+ "<div class=\"block\">xyz <pre> pqr </pre> abc<code> def </code>ghi</div>",
- "back_in_pre​()</pre>\n"
+ "back_in_pre()</pre>\n"
+ "<div class=\"block\">xyz <pre> pqr </pre> mno <pre> abc<code> def </code>ghi</pre></div>",
- "typical_usage_code​()</pre>\n"
+ "typical_usage_code()</pre>\n"
+ "<div class=\"block\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n"
+ " Example: <pre><code>\n"
+ " line 0 @Override\n"
@@ -68,7 +68,7 @@
+ " line 3 }\n"
+ " </code></pre>\n"
+ " and so it goes.</div>",
- "typical_usage_literal​()</pre>\n"
+ "typical_usage_literal()</pre>\n"
+ "<div class=\"block\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n"
+ " Example: <pre>\n"
+ " line 0 @Override\n"
@@ -77,7 +77,7 @@
+ " line 3 }\n"
+ " </pre>\n"
+ " and so it goes.</div>",
- "recommended_usage_literal​()</pre>\n"
+ "recommended_usage_literal()</pre>\n"
+ "<div class=\"block\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n"
+ " Example: <pre>\n"
+ " line 0 @Override\n"
@@ -89,7 +89,7 @@
+ " <PRE>\n"
+ " <b>id </b>\n"
+ " </PRE></div>",
- "<pre>public void htmlAttrInPre1​()</pre>\n"
+ "<pre>public void htmlAttrInPre1()</pre>\n"
+ "<div class=\"block\">More html tag outliers.\n"
+ " <pre>\n"
+ " @Override\n"
--- a/test/langtools/jdk/javadoc/doclet/testMemberSummary/TestMemberSummary.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testMemberSummary/TestMemberSummary.java Thu Sep 28 09:13:27 2017 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4951228 6290760 8025633 8026567 8081854 8162363 8175200 8177417
+ * @bug 4951228 6290760 8025633 8026567 8081854 8162363 8175200 8177417 8186332
* @summary Test the case where the overriden method returns a different
* type than the method in the child class. Make sure the
* documentation is inherited but the return type isn't.
@@ -52,12 +52,12 @@
// Check return type in member summary.
"<code><a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">PublicChild</a></code></td>\n"
+ "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\"><a href=\"../pkg/PublicChild.html#returnTypeTest--\">"
- + "returnTypeTest</a></span>​()</code>",
+ + "returnTypeTest</a></span>()</code>",
// Check return type in member detail.
"<pre>public <a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">"
- + "PublicChild</a> returnTypeTest​()</pre>",
+ + "PublicChild</a> returnTypeTest()</pre>",
"<th class=\"colConstructorName\" scope=\"row\"><code><span class=\"memberNameLink\">"
- + "<a href=\"../pkg/PublicChild.html#PublicChild--\">PublicChild</a></span>​()</code></th>");
+ + "<a href=\"../pkg/PublicChild.html#PublicChild--\">PublicChild</a></span>()</code></th>");
checkOutput("pkg/PrivateParent.html", true,
"<td class=\"colFirst\"><code>private </code></td>\n"
--- a/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java Thu Sep 28 09:13:27 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
+ * 8178043 8181622 8183511
* @summary Test modules support in javadoc.
* @author bpatel
* @library ../lib
@@ -446,7 +446,7 @@
void checkHtml5Description(boolean found) {
checkOutput("moduleA-summary.html", found,
"<section role=\"region\">\n"
- + "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated, for removal:"
+ + "<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>\n"
@@ -1015,7 +1015,7 @@
void checkModuleDeprecation(boolean found) {
checkOutput("moduleA-summary.html", found,
- "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated, for removal:"
+ "<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>");
@@ -1031,12 +1031,12 @@
+ "</td>\n"
+ "</tr>");
checkOutput("moduleB-summary.html", !found,
- "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated.</span>\n"
+ "<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>");
checkOutput("moduletags-summary.html", found,
"<p>@Deprecated\n"
+ "</p>",
- "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated.</span></div>");
+ "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span></div>");
}
void checkModuleAnnotation() {
--- a/test/langtools/jdk/javadoc/doclet/testNewLanguageFeatures/TestNewLanguageFeatures.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testNewLanguageFeatures/TestNewLanguageFeatures.java Thu Sep 28 09:13:27 2017 -0700
@@ -24,7 +24,7 @@
/*
* @test
* @bug 4789689 4905985 4927164 4827184 4993906 5004549 7025314 7010344 8025633 8026567 8162363
- * 8175200
+ * 8175200 8186332
* @summary Run Javadoc on a set of source files that demonstrate new
* language features. Check the output to ensure that the new
* language features are properly documented.
@@ -549,7 +549,7 @@
+ "=\"Constructor Annotation\",\n"
+ " <a href=\"../pkg/AnnotationType.html#required--\">"
+ "required</a>=1994)\n"
- + "public AnnotationTypeUsage​()</pre>",
+ + "public AnnotationTypeUsage()</pre>",
// METHOD
"<pre><a href=\"../pkg/AnnotationType.html\" "
+ "title=\"annotation in pkg\">@AnnotationType</a>("
@@ -557,7 +557,7 @@
+ "=\"Method Annotation\",\n"
+ " <a href=\"../pkg/AnnotationType.html#required--\">"
+ "required</a>=1994)\n"
- + "public void method​()</pre>",
+ + "public void method()</pre>",
// METHOD PARAMS
"<pre>public void methodWithParams​("
+ "<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">"
@@ -630,11 +630,11 @@
// CONSTRUCTOR
"<a href=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</a>(<a href=\"../pkg/AnnotationType.html#optional\">optional</a>=\"Constructor Annotation\",\n"
+ " <a href=\"../pkg/AnnotationType.html#required\">required</a>=1994)\n"
- + "public <span class=\"typeNameLabel\">AnnotationTypeUsage</span>​()",
+ + "public <span class=\"typeNameLabel\">AnnotationTypeUsage</span>()",
// METHOD
"<a href=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</a>(<a href=\"../pkg/AnnotationType.html#optional\">optional</a>=\"Method Annotation\",\n"
+ " <a href=\"../pkg/AnnotationType.html#required\">required</a>=1994)\n"
- + "public void <span class=\"memberNameLabel\">method</span>​()");
+ + "public void <span class=\"memberNameLabel\">method</span>()");
//=================================
// Make sure annotation types do not
--- a/test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.java Thu Sep 28 09:13:27 2017 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4749567 8071982 8175200
+ * @bug 4749567 8071982 8175200 8186332
* @summary Test the output for -header, -footer, -nooverview, -nodeprecatedlist, -nonavbar, -notree, -stylesheetfile options.
* @author Bhavesh Patel
* @library ../lib
@@ -148,7 +148,7 @@
"<pre>public java.lang.Object <a href="
+ "\"../src-html/linksource/Properties.html#line.31\">someProperty</a></pre>",
"<pre>public java.lang.Object <a href="
- + "\"../src-html/linksource/Properties.html#line.31\">someProperty</a>​()</pre>");
+ + "\"../src-html/linksource/Properties.html#line.31\">someProperty</a>()</pre>");
checkOutput("src-html/linksource/Properties.html", true,
"<title>Source code</title>",
@@ -161,9 +161,9 @@
"<pre>public int <a href=\"../src-html/linksource/SomeClass.html#line.31\">"
+ "field</a></pre>",
"<pre>public <a href=\"../src-html/linksource/SomeClass.html#line.33\">"
- + "SomeClass</a>​()</pre>",
+ + "SomeClass</a>()</pre>",
"<pre>public int <a href=\"../src-html/linksource/SomeClass.html#line.36\">"
- + "method</a>​()</pre>");
+ + "method</a>()</pre>");
checkOutput("src-html/linksource/SomeClass.html", true,
"<title>Source code</title>",
--- a/test/langtools/jdk/javadoc/doclet/testOverridenMethods/TestBadOverride.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testOverridenMethods/TestBadOverride.java Thu Sep 28 09:13:27 2017 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8174839 8175200
+ * @bug 8174839 8175200 8186332
* @summary Bad overriding method should not crash
* @library ../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
@@ -52,7 +52,7 @@
checkOutput("pkg4/Foo.html", true,
"<li class=\"blockList\">\n"
+ "<h4>toString</h4>\n"
- + "<pre>public void toString​()</pre>\n"
+ + "<pre>public void toString()</pre>\n"
+ "<div class=\"block\">Why can't I do this ?</div>\n"
+ "</li>");
}
--- a/test/langtools/jdk/javadoc/doclet/testPackageDeprecation/TestPackageDeprecation.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testPackageDeprecation/TestPackageDeprecation.java Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2016, 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
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6492694 8026567 8048351 8162363
+ * @bug 6492694 8026567 8048351 8162363 8183511
* @summary Test package deprecation.
* @author bpatel
* @library ../lib/
@@ -48,7 +48,7 @@
checkExit(Exit.OK);
checkOutput("pkg1/package-summary.html", true,
- "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated.</span>\n" +
+ "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span>\n" +
"<div class=\"block\"><span class=\"deprecationComment\">This package is Deprecated." +
"</span></div>"
);
--- a/test/langtools/jdk/javadoc/doclet/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java Thu Sep 28 09:13:27 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 6802694 8025633 8026567
+ * @bug 6802694 8025633 8026567 8183511
* @summary This test verifies deprecation info in serialized-form.html.
* @author Bhavesh Patel
* @library ../lib
@@ -135,7 +135,7 @@
void checkNoComment(boolean expectFound) {
checkOutput("serialized-form.html", expectFound,
"<pre>boolean undecorated</pre>\n"
- + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> <span class=\"deprecationComment\">"
+ + "<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"
--- a/test/langtools/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java Thu Sep 28 09:13:27 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
+ * 8175218 8176452 8181215 8182263 8183511
* @summary Run tests on doclet stylesheet.
* @author jamieh
* @library ../lib
@@ -186,6 +186,17 @@
+ ".constantValuesContainer td a:link, .constantValuesContainer td a:visited {\n"
+ " font-weight:bold;\n"
+ "}",
+ ".deprecationBlock {\n"
+ + " font-size:14px;\n"
+ + " font-family:'DejaVu Serif', Georgia, \"Times New Roman\", Times, serif;\n"
+ + " border-style:solid;\n"
+ + " border-width:thin;\n"
+ + " border-radius:10px;\n"
+ + " padding:10px;\n"
+ + " margin-bottom:10px;\n"
+ + " margin-right:10px;\n"
+ + " display:inline-block;\n"
+ + "}",
"#reset {\n"
+ " background-color: rgb(255,255,255);\n"
+ " background-image:url('resources/x.png');\n"
--- a/test/langtools/jdk/javadoc/doclet/testSummaryTag/TestSummaryTag.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testSummaryTag/TestSummaryTag.java Thu Sep 28 09:13:27 2017 -0700
@@ -25,7 +25,7 @@
/*
* @test
- * @bug 8173425
+ * @bug 8173425 8186332
* @summary tests for the summary tag behavior
* @library ../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
@@ -87,7 +87,7 @@
checkOutput("p1/A.html", true,
"<li class=\"blockList\">\n"
+ "<h4>m3</h4>\n"
- + "<pre>public void m3​()</pre>\n"
+ + "<pre>public void m3()</pre>\n"
+ "<div class=\"block\">First sentence some text maybe second sentence.</div>\n"
+ "</li>\n"
);
--- a/test/langtools/jdk/javadoc/doclet/testTagOutput/TestTagOutput.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testTagOutput/TestTagOutput.java Thu Sep 28 09:13:27 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
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8026370 8026567
+ * @bug 8026370 8026567 8183511
* @summary This test checks the generated tag output.
* @author Bhavesh Patel
* @library ../lib
@@ -47,12 +47,12 @@
checkExit(Exit.OK);
checkOutput("pkg1/DeprecatedTag.html", true,
- "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> </div>",
- "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> " +
+ "<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>");
checkOutput("pkg1/DeprecatedTag.html", false,
- "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated." +
+ "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated." +
"</span> <span class=\"deprecationComment\"></span></div>");
}
}
--- a/test/langtools/jdk/javadoc/doclet/testTypeAnnotations/TestTypeAnnotations.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testTypeAnnotations/TestTypeAnnotations.java Thu Sep 28 09:13:27 2017 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8005091 8009686 8025633 8026567 6469562 8071982 8071984 8162363 8175200
+ * @bug 8005091 8009686 8025633 8026567 6469562 8071982 8071984 8162363 8175200 8186332
* @summary Make sure that type annotations are displayed correctly
* @author Bhavesh Patel
* @library ../lib
@@ -155,17 +155,17 @@
checkOutput("typeannos/MtdDefaultScope.html", true,
"<pre>public <T> <a href=\"../typeannos/MRtnA.html\" "
+ "title=\"annotation in typeannos\">@MRtnA</a> java.lang.String"
- + " method​()</pre>",
+ + " method()</pre>",
// When JDK-8068737 is fixed, we should change the order
"<pre><a href=\"../typeannos/MRtnA.html\" title=\"annotation in typeannos\">"
+ "@MRtnA</a> java.lang.String "
+ "<a href=\"../typeannos/MRtnB.html\" title=\"annotation in typeannos\">@MRtnB</a> [] "
+ "<a href=\"../typeannos/MRtnA.html\" title=\"annotation in typeannos\">@MRtnA</a> []"
- + " array2Deep​()</pre>",
+ + " array2Deep()</pre>",
"<pre><a href=\"../typeannos/MRtnA.html\" title=\"annotation in "
- + "typeannos\">@MRtnA</a> java.lang.String[][] array2​()</pre>");
+ + "typeannos\">@MRtnA</a> java.lang.String[][] array2()</pre>");
checkOutput("typeannos/MtdModifiedScoped.html", true,
"<pre>public final <a href=\"../typeannos/MtdParameterized.html\" "
@@ -177,25 +177,25 @@
+ "String,<a href=\"../typeannos/MRtnB.html\" title=\"annotation in "
+ "typeannos\">@MRtnB</a> java.lang.String>,<a href=\"../typeannos/"
+ "MRtnB.html\" title=\"annotation in typeannos\">@MRtnB</a> java."
- + "lang.String> nestedMtdParameterized​()</pre>");
+ + "lang.String> nestedMtdParameterized()</pre>");
// Test for type annotations on method type parameters (MethodTypeParameters.java).
checkOutput("typeannos/UnscopedUnmodified.html", true,
"<pre><K extends <a href=\"../typeannos/MTyParamA.html\" title=\""
+ "annotation in typeannos\">@MTyParamA</a> java.lang.String>"
- + " void methodExtends​()</pre>",
+ + " void methodExtends()</pre>",
"<pre><K extends <a href=\"../typeannos/MTyParamA.html\" title=\""
+ "annotation in typeannos\">@MTyParamA</a> <a href=\"../typeannos/"
+ "MtdTyParameterized.html\" title=\"class in typeannos\">"
+ "MtdTyParameterized</a><<a href=\"../typeannos/MTyParamB.html\" "
+ "title=\"annotation in typeannos\">@MTyParamB</a> java.lang.String"
- + ">> void nestedExtends​()</pre>");
+ + ">> void nestedExtends()</pre>");
checkOutput("typeannos/PublicModifiedMethods.html", true,
"<pre>public final <K extends <a href=\"../typeannos/"
+ "MTyParamA.html\" title=\"annotation in typeannos\">@MTyParamA</a> "
- + "java.lang.String> void methodExtends​()</pre>",
+ + "java.lang.String> void methodExtends()</pre>",
"<pre>public final <K extends <a href=\"../typeannos/"
+ "MTyParamA.html\" title=\"annotation in typeannos\">@MTyParamA</a> "
@@ -204,7 +204,7 @@
+ "typeannos/MtdTyParameterized.html\" title=\"class in typeannos\">"
+ "MtdTyParameterized</a><<a href=\"../typeannos/MTyParamB.html\" "
+ "title=\"annotation in typeannos\">@MTyParamB</a> java.lang.String"
- + ">> void dual​()</pre>");
+ + ">> void dual()</pre>");
// Test for type annotations on parameters (Parameters.java).
checkOutput("typeannos/Parameters.html", true,
@@ -236,11 +236,11 @@
// Test for type annotations on throws (Throws.java).
checkOutput("typeannos/ThrDefaultUnmodified.html", true,
- "<pre>void oneException​()\n"
+ "<pre>void oneException()\n"
+ " throws <a href=\"../typeannos/ThrA.html\" title=\""
+ "annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>",
- "<pre>void twoExceptions​()\n"
+ "<pre>void twoExceptions()\n"
+ " throws <a href=\"../typeannos/ThrA.html\" title=\""
+ "annotation in typeannos\">@ThrA</a> java.lang.RuntimeException,\n"
+ " <a href=\"../typeannos/ThrA.html\" title=\""
@@ -258,12 +258,12 @@
+ "title=\"annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>");
checkOutput("typeannos/ThrWithValue.html", true,
- "<pre>void oneException​()\n"
+ "<pre>void oneException()\n"
+ " throws <a href=\"../typeannos/ThrB.html\" title=\""
+ "annotation in typeannos\">@ThrB</a>("
+ "\"m\") java.lang.Exception</pre>",
- "<pre>void twoExceptions​()\n"
+ "<pre>void twoExceptions()\n"
+ " throws <a href=\"../typeannos/ThrB.html\" title=\""
+ "annotation in typeannos\">@ThrB</a>("
+ "\"m\") java.lang.RuntimeException,\n"
@@ -275,7 +275,7 @@
"<pre><K,<a href=\"../typeannos/TyParaA.html\" title=\"annotation in typeannos\">"
+ "@TyParaA</a> V extends <a href=\"../typeannos/TyParaA.html\" "
+ "title=\"annotation in typeannos\">@TyParaA</a> "
- + "java.lang.String> void secondAnnotated​()</pre>"
+ + "java.lang.String> void secondAnnotated()</pre>"
);
// Test for type annotations on wildcard type (Wildcards.java).
@@ -288,7 +288,7 @@
"<pre><a href=\"../typeannos/MyList.html\" title=\"class in "
+ "typeannos\">MyList</a><? super <a href=\"../typeannos/WldA.html\" "
+ "title=\"annotation in typeannos\">@WldA</a> java.lang.String>"
- + " returnWcSuper​()</pre>");
+ + " returnWcSuper()</pre>");
checkOutput("typeannos/BoundWithValue.html", true,
"<pre>void wcSuper​(<a href=\"../typeannos/MyList.html\" title=\""
@@ -301,7 +301,7 @@
+ "typeannos\">MyList</a><? extends <a href=\"../typeannos/WldB."
+ "html\" title=\"annotation in typeannos\">@WldB</a>("
+ "\"m\") java.lang.String"
- + "> returnWcExtends​()</pre>");
+ + "> returnWcExtends()</pre>");
// Test for receiver annotations (Receivers.java).
checkOutput("typeannos/DefaultUnmodified.html", true,
@@ -396,7 +396,7 @@
+ "\"../typeannos/RepConstructorB.html\" title=\"annotation in typeannos"
+ "\">@RepConstructorB</a> <a href=\"../typeannos/RepConstructorB.html"
+ "\" title=\"annotation in typeannos\">@RepConstructorB</a>\n"
- + "RepeatingOnConstructor​()</pre>",
+ + "RepeatingOnConstructor()</pre>",
"<pre><a href=\"../typeannos/RepConstructorA.html\" title=\"annotation in typeannos"
+ "\">@RepConstructorA</a> <a href=\"../typeannos/RepConstructorA.html"
@@ -574,7 +574,7 @@
checkOutput("typeannos/RepeatingOnMethod.html", true,
"<code>(package private) java.lang.String</code></td>\n<th class=\"colSecond\" scope=\"row\">"
+ "<code><span class=\"memberNameLink\"><a href="
- + "\"../typeannos/RepeatingOnMethod.html#test1--\">test1</a></span>​()</code>",
+ + "\"../typeannos/RepeatingOnMethod.html#test1--\">test1</a></span>()</code>",
"<code>(package private) <a href=\"../typeannos/RepTypeUseA.html\" "
+ "title=\"annotation in typeannos\">@RepTypeUseA</a> <a href="
@@ -584,7 +584,7 @@
+ "\" title=\"annotation in typeannos\">@RepTypeUseB</a> java.lang.String</code>"
+ "</td>\n<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+ "<a href=\"../typeannos/RepeatingOnMethod.html#test2--\">test2</a>"
- + "</span>​()</code>",
+ + "</span>()</code>",
"<code>(package private) <a href=\"../typeannos/RepTypeUseA.html\" "
+ "title=\"annotation in typeannos\">@RepTypeUseA</a> <a href="
@@ -594,7 +594,7 @@
+ "title=\"annotation in typeannos\">@RepTypeUseB</a> java.lang.String</code>"
+ "</td>\n<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+ "<a href=\"../typeannos/RepeatingOnMethod.html#test3--\">test3</a>"
- + "</span>​()</code>",
+ + "</span>()</code>",
"<code>(package private) <a href=\"../typeannos/RepAllContextsA.html\" "
+ "title=\"annotation in typeannos\">@RepAllContextsA</a> <a href="
@@ -604,7 +604,7 @@
+ "\"../typeannos/RepAllContextsB.html\" title=\"annotation in typeannos\">"
+ "@RepAllContextsB</a> java.lang.String</code></td>\n<th class=\"colSecond\" scope=\"row\">"
+ "<code><span class=\"memberNameLink\"><a href=\"../typeannos/RepeatingOnMethod.html"
- + "#test4--\">test4</a></span>​()</code>",
+ + "#test4--\">test4</a></span>()</code>",
"<code><span class=\"memberNameLink\"><a href=\"../typeannos/RepeatingOnMethod.html"
+ "#test5-java.lang.String-java.lang.String...-\">test5</a></span>"
@@ -621,13 +621,13 @@
+ "\"annotation in typeannos\">@RepMethodA</a>\n<a href=\"../typeannos/RepMethodB.html\""
+ " title=\"annotation in typeannos\">@RepMethodB</a> <a href="
+ "\"../typeannos/RepMethodB.html\" title=\"annotation in typeannos\">"
- + "@RepMethodB</a>\njava.lang.String test1​()",
+ + "@RepMethodB</a>\njava.lang.String test1()",
"<a href=\"../typeannos/RepTypeUseA.html\" title=\"annotation in typeannos\">"
+ "@RepTypeUseA</a> <a href=\"../typeannos/RepTypeUseA.html\" title="
+ "\"annotation in typeannos\">@RepTypeUseA</a> <a href=\"../typeannos/RepTypeUseB.html\" "
+ "title=\"annotation in typeannos\">@RepTypeUseB</a> <a href=\"../typeannos/RepTypeUseB.html\" "
- + "title=\"annotation in typeannos\">@RepTypeUseB</a> java.lang.String test2​()",
+ + "title=\"annotation in typeannos\">@RepTypeUseB</a> java.lang.String test2()",
"<a href=\"../typeannos/RepMethodA.html\" title=\"annotation in typeannos\">"
+ "@RepMethodA</a> <a href=\"../typeannos/RepMethodA.html\" title="
@@ -639,7 +639,7 @@
+ "title=\"annotation in typeannos\">@RepTypeUseA</a> <a href="
+ "\"../typeannos/RepTypeUseB.html\" title=\"annotation in typeannos\">"
+ "@RepTypeUseB</a> <a href=\"../typeannos/RepTypeUseB.html\" title="
- + "\"annotation in typeannos\">@RepTypeUseB</a> java.lang.String test3​()",
+ + "\"annotation in typeannos\">@RepTypeUseB</a> java.lang.String test3()",
"<a href=\"../typeannos/RepAllContextsA.html\" title=\"annotation in typeannos\">"
+ "@RepAllContextsA</a> <a href=\"../typeannos/RepAllContextsA.html\" "
@@ -652,7 +652,7 @@
+ "title=\"annotation in typeannos\">@RepAllContextsA</a> <a href="
+ "\"../typeannos/RepAllContextsB.html\" title=\"annotation in typeannos\">"
+ "@RepAllContextsB</a> <a href=\"../typeannos/RepAllContextsB.html\" "
- + "title=\"annotation in typeannos\">@RepAllContextsB</a> java.lang.String test4​()",
+ + "title=\"annotation in typeannos\">@RepAllContextsB</a> java.lang.String test4()",
"java.lang.String test5​(<a href=\"../typeannos/RepTypeUseA.html\" "
+ "title=\"annotation in typeannos\">@RepTypeUseA</a> <a href="
@@ -697,7 +697,7 @@
"<code>(package private) java.lang.String</code></td>\n<th class=\"colSecond\" scope=\"row\"><code>"
+ "<span class=\"memberNameLink\"><a href=\"../typeannos/RepeatingOnTypeParametersBoundsTypeArgumentsOnMethod.html#"
- + "test--\">test</a></span>​()</code>",
+ + "test--\">test</a></span>()</code>",
"java.lang.String test​(<a href=\"../typeannos/RepTypeUseA.html\" "
+ "title=\"annotation in typeannos\">@RepTypeUseA</a> <a href="
@@ -718,6 +718,6 @@
+ "\"annotation in typeannos\">@RepMethodA</a>\n<a href=\"../typeannos/RepMethodB.html"
+ "\" title=\"annotation in typeannos\">@RepMethodB</a> <a href="
+ "\"../typeannos/RepMethodB.html\" title=\"annotation in typeannos\">"
- + "@RepMethodB</a>\nvoid test​()");
+ + "@RepMethodB</a>\nvoid test()");
}
}
--- a/test/langtools/jdk/javadoc/doclet/testUseOption/TestUseOption.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testUseOption/TestUseOption.java Thu Sep 28 09:13:27 2017 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4496290 4985072 7006178 7068595 8016328 8050031 8048351 8081854 8071982 8162363 8175200
+ * @bug 4496290 4985072 7006178 7068595 8016328 8050031 8048351 8081854 8071982 8162363 8175200 8186332
* @summary A simple test to ensure class-use files are correct.
* @author jamieh
* @library ../lib
@@ -134,7 +134,7 @@
"<td class=\"colFirst\"><code>void</code></td>\n<th class=\"colSecond\" scope=\"row\"><span class="
+ "\"typeNameLabel\">C1.</span><code><span class=\"memberNameLink\">"
+ "<a href=\"../../pkg1/C1.html#methodInC1ThrowsThrowable--\">methodInC1ThrowsThrowable"
- + "</a></span>​()</code></th>"
+ + "</a></span>()</code></th>"
);
}
--- a/test/langtools/jdk/jshell/CompletionSuggestionTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/langtools/jdk/jshell/CompletionSuggestionTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8131025 8141092 8153761 8145263 8131019 8175886 8176184 8176241 8176110
+ * @bug 8131025 8141092 8153761 8145263 8131019 8175886 8176184 8176241 8176110 8177466
* @summary Test Completion and Documentation
* @library /tools/lib
* @modules jdk.compiler/com.sun.tools.javac.api
@@ -645,6 +645,22 @@
assertCompletion("Foo.m(new Baz<>(|", true, "str");
}
+ public void testIntersection() {
+ assertEval("<Z extends Runnable & CharSequence> Z get() { return null; }");
+ assertEval("var v = get();");
+ assertCompletionIncludesExcludes("v.|", true, Set.of("run()", "length()"), Set.of());
+ assertCompletion("Runnable r = |", true, "get()", "v");
+ assertCompletion("CharSequence r = |", true, "get()", "v");
+ assertCompletion("Number r = |", true);
+ }
+
+ public void testAnonymous() {
+ assertEval("var v = new Runnable() { public void run() { } public int length() { return 0; } };");
+ assertCompletionIncludesExcludes("v.|", true, Set.of("run()", "length()"), Set.of());
+ assertCompletion("Runnable r = |", true, "v");
+ assertCompletion("CharSequence r = |", true);
+ }
+
@BeforeMethod
public void setUp() {
super.setUp();
--- a/test/langtools/jdk/jshell/ToolSimpleTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/langtools/jdk/jshell/ToolSimpleTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8153716 8143955 8151754 8150382 8153920 8156910 8131024 8160089 8153897 8167128 8154513 8170015 8170368 8172102 8172103 8165405 8173073 8173848 8174041 8173916 8174028 8174262 8174797 8177079 8180508
+ * @bug 8153716 8143955 8151754 8150382 8153920 8156910 8131024 8160089 8153897 8167128 8154513 8170015 8170368 8172102 8172103 8165405 8173073 8173848 8174041 8173916 8174028 8174262 8174797 8177079 8180508 8177466
* @summary Simple jshell tool tests
* @modules jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.main
@@ -740,4 +740,26 @@
(a) -> assertCommandOutputContains(a, "1234", "==> 1234")
);
}
+
+ @Test
+ public void testIntersection() {
+ test(
+ (a) -> assertCommandOutputContains(a, "<Z extends Runnable&CharSequence> Z get1() { return null; }", "get1()"),
+ (a) -> assertCommandOutputContains(a, "var g1 = get1()", "g1"),
+ (a) -> assertCommand(a, "/vars g1", "| CharSequence&Runnable g1 = null"),
+ (a) -> assertCommandOutputContains(a, "<Z extends Number&CharSequence> Z get2() { return null; }", "get2()"),
+ (a) -> assertCommandOutputContains(a, "var g2 = get2()", "g2"),
+ (a) -> assertCommand(a, "/vars g2", "| Number&CharSequence g2 = null")
+ );
+ }
+
+ @Test
+ public void testAnonymous() {
+ test(
+ (a) -> assertCommandOutputContains(a, "var r1 = new Object() {}", "r1"),
+ (a) -> assertCommandOutputContains(a, "/vars r1", "| <anonymous class extending Object> r1 = "),
+ (a) -> assertCommandOutputContains(a, "var r2 = new Runnable() { public void run() { } }", "r2"),
+ (a) -> assertCommandOutputContains(a, "/vars r2", "| <anonymous class implementing Runnable> r2 = ")
+ );
+ }
}
--- a/test/langtools/jdk/jshell/VariablesTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/langtools/jdk/jshell/VariablesTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8144903
+ * @bug 8144903 8177466
* @summary Tests for EvaluationState.variables
* @build KullaTesting TestingInputStream ExpectedDiagnostic
* @run testng VariablesTest
@@ -337,4 +337,30 @@
assertEquals(unr.get(0), "class undefined");
assertVariables(variable("undefined", "d"));
}
+
+ public void lvti() {
+ assertEval("var d = 234;", "234");
+ assertEval("class Test<T> { T[][] get() { return null; } }", added(VALID));
+ assertEval("Test<? extends String> test() { return new Test<>(); }", added(VALID));
+ assertEval("var t = test().get();", added(VALID));
+ assertEval("<Z extends Runnable & CharSequence> Z get1() { return null; }", added(VALID));
+ assertEval("var i1 = get1();", added(VALID));
+ assertEval("void t1() { i1.run(); i1.length(); }", added(VALID));
+ assertEval("i1 = 1;", DiagCheck.DIAG_ERROR, DiagCheck.DIAG_OK, ste(MAIN_SNIPPET, NONEXISTENT, REJECTED, false, null));
+ assertEval("<Z extends Number & CharSequence> Z get2() { return null; }", added(VALID));
+ assertEval("var i2 = get2();", added(VALID));
+ assertEval("void t2() { i2.length(); }", added(VALID));
+ assertEval("var r1 = new Runnable() { public void run() { } public String get() { return \"good\"; } };", added(VALID));
+ assertEval("Runnable r2 = r1;");
+ assertEval("r1.get()", "\"good\"");
+ assertEval("var v = r1.get();", "\"good\"");
+ assertEval("var r3 = new java.util.ArrayList<String>(42) { public String get() { return \"good\"; } };", added(VALID));
+ assertEval("r3.get()", "\"good\"");
+ assertEval("class O { public class Inner { public String test() { return \"good\"; } } }");
+ assertEval("var r4 = new O().new Inner() { public String get() { return \"good\"; } };");
+ assertEval("r4.get()", "\"good\"");
+ assertEval("class O2 { public class Inner { public Inner(int i) { } public String test() { return \"good\"; } } }");
+ assertEval("var r5 = new O2().new Inner(1) { public String get() { return \"good\"; } };");
+ assertEval("r5.get()", "\"good\"");
+ }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/diags/examples/IllegalRefToVarType.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,32 @@
+/*
+ * 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. 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.
+ */
+
+// key: compiler.err.illegal.ref.to.var.type
+
+import java.util.List;
+
+class IllegalRefToVarType {
+ var<String> list() { return null; }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/diags/examples/LocalArrayMissingTarget.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+
+// key: compiler.err.cant.infer.local.var.type
+// key: compiler.misc.local.array.missing.target
+
+class LocalArrayMissingTarget {
+ void test() {
+ var x = { 1, 2, 3 };
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/diags/examples/LocalCantInferNull.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,33 @@
+/*
+ * 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. 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.
+ */
+
+// key: compiler.err.cant.infer.local.var.type
+// key: compiler.misc.local.cant.infer.null
+
+class LocalCantInferNull {
+ void test() {
+ var s = null;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/diags/examples/LocalLambdaMissingTarget.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,33 @@
+/*
+ * 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. 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.
+ */
+
+// key: compiler.err.cant.infer.local.var.type
+// key: compiler.misc.local.lambda.missing.target
+
+class LocalLambdaMissingTarget {
+ void test() {
+ var x = () -> { };
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/diags/examples/LocalMissingInit.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,33 @@
+/*
+ * 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. 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.
+ */
+
+// key: compiler.err.cant.infer.local.var.type
+// key: compiler.misc.local.missing.init
+
+class LocalMissingInit {
+ void test() {
+ var s;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/diags/examples/LocalMrefMissingTarget.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,33 @@
+/*
+ * 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. 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.
+ */
+
+// key: compiler.err.cant.infer.local.var.type
+// key: compiler.misc.local.mref.missing.target
+
+class LocalMrefMissingTarget {
+ void test() {
+ var x = this::test;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/diags/examples/LocalRedundantType.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,33 @@
+/*
+ * 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. 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.
+ */
+
+// options: -XDfind=local
+// key: compiler.warn.local.redundant.type
+
+class LocalRedundantType {
+ void test() {
+ String s = "";
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/diags/examples/LocalSelfRef.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,35 @@
+/*
+ * 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. 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.
+ */
+
+// key: compiler.err.cant.infer.local.var.type
+// key: compiler.misc.local.self.ref
+
+class LocalSelfRef {
+ void test() {
+ var x = m(x);
+ }
+
+ String m(String s) { return s; }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/diags/examples/VarNotAllowed.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,28 @@
+/*
+ * 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. 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.
+ */
+
+// key: compiler.err.var.not.allowed
+
+class var { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/diags/examples/VarNotAllowedArray.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,32 @@
+/*
+ * 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. 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.
+ */
+
+// key: compiler.err.var.not.allowed.array
+
+class VarNotAllowedArray {
+ void test(String[] s) {
+ var[] x = s;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/diags/examples/VarNotAllowedCompound.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. 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.
+ */
+
+// key: compiler.err.var.not.allowed.compound
+
+class VarNotAllowedCompound {
+ void test() {
+ var x = 1, y = 2;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/diags/examples/VarNotAllowedHere.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,30 @@
+/*
+ * 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. 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.
+ */
+
+// key: compiler.err.var.not.allowed.here
+
+class VarNotAllowedField {
+ var s = "";
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lvti/BadLocalVarInferenceTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,33 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8177466
+ * @summary Add compiler support for local variable type-inference
+ * @compile/fail/ref=BadLocalVarInferenceTest.out -XDrawDiagnostics BadLocalVarInferenceTest.java
+ */
+
+class BadLocalVarInferenceTest {
+
+ interface Foo<X> {
+ void m(X x);
+ }
+
+ interface Supplier<X> {
+ void m(X x);
+ }
+
+ void test() {
+ var x;
+ var f = () -> { };
+ var m = this::l;
+ var g = null;
+ var d = d = 1;
+ var k = { 1 , 2 };
+ var l = new Foo<>() { //LHS was Foo<String>
+ @Override
+ void m(String s) { }
+ };
+ var s = f(x -> { x.charAt(0); }); //LHS was String
+ }
+
+ <Z> Z f(Supplier<Z> sz) { return null; }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lvti/BadLocalVarInferenceTest.out Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,10 @@
+BadLocalVarInferenceTest.java:19:13: compiler.err.cant.infer.local.var.type: x, (compiler.misc.local.missing.init)
+BadLocalVarInferenceTest.java:20:13: compiler.err.cant.infer.local.var.type: f, (compiler.misc.local.lambda.missing.target)
+BadLocalVarInferenceTest.java:21:13: compiler.err.cant.infer.local.var.type: m, (compiler.misc.local.mref.missing.target)
+BadLocalVarInferenceTest.java:22:13: compiler.err.cant.infer.local.var.type: g, (compiler.misc.local.cant.infer.null)
+BadLocalVarInferenceTest.java:23:13: compiler.err.cant.infer.local.var.type: d, (compiler.misc.local.self.ref)
+BadLocalVarInferenceTest.java:24:13: compiler.err.cant.infer.local.var.type: k, (compiler.misc.local.array.missing.target)
+BadLocalVarInferenceTest.java:25:29: compiler.err.does.not.override.abstract: compiler.misc.anonymous.class: BadLocalVarInferenceTest$1, m(java.lang.Object), BadLocalVarInferenceTest.Foo
+BadLocalVarInferenceTest.java:26:13: compiler.err.method.does.not.override.superclass
+BadLocalVarInferenceTest.java:29:27: compiler.err.cant.resolve.location.args: kindname.method, charAt, , int, (compiler.misc.location.1: kindname.variable, x, java.lang.Object)
+9 errors
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lvti/FoldingTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,47 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8177466
+ * @summary Add compiler support for local variable type-inference
+ * @compile/fail/ref=FoldingTest.out -XDrawDiagnostics FoldingTest.java
+ */
+class FoldingTest {
+
+ void testReachability() {
+ for(var i = 0; i < 3; i++) {
+ // ok
+ }
+ System.out.println("foo"); //this should be reachable
+ }
+
+ void testCase(String s) {
+ var c = "";
+ final String c2 = "" + c;
+ switch (s) {
+ case c: break; //error!
+ case c2: break; //error!
+ }
+ }
+
+ void testAnno() {
+ @Anno1(s1) //error
+ var s1 = "";
+ @Anno2(s2) //error
+ var s2 = "";
+ @Anno3(s3) //error
+ var s3 = "";
+ }
+
+ @interface Anno1 {
+ String value();
+ }
+ @interface Anno2 {
+ Class<?> value();
+ }
+ @interface Anno3 {
+ Foo value();
+ }
+
+ enum Foo {
+ A, B;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lvti/FoldingTest.out Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,6 @@
+FoldingTest.java:20:18: compiler.err.string.const.req
+FoldingTest.java:21:18: compiler.err.string.const.req
+FoldingTest.java:26:16: compiler.err.attribute.value.must.be.constant
+FoldingTest.java:28:16: compiler.err.annotation.value.must.be.class.literal
+FoldingTest.java:30:16: compiler.err.enum.annotation.must.be.enum.constant
+5 errors
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lvti/ParserTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,71 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8177466
+ * @summary Add compiler support for local variable type-inference
+ * @compile -source 9 ParserTest.java
+ * @compile/fail/ref=ParserTest.out -XDrawDiagnostics ParserTest.java
+ */
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.util.function.Function;
+import java.util.List;
+
+class ParserTest<var> {
+ static class TestClass {
+ static class var { } //illegal
+ }
+
+ static class TestInterface {
+ interface var { } //illegal
+ }
+
+ static class TestEnum {
+ enum var { } //illegal
+ }
+
+ static class TestAnno {
+ @interface var { } //illegal
+ }
+
+ @Target(ElementType.TYPE_USE)
+ @interface TA { }
+
+ @interface DA { }
+
+ static class var extends RuntimeException { } //illegal
+
+ var x = null; //illegal
+
+ void test() {
+ var[] x1 = null; //illegal
+ var x2[] = null; //illegal
+ var[][] x3 = null; //illegal
+ var x4[][] = null; //illegal
+ var[] x5 = null; //illegal
+ var x6[] = null; //illegal
+ var@TA[]@TA[] x7 = null; //illegal
+ var x8@TA[]@TA[] = null; //illegal
+ var x9 = null, y = null; //illegal
+ final @DA var x10 = m(); //ok
+ @DA final var x11 = m(); //ok
+ }
+
+ var m() { //illegal
+ return null;
+ }
+
+ void test2(var x) { //error
+ List<var> l1; //error
+ List<? extends var> l2; //error
+ List<? super var> l3; //error
+ try {
+ Function<var, String> f = (var x2) -> ""; //error
+ } catch (var ex) { } //error
+ }
+
+ void test3(Object o) {
+ boolean b1 = o instanceof var; //error
+ Object o2 = (var)o; //error
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lvti/ParserTest.out Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,25 @@
+ParserTest.java:14:18: compiler.err.var.not.allowed: var
+ParserTest.java:16:22: compiler.err.var.not.allowed: var
+ParserTest.java:20:19: compiler.err.var.not.allowed: var
+ParserTest.java:24:14: compiler.err.var.not.allowed: var
+ParserTest.java:28:20: compiler.err.var.not.allowed: var
+ParserTest.java:36:18: compiler.err.var.not.allowed: var
+ParserTest.java:38:5: compiler.err.var.not.allowed.here
+ParserTest.java:41:15: compiler.err.var.not.allowed.array
+ParserTest.java:42:13: compiler.err.var.not.allowed.array
+ParserTest.java:43:17: compiler.err.var.not.allowed.array
+ParserTest.java:44:13: compiler.err.var.not.allowed.array
+ParserTest.java:45:15: compiler.err.var.not.allowed.array
+ParserTest.java:46:13: compiler.err.var.not.allowed.array
+ParserTest.java:49:13: compiler.err.var.not.allowed.compound
+ParserTest.java:54:5: compiler.err.var.not.allowed.here
+ParserTest.java:58:16: compiler.err.var.not.allowed.here
+ParserTest.java:59:14: compiler.err.var.not.allowed.here
+ParserTest.java:60:24: compiler.err.var.not.allowed.here
+ParserTest.java:61:22: compiler.err.var.not.allowed.here
+ParserTest.java:63:22: compiler.err.var.not.allowed.here
+ParserTest.java:63:40: compiler.err.var.not.allowed.here
+ParserTest.java:64:18: compiler.err.var.not.allowed.here
+ParserTest.java:68:35: compiler.err.var.not.allowed.here
+ParserTest.java:69:22: compiler.err.var.not.allowed.here
+24 errors
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lvti/SelfRefTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,23 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8177466
+ * @summary Add compiler support for local variable type-inference
+ * @compile/fail/ref=SelfRefTest.out -XDrawDiagnostics SelfRefTest.java
+ */
+
+import java.util.function.Function;
+
+class SelfRefTest {
+
+ int q() { return 42; }
+ int m(int t) { return t; }
+
+ void test(boolean cond) {
+ var x = cond ? x : x; //error - self reference
+ var y = (Function<Integer, Integer>)(Integer y) -> y; //error - bad shadowing
+ var z = (Runnable)() -> { int z2 = m(z); }; //error - self reference
+ var w = new Object() { int w = 42; void test() { int w2 = w; } }; //ok
+ int u = u; //ok
+ int q = q(); //ok
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lvti/SelfRefTest.out Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,4 @@
+SelfRefTest.java:16:12: compiler.err.cant.infer.local.var.type: x, (compiler.misc.local.self.ref)
+SelfRefTest.java:17:53: compiler.err.already.defined: kindname.variable, y, kindname.method, test(boolean)
+SelfRefTest.java:18:12: compiler.err.cant.infer.local.var.type: z, (compiler.misc.local.self.ref)
+3 errors
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lvti/badTypeReference/BadTypeReference.java Thu Sep 28 09:13:27 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 /nodynamioccopyright/
+ * @bug 8177466
+ * @summary Add compiler support for local variable type-inference
+ * @compile -source 8 pkg/var.java
+ * @compile pkg/nested/var/A.java
+ * @compile/fail/ref=BadTypeReference.out -XDrawDiagnostics BadTypeReference.java
+ */
+
+import pkg.*;
+
+public class BadTypeReference {
+ void test(Object o) {
+ var<String> vs = null; //error
+ Object o2 = var.x; //error
+ pkg.nested.var.A a = new pkg.nested.var.A(); //ok
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lvti/badTypeReference/BadTypeReference.out Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,3 @@
+BadTypeReference.java:39:9: compiler.err.illegal.ref.to.var.type: var
+BadTypeReference.java:40:21: compiler.err.illegal.ref.to.var.type: var
+2 errors
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lvti/badTypeReference/pkg/nested/var/A.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg.nested.var;
+
+public class A {
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lvti/badTypeReference/pkg/var.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg;
+
+public class var {
+ public static Object x = "";
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lvti/harness/InferredType.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,28 @@
+/*
+ * 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. 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.
+ */
+
+public @interface InferredType {
+ String value();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lvti/harness/LocalVariableInferenceTester.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,162 @@
+/*
+ * 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. 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.
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ElementKind;
+import javax.lang.model.type.TypeMirror;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.ToolProvider;
+
+import com.sun.source.tree.CompilationUnitTree;
+import com.sun.source.tree.Tree;
+import com.sun.source.tree.VariableTree;
+import com.sun.source.util.JavacTask;
+import com.sun.source.util.TreePathScanner;
+import com.sun.tools.javac.api.JavacTaskImpl;
+import com.sun.tools.javac.api.JavacTrees;
+import com.sun.tools.javac.code.Printer;
+import com.sun.tools.javac.code.Type;
+import com.sun.tools.javac.code.Type.CapturedType;
+import com.sun.tools.javac.code.Type.ClassType;
+import com.sun.tools.javac.code.Types;
+import com.sun.tools.javac.util.Log;
+
+import static javax.tools.StandardLocation.SOURCE_PATH;
+
+public class LocalVariableInferenceTester {
+
+ static final JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+ static final StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
+
+ public static void main(String[] args) throws IOException {
+ try {
+ if (args.length != 1) {
+ System.err.println("Usage: LocalVariableInferenceTester <sourcefile>");
+ System.exit(1);
+ }
+ File path = new File(System.getProperty("test.src"));
+ fm.setLocation(SOURCE_PATH, Arrays.asList(path));
+ File input = new File(path, args[0]);
+ JavaFileObject jfo = fm.getJavaFileObjects(input).iterator().next();
+ new LocalVariableInferenceTester().compileAndCheck(jfo);
+ } finally {
+ fm.close();
+ }
+ }
+
+ int errors = 0;
+ int checks = 0;
+
+ void compileAndCheck(JavaFileObject input) throws IOException {
+ JavaCompiler c = ToolProvider.getSystemJavaCompiler();
+ JavacTask task = (JavacTask) c.getTask(null, fm, null, null, null, Arrays.asList(input));
+ JavacTrees trees = JavacTrees.instance(task);
+ Types types = Types.instance(((JavacTaskImpl)task).getContext());
+ Iterable<? extends CompilationUnitTree> roots = task.parse();
+ task.analyze(); //force attribution
+ Log log = Log.instance(((JavacTaskImpl)task).getContext());
+ errors += log.nerrors;
+ new LocalVarTypeChecker(trees, types).scan(roots, null);
+ System.err.println("Checks executed: " + checks);
+ if (errors != 0) {
+ throw new AssertionError("Errors were found");
+ }
+ }
+
+ void error(Tree node, String msg) {
+ System.err.println(node);
+ System.err.println("ERROR: " + msg);
+ errors++;
+ }
+
+ class LocalVarTypeChecker extends TreePathScanner<Void, Void> {
+
+ JavacTrees trees;
+ Types types;
+
+ LocalVarTypeChecker(JavacTrees trees, Types types) {
+ this.trees = trees;
+ this.types = types;
+ }
+
+ @Override
+ public Void visitVariable(VariableTree node, Void aVoid) {
+ Element e = trees.getElement(getCurrentPath());
+ if (e.getKind() == ElementKind.LOCAL_VARIABLE) {
+ TypeMirror type = e.asType();
+ InferredType inferredAnno = e.getAnnotation(InferredType.class);
+ if (inferredAnno != null) {
+ checks++;
+ String req = inferredAnno.value();
+ String found = new TypePrinter().visit((Type)type, null);
+ if (!req.equals(found)) {
+ error(node, "Inferred type mismatch; expected: " + req + " - found: " + found);
+ }
+ }
+ }
+ return super.visitVariable(node, null);
+ }
+
+ class TypePrinter extends Printer {
+
+ Map<Type, Integer> capturedIdMap = new HashMap<>();
+
+ @Override
+ protected String localize(Locale locale, String key, Object... args) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public String visitCapturedType(CapturedType t, Locale locale) {
+ return "CAP#" + capturedVarId(t, locale);
+ }
+
+ @Override
+ protected String capturedVarId(CapturedType t, Locale locale) {
+ return String.valueOf(capturedIdMap.getOrDefault(t, capturedIdMap.size()));
+ }
+
+ @Override
+ public String visitClassType(ClassType t, Locale locale) {
+ if (!t.isCompound() && t.tsym.name.isEmpty()) {
+ return "#ANON(" + types.directSupertypes(t) + ")";
+ } else if (t.isCompound()) {
+ return "#INT(" + types.directSupertypes(t) + ")";
+ } else {
+ return super.visitClassType(t, locale);
+ }
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lvti/harness/NonDenotableTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,148 @@
+/*
+ * 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. 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 8177466
+ * @summary Add compiler support for local variable type-inference
+ * @modules jdk.compiler/com.sun.source.tree
+ * jdk.compiler/com.sun.source.util
+ * jdk.compiler/com.sun.tools.javac.api
+ * jdk.compiler/com.sun.tools.javac.code
+ * jdk.compiler/com.sun.tools.javac.util
+ * @build LocalVariableInferenceTester
+ * @run main LocalVariableInferenceTester NonDenotableTest.java
+ */
+import java.util.List;
+
+class NonDenotableTest {
+
+ static final String OBJECT = "java.lang.Object";
+ static final String STRING = "java.lang.String";
+ static final String ANON_OBJECT = "#ANON(java.lang.Object)";
+ static final String ANON_RUNNABLE = "#ANON(java.lang.Object,java.lang.Runnable)";
+ static final String LIST_EXT = "java.util.List<? extends java.lang.String>";
+ static final String LIST_SUP = "java.util.List<? super java.lang.String>";
+ static final String LIST_UNB = "java.util.List<?>";
+ static final String COMP_UNB = "java.lang.Comparable<?>";
+ static final String LIST_EXT_COMP_UNB = "java.util.List<? extends java.lang.Comparable<?>>";
+ static final String LIST_SUP_COMP_UNB = "java.util.List<? super java.lang.Comparable<?>>";
+ static final String INT_INTEGER_DOUBLE = "#INT(java.lang.Number,java.lang.Comparable<? extends java.lang.Number&java.lang.Comparable<?>>)";
+
+ void testExtends() {
+ @InferredType(LIST_EXT)
+ var s = extString();
+ for (@InferredType(LIST_EXT) var s2 = extString() ; ; ) { break; }
+ for (@InferredType(LIST_EXT) var s2 : extStringArr()) { break; }
+ for (@InferredType(LIST_EXT) var s2 : extStringIter()) { break; }
+ for (@InferredType(STRING) var s2 : extString()) { break; }
+ }
+
+ void testExtendsFbound() {
+ @InferredType(LIST_EXT_COMP_UNB)
+ var s = extFbound();
+ for (@InferredType(LIST_EXT_COMP_UNB) var s2 = extFbound() ; ; ) { break; }
+ for (@InferredType(LIST_EXT_COMP_UNB) var s2 : extFboundArr()) { break; }
+ for (@InferredType(LIST_EXT_COMP_UNB) var s2 : extFboundIter()) { break; }
+ for (@InferredType(COMP_UNB) var s2 : extFbound()) { break; }
+ }
+
+ void testSuperFbound() {
+ @InferredType(LIST_UNB)
+ var s = supFbound();
+ for (@InferredType(LIST_UNB) var s2 = supFbound() ; ; ) { break; }
+ for (@InferredType(LIST_UNB) var s2 : supFboundArr()) { break; }
+ for (@InferredType(LIST_UNB) var s2 : supFboundIter()) { break; }
+ for (@InferredType(OBJECT) var s2 : supFbound()) { break; }
+ }
+
+ void testSuper() {
+ @InferredType(LIST_SUP)
+ var s = supString();
+ for (@InferredType(LIST_SUP) var s2 = supString() ; ; ) { break; }
+ for (@InferredType(LIST_SUP) var s2 : supStringArr()) { break; }
+ for (@InferredType(LIST_SUP) var s2 : supStringIter()) { break; }
+ for (@InferredType(OBJECT) var s2 : supString()) { break; }
+ }
+
+ void testUnbound() {
+ @InferredType(LIST_UNB)
+ var s = unbString();
+ for (@InferredType(LIST_UNB) var s2 = unbString() ; ; ) { break; }
+ for (@InferredType(LIST_UNB) var s2 : unbStringArr()) { break; }
+ for (@InferredType(LIST_UNB) var s2 : unbStringIter()) { break; }
+ for (@InferredType(OBJECT) var s2 : unbString()) { break; }
+ }
+
+ void testAnonymousClass() {
+ @InferredType(ANON_OBJECT)
+ var o = new Object() { };
+ for (@InferredType(ANON_OBJECT) var s2 = new Object() { } ; ; ) { break; }
+ for (@InferredType(ANON_OBJECT) var s2 : arrayOf(new Object() { })) { break; }
+ for (@InferredType(ANON_OBJECT) var s2 : listOf(new Object() { })) { break; }
+ }
+
+ void testAnonymousInterface() {
+ @InferredType(ANON_RUNNABLE)
+ var r = new Runnable() { public void run() { } };
+ for (@InferredType(ANON_RUNNABLE) var s2 = new Runnable() { public void run() { } } ; ; ) { break; }
+ for (@InferredType(ANON_RUNNABLE) var s2 : arrayOf(new Runnable() { public void run() { } })) { break; }
+ for (@InferredType(ANON_RUNNABLE) var s2 : listOf(new Runnable() { public void run() { } })) { break; }
+ }
+
+ void testIntersection() {
+ @InferredType(INT_INTEGER_DOUBLE)
+ var c = choose(1, 1L);
+ for (@InferredType(INT_INTEGER_DOUBLE) var s2 = choose(1, 1L) ; ;) { break; }
+ for (@InferredType(INT_INTEGER_DOUBLE) var s2 : arrayOf(choose(1, 1L))) { break; }
+ for (@InferredType(INT_INTEGER_DOUBLE) var s2 : listOf(choose(1, 1L))) { break; }
+ }
+
+ List<? extends String> extString() { return null; }
+ List<? super String> supString() { return null; }
+ List<?> unbString() { return null; }
+
+ List<? extends String>[] extStringArr() { return null; }
+ List<? super String>[] supStringArr() { return null; }
+ List<?>[] unbStringArr() { return null; }
+
+ Iterable<? extends List<? extends String>> extStringIter() { return null; }
+ Iterable<? extends List<? super String>> supStringIter() { return null; }
+ Iterable<? extends List<?>> unbStringIter() { return null; }
+
+ <Z extends Comparable<Z>> List<? extends Z> extFbound() { return null; }
+ <Z extends Comparable<Z>> List<? super Z> supFbound() { return null; }
+
+ <Z extends Comparable<Z>> List<? extends Z>[] extFboundArr() { return null; }
+ <Z extends Comparable<Z>> List<? super Z>[] supFboundArr() { return null; }
+
+ <Z extends Comparable<Z>> Iterable<? extends List<? extends Z>> extFboundIter() { return null; }
+ <Z extends Comparable<Z>> Iterable<? extends List<? super Z>> supFboundIter() { return null; }
+
+ <Z> List<Z> listOf(Z z) { return null; }
+ <Z> Z[] arrayOf(Z z) { return null; }
+
+ <Z> Z choose(Z z1, Z z2) { return z1; }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lvti/harness/PrimitiveTypeTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,97 @@
+/*
+ * 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. 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 8177466
+ * @summary Add compiler support for local variable type-inference
+ * @modules jdk.compiler/com.sun.source.tree
+ * jdk.compiler/com.sun.source.util
+ * jdk.compiler/com.sun.tools.javac.api
+ * jdk.compiler/com.sun.tools.javac.code
+ * jdk.compiler/com.sun.tools.javac.util
+ * @build LocalVariableInferenceTester
+ * @run main LocalVariableInferenceTester PrimitiveTypeTest.java
+ */
+class PrimitiveTypeTest {
+
+ byte[] b_arr = { 0 };
+ short[] s_arr = { 0 };
+ int[] i_arr = { 0 };
+ long[] l_arr = { 0 };
+ float[] f_arr = { 0 };
+ double[] d_arr = { 0 };
+ char[] c_arr = { 0 };
+ boolean[] z_arr = { false };
+
+ void testPrimitive() {
+ @InferredType("byte")
+ var b = (byte)0;
+ @InferredType("short")
+ var s = (short)0;
+ @InferredType("int")
+ var i = 0;
+ @InferredType("long")
+ var l = 0L;
+ @InferredType("float")
+ var f = 0f;
+ @InferredType("double")
+ var d = 0d;
+ @InferredType("char")
+ var c = 'c';
+ @InferredType("boolean")
+ var z = false;
+ }
+
+ void testPrimitiveArray() {
+ @InferredType("byte[]")
+ var b = b_arr;
+ @InferredType("short[]")
+ var s = s_arr;
+ @InferredType("int[]")
+ var i = i_arr;
+ @InferredType("long[]")
+ var l = l_arr;
+ @InferredType("float[]")
+ var f = f_arr;
+ @InferredType("double[]")
+ var d = d_arr;
+ @InferredType("char[]")
+ var c = c_arr;
+ @InferredType("boolean[]")
+ var z = z_arr;
+ }
+
+ void testForEachPrimitive() {
+ for (@InferredType("byte") var b : b_arr) { break; }
+ for (@InferredType("short") var s : s_arr) { break; }
+ for (@InferredType("int") var i : i_arr) { break; }
+ for (@InferredType("long") var l : l_arr) { break; }
+ for (@InferredType("float") var f : f_arr) { break; }
+ for (@InferredType("double") var d : d_arr) { break; }
+ for (@InferredType("char") var c : c_arr) { break; }
+ for (@InferredType("boolean") var z : z_arr) { break; }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lvti/harness/ReferenceTypeTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. 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 8177466
+ * @summary Add compiler support for local variable type-inference
+ * @modules jdk.compiler/com.sun.source.tree
+ * jdk.compiler/com.sun.source.util
+ * jdk.compiler/com.sun.tools.javac.api
+ * jdk.compiler/com.sun.tools.javac.code
+ * jdk.compiler/com.sun.tools.javac.util
+ * @build LocalVariableInferenceTester
+ * @run main LocalVariableInferenceTester ReferenceTypeTest.java
+ */
+class ReferenceTypeTest {
+
+ static final String STRING = "java.lang.String";
+ static final String FOO = "ReferenceTypeTest.Foo";
+
+ void test() {
+ @InferredType(STRING)
+ var s = "";
+ for (@InferredType(STRING) var s2 = "" ; ; ) { break; }
+ for (@InferredType(STRING) var s2 : stringArray()) { break; }
+ for (@InferredType(STRING) var s2 : stringIterable()) { break; }
+ try (@InferredType(FOO) var s2 = new Foo()) { } finally { }
+ try (@InferredType(FOO) var s2 = new Foo(); @InferredType(FOO) var s3 = new Foo()) { } finally { }
+ }
+
+ String[] stringArray() { return null; }
+ Iterable<String> stringIterable() { return null; }
+
+ static class Foo implements AutoCloseable {
+ @Override
+ public void close() { }
+ }
+}
--- a/test/langtools/tools/javac/parser/extend/TrialParser.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/langtools/tools/javac/parser/extend/TrialParser.java Thu Sep 28 09:13:27 2017 -0700
@@ -224,7 +224,7 @@
//mods.flags |= Flags.STATIC;
List<JCTree> defs
= variableDeclaratorsRest(pos, mods, t, name, false, dc,
- new ListBuffer<JCTree>()).toList();
+ new ListBuffer<JCTree>(), true).toList();
accept(SEMI);
storeEnd(defs.last(), S.prevToken().endPos);
return defs;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/positions/T8184739.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,87 @@
+/*
+ * 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 8184739
+ * @summary Check correct end position of the PackageTree
+ * @modules jdk.compiler
+ */
+
+import com.sun.source.tree.CompilationUnitTree;
+import com.sun.source.util.JavacTask;
+import com.sun.source.util.Trees;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.Collections;
+import java.util.List;
+
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import static javax.tools.JavaFileObject.Kind.SOURCE;
+import javax.tools.ToolProvider;
+
+import com.sun.source.tree.ImportTree;
+import com.sun.source.tree.PackageTree;
+
+public class T8184739 {
+ public static void main(String... args) throws IOException {
+ class MyFileObject extends SimpleJavaFileObject {
+ MyFileObject() {
+ super(URI.create("myfo:///Test.java"), SOURCE);
+ }
+ @Override
+ public String getCharContent(boolean ignoreEncodingErrors) {
+ // 0 1 2 3 4
+ // 0123456789012345678901234567890123456789012345
+ return "package a.b; /*foo*/ import java.lang.Object; /*foo*/ class Test { Test() { } }";
+ }
+ }
+ JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
+ List<JavaFileObject> compilationUnits =
+ Collections.<JavaFileObject>singletonList(new MyFileObject());
+ JavacTask task = (JavacTask)javac.getTask(null, null, null, null, null, compilationUnits);
+ Trees trees = Trees.instance(task);
+ CompilationUnitTree toplevel = task.parse().iterator().next();
+ PackageTree pt = toplevel.getPackage();
+ ImportTree impt = toplevel.getImports().get(0);
+ long pos = trees.getSourcePositions().getStartPosition(toplevel, pt);
+ if (pos != 0)
+ throw new AssertionError(String.format("Start pos for %s is incorrect (%s)!",
+ pt, pos));
+ pos = trees.getSourcePositions().getEndPosition(toplevel, pt);
+ if (pos != 12)
+ throw new AssertionError(String.format("End pos for %s is incorrect (%s)!",
+ pt, pos));
+ pos = trees.getSourcePositions().getStartPosition(toplevel, impt);
+ if (pos != 21)
+ throw new AssertionError(String.format("Start pos for %s is incorrect (%s)!",
+ impt, pos));
+ pos = trees.getSourcePositions().getEndPosition(toplevel, impt);
+ if (pos != 45)
+ throw new AssertionError(String.format("End pos for %s is incorrect (%s)!",
+ impt, pos));
+ }
+}
--- a/test/langtools/tools/javac/processing/model/TestSourceVersion.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/langtools/tools/javac/processing/model/TestSourceVersion.java Thu Sep 28 09:13:27 2017 -0700
@@ -41,6 +41,7 @@
public static void main(String... args) {
testLatestSupported();
testVersionVaryingKeywords();
+ testRestrictedKeywords();
}
private static void testLatestSupported() {
@@ -74,6 +75,27 @@
}
}
+ private static void testRestrictedKeywords() {
+ // Restricted keywords are not full keywords
+
+ /*
+ * JLS 3.9
+ * " A further ten character sequences are restricted
+ * keywords: open, module, requires, transitive, exports,
+ * opens, to, uses, provides, and with"
+ */
+ Set<String> restrictedKeywords =
+ Set.of("open", "module", "requires", "transitive", "exports",
+ "opens", "to", "uses", "provides", "with");
+
+ for(String key : restrictedKeywords) {
+ for(SourceVersion version : SourceVersion.values()) {
+ check(false, isKeyword(key, version), "keyword", version);
+ check(true, isName(key, version), "name", version);
+ }
+ }
+ }
+
private static void check(boolean result, boolean expected,
String message, SourceVersion version) {
if (result != expected) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/tree/NewClassDefEnclosing.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,95 @@
+/*
+ * 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 8044853
+ * @summary Check that enclosing element is not cleared in JCNewClass
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ * jdk.compiler/com.sun.tools.javac.tree
+ */
+
+import com.sun.source.tree.ClassTree;
+import com.sun.source.tree.CompilationUnitTree;
+import com.sun.tools.javac.api.JavacTaskImpl;
+import com.sun.tools.javac.tree.JCTree;
+
+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;
+
+public class NewClassDefEnclosing {
+ private final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
+
+ public static void main(String... args) throws Exception {
+ NewClassDefEnclosing nap = new NewClassDefEnclosing();
+ nap.run("O.I i = new O().new I() {}; class O { class I { } }",
+ "O.I i = new O().new I(){ (.Test.O x0) { x0.super(); } }");
+ nap.run("O.I i = new O().new I(1, \"2\") {}; class O { class I { public I(int i, String s) { } }",
+ "O.I i = new O().new I(1, \"2\"){ (.Test.O x0, int i, java.lang.String s) { x0.super(i, s); } }");
+ }
+
+ void run(String code, String expected) throws IOException {
+ String src = "public class Test {" + code + "}";
+
+ JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, List.of("-doe"),
+ null, Arrays.asList(new MyFileObject(src)));
+
+ Iterable<? extends CompilationUnitTree> units = ct.parse();
+ ct.analyze();
+
+ for (CompilationUnitTree cut : units) {
+ JCTree.JCVariableDecl var =
+ (JCTree.JCVariableDecl) ((ClassTree) cut.getTypeDecls().get(0)).getMembers().get(1);
+
+ expected = expected.replaceAll("\\s+", " ");
+ String actual = var.toString().replaceAll("\\s+", " ");
+
+ if (!expected.equals(actual)) {
+ System.err.println("Expected: " + expected);
+ System.err.println("Obtained: " + actual);
+ throw new RuntimeException("strings do not match!");
+ }
+ }
+ }
+ 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/langtools/tools/jdeps/modules/upgrademodulepath/UpgradeModulePathTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,115 @@
+/*
+ * 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 8187449
+ * @summary Tests jdeps --upgrade-module-path
+ * @library ../../lib
+ * @build CompilerUtils
+ * @modules jdk.jartool
+ * jdk.jdeps/com.sun.tools.jdeps
+ * @run testng UpgradeModulePathTest
+ */
+
+import java.io.BufferedWriter;
+import java.io.PrintWriter;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.spi.ToolProvider;
+import java.util.stream.Stream;
+
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+public class UpgradeModulePathTest {
+ private static final ToolProvider JAR = ToolProvider.findFirst("jar")
+ .orElseThrow(() -> new RuntimeException("jar not found"));
+
+ private static final String TEST_SRC = System.getProperty("test.src");
+
+ private static final Path SRC_DIR = Paths.get(TEST_SRC, "src");
+ private static final Path MODS_DIR = Paths.get("mods");
+
+ private static final String JAVA_COMPILER = "java.compiler";
+
+ /**
+ * Compiles classes used by the test
+ */
+ @BeforeTest
+ public void compileAll() throws Exception {
+ CompilerUtils.cleanDir(MODS_DIR);
+ assertTrue(CompilerUtils.compileModule(SRC_DIR, MODS_DIR, JAVA_COMPILER));
+
+ Path dir = MODS_DIR.resolve(JAVA_COMPILER);
+
+ // create a modular JAR file for java.compiler
+ JAR.run(System.out, System.err,
+ "cf", "java.compiler.jar", "-C", dir.toString(), ".");
+
+ // create a JAR file with AUTOMATIC-MODULE-NAME
+ try (BufferedWriter bw = Files.newBufferedWriter(Paths.get("manifest"));
+ PrintWriter writer = new PrintWriter(bw)) {
+ writer.println("AUTOMATIC-MODULE-NAME: java.compiler");
+ }
+
+ JAR.run(System.out, System.err,
+ "cfm", "auto.jar", "manifest", "-C", dir.toString(), "javax");
+ }
+
+ @Test
+ public void testSystemModule() throws Exception {
+ JdepsRunner jdepsRunner =
+ JdepsRunner.run(Stream.of("-m", "java.compiler").toArray(String[]::new));
+
+ assertTrue(jdepsRunner.outputContains("javax.tools"));
+ assertTrue(jdepsRunner.outputContains("javax.lang.model"));
+ assertTrue(jdepsRunner.outputContains("javax.annotation.processing"));
+ }
+
+ @Test
+ public void testUpgradedModule() throws Exception {
+ JdepsRunner jdepsRunner =
+ JdepsRunner.run(Stream.of("--upgrade-module-path", "java.compiler.jar",
+ "-m", "java.compiler").toArray(String[]::new));
+
+ assertTrue(jdepsRunner.outputContains("javax.tools"));
+ assertFalse(jdepsRunner.outputContains("javax.lang.model"));
+ assertFalse(jdepsRunner.outputContains("javax.annotation.processing"));
+ }
+
+ @Test
+ public void testAutomaticModule() throws Exception {
+ JdepsRunner jdepsRunner =
+ JdepsRunner.run(Stream.of("--upgrade-module-path", "auto.jar",
+ "-m", "java.compiler").toArray(String[]::new));
+
+ assertTrue(jdepsRunner.outputContains("javax.tools"));
+ assertFalse(jdepsRunner.outputContains("javax.lang.model"));
+ assertFalse(jdepsRunner.outputContains("javax.annotation.processing"));
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/jdeps/modules/upgrademodulepath/src/java.compiler/javax/tools/Tool.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javax.tools;
+
+public interface Tool {
+ default String name() {
+ return "upgraded Tool interface";
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/jdeps/modules/upgrademodulepath/src/java.compiler/module-info.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+module java.compiler {
+ exports javax.tools;
+}
--- a/test/langtools/tools/lib/types/TypeHarness.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/langtools/tools/lib/types/TypeHarness.java Thu Sep 28 09:13:27 2017 -0700
@@ -354,7 +354,7 @@
public TypeVar TypeVariable(Type bound) {
TypeSymbol tvsym = new TypeVariableSymbol(0, syntheticName(), null, predef.noSymbol);
- tvsym.type = new TypeVar(tvsym, bound, null);
+ tvsym.type = new TypeVar(tvsym, bound, Type.noType);
return (TypeVar)tvsym.type;
}
--- a/test/lib/jdk/test/lib/util/FileUtils.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/lib/jdk/test/lib/util/FileUtils.java Thu Sep 28 09:13:27 2017 -0700
@@ -98,6 +98,7 @@
while (true) {
try {
Files.delete(path);
+ // Checks for absence of the file. Semantics of Files.exists() is not the same.
while (!Files.notExists(path)) {
times++;
if (times > MAX_RETRY_DELETE_TIMES) {
--- a/test/lib/sun/hotspot/WhiteBox.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/lib/sun/hotspot/WhiteBox.java Thu Sep 28 09:13:27 2017 -0700
@@ -529,4 +529,7 @@
// Compiler Directive
public native int addCompilerDirective(String compDirect);
public native void removeCompilerDirective(int count);
+
+ // Returns true on linux if library has the noexecstack flag set.
+ public native boolean checkLibSpecifiesNoexecstack(String libfilename);
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/nashorn/script/basic/JDK-8186646.js Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,39 @@
+/*
+ * 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-8186646: Nashorn: "duplicate code" assertion when binding a vararg function that just passes arguments along
+ *
+ * @test
+ * @run
+ */
+
+var fn2 = function () {};
+
+var fn = function () {
+ fn2.apply(null, arguments);
+};
+
+fn();
+fn.bind();
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/nashorn/script/basic/JDK-8186815.js Thu Sep 28 09:13:27 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.
+ */
+
+/**
+ * JDK-8186815: Java.from has a bug, when element is ScriptObject
+ *
+ * @test
+ * @run
+ */
+
+var list = new java.util.ArrayList();
+var obj = { x: 1 };
+list.add(obj);
+
+Assert.assertTrue(list.get(0) === obj);
+Assert.assertTrue(list.get(0) instanceof Object);
+
+var fromList = Java.from(list);
+Assert.assertTrue(fromList[0] === obj);
+Assert.assertTrue(fromList[0] instanceof Object);
+
+var fromArray = Java.from(list.toArray());
+Assert.assertTrue(fromArray[0] === obj);
+Assert.assertTrue(fromArray[0] instanceof Object);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/nashorn/script/basic/JDK-8187962.js Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,38 @@
+/*
+ * 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-8187962: Optimistic types ignore JavaAdapter return types
+ *
+ * @test
+ * @run
+ */
+
+function iterator() {
+ return null;
+}
+
+var list = new java.util.List() { iterator: function() { return iterator(); }};
+var result = list.iterator();
+Assert.assertEquals(result, null);
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/nashorn/script/basic/es6/JDK-8185257.js Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,34 @@
+/*
+ * 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-8185257: Nashorn AST is missing nodes when a for-loop contains a VariableDeclarationList
+ *
+ * @test
+ * @run
+ * @fork
+ */
+
+var ASTVisitor = Java.type("jdk.nashorn.test.models.ES6ASTVisitor");
+var testcode = "for (var i = 0; i < 100; i++) {\n print(i);\n}\n";
+ASTVisitor.visit(testcode);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/nashorn/script/basic/es6/JDK-8185257.js.EXPECTED Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,2 @@
+5-14 VARIABLE
+0-44 FOR_LOOP
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/nashorn/script/basic/es6/JDK-8186180.js Thu Sep 28 09:13:27 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.
+ *
+ * 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-8186180: Symbol.__proto__ results in error with format string placeholder
+ *
+ * @test
+ * @run
+ * @option --language=es6
+ */
+
+var sym = Symbol('foo');
+try {
+ print(sym.__proto__);
+} catch (e) {
+ print(e);
+}
+try {
+ print(Symbol.prototype.toString());
+} catch (e) {
+ print(e);
+}
+print(Symbol('foo').toString());
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/nashorn/script/basic/es6/JDK-8186180.js.EXPECTED Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,3 @@
+TypeError: [object Symbol] is not a symbol.
+TypeError: [object Symbol] is not a symbol.
+Symbol(foo)
--- a/test/nashorn/script/currently-failing/JDK-8055034.js Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * JDK-8055034: jjs exits interactive mode if exception was thrown when trying to print value of last evaluated expression
- *
- * @test
- * @option -scripting
- * @run
- */
-
-// assume that this script is run with "nashorn.jar" System
-// property set to relative or absolute path of nashorn.jar
-
-if (typeof fail != 'function') {
- fail = print;
-}
-
-var System = java.lang.System;
-var File = java.io.File;
-var javahome = System.getProperty("java.home");
-var nashornJar = new File(System.getProperty("nashorn.jar"));
-if (! nashornJar.isAbsolute()) {
- nashornJar = new File(".", nashornJar);
-}
-
-// we want to use nashorn.jar passed and not the one that comes with JRE
-var jjsCmd = javahome + "/../bin/jjs";
-jjsCmd = jjsCmd.toString().replace(/\//g, File.separator);
-if (! new File(jjsCmd).isFile()) {
- jjsCmd = javahome + "/bin/jjs";
- jjsCmd = jjsCmd.toString().replace(/\//g, File.separator);
-}
-jjsCmd += " -J--patch-module=jdk.scripting.nashorn=" + nashornJar;
-
-$ENV.PWD=System.getProperty("user.dir") // to avoid RE on Cygwin
-$EXEC(jjsCmd, "var x = Object.create(null);\nx;\nprint('PASSED');\nexit(0)");
-
-// $ERR has all interactions including prompts! Just check for error substring.
-var err = $ERR.trim();
-if (! err.contains("TypeError: Cannot get default string value")) {
- fail("Error stream does not contain expected error message");
-}
-
-// should print "PASSED"
-print($OUT.trim());
-// exit code should be 0
-print("exit code = " + $EXIT);
--- a/test/nashorn/script/currently-failing/JDK-8055034.js.EXPECTED Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-PASSED
-exit code = 0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/nashorn/script/nosecurity/JDK-8055034.js Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,68 @@
+/*
+ * 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-8055034: jjs exits interactive mode if exception was thrown when trying to print value of last evaluated expression
+ *
+ * @test
+ * @option -scripting
+ * @run
+ */
+
+// assume that this script is run with "nashorn.jar" System
+// property set to relative or absolute path of nashorn.jar
+
+if (typeof fail != 'function') {
+ fail = print;
+}
+
+var System = java.lang.System;
+var File = java.io.File;
+var javahome = System.getProperty("java.home");
+var nashornJar = new File(System.getProperty("nashorn.jar"));
+if (! nashornJar.isAbsolute()) {
+ nashornJar = new File(".", nashornJar);
+}
+
+// we want to use nashorn.jar passed and not the one that comes with JRE
+var jjsCmd = javahome + "/../bin/jjs";
+jjsCmd = jjsCmd.toString().replace(/\//g, File.separator);
+if (! new File(jjsCmd).isFile()) {
+ jjsCmd = javahome + "/bin/jjs";
+ jjsCmd = jjsCmd.toString().replace(/\//g, File.separator);
+}
+jjsCmd += " -J--patch-module=jdk.scripting.nashorn=" + nashornJar;
+
+$ENV.PWD=System.getProperty("user.dir") // to avoid RE on Cygwin
+$EXEC(jjsCmd, "var x = Object.create(null);\nx;\nprint('PASSED');\nexit(0)");
+
+// $ERR has all interactions including prompts! Just check for error substring.
+var err = $ERR.trim();
+if (! err.contains("TypeError: Cannot get default string value")) {
+ fail("Error stream does not contain expected error message");
+}
+
+// should print "PASSED"
+print($OUT.trim());
+// exit code should be 0
+print("exit code = " + $EXIT);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/nashorn/script/nosecurity/JDK-8055034.js.EXPECTED Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,6 @@
+jjs> var x = Object.create(null);
+jjs> x;
+jjs> print('PASSED');
+PASSED
+jjs> exit(0)
+exit code = 0
--- a/test/nashorn/src/jdk/nashorn/internal/codegen/test/CompilerTest.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/nashorn/src/jdk/nashorn/internal/codegen/test/CompilerTest.java Thu Sep 28 09:13:27 2017 -0700
@@ -49,7 +49,6 @@
private static final boolean VERBOSE = Boolean.valueOf(System.getProperty("compilertest.verbose"));
private static final boolean TEST262 = Boolean.valueOf(System.getProperty("compilertest.test262"));
private static final String TEST_BASIC_DIR = System.getProperty("test.basic.dir");
- private static final String TEST_NODE_DIR = System.getProperty("test.node.dir");
private static final String TEST262_SUITE_DIR = System.getProperty("test262.suite.dir");
interface TestFilter {
@@ -108,8 +107,6 @@
return file.getName().equals("es6");
}
});
- compileTestSet(new File(TEST_NODE_DIR, "node"), null);
- compileTestSet(new File(TEST_NODE_DIR, "src"), null);
}
private void compileTestSet(final File testSetDir, final TestFilter filter) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/nashorn/src/jdk/nashorn/internal/runtime/test/nashorn/JDK_8187362_Test.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.runtime.test;
+
+import jdk.nashorn.api.scripting.NashornScriptEngine;
+import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
+import javax.script.ScriptException;
+import static org.testng.Assert.assertEquals;
+import org.testng.annotations.Test;
+
+/**
+ * @test
+ * @bug 8187362
+ * @summary Nashorn unsigned right shift operator unexpectedly returns floating-point
+ * @modules jdk.scripting.nashorn/jdk.nashorn.internal.runtime
+ * @run testng jdk.nashorn.internal.runtime.test.JDK_8187362_Test
+ */
+public class JDK_8187362_Test {
+
+ @Test
+ public void testOperator() throws ScriptException {
+ NashornScriptEngine engine = (NashornScriptEngine) new NashornScriptEngineFactory().getScriptEngine();
+ assertEquals(engine.eval("100 >>> 1"), 50);
+ assertEquals(engine.eval("100 >> 1"), 50);
+ }
+}
--- a/test/nashorn/src/jdk/nashorn/test/models/ClassWithFinalFinalizer.java Tue Sep 26 10:46:23 2017 +0530
+++ b/test/nashorn/src/jdk/nashorn/test/models/ClassWithFinalFinalizer.java Thu Sep 28 09:13:27 2017 -0700
@@ -28,6 +28,7 @@
@SuppressWarnings("javadoc")
public class ClassWithFinalFinalizer {
@Override
+ @SuppressWarnings("deprecation")
protected final void finalize() {
//empty
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/nashorn/src/jdk/nashorn/test/nashorn/models/ES6ASTVisitor.java Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.test.models;
+
+import jdk.nashorn.api.tree.SimpleTreeVisitorES6;
+import jdk.nashorn.api.tree.*;
+
+public class ES6ASTVisitor{
+
+ public static void visit(String script) {
+ DiagnosticListener listener = (Diagnostic diag) -> { System.err.println(diag.toString()); };
+ Parser parser = Parser.create("--language=es6","--empty-statements");
+ Tree astRoot = parser.parse("unknown", script, listener);
+ astRoot.accept(new SimpleTreeVisitorES6<Boolean, Void>() {
+ @Override
+ public Boolean visitCompilationUnit(CompilationUnitTree stmt, Void none) {
+ for (Tree item : stmt.getSourceElements()) {
+ System.out.println(item.getStartPosition() + "-" + item.getEndPosition() + " " + item.getKind());
+ }
+ return super.visitCompilationUnit(stmt, none);
+ }
+
+ }, null);
+
+ }
+
+}
+