This commit is contained in:
Phil Race 2018-04-12 16:25:29 -07:00
commit e5f945b7cd
81 changed files with 2825 additions and 1881 deletions

View File

@ -479,3 +479,4 @@ d5c43e9f08fb9a7c74aae0d48daf17f2ad2afaef jdk-11+5
3acb379b86725c47e7f33358cb22efa8752ae532 jdk-11+6 3acb379b86725c47e7f33358cb22efa8752ae532 jdk-11+6
f7363de371c9a1f668bd0a01b7df3d1ddb9cc58b jdk-11+7 f7363de371c9a1f668bd0a01b7df3d1ddb9cc58b jdk-11+7
755e1b55a4dff510f9639cdb5c5e82549a7e09b3 jdk-11+8 755e1b55a4dff510f9639cdb5c5e82549a7e09b3 jdk-11+8
0c3e252cea44f06aef570ef464950ab97c669970 jdk-11+9

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -226,6 +226,15 @@ else # HAS_SPEC=true
# Parse COMPARE_BUILD (for makefile development) # Parse COMPARE_BUILD (for makefile development)
$(eval $(call ParseCompareBuild)) $(eval $(call ParseCompareBuild))
# If no LOG= was given on command line, but we have a non-standard default
# value, use that instead and re-parse log level.
ifeq ($(LOG), )
ifneq ($(DEFAULT_LOG), )
override LOG := $(DEFAULT_LOG)
$(eval $(call ParseLogLevel))
endif
endif
ifeq ($(LOG_NOFILE), true) ifeq ($(LOG_NOFILE), true)
# Disable build log if LOG=[level,]nofile was given # Disable build log if LOG=[level,]nofile was given
override BUILD_LOG_PIPE := override BUILD_LOG_PIPE :=

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -131,73 +131,6 @@ ifeq ($(HAS_SPEC),)
endif endif
endef endef
# Look for a given option in the LOG variable, and if found, set a variable
# and remove the option from the LOG variable
# $1: The option to look for
# $2: The option to set to "true" if the option is found
define ParseLogOption
ifneq ($$(findstring $1, $$(LOG)),)
$2 := true
# COMMA is defined in spec.gmk, but that is not included yet
COMMA := ,
# First try to remove ",<option>" if it exists, otherwise just remove "<option>"
LOG_STRIPPED := $$(subst $1,, $$(subst $$(COMMA)$(strip $1),, $$(LOG)))
# We might have ended up with a leading comma. Remove it. Need override
# since LOG is set from the command line.
override LOG := $$(strip $$(patsubst $$(COMMA)%, %, $$(LOG_STRIPPED)))
endif
endef
define ParseLogLevel
# Catch old-style VERBOSE= command lines.
ifneq ($$(origin VERBOSE), undefined)
$$(info Error: VERBOSE is deprecated. Use LOG=<warn|info|debug|trace> instead.)
$$(error Cannot continue)
endif
# Setup logging according to LOG
# If the "nofile" argument is given, act on it and strip it away
$$(eval $$(call ParseLogOption, nofile, LOG_NOFILE))
# If the "cmdline" argument is given, act on it and strip it away
$$(eval $$(call ParseLogOption, cmdlines, LOG_CMDLINES))
# If the "profile-to-log" argument is given, write shell times in build log
$$(eval $$(call ParseLogOption, profile-to-log, LOG_PROFILE_TIMES_LOG))
# If the "profile" argument is given, write shell times in separate log file
# IMPORTANT: $(ParseLogOption profile-to-log) should go first. Otherwise
# parsing of 'LOG=debug,profile-to-log,nofile' ends up in the following error:
# Error: LOG contains unknown option or log level: debug-to-log.
$$(eval $$(call ParseLogOption, profile, LOG_PROFILE_TIMES_FILE))
# Treat LOG=profile-to-log as if it were LOG=profile,profile-to-log
LOG_PROFILE_TIMES_FILE := $$(firstword $$(LOG_PROFILE_TIMES_FILE) $$(LOG_PROFILE_TIMES_LOG))
LOG_LEVEL := $$(LOG)
ifeq ($$(LOG_LEVEL),)
# Set LOG to "warn" as default if not set
LOG_LEVEL := warn
endif
ifeq ($$(LOG_LEVEL), warn)
MAKE_LOG_FLAGS := -s
else ifeq ($$(LOG_LEVEL), info)
MAKE_LOG_FLAGS := -s
else ifeq ($$(LOG_LEVEL), debug)
MAKE_LOG_FLAGS :=
else ifeq ($$(LOG_LEVEL), trace)
MAKE_LOG_FLAGS :=
else
$$(info Error: LOG contains unknown option or log level: $$(LOG).)
$$(info LOG can be <level>[,<opt>[...]] where <opt> is nofile | cmdlines | profile | profile-to-log)
$$(info and <level> is warn | info | debug | trace)
$$(error Cannot continue)
endif
endef
define ParseConfAndSpec define ParseConfAndSpec
ifneq ($$(origin SPEC), undefined) ifneq ($$(origin SPEC), undefined)
# We have been given a SPEC, check that it works out properly # We have been given a SPEC, check that it works out properly
@ -477,30 +410,38 @@ else # $(HAS_SPEC)=true
endef endef
define PrintFailureReports define PrintFailureReports
$(if $(wildcard $(MAKESUPPORT_OUTPUTDIR)/failure-logs/*.log), \ $(if $(filter none, $(LOG_REPORT)), , \
$(PRINTF) "\n=== Output from failing command(s) repeated here ===\n" $(NEWLINE) \ $(if $(wildcard $(MAKESUPPORT_OUTPUTDIR)/failure-logs/*.log), \
$(foreach logfile, $(sort $(wildcard $(MAKESUPPORT_OUTPUTDIR)/failure-logs/*.log)), \ $(PRINTF) "\n=== Output from failing command(s) repeated here ===\n" $(NEWLINE) \
$(PRINTF) "* For target $(notdir $(basename $(logfile))):\n" $(NEWLINE) \ $(foreach logfile, $(sort $(wildcard $(MAKESUPPORT_OUTPUTDIR)/failure-logs/*.log)), \
($(GREP) -v -e "^Note: including file:" < $(logfile) || true) | $(HEAD) -n 12 $(NEWLINE) \ $(PRINTF) "* For target $(notdir $(basename $(logfile))):\n" $(NEWLINE) \
if test `$(WC) -l < $(logfile)` -gt 12; then \ $(if $(filter all, $(LOG_REPORT)), \
$(ECHO) " ... (rest of output omitted)" ; \ $(GREP) -v -e "^Note: including file:" < $(logfile) || true $(NEWLINE) \
fi $(NEWLINE) \ , \
($(GREP) -v -e "^Note: including file:" < $(logfile) || true) | $(HEAD) -n 12 $(NEWLINE) \
if test `$(WC) -l < $(logfile)` -gt 12; then \
$(ECHO) " ... (rest of output omitted)" ; \
fi $(NEWLINE) \
) \
) \
$(PRINTF) "\n* All command lines available in $(MAKESUPPORT_OUTPUTDIR)/failure-logs.\n" $(NEWLINE) \
$(PRINTF) "=== End of repeated output ===\n" \
) \ ) \
$(PRINTF) "\n* All command lines available in $(MAKESUPPORT_OUTPUTDIR)/failure-logs.\n" $(NEWLINE) \
$(PRINTF) "=== End of repeated output ===\n" \
) )
endef endef
define PrintBuildLogFailures define PrintBuildLogFailures
if $(GREP) -q "recipe for target .* failed" $(BUILD_LOG) 2> /dev/null; then \ $(if $(filter none, $(LOG_REPORT)), , \
$(PRINTF) "\n=== Make failed targets repeated here ===\n" ; \ if $(GREP) -q "recipe for target .* failed" $(BUILD_LOG) 2> /dev/null; then \
$(GREP) "recipe for target .* failed" $(BUILD_LOG) ; \ $(PRINTF) "\n=== Make failed targets repeated here ===\n" ; \
$(PRINTF) "=== End of repeated output ===\n" ; \ $(GREP) "recipe for target .* failed" $(BUILD_LOG) ; \
$(PRINTF) "\nHint: Try searching the build log for the name of the first failed target.\n" ; \ $(PRINTF) "=== End of repeated output ===\n" ; \
else \ $(PRINTF) "\nHint: Try searching the build log for the name of the first failed target.\n" ; \
$(PRINTF) "\nNo indication of failed target found.\n" ; \ else \
$(PRINTF) "Hint: Try searching the build log for '] Error'.\n" ; \ $(PRINTF) "\nNo indication of failed target found.\n" ; \
fi $(PRINTF) "Hint: Try searching the build log for '] Error'.\n" ; \
fi \
)
endef endef
define RotateLogFiles define RotateLogFiles
@ -583,8 +524,107 @@ else # $(HAS_SPEC)=true
endif # HAS_SPEC endif # HAS_SPEC
# Look for a given option in the LOG variable, and if found, set a variable
# and remove the option from the LOG variable
# $1: The option to look for
# $2: The variable to set to "true" if the option is found
define ParseLogOption
ifneq ($$(findstring $1, $$(LOG)),)
override $2 := true
# COMMA is defined in spec.gmk, but that is not included yet
COMMA := ,
# First try to remove ",<option>" if it exists, otherwise just remove "<option>"
LOG_STRIPPED := $$(subst $1,, $$(subst $$(COMMA)$$(strip $1),, $$(LOG)))
# We might have ended up with a leading comma. Remove it. Need override
# since LOG is set from the command line.
override LOG := $$(strip $$(patsubst $$(COMMA)%, %, $$(LOG_STRIPPED)))
endif
endef
# Look for a given option with an assignment in the LOG variable, and if found,
# set a variable to that value and remove the option from the LOG variable
# $1: The option to look for
# $2: The variable to set to the value of the option, if found
define ParseLogValue
ifneq ($$(findstring $1=, $$(LOG)),)
# Make words of out comma-separated list and find the one with opt=val
value := $$(strip $$(subst $$(strip $1)=,, $$(filter $$(strip $1)=%, $$(subst $$(COMMA), , $$(LOG)))))
override $2 := $$(value)
# COMMA is defined in spec.gmk, but that is not included yet
COMMA := ,
# First try to remove ",<option>" if it exists, otherwise just remove "<option>"
LOG_STRIPPED := $$(subst $$(strip $1)=$$(value),, \
$$(subst $$(COMMA)$$(strip $1)=$$(value),, $$(LOG)))
# We might have ended up with a leading comma. Remove it. Need override
# since LOG is set from the command line.
override LOG := $$(strip $$(patsubst $$(COMMA)%, %, $$(LOG_STRIPPED)))
endif
endef
define ParseLogLevel
# Catch old-style VERBOSE= command lines.
ifneq ($$(origin VERBOSE), undefined)
$$(info Error: VERBOSE is deprecated. Use LOG=<warn|info|debug|trace> instead.)
$$(error Cannot continue)
endif
# Setup logging according to LOG
# If "nofile" is present, do not log to a file
$$(eval $$(call ParseLogOption, nofile, LOG_NOFILE))
# If "cmdline" is present, print all executes "important" command lines.
$$(eval $$(call ParseLogOption, cmdlines, LOG_CMDLINES))
# If "report" is present, use non-standard reporting options at build failure.
$$(eval $$(call ParseLogValue, report, LOG_REPORT))
ifneq ($$(LOG_REPORT), )
ifeq ($$(filter $$(LOG_REPORT), none all default), )
$$(info Error: LOG=report has invalid value: $$(LOG_REPORT).)
$$(info Valid values: LOG=report=<none>|<all>|<default>)
$$(error Cannot continue)
endif
endif
# If "profile-to-log" is present, write shell times in build log
$$(eval $$(call ParseLogOption, profile-to-log, LOG_PROFILE_TIMES_LOG))
# If "profile" is present, write shell times in separate log file
# IMPORTANT: $(ParseLogOption profile-to-log) should go first. Otherwise
# parsing of 'LOG=debug,profile-to-log,nofile' ends up in the following error:
# Error: LOG contains unknown option or log level: debug-to-log.
$$(eval $$(call ParseLogOption, profile, LOG_PROFILE_TIMES_FILE))
# Treat LOG=profile-to-log as if it were LOG=profile,profile-to-log
LOG_PROFILE_TIMES_FILE := $$(firstword $$(LOG_PROFILE_TIMES_FILE) $$(LOG_PROFILE_TIMES_LOG))
override LOG_LEVEL := $$(LOG)
ifeq ($$(LOG_LEVEL),)
# Set LOG to "warn" as default if not set
override LOG_LEVEL := warn
endif
ifeq ($$(LOG_LEVEL), warn)
override MAKE_LOG_FLAGS := -s
else ifeq ($$(LOG_LEVEL), info)
override MAKE_LOG_FLAGS := -s
else ifeq ($$(LOG_LEVEL), debug)
override MAKE_LOG_FLAGS :=
else ifeq ($$(LOG_LEVEL), trace)
override MAKE_LOG_FLAGS :=
else
$$(info Error: LOG contains unknown option or log level: $$(LOG).)
$$(info LOG can be <level>[,<opt>[...]] where <opt> is nofile | cmdlines | profile | profile-to-log)
$$(info and <level> is warn | info | debug | trace)
$$(error Cannot continue)
endif
endef
MAKE_LOG_VARS = $(foreach v, \ MAKE_LOG_VARS = $(foreach v, \
LOG_LEVEL LOG_NOFILE LOG_CMDLINES LOG_PROFILE_TIMES_LOG LOG_PROFILE_TIMES_FILE, \ LOG_LEVEL LOG_NOFILE LOG_CMDLINES LOG_REPORT LOG_PROFILE_TIMES_LOG \
LOG_PROFILE_TIMES_FILE, \
$v=$($v) \ $v=$($v) \
) )

View File

@ -23,6 +23,7 @@
# questions. # questions.
# #
###############################################################################
# Create a function/macro that takes a series of named arguments. The call is # Create a function/macro that takes a series of named arguments. The call is
# similar to AC_DEFUN, but the setup of the function looks like this: # similar to AC_DEFUN, but the setup of the function looks like this:
# BASIC_DEFUN_NAMED([MYFUNC], [FOO *BAR], [$@], [ # BASIC_DEFUN_NAMED([MYFUNC], [FOO *BAR], [$@], [
@ -91,6 +92,48 @@ AC_DEFUN([BASIC_DEFUN_NAMED],
]) ])
]) ])
###############################################################################
# Check if a list of space-separated words are selected only from a list of
# space-separated legal words. Typical use is to see if a user-specified
# set of words is selected from a set of legal words.
#
# Sets the specified variable to list of non-matching (offending) words, or to
# the empty string if all words are matching the legal set.
#
# $1: result variable name
# $2: list of values to check
# $3: list of legal values
AC_DEFUN([BASIC_GET_NON_MATCHING_VALUES],
[
# grep filter function inspired by a comment to http://stackoverflow.com/a/1617326
# Notice that the original variant fails on SLES 10 and 11
# Some grep versions (at least bsd) behaves strangely on the base case with
# no legal_values, so make it explicit.
values_to_check=`$ECHO $2 | $TR ' ' '\n'`
legal_values=`$ECHO $3 | $TR ' ' '\n'`
if test -z "$legal_values"; then
$1="$2"
else
result=`$GREP -Fvx "$legal_values" <<< "$values_to_check" | $GREP -v '^$'`
$1=${result//$'\n'/ }
fi
])
###############################################################################
# Sort a space-separated list, and remove duplicates.
#
# Sets the specified variable to the resulting list.
#
# $1: result variable name
# $2: list of values to sort
AC_DEFUN([BASIC_SORT_LIST],
[
values_to_sort=`$ECHO $2 | $TR ' ' '\n'`
result=`$SORT -u <<< "$values_to_sort" | $GREP -v '^$'`
$1=${result//$'\n'/ }
])
###############################################################################
# Test if $1 is a valid argument to $3 (often is $JAVA passed as $3) # Test if $1 is a valid argument to $3 (often is $JAVA passed as $3)
# If so, then append $1 to $2 \ # If so, then append $1 to $2 \
# Also set JVM_ARG_OK to true/false depending on outcome. # Also set JVM_ARG_OK to true/false depending on outcome.
@ -135,6 +178,7 @@ AC_DEFUN([BASIC_PREPEND_TO_PATH],
fi fi
]) ])
###############################################################################
# This will make sure the given variable points to a full and proper # This will make sure the given variable points to a full and proper
# path. This means: # path. This means:
# 1) There will be no spaces in the path. On unix platforms, # 1) There will be no spaces in the path. On unix platforms,
@ -178,6 +222,7 @@ AC_DEFUN([BASIC_FIXUP_PATH],
fi fi
]) ])
###############################################################################
# This will make sure the given variable points to a executable # This will make sure the given variable points to a executable
# with a full and proper path. This means: # with a full and proper path. This means:
# 1) There will be no spaces in the path. On unix platforms, # 1) There will be no spaces in the path. On unix platforms,
@ -249,6 +294,7 @@ AC_DEFUN([BASIC_FIXUP_EXECUTABLE],
fi fi
]) ])
###############################################################################
AC_DEFUN([BASIC_REMOVE_SYMBOLIC_LINKS], AC_DEFUN([BASIC_REMOVE_SYMBOLIC_LINKS],
[ [
if test "x$OPENJDK_BUILD_OS" != xwindows; then if test "x$OPENJDK_BUILD_OS" != xwindows; then
@ -295,6 +341,7 @@ AC_DEFUN([BASIC_REMOVE_SYMBOLIC_LINKS],
fi fi
]) ])
###############################################################################
# Register a --with argument but mark it as deprecated # Register a --with argument but mark it as deprecated
# $1: The name of the with argument to deprecate, not including --with- # $1: The name of the with argument to deprecate, not including --with-
AC_DEFUN([BASIC_DEPRECATED_ARG_WITH], AC_DEFUN([BASIC_DEPRECATED_ARG_WITH],
@ -304,6 +351,7 @@ AC_DEFUN([BASIC_DEPRECATED_ARG_WITH],
[AC_MSG_WARN([Option --with-$1 is deprecated and will be ignored.])]) [AC_MSG_WARN([Option --with-$1 is deprecated and will be ignored.])])
]) ])
###############################################################################
# Register a --enable argument but mark it as deprecated # Register a --enable argument but mark it as deprecated
# $1: The name of the with argument to deprecate, not including --enable- # $1: The name of the with argument to deprecate, not including --enable-
# $2: The name of the argument to deprecate, in shell variable style (i.e. with _ instead of -) # $2: The name of the argument to deprecate, in shell variable style (i.e. with _ instead of -)
@ -322,6 +370,7 @@ AC_DEFUN([BASIC_DEPRECATED_ARG_ENABLE],
fi fi
]) ])
###############################################################################
AC_DEFUN_ONCE([BASIC_INIT], AC_DEFUN_ONCE([BASIC_INIT],
[ [
# Save the original command line. This is passed to us by the wrapper configure script. # Save the original command line. This is passed to us by the wrapper configure script.
@ -334,6 +383,7 @@ AC_DEFUN_ONCE([BASIC_INIT],
AC_MSG_NOTICE([Configuration created at $DATE_WHEN_CONFIGURED.]) AC_MSG_NOTICE([Configuration created at $DATE_WHEN_CONFIGURED.])
]) ])
###############################################################################
# Test that variable $1 denoting a program is not empty. If empty, exit with an error. # Test that variable $1 denoting a program is not empty. If empty, exit with an error.
# $1: variable to check # $1: variable to check
AC_DEFUN([BASIC_CHECK_NONEMPTY], AC_DEFUN([BASIC_CHECK_NONEMPTY],
@ -343,6 +393,7 @@ AC_DEFUN([BASIC_CHECK_NONEMPTY],
fi fi
]) ])
###############################################################################
# Check that there are no unprocessed overridden variables left. # Check that there are no unprocessed overridden variables left.
# If so, they are an incorrect argument and we will exit with an error. # If so, they are an incorrect argument and we will exit with an error.
AC_DEFUN([BASIC_CHECK_LEFTOVER_OVERRIDDEN], AC_DEFUN([BASIC_CHECK_LEFTOVER_OVERRIDDEN],
@ -354,6 +405,7 @@ AC_DEFUN([BASIC_CHECK_LEFTOVER_OVERRIDDEN],
fi fi
]) ])
###############################################################################
# Setup a tool for the given variable. If correctly specified by the user, # Setup a tool for the given variable. If correctly specified by the user,
# use that value, otherwise search for the tool using the supplied code snippet. # use that value, otherwise search for the tool using the supplied code snippet.
# $1: variable to set # $1: variable to set
@ -420,6 +472,7 @@ AC_DEFUN([BASIC_SETUP_TOOL],
fi fi
]) ])
###############################################################################
# Call BASIC_SETUP_TOOL with AC_PATH_PROGS to locate the tool # Call BASIC_SETUP_TOOL with AC_PATH_PROGS to locate the tool
# $1: variable to set # $1: variable to set
# $2: executable name (or list of names) to look for # $2: executable name (or list of names) to look for
@ -429,6 +482,7 @@ AC_DEFUN([BASIC_PATH_PROGS],
BASIC_SETUP_TOOL($1, [AC_PATH_PROGS($1, $2, , $3)]) BASIC_SETUP_TOOL($1, [AC_PATH_PROGS($1, $2, , $3)])
]) ])
###############################################################################
# Call BASIC_SETUP_TOOL with AC_CHECK_TOOLS to locate the tool # Call BASIC_SETUP_TOOL with AC_CHECK_TOOLS to locate the tool
# $1: variable to set # $1: variable to set
# $2: executable name (or list of names) to look for # $2: executable name (or list of names) to look for
@ -437,6 +491,7 @@ AC_DEFUN([BASIC_CHECK_TOOLS],
BASIC_SETUP_TOOL($1, [AC_CHECK_TOOLS($1, $2)]) BASIC_SETUP_TOOL($1, [AC_CHECK_TOOLS($1, $2)])
]) ])
###############################################################################
# Like BASIC_PATH_PROGS but fails if no tool was found. # Like BASIC_PATH_PROGS but fails if no tool was found.
# $1: variable to set # $1: variable to set
# $2: executable name (or list of names) to look for # $2: executable name (or list of names) to look for
@ -447,6 +502,7 @@ AC_DEFUN([BASIC_REQUIRE_PROGS],
BASIC_CHECK_NONEMPTY($1) BASIC_CHECK_NONEMPTY($1)
]) ])
###############################################################################
# Like BASIC_SETUP_TOOL but fails if no tool was found. # Like BASIC_SETUP_TOOL but fails if no tool was found.
# $1: variable to set # $1: variable to set
# $2: autoconf macro to call to look for the special tool # $2: autoconf macro to call to look for the special tool
@ -456,6 +512,7 @@ AC_DEFUN([BASIC_REQUIRE_SPECIAL],
BASIC_CHECK_NONEMPTY($1) BASIC_CHECK_NONEMPTY($1)
]) ])
###############################################################################
# Setup the most fundamental tools that relies on not much else to set up, # Setup the most fundamental tools that relies on not much else to set up,
# but is used by much of the early bootstrap code. # but is used by much of the early bootstrap code.
AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS], AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS],
@ -528,6 +585,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS],
BASIC_PATH_PROGS(PANDOC, pandoc) BASIC_PATH_PROGS(PANDOC, pandoc)
]) ])
###############################################################################
# Setup basic configuration paths, and platform-specific stuff related to PATHs. # Setup basic configuration paths, and platform-specific stuff related to PATHs.
AC_DEFUN_ONCE([BASIC_SETUP_PATHS], AC_DEFUN_ONCE([BASIC_SETUP_PATHS],
[ [
@ -569,6 +627,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_PATHS],
AC_SUBST(USERNAME) AC_SUBST(USERNAME)
]) ])
###############################################################################
# Evaluates platform specific overrides for devkit variables. # Evaluates platform specific overrides for devkit variables.
# $1: Name of variable # $1: Name of variable
AC_DEFUN([BASIC_EVAL_DEVKIT_VARIABLE], AC_DEFUN([BASIC_EVAL_DEVKIT_VARIABLE],
@ -578,6 +637,7 @@ AC_DEFUN([BASIC_EVAL_DEVKIT_VARIABLE],
fi fi
]) ])
###############################################################################
AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT], AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT],
[ [
AC_ARG_WITH([devkit], [AS_HELP_STRING([--with-devkit], AC_ARG_WITH([devkit], [AS_HELP_STRING([--with-devkit],
@ -756,6 +816,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT],
AC_MSG_RESULT([$EXTRA_PATH]) AC_MSG_RESULT([$EXTRA_PATH])
]) ])
###############################################################################
AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR], AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR],
[ [
@ -855,6 +916,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR],
#%%% Simple tools %%% #%%% Simple tools %%%
###############################################################################
# Check if we have found a usable version of make # Check if we have found a usable version of make
# $1: the path to a potential make binary (or empty) # $1: the path to a potential make binary (or empty)
# $2: the description on how we found this # $2: the description on how we found this
@ -908,6 +970,7 @@ AC_DEFUN([BASIC_CHECK_MAKE_VERSION],
fi fi
]) ])
###############################################################################
AC_DEFUN([BASIC_CHECK_MAKE_OUTPUT_SYNC], AC_DEFUN([BASIC_CHECK_MAKE_OUTPUT_SYNC],
[ [
# Check if make supports the output sync option and if so, setup using it. # Check if make supports the output sync option and if so, setup using it.
@ -934,6 +997,7 @@ AC_DEFUN([BASIC_CHECK_MAKE_OUTPUT_SYNC],
AC_SUBST(OUTPUT_SYNC) AC_SUBST(OUTPUT_SYNC)
]) ])
###############################################################################
# Goes looking for a usable version of GNU make. # Goes looking for a usable version of GNU make.
AC_DEFUN([BASIC_CHECK_GNU_MAKE], AC_DEFUN([BASIC_CHECK_GNU_MAKE],
[ [
@ -981,6 +1045,7 @@ AC_DEFUN([BASIC_CHECK_GNU_MAKE],
BASIC_CHECK_MAKE_OUTPUT_SYNC BASIC_CHECK_MAKE_OUTPUT_SYNC
]) ])
###############################################################################
AC_DEFUN([BASIC_CHECK_FIND_DELETE], AC_DEFUN([BASIC_CHECK_FIND_DELETE],
[ [
# Test if find supports -delete # Test if find supports -delete
@ -1009,6 +1074,7 @@ AC_DEFUN([BASIC_CHECK_FIND_DELETE],
AC_SUBST(FIND_DELETE) AC_SUBST(FIND_DELETE)
]) ])
###############################################################################
AC_DEFUN([BASIC_CHECK_TAR], AC_DEFUN([BASIC_CHECK_TAR],
[ [
# Test which kind of tar was found # Test which kind of tar was found
@ -1043,6 +1109,7 @@ AC_DEFUN([BASIC_CHECK_TAR],
AC_SUBST(TAR_SUPPORTS_TRANSFORM) AC_SUBST(TAR_SUPPORTS_TRANSFORM)
]) ])
###############################################################################
AC_DEFUN([BASIC_CHECK_GREP], AC_DEFUN([BASIC_CHECK_GREP],
[ [
# Test that grep supports -Fx with a list of pattern which includes null pattern. # Test that grep supports -Fx with a list of pattern which includes null pattern.
@ -1066,6 +1133,7 @@ AC_DEFUN([BASIC_CHECK_GREP],
fi fi
]) ])
###############################################################################
AC_DEFUN_ONCE([BASIC_SETUP_COMPLEX_TOOLS], AC_DEFUN_ONCE([BASIC_SETUP_COMPLEX_TOOLS],
[ [
BASIC_CHECK_GNU_MAKE BASIC_CHECK_GNU_MAKE
@ -1132,6 +1200,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_COMPLEX_TOOLS],
fi fi
]) ])
###############################################################################
# Check if build directory is on local disk. If not possible to determine, # Check if build directory is on local disk. If not possible to determine,
# we prefer to claim it's local. # we prefer to claim it's local.
# Argument 1: directory to test # Argument 1: directory to test
@ -1171,6 +1240,7 @@ AC_DEFUN([BASIC_CHECK_DIR_ON_LOCAL_DISK],
fi fi
]) ])
###############################################################################
# Check that source files have basic read permissions set. This might # Check that source files have basic read permissions set. This might
# not be the case in cygwin in certain conditions. # not be the case in cygwin in certain conditions.
AC_DEFUN_ONCE([BASIC_CHECK_SRC_PERMS], AC_DEFUN_ONCE([BASIC_CHECK_SRC_PERMS],
@ -1183,6 +1253,7 @@ AC_DEFUN_ONCE([BASIC_CHECK_SRC_PERMS],
fi fi
]) ])
###############################################################################
AC_DEFUN_ONCE([BASIC_TEST_USABILITY_ISSUES], AC_DEFUN_ONCE([BASIC_TEST_USABILITY_ISSUES],
[ [
AC_MSG_CHECKING([if build directory is on local disk]) AC_MSG_CHECKING([if build directory is on local disk])
@ -1205,6 +1276,7 @@ AC_DEFUN_ONCE([BASIC_TEST_USABILITY_ISSUES],
fi fi
]) ])
###############################################################################
# Check for support for specific options in bash # Check for support for specific options in bash
AC_DEFUN_ONCE([BASIC_CHECK_BASH_OPTIONS], AC_DEFUN_ONCE([BASIC_CHECK_BASH_OPTIONS],
[ [
@ -1260,6 +1332,26 @@ AC_DEFUN_ONCE([BASIC_SETUP_DEFAULT_MAKE_TARGET],
AC_SUBST(DEFAULT_MAKE_TARGET) AC_SUBST(DEFAULT_MAKE_TARGET)
]) ])
###############################################################################
# Setup the default value for LOG=
#
AC_DEFUN_ONCE([BASIC_SETUP_DEFAULT_LOG],
[
AC_ARG_WITH(log, [AS_HELP_STRING([--with-log],
[[default vaue for make LOG argument [warn]]])])
AC_MSG_CHECKING([for default LOG value])
if test "x$with_log" = x; then
DEFAULT_LOG=""
else
# Syntax for valid LOG options is a bit too complex for it to be worth
# implementing a test for correctness in configure. Just accept it.
DEFAULT_LOG=$with_log
fi
AC_MSG_RESULT([$DEFAULT_LOG])
AC_SUBST(DEFAULT_LOG)
])
###############################################################################
# Code to run after AC_OUTPUT # Code to run after AC_OUTPUT
AC_DEFUN_ONCE([BASIC_POST_CONFIG_OUTPUT], AC_DEFUN_ONCE([BASIC_POST_CONFIG_OUTPUT],
[ [

View File

@ -120,6 +120,7 @@ PLATFORM_SETUP_OPENJDK_BUILD_OS_VERSION
# Misc basic settings # Misc basic settings
BASIC_SETUP_DEFAULT_MAKE_TARGET BASIC_SETUP_DEFAULT_MAKE_TARGET
BASIC_SETUP_DEFAULT_LOG
############################################################################### ###############################################################################
# #
@ -272,7 +273,7 @@ BASIC_TEST_USABILITY_ISSUES
CUSTOM_LATE_HOOK CUSTOM_LATE_HOOK
# This needs to be done after CUSTOM_LATE_HOOK since we can setup custom features. # This needs to be done after CUSTOM_LATE_HOOK since we can setup custom features.
HOTSPOT_VALIDATE_JVM_FEATURES HOTSPOT_FINALIZE_JVM_FEATURES
# Did user specify any unknown variables? # Did user specify any unknown variables?
BASIC_CHECK_LEFTOVER_OVERRIDDEN BASIC_CHECK_LEFTOVER_OVERRIDDEN

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -213,8 +213,16 @@ AC_DEFUN_ONCE([HELP_PRINT_SUMMARY_AND_WARNINGS],
printf "Configuration summary:\n" printf "Configuration summary:\n"
printf "* Debug level: $DEBUG_LEVEL\n" printf "* Debug level: $DEBUG_LEVEL\n"
printf "* HS debug level: $HOTSPOT_DEBUG_LEVEL\n" printf "* HS debug level: $HOTSPOT_DEBUG_LEVEL\n"
printf "* JDK variant: $JDK_VARIANT\n"
printf "* JVM variants: $JVM_VARIANTS\n" printf "* JVM variants: $JVM_VARIANTS\n"
printf "* JVM features: "
for variant in $JVM_VARIANTS; do
features_var_name=JVM_FEATURES_$variant
JVM_FEATURES_FOR_VARIANT=${!features_var_name}
printf "$variant: \'$JVM_FEATURES_FOR_VARIANT\' "
done
printf "\n"
printf "* OpenJDK target: OS: $OPENJDK_TARGET_OS, CPU architecture: $OPENJDK_TARGET_CPU_ARCH, address length: $OPENJDK_TARGET_CPU_BITS\n" printf "* OpenJDK target: OS: $OPENJDK_TARGET_OS, CPU architecture: $OPENJDK_TARGET_CPU_ARCH, address length: $OPENJDK_TARGET_CPU_BITS\n"
printf "* Version string: $VERSION_STRING ($VERSION_SHORT)\n" printf "* Version string: $VERSION_STRING ($VERSION_SHORT)\n"

View File

@ -93,22 +93,16 @@ AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_VARIANTS],
AC_MSG_RESULT([$JVM_VARIANTS]) AC_MSG_RESULT([$JVM_VARIANTS])
# Check that the selected variants are valid # Check that the selected variants are valid
BASIC_GET_NON_MATCHING_VALUES(INVALID_VARIANTS, $JVM_VARIANTS, $VALID_JVM_VARIANTS)
# grep filter function inspired by a comment to http://stackoverflow.com/a/1617326
# Notice that the original variant failes on SLES 10 and 11
NEEDLE=${VALID_JVM_VARIANTS// /$'\n'}
STACK=${JVM_VARIANTS// /$'\n'}
INVALID_VARIANTS=`$GREP -Fvx "${NEEDLE}" <<< "${STACK}"`
if test "x$INVALID_VARIANTS" != x; then if test "x$INVALID_VARIANTS" != x; then
AC_MSG_NOTICE([Unknown variant(s) specified: $INVALID_VARIANTS]) AC_MSG_NOTICE([Unknown variant(s) specified: "$INVALID_VARIANTS"])
AC_MSG_ERROR([The available JVM variants are: $VALID_JVM_VARIANTS]) AC_MSG_NOTICE([The available JVM variants are: "$VALID_JVM_VARIANTS"])
AC_MSG_ERROR([Cannot continue])
fi fi
# All "special" variants share the same output directory ("server") # All "special" variants share the same output directory ("server")
VALID_MULTIPLE_JVM_VARIANTS="server client minimal" VALID_MULTIPLE_JVM_VARIANTS="server client minimal"
NEEDLE=${VALID_MULTIPLE_JVM_VARIANTS// /$'\n'} BASIC_GET_NON_MATCHING_VALUES(INVALID_MULTIPLE_VARIANTS, $JVM_VARIANTS, $VALID_MULTIPLE_JVM_VARIANTS)
STACK=${JVM_VARIANTS// /$'\n'}
INVALID_MULTIPLE_VARIANTS=`$GREP -Fvx "${NEEDLE}" <<< "${STACK}"`
if test "x$INVALID_MULTIPLE_VARIANTS" != x && test "x$BUILDING_MULTIPLE_JVM_VARIANTS" = xtrue; then if test "x$INVALID_MULTIPLE_VARIANTS" != x && test "x$BUILDING_MULTIPLE_JVM_VARIANTS" = xtrue; then
AC_MSG_ERROR([You cannot build multiple variants with anything else than $VALID_MULTIPLE_JVM_VARIANTS.]) AC_MSG_ERROR([You cannot build multiple variants with anything else than $VALID_MULTIPLE_JVM_VARIANTS.])
fi fi
@ -263,14 +257,30 @@ AC_DEFUN_ONCE([HOTSPOT_ENABLE_DISABLE_CDS],
# #
AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_FEATURES], AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_FEATURES],
[ [
# Prettify the VALID_JVM_FEATURES string
BASIC_SORT_LIST(VALID_JVM_FEATURES, $VALID_JVM_FEATURES)
# The user can in some cases supply additional jvm features. For the custom # The user can in some cases supply additional jvm features. For the custom
# variant, this defines the entire variant. # variant, this defines the entire variant.
AC_ARG_WITH([jvm-features], [AS_HELP_STRING([--with-jvm-features], AC_ARG_WITH([jvm-features], [AS_HELP_STRING([--with-jvm-features],
[additional JVM features to enable (separated by comma), use '--help' to show possible values @<:@none@:>@])]) [JVM features to enable (foo) or disable (-foo), separated by comma. Use '--help' to show possible values @<:@none@:>@])])
if test "x$with_jvm_features" != x; then if test "x$with_jvm_features" != x; then
AC_MSG_CHECKING([additional JVM features]) AC_MSG_CHECKING([user specified JVM feature list])
JVM_FEATURES=`$ECHO $with_jvm_features | $SED -e 's/,/ /g'` USER_JVM_FEATURE_LIST=`$ECHO $with_jvm_features | $SED -e 's/,/ /g'`
AC_MSG_RESULT([$JVM_FEATURES]) AC_MSG_RESULT([$user_jvm_feature_list])
# These features will be added to all variant defaults
JVM_FEATURES=`$ECHO $USER_JVM_FEATURE_LIST | $AWK '{ for (i=1; i<=NF; i++) if (!match($i, /-.*/)) print $i }'`
# These features will be removed from all variant defaults
DISABLED_JVM_FEATURES=`$ECHO $USER_JVM_FEATURE_LIST | $AWK '{ for (i=1; i<=NF; i++) if (match($i, /-.*/)) print substr($i, 2) }'`
# Verify that the user has provided valid features
BASIC_GET_NON_MATCHING_VALUES(INVALID_FEATURES, $JVM_FEATURES $DISABLED_JVM_FEATURES, $VALID_JVM_FEATURES)
if test "x$INVALID_FEATURES" != x; then
AC_MSG_NOTICE([Unknown JVM features specified: "$INVALID_FEATURES"])
AC_MSG_NOTICE([The available JVM features are: "$VALID_JVM_FEATURES"])
AC_MSG_ERROR([Cannot continue])
fi
fi fi
# Override hotspot cpu definitions for ARM platforms # Override hotspot cpu definitions for ARM platforms
@ -390,7 +400,7 @@ AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_FEATURES],
NON_MINIMAL_FEATURES="$NON_MINIMAL_FEATURES cds" NON_MINIMAL_FEATURES="$NON_MINIMAL_FEATURES cds"
fi fi
# Enable features depending on variant. # Enable default features depending on variant.
JVM_FEATURES_server="compiler1 compiler2 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci $JVM_FEATURES_aot $JVM_FEATURES_graal" JVM_FEATURES_server="compiler1 compiler2 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci $JVM_FEATURES_aot $JVM_FEATURES_graal"
JVM_FEATURES_client="compiler1 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci" JVM_FEATURES_client="compiler1 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci"
JVM_FEATURES_core="$NON_MINIMAL_FEATURES $JVM_FEATURES" JVM_FEATURES_core="$NON_MINIMAL_FEATURES $JVM_FEATURES"
@ -413,29 +423,29 @@ AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_FEATURES],
]) ])
############################################################################### ###############################################################################
# Validate JVM features once all setup is complete, including custom setup. # Finalize JVM features once all setup is complete, including custom setup.
# #
AC_DEFUN_ONCE([HOTSPOT_VALIDATE_JVM_FEATURES], AC_DEFUN_ONCE([HOTSPOT_FINALIZE_JVM_FEATURES],
[ [
# Keep feature lists sorted and free of duplicates
JVM_FEATURES_server="$($ECHO $($PRINTF '%s\n' $JVM_FEATURES_server | $SORT -u))"
JVM_FEATURES_client="$($ECHO $($PRINTF '%s\n' $JVM_FEATURES_client | $SORT -u))"
JVM_FEATURES_core="$($ECHO $($PRINTF '%s\n' $JVM_FEATURES_core | $SORT -u))"
JVM_FEATURES_minimal="$($ECHO $($PRINTF '%s\n' $JVM_FEATURES_minimal | $SORT -u))"
JVM_FEATURES_zero="$($ECHO $($PRINTF '%s\n' $JVM_FEATURES_zero | $SORT -u))"
JVM_FEATURES_custom="$($ECHO $($PRINTF '%s\n' $JVM_FEATURES_custom | $SORT -u))"
# Validate features
for variant in $JVM_VARIANTS; do for variant in $JVM_VARIANTS; do
AC_MSG_CHECKING([JVM features for JVM variant '$variant']) AC_MSG_CHECKING([JVM features for JVM variant '$variant'])
features_var_name=JVM_FEATURES_$variant features_var_name=JVM_FEATURES_$variant
JVM_FEATURES_TO_TEST=${!features_var_name} JVM_FEATURES_FOR_VARIANT=${!features_var_name}
AC_MSG_RESULT([$JVM_FEATURES_TO_TEST])
NEEDLE=${VALID_JVM_FEATURES// /$'\n'} # Filter out user-requested disabled features
STACK=${JVM_FEATURES_TO_TEST// /$'\n'} BASIC_GET_NON_MATCHING_VALUES(JVM_FEATURES_FOR_VARIANT, $JVM_FEATURES_FOR_VARIANT, $DISABLED_JVM_FEATURES)
INVALID_FEATURES=`$GREP -Fvx "${NEEDLE}" <<< "${STACK}"`
# Keep feature lists sorted and free of duplicates
BASIC_SORT_LIST(JVM_FEATURES_FOR_VARIANT, $JVM_FEATURES_FOR_VARIANT)
# Update real feature set variable
eval $features_var_name='"'$JVM_FEATURES_FOR_VARIANT'"'
AC_MSG_RESULT(["$JVM_FEATURES_FOR_VARIANT"])
# Validate features (for configure script errors, not user errors)
INVALID_FEATURES=`$GREP -Fvx "${VALID_JVM_FEATURES// /$'\n'}" <<< "${JVM_FEATURES_FOR_VARIANT// /$'\n'}"`
if test "x$INVALID_FEATURES" != x; then if test "x$INVALID_FEATURES" != x; then
AC_MSG_ERROR([Invalid JVM feature(s): $INVALID_FEATURES]) AC_MSG_ERROR([Internal configure script error. Invalid JVM feature(s): $INVALID_FEATURES])
fi fi
done done
]) ])

View File

@ -332,6 +332,7 @@ TEST_JOBS?=@TEST_JOBS@
# Default make target # Default make target
DEFAULT_MAKE_TARGET:=@DEFAULT_MAKE_TARGET@ DEFAULT_MAKE_TARGET:=@DEFAULT_MAKE_TARGET@
DEFAULT_LOG:=@DEFAULT_LOG@
FREETYPE_TO_USE:=@FREETYPE_TO_USE@ FREETYPE_TO_USE:=@FREETYPE_TO_USE@
FREETYPE_LIBS:=@FREETYPE_LIBS@ FREETYPE_LIBS:=@FREETYPE_LIBS@

View File

@ -497,8 +497,10 @@ var getJibProfilesProfiles = function (input, common, data) {
configure_args: [ configure_args: [
"--with-jvm-variants=minimal1,client", "--with-jvm-variants=minimal1,client",
"--with-x=" + input.get("devkit", "install_path") + "/arm-linux-gnueabihf/libc/usr/X11R6-PI", "--with-x=" + input.get("devkit", "install_path") + "/arm-linux-gnueabihf/libc/usr/X11R6-PI",
"--with-fontconfig=" + input.get("devkit", "install_path") + "/arm-linux-gnueabihf/libc/usr/X11R6-PI",
"--openjdk-target=arm-linux-gnueabihf", "--openjdk-target=arm-linux-gnueabihf",
"--with-abi-profile=arm-vfp-hflt" "--with-abi-profile=arm-vfp-hflt",
"--with-freetype=bundled"
], ],
}, },

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -34,19 +34,28 @@ CLDR_METAINFO_FILE := $(GENSRC_DIR)/sun/util/resources/cldr/provider/CLDRLocaleD
CLDR_BASE_LOCALES := "en-US" CLDR_BASE_LOCALES := "en-US"
ZONENAME_TEMPLATE := $(TOPDIR)/src/java.base/share/classes/java/time/format/ZoneName.java.template
$(CLDR_BASEMETAINFO_FILE): $(wildcard $(CLDRSRCDIR)/common/dtd/*.dtd) \ $(CLDR_BASEMETAINFO_FILE): $(wildcard $(CLDRSRCDIR)/common/dtd/*.dtd) \
$(wildcard $(CLDRSRCDIR)/common/main/en*.xml) \ $(wildcard $(CLDRSRCDIR)/common/main/en*.xml) \
$(wildcard $(CLDRSRCDIR)/common/supplemental/*.xml) \ $(wildcard $(CLDRSRCDIR)/common/supplemental/*.xml) \
$(ZONENAME_TEMPLATE) \
$(BUILD_TOOLS_JDK) $(BUILD_TOOLS_JDK)
$(MKDIR) -p $(GENSRC_BASEDIR) $(MKDIR) -p $(GENSRC_BASEDIR)
$(TOOL_CLDRCONVERTER) -base $(CLDRSRCDIR) -baselocales $(CLDR_BASE_LOCALES) -basemodule -o $(GENSRC_BASEDIR) $(TOOL_CLDRCONVERTER) -base $(CLDRSRCDIR) \
-baselocales $(CLDR_BASE_LOCALES) \
-o $(GENSRC_BASEDIR) \
-basemodule \
-zntempfile $(ZONENAME_TEMPLATE)
$(CLDR_METAINFO_FILE): $(wildcard $(CLDRSRCDIR)/common/dtd/*.dtd) \ $(CLDR_METAINFO_FILE): $(wildcard $(CLDRSRCDIR)/common/dtd/*.dtd) \
$(wildcard $(CLDRSRCDIR)/common/main/*.xml) \ $(wildcard $(CLDRSRCDIR)/common/main/*.xml) \
$(wildcard $(CLDRSRCDIR)/common/supplemental/*.xml) \ $(wildcard $(CLDRSRCDIR)/common/supplemental/*.xml) \
$(BUILD_TOOLS_JDK) $(BUILD_TOOLS_JDK)
$(MKDIR) -p $(GENSRC_DIR) $(MKDIR) -p $(GENSRC_DIR)
$(TOOL_CLDRCONVERTER) -base $(CLDRSRCDIR) -baselocales $(CLDR_BASE_LOCALES) -o $(GENSRC_DIR) $(TOOL_CLDRCONVERTER) -base $(CLDRSRCDIR) \
-baselocales $(CLDR_BASE_LOCALES) \
-o $(GENSRC_DIR)
GENSRC_JAVA_BASE += $(CLDR_BASEMETAINFO_FILE) GENSRC_JAVA_BASE += $(CLDR_BASEMETAINFO_FILE)
GENSRC_JDK_LOCALEDATA += $(CLDR_METAINFO_FILE) GENSRC_JDK_LOCALEDATA += $(CLDR_METAINFO_FILE)

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -28,16 +28,15 @@ package build.tools.cldrconverter;
import static build.tools.cldrconverter.Bundle.jreTimeZoneNames; import static build.tools.cldrconverter.Bundle.jreTimeZoneNames;
import build.tools.cldrconverter.BundleGenerator.BundleType; import build.tools.cldrconverter.BundleGenerator.BundleType;
import java.io.File; import java.io.File;
import java.nio.file.DirectoryStream; import java.nio.file.*;
import java.nio.file.FileSystems; import java.time.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.*; import java.util.*;
import java.util.ResourceBundle.Control; import java.util.ResourceBundle.Control;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.IntStream; import java.util.stream.IntStream;
import java.util.stream.Stream;
import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory; import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotRecognizedException;
@ -56,12 +55,13 @@ public class CLDRConverter {
static final String BCP47_LDML_DTD_SYSTEM_ID = "http://www.unicode.org/cldr/dtd/2.0/ldmlBCP47.dtd"; static final String BCP47_LDML_DTD_SYSTEM_ID = "http://www.unicode.org/cldr/dtd/2.0/ldmlBCP47.dtd";
private static String CLDR_BASE = "../CLDR/21.0.1/"; private static String CLDR_BASE;
static String LOCAL_LDML_DTD; static String LOCAL_LDML_DTD;
static String LOCAL_SPPL_LDML_DTD; static String LOCAL_SPPL_LDML_DTD;
static String LOCAL_BCP47_LDML_DTD; static String LOCAL_BCP47_LDML_DTD;
private static String SOURCE_FILE_DIR; private static String SOURCE_FILE_DIR;
private static String SPPL_SOURCE_FILE; private static String SPPL_SOURCE_FILE;
private static String SPPL_META_SOURCE_FILE;
private static String NUMBERING_SOURCE_FILE; private static String NUMBERING_SOURCE_FILE;
private static String METAZONES_SOURCE_FILE; private static String METAZONES_SOURCE_FILE;
private static String LIKELYSUBTAGS_SOURCE_FILE; private static String LIKELYSUBTAGS_SOURCE_FILE;
@ -85,6 +85,7 @@ public class CLDRConverter {
static final String PARENT_LOCALE_PREFIX = "parentLocale."; static final String PARENT_LOCALE_PREFIX = "parentLocale.";
private static SupplementDataParseHandler handlerSuppl; private static SupplementDataParseHandler handlerSuppl;
private static SupplementalMetadataParseHandler handlerSupplMeta;
private static LikelySubtagsParseHandler handlerLikelySubtags; private static LikelySubtagsParseHandler handlerLikelySubtags;
static NumberingSystemsParseHandler handlerNumbering; static NumberingSystemsParseHandler handlerNumbering;
static MetaZonesParseHandler handlerMetaZones; static MetaZonesParseHandler handlerMetaZones;
@ -100,6 +101,9 @@ public class CLDRConverter {
private static final ResourceBundle.Control defCon = private static final ResourceBundle.Control defCon =
ResourceBundle.Control.getControl(ResourceBundle.Control.FORMAT_DEFAULT); ResourceBundle.Control.getControl(ResourceBundle.Control.FORMAT_DEFAULT);
private static final String[] AVAILABLE_TZIDS = TimeZone.getAvailableIDs();
private static String zoneNameTempFile;
static enum DraftType { static enum DraftType {
UNCONFIRMED, UNCONFIRMED,
PROVISIONAL, PROVISIONAL,
@ -195,6 +199,10 @@ public class CLDRConverter {
verbose = true; verbose = true;
break; break;
case "-zntempfile":
zoneNameTempFile = args[++i];
break;
case "-help": case "-help":
usage(); usage();
System.exit(0); System.exit(0);
@ -221,6 +229,7 @@ public class CLDRConverter {
NUMBERING_SOURCE_FILE = CLDR_BASE + "/supplemental/numberingSystems.xml"; NUMBERING_SOURCE_FILE = CLDR_BASE + "/supplemental/numberingSystems.xml";
METAZONES_SOURCE_FILE = CLDR_BASE + "/supplemental/metaZones.xml"; METAZONES_SOURCE_FILE = CLDR_BASE + "/supplemental/metaZones.xml";
TIMEZONE_SOURCE_FILE = CLDR_BASE + "/bcp47/timezone.xml"; TIMEZONE_SOURCE_FILE = CLDR_BASE + "/bcp47/timezone.xml";
SPPL_META_SOURCE_FILE = CLDR_BASE + "/supplemental/supplementalMetadata.xml";
if (BASE_LOCALES.isEmpty()) { if (BASE_LOCALES.isEmpty()) {
setupBaseLocales("en-US"); setupBaseLocales("en-US");
@ -234,6 +243,11 @@ public class CLDRConverter {
List<Bundle> bundles = readBundleList(); List<Bundle> bundles = readBundleList();
convertBundles(bundles); convertBundles(bundles);
// Generate java.time.format.ZoneName.java
if (isBaseModule) {
generateZoneName();
}
} }
private static void usage() { private static void usage() {
@ -246,7 +260,7 @@ public class CLDRConverter {
+ "\t-basemodule generates bundles that go into java.base module%n" + "\t-basemodule generates bundles that go into java.base module%n"
+ "\t-baselocales loc(,loc)* locales that go into the base module%n" + "\t-baselocales loc(,loc)* locales that go into the base module%n"
+ "\t-o dir output directory (default: ./build/gensrc)%n" + "\t-o dir output directory (default: ./build/gensrc)%n"
+ "\t-o dir output directory (defaut: ./build/gensrc)%n" + "\t-zntempfile template file for java.time.format.ZoneName.java%n"
+ "\t-utf8 use UTF-8 rather than \\uxxxx (for debug)%n"); + "\t-utf8 use UTF-8 rather than \\uxxxx (for debug)%n");
} }
@ -401,6 +415,11 @@ public class CLDRConverter {
// Parse likelySubtags // Parse likelySubtags
handlerLikelySubtags = new LikelySubtagsParseHandler(); handlerLikelySubtags = new LikelySubtagsParseHandler();
parseLDMLFile(new File(LIKELYSUBTAGS_SOURCE_FILE), handlerLikelySubtags); parseLDMLFile(new File(LIKELYSUBTAGS_SOURCE_FILE), handlerLikelySubtags);
// Parse supplementalMetadata
// Currently only interested in deprecated time zone ids.
handlerSupplMeta = new SupplementalMetadataParseHandler();
parseLDMLFile(new File(SPPL_META_SOURCE_FILE), handlerSupplMeta);
} }
// Parsers for data in "bcp47" directory // Parsers for data in "bcp47" directory
@ -656,13 +675,16 @@ public class CLDRConverter {
}); });
} }
for (String tzid : handlerMetaZones.keySet()) { Arrays.stream(AVAILABLE_TZIDS).forEach(tzid -> {
String tzKey = TIMEZONE_ID_PREFIX + tzid; // If the tzid is deprecated, get the data for the replacement id
Object data = map.get(tzKey); String tzKey = Optional.ofNullable((String)handlerSupplMeta.get(tzid))
.orElse(tzid);
Object data = map.get(TIMEZONE_ID_PREFIX + tzKey);
if (data instanceof String[]) { if (data instanceof String[]) {
names.put(tzid, data); names.put(tzid, data);
} else { } else {
String meta = handlerMetaZones.get(tzid); String meta = handlerMetaZones.get(tzKey);
if (meta != null) { if (meta != null) {
String metaKey = METAZONE_ID_PREFIX + meta; String metaKey = METAZONE_ID_PREFIX + meta;
data = map.get(metaKey); data = map.get(metaKey);
@ -673,7 +695,8 @@ public class CLDRConverter {
} }
} }
} }
} });
return names; return names;
} }
@ -948,4 +971,44 @@ public class CLDRConverter {
return candidates; return candidates;
} }
private static void generateZoneName() throws Exception {
Files.createDirectories(Paths.get(DESTINATION_DIR, "java", "time", "format"));
Files.write(Paths.get(DESTINATION_DIR, "java", "time", "format", "ZoneName.java"),
Files.lines(Paths.get(zoneNameTempFile))
.flatMap(l -> {
if (l.equals("%%%%ZIDMAP%%%%")) {
return zidMapEntry();
} else if (l.equals("%%%%MZONEMAP%%%%")) {
return handlerMetaZones.mzoneMapEntry();
} else if (l.equals("%%%%DEPRECATED%%%%")) {
return handlerSupplMeta.deprecatedMap();
} else {
return Stream.of(l);
}
})
.collect(Collectors.toList()),
StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
}
private static Stream<String> zidMapEntry() {
Map<String, String> canonMap = new HashMap<>();
handlerTimeZone.getData().entrySet().stream()
.forEach(e -> {
String[] ids = ((String)e.getValue()).split("\\s");
for (int i = 1; i < ids.length; i++) {
canonMap.put(ids[i], ids[0]);
}});
return ZoneId.getAvailableZoneIds().stream()
.map(id -> {
String canonId = canonMap.getOrDefault(id, id);
String meta = handlerMetaZones.get(canonId);
String zone001 = handlerMetaZones.zidMap().get(meta);
return zone001 == null ? "" :
String.format(" \"%s\", \"%s\", \"%s\",",
id, meta, zone001);
})
.filter(s -> !s.isEmpty())
.sorted();
}
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -27,6 +27,9 @@ package build.tools.cldrconverter;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.*;
import java.util.stream.*;
import org.xml.sax.Attributes; import org.xml.sax.Attributes;
import org.xml.sax.InputSource; import org.xml.sax.InputSource;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
@ -34,6 +37,10 @@ import org.xml.sax.SAXException;
class MetaZonesParseHandler extends AbstractLDMLHandler<String> { class MetaZonesParseHandler extends AbstractLDMLHandler<String> {
private String tzid, metazone; private String tzid, metazone;
// for java.time.format.ZoneNames.java
private List<String> mzoneMapEntryList = new ArrayList<>();
private Map<String, String> zones = new HashMap<>();
MetaZonesParseHandler() { MetaZonesParseHandler() {
} }
@ -64,6 +71,19 @@ class MetaZonesParseHandler extends AbstractLDMLHandler<String> {
pushIgnoredContainer(qName); pushIgnoredContainer(qName);
break; break;
case "mapZone":
String territory = attributes.getValue("territory");
if (territory.equals("001")) {
zones.put(attributes.getValue("other"), attributes.getValue("type"));
} else {
mzoneMapEntryList.add(String.format(" \"%s\", \"%s\", \"%s\",",
attributes.getValue("other"),
territory,
attributes.getValue("type")));
}
pushIgnoredContainer(qName);
break;
case "version": case "version":
case "generation": case "generation":
pushIgnoredContainer(qName); pushIgnoredContainer(qName);
@ -89,4 +109,12 @@ class MetaZonesParseHandler extends AbstractLDMLHandler<String> {
} }
currentContainer = currentContainer.getParent(); currentContainer = currentContainer.getParent();
} }
public Map<String, String> zidMap() {
return zones;
}
public Stream<String> mzoneMapEntry() {
return mzoneMapEntryList.stream();
}
} }

View File

@ -0,0 +1,72 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package build.tools.cldrconverter;
import java.io.File;
import java.io.IOException;
import java.util.stream.Stream;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/**
* Handles parsing of files in Locale Data Markup Language for
* SupplementalMetadata.xml
*/
class SupplementalMetadataParseHandler extends AbstractLDMLHandler<Object> {
@Override
public InputSource resolveEntity(String publicID, String systemID) throws IOException, SAXException {
// avoid HTTP traffic to unicode.org
if (systemID.startsWith(CLDRConverter.SPPL_LDML_DTD_SYSTEM_ID)) {
return new InputSource((new File(CLDRConverter.LOCAL_SPPL_LDML_DTD)).toURI().toString());
}
return null;
}
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
switch (qName) {
case "zoneAlias":
String reason = attributes.getValue("reason");
if ("deprecated".equals(reason)) {
put(attributes.getValue("type"), attributes.getValue("replacement"));
}
pushIgnoredContainer(qName);
break;
default:
// treat anything else as a container
pushContainer(qName, attributes);
break;
}
}
public Stream<String> deprecatedMap() {
return keySet().stream()
.map(k -> String.format(" \"%s\", \"%s\",", k, get(k)))
.sorted();
}
}

View File

@ -140,10 +140,12 @@ class LinuxFileStore
if ((entry().hasOption("user_xattr"))) if ((entry().hasOption("user_xattr")))
return true; return true;
// user_xattr option not present but we special-case ext3/4 as we // for ext3 and ext4 user_xattr option is enabled by default so
// know that extended attributes are not enabled by default. // check for explicit disabling of this option
if (entry().fstype().equals("ext3") || entry().fstype().equals("ext4")) if (entry().fstype().equals("ext3") ||
return false; entry().fstype().equals("ext4")) {
return !entry().hasOption("nouser_xattr");
}
// not ext3/4 so probe mount point // not ext3/4 so probe mount point
if (!xattrChecked) { if (!xattrChecked) {

View File

@ -49,6 +49,18 @@ public final class ConstantBootstraps {
Object info, Object info,
// Caller information: // Caller information:
Class<?> callerClass) { Class<?> callerClass) {
// Restrict bootstrap methods to those whose first parameter is Lookup
// The motivation here is, in the future, to possibly support BSMs
// that do not accept the meta-data of lookup/name/type, thereby
// allowing the co-opting of existing methods to be used as BSMs as
// long as the static arguments can be passed as method arguments
MethodType mt = bootstrapMethod.type();
if (mt.parameterCount() < 2 ||
!MethodHandles.Lookup.class.isAssignableFrom(mt.parameterType(0))) {
throw new BootstrapMethodError(
"Invalid bootstrap method declared for resolving a dynamic constant: " + bootstrapMethod);
}
// BSMI.invoke handles all type checking and exception translation. // BSMI.invoke handles all type checking and exception translation.
// If type is not a reference type, the JVM is expecting a boxed // If type is not a reference type, the JVM is expecting a boxed
// version, and will manage unboxing on the other side. // version, and will manage unboxing on the other side.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -122,8 +122,11 @@
* On success the call site then becomes permanently linked to the {@code invokedynamic} * On success the call site then becomes permanently linked to the {@code invokedynamic}
* instruction. * instruction.
* <p> * <p>
* For a dynamically-computed constant, the result of the bootstrap method is cached * For a dynamically-computed constant, the first parameter of the bootstrap
* as the resolved constant value. * method must be assignable to {@code MethodHandles.Lookup}. If this condition
* is not met, a {@code BootstrapMethodError} is thrown.
* On success the result of the bootstrap method is cached as the resolved
* constant value.
* <p> * <p>
* If an exception, {@code E} say, occurs during execution of the bootstrap method, then * If an exception, {@code E} say, occurs during execution of the bootstrap method, then
* resolution fails and terminates abnormally. {@code E} is rethrown if the type of * resolution fails and terminates abnormally. {@code E} is rethrown if the type of
@ -171,16 +174,25 @@
* <h2>Types of bootstrap methods</h2> * <h2>Types of bootstrap methods</h2>
* For a dynamically-computed call site, the bootstrap method is invoked with parameter * For a dynamically-computed call site, the bootstrap method is invoked with parameter
* types {@code MethodHandles.Lookup}, {@code String}, {@code MethodType}, and the types * types {@code MethodHandles.Lookup}, {@code String}, {@code MethodType}, and the types
* of any static arguments; the return type is {@code CallSite}. For a * of any static arguments; the return type is {@code CallSite}.
* dynamically-computed constant, the bootstrap method is invoked with parameter types * <p>
* For a dynamically-computed constant, the bootstrap method is invoked with parameter types
* {@code MethodHandles.Lookup}, {@code String}, {@code Class}, and the types of any * {@code MethodHandles.Lookup}, {@code String}, {@code Class}, and the types of any
* static arguments; the return type is the type represented by the {@code Class}. * static arguments; the return type is the type represented by the {@code Class}.
* * <p>
* Because {@link java.lang.invoke.MethodHandle#invoke MethodHandle.invoke} allows for * Because {@link java.lang.invoke.MethodHandle#invoke MethodHandle.invoke} allows for
* adaptations between the invoked method type and the method handle's method type, * adaptations between the invoked method type and the bootstrap method handle's method type,
* there is flexibility in the declaration of the bootstrap method. * there is flexibility in the declaration of the bootstrap method.
* For example, the first argument could be {@code Object} * For a dynamically-computed constant the first parameter type of the bootstrap method handle
* instead of {@code MethodHandles.Lookup}, and the return type * must be assignable to {@code MethodHandles.Lookup}, other than that constraint the same degree
* of flexibility applies to bootstrap methods of dynamically-computed call sites and
* dynamically-computed constants.
* Note: this constraint allows for the future possibility where the bootstrap method is
* invoked with just the parameter types of static arguments, thereby supporting a wider
* range of methods compatible with the static arguments (such as methods that don't declare
* or require the lookup, name, and type meta-data parameters).
* <p> For example, for dynamically-computed call site, a the first argument
* could be {@code Object} instead of {@code MethodHandles.Lookup}, and the return type
* could also be {@code Object} instead of {@code CallSite}. * could also be {@code Object} instead of {@code CallSite}.
* (Note that the types and number of the stacked arguments limit * (Note that the types and number of the stacked arguments limit
* the legal kinds of bootstrap methods to appropriately typed * the legal kinds of bootstrap methods to appropriately typed
@ -227,7 +239,10 @@
* {@code String} and {@code Integer} (or {@code int}), respectively. * {@code String} and {@code Integer} (or {@code int}), respectively.
* The second-to-last example assumes that all extra arguments are of type * The second-to-last example assumes that all extra arguments are of type
* {@code String}. * {@code String}.
* The other examples work with all types of extra arguments. * The other examples work with all types of extra arguments. Note that all
* the examples except the second and third also work with dynamically-computed
* constants if the return type is changed to be compatible with the
* constant's declared type (such as {@code Object}, which is always compatible).
* <p> * <p>
* Since dynamically-computed constants can be provided as static arguments to bootstrap * Since dynamically-computed constants can be provided as static arguments to bootstrap
* methods, there are no limitations on the types of bootstrap arguments. * methods, there are no limitations on the types of bootstrap arguments.

View File

@ -65,25 +65,13 @@ class Bits { // package-private
private static final Unsafe UNSAFE = Unsafe.getUnsafe(); private static final Unsafe UNSAFE = Unsafe.getUnsafe();
static Unsafe unsafe() {
return UNSAFE;
}
// -- Processor and memory-system properties -- // -- Processor and memory-system properties --
private static final ByteOrder BYTE_ORDER
= UNSAFE.isBigEndian() ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN;
static ByteOrder byteOrder() {
return BYTE_ORDER;
}
private static int PAGE_SIZE = -1; private static int PAGE_SIZE = -1;
static int pageSize() { static int pageSize() {
if (PAGE_SIZE == -1) if (PAGE_SIZE == -1)
PAGE_SIZE = unsafe().pageSize(); PAGE_SIZE = UNSAFE.pageSize();
return PAGE_SIZE; return PAGE_SIZE;
} }

View File

@ -183,7 +183,7 @@ import java.util.Spliterator;
public abstract class Buffer { public abstract class Buffer {
// Cached unsafe-access object // Cached unsafe-access object
static final Unsafe UNSAFE = Bits.unsafe(); static final Unsafe UNSAFE = Unsafe.getUnsafe();
/** /**
* The characteristics of Spliterators that traverse and split elements * The characteristics of Spliterators that traverse and split elements

View File

@ -25,6 +25,7 @@
package java.nio; package java.nio;
import jdk.internal.misc.Unsafe;
/** /**
* A typesafe enumeration for byte orders. * A typesafe enumeration for byte orders.
@ -57,6 +58,12 @@ public final class ByteOrder {
public static final ByteOrder LITTLE_ENDIAN public static final ByteOrder LITTLE_ENDIAN
= new ByteOrder("LITTLE_ENDIAN"); = new ByteOrder("LITTLE_ENDIAN");
// Retrieve the native byte order. It's used early during bootstrap, and
// must be initialized after BIG_ENDIAN and LITTLE_ENDIAN.
private static final ByteOrder NATIVE_ORDER
= Unsafe.getUnsafe().isBigEndian()
? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN;
/** /**
* Retrieves the native byte order of the underlying platform. * Retrieves the native byte order of the underlying platform.
* *
@ -69,7 +76,7 @@ public final class ByteOrder {
* virtual machine is running * virtual machine is running
*/ */
public static ByteOrder nativeOrder() { public static ByteOrder nativeOrder() {
return Bits.byteOrder(); return NATIVE_ORDER;
} }
/** /**

View File

@ -1579,7 +1579,7 @@ public abstract class $Type$Buffer
boolean bigEndian // package-private boolean bigEndian // package-private
= true; = true;
boolean nativeByteOrder // package-private boolean nativeByteOrder // package-private
= (Bits.byteOrder() == ByteOrder.BIG_ENDIAN); = (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN);
/** /**
* Retrieves this buffer's byte order. * Retrieves this buffer's byte order.
@ -1608,7 +1608,7 @@ public abstract class $Type$Buffer
public final $Type$Buffer order(ByteOrder bo) { public final $Type$Buffer order(ByteOrder bo) {
bigEndian = (bo == ByteOrder.BIG_ENDIAN); bigEndian = (bo == ByteOrder.BIG_ENDIAN);
nativeByteOrder = nativeByteOrder =
(bigEndian == (Bits.byteOrder() == ByteOrder.BIG_ENDIAN)); (bigEndian == (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN));
return this; return this;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -33,8 +33,6 @@ import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import jdk.internal.misc.JavaSecurityAccess; import jdk.internal.misc.JavaSecurityAccess;
import jdk.internal.misc.JavaSecurityProtectionDomainAccess;
import static jdk.internal.misc.JavaSecurityProtectionDomainAccess.ProtectionDomainCache;
import jdk.internal.misc.SharedSecrets; import jdk.internal.misc.SharedSecrets;
import sun.security.action.GetPropertyAction; import sun.security.action.GetPropertyAction;
import sun.security.provider.PolicyFile; import sun.security.provider.PolicyFile;
@ -110,6 +108,21 @@ public class ProtectionDomain {
return new AccessControlContext(stack.getContext(), acc).optimize(); return new AccessControlContext(stack.getContext(), acc).optimize();
} }
@Override
public ProtectionDomainCache getProtectionDomainCache() {
return new ProtectionDomainCache() {
private final Map<Key, PermissionCollection> map =
Collections.synchronizedMap(new WeakHashMap<>());
public void put(ProtectionDomain pd,
PermissionCollection pc) {
map.put((pd == null ? null : pd.key), pc);
}
public PermissionCollection get(ProtectionDomain pd) {
return pd == null ? map.get(null) : map.get(pd.key);
}
};
}
} }
static { static {
@ -560,23 +573,4 @@ public class ProtectionDomain {
*/ */
final class Key {} final class Key {}
static {
SharedSecrets.setJavaSecurityProtectionDomainAccess(
new JavaSecurityProtectionDomainAccess() {
public ProtectionDomainCache getProtectionDomainCache() {
return new ProtectionDomainCache() {
private final Map<Key, PermissionCollection> map =
Collections.synchronizedMap
(new WeakHashMap<Key, PermissionCollection>());
public void put(ProtectionDomain pd,
PermissionCollection pc) {
map.put((pd == null ? null : pd.key), pc);
}
public PermissionCollection get(ProtectionDomain pd) {
return pd == null ? map.get(null) : map.get(pd.key);
}
};
}
});
}
} }

View File

@ -1,798 +0,0 @@
/*
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package java.time.format;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
/**
* A helper class to map a zone name to metazone and back to the
* appropriate zone id for the particular locale.
* <p>
* The zid<->metazone mappings are based on CLDR metaZones.xml.
* The alias mappings are based on Link entries in tzdb data files.
*/
class ZoneName {
public static String toZid(String zid, Locale locale) {
String mzone = zidToMzone.get(zid);
if (mzone == null && aliases.containsKey(zid)) {
zid = aliases.get(zid);
mzone = zidToMzone.get(zid);
}
if (mzone != null) {
Map<String, String> map = mzoneToZidL.get(mzone);
if (map != null && map.containsKey(locale.getCountry())) {
zid = map.get(locale.getCountry());
} else {
zid = mzoneToZid.get(mzone);
}
}
return toZid(zid);
}
public static String toZid(String zid) {
if (aliases.containsKey(zid)) {
return aliases.get(zid);
}
return zid;
}
private static final String[] zidMap = new String[] {
"Pacific/Rarotonga", "Cook", "Pacific/Rarotonga",
"Europe/Tirane", "Europe_Central", "Europe/Paris",
"America/Recife", "Brasilia", "America/Sao_Paulo",
"America/Argentina/San_Juan", "Argentina", "America/Buenos_Aires",
"Asia/Kolkata", "India", "Asia/Calcutta",
"America/Guayaquil", "Ecuador", "America/Guayaquil",
"Europe/Samara", "Moscow", "Europe/Moscow",
"Indian/Antananarivo", "Africa_Eastern", "Africa/Nairobi",
"America/Santa_Isabel", "America_Pacific", "America/Los_Angeles",
"America/Montserrat", "Atlantic", "America/Halifax",
"Pacific/Port_Moresby", "Papua_New_Guinea", "Pacific/Port_Moresby",
"Europe/Paris", "Europe_Central", "Europe/Paris",
"America/Argentina/Salta", "Argentina", "America/Buenos_Aires",
"Asia/Omsk", "Omsk", "Asia/Omsk",
"Africa/Ceuta", "Europe_Central", "Europe/Paris",
"America/Argentina/San_Luis", "Argentina_Western", "America/Argentina/San_Luis",
"America/Atikokan", "America_Eastern", "America/New_York",
"Asia/Vladivostok", "Vladivostok", "Asia/Vladivostok",
"America/Argentina/Jujuy", "Argentina", "America/Buenos_Aires",
"Asia/Almaty", "Kazakhstan_Eastern", "Asia/Almaty",
"Atlantic/Canary", "Europe_Western", "Atlantic/Canary",
"Asia/Bangkok", "Indochina", "Asia/Saigon",
"America/Caracas", "Venezuela", "America/Caracas",
"Australia/Hobart", "Australia_Eastern", "Australia/Sydney",
"America/Havana", "Cuba", "America/Havana",
"Africa/Malabo", "Africa_Western", "Africa/Lagos",
"Australia/Lord_Howe", "Lord_Howe", "Australia/Lord_Howe",
"Pacific/Fakaofo", "Tokelau", "Pacific/Fakaofo",
"America/Matamoros", "America_Central", "America/Chicago",
"America/Guadeloupe", "Atlantic", "America/Halifax",
"Europe/Helsinki", "Europe_Eastern", "Europe/Bucharest",
"Asia/Calcutta", "India", "Asia/Calcutta",
"Africa/Kinshasa", "Africa_Western", "Africa/Lagos",
"America/Miquelon", "Pierre_Miquelon", "America/Miquelon",
"Europe/Athens", "Europe_Eastern", "Europe/Bucharest",
"Asia/Novosibirsk", "Novosibirsk", "Asia/Novosibirsk",
"Indian/Cocos", "Cocos", "Indian/Cocos",
"Africa/Bujumbura", "Africa_Central", "Africa/Maputo",
"Europe/Mariehamn", "Europe_Eastern", "Europe/Bucharest",
"America/Winnipeg", "America_Central", "America/Chicago",
"America/Buenos_Aires", "Argentina", "America/Buenos_Aires",
"America/Yellowknife", "America_Mountain", "America/Denver",
"Pacific/Midway", "Samoa", "Pacific/Apia",
"Africa/Dar_es_Salaam", "Africa_Eastern", "Africa/Nairobi",
"Pacific/Tahiti", "Tahiti", "Pacific/Tahiti",
"Asia/Gaza", "Europe_Eastern", "Europe/Bucharest",
"Australia/Lindeman", "Australia_Eastern", "Australia/Sydney",
"Europe/Kaliningrad", "Europe_Eastern", "Europe/Bucharest",
"Europe/Bucharest", "Europe_Eastern", "Europe/Bucharest",
"America/Lower_Princes", "Atlantic", "America/Halifax",
"Pacific/Chuuk", "Truk", "Pacific/Truk",
"America/Anchorage", "Alaska", "America/Juneau",
"America/Rankin_Inlet", "America_Central", "America/Chicago",
"America/Marigot", "Atlantic", "America/Halifax",
"Africa/Juba", "Africa_Eastern", "Africa/Nairobi",
"Africa/Algiers", "Europe_Central", "Europe/Paris",
"Europe/Kiev", "Europe_Eastern", "Europe/Bucharest",
"America/Santarem", "Brasilia", "America/Sao_Paulo",
"Africa/Brazzaville", "Africa_Western", "Africa/Lagos",
"Asia/Choibalsan", "Choibalsan", "Asia/Choibalsan",
"Indian/Christmas", "Christmas", "Indian/Christmas",
"America/Nassau", "America_Eastern", "America/New_York",
"Africa/Tunis", "Europe_Central", "Europe/Paris",
"Pacific/Noumea", "New_Caledonia", "Pacific/Noumea",
"Africa/El_Aaiun", "Europe_Western", "Atlantic/Canary",
"Europe/Sarajevo", "Europe_Central", "Europe/Paris",
"America/Campo_Grande", "Amazon", "America/Manaus",
"America/Puerto_Rico", "Atlantic", "America/Halifax",
"Antarctica/Mawson", "Mawson", "Antarctica/Mawson",
"Pacific/Galapagos", "Galapagos", "Pacific/Galapagos",
"Asia/Tehran", "Iran", "Asia/Tehran",
"America/Port-au-Prince", "America_Eastern", "America/New_York",
"America/Scoresbysund", "Greenland_Eastern", "America/Scoresbysund",
"Africa/Harare", "Africa_Central", "Africa/Maputo",
"America/Dominica", "Atlantic", "America/Halifax",
"Europe/Chisinau", "Europe_Eastern", "Europe/Bucharest",
"America/Chihuahua", "America_Mountain", "America/Denver",
"America/La_Paz", "Bolivia", "America/La_Paz",
"Indian/Chagos", "Indian_Ocean", "Indian/Chagos",
"Australia/Broken_Hill", "Australia_Central", "Australia/Adelaide",
"America/Grenada", "Atlantic", "America/Halifax",
"America/North_Dakota/New_Salem", "America_Central", "America/Chicago",
"Pacific/Majuro", "Marshall_Islands", "Pacific/Majuro",
"Australia/Adelaide", "Australia_Central", "Australia/Adelaide",
"Europe/Warsaw", "Europe_Central", "Europe/Paris",
"Europe/Vienna", "Europe_Central", "Europe/Paris",
"Atlantic/Cape_Verde", "Cape_Verde", "Atlantic/Cape_Verde",
"America/Mendoza", "Argentina", "America/Buenos_Aires",
"Pacific/Gambier", "Gambier", "Pacific/Gambier",
"Europe/Istanbul", "Europe_Eastern", "Europe/Bucharest",
"America/Kentucky/Monticello", "America_Eastern", "America/New_York",
"America/Chicago", "America_Central", "America/Chicago",
"Asia/Ulaanbaatar", "Mongolia", "Asia/Ulaanbaatar",
"Indian/Maldives", "Maldives", "Indian/Maldives",
"America/Mexico_City", "America_Central", "America/Chicago",
"Africa/Asmara", "Africa_Eastern", "Africa/Nairobi",
"Asia/Chongqing", "China", "Asia/Shanghai",
"America/Argentina/La_Rioja", "Argentina", "America/Buenos_Aires",
"America/Tijuana", "America_Pacific", "America/Los_Angeles",
"Asia/Harbin", "China", "Asia/Shanghai",
"Pacific/Honolulu", "Hawaii_Aleutian", "Pacific/Honolulu",
"Atlantic/Azores", "Azores", "Atlantic/Azores",
"Indian/Mayotte", "Africa_Eastern", "Africa/Nairobi",
"America/Guatemala", "America_Central", "America/Chicago",
"America/Indianapolis", "America_Eastern", "America/New_York",
"America/Halifax", "Atlantic", "America/Halifax",
"America/Resolute", "America_Central", "America/Chicago",
"Europe/London", "GMT", "Atlantic/Reykjavik",
"America/Hermosillo", "America_Mountain", "America/Denver",
"Atlantic/Madeira", "Europe_Western", "Atlantic/Canary",
"Europe/Zagreb", "Europe_Central", "Europe/Paris",
"America/Boa_Vista", "Amazon", "America/Manaus",
"America/Regina", "America_Central", "America/Chicago",
"America/Cordoba", "Argentina", "America/Buenos_Aires",
"America/Shiprock", "America_Mountain", "America/Denver",
"Europe/Luxembourg", "Europe_Central", "Europe/Paris",
"America/Cancun", "America_Central", "America/Chicago",
"Pacific/Enderbury", "Phoenix_Islands", "Pacific/Enderbury",
"Africa/Bissau", "GMT", "Atlantic/Reykjavik",
"Antarctica/Vostok", "Vostok", "Antarctica/Vostok",
"Pacific/Apia", "Samoa", "Pacific/Apia",
"Australia/Perth", "Australia_Western", "Australia/Perth",
"America/Juneau", "Alaska", "America/Juneau",
"Africa/Mbabane", "Africa_Southern", "Africa/Johannesburg",
"Pacific/Niue", "Niue", "Pacific/Niue",
"Europe/Zurich", "Europe_Central", "Europe/Paris",
"America/Rio_Branco", "Amazon", "America/Manaus",
"Africa/Ndjamena", "Africa_Western", "Africa/Lagos",
"Asia/Macau", "China", "Asia/Shanghai",
"America/Lima", "Peru", "America/Lima",
"Africa/Windhoek", "Africa_Central", "Africa/Maputo",
"America/Sitka", "Alaska", "America/Juneau",
"America/Mazatlan", "America_Mountain", "America/Denver",
"Asia/Saigon", "Indochina", "Asia/Saigon",
"Asia/Kamchatka", "Magadan", "Asia/Magadan",
"America/Menominee", "America_Central", "America/Chicago",
"America/Belize", "America_Central", "America/Chicago",
"America/Sao_Paulo", "Brasilia", "America/Sao_Paulo",
"America/Barbados", "Atlantic", "America/Halifax",
"America/Porto_Velho", "Amazon", "America/Manaus",
"America/Costa_Rica", "America_Central", "America/Chicago",
"Europe/Monaco", "Europe_Central", "Europe/Paris",
"Europe/Riga", "Europe_Eastern", "Europe/Bucharest",
"Europe/Vatican", "Europe_Central", "Europe/Paris",
"Europe/Madrid", "Europe_Central", "Europe/Paris",
"Africa/Dakar", "GMT", "Atlantic/Reykjavik",
"Asia/Damascus", "Europe_Eastern", "Europe/Bucharest",
"Asia/Hong_Kong", "Hong_Kong", "Asia/Hong_Kong",
"America/Adak", "Hawaii_Aleutian", "Pacific/Honolulu",
"Europe/Vilnius", "Europe_Eastern", "Europe/Bucharest",
"America/Indiana/Indianapolis", "America_Eastern", "America/New_York",
"Africa/Freetown", "GMT", "Atlantic/Reykjavik",
"Atlantic/Reykjavik", "GMT", "Atlantic/Reykjavik",
"Asia/Ho_Chi_Minh", "Indochina", "Asia/Saigon",
"America/St_Kitts", "Atlantic", "America/Halifax",
"America/Martinique", "Atlantic", "America/Halifax",
"America/Thule", "Atlantic", "America/Halifax",
"America/Asuncion", "Paraguay", "America/Asuncion",
"Africa/Luanda", "Africa_Western", "Africa/Lagos",
"America/Monterrey", "America_Central", "America/Chicago",
"Pacific/Fiji", "Fiji", "Pacific/Fiji",
"Africa/Banjul", "GMT", "Atlantic/Reykjavik",
"America/Grand_Turk", "America_Eastern", "America/New_York",
"Pacific/Pitcairn", "Pitcairn", "Pacific/Pitcairn",
"America/Montevideo", "Uruguay", "America/Montevideo",
"America/Bahia_Banderas", "America_Central", "America/Chicago",
"America/Cayman", "America_Eastern", "America/New_York",
"Pacific/Norfolk", "Norfolk", "Pacific/Norfolk",
"Africa/Ouagadougou", "GMT", "Atlantic/Reykjavik",
"America/Maceio", "Brasilia", "America/Sao_Paulo",
"Pacific/Guam", "Chamorro", "Pacific/Saipan",
"Africa/Monrovia", "GMT", "Atlantic/Reykjavik",
"Africa/Bamako", "GMT", "Atlantic/Reykjavik",
"Asia/Colombo", "India", "Asia/Calcutta",
"Asia/Urumqi", "China", "Asia/Shanghai",
"Asia/Kabul", "Afghanistan", "Asia/Kabul",
"America/Yakutat", "Alaska", "America/Juneau",
"America/Phoenix", "America_Mountain", "America/Denver",
"Asia/Nicosia", "Europe_Eastern", "Europe/Bucharest",
"Asia/Phnom_Penh", "Indochina", "Asia/Saigon",
"America/Rainy_River", "America_Central", "America/Chicago",
"Europe/Uzhgorod", "Europe_Eastern", "Europe/Bucharest",
"Pacific/Saipan", "Chamorro", "Pacific/Saipan",
"America/St_Vincent", "Atlantic", "America/Halifax",
"Europe/Rome", "Europe_Central", "Europe/Paris",
"America/Nome", "Alaska", "America/Juneau",
"Africa/Mogadishu", "Africa_Eastern", "Africa/Nairobi",
"Europe/Zaporozhye", "Europe_Eastern", "Europe/Bucharest",
"Pacific/Funafuti", "Tuvalu", "Pacific/Funafuti",
"Atlantic/South_Georgia", "South_Georgia", "Atlantic/South_Georgia",
"Europe/Skopje", "Europe_Central", "Europe/Paris",
"Asia/Yekaterinburg", "Yekaterinburg", "Asia/Yekaterinburg",
"Australia/Melbourne", "Australia_Eastern", "Australia/Sydney",
"America/Argentina/Cordoba", "Argentina", "America/Buenos_Aires",
"Africa/Kigali", "Africa_Central", "Africa/Maputo",
"Africa/Blantyre", "Africa_Central", "Africa/Maputo",
"Africa/Tripoli", "Europe_Eastern", "Europe/Bucharest",
"Africa/Gaborone", "Africa_Central", "Africa/Maputo",
"Asia/Kuching", "Malaysia", "Asia/Kuching",
"Pacific/Nauru", "Nauru", "Pacific/Nauru",
"America/Aruba", "Atlantic", "America/Halifax",
"America/Antigua", "Atlantic", "America/Halifax",
"Europe/Volgograd", "Volgograd", "Europe/Volgograd",
"Africa/Djibouti", "Africa_Eastern", "Africa/Nairobi",
"America/Catamarca", "Argentina", "America/Buenos_Aires",
"Asia/Manila", "Philippines", "Asia/Manila",
"Pacific/Kiritimati", "Line_Islands", "Pacific/Kiritimati",
"Asia/Shanghai", "China", "Asia/Shanghai",
"Pacific/Truk", "Truk", "Pacific/Truk",
"Pacific/Tarawa", "Gilbert_Islands", "Pacific/Tarawa",
"Africa/Conakry", "GMT", "Atlantic/Reykjavik",
"Asia/Bishkek", "Kyrgystan", "Asia/Bishkek",
"Europe/Gibraltar", "Europe_Central", "Europe/Paris",
"Asia/Rangoon", "Myanmar", "Asia/Rangoon",
"Asia/Baku", "Azerbaijan", "Asia/Baku",
"America/Santiago", "Chile", "America/Santiago",
"America/El_Salvador", "America_Central", "America/Chicago",
"America/Noronha", "Noronha", "America/Noronha",
"America/St_Thomas", "Atlantic", "America/Halifax",
"Atlantic/St_Helena", "GMT", "Atlantic/Reykjavik",
"Asia/Krasnoyarsk", "Krasnoyarsk", "Asia/Krasnoyarsk",
"America/Vancouver", "America_Pacific", "America/Los_Angeles",
"Europe/Belgrade", "Europe_Central", "Europe/Paris",
"America/St_Barthelemy", "Atlantic", "America/Halifax",
"Asia/Pontianak", "Indonesia_Western", "Asia/Jakarta",
"Africa/Lusaka", "Africa_Central", "Africa/Maputo",
"America/Godthab", "Greenland_Western", "America/Godthab",
"Asia/Dhaka", "Bangladesh", "Asia/Dhaka",
"Asia/Dubai", "Gulf", "Asia/Dubai",
"Europe/Moscow", "Moscow", "Europe/Moscow",
"America/Louisville", "America_Eastern", "America/New_York",
"Australia/Darwin", "Australia_Central", "Australia/Adelaide",
"America/Santo_Domingo", "Atlantic", "America/Halifax",
"America/Argentina/Ushuaia", "Argentina", "America/Buenos_Aires",
"America/Tegucigalpa", "America_Central", "America/Chicago",
"Asia/Aden", "Arabian", "Asia/Riyadh",
"America/Inuvik", "America_Mountain", "America/Denver",
"Asia/Beirut", "Europe_Eastern", "Europe/Bucharest",
"Asia/Qatar", "Arabian", "Asia/Riyadh",
"Europe/Oslo", "Europe_Central", "Europe/Paris",
"Asia/Anadyr", "Magadan", "Asia/Magadan",
"Pacific/Palau", "Palau", "Pacific/Palau",
"Arctic/Longyearbyen", "Europe_Central", "Europe/Paris",
"America/Anguilla", "Atlantic", "America/Halifax",
"Asia/Aqtau", "Kazakhstan_Western", "Asia/Aqtobe",
"Asia/Yerevan", "Armenia", "Asia/Yerevan",
"Africa/Lagos", "Africa_Western", "Africa/Lagos",
"America/Denver", "America_Mountain", "America/Denver",
"Antarctica/Palmer", "Chile", "America/Santiago",
"Europe/Stockholm", "Europe_Central", "Europe/Paris",
"America/Bahia", "Brasilia", "America/Sao_Paulo",
"America/Danmarkshavn", "GMT", "Atlantic/Reykjavik",
"Indian/Mauritius", "Mauritius", "Indian/Mauritius",
"Pacific/Chatham", "Chatham", "Pacific/Chatham",
"Europe/Prague", "Europe_Central", "Europe/Paris",
"America/Blanc-Sablon", "Atlantic", "America/Halifax",
"America/Bogota", "Colombia", "America/Bogota",
"America/Managua", "America_Central", "America/Chicago",
"Pacific/Auckland", "New_Zealand", "Pacific/Auckland",
"Atlantic/Faroe", "Europe_Western", "Atlantic/Canary",
"America/Cambridge_Bay", "America_Mountain", "America/Denver",
"America/Los_Angeles", "America_Pacific", "America/Los_Angeles",
"Africa/Khartoum", "Africa_Central", "Africa/Maputo",
"Europe/Simferopol", "Europe_Eastern", "Europe/Bucharest",
"Australia/Currie", "Australia_Eastern", "Australia/Sydney",
"Europe/Guernsey", "GMT", "Atlantic/Reykjavik",
"Asia/Thimphu", "Bhutan", "Asia/Thimphu",
"America/Eirunepe", "Amazon", "America/Manaus",
"Africa/Nairobi", "Africa_Eastern", "Africa/Nairobi",
"Asia/Yakutsk", "Yakutsk", "Asia/Yakutsk",
"Asia/Yangon", "Myanmar", "Asia/Rangoon",
"America/Goose_Bay", "Atlantic", "America/Halifax",
"Africa/Maseru", "Africa_Southern", "Africa/Johannesburg",
"America/Swift_Current", "America_Central", "America/Chicago",
"America/Guyana", "Guyana", "America/Guyana",
"Asia/Tokyo", "Japan", "Asia/Tokyo",
"Indian/Kerguelen", "French_Southern", "Indian/Kerguelen",
"America/Belem", "Brasilia", "America/Sao_Paulo",
"Pacific/Wallis", "Wallis", "Pacific/Wallis",
"America/Whitehorse", "America_Pacific", "America/Los_Angeles",
"America/North_Dakota/Beulah", "America_Central", "America/Chicago",
"Asia/Jerusalem", "Israel", "Asia/Jerusalem",
"Antarctica/Syowa", "Syowa", "Antarctica/Syowa",
"America/Thunder_Bay", "America_Eastern", "America/New_York",
"Asia/Brunei", "Brunei", "Asia/Brunei",
"America/Metlakatla", "America_Pacific", "America/Los_Angeles",
"Asia/Dushanbe", "Tajikistan", "Asia/Dushanbe",
"Pacific/Kosrae", "Kosrae", "Pacific/Kosrae",
"America/Coral_Harbour", "America_Eastern", "America/New_York",
"America/Tortola", "Atlantic", "America/Halifax",
"Asia/Karachi", "Pakistan", "Asia/Karachi",
"Indian/Reunion", "Reunion", "Indian/Reunion",
"America/Detroit", "America_Eastern", "America/New_York",
"Australia/Eucla", "Australia_CentralWestern", "Australia/Eucla",
"Asia/Seoul", "Korea", "Asia/Seoul",
"Asia/Singapore", "Singapore", "Asia/Singapore",
"Africa/Casablanca", "Europe_Western", "Atlantic/Canary",
"Asia/Dili", "East_Timor", "Asia/Dili",
"America/Indiana/Vincennes", "America_Eastern", "America/New_York",
"Europe/Dublin", "GMT", "Atlantic/Reykjavik",
"America/St_Johns", "Newfoundland", "America/St_Johns",
"Antarctica/Macquarie", "Macquarie", "Antarctica/Macquarie",
"America/Port_of_Spain", "Atlantic", "America/Halifax",
"Europe/Budapest", "Europe_Central", "Europe/Paris",
"America/Fortaleza", "Brasilia", "America/Sao_Paulo",
"Australia/Brisbane", "Australia_Eastern", "Australia/Sydney",
"Atlantic/Bermuda", "Atlantic", "America/Halifax",
"Asia/Amman", "Europe_Eastern", "Europe/Bucharest",
"Asia/Tashkent", "Uzbekistan", "Asia/Tashkent",
"Antarctica/DumontDUrville", "DumontDUrville", "Antarctica/DumontDUrville",
"Antarctica/Casey", "Australia_Western", "Australia/Perth",
"Asia/Vientiane", "Indochina", "Asia/Saigon",
"Pacific/Johnston", "Hawaii_Aleutian", "Pacific/Honolulu",
"America/Jamaica", "America_Eastern", "America/New_York",
"Africa/Addis_Ababa", "Africa_Eastern", "Africa/Nairobi",
"Pacific/Ponape", "Ponape", "Pacific/Ponape",
"Europe/Jersey", "GMT", "Atlantic/Reykjavik",
"Africa/Lome", "GMT", "Atlantic/Reykjavik",
"America/Manaus", "Amazon", "America/Manaus",
"Africa/Niamey", "Africa_Western", "Africa/Lagos",
"Asia/Kashgar", "China", "Asia/Shanghai",
"Pacific/Tongatapu", "Tonga", "Pacific/Tongatapu",
"Europe/Minsk", "Europe_Eastern", "Europe/Bucharest",
"America/Edmonton", "America_Mountain", "America/Denver",
"Asia/Baghdad", "Arabian", "Asia/Riyadh",
"Asia/Kathmandu", "Nepal", "Asia/Katmandu",
"America/Ojinaga", "America_Mountain", "America/Denver",
"Africa/Abidjan", "GMT", "Atlantic/Reykjavik",
"America/Indiana/Winamac", "America_Eastern", "America/New_York",
"Asia/Qyzylorda", "Kazakhstan_Eastern", "Asia/Almaty",
"Australia/Sydney", "Australia_Eastern", "Australia/Sydney",
"Asia/Ashgabat", "Turkmenistan", "Asia/Ashgabat",
"Europe/Amsterdam", "Europe_Central", "Europe/Paris",
"America/Dawson_Creek", "America_Mountain", "America/Denver",
"Africa/Cairo", "Europe_Eastern", "Europe/Bucharest",
"Asia/Pyongyang", "Korea", "Asia/Seoul",
"Africa/Kampala", "Africa_Eastern", "Africa/Nairobi",
"America/Araguaina", "Brasilia", "America/Sao_Paulo",
"Asia/Novokuznetsk", "Novosibirsk", "Asia/Novosibirsk",
"Pacific/Kwajalein", "Marshall_Islands", "Pacific/Majuro",
"Africa/Lubumbashi", "Africa_Central", "Africa/Maputo",
"Asia/Sakhalin", "Sakhalin", "Asia/Sakhalin",
"America/Indiana/Vevay", "America_Eastern", "America/New_York",
"Africa/Maputo", "Africa_Central", "Africa/Maputo",
"Atlantic/Faeroe", "Europe_Western", "Atlantic/Canary",
"America/North_Dakota/Center", "America_Central", "America/Chicago",
"Pacific/Wake", "Wake", "Pacific/Wake",
"Pacific/Pago_Pago", "Samoa", "Pacific/Apia",
"America/Moncton", "Atlantic", "America/Halifax",
"Africa/Sao_Tome", "Africa_Western", "Africa/Lagos",
"America/Glace_Bay", "Atlantic", "America/Halifax",
"Asia/Jakarta", "Indonesia_Western", "Asia/Jakarta",
"Africa/Asmera", "Africa_Eastern", "Africa/Nairobi",
"Europe/Lisbon", "Europe_Western", "Atlantic/Canary",
"America/Dawson", "America_Pacific", "America/Los_Angeles",
"America/Cayenne", "French_Guiana", "America/Cayenne",
"Asia/Bahrain", "Arabian", "Asia/Riyadh",
"Europe/Malta", "Europe_Central", "Europe/Paris",
"America/Indiana/Tell_City", "America_Central", "America/Chicago",
"America/Indiana/Petersburg", "America_Eastern", "America/New_York",
"Antarctica/Rothera", "Rothera", "Antarctica/Rothera",
"Asia/Aqtobe", "Kazakhstan_Western", "Asia/Aqtobe",
"Europe/Vaduz", "Europe_Central", "Europe/Paris",
"America/Indiana/Marengo", "America_Eastern", "America/New_York",
"Europe/Brussels", "Europe_Central", "Europe/Paris",
"Europe/Andorra", "Europe_Central", "Europe/Paris",
"America/Indiana/Knox", "America_Central", "America/Chicago",
"Pacific/Easter", "Easter", "Pacific/Easter",
"America/Argentina/Rio_Gallegos", "Argentina", "America/Buenos_Aires",
"Asia/Oral", "Kazakhstan_Western", "Asia/Aqtobe",
"Europe/Copenhagen", "Europe_Central", "Europe/Paris",
"Africa/Johannesburg", "Africa_Southern", "Africa/Johannesburg",
"Pacific/Pohnpei", "Ponape", "Pacific/Ponape",
"America/Argentina/Tucuman", "Argentina", "America/Buenos_Aires",
"America/Toronto", "America_Eastern", "America/New_York",
"Asia/Makassar", "Indonesia_Central", "Asia/Makassar",
"Europe/Berlin", "Europe_Central", "Europe/Paris",
"America/Argentina/Mendoza", "Argentina", "America/Buenos_Aires",
"America/Cuiaba", "Amazon", "America/Manaus",
"America/Creston", "America_Mountain", "America/Denver",
"Asia/Samarkand", "Uzbekistan", "Asia/Tashkent",
"Asia/Hovd", "Hovd", "Asia/Hovd",
"Europe/Bratislava", "Europe_Central", "Europe/Paris",
"Africa/Accra", "GMT", "Atlantic/Reykjavik",
"Africa/Douala", "Africa_Western", "Africa/Lagos",
"Africa/Nouakchott", "GMT", "Atlantic/Reykjavik",
"Europe/Sofia", "Europe_Eastern", "Europe/Bucharest",
"Antarctica/Davis", "Davis", "Antarctica/Davis",
"Antarctica/McMurdo", "New_Zealand", "Pacific/Auckland",
"Europe/San_Marino", "Europe_Central", "Europe/Paris",
"Africa/Porto-Novo", "Africa_Western", "Africa/Lagos",
"Asia/Jayapura", "Indonesia_Eastern", "Asia/Jayapura",
"America/St_Lucia", "Atlantic", "America/Halifax",
"America/Nipigon", "America_Eastern", "America/New_York",
"America/Argentina/Catamarca", "Argentina", "America/Buenos_Aires",
"Europe/Isle_of_Man", "GMT", "Atlantic/Reykjavik",
"America/Kentucky/Louisville", "America_Eastern", "America/New_York",
"America/Merida", "America_Central", "America/Chicago",
"Pacific/Marquesas", "Marquesas", "Pacific/Marquesas",
"Asia/Magadan", "Magadan", "Asia/Magadan",
"Africa/Libreville", "Africa_Western", "Africa/Lagos",
"Pacific/Efate", "Vanuatu", "Pacific/Efate",
"Asia/Kuala_Lumpur", "Malaysia", "Asia/Kuching",
"America/Iqaluit", "America_Eastern", "America/New_York",
"Indian/Comoro", "Africa_Eastern", "Africa/Nairobi",
"America/Panama", "America_Eastern", "America/New_York",
"Asia/Hebron", "Europe_Eastern", "Europe/Bucharest",
"America/Jujuy", "Argentina", "America/Buenos_Aires",
"America/Pangnirtung", "America_Eastern", "America/New_York",
"Asia/Tbilisi", "Georgia", "Asia/Tbilisi",
"Europe/Podgorica", "Europe_Central", "Europe/Paris",
"America/Boise", "America_Mountain", "America/Denver",
"Asia/Muscat", "Gulf", "Asia/Dubai",
"Indian/Mahe", "Seychelles", "Indian/Mahe",
"America/Montreal", "America_Eastern", "America/New_York",
"Africa/Bangui", "Africa_Western", "Africa/Lagos",
"America/Curacao", "Atlantic", "America/Halifax",
"Asia/Taipei", "Taipei", "Asia/Taipei",
"Europe/Ljubljana", "Europe_Central", "Europe/Paris",
"Atlantic/Stanley", "Falkland", "Atlantic/Stanley",
"Pacific/Guadalcanal", "Solomon", "Pacific/Guadalcanal",
"Asia/Kuwait", "Arabian", "Asia/Riyadh",
"Asia/Riyadh", "Arabian", "Asia/Riyadh",
"Europe/Tallinn", "Europe_Eastern", "Europe/Bucharest",
"America/New_York", "America_Eastern", "America/New_York",
"America/Paramaribo", "Suriname", "America/Paramaribo",
"America/Argentina/Buenos_Aires", "Argentina", "America/Buenos_Aires",
"Asia/Irkutsk", "Irkutsk", "Asia/Irkutsk",
"Asia/Katmandu", "Nepal", "Asia/Katmandu",
"America/Kralendijk", "Atlantic", "America/Halifax",
};
private static final String[] mzoneMap = new String[] {
"GMT", "ML", "Africa/Bamako",
"GMT", "IE", "Europe/Dublin",
"GMT", "SN", "Africa/Dakar",
"GMT", "GH", "Africa/Accra",
"GMT", "CI", "Africa/Abidjan",
"GMT", "BF", "Africa/Ouagadougou",
"GMT", "MR", "Africa/Nouakchott",
"GMT", "GM", "Africa/Banjul",
"GMT", "SL", "Africa/Freetown",
"GMT", "GN", "Africa/Conakry",
"GMT", "SH", "Atlantic/St_Helena",
"GMT", "GB", "Europe/London",
"GMT", "LR", "Africa/Monrovia",
"GMT", "TG", "Africa/Lome",
"Africa_Western", "ST", "Africa/Sao_Tome",
"Africa_Western", "CF", "Africa/Bangui",
"Africa_Western", "NE", "Africa/Niamey",
"Africa_Western", "CM", "Africa/Douala",
"Africa_Western", "CD", "Africa/Kinshasa",
"Africa_Western", "CG", "Africa/Brazzaville",
"Africa_Western", "GA", "Africa/Libreville",
"Africa_Western", "TD", "Africa/Ndjamena",
"Africa_Western", "AO", "Africa/Luanda",
"Africa_Western", "GQ", "Africa/Malabo",
"Africa_Eastern", "YT", "Indian/Mayotte",
"Africa_Eastern", "UG", "Africa/Kampala",
"Africa_Eastern", "ET", "Africa/Addis_Ababa",
"Africa_Eastern", "MG", "Indian/Antananarivo",
"Africa_Eastern", "TZ", "Africa/Dar_es_Salaam",
"Africa_Eastern", "SO", "Africa/Mogadishu",
"Africa_Eastern", "ER", "Africa/Asmera",
"Africa_Eastern", "KM", "Indian/Comoro",
"Africa_Eastern", "DJ", "Africa/Djibouti",
"Europe_Central", "GI", "Europe/Gibraltar",
"Europe_Central", "DK", "Europe/Copenhagen",
"Europe_Central", "SE", "Europe/Stockholm",
"Europe_Central", "CH", "Europe/Zurich",
"Europe_Central", "AL", "Europe/Tirane",
"Europe_Central", "RS", "Europe/Belgrade",
"Europe_Central", "HU", "Europe/Budapest",
"Europe_Central", "MT", "Europe/Malta",
"Europe_Central", "PL", "Europe/Warsaw",
"Europe_Central", "ME", "Europe/Podgorica",
"Europe_Central", "ES", "Europe/Madrid",
"Europe_Central", "CZ", "Europe/Prague",
"Europe_Central", "IT", "Europe/Rome",
"Europe_Central", "SI", "Europe/Ljubljana",
"Europe_Central", "LI", "Europe/Vaduz",
"Europe_Central", "AT", "Europe/Vienna",
"Europe_Central", "VA", "Europe/Vatican",
"Europe_Central", "DE", "Europe/Berlin",
"Europe_Central", "NO", "Europe/Oslo",
"Europe_Central", "SK", "Europe/Bratislava",
"Europe_Central", "AD", "Europe/Andorra",
"Europe_Central", "SM", "Europe/San_Marino",
"Europe_Central", "MK", "Europe/Skopje",
"Europe_Central", "TN", "Africa/Tunis",
"Europe_Central", "HR", "Europe/Zagreb",
"Europe_Central", "NL", "Europe/Amsterdam",
"Europe_Central", "BE", "Europe/Brussels",
"Europe_Central", "MC", "Europe/Monaco",
"Europe_Central", "LU", "Europe/Luxembourg",
"Europe_Central", "BA", "Europe/Sarajevo",
"China", "MO", "Asia/Macau",
"America_Pacific", "MX", "America/Tijuana",
"America_Pacific", "CA", "America/Vancouver",
"Indochina", "LA", "Asia/Vientiane",
"Indochina", "KH", "Asia/Phnom_Penh",
"Indochina", "TH", "Asia/Bangkok",
"Korea", "KP", "Asia/Pyongyang",
"America_Mountain", "MX", "America/Hermosillo",
"America_Mountain", "CA", "America/Edmonton",
"Africa_Southern", "LS", "Africa/Maseru",
"Africa_Southern", "SZ", "Africa/Mbabane",
"Chile", "AQ", "Antarctica/Palmer",
"New_Zealand", "AQ", "Antarctica/McMurdo",
"Gulf", "OM", "Asia/Muscat",
"Europe_Western", "FO", "Atlantic/Faeroe",
"America_Eastern", "TC", "America/Grand_Turk",
"America_Eastern", "CA", "America/Toronto",
"America_Eastern", "BS", "America/Nassau",
"America_Eastern", "PA", "America/Panama",
"America_Eastern", "JM", "America/Jamaica",
"America_Eastern", "KY", "America/Cayman",
"Africa_Central", "BI", "Africa/Bujumbura",
"Africa_Central", "ZM", "Africa/Lusaka",
"Africa_Central", "ZW", "Africa/Harare",
"Africa_Central", "CD", "Africa/Lubumbashi",
"Africa_Central", "BW", "Africa/Gaborone",
"Africa_Central", "RW", "Africa/Kigali",
"Africa_Central", "MW", "Africa/Blantyre",
"America_Central", "MX", "America/Mexico_City",
"America_Central", "HN", "America/Tegucigalpa",
"America_Central", "CA", "America/Winnipeg",
"America_Central", "GT", "America/Guatemala",
"America_Central", "SV", "America/El_Salvador",
"America_Central", "CR", "America/Costa_Rica",
"America_Central", "BZ", "America/Belize",
"Atlantic", "MS", "America/Montserrat",
"Atlantic", "AG", "America/Antigua",
"Atlantic", "TT", "America/Port_of_Spain",
"Atlantic", "MQ", "America/Martinique",
"Atlantic", "DM", "America/Dominica",
"Atlantic", "KN", "America/St_Kitts",
"Atlantic", "BM", "Atlantic/Bermuda",
"Atlantic", "PR", "America/Puerto_Rico",
"Atlantic", "AW", "America/Aruba",
"Atlantic", "VG", "America/Tortola",
"Atlantic", "GD", "America/Grenada",
"Atlantic", "GL", "America/Thule",
"Atlantic", "BB", "America/Barbados",
"Atlantic", "BQ", "America/Kralendijk",
"Atlantic", "SX", "America/Lower_Princes",
"Atlantic", "VI", "America/St_Thomas",
"Atlantic", "MF", "America/Marigot",
"Atlantic", "AI", "America/Anguilla",
"Atlantic", "AN", "America/Curacao",
"Atlantic", "LC", "America/St_Lucia",
"Atlantic", "GP", "America/Guadeloupe",
"Atlantic", "VC", "America/St_Vincent",
"Arabian", "QA", "Asia/Qatar",
"Arabian", "YE", "Asia/Aden",
"Arabian", "KW", "Asia/Kuwait",
"Arabian", "BH", "Asia/Bahrain",
"Arabian", "IQ", "Asia/Baghdad",
"India", "LK", "Asia/Colombo",
"Europe_Eastern", "SY", "Asia/Damascus",
"Europe_Eastern", "BG", "Europe/Sofia",
"Europe_Eastern", "GR", "Europe/Athens",
"Europe_Eastern", "JO", "Asia/Amman",
"Europe_Eastern", "CY", "Asia/Nicosia",
"Europe_Eastern", "AX", "Europe/Mariehamn",
"Europe_Eastern", "LB", "Asia/Beirut",
"Europe_Eastern", "FI", "Europe/Helsinki",
"Europe_Eastern", "EG", "Africa/Cairo",
"Chamorro", "GU", "Pacific/Guam",
};
private static final String[] aliasMap = new String[] {
"Brazil/Acre", "America/Rio_Branco",
"US/Indiana-Starke", "America/Indiana/Knox",
"America/Atka", "America/Adak",
"America/St_Barthelemy", "America/Guadeloupe",
"Australia/North", "Australia/Darwin",
"Europe/Zagreb", "Europe/Belgrade",
"Etc/Universal", "Etc/UTC",
"NZ-CHAT", "Pacific/Chatham",
"Asia/Macao", "Asia/Macau",
"Pacific/Yap", "Pacific/Chuuk",
"Egypt", "Africa/Cairo",
"US/Central", "America/Chicago",
"Canada/Atlantic", "America/Halifax",
"Brazil/East", "America/Sao_Paulo",
"America/Cordoba", "America/Argentina/Cordoba",
"US/Hawaii", "Pacific/Honolulu",
"America/Louisville", "America/Kentucky/Louisville",
"America/Shiprock", "America/Denver",
"Australia/Canberra", "Australia/Sydney",
"Asia/Chungking", "Asia/Chongqing",
"Universal", "Etc/UTC",
"US/Alaska", "America/Anchorage",
"Asia/Ujung_Pandang", "Asia/Makassar",
"Japan", "Asia/Tokyo",
"Atlantic/Faeroe", "Atlantic/Faroe",
"Asia/Istanbul", "Europe/Istanbul",
"US/Pacific", "America/Los_Angeles",
"Mexico/General", "America/Mexico_City",
"Poland", "Europe/Warsaw",
"Africa/Asmera", "Africa/Asmara",
"Asia/Saigon", "Asia/Ho_Chi_Minh",
"US/Michigan", "America/Detroit",
"America/Argentina/ComodRivadavia", "America/Argentina/Catamarca",
"W-SU", "Europe/Moscow",
"Australia/ACT", "Australia/Sydney",
"Asia/Calcutta", "Asia/Kolkata",
"Arctic/Longyearbyen", "Europe/Oslo",
"America/Knox_IN", "America/Indiana/Knox",
"ROC", "Asia/Taipei",
"Zulu", "Etc/UTC",
"Australia/Yancowinna", "Australia/Broken_Hill",
"Australia/West", "Australia/Perth",
"Singapore", "Asia/Singapore",
"Europe/Mariehamn", "Europe/Helsinki",
"ROK", "Asia/Seoul",
"America/Porto_Acre", "America/Rio_Branco",
"Etc/Zulu", "Etc/UTC",
"Canada/Yukon", "America/Whitehorse",
"Europe/Vatican", "Europe/Rome",
"Africa/Timbuktu", "Africa/Bamako",
"America/Buenos_Aires", "America/Argentina/Buenos_Aires",
"Canada/Pacific", "America/Vancouver",
"US/Pacific-New", "America/Los_Angeles",
"Mexico/BajaNorte", "America/Tijuana",
"Europe/Guernsey", "Europe/London",
"Asia/Tel_Aviv", "Asia/Jerusalem",
"Chile/Continental", "America/Santiago",
"Jamaica", "America/Jamaica",
"Mexico/BajaSur", "America/Mazatlan",
"Canada/Eastern", "America/Toronto",
"Australia/Tasmania", "Australia/Hobart",
"NZ", "Pacific/Auckland",
"America/Lower_Princes", "America/Curacao",
"GMT-", "Etc/GMT",
"America/Rosario", "America/Argentina/Cordoba",
"Libya", "Africa/Tripoli",
"Asia/Ashkhabad", "Asia/Ashgabat",
"Australia/NSW", "Australia/Sydney",
"America/Marigot", "America/Guadeloupe",
"Europe/Bratislava", "Europe/Prague",
"Portugal", "Europe/Lisbon",
"Etc/GMT-", "Etc/GMT",
"Europe/San_Marino", "Europe/Rome",
"Europe/Sarajevo", "Europe/Belgrade",
"Antarctica/South_Pole", "Antarctica/McMurdo",
"Canada/Central", "America/Winnipeg",
"Etc/GMT", "Etc/GMT",
"Europe/Isle_of_Man", "Europe/London",
"America/Fort_Wayne", "America/Indiana/Indianapolis",
"Eire", "Europe/Dublin",
"America/Coral_Harbour", "America/Atikokan",
"Europe/Nicosia", "Asia/Nicosia",
"US/Samoa", "Pacific/Pago_Pago",
"Hongkong", "Asia/Hong_Kong",
"Canada/Saskatchewan", "America/Regina",
"Asia/Thimbu", "Asia/Thimphu",
"Kwajalein", "Pacific/Kwajalein",
"GB", "Europe/London",
"Chile/EasterIsland", "Pacific/Easter",
"US/East-Indiana", "America/Indiana/Indianapolis",
"Australia/LHI", "Australia/Lord_Howe",
"Cuba", "America/Havana",
"America/Jujuy", "America/Argentina/Jujuy",
"US/Mountain", "America/Denver",
"Atlantic/Jan_Mayen", "Europe/Oslo",
"Europe/Tiraspol", "Europe/Chisinau",
"Europe/Podgorica", "Europe/Belgrade",
"US/Arizona", "America/Phoenix",
"Navajo", "America/Denver",
"Etc/Greenwich", "Etc/GMT",
"Canada/Mountain", "America/Edmonton",
"Iceland", "Atlantic/Reykjavik",
"Australia/Victoria", "Australia/Melbourne",
"Australia/South", "Australia/Adelaide",
"Brazil/West", "America/Manaus",
"Pacific/Ponape", "Pacific/Pohnpei",
"Europe/Ljubljana", "Europe/Belgrade",
"Europe/Jersey", "Europe/London",
"Australia/Queensland", "Australia/Brisbane",
"UTC", "Etc/UTC",
"Canada/Newfoundland", "America/St_Johns",
"Europe/Skopje", "Europe/Belgrade",
"PRC", "Asia/Shanghai",
"UCT", "Etc/UCT",
"America/Mendoza", "America/Argentina/Mendoza",
"Israel", "Asia/Jerusalem",
"US/Eastern", "America/New_York",
"Asia/Ulan_Bator", "Asia/Ulaanbaatar",
"Turkey", "Europe/Istanbul",
"GMT", "Etc/GMT",
"US/Aleutian", "America/Adak",
"Brazil/DeNoronha", "America/Noronha",
"GB-Eire", "Europe/London",
"Asia/Dacca", "Asia/Dhaka",
"America/Ensenada", "America/Tijuana",
"America/Catamarca", "America/Argentina/Catamarca",
"Iran", "Asia/Tehran",
"Greenwich", "Etc/GMT",
"Pacific/Truk", "Pacific/Chuuk",
"Pacific/Samoa", "Pacific/Pago_Pago",
"America/Virgin", "America/St_Thomas",
"Asia/Katmandu", "Asia/Kathmandu",
"America/Indianapolis", "America/Indiana/Indianapolis",
"Europe/Belfast", "Europe/London",
"America/Kralendijk", "America/Curacao",
"Asia/Rangoon", "Asia/Yangon",
};
private static final Map<String, String> zidToMzone = new HashMap<>();
private static final Map<String, String> mzoneToZid = new HashMap<>();
private static final Map<String, Map<String, String>> mzoneToZidL = new HashMap<>();
private static final Map<String, String> aliases = new HashMap<>();
static {
for (int i = 0; i < zidMap.length; i += 3) {
zidToMzone.put(zidMap[i], zidMap[i + 1]);
mzoneToZid.put(zidMap[i + 1], zidMap[i + 2]);
}
for (int i = 0; i < mzoneMap.length; i += 3) {
String mzone = mzoneMap[i];
Map<String, String> map = mzoneToZidL.get(mzone);
if (map == null) {
map = new HashMap<>();
mzoneToZidL.put(mzone, map);
}
map.put(mzoneMap[i + 1], mzoneMap[i + 2]);
}
for (int i = 0; i < aliasMap.length; i += 2) {
aliases.put(aliasMap[i], aliasMap[i + 1]);
}
}
}

View File

@ -0,0 +1,249 @@
/*
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package java.time.format;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
/**
* A helper class to map a zone name to metazone and back to the
* appropriate zone id for the particular locale.
* <p>
* The zid<->metazone mappings are based on CLDR metaZones.xml.
* The alias mappings are based on Link entries in tzdb data files and
* CLDR's supplementalMetadata.xml.
*/
class ZoneName {
public static String toZid(String zid, Locale locale) {
String mzone = zidToMzone.get(zid);
if (mzone == null && aliases.containsKey(zid)) {
zid = aliases.get(zid);
mzone = zidToMzone.get(zid);
}
if (mzone != null) {
Map<String, String> map = mzoneToZidL.get(mzone);
if (map != null && map.containsKey(locale.getCountry())) {
zid = map.get(locale.getCountry());
} else {
zid = mzoneToZid.get(mzone);
}
}
return toZid(zid);
}
public static String toZid(String zid) {
if (aliases.containsKey(zid)) {
return aliases.get(zid);
}
return zid;
}
private static final String[] zidMap = new String[] {
// From metaZones.xml
%%%%ZIDMAP%%%%
// From tzdb
"Africa/Khartoum", "Africa_Central", "Africa/Maputo", // tzdata2017c
"Africa/Windhoek", "Africa_Central", "Africa/Maputo", // tzdata2017c
"Africa/Sao_Tome", "Africa_Western", "Africa/Lagos", // tzdata2018c
};
private static final String[] mzoneMap = new String[] {
// From metaZones.xml
%%%%MZONEMAP%%%%
// From tzdb
"Africa_Western", "ST", "Africa/Sao_Tome", // tzdata2018c
};
private static final String[] aliasMap = new String[] {
// From supplementalMetadata.xml
%%%%DEPRECATED%%%%
// From tzdb
"Brazil/Acre", "America/Rio_Branco",
"US/Indiana-Starke", "America/Indiana/Knox",
"America/Atka", "America/Adak",
"America/St_Barthelemy", "America/Guadeloupe",
"Australia/North", "Australia/Darwin",
"Europe/Zagreb", "Europe/Belgrade",
"Etc/Universal", "Etc/UTC",
"NZ-CHAT", "Pacific/Chatham",
"Asia/Macao", "Asia/Macau",
"Pacific/Yap", "Pacific/Chuuk",
"Egypt", "Africa/Cairo",
"US/Central", "America/Chicago",
"Canada/Atlantic", "America/Halifax",
"Brazil/East", "America/Sao_Paulo",
"America/Cordoba", "America/Argentina/Cordoba",
"US/Hawaii", "Pacific/Honolulu",
"America/Louisville", "America/Kentucky/Louisville",
"America/Shiprock", "America/Denver",
"Australia/Canberra", "Australia/Sydney",
"Asia/Chungking", "Asia/Chongqing",
"Universal", "Etc/UTC",
"US/Alaska", "America/Anchorage",
"Asia/Ujung_Pandang", "Asia/Makassar",
"Japan", "Asia/Tokyo",
"Atlantic/Faeroe", "Atlantic/Faroe",
"Asia/Istanbul", "Europe/Istanbul",
"US/Pacific", "America/Los_Angeles",
"Mexico/General", "America/Mexico_City",
"Poland", "Europe/Warsaw",
"Africa/Asmera", "Africa/Asmara",
"Asia/Saigon", "Asia/Ho_Chi_Minh",
"US/Michigan", "America/Detroit",
"America/Argentina/ComodRivadavia", "America/Argentina/Catamarca",
"W-SU", "Europe/Moscow",
"Australia/ACT", "Australia/Sydney",
"Asia/Calcutta", "Asia/Kolkata",
"Arctic/Longyearbyen", "Europe/Oslo",
"America/Knox_IN", "America/Indiana/Knox",
"ROC", "Asia/Taipei",
"Zulu", "Etc/UTC",
"Australia/Yancowinna", "Australia/Broken_Hill",
"Australia/West", "Australia/Perth",
"Singapore", "Asia/Singapore",
"Europe/Mariehamn", "Europe/Helsinki",
"ROK", "Asia/Seoul",
"America/Porto_Acre", "America/Rio_Branco",
"Etc/Zulu", "Etc/UTC",
"Canada/Yukon", "America/Whitehorse",
"Europe/Vatican", "Europe/Rome",
"Africa/Timbuktu", "Africa/Bamako",
"America/Buenos_Aires", "America/Argentina/Buenos_Aires",
"Canada/Pacific", "America/Vancouver",
"US/Pacific-New", "America/Los_Angeles",
"Mexico/BajaNorte", "America/Tijuana",
"Europe/Guernsey", "Europe/London",
"Asia/Tel_Aviv", "Asia/Jerusalem",
"Chile/Continental", "America/Santiago",
"Jamaica", "America/Jamaica",
"Mexico/BajaSur", "America/Mazatlan",
"Canada/Eastern", "America/Toronto",
"Australia/Tasmania", "Australia/Hobart",
"NZ", "Pacific/Auckland",
"America/Lower_Princes", "America/Curacao",
"GMT-", "Etc/GMT",
"America/Rosario", "America/Argentina/Cordoba",
"Libya", "Africa/Tripoli",
"Asia/Ashkhabad", "Asia/Ashgabat",
"Australia/NSW", "Australia/Sydney",
"America/Marigot", "America/Guadeloupe",
"Europe/Bratislava", "Europe/Prague",
"Portugal", "Europe/Lisbon",
"Etc/GMT-", "Etc/GMT",
"Europe/San_Marino", "Europe/Rome",
"Europe/Sarajevo", "Europe/Belgrade",
"Antarctica/South_Pole", "Antarctica/McMurdo",
"Canada/Central", "America/Winnipeg",
"Etc/GMT", "Etc/GMT",
"Europe/Isle_of_Man", "Europe/London",
"America/Fort_Wayne", "America/Indiana/Indianapolis",
"Eire", "Europe/Dublin",
"America/Coral_Harbour", "America/Atikokan",
"Europe/Nicosia", "Asia/Nicosia",
"US/Samoa", "Pacific/Pago_Pago",
"Hongkong", "Asia/Hong_Kong",
"Canada/Saskatchewan", "America/Regina",
"Asia/Thimbu", "Asia/Thimphu",
"Kwajalein", "Pacific/Kwajalein",
"GB", "Europe/London",
"Chile/EasterIsland", "Pacific/Easter",
"US/East-Indiana", "America/Indiana/Indianapolis",
"Australia/LHI", "Australia/Lord_Howe",
"Cuba", "America/Havana",
"America/Jujuy", "America/Argentina/Jujuy",
"US/Mountain", "America/Denver",
"Atlantic/Jan_Mayen", "Europe/Oslo",
"Europe/Tiraspol", "Europe/Chisinau",
"Europe/Podgorica", "Europe/Belgrade",
"US/Arizona", "America/Phoenix",
"Navajo", "America/Denver",
"Etc/Greenwich", "Etc/GMT",
"Canada/Mountain", "America/Edmonton",
"Iceland", "Atlantic/Reykjavik",
"Australia/Victoria", "Australia/Melbourne",
"Australia/South", "Australia/Adelaide",
"Brazil/West", "America/Manaus",
"Pacific/Ponape", "Pacific/Pohnpei",
"Europe/Ljubljana", "Europe/Belgrade",
"Europe/Jersey", "Europe/London",
"Australia/Queensland", "Australia/Brisbane",
"UTC", "Etc/UTC",
"Canada/Newfoundland", "America/St_Johns",
"Europe/Skopje", "Europe/Belgrade",
"PRC", "Asia/Shanghai",
"UCT", "Etc/UCT",
"America/Mendoza", "America/Argentina/Mendoza",
"Israel", "Asia/Jerusalem",
"US/Eastern", "America/New_York",
"Asia/Ulan_Bator", "Asia/Ulaanbaatar",
"Turkey", "Europe/Istanbul",
"GMT", "Etc/GMT",
"US/Aleutian", "America/Adak",
"Brazil/DeNoronha", "America/Noronha",
"GB-Eire", "Europe/London",
"Asia/Dacca", "Asia/Dhaka",
"America/Ensenada", "America/Tijuana",
"America/Catamarca", "America/Argentina/Catamarca",
"Iran", "Asia/Tehran",
"Greenwich", "Etc/GMT",
"Pacific/Truk", "Pacific/Chuuk",
"Pacific/Samoa", "Pacific/Pago_Pago",
"America/Virgin", "America/St_Thomas",
"Asia/Katmandu", "Asia/Kathmandu",
"America/Indianapolis", "America/Indiana/Indianapolis",
"Europe/Belfast", "Europe/London",
"America/Kralendijk", "America/Curacao",
"Asia/Rangoon", "Asia/Yangon",
};
private static final Map<String, String> zidToMzone = new HashMap<>();
private static final Map<String, String> mzoneToZid = new HashMap<>();
private static final Map<String, Map<String, String>> mzoneToZidL = new HashMap<>();
private static final Map<String, String> aliases = new HashMap<>();
static {
for (int i = 0; i < zidMap.length; i += 3) {
zidToMzone.put(zidMap[i], zidMap[i + 1]);
mzoneToZid.put(zidMap[i + 1], zidMap[i + 2]);
}
for (int i = 0; i < mzoneMap.length; i += 3) {
String mzone = mzoneMap[i];
Map<String, String> map = mzoneToZidL.get(mzone);
if (map == null) {
map = new HashMap<>();
mzoneToZidL.put(mzone, map);
}
map.put(mzoneMap[i + 1], mzoneMap[i + 2]);
}
for (int i = 0; i < aliasMap.length; i += 2) {
aliases.put(aliasMap[i], aliasMap[i + 1]);
}
}
}

View File

@ -37,7 +37,6 @@ import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.nio.file.attribute.BasicFileAttributes; import java.nio.file.attribute.BasicFileAttributes;
import java.nio.file.Files; import java.nio.file.Files;
import java.util.ArrayDeque; import java.util.ArrayDeque;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -52,13 +51,14 @@ import java.util.Set;
import java.util.Spliterator; import java.util.Spliterator;
import java.util.Spliterators; import java.util.Spliterators;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.function.Function; import java.util.function.Function;
import java.util.function.IntFunction; import java.util.function.IntFunction;
import java.util.jar.JarEntry; import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.stream.Stream; import java.util.stream.Stream;
import java.util.stream.StreamSupport; import java.util.stream.StreamSupport;
import jdk.internal.misc.JavaLangAccess;
import jdk.internal.misc.JavaUtilZipFileAccess; import jdk.internal.misc.JavaUtilZipFileAccess;
import jdk.internal.misc.SharedSecrets; import jdk.internal.misc.SharedSecrets;
import jdk.internal.misc.VM; import jdk.internal.misc.VM;
@ -834,11 +834,10 @@ class ZipFile implements ZipConstants, Closeable {
static CleanableResource get(ZipFile zf, File file, int mode) static CleanableResource get(ZipFile zf, File file, int mode)
throws IOException { throws IOException {
Class<?> clz = zf.getClass(); Class<?> clz = zf.getClass();
while (clz != ZipFile.class) { while (clz != ZipFile.class && clz != JarFile.class) {
try { if (JLA.getDeclaredPublicMethods(clz, "close").size() != 0) {
clz.getDeclaredMethod("close");
return new FinalizableResource(zf, file, mode); return new FinalizableResource(zf, file, mode);
} catch (NoSuchMethodException nsme) {} }
clz = clz.getSuperclass(); clz = clz.getSuperclass();
} }
return new CleanableResource(zf, file, mode); return new CleanableResource(zf, file, mode);
@ -1101,6 +1100,8 @@ class ZipFile implements ZipConstants, Closeable {
} }
private static boolean isWindows; private static boolean isWindows;
private static final JavaLangAccess JLA;
static { static {
SharedSecrets.setJavaUtilZipFileAccess( SharedSecrets.setJavaUtilZipFileAccess(
new JavaUtilZipFileAccess() { new JavaUtilZipFileAccess() {
@ -1133,6 +1134,7 @@ class ZipFile implements ZipConstants, Closeable {
} }
} }
); );
JLA = jdk.internal.misc.SharedSecrets.getJavaLangAccess();
isWindows = VM.getSavedProperty("os.name").contains("Windows"); isWindows = VM.getSavedProperty("os.name").contains("Windows");
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -26,6 +26,7 @@
package jdk.internal.misc; package jdk.internal.misc;
import java.security.AccessControlContext; import java.security.AccessControlContext;
import java.security.PermissionCollection;
import java.security.PrivilegedAction; import java.security.PrivilegedAction;
import java.security.ProtectionDomain; import java.security.ProtectionDomain;
@ -39,4 +40,14 @@ public interface JavaSecurityAccess {
AccessControlContext context); AccessControlContext context);
ProtectionDomain[] getProtectDomains(AccessControlContext context); ProtectionDomain[] getProtectDomains(AccessControlContext context);
interface ProtectionDomainCache {
void put(ProtectionDomain pd, PermissionCollection pc);
PermissionCollection get(ProtectionDomain pd);
}
/**
* Returns the ProtectionDomainCache.
*/
ProtectionDomainCache getProtectionDomainCache();
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -35,7 +35,6 @@ import java.io.FilePermission;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;
import java.io.RandomAccessFile; import java.io.RandomAccessFile;
import java.security.ProtectionDomain; import java.security.ProtectionDomain;
import java.security.AccessController;
/** A repository of "shared secrets", which are a mechanism for /** A repository of "shared secrets", which are a mechanism for
calling implementation-private methods in another package without calling implementation-private methods in another package without
@ -63,7 +62,6 @@ public class SharedSecrets {
private static JavaNioAccess javaNioAccess; private static JavaNioAccess javaNioAccess;
private static JavaIOFileDescriptorAccess javaIOFileDescriptorAccess; private static JavaIOFileDescriptorAccess javaIOFileDescriptorAccess;
private static JavaIOFilePermissionAccess javaIOFilePermissionAccess; private static JavaIOFilePermissionAccess javaIOFilePermissionAccess;
private static JavaSecurityProtectionDomainAccess javaSecurityProtectionDomainAccess;
private static JavaSecurityAccess javaSecurityAccess; private static JavaSecurityAccess javaSecurityAccess;
private static JavaUtilZipFileAccess javaUtilZipFileAccess; private static JavaUtilZipFileAccess javaUtilZipFileAccess;
private static JavaUtilResourceBundleAccess javaUtilResourceBundleAccess; private static JavaUtilResourceBundleAccess javaUtilResourceBundleAccess;
@ -235,25 +233,13 @@ public class SharedSecrets {
return javaIOFileDescriptorAccess; return javaIOFileDescriptorAccess;
} }
public static void setJavaSecurityProtectionDomainAccess
(JavaSecurityProtectionDomainAccess jspda) {
javaSecurityProtectionDomainAccess = jspda;
}
public static JavaSecurityProtectionDomainAccess
getJavaSecurityProtectionDomainAccess() {
if (javaSecurityProtectionDomainAccess == null)
unsafe.ensureClassInitialized(ProtectionDomain.class);
return javaSecurityProtectionDomainAccess;
}
public static void setJavaSecurityAccess(JavaSecurityAccess jsa) { public static void setJavaSecurityAccess(JavaSecurityAccess jsa) {
javaSecurityAccess = jsa; javaSecurityAccess = jsa;
} }
public static JavaSecurityAccess getJavaSecurityAccess() { public static JavaSecurityAccess getJavaSecurityAccess() {
if (javaSecurityAccess == null) { if (javaSecurityAccess == null) {
unsafe.ensureClassInitialized(AccessController.class); unsafe.ensureClassInitialized(ProtectionDomain.class);
} }
return javaSecurityAccess; return javaSecurityAccess;
} }

View File

@ -41,8 +41,8 @@ import java.io.FilePermission;
import java.net.SocketPermission; import java.net.SocketPermission;
import java.net.NetPermission; import java.net.NetPermission;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import jdk.internal.misc.JavaSecurityProtectionDomainAccess; import jdk.internal.misc.JavaSecurityAccess;
import static jdk.internal.misc.JavaSecurityProtectionDomainAccess.ProtectionDomainCache; import static jdk.internal.misc.JavaSecurityAccess.ProtectionDomainCache;
import jdk.internal.misc.SharedSecrets; import jdk.internal.misc.SharedSecrets;
import sun.security.util.*; import sun.security.util.*;
import sun.net.www.ParseUtil; import sun.net.www.ParseUtil;
@ -2202,8 +2202,8 @@ public class PolicyFile extends java.security.Policy {
aliasMapping = Collections.synchronizedMap(new HashMap<>(11)); aliasMapping = Collections.synchronizedMap(new HashMap<>(11));
pdMapping = new ProtectionDomainCache[numCaches]; pdMapping = new ProtectionDomainCache[numCaches];
JavaSecurityProtectionDomainAccess jspda JavaSecurityAccess jspda
= SharedSecrets.getJavaSecurityProtectionDomainAccess(); = SharedSecrets.getJavaSecurityAccess();
for (int i = 0; i < numCaches; i++) { for (int i = 0; i < numCaches; i++) {
pdMapping[i] = jspda.getProtectionDomainCache(); pdMapping[i] = jspda.getProtectionDomainCache();
} }

View File

@ -287,7 +287,12 @@ public class Lint
/** /**
* Warn about potentially unsafe vararg methods * Warn about potentially unsafe vararg methods
*/ */
VARARGS("varargs"); VARARGS("varargs"),
/**
* Warn about use of preview features.
*/
PREVIEW("preview");
LintCategory(String option) { LintCategory(String option) {
this(option, false); this(option, false);

View File

@ -0,0 +1,204 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.tools.javac.code;
import com.sun.tools.javac.code.Lint.LintCategory;
import com.sun.tools.javac.code.Source.Feature;
import com.sun.tools.javac.comp.Infer;
import com.sun.tools.javac.jvm.Target;
import com.sun.tools.javac.resources.CompilerProperties.Errors;
import com.sun.tools.javac.resources.CompilerProperties.Warnings;
import com.sun.tools.javac.util.Assert;
import com.sun.tools.javac.util.Context;
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
import com.sun.tools.javac.util.JCDiagnostic.Error;
import com.sun.tools.javac.util.JCDiagnostic.SimpleDiagnosticPosition;
import com.sun.tools.javac.util.Log;
import com.sun.tools.javac.util.MandatoryWarningHandler;
import com.sun.tools.javac.util.Name;
import com.sun.tools.javac.util.Options;
import javax.tools.JavaFileObject;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import static com.sun.tools.javac.main.Option.PREVIEW;
/**
* Helper class to handle preview language features. This class maps certain language features
* (see {@link Feature} into 'preview' features; the mapping is completely ad-hoc, so as to allow
* for maximum flexibility, which allows to migrate preview feature into supported features with ease.
*
* This class acts as a centralized point against which usages of preview features are reported by
* clients (e.g. other javac classes). Internally, this class collects all such usages and generates
* diagnostics to inform the user of such usages. Such diagnostics can be enabled using the
* {@link LintCategory#PREVIEW} lint category, and are suppressible by usual means.
*/
public class Preview {
/** flag: are preview featutres enabled */
private final boolean enabled;
/** the diag handler to manage preview feature usage diagnostics */
private final MandatoryWarningHandler previewHandler;
/** test flag: should all features be considered as preview features? */
private final boolean forcePreview;
/** a mapping from classfile numbers to Java SE versions */
private final Map<Integer, Source> majorVersionToSource;
private final Lint lint;
private final Log log;
private static final Context.Key<Preview> previewKey = new Context.Key<>();
public static Preview instance(Context context) {
Preview instance = context.get(previewKey);
if (instance == null) {
instance = new Preview(context);
}
return instance;
}
Preview(Context context) {
context.put(previewKey, this);
Options options = Options.instance(context);
enabled = options.isSet(PREVIEW);
log = Log.instance(context);
lint = Lint.instance(context);
this.previewHandler =
new MandatoryWarningHandler(log, lint.isEnabled(LintCategory.PREVIEW), true, "preview", LintCategory.PREVIEW);
forcePreview = options.isSet("forcePreview");
majorVersionToSource = initMajorVersionToSourceMap();
}
private Map<Integer, Source> initMajorVersionToSourceMap() {
Map<Integer, Source> majorVersionToSource = new HashMap<>();
for (Target t : Target.values()) {
int major = t.majorVersion;
Source source = Source.lookup(t.name);
if (source != null) {
majorVersionToSource.put(major, source);
}
}
return majorVersionToSource;
}
/**
* Report usage of a preview feature. Usages reported through this method will affect the
* set of sourcefiles with dependencies on preview features.
* @param pos the position at which the preview feature was used.
* @param feature the preview feature used.
*/
public void warnPreview(int pos, Feature feature) {
warnPreview(new SimpleDiagnosticPosition(pos), feature);
}
/**
* Report usage of a preview feature. Usages reported through this method will affect the
* set of sourcefiles with dependencies on preview features.
* @param pos the position at which the preview feature was used.
* @param feature the preview feature used.
*/
public void warnPreview(DiagnosticPosition pos, Feature feature) {
Assert.check(isEnabled());
Assert.check(isPreview(feature));
if (!lint.isSuppressed(LintCategory.PREVIEW)) {
previewHandler.report(pos, feature.isPlural() ?
Warnings.PreviewFeatureUsePlural(feature.nameFragment()) :
Warnings.PreviewFeatureUse(feature.nameFragment()));
}
}
/**
* Report usage of a preview feature in classfile.
* @param classfile the name of the classfile with preview features enabled
* @param majorVersion the major version found in the classfile.
*/
public void warnPreview(JavaFileObject classfile, int majorVersion) {
Assert.check(isEnabled());
if (!lint.isSuppressed(LintCategory.PREVIEW)) {
previewHandler.report(null,
Warnings.PreviewFeatureUseClassfile(classfile, majorVersionToSource.get(majorVersion).name));
}
}
/**
* Are preview features enabled?
* @return true, if preview features are enabled.
*/
public boolean isEnabled() {
return enabled;
}
/**
* Is given feature a preview feature?
* @param feature the feature to be tested.
* @return true, if given feature is a preview feature.
*/
public boolean isPreview(Feature feature) {
//Note: this is a backdoor which allows to optionally treat all features as 'preview' (for testing).
//When real preview features will be added, this method can be implemented to return 'true'
//for those selected features, and 'false' for all the others.
return forcePreview;
}
/**
* Generate an error key which captures the fact that a given preview feature could not be used
* due to the preview feature support being disabled.
* @param feature the feature for which the diagnostic has to be generated.
* @return the diagnostic.
*/
public Error disabledError(Feature feature) {
Assert.check(!isEnabled());
return feature.isPlural() ?
Errors.PreviewFeatureDisabledPlural(feature.nameFragment()) :
Errors.PreviewFeatureDisabled(feature.nameFragment());
}
/**
* Generate an error key which captures the fact that a preview classfile cannot be loaded
* due to the preview feature support being disabled.
* @param classfile the name of the classfile with preview features enabled
* @param majorVersion the major version found in the classfile.
*/
public Error disabledError(JavaFileObject classfile, int majorVersion) {
Assert.check(!isEnabled());
return Errors.PreviewFeatureDisabledClassfile(classfile, majorVersionToSource.get(majorVersion).name);
}
/**
* Report any deferred diagnostics.
*/
public void reportDeferredDiagnostics() {
previewHandler.reportDeferredDiagnostic();
}
}

View File

@ -217,6 +217,16 @@ public enum Source {
source.compareTo(maxLevel) <= 0; source.compareTo(maxLevel) <= 0;
} }
public boolean isPlural() {
Assert.checkNonNull(optKind);
return optKind == DiagKind.PLURAL;
}
public Fragment nameFragment() {
Assert.checkNonNull(optFragment);
return optFragment;
}
public Fragment fragment(String sourceName) { public Fragment fragment(String sourceName) {
Assert.checkNonNull(optFragment); Assert.checkNonNull(optFragment);
return optKind == DiagKind.NORMAL ? return optKind == DiagKind.NORMAL ?

View File

@ -67,6 +67,7 @@ import static com.sun.tools.javac.code.Flags.*;
import static com.sun.tools.javac.code.Kinds.Kind.*; import static com.sun.tools.javac.code.Kinds.Kind.*;
import static com.sun.tools.javac.code.TypeTag.*; import static com.sun.tools.javac.code.TypeTag.*;
import static com.sun.tools.javac.tree.JCTree.Tag.*; import static com.sun.tools.javac.tree.JCTree.Tag.*;
import static com.sun.tools.javac.jvm.Pool.DynamicMethod;
import javax.lang.model.element.ElementKind; import javax.lang.model.element.ElementKind;
import javax.lang.model.type.TypeKind; import javax.lang.model.type.TypeKind;
@ -208,6 +209,8 @@ public class LambdaToMethod extends TreeTranslator {
private Map<DedupedLambda, DedupedLambda> dedupedLambdas; private Map<DedupedLambda, DedupedLambda> dedupedLambdas;
private Map<DynamicMethod, DynamicMethodSymbol> dynMethSyms = new HashMap<>();
/** /**
* list of deserialization cases * list of deserialization cases
*/ */
@ -1200,9 +1203,10 @@ public class LambdaToMethod extends TreeTranslator {
(MethodSymbol)bsm, (MethodSymbol)bsm,
indyType, indyType,
staticArgs.toArray()); staticArgs.toArray());
JCFieldAccess qualifier = make.Select(make.QualIdent(site.tsym), bsmName); JCFieldAccess qualifier = make.Select(make.QualIdent(site.tsym), bsmName);
qualifier.sym = dynSym; DynamicMethodSymbol existing = kInfo.dynMethSyms.putIfAbsent(
new DynamicMethod(dynSym, types), dynSym);
qualifier.sym = existing != null ? existing : dynSym;
qualifier.type = indyType.getReturnType(); qualifier.type = indyType.getReturnType();
JCMethodInvocation proxyCall = make.Apply(List.nil(), qualifier, indyArgs); JCMethodInvocation proxyCall = make.Apply(List.nil(), qualifier, indyArgs);

View File

@ -2120,6 +2120,7 @@ public class Resolve {
Set<ModuleSymbol> recoverableModules = new HashSet<>(syms.getAllModules()); Set<ModuleSymbol> recoverableModules = new HashSet<>(syms.getAllModules());
recoverableModules.add(syms.unnamedModule);
recoverableModules.remove(env.toplevel.modle); recoverableModules.remove(env.toplevel.modle);
for (ModuleSymbol ms : recoverableModules) { for (ModuleSymbol ms : recoverableModules) {

View File

@ -105,6 +105,8 @@ public class ClassFile {
public final static int MAX_LOCALS = 0xffff; public final static int MAX_LOCALS = 0xffff;
public final static int MAX_STACK = 0xffff; public final static int MAX_STACK = 0xffff;
public final static int PREVIEW_MINOR_VERSION = 0xffff;
public enum Version { public enum Version {
V45_3(45, 3), // base level for all attributes V45_3(45, 3), // base level for all attributes
V49(49, 0), // JDK 1.5: enum, generics, annotations V49(49, 0), // JDK 1.5: enum, generics, annotations

View File

@ -148,6 +148,11 @@ public class ClassReader {
DeferredCompletionFailureHandler dcfh; DeferredCompletionFailureHandler dcfh;
/**
* Support for preview language features.
*/
Preview preview;
/** The current scope where type variables are entered. /** The current scope where type variables are entered.
*/ */
protected WriteableScope typevars; protected WriteableScope typevars;
@ -270,6 +275,7 @@ public class ClassReader {
verbose = options.isSet(Option.VERBOSE); verbose = options.isSet(Option.VERBOSE);
Source source = Source.instance(context); Source source = Source.instance(context);
preview = Preview.instance(context);
allowSimplifiedVarargs = Feature.SIMPLIFIED_VARARGS.allowedInSource(source); allowSimplifiedVarargs = Feature.SIMPLIFIED_VARARGS.allowedInSource(source);
allowModules = Feature.MODULES.allowedInSource(source); allowModules = Feature.MODULES.allowedInSource(source);
@ -2786,6 +2792,14 @@ public class ClassReader {
Integer.toString(maxMinor)); Integer.toString(maxMinor));
} }
if (minorVersion == ClassFile.PREVIEW_MINOR_VERSION) {
if (!preview.isEnabled()) {
log.error(preview.disabledError(currentClassFile, majorVersion));
} else {
preview.warnPreview(c.classfile, majorVersion);
}
}
indexPool(); indexPool();
if (signatureBuffer.length < bp) { if (signatureBuffer.length < bp) {
int ns = Integer.highestOneBit(bp) << 1; int ns = Integer.highestOneBit(bp) << 1;

View File

@ -49,7 +49,6 @@ import com.sun.tools.javac.jvm.Pool.DynamicMethod;
import com.sun.tools.javac.jvm.Pool.Method; import com.sun.tools.javac.jvm.Pool.Method;
import com.sun.tools.javac.jvm.Pool.MethodHandle; import com.sun.tools.javac.jvm.Pool.MethodHandle;
import com.sun.tools.javac.jvm.Pool.Variable; import com.sun.tools.javac.jvm.Pool.Variable;
import com.sun.tools.javac.main.Option;
import com.sun.tools.javac.util.*; import com.sun.tools.javac.util.*;
import static com.sun.tools.javac.code.Flags.*; import static com.sun.tools.javac.code.Flags.*;
@ -89,6 +88,10 @@ public class ClassWriter extends ClassFile {
*/ */
private boolean debugstackmap; private boolean debugstackmap;
/** Preview language level.
*/
private Preview preview;
/** /**
* Target class version. * Target class version.
*/ */
@ -178,6 +181,7 @@ public class ClassWriter extends ClassFile {
log = Log.instance(context); log = Log.instance(context);
names = Names.instance(context); names = Names.instance(context);
options = Options.instance(context); options = Options.instance(context);
preview = Preview.instance(context);
target = Target.instance(context); target = Target.instance(context);
source = Source.instance(context); source = Source.instance(context);
types = Types.instance(context); types = Types.instance(context);
@ -1819,7 +1823,11 @@ public class ClassWriter extends ClassFile {
acount += writeExtraClassAttributes(c); acount += writeExtraClassAttributes(c);
poolbuf.appendInt(JAVA_MAGIC); poolbuf.appendInt(JAVA_MAGIC);
poolbuf.appendChar(target.minorVersion); if (preview.isEnabled()) {
poolbuf.appendChar(ClassFile.PREVIEW_MINOR_VERSION);
} else {
poolbuf.appendChar(target.minorVersion);
}
poolbuf.appendChar(target.majorVersion); poolbuf.appendChar(target.majorVersion);
writePool(c.pool); writePool(c.pool);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -180,10 +180,10 @@ public class Pool {
} }
} }
static class DynamicMethod extends Method { public static class DynamicMethod extends Method {
public Object[] uniqueStaticArgs; public Object[] uniqueStaticArgs;
DynamicMethod(DynamicMethodSymbol m, Types types) { public DynamicMethod(DynamicMethodSymbol m, Types types) {
super(m, types); super(m, types);
uniqueStaticArgs = getUniqueTypeArray(m.staticArgs, types); uniqueStaticArgs = getUniqueTypeArray(m.staticArgs, types);
} }

View File

@ -536,6 +536,20 @@ public class Arguments {
} }
} }
if (options.isSet(Option.PREVIEW)) {
if (sourceString == null) {
//enable-preview must be used with explicit -source or --release
error("err.preview.without.source.or.release");
return false;
} else if (source != Source.DEFAULT) {
//enable-preview must be used with latest source version
error("err.preview.not.latest",
sourceString,
Source.DEFAULT.name);
return false;
}
}
String profileString = options.get(Option.PROFILE); String profileString = options.get(Option.PROFILE);
if (profileString != null) { if (profileString != null) {
Profile profile = Profile.lookup(profileString); Profile profile = Profile.lookup(profileString);

View File

@ -275,6 +275,10 @@ public class JavaCompiler {
*/ */
protected Source source; protected Source source;
/** The preview language version.
*/
protected Preview preview;
/** The module for code generation. /** The module for code generation.
*/ */
protected Gen gen; protected Gen gen;
@ -405,6 +409,7 @@ public class JavaCompiler {
log.error(Errors.CantAccess(ex.sym, ex.getDetailValue())); log.error(Errors.CantAccess(ex.sym, ex.getDetailValue()));
} }
source = Source.instance(context); source = Source.instance(context);
preview = Preview.instance(context);
attr = Attr.instance(context); attr = Attr.instance(context);
analyzer = Analyzer.instance(context); analyzer = Analyzer.instance(context);
chk = Check.instance(context); chk = Check.instance(context);
@ -1725,6 +1730,7 @@ public class JavaCompiler {
log.warning(Warnings.ProcUseProcOrImplicit); log.warning(Warnings.ProcUseProcOrImplicit);
} }
chk.reportDeferredDiagnostics(); chk.reportDeferredDiagnostics();
preview.reportDeferredDiagnostics();
if (log.compressedOutput) { if (log.compressedOutput) {
log.mandatoryNote(null, Notes.CompressedDiags); log.mandatoryNote(null, Notes.CompressedDiags);
} }

View File

@ -330,6 +330,8 @@ public enum Option {
} }
}, },
PREVIEW("--enable-preview", "opt.preview", STANDARD, BASIC),
PROFILE("-profile", "opt.arg.profile", "opt.profile", STANDARD, BASIC) { PROFILE("-profile", "opt.arg.profile", "opt.profile", STANDARD, BASIC) {
@Override @Override
public void process(OptionHelper helper, String option, String operand) throws InvalidValueException { public void process(OptionHelper helper, String option, String operand) throws InvalidValueException {

View File

@ -25,6 +25,7 @@
package com.sun.tools.javac.parser; package com.sun.tools.javac.parser;
import com.sun.tools.javac.code.Preview;
import com.sun.tools.javac.code.Source; import com.sun.tools.javac.code.Source;
import com.sun.tools.javac.code.Source.Feature; import com.sun.tools.javac.code.Source.Feature;
import com.sun.tools.javac.parser.Tokens.Comment.CommentStyle; import com.sun.tools.javac.parser.Tokens.Comment.CommentStyle;
@ -53,6 +54,9 @@ public class JavaTokenizer {
*/ */
private Source source; private Source source;
/** The preview language setting. */
private Preview preview;
/** The log to be used for error reporting. /** The log to be used for error reporting.
*/ */
private final Log log; private final Log log;
@ -115,12 +119,20 @@ public class JavaTokenizer {
this.log = fac.log; this.log = fac.log;
this.tokens = fac.tokens; this.tokens = fac.tokens;
this.source = fac.source; this.source = fac.source;
this.preview = fac.preview;
this.reader = reader; this.reader = reader;
} }
private void checkSourceLevel(int pos, Feature feature) { protected void checkSourceLevel(int pos, Feature feature) {
if (!feature.allowedInSource(source)) { if (preview.isPreview(feature) && !preview.isEnabled()) {
//preview feature without --preview flag, error
lexError(DiagnosticFlag.SOURCE_LEVEL, pos, preview.disabledError(feature));
} else if (!feature.allowedInSource(source)) {
//incompatible source level, error
lexError(DiagnosticFlag.SOURCE_LEVEL, pos, feature.error(source.name)); lexError(DiagnosticFlag.SOURCE_LEVEL, pos, feature.error(source.name));
} else if (preview.isPreview(feature)) {
//use of preview feature, warn
preview.warnPreview(pos, feature);
} }
} }

View File

@ -95,6 +95,9 @@ public class JavacParser implements Parser {
/** The Source language setting. */ /** The Source language setting. */
private Source source; private Source source;
/** The Preview language setting. */
private Preview preview;
/** The name table. */ /** The name table. */
private Names names; private Names names;
@ -169,6 +172,7 @@ public class JavacParser implements Parser {
this.log = fac.log; this.log = fac.log;
this.names = fac.names; this.names = fac.names;
this.source = fac.source; this.source = fac.source;
this.preview = fac.preview;
this.allowStringFolding = fac.options.getBoolean("allowStringFolding", true); this.allowStringFolding = fac.options.getBoolean("allowStringFolding", true);
this.keepDocComments = keepDocComments; this.keepDocComments = keepDocComments;
this.parseModuleInfo = parseModuleInfo; this.parseModuleInfo = parseModuleInfo;
@ -4219,8 +4223,15 @@ public class JavacParser implements Parser {
} }
protected void checkSourceLevel(int pos, Feature feature) { protected void checkSourceLevel(int pos, Feature feature) {
if (!feature.allowedInSource(source)) { if (preview.isPreview(feature) && !preview.isEnabled()) {
//preview feature without --preview flag, error
log.error(DiagnosticFlag.SOURCE_LEVEL, pos, preview.disabledError(feature));
} else if (!feature.allowedInSource(source)) {
//incompatible source level, error
log.error(DiagnosticFlag.SOURCE_LEVEL, pos, feature.error(source.name)); log.error(DiagnosticFlag.SOURCE_LEVEL, pos, feature.error(source.name));
} else if (preview.isPreview(feature)) {
//use of preview feature, warn
preview.warnPreview(pos, feature);
} }
} }

View File

@ -27,6 +27,7 @@ package com.sun.tools.javac.parser;
import java.util.Locale; import java.util.Locale;
import com.sun.tools.javac.code.Preview;
import com.sun.tools.javac.code.Source; import com.sun.tools.javac.code.Source;
import com.sun.tools.javac.tree.DocTreeMaker; import com.sun.tools.javac.tree.DocTreeMaker;
import com.sun.tools.javac.tree.TreeMaker; import com.sun.tools.javac.tree.TreeMaker;
@ -62,6 +63,7 @@ public class ParserFactory {
final Log log; final Log log;
final Tokens tokens; final Tokens tokens;
final Source source; final Source source;
final Preview preview;
final Names names; final Names names;
final Options options; final Options options;
final ScannerFactory scannerFactory; final ScannerFactory scannerFactory;
@ -76,6 +78,7 @@ public class ParserFactory {
this.names = Names.instance(context); this.names = Names.instance(context);
this.tokens = Tokens.instance(context); this.tokens = Tokens.instance(context);
this.source = Source.instance(context); this.source = Source.instance(context);
this.preview = Preview.instance(context);
this.options = Options.instance(context); this.options = Options.instance(context);
this.scannerFactory = ScannerFactory.instance(context); this.scannerFactory = ScannerFactory.instance(context);
this.locale = context.get(Locale.class); this.locale = context.get(Locale.class);

View File

@ -27,6 +27,7 @@ package com.sun.tools.javac.parser;
import java.nio.CharBuffer; import java.nio.CharBuffer;
import com.sun.tools.javac.code.Preview;
import com.sun.tools.javac.code.Source; import com.sun.tools.javac.code.Source;
import com.sun.tools.javac.util.Context; import com.sun.tools.javac.util.Context;
import com.sun.tools.javac.util.Log; import com.sun.tools.javac.util.Log;
@ -56,6 +57,7 @@ public class ScannerFactory {
final Log log; final Log log;
final Names names; final Names names;
final Source source; final Source source;
final Preview preview;
final Tokens tokens; final Tokens tokens;
/** Create a new scanner factory. */ /** Create a new scanner factory. */
@ -64,6 +66,7 @@ public class ScannerFactory {
this.log = Log.instance(context); this.log = Log.instance(context);
this.names = Names.instance(context); this.names = Names.instance(context);
this.source = Source.instance(context); this.source = Source.instance(context);
this.preview = Preview.instance(context);
this.tokens = Tokens.instance(context); this.tokens = Tokens.instance(context);
} }

View File

@ -1547,6 +1547,25 @@ compiler.note.unchecked.filename.additional=\
compiler.note.unchecked.plural.additional=\ compiler.note.unchecked.plural.additional=\
Some input files additionally use unchecked or unsafe operations. Some input files additionally use unchecked or unsafe operations.
# 0: file name
compiler.note.preview.filename=\
{0} uses preview language features.
compiler.note.preview.plural=\
Some input files use preview language features.
# The following string may appear after one of the above deprecation
# messages.
compiler.note.preview.recompile=\
Recompile with -Xlint:preview for details.
# 0: file name
compiler.note.preview.filename.additional=\
{0} has additional uses of preview language features.
compiler.note.preview.plural.additional=\
Some input files additionally use preview language features.
# Notes related to annotation processing # Notes related to annotation processing
# Print a client-generated note; assumed to be localized, no translation required # Print a client-generated note; assumed to be localized, no translation required
@ -2665,6 +2684,34 @@ compiler.misc.feature.not.supported.in.source.plural=\
{0} are not supported in -source {1}\n\ {0} are not supported in -source {1}\n\
(use -source {2} or higher to enable {0}) (use -source {2} or higher to enable {0})
# 0: message segment (feature)
compiler.err.preview.feature.disabled=\
{0} is a preview feature and is disabled by default.\n\
(use --enable-preview to enable {0})
# 0: message segment (feature)
compiler.err.preview.feature.disabled.plural=\
{0} are a preview feature and are disabled by default.\n\
(use --enable-preview to enable {0})
# 0: file object (classfile), 1: string (expected version)
compiler.err.preview.feature.disabled.classfile=\
classfile for {0} uses preview features of Java SE {1}.\n\
(use --enable-preview to allow loading of classfiles which contain preview features)
# 0: message segment (feature)
compiler.warn.preview.feature.use=\
{0} is a preview feature and may be removed in a future release.
# 0: message segment (feature)
compiler.warn.preview.feature.use.plural=\
{0} are a preview feature and may be removed in a future release.
# 0: file object (classfile), 1: string (expected version)
compiler.warn.preview.feature.use.classfile=\
classfile for {0} uses preview features of Java SE {1}.
compiler.misc.feature.modules=\ compiler.misc.feature.modules=\
modules modules

View File

@ -252,6 +252,9 @@ javac.opt.Xlint.desc.unchecked=\
javac.opt.Xlint.desc.varargs=\ javac.opt.Xlint.desc.varargs=\
Warn about potentially unsafe vararg methods Warn about potentially unsafe vararg methods
javac.opt.Xlint.desc.preview=\
Warn about use of preview language features
javac.opt.Xdoclint=\ javac.opt.Xdoclint=\
Enable recommended checks for problems in javadoc comments Enable recommended checks for problems in javadoc comments
# L10N: do not localize: all none # L10N: do not localize: all none
@ -293,6 +296,8 @@ javac.opt.userpathsfirst=\
Search classpath and sourcepath for classes before the bootclasspath instead of after Search classpath and sourcepath for classes before the bootclasspath instead of after
javac.opt.prefer=\ javac.opt.prefer=\
Specify which file to read when both a source file and class file are found for an implicitly compiled class Specify which file to read when both a source file and class file are found for an implicitly compiled class
javac.opt.preview=\
Enable preview language features. To be used in conjunction with either -source or --release.
javac.opt.AT=\ javac.opt.AT=\
Read options and filenames from file Read options and filenames from file
javac.opt.diags=\ javac.opt.diags=\
@ -368,6 +373,11 @@ javac.warn.target.default.source.conflict=\
target release {0} conflicts with default source release {1} target release {0} conflicts with default source release {1}
javac.warn.profile.target.conflict=\ javac.warn.profile.target.conflict=\
profile {0} is not valid for target release {1} profile {0} is not valid for target release {1}
javac.err.preview.not.latest=\
invalid source release {0} with --enable-preview\n\
(preview language features are only supported for release {1})
javac.err.preview.without.source.or.release=\
--enable-preview must be used with either -source or --release
javac.err.file.not.found=\ javac.err.file.not.found=\
file not found: {0} file not found: {0}
javac.err.file.not.directory=\ javac.err.file.not.directory=\

View File

@ -40,6 +40,7 @@ import jdk.javadoc.internal.doclets.formats.html.markup.Links;
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
import jdk.javadoc.internal.doclets.toolkit.Content; import jdk.javadoc.internal.doclets.toolkit.Content;
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException; import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths; import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
/** /**
@ -100,8 +101,11 @@ public class ModuleFrameWriter extends HtmlDocletWriter {
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN)) HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
? HtmlTree.MAIN() ? HtmlTree.MAIN()
: body; : body;
DocPath moduleSummary = configuration.useModuleDirectories
? DocPaths.DOT_DOT.resolve(configuration.docPaths.moduleSummary(moduleElement))
: configuration.docPaths.moduleSummary(moduleElement);
Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar, Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar,
mdlgen.links.createLink(configuration.docPaths.moduleSummary(moduleElement), mdlLabel, "", "classFrame")); mdlgen.links.createLink(moduleSummary, mdlLabel, "", "classFrame"));
htmlTree.addContent(heading); htmlTree.addContent(heading);
HtmlTree div = new HtmlTree(HtmlTag.DIV); HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.setStyle(HtmlStyle.indexContainer); div.setStyle(HtmlStyle.indexContainer);

View File

@ -36,7 +36,6 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.Links;
import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml; import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
import jdk.javadoc.internal.doclets.toolkit.Content; import jdk.javadoc.internal.doclets.toolkit.Content;

View File

@ -37,7 +37,6 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.Links;
import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml; import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
import jdk.javadoc.internal.doclets.toolkit.Content; import jdk.javadoc.internal.doclets.toolkit.Content;
@ -189,7 +188,10 @@ public class ModulePackageIndexFrameWriter extends AbstractModuleIndexWriter {
* @param ul the Content object to which the all classes link should be added * @param ul the Content object to which the all classes link should be added
*/ */
protected void addAllClassesLink(Content ul) { protected void addAllClassesLink(Content ul) {
Content linkContent = links.createLink(DocPaths.ALLCLASSES_FRAME, DocPath allClassesFrame = configuration.useModuleDirectories
? DocPaths.DOT_DOT.resolve(DocPaths.ALLCLASSES_FRAME)
: DocPaths.ALLCLASSES_FRAME;
Content linkContent = links.createLink(allClassesFrame,
contents.allClassesLabel, "", "packageFrame"); contents.allClassesLabel, "", "packageFrame");
Content li = HtmlTree.LI(linkContent); Content li = HtmlTree.LI(linkContent);
ul.addContent(li); ul.addContent(li);
@ -202,7 +204,10 @@ public class ModulePackageIndexFrameWriter extends AbstractModuleIndexWriter {
* @param ul the Content object to which the all packages link should be added * @param ul the Content object to which the all packages link should be added
*/ */
protected void addAllPackagesLink(Content ul) { protected void addAllPackagesLink(Content ul) {
Content linkContent = links.createLink(DocPaths.OVERVIEW_FRAME, DocPath overviewFrame = configuration.useModuleDirectories
? DocPaths.DOT_DOT.resolve(DocPaths.OVERVIEW_FRAME)
: DocPaths.OVERVIEW_FRAME;
Content linkContent = links.createLink(overviewFrame,
contents.allPackagesLabel, "", "packageListFrame"); contents.allPackagesLabel, "", "packageListFrame");
Content li = HtmlTree.LI(linkContent); Content li = HtmlTree.LI(linkContent);
ul.addContent(li); ul.addContent(li);
@ -215,7 +220,10 @@ public class ModulePackageIndexFrameWriter extends AbstractModuleIndexWriter {
* @param ul the Content object to which the all modules link should be added * @param ul the Content object to which the all modules link should be added
*/ */
protected void addAllModulesLink(Content ul) { protected void addAllModulesLink(Content ul) {
Content linkContent = links.createLink(DocPaths.MODULE_OVERVIEW_FRAME, DocPath moduleOverviewFrame = configuration.useModuleDirectories
? DocPaths.DOT_DOT.resolve(DocPaths.MODULE_OVERVIEW_FRAME)
: DocPaths.MODULE_OVERVIEW_FRAME;
Content linkContent = links.createLink(moduleOverviewFrame,
contents.allModulesLabel, "", "packageListFrame"); contents.allModulesLabel, "", "packageListFrame");
Content li = HtmlTree.LI(linkContent); Content li = HtmlTree.LI(linkContent);
ul.addContent(li); ul.addContent(li);

View File

@ -30,10 +30,6 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import javax.lang.model.element.ModuleElement;
import javax.lang.model.element.PackageElement;
import javax.lang.model.element.TypeElement;
/** /**
* Abstraction for immutable relative paths. * Abstraction for immutable relative paths.
* Paths always use '/' as a separator, and never begin or end with '/'. * Paths always use '/' as a separator, and never begin or end with '/'.

View File

@ -49,6 +49,8 @@ public class DocPaths {
moduleSeparator = useModuleDirectories ? "/module-" : "-"; moduleSeparator = useModuleDirectories ? "/module-" : "-";
} }
public static final DocPath DOT_DOT = DocPath.create("..");
/** The name of the file for all classes, without using frames, when --no-frames is specified. */ /** The name of the file for all classes, without using frames, when --no-frames is specified. */
public static final DocPath ALLCLASSES = DocPath.create("allclasses.html"); public static final DocPath ALLCLASSES = DocPath.create("allclasses.html");

View File

@ -589,7 +589,6 @@ javax/net/ssl/DTLS/RespondToRetransmit.java 8169086 macosx-x
sun/security/krb5/auto/UnboundSSL.java 8180265 windows-all sun/security/krb5/auto/UnboundSSL.java 8180265 windows-all
sun/security/provider/KeyStore/DKSTest.sh 8180266 windows-all sun/security/provider/KeyStore/DKSTest.sh 8180266 windows-all
sun/security/ssl/X509KeyManager/PreferredKey.java 8190333 generic-all
############################################################################ ############################################################################
@ -777,7 +776,7 @@ com/sun/jndi/ldap/DeadSSLLdapTimeoutTest.java 8169942 linux-i5
com/sun/jndi/ldap/LdapTimeoutTest.java 8151678 linux-all com/sun/jndi/ldap/LdapTimeoutTest.java 8151678 linux-all
javax/rmi/ssl/SSLSocketParametersTest.sh 8194663 generic-all javax/rmi/ssl/SSLSocketParametersTest.sh 8162906 generic-all
############################################################################ ############################################################################

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8186046 * @bug 8186046 8199875
* @summary Test basic invocation of bootstrap methods * @summary Test basic invocation of bootstrap methods
* @library /lib/testlibrary/bytecode /java/lang/invoke/common * @library /lib/testlibrary/bytecode /java/lang/invoke/common
* @build jdk.experimental.bytecode.BasicClassBuilder test.java.lang.invoke.lib.InstructionHelper * @build jdk.experimental.bytecode.BasicClassBuilder test.java.lang.invoke.lib.InstructionHelper
@ -40,8 +40,10 @@ import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType; import java.lang.invoke.MethodType;
import java.lang.invoke.WrongMethodTypeException; import java.lang.invoke.WrongMethodTypeException;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.stream.IntStream; import java.util.stream.IntStream;
import java.util.stream.Stream;
import static java.lang.invoke.MethodType.methodType; import static java.lang.invoke.MethodType.methodType;
@ -63,85 +65,85 @@ public class CondyBSMInvocation {
} }
} }
static MethodHandle[] bsms(String bsmName) {
return Stream.of(CondyBSMInvocation.class.getDeclaredMethods()).
filter(m -> m.getName().equals(bsmName)).
map(m -> {
try {
return MethodHandles.lookup().unreflect(m);
} catch (IllegalAccessException e) {
throw new RuntimeException();
}
}).toArray(MethodHandle[]::new);
}
public static Object _bsm() { public static Object shape_bsm() {
return "0"; return "0";
} }
public static Object _bsm(Object a1) { public static Object shape_bsm(Object a1) {
return "0"; return "0";
} }
// Note: when pull mode is supported for a BSM this test case public static Object shape_bsm(Object... args) {
// will fail and must be removed return "0";
public static Object _bsm(Object a1, Object a2) { }
public static Object shape_bsm(Object a1, Object a2) {
return "0";
}
public static Object shape_bsm(Object a1, Object... args) {
return "0";
}
public static Object shape_bsm(Object a1, Object a2, Object a3) {
return "0";
}
public static Object shape_bsm(MethodHandles.Lookup a1) {
return "0"; return "0";
} }
@Test @Test
public void testWrongArity() throws Throwable { public void testWrongShape() throws Throwable {
for (int i = 0; i < 3; i++) { for (MethodHandle bsm : bsms("shape_bsm")) {
final int n = i;
MethodType mt = methodType(Object.class)
.appendParameterTypes(Collections.nCopies(n, Object.class));
MethodHandle mh = InstructionHelper.ldcDynamicConstant( MethodHandle mh = InstructionHelper.ldcDynamicConstant(
L, "name", Object.class, L, "name", Object.class,
"_bsm", mt, "shape_bsm", bsm.type(),
S -> IntStream.range(0, n).forEach(S::add) S -> {}
); );
try { try {
Object r = mh.invoke(); Object r = mh.invoke();
Assert.fail("BootstrapMethodError expected to be thrown for arrity " + n); Assert.fail("BootstrapMethodError expected to be thrown for " + bsm);
} catch (BootstrapMethodError e) { } catch (BootstrapMethodError e) {
Throwable t = e.getCause();
Assert.assertTrue(WrongMethodTypeException.class.isAssignableFrom(t.getClass()));
} }
} }
} }
public static Object _bsm(String[] ss) { public static Object sig_bsm(MethodHandles.Lookup a1, String[] a2) {
return "0"; return "0";
} }
public static Object _bsm(String a1, String a2, String a3) { public static Object sig_bsm(MethodHandles.Lookup a1, String a2, String a3) {
return "0"; return "0";
} }
@Test @Test
public void testWrongSignature() throws Throwable { public void testWrongSignature() throws Throwable {
{ for (MethodHandle bsm : bsms("sig_bsm")) {
MethodHandle mh = InstructionHelper.ldcDynamicConstant( MethodHandle mh = InstructionHelper.ldcDynamicConstant(
L, "name", Object.class, L, "name", Object.class,
"_bsm", methodType(Object.class, String[].class), "sig_bsm", bsm.type(),
S -> {} S -> {}
); );
try { try {
Object r = mh.invoke(); Object r = mh.invoke();
Assert.fail("BootstrapMethodError expected to be thrown"); Assert.fail("BootstrapMethodError expected to be thrown for " + bsm);
} } catch (BootstrapMethodError e) {
catch (BootstrapMethodError e) {
Throwable t = e.getCause();
Assert.assertTrue(WrongMethodTypeException.class.isAssignableFrom(t.getClass()));
}
}
{
MethodHandle mh = InstructionHelper.ldcDynamicConstant(
L, "name", Object.class,
"_bsm", methodType(Object.class, String.class, String.class, String.class),
S -> {}
);
try {
Object r = mh.invoke();
Assert.fail("BootstrapMethodError expected to be thrown");
}
catch (BootstrapMethodError e) {
Throwable t = e.getCause();
Assert.assertTrue(ClassCastException.class.isAssignableFrom(t.getClass()));
} }
} }
} }
@ -193,6 +195,12 @@ public class CondyBSMInvocation {
return "7"; return "7";
} }
public static Object bsm(MethodHandles.Lookup l, Object... args) {
Object[] staticArgs = Arrays.copyOfRange(args, 2, args.length);
assertAll(staticArgs);
return Integer.toString(staticArgs.length);
}
static void assertAll(Object... as) { static void assertAll(Object... as) {
for (int i = 0; i < as.length; i++) { for (int i = 0; i < as.length; i++) {
Assert.assertEquals(as[i], i); Assert.assertEquals(as[i], i);
@ -214,6 +222,19 @@ public class CondyBSMInvocation {
Object r = mh.invoke(); Object r = mh.invoke();
Assert.assertEquals(r, Integer.toString(n)); Assert.assertEquals(r, Integer.toString(n));
} }
{
MethodType mt = methodType(Object.class, MethodHandles.Lookup.class, Object[].class);
MethodHandle mh = InstructionHelper.ldcDynamicConstant(
L, "name", Object.class,
"bsm", mt,
S -> IntStream.range(0, 9).forEach(S::add)
);
Object r = mh.invoke();
Assert.assertEquals(r, Integer.toString(9));
}
} }
@Test @Test

View File

@ -30,6 +30,7 @@
import java.io.InputStream; import java.io.InputStream;
import java.net.ServerSocket; import java.net.ServerSocket;
import java.net.Socket; import java.net.Socket;
import java.net.ConnectException;
import java.net.SocketException; import java.net.SocketException;
import java.util.concurrent.Phaser; import java.util.concurrent.Phaser;
@ -43,33 +44,37 @@ public class Race {
final int port = ss.getLocalPort(); final int port = ss.getLocalPort();
final Phaser phaser = new Phaser(THREADS + 1); final Phaser phaser = new Phaser(THREADS + 1);
for (int i=0; i<100; i++) { for (int i=0; i<100; i++) {
final Socket s = new Socket("localhost", port); try {
s.setSoLinger(false, 0); final Socket s = new Socket("localhost", port);
try (Socket sa = ss.accept()) { s.setSoLinger(false, 0);
sa.setSoLinger(false, 0); try (Socket sa = ss.accept()) {
final InputStream is = s.getInputStream(); sa.setSoLinger(false, 0);
Thread[] threads = new Thread[THREADS]; final InputStream is = s.getInputStream();
for (int j=0; j<THREADS; j++) { Thread[] threads = new Thread[THREADS];
threads[j] = new Thread() { for (int j=0; j<THREADS; j++) {
public void run() { threads[j] = new Thread() {
try { public void run() {
phaser.arriveAndAwaitAdvance(); try {
while (is.read() != -1) phaser.arriveAndAwaitAdvance();
Thread.sleep(50); while (is.read() != -1)
} catch (Exception x) { Thread.sleep(50);
if (!(x instanceof SocketException } catch (Exception x) {
&& x.getMessage().equalsIgnoreCase("socket closed"))) if (!(x instanceof SocketException
x.printStackTrace(); && x.getMessage().equalsIgnoreCase("socket closed")))
// ok, expect Socket closed x.printStackTrace();
} // ok, expect Socket closed
}}; }
}};
}
for (int j=0; j<100; j++)
threads[j].start();
phaser.arriveAndAwaitAdvance();
s.close();
for (int j=0; j<100; j++)
threads[j].join();
} }
for (int j=0; j<100; j++) } catch (ConnectException e) {
threads[j].start(); System.err.println("Exception " + e + " Port: " + port);
phaser.arriveAndAwaitAdvance();
s.close();
for (int j=0; j<100; j++)
threads[j].join();
} }
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -29,79 +29,70 @@
* java.rmi/sun.rmi.server * java.rmi/sun.rmi.server
* java.rmi/sun.rmi.transport * java.rmi/sun.rmi.transport
* java.rmi/sun.rmi.transport.tcp * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary RegistryVM RegistryRunner * @build TestLibrary
* @run main/othervm Reexport * @run main/othervm Reexport
*/ */
/* /*
* If a VM could not create an RMI registry because another registry * If a VM could not create an RMI registry because the registry port
* usually in another process, was using the registry port, the next * was already occupied by this or other processes, the next
* time the VM tried to create a registry (after the other registry * time the VM tried to create a registry (after the other registry
* was brought down) the attempt would fail. The second try to create * was brought down) the attempt would fail. The second try to create
* a registry would fail because the registry ObjID would still be in * a registry would fail because the registry ObjID would still be in
* use when it should never have been allocated. * use when it should never have been allocated.
* *
* The test creates this conflict using Runtime.exec and ensures that * The test creates this conflict starting a dummy tcp server and ensures
* a registry can still be created after the conflict is resolved. * that a registry can still be created after the conflict is resolved.
*/ */
import java.io.*; import java.io.IOException;
import java.rmi.*; import java.net.InetSocketAddress;
import java.rmi.registry.*; import java.nio.channels.ServerSocketChannel;
import java.rmi.server.*; import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
public class Reexport { public class Reexport {
static public void main(String[] argv) { static public void main(String[] argv) throws IOException {
Registry reg = null; for (int loop = 0; loop < 10; loop++) {
try { System.err.println("\nat loop: " + loop);
System.err.println("\nregression test for 4120329\n"); int port = -1;
try (ServerSocketChannel server = ServerSocketChannel.open();) {
server.bind(null);
InetSocketAddress addr = (InetSocketAddress)server.getLocalAddress();
port = addr.getPort();
// establish the registry (we hope) System.err.println("Creating duplicate registry, this should fail...");
makeRegistry(); createReg(port, true);
}
// Get a handle to the registry
System.err.println("Creating duplicate registry, this should fail...");
reg = createReg(true);
// Kill the first registry.
System.err.println("Bringing down the first registry");
try { try {
killRegistry(); if (createReg(port, false) == null) {
} catch (Exception foo) { TestLibrary.bomb("Could not create registry on second try");
}
System.err.println("Test passed");
return;
} catch (Exception e) {
String err = e.getMessage();
if (err.contains("Address already in use")
|| err.contains("Port already in use")) {
continue;
}
TestLibrary.bomb(e);
} }
// start another registry now that the first is gone; this should work
System.err.println("Trying again to start our own " +
"registry... this should work");
reg = createReg(false);
if (reg == null) {
TestLibrary.bomb("Could not create registry on second try");
}
System.err.println("Test passed");
} catch (Exception e) {
TestLibrary.bomb(e);
} finally {
// dont leave the registry around to affect other tests.
killRegistry();
reg = null;
} }
TestLibrary.bomb("Test failed");
} }
static Registry createReg(boolean remoteOk) { static Registry createReg(int port, boolean expectException) {
Registry reg = null; Registry reg = null;
try { try {
reg = LocateRegistry.createRegistry(port); reg = LocateRegistry.createRegistry(port);
if (remoteOk) { if (expectException) {
TestLibrary.bomb("Remote registry is up, an Exception is expected!"); TestLibrary.bomb("Registry is up, an Exception is expected!");
} }
} catch (Throwable e) { } catch (Throwable e) {
if (remoteOk) { if (expectException) {
System.err.println("EXPECTING PORT IN USE EXCEPTION:"); System.err.println("EXPECTING PORT IN USE EXCEPTION:");
System.err.println(e.getMessage()); System.err.println(e.getMessage());
e.printStackTrace(); e.printStackTrace();
@ -111,27 +102,4 @@ public class Reexport {
} }
return reg; return reg;
} }
public static void makeRegistry() {
try {
subreg = RegistryVM.createRegistryVM();
subreg.start();
port = subreg.getPort();
System.out.println("Starting registry on port " + port);
} catch (IOException e) {
// one of these is summarily dropped, can't remember which one
System.out.println ("Test setup failed - cannot run rmiregistry");
TestLibrary.bomb("Test setup failed - cannot run test", e);
}
}
private static RegistryVM subreg = null;
private static int port = -1;
public static void killRegistry() {
if (subreg != null) {
subreg.cleanup();
subreg = null;
}
}
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -49,7 +49,7 @@ import org.testng.annotations.Test;
/* /*
* @test * @test
* @bug 8081022 8151876 8166875 * @bug 8081022 8151876 8166875 8189784
* @key randomness * @key randomness
*/ */
@ -158,6 +158,10 @@ public class TestZoneTextPrinterParser extends AbstractTestPrinterParser {
{"Australia/South", "ACST", preferred_s, Locale.ENGLISH, TextStyle.SHORT}, {"Australia/South", "ACST", preferred_s, Locale.ENGLISH, TextStyle.SHORT},
{"America/Chicago", "CDT", none, Locale.ENGLISH, TextStyle.SHORT}, {"America/Chicago", "CDT", none, Locale.ENGLISH, TextStyle.SHORT},
{"Asia/Shanghai", "CDT", preferred_s, Locale.ENGLISH, TextStyle.SHORT}, {"Asia/Shanghai", "CDT", preferred_s, Locale.ENGLISH, TextStyle.SHORT},
{"America/Juneau", "AKST", none, Locale.ENGLISH, TextStyle.SHORT},
{"America/Juneau", "AKDT", none, Locale.ENGLISH, TextStyle.SHORT},
{"Pacific/Honolulu", "HST", none, Locale.ENGLISH, TextStyle.SHORT},
{"America/Halifax", "AST", none, Locale.ENGLISH, TextStyle.SHORT},
}; };
} }

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,131 @@
/*
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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 4327164
* @summary Basic test for new RandomAccess interface
*/
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
import java.util.RandomAccess;
import java.util.Vector;
public class Basic {
public static void main(String[] args) throws Exception {
List a0 = Arrays.asList(new String[] { "a", "b", "c" });
List a[] = { a0, new ArrayList(a0), new LinkedList(a0),
new Vector(a0) };
if (!(a[0] instanceof RandomAccess))
throw new Exception("Arrays.asList doesn't implement RandomAccess");
if (!(a[1] instanceof RandomAccess))
throw new Exception("ArrayList doesn't implement RandomAccess");
if (a[2] instanceof RandomAccess)
throw new Exception("LinkedList implements RandomAccess");
if (!(a[3] instanceof RandomAccess))
throw new Exception("Vector doesn't implement RandomAccess");
for (int i = 0; i < a.length; i++) {
List t = a[i];
List ut = Collections.unmodifiableList(t);
List st = Collections.synchronizedList(t);
boolean random = t instanceof RandomAccess;
if ((ut instanceof RandomAccess) != random)
throw new Exception(
"Unmodifiable fails to preserve RandomAccess: " + i);
if ((st instanceof RandomAccess) != random)
throw new Exception(
"Synchronized fails to preserve RandomAccess: " + i);
while (t.size() > 0) {
t = t.subList(0, t.size() - 1);
if ((t instanceof RandomAccess) != random)
throw new Exception(
"SubList fails to preserve RandomAccess: " + i
+ ", " + t.size());
ut = ut.subList(0, ut.size() - 1);
if ((ut instanceof RandomAccess) != random)
throw new Exception(
"SubList(unmodifiable) fails to preserve RandomAccess: "
+ i + ", " + ut.size());
st = st.subList(0, st.size() - 1);
if ((st instanceof RandomAccess) != random)
throw new Exception(
"SubList(synchronized) fails to preserve RandomAccess: "
+ i + ", " + st.size());
}
}
// Test that shuffle works the same on random and sequential access
List al = new ArrayList();
for (int j = 0; j < 100; j++)
al.add(Integer.valueOf(2 * j));
List ll = new LinkedList(al);
Random r1 = new Random(666), r2 = new Random(666);
for (int i = 0; i < 100; i++) {
Collections.shuffle(al, r1);
Collections.shuffle(ll, r2);
if (!al.equals(ll))
throw new Exception("Shuffle failed: " + i);
}
// Test that fill works on random & sequential access
List gumbyParade = Collections.nCopies(100, "gumby");
Collections.fill(al, "gumby");
if (!al.equals(gumbyParade))
throw new Exception("ArrayList fill failed");
Collections.fill(ll, "gumby");
if (!ll.equals(gumbyParade))
throw new Exception("LinkedList fill failed");
// Test that copy works on random & sequential access
List pokeyParade = Collections.nCopies(100, "pokey");
Collections.copy(al, pokeyParade);
if (!al.equals(pokeyParade))
throw new Exception("ArrayList copy failed");
Collections.copy(ll, pokeyParade);
if (!ll.equals(pokeyParade))
throw new Exception("LinkedList copy failed");
// Test that binarySearch works the same on random & sequential access
al = new ArrayList();
for (int i = 0; i < 10000; i++)
al.add(Integer.valueOf(2 * i));
ll = new LinkedList(al);
for (int i = 0; i < 500; i++) {
Integer key = Integer.valueOf(r1.nextInt(20000));
if (Collections.binarySearch(al, key) != Collections
.binarySearch(ll, key))
throw new Exception("Binary search failed: " + i);
}
}
}

View File

@ -62,22 +62,21 @@ it can be used for version 1 X.509 certificate) keytool command:
Alias name: dummydsa Alias name: dummydsa
-------------------- --------------------
Creation date: Mar 11, 2007 Creation date: Mar 29, 2018
Entry type: PrivateKeyEntry Entry type: PrivateKeyEntry
Certificate chain length: 1 Certificate chain length: 1
Certificate[1]: Certificate[1]:
Owner: CN=dummy.example.com, OU=Dummy, O=Dummy, L=Cupertino, ST=CA, C=US Owner: CN=dummy.example.com, OU=Dummy, O=Dummy, L=Cupertino, ST=CA, C=US
Issuer: CN=dummy.example.com, OU=Dummy, O=Dummy, L=Cupertino, ST=CA, C=US Issuer: CN=dummy.example.com, OU=Dummy, O=Dummy, L=Cupertino, ST=CA, C=US
Serial number: 45f3a314 Serial number: 324d85f0
Valid from: Sun Mar 11 06:35:00 UTC 2007 until: Wed Mar 08 06:35:00 UTC 2017 Valid from: Thu Mar 29 16:06:34 PDT 2018 until: Tue Mar 28 16:06:34 PDT 2028
Certificate fingerprints: Signature algorithm name: SHA256withDSA
Signature algorithm name: SHA1withDSA Version: 3
Version: 1
This can be generated using hacked (update the keytool source code so that This can be generated using hacked (update the keytool source code so that
it can be used for version 1 X.509 certificate) keytool command: it can be used for version 1 X.509 certificate) keytool command:
% keytool -genkeypair -alias dummy -keyalg DSA -keysize 1024 \ % keytool -genkeypair -alias dummydsa -keyalg DSA -keysize 1024 \
-sigalg SHA1withDSA \ -sigalg SHA256withDSA \
-dname "CN=dummy.example.com, OU=Dummy, O=Dummy, L=Cupertino, ST=CA, C=US" \ -dname "CN=dummy.example.com, OU=Dummy, O=Dummy, L=Cupertino, ST=CA, C=US" \
-validity 3652 -keypass passphrase -keystore keystore -storepass passphrase -validity 3652 -keypass passphrase -keystore keystore -storepass passphrase

Binary file not shown.

View File

@ -52,7 +52,9 @@ import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.nio.file.StandardCopyOption; import java.nio.file.StandardCopyOption;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.jar.JarFile; import java.util.jar.JarFile;
import java.util.spi.ToolProvider; import java.util.spi.ToolProvider;
@ -134,14 +136,15 @@ public class JLinkMultiReleaseJarTest {
} }
private void javac(Path source, Path destination, String srcpath) throws IOException { private void javac(Path source, Path destination, String srcpath) throws IOException {
String[] args = Stream.concat( var args = Stream.of("-d", destination.toString(), "--module-source-path", srcpath);
Stream.of("-d", destination.toString(), "--module-source-path", srcpath), try (Stream<Path> pathStream = Files.walk(source)) {
Files.walk(source) args = Stream.concat(args,
.map(Path::toString) pathStream.map(Path::toString)
.filter(s -> s.endsWith(".java")) .filter(s -> s.endsWith(".java")));
).toArray(String[]::new);
int rc = JAVAC_TOOL.run(System.out, System.err, args); int rc = JAVAC_TOOL.run(System.out, System.err, args.toArray(String[]::new));
Assert.assertEquals(rc, 0); Assert.assertEquals(rc, 0);
}
} }
@Test @Test
@ -149,7 +152,7 @@ public class JLinkMultiReleaseJarTest {
if (ignoreTest()) return; if (ignoreTest()) return;
// use jlink to build image from multi-release jar // use jlink to build image from multi-release jar
jlink("m1.jar", "myimage"); jlink("m1.jar", "myimage");
// validate image // validate image
Path jimage = userdir.resolve("myimage").resolve("lib").resolve("modules"); Path jimage = userdir.resolve("myimage").resolve("lib").resolve("modules");

View File

@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8195795 * @bug 8195795 8201396
* @summary test the use of module directories in output, * @summary test the use of module directories in output,
* and the --no-module-directories option * and the --no-module-directories option
* @modules jdk.javadoc/jdk.javadoc.internal.api * @modules jdk.javadoc/jdk.javadoc.internal.api
@ -71,46 +71,85 @@ public class TestModuleDirs extends JavadocTester {
@Test @Test
public void testNoModuleDirs(Path base) throws IOException { public void testNoModuleDirs(Path base) throws IOException {
Path src = base.resolve("src"); Path src = base.resolve("src");
new ModuleBuilder(tb, "m") new ModuleBuilder(tb, "ma")
.classes("package p; public class A {}") .classes("package pa; public class A {}")
.exports("p") .exports("pa")
.write(src);
new ModuleBuilder(tb, "mb")
.classes("package pb; public class B {}")
.exports("pb")
.write(src); .write(src);
javadoc("-d", base.resolve("api").toString(), javadoc("-d", base.resolve("api").toString(),
"-quiet", "-quiet",
"--module-source-path", src.toString(), "--module-source-path", src.toString(),
"--no-module-directories", "--no-module-directories",
"--module", "m"); "--module", "ma,mb");
checkExit(Exit.OK); checkExit(Exit.OK);
checkFiles(true, checkFiles(true,
"m-summary.html", "ma-frame.html",
"p/package-summary.html"); "ma-summary.html",
"pa/package-summary.html");
checkFiles(false, checkFiles(false,
"m/module-summary.html", "ma/module-frame.html",
"m/p/package-summary.html"); "ma/module-summary.html",
"ma/pa/package-summary.html");
checkOutput("ma-frame.html", true,
"<ul>\n"
+ "<li><a href=\"allclasses-frame.html\" target=\"packageFrame\">All&nbsp;Classes</a></li>\n"
+ "<li><a href=\"overview-frame.html\" target=\"packageListFrame\">All&nbsp;Packages</a></li>\n"
+ "<li><a href=\"module-overview-frame.html\" target=\"packageListFrame\">All&nbsp;Modules</a></li>\n"
+ "</ul>\n");
checkOutput("ma-summary.html", true,
"<ul class=\"navList\" id=\"allclasses_navbar_top\">\n"
+ "<li><a href=\"allclasses-noframe.html\">All&nbsp;Classes</a></li>\n"
+ "</ul>\n");
checkOutput("pa/package-summary.html", true,
"<li><a href=\"../deprecated-list.html\">Deprecated</a></li>\n"
+ "<li><a href=\"../index-all.html\">Index</a></li>");
} }
@Test @Test
public void testModuleDirs(Path base) throws IOException { public void testModuleDirs(Path base) throws IOException {
Path src = base.resolve("src"); Path src = base.resolve("src");
new ModuleBuilder(tb, "m") new ModuleBuilder(tb, "ma")
.classes("package p; public class A {}") .classes("package pa; public class A {}")
.exports("p") .exports("pa")
.write(src);
new ModuleBuilder(tb, "mb")
.classes("package pb; public class B {}")
.exports("pb")
.write(src); .write(src);
javadoc("-d", base.resolve("api").toString(), javadoc("-d", base.resolve("api").toString(),
"-quiet", "-quiet",
"--module-source-path", src.toString(), "--module-source-path", src.toString(),
"--module", "m"); "--module", "ma,mb");
checkExit(Exit.OK); checkExit(Exit.OK);
checkFiles(false, checkFiles(false,
"m-summary.html", "ma-frame.html",
"p/package-summary.html"); "ma-summary.html",
"pa/package-summary.html");
checkFiles(true, checkFiles(true,
"m/module-summary.html", "ma/module-frame.html",
"m/p/package-summary.html"); "ma/module-summary.html",
"ma/pa/package-summary.html");
checkOutput("ma/module-frame.html", true,
"<ul>\n"
+ "<li><a href=\"../allclasses-frame.html\" target=\"packageFrame\">All&nbsp;Classes</a></li>\n"
+ "<li><a href=\"../overview-frame.html\" target=\"packageListFrame\">All&nbsp;Packages</a></li>\n"
+ "<li><a href=\"../module-overview-frame.html\" target=\"packageListFrame\">All&nbsp;Modules</a></li>\n"
+ "</ul>\n");
checkOutput("ma/module-summary.html", true,
"<ul class=\"navList\" id=\"allclasses_navbar_top\">\n"
+ "<li><a href=\"../allclasses-noframe.html\">All&nbsp;Classes</a></li>\n"
+ "</ul>\n");
checkOutput("ma/pa/package-summary.html", true,
"<li><a href=\"../../deprecated-list.html\">Deprecated</a></li>\n"
+ "<li><a href=\"../../index-all.html\">Index</a></li>");
} }
} }

View File

@ -127,6 +127,8 @@ compiler.misc.bad.const.pool.entry # constant pool entry ha
compiler.warn.access.to.member.from.serializable.lambda # in order to generate it we need to modify a restricted package compiler.warn.access.to.member.from.serializable.lambda # in order to generate it we need to modify a restricted package
compiler.warn.invalid.path # this warning is generated only in Windows systems compiler.warn.invalid.path # this warning is generated only in Windows systems
compiler.note.multiple.elements # needs user code compiler.note.multiple.elements # needs user code
compiler.err.preview.feature.disabled.classfile # preview feature support: needs compilation against classfile
compiler.warn.preview.feature.use.classfile # preview feature support: needs compilation against classfile
# The following module-related messages will have to stay on the not-yet list for various reasons: # The following module-related messages will have to stay on the not-yet list for various reasons:
compiler.warn.locn.unknown.file.on.module.path # Never issued ATM (short circuited with an if (false)) compiler.warn.locn.unknown.file.on.module.path # Never issued ATM (short circuited with an if (false))

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -22,18 +22,15 @@
* or visit www.oracle.com if you need additional information or have any * or visit www.oracle.com if you need additional information or have any
* questions. * questions.
*/ */
package jdk.internal.misc;
import java.security.PermissionCollection; // key: compiler.err.preview.feature.disabled
import java.security.ProtectionDomain; // key: compiler.misc.feature.diamond
// options: -XDforcePreview
public interface JavaSecurityProtectionDomainAccess { import java.util.ArrayList;
interface ProtectionDomainCache {
void put(ProtectionDomain pd, PermissionCollection pc); class PreviewFeatureDisabled {
PermissionCollection get(ProtectionDomain pd); void m() {
new ArrayList<>();
} }
/**
* Returns the ProtectionDomainCache.
*/
ProtectionDomainCache getProtectionDomainCache();
} }

View File

@ -0,0 +1,34 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
// key: compiler.err.preview.feature.disabled.plural
// key: compiler.misc.feature.lambda
// options: -XDforcePreview
class PreviewFeatureDisabledPlural {
void m() {
Runnable r = () -> {};
}
}

View File

@ -0,0 +1,39 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
//key: compiler.warn.preview.feature.use
//key: compiler.warn.preview.feature.use.plural
//key: compiler.misc.feature.diamond
//key: compiler.misc.feature.lambda
//options: -Xlint:preview -XDforcePreview -source 11 --enable-preview
import java.util.ArrayList;
class PreviewFeatureUse {
void test() {
new ArrayList<>();
Runnable r = () -> {};
}
}

View File

@ -0,0 +1,35 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. 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.note.preview.filename
// key: compiler.note.preview.recompile
// options: -XDforcePreview -source 11 --enable-preview
import java.util.ArrayList;
import java.util.List;
class PreviewFilename {
List<String> ls = new ArrayList<>();
}

View File

@ -0,0 +1,38 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
// key: compiler.note.preview.filename.additional
// key: compiler.warn.preview.feature.use
// key: compiler.misc.feature.diamond
// options: -Xlint:preview -Xmaxwarns 1 -XDforcePreview -source 11 --enable-preview
import java.util.ArrayList;
class PreviewFilenameAdditional {
void test() {
new ArrayList<>();
new ArrayList<>();
}
}

View File

@ -0,0 +1,28 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
class Bar {
Runnable r = () -> {};
}

View File

@ -0,0 +1,37 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
// key: compiler.note.preview.plural
// key: compiler.note.preview.recompile
// options: -XDforcePreview -source 11 --enable-preview
import java.util.ArrayList;
class PreviewPlural {
void test() {
new Bar();
new ArrayList<>();
}
}

View File

@ -0,0 +1,33 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import java.util.ArrayList;
class Bar {
Runnable r = () -> {};
void test() {
new ArrayList<>();
}
}

View File

@ -0,0 +1,38 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
// key: compiler.note.preview.plural.additional
// key: compiler.warn.preview.feature.use.plural
// key: compiler.misc.feature.lambda
// options: -Xlint:preview -Xmaxwarns 1 -XDforcePreview -source 11 --enable-preview
import java.util.ArrayList;
class PreviewPlural {
void test() {
new Bar();
new ArrayList<>();
}
}

View File

@ -32,6 +32,12 @@ public class Deduplication {
void group(Object... xs) {} void group(Object... xs) {}
void test() { void test() {
group(
(Runnable) () -> { ( (Runnable) () -> {} ).run(); },
(Runnable) () -> { ( (Runnable) () -> {} ).run(); }
);
group((Function<String, Integer>) x -> x.hashCode()); group((Function<String, Integer>) x -> x.hashCode());
group((Function<Object, Integer>) x -> x.hashCode()); group((Function<Object, Integer>) x -> x.hashCode());

View File

@ -252,7 +252,7 @@ public class CompileModulePatchTest extends ModuleTestBase {
.getOutputLines(Task.OutputKind.DIRECT); .getOutputLines(Task.OutputKind.DIRECT);
List<String> expectedOut = Arrays.asList( List<String> expectedOut = Arrays.asList(
"Extra.java:1:76: compiler.err.doesnt.exist: p", "Extra.java:1:75: compiler.err.package.not.visible: p, (compiler.misc.not.def.access.does.not.read.unnamed: p, java.compiler)",
"1 error" "1 error"
); );

View File

@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8169197 8172668 8173117 8175007 * @bug 8169197 8172668 8173117 8175007 8189765
* @summary Check convenient errors are produced for inaccessible classes. * @summary Check convenient errors are produced for inaccessible classes.
* @library /tools/lib * @library /tools/lib
* @modules jdk.compiler/com.sun.tools.javac.api * @modules jdk.compiler/com.sun.tools.javac.api
@ -199,7 +199,7 @@ public class ConvenientAccessErrorsTest extends ModuleTestBase {
throw new Exception("expected output not found; actual: " + log); throw new Exception("expected output not found; actual: " + log);
} }
// @Test @Test
public void testInaccessibleUnnamedModule(Path base) throws Exception { public void testInaccessibleUnnamedModule(Path base) throws Exception {
Path jar = prepareTestJar(base, "package api; class Api { public static class Foo {} }"); Path jar = prepareTestJar(base, "package api; class Api { public static class Foo {} }");
@ -224,8 +224,8 @@ public class ConvenientAccessErrorsTest extends ModuleTestBase {
.getOutputLines(Task.OutputKind.DIRECT); .getOutputLines(Task.OutputKind.DIRECT);
List<String> expected = Arrays.asList( List<String> expected = Arrays.asList(
"Test.java:1:38: compiler.err.not.def.access.package.cant.access: api.Api, api, (compiler.misc.not.def.access.does.not.read.unnamed: api, m1x)", "Test.java:1:35: compiler.err.package.not.visible: api, (compiler.misc.not.def.access.does.not.read.unnamed: api, m1x)",
"Test.java:1:51: compiler.err.not.def.access.package.cant.access: api.Api, api, (compiler.misc.not.def.access.does.not.read.unnamed: api, m1x)", "Test.java:1:48: compiler.err.package.not.visible: api, (compiler.misc.not.def.access.does.not.read.unnamed: api, m1x)",
"2 errors"); "2 errors");
if (!expected.equals(log)) if (!expected.equals(log))

View File

@ -77,7 +77,7 @@ public class ModulesAndClassPathTest extends ModuleTestBase {
.writeAll() .writeAll()
.getOutputLines(Task.OutputKind.DIRECT); .getOutputLines(Task.OutputKind.DIRECT);
List<String> expected = Arrays.asList("Impl.java:1:38: compiler.err.doesnt.exist: api", List<String> expected = Arrays.asList("Impl.java:1:35: compiler.err.package.not.visible: api, (compiler.misc.not.def.access.does.not.read.unnamed: api, m)",
"1 error"); "1 error");
if (!expected.equals(modLog)) { if (!expected.equals(modLog)) {
@ -129,7 +129,7 @@ public class ModulesAndClassPathTest extends ModuleTestBase {
.writeAll() .writeAll()
.getOutputLines(Task.OutputKind.DIRECT); .getOutputLines(Task.OutputKind.DIRECT);
List<String> expected = Arrays.asList("Impl.java:1:38: compiler.err.doesnt.exist: api", List<String> expected = Arrays.asList("Impl.java:1:35: compiler.err.package.not.visible: api, (compiler.misc.not.def.access.does.not.read.unnamed: api, m)",
"1 error"); "1 error");
if (!expected.equals(modLog)) { if (!expected.equals(modLog)) {
@ -170,7 +170,7 @@ public class ModulesAndClassPathTest extends ModuleTestBase {
.writeAll() .writeAll()
.getOutputLines(Task.OutputKind.DIRECT); .getOutputLines(Task.OutputKind.DIRECT);
List<String> expected = Arrays.asList("Impl.java:1:38: compiler.err.doesnt.exist: api", List<String> expected = Arrays.asList("Impl.java:1:35: compiler.err.package.not.visible: api, (compiler.misc.not.def.access.does.not.read.unnamed: api, m)",
"1 error"); "1 error");
if (!expected.equals(modLog)) { if (!expected.equals(modLog)) {

View File

@ -0,0 +1,113 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8199194
* @summary smoke test for enable-preview command line flag
* @modules jdk.compiler/com.sun.tools.javac.code
*/
import java.io.*;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import com.sun.tools.javac.code.Source;
public class PreviewOptionTest {
public static void main(String... args) throws Exception {
PreviewOptionTest t = new PreviewOptionTest();
t.run();
}
public void run() throws Exception {
try (FileWriter out = new FileWriter("Test.java")) {
out.write("class Test { }");
}
testWithNoFlags();
List<Source> versionsToTest = Stream.of(Source.values())
.filter(s -> s.compareTo(Source.MIN) >= 0)
.collect(Collectors.toList());
versionsToTest.stream().forEach(this::testWithSourceFlag);
versionsToTest.stream().forEach(this::testWithReleaseFlag);
if (errors > 0)
throw new Exception(errors + " errors occurred");
}
void testWithNoFlags() {
testInternal(null, null, true);
}
void testWithSourceFlag(Source source) {
testInternal(source, null, source != Source.DEFAULT);
}
void testWithReleaseFlag(Source release) {
//Todo: the condition below should say "release != Source.DEFAULT", but we can't do that
//since --release 11 is not supported yet.
testInternal(null, release, true);
}
void testInternal(Source source, Source release, boolean shouldFail) {
System.err.println("Test: source:" + source + ", release:" + release + " " + shouldFail + " " + shouldFail);
List<String> args = new ArrayList<>();
args.add("--enable-preview");
if (source != null) {
args.add("-source");
args.add(source.name);
}
if (release != null) {
args.add("--release");
args.add(release.name);
}
args.add("Test.java");
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
int rc = com.sun.tools.javac.Main.compile(args.toArray(new String[args.size()]), pw);
pw.close();
boolean hasErrors = rc != 0;
if (hasErrors != shouldFail) {
if (hasErrors) {
String out = sw.toString();
error("error not expected but found:\n" + out);
} else {
error("error expected but not found");
}
}
}
void error(String msg) {
System.err.println("error: " + msg);
errors++;
}
int errors;
}

View File

@ -0,0 +1,28 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
public class Bar {
Runnable r = () -> {};
}

View File

@ -0,0 +1,14 @@
/*
* @test /nodynamioccopyright/
* @bug 8199194
* @summary smoke test for --enabled-preview classreader support
* @compile -XDforcePreview --enable-preview -source 11 Bar.java
* @compile/fail/ref=Client.nopreview.out -Xlint:preview -XDrawDiagnostics Client.java
* @compile/fail/ref=Client.preview.out -Werror -Xlint:preview -XDrawDiagnostics --enable-preview -source 11 Client.java
*/
public class Client {
void test() {
new Bar();
}
}

View File

@ -0,0 +1,2 @@
- compiler.err.preview.feature.disabled.classfile: Bar.class, 11
1 error

View File

@ -0,0 +1,4 @@
- compiler.warn.preview.feature.use.classfile: Bar.class, 11
- compiler.err.warnings.and.werror
1 error
1 warning