diff --git a/.hgtags b/.hgtags index a85caf27420..5eb1df173db 100644 --- a/.hgtags +++ b/.hgtags @@ -189,3 +189,6 @@ cdaa6122185f9bf512dcd6600f56bfccc4824e8c jdk8-b61 a2cf4d4a484378caea2e827ed604b2bbae58bdba jdk8-b65 17820b958ae84f7c1cc6719319c8e2232f7a4f1d jdk8-b66 76cc9bd3ece407d3a15d3bea537b57927973c5e7 jdk8-b67 +cb33628d4e8f11e879c371959e5948b66a53376f jdk8-b68 +adb5171c554e14cd86f618b5584f6e3d693d5889 jdk8-b69 +0d625373c69e2ad6f546fd88ab50c6c9aad01271 jdk8-b70 diff --git a/.hgtags-top-repo b/.hgtags-top-repo index e46dc2409da..e187abcd614 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -190,3 +190,5 @@ b772de306dc24c17f7bd1398531ddeb58723b804 jdk8-b65 13bb8c326e7b7b0b19d78c8088033e3932e3f7ca jdk8-b66 9a6ec97ec45c1a62d5233cefa91e8390e380e13a jdk8-b67 cdb401a60cea6ad5ef3f498725ed1decf8dda1ea jdk8-b68 +6ee8080a6efe0639fcd00627a5e0f839bf010481 jdk8-b69 +105a25ffa4a4f0af70188d4371b4a0385009b7ce jdk8-b70 diff --git a/common/autoconf/basics.m4 b/common/autoconf/basics.m4 index f2398978543..0074e8c16b1 100644 --- a/common/autoconf/basics.m4 +++ b/common/autoconf/basics.m4 @@ -90,13 +90,25 @@ AC_DEFUN([BASIC_FIXUP_EXECUTABLE], tmp="$complete EOL" arguments="${tmp#* }" - new_path=`$WHICH $path 2> /dev/null` + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + AC_MSG_NOTICE([Resolving $1 (as $path) failed, using $path directly.]) + new_path="$path" + fi + if test "x$new_path" = x; then - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test "x$is_absolute_path" != x; then - AC_MSG_NOTICE([Resolving $1 (as $path) with 'which' failed, using $path directly.]) - new_path="$path" - else AC_MSG_NOTICE([The path of $1, which resolves as "$complete", is not found.]) has_space=`$ECHO "$complete" | $GREP " "` if test "x$has_space" != x; then @@ -104,20 +116,19 @@ AC_DEFUN([BASIC_FIXUP_EXECUTABLE], fi AC_MSG_ERROR([Cannot locate the the path of $1]) fi - fi fi - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi if test "x$complete" != "x$new_complete"; then - $1="$new_complete" - AC_MSG_NOTICE([Rewriting $1 to "$new_complete"]) - fi + $1="$new_complete" + AC_MSG_NOTICE([Rewriting $1 to "$new_complete"]) + fi ]) AC_DEFUN([BASIC_REMOVE_SYMBOLIC_LINKS], diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index b1495417e4a..38370ee3636 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.67 for OpenJDK jdk8. +# Generated by GNU Autoconf 2.68 for OpenJDK jdk8. # # Report bugs to . # @@ -91,6 +91,7 @@ fi IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. +as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -216,11 +217,18 @@ IFS=$as_save_IFS # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. + # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} + case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; + esac + exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : @@ -812,6 +820,7 @@ MACOSX_UNIVERSAL JVM_VARIANT_ZEROSHARK JVM_VARIANT_ZERO JVM_VARIANT_KERNEL +JVM_VARIANT_MINIMAL1 JVM_VARIANT_CLIENT JVM_VARIANT_SERVER JVM_VARIANTS @@ -1430,7 +1439,7 @@ Try \`$0 --help' for more information" $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac @@ -1684,7 +1693,7 @@ Optional Packages: sys-root (for cross-compiling) --with-jdk-variant JDK variant to build (normal) [normal] --with-jvm-variants JVM variants (separated by commas) to build (server, - client, kernel, zero, zeroshark) [server] + client, minimal1, kernel, zero, zeroshark) [server] --with-debug-level set the debug level (release, fastdebug, slowdebug) [release] --with-conf-name use this as the name of the configuration [generated @@ -1850,7 +1859,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF OpenJDK configure jdk8 -generated by GNU Autoconf 2.67 +generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation @@ -1896,7 +1905,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile @@ -1934,7 +1943,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_compile @@ -1972,7 +1981,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_objc_try_compile @@ -2009,7 +2018,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp @@ -2046,7 +2055,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_cpp @@ -2059,10 +2068,10 @@ fi ac_fn_cxx_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval "test \"\${$3+set}\"" = set; then : + if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 @@ -2129,7 +2138,7 @@ $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" @@ -2138,7 +2147,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_cxx_check_header_mongrel @@ -2179,7 +2188,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_run @@ -2193,7 +2202,7 @@ ac_fn_cxx_check_header_compile () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2211,7 +2220,7 @@ fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_cxx_check_header_compile @@ -2388,7 +2397,7 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ rm -f conftest.val fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_compute_int @@ -2434,7 +2443,7 @@ fi # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_link @@ -2447,7 +2456,7 @@ ac_fn_cxx_check_func () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2502,7 +2511,7 @@ fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_cxx_check_func @@ -2515,7 +2524,7 @@ ac_fn_c_check_header_compile () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2533,7 +2542,7 @@ fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile cat >config.log <<_ACEOF @@ -2541,7 +2550,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by OpenJDK $as_me jdk8, which was -generated by GNU Autoconf 2.67. Invocation command line was +generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2799,7 +2808,7 @@ $as_echo "$as_me: loading site script $ac_site_file" >&6;} || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi done @@ -3674,7 +3683,7 @@ fi #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1355221914 +DATE_WHEN_GENERATED=1355963953 ############################################################################### # @@ -3712,7 +3721,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_BASENAME+set}" = set; then : +if ${ac_cv_path_BASENAME+:} false; then : $as_echo_n "(cached) " >&6 else case $BASENAME in @@ -3771,7 +3780,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_BASH+set}" = set; then : +if ${ac_cv_path_BASH+:} false; then : $as_echo_n "(cached) " >&6 else case $BASH in @@ -3830,7 +3839,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_CAT+set}" = set; then : +if ${ac_cv_path_CAT+:} false; then : $as_echo_n "(cached) " >&6 else case $CAT in @@ -3889,7 +3898,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_CHMOD+set}" = set; then : +if ${ac_cv_path_CHMOD+:} false; then : $as_echo_n "(cached) " >&6 else case $CHMOD in @@ -3948,7 +3957,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_CMP+set}" = set; then : +if ${ac_cv_path_CMP+:} false; then : $as_echo_n "(cached) " >&6 else case $CMP in @@ -4007,7 +4016,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_CP+set}" = set; then : +if ${ac_cv_path_CP+:} false; then : $as_echo_n "(cached) " >&6 else case $CP in @@ -4066,7 +4075,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_CUT+set}" = set; then : +if ${ac_cv_path_CUT+:} false; then : $as_echo_n "(cached) " >&6 else case $CUT in @@ -4125,7 +4134,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_DATE+set}" = set; then : +if ${ac_cv_path_DATE+:} false; then : $as_echo_n "(cached) " >&6 else case $DATE in @@ -4184,7 +4193,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_DIFF+set}" = set; then : +if ${ac_cv_path_DIFF+:} false; then : $as_echo_n "(cached) " >&6 else case $DIFF in @@ -4243,7 +4252,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_DIRNAME+set}" = set; then : +if ${ac_cv_path_DIRNAME+:} false; then : $as_echo_n "(cached) " >&6 else case $DIRNAME in @@ -4302,7 +4311,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_ECHO+set}" = set; then : +if ${ac_cv_path_ECHO+:} false; then : $as_echo_n "(cached) " >&6 else case $ECHO in @@ -4361,7 +4370,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_EXPR+set}" = set; then : +if ${ac_cv_path_EXPR+:} false; then : $as_echo_n "(cached) " >&6 else case $EXPR in @@ -4420,7 +4429,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_FILE+set}" = set; then : +if ${ac_cv_path_FILE+:} false; then : $as_echo_n "(cached) " >&6 else case $FILE in @@ -4479,7 +4488,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_FIND+set}" = set; then : +if ${ac_cv_path_FIND+:} false; then : $as_echo_n "(cached) " >&6 else case $FIND in @@ -4538,7 +4547,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_HEAD+set}" = set; then : +if ${ac_cv_path_HEAD+:} false; then : $as_echo_n "(cached) " >&6 else case $HEAD in @@ -4597,7 +4606,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_LN+set}" = set; then : +if ${ac_cv_path_LN+:} false; then : $as_echo_n "(cached) " >&6 else case $LN in @@ -4656,7 +4665,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_LS+set}" = set; then : +if ${ac_cv_path_LS+:} false; then : $as_echo_n "(cached) " >&6 else case $LS in @@ -4715,7 +4724,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_MKDIR+set}" = set; then : +if ${ac_cv_path_MKDIR+:} false; then : $as_echo_n "(cached) " >&6 else case $MKDIR in @@ -4774,7 +4783,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_MKTEMP+set}" = set; then : +if ${ac_cv_path_MKTEMP+:} false; then : $as_echo_n "(cached) " >&6 else case $MKTEMP in @@ -4833,7 +4842,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_MV+set}" = set; then : +if ${ac_cv_path_MV+:} false; then : $as_echo_n "(cached) " >&6 else case $MV in @@ -4892,7 +4901,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_PRINTF+set}" = set; then : +if ${ac_cv_path_PRINTF+:} false; then : $as_echo_n "(cached) " >&6 else case $PRINTF in @@ -4951,7 +4960,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_THEPWDCMD+set}" = set; then : +if ${ac_cv_path_THEPWDCMD+:} false; then : $as_echo_n "(cached) " >&6 else case $THEPWDCMD in @@ -5010,7 +5019,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_RM+set}" = set; then : +if ${ac_cv_path_RM+:} false; then : $as_echo_n "(cached) " >&6 else case $RM in @@ -5069,7 +5078,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_SH+set}" = set; then : +if ${ac_cv_path_SH+:} false; then : $as_echo_n "(cached) " >&6 else case $SH in @@ -5128,7 +5137,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_SORT+set}" = set; then : +if ${ac_cv_path_SORT+:} false; then : $as_echo_n "(cached) " >&6 else case $SORT in @@ -5187,7 +5196,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_TAIL+set}" = set; then : +if ${ac_cv_path_TAIL+:} false; then : $as_echo_n "(cached) " >&6 else case $TAIL in @@ -5246,7 +5255,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_TAR+set}" = set; then : +if ${ac_cv_path_TAR+:} false; then : $as_echo_n "(cached) " >&6 else case $TAR in @@ -5305,7 +5314,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_TEE+set}" = set; then : +if ${ac_cv_path_TEE+:} false; then : $as_echo_n "(cached) " >&6 else case $TEE in @@ -5364,7 +5373,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_TOUCH+set}" = set; then : +if ${ac_cv_path_TOUCH+:} false; then : $as_echo_n "(cached) " >&6 else case $TOUCH in @@ -5423,7 +5432,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_TR+set}" = set; then : +if ${ac_cv_path_TR+:} false; then : $as_echo_n "(cached) " >&6 else case $TR in @@ -5482,7 +5491,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_UNAME+set}" = set; then : +if ${ac_cv_path_UNAME+:} false; then : $as_echo_n "(cached) " >&6 else case $UNAME in @@ -5541,7 +5550,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_UNIQ+set}" = set; then : +if ${ac_cv_path_UNIQ+:} false; then : $as_echo_n "(cached) " >&6 else case $UNIQ in @@ -5600,7 +5609,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_WC+set}" = set; then : +if ${ac_cv_path_WC+:} false; then : $as_echo_n "(cached) " >&6 else case $WC in @@ -5659,7 +5668,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_WHICH+set}" = set; then : +if ${ac_cv_path_WHICH+:} false; then : $as_echo_n "(cached) " >&6 else case $WHICH in @@ -5718,7 +5727,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_XARGS+set}" = set; then : +if ${ac_cv_path_XARGS+:} false; then : $as_echo_n "(cached) " >&6 else case $XARGS in @@ -5778,7 +5787,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_AWK+set}" = set; then : +if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then @@ -5828,7 +5837,7 @@ $as_echo "$as_me: Could not find $PROG_NAME!" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if test "${ac_cv_path_GREP+set}" = set; then : +if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then @@ -5903,7 +5912,7 @@ $as_echo "$as_me: Could not find $PROG_NAME!" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then : +if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 @@ -5982,7 +5991,7 @@ $as_echo "$as_me: Could not find $PROG_NAME!" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } -if test "${ac_cv_path_FGREP+set}" = set; then : +if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 @@ -6061,7 +6070,7 @@ $as_echo "$as_me: Could not find $PROG_NAME!" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } -if test "${ac_cv_path_SED+set}" = set; then : +if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ @@ -6147,7 +6156,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_NAWK+set}" = set; then : +if ${ac_cv_path_NAWK+:} false; then : $as_echo_n "(cached) " >&6 else case $NAWK in @@ -6207,7 +6216,7 @@ RM="$RM -f" set dummy cygpath; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_CYGPATH+set}" = set; then : +if ${ac_cv_path_CYGPATH+:} false; then : $as_echo_n "(cached) " >&6 else case $CYGPATH in @@ -6247,7 +6256,7 @@ fi set dummy readlink; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_READLINK+set}" = set; then : +if ${ac_cv_path_READLINK+:} false; then : $as_echo_n "(cached) " >&6 else case $READLINK in @@ -6287,7 +6296,7 @@ fi set dummy df; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_DF+set}" = set; then : +if ${ac_cv_path_DF+:} false; then : $as_echo_n "(cached) " >&6 else case $DF in @@ -6327,7 +6336,7 @@ fi set dummy SetFile; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_SETFILE+set}" = set; then : +if ${ac_cv_path_SETFILE+:} false; then : $as_echo_n "(cached) " >&6 else case $SETFILE in @@ -6373,7 +6382,7 @@ $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } -if test "${ac_cv_build+set}" = set; then : +if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias @@ -6389,7 +6398,7 @@ fi $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; -*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' @@ -6407,7 +6416,7 @@ case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } -if test "${ac_cv_host+set}" = set; then : +if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then @@ -6422,7 +6431,7 @@ fi $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; -*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' @@ -6440,7 +6449,7 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 $as_echo_n "checking target system type... " >&6; } -if test "${ac_cv_target+set}" = set; then : +if ${ac_cv_target+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$target_alias" = x; then @@ -6455,7 +6464,7 @@ fi $as_echo "$ac_cv_target" >&6; } case $ac_cv_target in *-*-*) ;; -*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5 ;; +*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; esac target=$ac_cv_target ac_save_IFS=$IFS; IFS='-' @@ -7387,6 +7396,7 @@ $as_echo "$JDK_VARIANT" >&6; } # Currently we have: # server: normal interpreter and a tiered C1/C2 compiler # client: normal interpreter and C1 (no C2 compiler) (only 32-bit platforms) +# minimal1: reduced form of client with optional VM services and features stripped out # kernel: kernel footprint JVM that passes the TCK without major performance problems, # ie normal interpreter and C1, only the serial GC, kernel jvmti etc # zero: no machine code interpreter, no compiler @@ -7405,16 +7415,17 @@ if test "x$with_jvm_variants" = x; then fi JVM_VARIANTS=",$with_jvm_variants," -TEST_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/server,//' -e 's/client,//' -e 's/kernel,//' -e 's/zero,//' -e 's/zeroshark,//'` +TEST_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/server,//' -e 's/client,//' -e 's/minimal1,//' -e 's/kernel,//' -e 's/zero,//' -e 's/zeroshark,//'` if test "x$TEST_VARIANTS" != "x,"; then - as_fn_error $? "The available JVM variants are: server, client, kernel, zero, zeroshark" "$LINENO" 5 + as_fn_error $? "The available JVM variants are: server, client, minimal1, kernel, zero, zeroshark" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_jvm_variants" >&5 $as_echo "$with_jvm_variants" >&6; } JVM_VARIANT_SERVER=`$ECHO "$JVM_VARIANTS" | $SED -e '/,server,/!s/.*/false/g' -e '/,server,/s/.*/true/g'` JVM_VARIANT_CLIENT=`$ECHO "$JVM_VARIANTS" | $SED -e '/,client,/!s/.*/false/g' -e '/,client,/s/.*/true/g'` +JVM_VARIANT_MINIMAL1=`$ECHO "$JVM_VARIANTS" | $SED -e '/,minimal1,/!s/.*/false/g' -e '/,minimal1,/s/.*/true/g'` JVM_VARIANT_KERNEL=`$ECHO "$JVM_VARIANTS" | $SED -e '/,kernel,/!s/.*/false/g' -e '/,kernel,/s/.*/true/g'` JVM_VARIANT_ZERO=`$ECHO "$JVM_VARIANTS" | $SED -e '/,zero,/!s/.*/false/g' -e '/,zero,/s/.*/true/g'` JVM_VARIANT_ZEROSHARK=`$ECHO "$JVM_VARIANTS" | $SED -e '/,zeroshark,/!s/.*/false/g' -e '/,zeroshark,/s/.*/true/g'` @@ -7429,10 +7440,15 @@ if test "x$JVM_VARIANT_KERNEL" = xtrue; then as_fn_error $? "You cannot build a kernel JVM for a 64-bit machine." "$LINENO" 5 fi fi +if test "x$JVM_VARIANT_MINIMAL1" = xtrue; then + if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then + as_fn_error $? "You cannot build a minimal JVM for a 64-bit machine." "$LINENO" 5 + fi +fi # Replace the commas with AND for use in the build directory name. ANDED_JVM_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/^,//' -e 's/,$//' -e 's/,/AND/'` -COUNT_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/server,/1/' -e 's/client,/1/' -e 's/kernel,/1/' -e 's/zero,/1/' -e 's/zeroshark,/1/'` +COUNT_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/server,/1/' -e 's/client,/1/' -e 's/minimal1,/1/' -e 's/kernel,/1/' -e 's/zero,/1/' -e 's/zeroshark,/1/'` if test "x$COUNT_VARIANTS" != "x,1"; then BUILDING_MULTIPLE_JVM_VARIANTS=yes else @@ -7446,6 +7462,7 @@ fi + if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then MACOSX_UNIVERSAL="true" fi @@ -7531,7 +7548,9 @@ esac ##### # Generate the legacy makefile targets for hotspot. # The hotspot api for selecting the build artifacts, really, needs to be improved. -# +# JDK-7195896 will fix this on the hotspot side by using the JVM_VARIANT_* variables to +# determine what needs to be built. All we will need to set here is all_product, all_fastdebug etc +# But until then ... HOTSPOT_TARGET="" if test "x$JVM_VARIANT_SERVER" = xtrue; then @@ -7542,6 +7561,10 @@ if test "x$JVM_VARIANT_CLIENT" = xtrue; then HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}1 " fi +if test "x$JVM_VARIANT_MINIMAL1" = xtrue; then + HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}minimal1 " +fi + if test "x$JVM_VARIANT_KERNEL" = xtrue; then HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}kernel " fi @@ -7860,7 +7883,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_PKGHANDLER+set}" = set; then : +if ${ac_cv_prog_PKGHANDLER+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$PKGHANDLER"; then @@ -8165,14 +8188,26 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh tmp="$complete EOL" arguments="${tmp#* }" - new_path=`$WHICH $path 2> /dev/null` + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving FOUND_MAKE (as $path) failed, using $path directly." >&5 +$as_echo "$as_me: Resolving FOUND_MAKE (as $path) failed, using $path directly." >&6;} + new_path="$path" + fi + if test "x$new_path" = x; then - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test "x$is_absolute_path" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving FOUND_MAKE (as $path) with 'which' failed, using $path directly." >&5 -$as_echo "$as_me: Resolving FOUND_MAKE (as $path) with 'which' failed, using $path directly." >&6;} - new_path="$path" - else { $as_echo "$as_me:${as_lineno-$LINENO}: The path of FOUND_MAKE, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of FOUND_MAKE, which resolves as \"$complete\", is not found." >&6;} has_space=`$ECHO "$complete" | $GREP " "` @@ -8182,21 +8217,20 @@ $as_echo "$as_me: This might be caused by spaces in the path, which is not allow fi as_fn_error $? "Cannot locate the the path of FOUND_MAKE" "$LINENO" 5 fi - fi fi - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi if test "x$complete" != "x$new_complete"; then - FOUND_MAKE="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting FOUND_MAKE to \"$new_complete\"" >&5 + FOUND_MAKE="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting FOUND_MAKE to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting FOUND_MAKE to \"$new_complete\"" >&6;} - fi + fi fi fi @@ -8214,7 +8248,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_CHECK_GMAKE+set}" = set; then : +if ${ac_cv_path_CHECK_GMAKE+:} false; then : $as_echo_n "(cached) " >&6 else case $CHECK_GMAKE in @@ -8511,14 +8545,26 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh tmp="$complete EOL" arguments="${tmp#* }" - new_path=`$WHICH $path 2> /dev/null` + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving FOUND_MAKE (as $path) failed, using $path directly." >&5 +$as_echo "$as_me: Resolving FOUND_MAKE (as $path) failed, using $path directly." >&6;} + new_path="$path" + fi + if test "x$new_path" = x; then - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test "x$is_absolute_path" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving FOUND_MAKE (as $path) with 'which' failed, using $path directly." >&5 -$as_echo "$as_me: Resolving FOUND_MAKE (as $path) with 'which' failed, using $path directly." >&6;} - new_path="$path" - else { $as_echo "$as_me:${as_lineno-$LINENO}: The path of FOUND_MAKE, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of FOUND_MAKE, which resolves as \"$complete\", is not found." >&6;} has_space=`$ECHO "$complete" | $GREP " "` @@ -8528,21 +8574,20 @@ $as_echo "$as_me: This might be caused by spaces in the path, which is not allow fi as_fn_error $? "Cannot locate the the path of FOUND_MAKE" "$LINENO" 5 fi - fi fi - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi if test "x$complete" != "x$new_complete"; then - FOUND_MAKE="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting FOUND_MAKE to \"$new_complete\"" >&5 + FOUND_MAKE="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting FOUND_MAKE to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting FOUND_MAKE to \"$new_complete\"" >&6;} - fi + fi fi fi @@ -8557,7 +8602,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_CHECK_MAKE+set}" = set; then : +if ${ac_cv_path_CHECK_MAKE+:} false; then : $as_echo_n "(cached) " >&6 else case $CHECK_MAKE in @@ -8854,14 +8899,26 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh tmp="$complete EOL" arguments="${tmp#* }" - new_path=`$WHICH $path 2> /dev/null` + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving FOUND_MAKE (as $path) failed, using $path directly." >&5 +$as_echo "$as_me: Resolving FOUND_MAKE (as $path) failed, using $path directly." >&6;} + new_path="$path" + fi + if test "x$new_path" = x; then - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test "x$is_absolute_path" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving FOUND_MAKE (as $path) with 'which' failed, using $path directly." >&5 -$as_echo "$as_me: Resolving FOUND_MAKE (as $path) with 'which' failed, using $path directly." >&6;} - new_path="$path" - else { $as_echo "$as_me:${as_lineno-$LINENO}: The path of FOUND_MAKE, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of FOUND_MAKE, which resolves as \"$complete\", is not found." >&6;} has_space=`$ECHO "$complete" | $GREP " "` @@ -8871,21 +8928,20 @@ $as_echo "$as_me: This might be caused by spaces in the path, which is not allow fi as_fn_error $? "Cannot locate the the path of FOUND_MAKE" "$LINENO" 5 fi - fi fi - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi if test "x$complete" != "x$new_complete"; then - FOUND_MAKE="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting FOUND_MAKE to \"$new_complete\"" >&5 + FOUND_MAKE="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting FOUND_MAKE to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting FOUND_MAKE to \"$new_complete\"" >&6;} - fi + fi fi fi @@ -8905,7 +8961,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_CHECK_TOOLSDIR_GMAKE+set}" = set; then : +if ${ac_cv_path_CHECK_TOOLSDIR_GMAKE+:} false; then : $as_echo_n "(cached) " >&6 else case $CHECK_TOOLSDIR_GMAKE in @@ -9202,14 +9258,26 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh tmp="$complete EOL" arguments="${tmp#* }" - new_path=`$WHICH $path 2> /dev/null` + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving FOUND_MAKE (as $path) failed, using $path directly." >&5 +$as_echo "$as_me: Resolving FOUND_MAKE (as $path) failed, using $path directly." >&6;} + new_path="$path" + fi + if test "x$new_path" = x; then - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test "x$is_absolute_path" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving FOUND_MAKE (as $path) with 'which' failed, using $path directly." >&5 -$as_echo "$as_me: Resolving FOUND_MAKE (as $path) with 'which' failed, using $path directly." >&6;} - new_path="$path" - else { $as_echo "$as_me:${as_lineno-$LINENO}: The path of FOUND_MAKE, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of FOUND_MAKE, which resolves as \"$complete\", is not found." >&6;} has_space=`$ECHO "$complete" | $GREP " "` @@ -9219,21 +9287,20 @@ $as_echo "$as_me: This might be caused by spaces in the path, which is not allow fi as_fn_error $? "Cannot locate the the path of FOUND_MAKE" "$LINENO" 5 fi - fi fi - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi if test "x$complete" != "x$new_complete"; then - FOUND_MAKE="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting FOUND_MAKE to \"$new_complete\"" >&5 + FOUND_MAKE="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting FOUND_MAKE to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting FOUND_MAKE to \"$new_complete\"" >&6;} - fi + fi fi fi @@ -9247,7 +9314,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_CHECK_TOOLSDIR_MAKE+set}" = set; then : +if ${ac_cv_path_CHECK_TOOLSDIR_MAKE+:} false; then : $as_echo_n "(cached) " >&6 else case $CHECK_TOOLSDIR_MAKE in @@ -9544,14 +9611,26 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh tmp="$complete EOL" arguments="${tmp#* }" - new_path=`$WHICH $path 2> /dev/null` + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving FOUND_MAKE (as $path) failed, using $path directly." >&5 +$as_echo "$as_me: Resolving FOUND_MAKE (as $path) failed, using $path directly." >&6;} + new_path="$path" + fi + if test "x$new_path" = x; then - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test "x$is_absolute_path" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving FOUND_MAKE (as $path) with 'which' failed, using $path directly." >&5 -$as_echo "$as_me: Resolving FOUND_MAKE (as $path) with 'which' failed, using $path directly." >&6;} - new_path="$path" - else { $as_echo "$as_me:${as_lineno-$LINENO}: The path of FOUND_MAKE, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of FOUND_MAKE, which resolves as \"$complete\", is not found." >&6;} has_space=`$ECHO "$complete" | $GREP " "` @@ -9561,21 +9640,20 @@ $as_echo "$as_me: This might be caused by spaces in the path, which is not allow fi as_fn_error $? "Cannot locate the the path of FOUND_MAKE" "$LINENO" 5 fi - fi fi - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi if test "x$complete" != "x$new_complete"; then - FOUND_MAKE="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting FOUND_MAKE to \"$new_complete\"" >&5 + FOUND_MAKE="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting FOUND_MAKE to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting FOUND_MAKE to \"$new_complete\"" >&6;} - fi + fi fi fi @@ -9632,7 +9710,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_UNZIP+set}" = set; then : +if ${ac_cv_path_UNZIP+:} false; then : $as_echo_n "(cached) " >&6 else case $UNZIP in @@ -9691,7 +9769,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_ZIP+set}" = set; then : +if ${ac_cv_path_ZIP+:} false; then : $as_echo_n "(cached) " >&6 else case $ZIP in @@ -9750,7 +9828,7 @@ $as_echo "$as_me: Could not find $PROG_NAME!" >&6;} set dummy ldd; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_LDD+set}" = set; then : +if ${ac_cv_path_LDD+:} false; then : $as_echo_n "(cached) " >&6 else case $LDD in @@ -9796,7 +9874,7 @@ fi set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_OTOOL+set}" = set; then : +if ${ac_cv_path_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else case $OTOOL in @@ -9841,7 +9919,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_READELF+set}" = set; then : +if ${ac_cv_path_READELF+:} false; then : $as_echo_n "(cached) " >&6 else case $READELF in @@ -9884,7 +9962,7 @@ done set dummy hg; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_HG+set}" = set; then : +if ${ac_cv_path_HG+:} false; then : $as_echo_n "(cached) " >&6 else case $HG in @@ -9924,7 +10002,7 @@ fi set dummy stat; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_STAT+set}" = set; then : +if ${ac_cv_path_STAT+:} false; then : $as_echo_n "(cached) " >&6 else case $STAT in @@ -9964,7 +10042,7 @@ fi set dummy time; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_TIME+set}" = set; then : +if ${ac_cv_path_TIME+:} false; then : $as_echo_n "(cached) " >&6 else case $TIME in @@ -10009,7 +10087,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_COMM+set}" = set; then : +if ${ac_cv_path_COMM+:} false; then : $as_echo_n "(cached) " >&6 else case $COMM in @@ -10073,7 +10151,7 @@ if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_PKG_CONFIG+set}" = set; then : +if ${ac_cv_path_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in @@ -10116,7 +10194,7 @@ if test -z "$ac_cv_path_PKG_CONFIG"; then set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then : +if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in @@ -10289,7 +10367,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_BDEPS_UNZIP+set}" = set; then : +if ${ac_cv_prog_BDEPS_UNZIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$BDEPS_UNZIP"; then @@ -10335,7 +10413,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_BDEPS_FTP+set}" = set; then : +if ${ac_cv_prog_BDEPS_FTP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$BDEPS_FTP"; then @@ -11624,7 +11702,7 @@ $as_echo "$BOOT_JDK_VERSION" >&6; } set dummy javac; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_JAVAC_CHECK+set}" = set; then : +if ${ac_cv_path_JAVAC_CHECK+:} false; then : $as_echo_n "(cached) " >&6 else case $JAVAC_CHECK in @@ -11664,7 +11742,7 @@ fi set dummy java; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_JAVA_CHECK+set}" = set; then : +if ${ac_cv_path_JAVA_CHECK+:} false; then : $as_echo_n "(cached) " >&6 else case $JAVA_CHECK in @@ -15723,7 +15801,7 @@ if test "x$OPENJDK_TARGET_OS" = "xwindows"; then set dummy link; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_CYGWIN_LINK+set}" = set; then : +if ${ac_cv_path_CYGWIN_LINK+:} false; then : $as_echo_n "(cached) " >&6 else case $CYGWIN_LINK in @@ -16373,14 +16451,26 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh tmp="$complete EOL" arguments="${tmp#* }" - new_path=`$WHICH $path 2> /dev/null` + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving VS_ENV_CMD (as $path) failed, using $path directly." >&5 +$as_echo "$as_me: Resolving VS_ENV_CMD (as $path) failed, using $path directly." >&6;} + new_path="$path" + fi + if test "x$new_path" = x; then - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test "x$is_absolute_path" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving VS_ENV_CMD (as $path) with 'which' failed, using $path directly." >&5 -$as_echo "$as_me: Resolving VS_ENV_CMD (as $path) with 'which' failed, using $path directly." >&6;} - new_path="$path" - else { $as_echo "$as_me:${as_lineno-$LINENO}: The path of VS_ENV_CMD, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of VS_ENV_CMD, which resolves as \"$complete\", is not found." >&6;} has_space=`$ECHO "$complete" | $GREP " "` @@ -16390,21 +16480,20 @@ $as_echo "$as_me: This might be caused by spaces in the path, which is not allow fi as_fn_error $? "Cannot locate the the path of VS_ENV_CMD" "$LINENO" 5 fi - fi fi - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi if test "x$complete" != "x$new_complete"; then - VS_ENV_CMD="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting VS_ENV_CMD to \"$new_complete\"" >&5 + VS_ENV_CMD="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting VS_ENV_CMD to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting VS_ENV_CMD to \"$new_complete\"" >&6;} - fi + fi # Lets extract the variables that are set by vcvarsall.bat/vsvars32.bat/vsvars64.bat @@ -16701,7 +16790,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_BUILD_CC+set}" = set; then : +if ${ac_cv_path_BUILD_CC+:} false; then : $as_echo_n "(cached) " >&6 else case $BUILD_CC in @@ -16962,14 +17051,26 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh tmp="$complete EOL" arguments="${tmp#* }" - new_path=`$WHICH $path 2> /dev/null` + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving BUILD_CC (as $path) failed, using $path directly." >&5 +$as_echo "$as_me: Resolving BUILD_CC (as $path) failed, using $path directly." >&6;} + new_path="$path" + fi + if test "x$new_path" = x; then - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test "x$is_absolute_path" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving BUILD_CC (as $path) with 'which' failed, using $path directly." >&5 -$as_echo "$as_me: Resolving BUILD_CC (as $path) with 'which' failed, using $path directly." >&6;} - new_path="$path" - else { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BUILD_CC, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of BUILD_CC, which resolves as \"$complete\", is not found." >&6;} has_space=`$ECHO "$complete" | $GREP " "` @@ -16979,21 +17080,20 @@ $as_echo "$as_me: This might be caused by spaces in the path, which is not allow fi as_fn_error $? "Cannot locate the the path of BUILD_CC" "$LINENO" 5 fi - fi fi - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi if test "x$complete" != "x$new_complete"; then - BUILD_CC="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting BUILD_CC to \"$new_complete\"" >&5 + BUILD_CC="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting BUILD_CC to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting BUILD_CC to \"$new_complete\"" >&6;} - fi + fi for ac_prog in cl CC g++ do @@ -17001,7 +17101,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_BUILD_CXX+set}" = set; then : +if ${ac_cv_path_BUILD_CXX+:} false; then : $as_echo_n "(cached) " >&6 else case $BUILD_CXX in @@ -17262,14 +17362,26 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh tmp="$complete EOL" arguments="${tmp#* }" - new_path=`$WHICH $path 2> /dev/null` + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving BUILD_CXX (as $path) failed, using $path directly." >&5 +$as_echo "$as_me: Resolving BUILD_CXX (as $path) failed, using $path directly." >&6;} + new_path="$path" + fi + if test "x$new_path" = x; then - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test "x$is_absolute_path" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving BUILD_CXX (as $path) with 'which' failed, using $path directly." >&5 -$as_echo "$as_me: Resolving BUILD_CXX (as $path) with 'which' failed, using $path directly." >&6;} - new_path="$path" - else { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BUILD_CXX, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of BUILD_CXX, which resolves as \"$complete\", is not found." >&6;} has_space=`$ECHO "$complete" | $GREP " "` @@ -17279,27 +17391,26 @@ $as_echo "$as_me: This might be caused by spaces in the path, which is not allow fi as_fn_error $? "Cannot locate the the path of BUILD_CXX" "$LINENO" 5 fi - fi fi - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi if test "x$complete" != "x$new_complete"; then - BUILD_CXX="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting BUILD_CXX to \"$new_complete\"" >&5 + BUILD_CXX="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting BUILD_CXX to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting BUILD_CXX to \"$new_complete\"" >&6;} - fi + fi # Extract the first word of "ld", so it can be a program name with args. set dummy ld; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_BUILD_LD+set}" = set; then : +if ${ac_cv_path_BUILD_LD+:} false; then : $as_echo_n "(cached) " >&6 else case $BUILD_LD in @@ -17557,14 +17668,26 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh tmp="$complete EOL" arguments="${tmp#* }" - new_path=`$WHICH $path 2> /dev/null` + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving BUILD_LD (as $path) failed, using $path directly." >&5 +$as_echo "$as_me: Resolving BUILD_LD (as $path) failed, using $path directly." >&6;} + new_path="$path" + fi + if test "x$new_path" = x; then - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test "x$is_absolute_path" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving BUILD_LD (as $path) with 'which' failed, using $path directly." >&5 -$as_echo "$as_me: Resolving BUILD_LD (as $path) with 'which' failed, using $path directly." >&6;} - new_path="$path" - else { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BUILD_LD, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of BUILD_LD, which resolves as \"$complete\", is not found." >&6;} has_space=`$ECHO "$complete" | $GREP " "` @@ -17574,21 +17697,20 @@ $as_echo "$as_me: This might be caused by spaces in the path, which is not allow fi as_fn_error $? "Cannot locate the the path of BUILD_LD" "$LINENO" 5 fi - fi fi - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi if test "x$complete" != "x$new_complete"; then - BUILD_LD="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting BUILD_LD to \"$new_complete\"" >&5 + BUILD_LD="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting BUILD_LD to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting BUILD_LD to \"$new_complete\"" >&6;} - fi + fi fi @@ -17800,7 +17922,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_TOOLS_DIR_CC+set}" = set; then : +if ${ac_cv_path_TOOLS_DIR_CC+:} false; then : $as_echo_n "(cached) " >&6 else case $TOOLS_DIR_CC in @@ -17852,7 +17974,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_POTENTIAL_CC+set}" = set; then : +if ${ac_cv_path_POTENTIAL_CC+:} false; then : $as_echo_n "(cached) " >&6 else case $POTENTIAL_CC in @@ -18144,14 +18266,26 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh tmp="$complete EOL" arguments="${tmp#* }" - new_path=`$WHICH $path 2> /dev/null` + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving CC (as $path) failed, using $path directly." >&5 +$as_echo "$as_me: Resolving CC (as $path) failed, using $path directly." >&6;} + new_path="$path" + fi + if test "x$new_path" = x; then - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test "x$is_absolute_path" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving CC (as $path) with 'which' failed, using $path directly." >&5 -$as_echo "$as_me: Resolving CC (as $path) with 'which' failed, using $path directly." >&6;} - new_path="$path" - else { $as_echo "$as_me:${as_lineno-$LINENO}: The path of CC, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of CC, which resolves as \"$complete\", is not found." >&6;} has_space=`$ECHO "$complete" | $GREP " "` @@ -18161,21 +18295,20 @@ $as_echo "$as_me: This might be caused by spaces in the path, which is not allow fi as_fn_error $? "Cannot locate the the path of CC" "$LINENO" 5 fi - fi fi - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi if test "x$complete" != "x$new_complete"; then - CC="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting CC to \"$new_complete\"" >&5 + CC="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting CC to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting CC to \"$new_complete\"" >&6;} - fi + fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking resolved symbolic links for CC" >&5 $as_echo_n "checking resolved symbolic links for CC... " >&6; } @@ -18254,7 +18387,7 @@ $as_echo "yes, trying to find proper $COMPILER_NAME compiler" >&6; } set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_PROPER_COMPILER_CC+set}" = set; then : +if ${ac_cv_prog_PROPER_COMPILER_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$PROPER_COMPILER_CC"; then @@ -18298,7 +18431,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_PROPER_COMPILER_CC+set}" = set; then : +if ${ac_cv_prog_ac_ct_PROPER_COMPILER_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_PROPER_COMPILER_CC"; then @@ -18569,14 +18702,26 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh tmp="$complete EOL" arguments="${tmp#* }" - new_path=`$WHICH $path 2> /dev/null` + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving PROPER_COMPILER_CC (as $path) failed, using $path directly." >&5 +$as_echo "$as_me: Resolving PROPER_COMPILER_CC (as $path) failed, using $path directly." >&6;} + new_path="$path" + fi + if test "x$new_path" = x; then - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test "x$is_absolute_path" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving PROPER_COMPILER_CC (as $path) with 'which' failed, using $path directly." >&5 -$as_echo "$as_me: Resolving PROPER_COMPILER_CC (as $path) with 'which' failed, using $path directly." >&6;} - new_path="$path" - else { $as_echo "$as_me:${as_lineno-$LINENO}: The path of PROPER_COMPILER_CC, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of PROPER_COMPILER_CC, which resolves as \"$complete\", is not found." >&6;} has_space=`$ECHO "$complete" | $GREP " "` @@ -18586,21 +18731,20 @@ $as_echo "$as_me: This might be caused by spaces in the path, which is not allow fi as_fn_error $? "Cannot locate the the path of PROPER_COMPILER_CC" "$LINENO" 5 fi - fi fi - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi if test "x$complete" != "x$new_complete"; then - PROPER_COMPILER_CC="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting PROPER_COMPILER_CC to \"$new_complete\"" >&5 + PROPER_COMPILER_CC="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting PROPER_COMPILER_CC to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting PROPER_COMPILER_CC to \"$new_complete\"" >&6;} - fi + fi PATH="$RETRY_COMPILER_SAVED_PATH" @@ -18737,7 +18881,7 @@ if test -n "$ac_tool_prefix"; then set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -18781,7 +18925,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -18834,7 +18978,7 @@ fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 @@ -18949,7 +19093,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -18992,7 +19136,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 @@ -19051,7 +19195,7 @@ $as_echo "$ac_try_echo"; } >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi fi fi @@ -19062,7 +19206,7 @@ rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } -if test "${ac_cv_objext+set}" = set; then : +if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -19103,7 +19247,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi @@ -19113,7 +19257,7 @@ OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then : +if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -19150,7 +19294,7 @@ ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then : +if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag @@ -19228,7 +19372,7 @@ else fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then : +if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no @@ -19347,7 +19491,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_TOOLS_DIR_CXX+set}" = set; then : +if ${ac_cv_path_TOOLS_DIR_CXX+:} false; then : $as_echo_n "(cached) " >&6 else case $TOOLS_DIR_CXX in @@ -19399,7 +19543,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_POTENTIAL_CXX+set}" = set; then : +if ${ac_cv_path_POTENTIAL_CXX+:} false; then : $as_echo_n "(cached) " >&6 else case $POTENTIAL_CXX in @@ -19691,14 +19835,26 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh tmp="$complete EOL" arguments="${tmp#* }" - new_path=`$WHICH $path 2> /dev/null` + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving CXX (as $path) failed, using $path directly." >&5 +$as_echo "$as_me: Resolving CXX (as $path) failed, using $path directly." >&6;} + new_path="$path" + fi + if test "x$new_path" = x; then - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test "x$is_absolute_path" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving CXX (as $path) with 'which' failed, using $path directly." >&5 -$as_echo "$as_me: Resolving CXX (as $path) with 'which' failed, using $path directly." >&6;} - new_path="$path" - else { $as_echo "$as_me:${as_lineno-$LINENO}: The path of CXX, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of CXX, which resolves as \"$complete\", is not found." >&6;} has_space=`$ECHO "$complete" | $GREP " "` @@ -19708,21 +19864,20 @@ $as_echo "$as_me: This might be caused by spaces in the path, which is not allow fi as_fn_error $? "Cannot locate the the path of CXX" "$LINENO" 5 fi - fi fi - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi if test "x$complete" != "x$new_complete"; then - CXX="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting CXX to \"$new_complete\"" >&5 + CXX="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting CXX to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting CXX to \"$new_complete\"" >&6;} - fi + fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking resolved symbolic links for CXX" >&5 $as_echo_n "checking resolved symbolic links for CXX... " >&6; } @@ -19801,7 +19956,7 @@ $as_echo "yes, trying to find proper $COMPILER_NAME compiler" >&6; } set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_PROPER_COMPILER_CXX+set}" = set; then : +if ${ac_cv_prog_PROPER_COMPILER_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$PROPER_COMPILER_CXX"; then @@ -19845,7 +20000,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_PROPER_COMPILER_CXX+set}" = set; then : +if ${ac_cv_prog_ac_ct_PROPER_COMPILER_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_PROPER_COMPILER_CXX"; then @@ -20116,14 +20271,26 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh tmp="$complete EOL" arguments="${tmp#* }" - new_path=`$WHICH $path 2> /dev/null` + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving PROPER_COMPILER_CXX (as $path) failed, using $path directly." >&5 +$as_echo "$as_me: Resolving PROPER_COMPILER_CXX (as $path) failed, using $path directly." >&6;} + new_path="$path" + fi + if test "x$new_path" = x; then - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test "x$is_absolute_path" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving PROPER_COMPILER_CXX (as $path) with 'which' failed, using $path directly." >&5 -$as_echo "$as_me: Resolving PROPER_COMPILER_CXX (as $path) with 'which' failed, using $path directly." >&6;} - new_path="$path" - else { $as_echo "$as_me:${as_lineno-$LINENO}: The path of PROPER_COMPILER_CXX, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of PROPER_COMPILER_CXX, which resolves as \"$complete\", is not found." >&6;} has_space=`$ECHO "$complete" | $GREP " "` @@ -20133,21 +20300,20 @@ $as_echo "$as_me: This might be caused by spaces in the path, which is not allow fi as_fn_error $? "Cannot locate the the path of PROPER_COMPILER_CXX" "$LINENO" 5 fi - fi fi - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi if test "x$complete" != "x$new_complete"; then - PROPER_COMPILER_CXX="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting PROPER_COMPILER_CXX to \"$new_complete\"" >&5 + PROPER_COMPILER_CXX="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting PROPER_COMPILER_CXX to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting PROPER_COMPILER_CXX to \"$new_complete\"" >&6;} - fi + fi PATH="$RETRY_COMPILER_SAVED_PATH" @@ -20288,7 +20454,7 @@ if test -z "$CXX"; then set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CXX+set}" = set; then : +if ${ac_cv_prog_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then @@ -20332,7 +20498,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then : +if ${ac_cv_prog_ac_ct_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CXX"; then @@ -20410,7 +20576,7 @@ done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } -if test "${ac_cv_cxx_compiler_gnu+set}" = set; then : +if ${ac_cv_cxx_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -20447,7 +20613,7 @@ ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 $as_echo_n "checking whether $CXX accepts -g... " >&6; } -if test "${ac_cv_prog_cxx_g+set}" = set; then : +if ${ac_cv_prog_cxx_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag @@ -20545,7 +20711,7 @@ if test -n "$ac_tool_prefix"; then set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_OBJC+set}" = set; then : +if ${ac_cv_prog_OBJC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJC"; then @@ -20589,7 +20755,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_OBJC+set}" = set; then : +if ${ac_cv_prog_ac_ct_OBJC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJC"; then @@ -20665,7 +20831,7 @@ done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU Objective C compiler" >&5 $as_echo_n "checking whether we are using the GNU Objective C compiler... " >&6; } -if test "${ac_cv_objc_compiler_gnu+set}" = set; then : +if ${ac_cv_objc_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -20702,7 +20868,7 @@ ac_test_OBJCFLAGS=${OBJCFLAGS+set} ac_save_OBJCFLAGS=$OBJCFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $OBJC accepts -g" >&5 $as_echo_n "checking whether $OBJC accepts -g... " >&6; } -if test "${ac_cv_prog_objc_g+set}" = set; then : +if ${ac_cv_prog_objc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_objc_werror_flag=$ac_objc_werror_flag @@ -21006,14 +21172,26 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh tmp="$complete EOL" arguments="${tmp#* }" - new_path=`$WHICH $path 2> /dev/null` + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving OBJC (as $path) failed, using $path directly." >&5 +$as_echo "$as_me: Resolving OBJC (as $path) failed, using $path directly." >&6;} + new_path="$path" + fi + if test "x$new_path" = x; then - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test "x$is_absolute_path" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving OBJC (as $path) with 'which' failed, using $path directly." >&5 -$as_echo "$as_me: Resolving OBJC (as $path) with 'which' failed, using $path directly." >&6;} - new_path="$path" - else { $as_echo "$as_me:${as_lineno-$LINENO}: The path of OBJC, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of OBJC, which resolves as \"$complete\", is not found." >&6;} has_space=`$ECHO "$complete" | $GREP " "` @@ -21023,21 +21201,20 @@ $as_echo "$as_me: This might be caused by spaces in the path, which is not allow fi as_fn_error $? "Cannot locate the the path of OBJC" "$LINENO" 5 fi - fi fi - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi if test "x$complete" != "x$new_complete"; then - OBJC="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting OBJC to \"$new_complete\"" >&5 + OBJC="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting OBJC to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting OBJC to \"$new_complete\"" >&6;} - fi + fi else OBJC= @@ -21067,7 +21244,7 @@ if test "x$OPENJDK_TARGET_OS" != xwindows; then set dummy ${ac_tool_prefix}ar; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_AR+set}" = set; then : +if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then @@ -21107,7 +21284,7 @@ if test -z "$ac_cv_prog_AR"; then set dummy ar; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_AR+set}" = set; then : +if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then @@ -21376,14 +21553,26 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh tmp="$complete EOL" arguments="${tmp#* }" - new_path=`$WHICH $path 2> /dev/null` + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving AR (as $path) failed, using $path directly." >&5 +$as_echo "$as_me: Resolving AR (as $path) failed, using $path directly." >&6;} + new_path="$path" + fi + if test "x$new_path" = x; then - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test "x$is_absolute_path" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving AR (as $path) with 'which' failed, using $path directly." >&5 -$as_echo "$as_me: Resolving AR (as $path) with 'which' failed, using $path directly." >&6;} - new_path="$path" - else { $as_echo "$as_me:${as_lineno-$LINENO}: The path of AR, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of AR, which resolves as \"$complete\", is not found." >&6;} has_space=`$ECHO "$complete" | $GREP " "` @@ -21393,21 +21582,20 @@ $as_echo "$as_me: This might be caused by spaces in the path, which is not allow fi as_fn_error $? "Cannot locate the the path of AR" "$LINENO" 5 fi - fi fi - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi if test "x$complete" != "x$new_complete"; then - AR="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting AR to \"$new_complete\"" >&5 + AR="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting AR to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting AR to \"$new_complete\"" >&6;} - fi + fi fi if test "x$OPENJDK_TARGET_OS" = xmacosx; then @@ -21438,7 +21626,7 @@ if test "x$OPENJDK_TARGET_OS" = xwindows; then : set dummy link; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_WINLD+set}" = set; then : +if ${ac_cv_prog_WINLD+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$WINLD"; then @@ -21712,14 +21900,26 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh tmp="$complete EOL" arguments="${tmp#* }" - new_path=`$WHICH $path 2> /dev/null` + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving WINLD (as $path) failed, using $path directly." >&5 +$as_echo "$as_me: Resolving WINLD (as $path) failed, using $path directly." >&6;} + new_path="$path" + fi + if test "x$new_path" = x; then - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test "x$is_absolute_path" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving WINLD (as $path) with 'which' failed, using $path directly." >&5 -$as_echo "$as_me: Resolving WINLD (as $path) with 'which' failed, using $path directly." >&6;} - new_path="$path" - else { $as_echo "$as_me:${as_lineno-$LINENO}: The path of WINLD, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of WINLD, which resolves as \"$complete\", is not found." >&6;} has_space=`$ECHO "$complete" | $GREP " "` @@ -21729,21 +21929,20 @@ $as_echo "$as_me: This might be caused by spaces in the path, which is not allow fi as_fn_error $? "Cannot locate the the path of WINLD" "$LINENO" 5 fi - fi fi - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi if test "x$complete" != "x$new_complete"; then - WINLD="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting WINLD to \"$new_complete\"" >&5 + WINLD="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting WINLD to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting WINLD to \"$new_complete\"" >&6;} - fi + fi printf "Windows linker was found at $WINLD\n" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the found link.exe is actually the Visual Studio linker" >&5 @@ -21766,7 +21965,7 @@ $as_echo "yes" >&6; } set dummy mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_MT+set}" = set; then : +if ${ac_cv_prog_MT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MT"; then @@ -22038,14 +22237,26 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh tmp="$complete EOL" arguments="${tmp#* }" - new_path=`$WHICH $path 2> /dev/null` + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving MT (as $path) failed, using $path directly." >&5 +$as_echo "$as_me: Resolving MT (as $path) failed, using $path directly." >&6;} + new_path="$path" + fi + if test "x$new_path" = x; then - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test "x$is_absolute_path" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving MT (as $path) with 'which' failed, using $path directly." >&5 -$as_echo "$as_me: Resolving MT (as $path) with 'which' failed, using $path directly." >&6;} - new_path="$path" - else { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MT, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of MT, which resolves as \"$complete\", is not found." >&6;} has_space=`$ECHO "$complete" | $GREP " "` @@ -22055,28 +22266,27 @@ $as_echo "$as_me: This might be caused by spaces in the path, which is not allow fi as_fn_error $? "Cannot locate the the path of MT" "$LINENO" 5 fi - fi fi - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi if test "x$complete" != "x$new_complete"; then - MT="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MT to \"$new_complete\"" >&5 + MT="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MT to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting MT to \"$new_complete\"" >&6;} - fi + fi # The resource compiler # Extract the first word of "rc", so it can be a program name with args. set dummy rc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_RC+set}" = set; then : +if ${ac_cv_prog_RC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RC"; then @@ -22348,14 +22558,26 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh tmp="$complete EOL" arguments="${tmp#* }" - new_path=`$WHICH $path 2> /dev/null` + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving RC (as $path) failed, using $path directly." >&5 +$as_echo "$as_me: Resolving RC (as $path) failed, using $path directly." >&6;} + new_path="$path" + fi + if test "x$new_path" = x; then - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test "x$is_absolute_path" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving RC (as $path) with 'which' failed, using $path directly." >&5 -$as_echo "$as_me: Resolving RC (as $path) with 'which' failed, using $path directly." >&6;} - new_path="$path" - else { $as_echo "$as_me:${as_lineno-$LINENO}: The path of RC, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of RC, which resolves as \"$complete\", is not found." >&6;} has_space=`$ECHO "$complete" | $GREP " "` @@ -22365,21 +22587,20 @@ $as_echo "$as_me: This might be caused by spaces in the path, which is not allow fi as_fn_error $? "Cannot locate the the path of RC" "$LINENO" 5 fi - fi fi - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi if test "x$complete" != "x$new_complete"; then - RC="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting RC to \"$new_complete\"" >&5 + RC="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting RC to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting RC to \"$new_complete\"" >&6;} - fi + fi # For hotspot, we need these in Windows mixed path, @@ -22456,7 +22677,7 @@ fi set dummy lib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_WINAR+set}" = set; then : +if ${ac_cv_prog_WINAR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$WINAR"; then @@ -22711,14 +22932,26 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh tmp="$complete EOL" arguments="${tmp#* }" - new_path=`$WHICH $path 2> /dev/null` + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving WINAR (as $path) failed, using $path directly." >&5 +$as_echo "$as_me: Resolving WINAR (as $path) failed, using $path directly." >&6;} + new_path="$path" + fi + if test "x$new_path" = x; then - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test "x$is_absolute_path" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving WINAR (as $path) with 'which' failed, using $path directly." >&5 -$as_echo "$as_me: Resolving WINAR (as $path) with 'which' failed, using $path directly." >&6;} - new_path="$path" - else { $as_echo "$as_me:${as_lineno-$LINENO}: The path of WINAR, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of WINAR, which resolves as \"$complete\", is not found." >&6;} has_space=`$ECHO "$complete" | $GREP " "` @@ -22728,21 +22961,20 @@ $as_echo "$as_me: This might be caused by spaces in the path, which is not allow fi as_fn_error $? "Cannot locate the the path of WINAR" "$LINENO" 5 fi - fi fi - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi if test "x$complete" != "x$new_complete"; then - WINAR="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting WINAR to \"$new_complete\"" >&5 + WINAR="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting WINAR to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting WINAR to \"$new_complete\"" >&6;} - fi + fi AR="$WINAR" ARFLAGS="-nologo -NODEFAULTLIB:MSVCRT" @@ -22751,7 +22983,7 @@ $as_echo "$as_me: Rewriting WINAR to \"$new_complete\"" >&6;} set dummy dumpbin; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_DUMPBIN+set}" = set; then : +if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then @@ -23006,14 +23238,26 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh tmp="$complete EOL" arguments="${tmp#* }" - new_path=`$WHICH $path 2> /dev/null` + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving DUMPBIN (as $path) failed, using $path directly." >&5 +$as_echo "$as_me: Resolving DUMPBIN (as $path) failed, using $path directly." >&6;} + new_path="$path" + fi + if test "x$new_path" = x; then - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test "x$is_absolute_path" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving DUMPBIN (as $path) with 'which' failed, using $path directly." >&5 -$as_echo "$as_me: Resolving DUMPBIN (as $path) with 'which' failed, using $path directly." >&6;} - new_path="$path" - else { $as_echo "$as_me:${as_lineno-$LINENO}: The path of DUMPBIN, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of DUMPBIN, which resolves as \"$complete\", is not found." >&6;} has_space=`$ECHO "$complete" | $GREP " "` @@ -23023,21 +23267,20 @@ $as_echo "$as_me: This might be caused by spaces in the path, which is not allow fi as_fn_error $? "Cannot locate the the path of DUMPBIN" "$LINENO" 5 fi - fi fi - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi if test "x$complete" != "x$new_complete"; then - DUMPBIN="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting DUMPBIN to \"$new_complete\"" >&5 + DUMPBIN="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting DUMPBIN to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting DUMPBIN to \"$new_complete\"" >&6;} - fi + fi COMPILER_TYPE=CL @@ -23059,7 +23302,7 @@ if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then : + if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded @@ -23175,7 +23418,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=cpp @@ -23406,14 +23649,26 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh tmp="$complete EOL" arguments="${tmp#* }" - new_path=`$WHICH $path 2> /dev/null` + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving CPP (as $path) failed, using $path directly." >&5 +$as_echo "$as_me: Resolving CPP (as $path) failed, using $path directly." >&6;} + new_path="$path" + fi + if test "x$new_path" = x; then - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test "x$is_absolute_path" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving CPP (as $path) with 'which' failed, using $path directly." >&5 -$as_echo "$as_me: Resolving CPP (as $path) with 'which' failed, using $path directly." >&6;} - new_path="$path" - else { $as_echo "$as_me:${as_lineno-$LINENO}: The path of CPP, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of CPP, which resolves as \"$complete\", is not found." >&6;} has_space=`$ECHO "$complete" | $GREP " "` @@ -23423,21 +23678,20 @@ $as_echo "$as_me: This might be caused by spaces in the path, which is not allow fi as_fn_error $? "Cannot locate the the path of CPP" "$LINENO" 5 fi - fi fi - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi if test "x$complete" != "x$new_complete"; then - CPP="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting CPP to \"$new_complete\"" >&5 + CPP="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting CPP to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting CPP to \"$new_complete\"" >&6;} - fi + fi ac_ext=cpp @@ -23448,7 +23702,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 $as_echo_n "checking how to run the C++ preprocessor... " >&6; } if test -z "$CXXCPP"; then - if test "${ac_cv_prog_CXXCPP+set}" = set; then : + if ${ac_cv_prog_CXXCPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CXXCPP needs to be expanded @@ -23564,7 +23818,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=cpp @@ -23795,14 +24049,26 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh tmp="$complete EOL" arguments="${tmp#* }" - new_path=`$WHICH $path 2> /dev/null` + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving CXXCPP (as $path) failed, using $path directly." >&5 +$as_echo "$as_me: Resolving CXXCPP (as $path) failed, using $path directly." >&6;} + new_path="$path" + fi + if test "x$new_path" = x; then - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test "x$is_absolute_path" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving CXXCPP (as $path) with 'which' failed, using $path directly." >&5 -$as_echo "$as_me: Resolving CXXCPP (as $path) with 'which' failed, using $path directly." >&6;} - new_path="$path" - else { $as_echo "$as_me:${as_lineno-$LINENO}: The path of CXXCPP, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of CXXCPP, which resolves as \"$complete\", is not found." >&6;} has_space=`$ECHO "$complete" | $GREP " "` @@ -23812,21 +24078,20 @@ $as_echo "$as_me: This might be caused by spaces in the path, which is not allow fi as_fn_error $? "Cannot locate the the path of CXXCPP" "$LINENO" 5 fi - fi fi - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi if test "x$complete" != "x$new_complete"; then - CXXCPP="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting CXXCPP to \"$new_complete\"" >&5 + CXXCPP="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting CXXCPP to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting CXXCPP to \"$new_complete\"" >&6;} - fi + fi if test "x$COMPILE_TYPE" != "xcross"; then @@ -23855,7 +24120,7 @@ if test "x$OPENJDK_TARGET_OS" = xsolaris; then set dummy as; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_AS+set}" = set; then : +if ${ac_cv_path_AS+:} false; then : $as_echo_n "(cached) " >&6 else case $AS in @@ -24113,14 +24378,26 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh tmp="$complete EOL" arguments="${tmp#* }" - new_path=`$WHICH $path 2> /dev/null` + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving AS (as $path) failed, using $path directly." >&5 +$as_echo "$as_me: Resolving AS (as $path) failed, using $path directly." >&6;} + new_path="$path" + fi + if test "x$new_path" = x; then - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test "x$is_absolute_path" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving AS (as $path) with 'which' failed, using $path directly." >&5 -$as_echo "$as_me: Resolving AS (as $path) with 'which' failed, using $path directly." >&6;} - new_path="$path" - else { $as_echo "$as_me:${as_lineno-$LINENO}: The path of AS, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of AS, which resolves as \"$complete\", is not found." >&6;} has_space=`$ECHO "$complete" | $GREP " "` @@ -24130,21 +24407,20 @@ $as_echo "$as_me: This might be caused by spaces in the path, which is not allow fi as_fn_error $? "Cannot locate the the path of AS" "$LINENO" 5 fi - fi fi - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi if test "x$complete" != "x$new_complete"; then - AS="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting AS to \"$new_complete\"" >&5 + AS="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting AS to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting AS to \"$new_complete\"" >&6;} - fi + fi else AS="$CC -c" @@ -24158,7 +24434,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_NM+set}" = set; then : +if ${ac_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else case $NM in @@ -24419,14 +24695,26 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh tmp="$complete EOL" arguments="${tmp#* }" - new_path=`$WHICH $path 2> /dev/null` + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving NM (as $path) failed, using $path directly." >&5 +$as_echo "$as_me: Resolving NM (as $path) failed, using $path directly." >&6;} + new_path="$path" + fi + if test "x$new_path" = x; then - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test "x$is_absolute_path" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving NM (as $path) with 'which' failed, using $path directly." >&5 -$as_echo "$as_me: Resolving NM (as $path) with 'which' failed, using $path directly." >&6;} - new_path="$path" - else { $as_echo "$as_me:${as_lineno-$LINENO}: The path of NM, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of NM, which resolves as \"$complete\", is not found." >&6;} has_space=`$ECHO "$complete" | $GREP " "` @@ -24436,27 +24724,26 @@ $as_echo "$as_me: This might be caused by spaces in the path, which is not allow fi as_fn_error $? "Cannot locate the the path of NM" "$LINENO" 5 fi - fi fi - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi if test "x$complete" != "x$new_complete"; then - NM="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting NM to \"$new_complete\"" >&5 + NM="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting NM to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting NM to \"$new_complete\"" >&6;} - fi + fi # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_STRIP+set}" = set; then : +if ${ac_cv_path_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else case $STRIP in @@ -24714,14 +25001,26 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh tmp="$complete EOL" arguments="${tmp#* }" - new_path=`$WHICH $path 2> /dev/null` + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving STRIP (as $path) failed, using $path directly." >&5 +$as_echo "$as_me: Resolving STRIP (as $path) failed, using $path directly." >&6;} + new_path="$path" + fi + if test "x$new_path" = x; then - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test "x$is_absolute_path" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving STRIP (as $path) with 'which' failed, using $path directly." >&5 -$as_echo "$as_me: Resolving STRIP (as $path) with 'which' failed, using $path directly." >&6;} - new_path="$path" - else { $as_echo "$as_me:${as_lineno-$LINENO}: The path of STRIP, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of STRIP, which resolves as \"$complete\", is not found." >&6;} has_space=`$ECHO "$complete" | $GREP " "` @@ -24731,27 +25030,26 @@ $as_echo "$as_me: This might be caused by spaces in the path, which is not allow fi as_fn_error $? "Cannot locate the the path of STRIP" "$LINENO" 5 fi - fi fi - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi if test "x$complete" != "x$new_complete"; then - STRIP="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting STRIP to \"$new_complete\"" >&5 + STRIP="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting STRIP to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting STRIP to \"$new_complete\"" >&6;} - fi + fi # Extract the first word of "mcs", so it can be a program name with args. set dummy mcs; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_MCS+set}" = set; then : +if ${ac_cv_path_MCS+:} false; then : $as_echo_n "(cached) " >&6 else case $MCS in @@ -25009,14 +25307,26 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh tmp="$complete EOL" arguments="${tmp#* }" - new_path=`$WHICH $path 2> /dev/null` + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving MCS (as $path) failed, using $path directly." >&5 +$as_echo "$as_me: Resolving MCS (as $path) failed, using $path directly." >&6;} + new_path="$path" + fi + if test "x$new_path" = x; then - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test "x$is_absolute_path" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving MCS (as $path) with 'which' failed, using $path directly." >&5 -$as_echo "$as_me: Resolving MCS (as $path) with 'which' failed, using $path directly." >&6;} - new_path="$path" - else { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MCS, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of MCS, which resolves as \"$complete\", is not found." >&6;} has_space=`$ECHO "$complete" | $GREP " "` @@ -25026,21 +25336,20 @@ $as_echo "$as_me: This might be caused by spaces in the path, which is not allow fi as_fn_error $? "Cannot locate the the path of MCS" "$LINENO" 5 fi - fi fi - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi if test "x$complete" != "x$new_complete"; then - MCS="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MCS to \"$new_complete\"" >&5 + MCS="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MCS to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting MCS to \"$new_complete\"" >&6;} - fi + fi elif test "x$OPENJDK_TARGET_OS" != xwindows; then if test -n "$ac_tool_prefix"; then @@ -25048,7 +25357,7 @@ elif test "x$OPENJDK_TARGET_OS" != xwindows; then set dummy ${ac_tool_prefix}nm; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_NM+set}" = set; then : +if ${ac_cv_prog_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then @@ -25088,7 +25397,7 @@ if test -z "$ac_cv_prog_NM"; then set dummy nm; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_NM+set}" = set; then : +if ${ac_cv_prog_ac_ct_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NM"; then @@ -25357,14 +25666,26 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh tmp="$complete EOL" arguments="${tmp#* }" - new_path=`$WHICH $path 2> /dev/null` + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving NM (as $path) failed, using $path directly." >&5 +$as_echo "$as_me: Resolving NM (as $path) failed, using $path directly." >&6;} + new_path="$path" + fi + if test "x$new_path" = x; then - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test "x$is_absolute_path" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving NM (as $path) with 'which' failed, using $path directly." >&5 -$as_echo "$as_me: Resolving NM (as $path) with 'which' failed, using $path directly." >&6;} - new_path="$path" - else { $as_echo "$as_me:${as_lineno-$LINENO}: The path of NM, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of NM, which resolves as \"$complete\", is not found." >&6;} has_space=`$ECHO "$complete" | $GREP " "` @@ -25374,28 +25695,27 @@ $as_echo "$as_me: This might be caused by spaces in the path, which is not allow fi as_fn_error $? "Cannot locate the the path of NM" "$LINENO" 5 fi - fi fi - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi if test "x$complete" != "x$new_complete"; then - NM="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting NM to \"$new_complete\"" >&5 + NM="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting NM to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting NM to \"$new_complete\"" >&6;} - fi + fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_STRIP+set}" = set; then : +if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then @@ -25435,7 +25755,7 @@ if test -z "$ac_cv_prog_STRIP"; then set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then @@ -25704,14 +26024,26 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh tmp="$complete EOL" arguments="${tmp#* }" - new_path=`$WHICH $path 2> /dev/null` + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving STRIP (as $path) failed, using $path directly." >&5 +$as_echo "$as_me: Resolving STRIP (as $path) failed, using $path directly." >&6;} + new_path="$path" + fi + if test "x$new_path" = x; then - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test "x$is_absolute_path" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving STRIP (as $path) with 'which' failed, using $path directly." >&5 -$as_echo "$as_me: Resolving STRIP (as $path) with 'which' failed, using $path directly." >&6;} - new_path="$path" - else { $as_echo "$as_me:${as_lineno-$LINENO}: The path of STRIP, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of STRIP, which resolves as \"$complete\", is not found." >&6;} has_space=`$ECHO "$complete" | $GREP " "` @@ -25721,21 +26053,20 @@ $as_echo "$as_me: This might be caused by spaces in the path, which is not allow fi as_fn_error $? "Cannot locate the the path of STRIP" "$LINENO" 5 fi - fi fi - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi if test "x$complete" != "x$new_complete"; then - STRIP="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting STRIP to \"$new_complete\"" >&5 + STRIP="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting STRIP to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting STRIP to \"$new_complete\"" >&6;} - fi + fi fi @@ -25749,7 +26080,7 @@ if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xlinux; set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_OBJCOPY+set}" = set; then : +if ${ac_cv_prog_OBJCOPY+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJCOPY"; then @@ -25793,7 +26124,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_OBJCOPY+set}" = set; then : +if ${ac_cv_prog_ac_ct_OBJCOPY+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJCOPY"; then @@ -26066,14 +26397,26 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh tmp="$complete EOL" arguments="${tmp#* }" - new_path=`$WHICH $path 2> /dev/null` + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving OBJCOPY (as $path) failed, using $path directly." >&5 +$as_echo "$as_me: Resolving OBJCOPY (as $path) failed, using $path directly." >&6;} + new_path="$path" + fi + if test "x$new_path" = x; then - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test "x$is_absolute_path" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving OBJCOPY (as $path) with 'which' failed, using $path directly." >&5 -$as_echo "$as_me: Resolving OBJCOPY (as $path) with 'which' failed, using $path directly." >&6;} - new_path="$path" - else { $as_echo "$as_me:${as_lineno-$LINENO}: The path of OBJCOPY, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of OBJCOPY, which resolves as \"$complete\", is not found." >&6;} has_space=`$ECHO "$complete" | $GREP " "` @@ -26083,21 +26426,20 @@ $as_echo "$as_me: This might be caused by spaces in the path, which is not allow fi as_fn_error $? "Cannot locate the the path of OBJCOPY" "$LINENO" 5 fi - fi fi - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi if test "x$complete" != "x$new_complete"; then - OBJCOPY="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting OBJCOPY to \"$new_complete\"" >&5 + OBJCOPY="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting OBJCOPY to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting OBJCOPY to \"$new_complete\"" >&6;} - fi + fi fi fi @@ -26109,7 +26451,7 @@ if test -n "$ac_tool_prefix"; then set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_OBJDUMP+set}" = set; then : +if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then @@ -26153,7 +26495,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then : +if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then @@ -26426,14 +26768,26 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh tmp="$complete EOL" arguments="${tmp#* }" - new_path=`$WHICH $path 2> /dev/null` + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving OBJDUMP (as $path) failed, using $path directly." >&5 +$as_echo "$as_me: Resolving OBJDUMP (as $path) failed, using $path directly." >&6;} + new_path="$path" + fi + if test "x$new_path" = x; then - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test "x$is_absolute_path" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving OBJDUMP (as $path) with 'which' failed, using $path directly." >&5 -$as_echo "$as_me: Resolving OBJDUMP (as $path) with 'which' failed, using $path directly." >&6;} - new_path="$path" - else { $as_echo "$as_me:${as_lineno-$LINENO}: The path of OBJDUMP, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of OBJDUMP, which resolves as \"$complete\", is not found." >&6;} has_space=`$ECHO "$complete" | $GREP " "` @@ -26443,21 +26797,20 @@ $as_echo "$as_me: This might be caused by spaces in the path, which is not allow fi as_fn_error $? "Cannot locate the the path of OBJDUMP" "$LINENO" 5 fi - fi fi - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi if test "x$complete" != "x$new_complete"; then - OBJDUMP="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting OBJDUMP to \"$new_complete\"" >&5 + OBJDUMP="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting OBJDUMP to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting OBJDUMP to \"$new_complete\"" >&6;} - fi + fi fi @@ -26466,7 +26819,7 @@ if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_LIPO+set}" = set; then : +if ${ac_cv_path_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else case $LIPO in @@ -26724,14 +27077,26 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh tmp="$complete EOL" arguments="${tmp#* }" - new_path=`$WHICH $path 2> /dev/null` + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving LIPO (as $path) failed, using $path directly." >&5 +$as_echo "$as_me: Resolving LIPO (as $path) failed, using $path directly." >&6;} + new_path="$path" + fi + if test "x$new_path" = x; then - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test "x$is_absolute_path" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Resolving LIPO (as $path) with 'which' failed, using $path directly." >&5 -$as_echo "$as_me: Resolving LIPO (as $path) with 'which' failed, using $path directly." >&6;} - new_path="$path" - else { $as_echo "$as_me:${as_lineno-$LINENO}: The path of LIPO, which resolves as \"$complete\", is not found." >&5 $as_echo "$as_me: The path of LIPO, which resolves as \"$complete\", is not found." >&6;} has_space=`$ECHO "$complete" | $GREP " "` @@ -26741,21 +27106,20 @@ $as_echo "$as_me: This might be caused by spaces in the path, which is not allow fi as_fn_error $? "Cannot locate the the path of LIPO" "$LINENO" 5 fi - fi fi - # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" - else - new_complete="$new_path" - fi + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi if test "x$complete" != "x$new_complete"; then - LIPO="$new_complete" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting LIPO to \"$new_complete\"" >&5 + LIPO="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting LIPO to \"$new_complete\"" >&5 $as_echo "$as_me: Rewriting LIPO to \"$new_complete\"" >&6;} - fi + fi fi @@ -26770,7 +27134,7 @@ PATH="$OLD_PATH" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then : +if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -26946,7 +27310,7 @@ fi for ac_header in stdio.h do : ac_fn_cxx_check_header_mongrel "$LINENO" "stdio.h" "ac_cv_header_stdio_h" "$ac_includes_default" -if test "x$ac_cv_header_stdio_h" = x""yes; then : +if test "x$ac_cv_header_stdio_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDIO_H 1 _ACEOF @@ -26975,7 +27339,7 @@ done # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int *" >&5 $as_echo_n "checking size of int *... " >&6; } -if test "${ac_cv_sizeof_int_p+set}" = set; then : +if ${ac_cv_sizeof_int_p+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_cxx_compute_int "$LINENO" "(long int) (sizeof (int *))" "ac_cv_sizeof_int_p" "$ac_includes_default"; then : @@ -26985,7 +27349,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (int *) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_int_p=0 fi @@ -27032,7 +27396,7 @@ $as_echo "$OPENJDK_TARGET_CPU_BITS bits" >&6; } # { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } -if test "${ac_cv_c_bigendian+set}" = set; then : +if ${ac_cv_c_bigendian+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown @@ -27764,11 +28128,14 @@ else # On some platforms (mac) the linker warns about non existing -L dirs. # Add server first if available. Linking aginst client does not always produce the same results. - # Only add client dir if client is being built. Default to server for other variants. + # Only add client dir if client is being built. Add minimal (note not minimal1) if only building minimal1. + # Default to server for other variants. if test "x$JVM_VARIANT_SERVER" = xtrue; then LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server" elif test "x$JVM_VARIANT_CLIENT" = xtrue; then LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/client" + elif test "x$JVM_VARIANT_MINIMAL1" = xtrue; then + LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/minimal" else LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server" fi @@ -28029,8 +28396,8 @@ if test "x$with_x" = xno; then have_x=disabled else case $x_includes,$x_libraries in #( - *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5 ;; #( - *,NONE | NONE,*) if test "${ac_cv_have_x+set}" = set; then : + *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5;; #( + *,NONE | NONE,*) if ${ac_cv_have_x+:} false; then : $as_echo_n "(cached) " >&6 else # One or both of the vars are not set, and there is no cached value. @@ -28307,7 +28674,7 @@ if ac_fn_cxx_try_link "$LINENO"; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet" >&5 $as_echo_n "checking for dnet_ntoa in -ldnet... " >&6; } -if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then : +if ${ac_cv_lib_dnet_dnet_ntoa+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -28341,14 +28708,14 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 $as_echo "$ac_cv_lib_dnet_dnet_ntoa" >&6; } -if test "x$ac_cv_lib_dnet_dnet_ntoa" = x""yes; then : +if test "x$ac_cv_lib_dnet_dnet_ntoa" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet_stub" >&5 $as_echo_n "checking for dnet_ntoa in -ldnet_stub... " >&6; } -if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then : +if ${ac_cv_lib_dnet_stub_dnet_ntoa+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -28382,7 +28749,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 $as_echo "$ac_cv_lib_dnet_stub_dnet_ntoa" >&6; } -if test "x$ac_cv_lib_dnet_stub_dnet_ntoa" = x""yes; then : +if test "x$ac_cv_lib_dnet_stub_dnet_ntoa" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" fi @@ -28401,14 +28768,14 @@ rm -f core conftest.err conftest.$ac_objext \ # The functions gethostbyname, getservbyname, and inet_addr are # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking. ac_fn_cxx_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" -if test "x$ac_cv_func_gethostbyname" = x""yes; then : +if test "x$ac_cv_func_gethostbyname" = xyes; then : fi if test $ac_cv_func_gethostbyname = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5 $as_echo_n "checking for gethostbyname in -lnsl... " >&6; } -if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then : +if ${ac_cv_lib_nsl_gethostbyname+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -28442,14 +28809,14 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5 $as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; } -if test "x$ac_cv_lib_nsl_gethostbyname" = x""yes; then : +if test "x$ac_cv_lib_nsl_gethostbyname" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" fi if test $ac_cv_lib_nsl_gethostbyname = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lbsd" >&5 $as_echo_n "checking for gethostbyname in -lbsd... " >&6; } -if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then : +if ${ac_cv_lib_bsd_gethostbyname+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -28483,7 +28850,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_gethostbyname" >&5 $as_echo "$ac_cv_lib_bsd_gethostbyname" >&6; } -if test "x$ac_cv_lib_bsd_gethostbyname" = x""yes; then : +if test "x$ac_cv_lib_bsd_gethostbyname" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd" fi @@ -28498,14 +28865,14 @@ fi # must be given before -lnsl if both are needed. We assume that # if connect needs -lnsl, so does gethostbyname. ac_fn_cxx_check_func "$LINENO" "connect" "ac_cv_func_connect" -if test "x$ac_cv_func_connect" = x""yes; then : +if test "x$ac_cv_func_connect" = xyes; then : fi if test $ac_cv_func_connect = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for connect in -lsocket" >&5 $as_echo_n "checking for connect in -lsocket... " >&6; } -if test "${ac_cv_lib_socket_connect+set}" = set; then : +if ${ac_cv_lib_socket_connect+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -28539,7 +28906,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_connect" >&5 $as_echo "$ac_cv_lib_socket_connect" >&6; } -if test "x$ac_cv_lib_socket_connect" = x""yes; then : +if test "x$ac_cv_lib_socket_connect" = xyes; then : X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" fi @@ -28547,14 +28914,14 @@ fi # Guillermo Gomez says -lposix is necessary on A/UX. ac_fn_cxx_check_func "$LINENO" "remove" "ac_cv_func_remove" -if test "x$ac_cv_func_remove" = x""yes; then : +if test "x$ac_cv_func_remove" = xyes; then : fi if test $ac_cv_func_remove = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for remove in -lposix" >&5 $as_echo_n "checking for remove in -lposix... " >&6; } -if test "${ac_cv_lib_posix_remove+set}" = set; then : +if ${ac_cv_lib_posix_remove+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -28588,7 +28955,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix_remove" >&5 $as_echo "$ac_cv_lib_posix_remove" >&6; } -if test "x$ac_cv_lib_posix_remove" = x""yes; then : +if test "x$ac_cv_lib_posix_remove" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" fi @@ -28596,14 +28963,14 @@ fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. ac_fn_cxx_check_func "$LINENO" "shmat" "ac_cv_func_shmat" -if test "x$ac_cv_func_shmat" = x""yes; then : +if test "x$ac_cv_func_shmat" = xyes; then : fi if test $ac_cv_func_shmat = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shmat in -lipc" >&5 $as_echo_n "checking for shmat in -lipc... " >&6; } -if test "${ac_cv_lib_ipc_shmat+set}" = set; then : +if ${ac_cv_lib_ipc_shmat+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -28637,7 +29004,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ipc_shmat" >&5 $as_echo "$ac_cv_lib_ipc_shmat" >&6; } -if test "x$ac_cv_lib_ipc_shmat" = x""yes; then : +if test "x$ac_cv_lib_ipc_shmat" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" fi @@ -28655,7 +29022,7 @@ fi # John Interrante, Karl Berry { $as_echo "$as_me:${as_lineno-$LINENO}: checking for IceConnectionNumber in -lICE" >&5 $as_echo_n "checking for IceConnectionNumber in -lICE... " >&6; } -if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then : +if ${ac_cv_lib_ICE_IceConnectionNumber+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -28689,7 +29056,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 $as_echo "$ac_cv_lib_ICE_IceConnectionNumber" >&6; } -if test "x$ac_cv_lib_ICE_IceConnectionNumber" = x""yes; then : +if test "x$ac_cv_lib_ICE_IceConnectionNumber" = xyes; then : X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" fi @@ -29696,7 +30063,7 @@ $as_echo "$FREETYPE2_FOUND" >&6; } LDFLAGS="$FREETYPE2_LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FT_Init_FreeType in -lfreetype" >&5 $as_echo_n "checking for FT_Init_FreeType in -lfreetype... " >&6; } -if test "${ac_cv_lib_freetype_FT_Init_FreeType+set}" = set; then : +if ${ac_cv_lib_freetype_FT_Init_FreeType+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -29730,7 +30097,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_freetype_FT_Init_FreeType" >&5 $as_echo "$ac_cv_lib_freetype_FT_Init_FreeType" >&6; } -if test "x$ac_cv_lib_freetype_FT_Init_FreeType" = x""yes; then : +if test "x$ac_cv_lib_freetype_FT_Init_FreeType" = xyes; then : FREETYPE2_FOUND=true else as_fn_error $? "Could not find freetype2! $HELP_MSG " "$LINENO" 5 @@ -30018,7 +30385,7 @@ fi for ac_header in alsa/asoundlib.h do : ac_fn_cxx_check_header_mongrel "$LINENO" "alsa/asoundlib.h" "ac_cv_header_alsa_asoundlib_h" "$ac_includes_default" -if test "x$ac_cv_header_alsa_asoundlib_h" = x""yes; then : +if test "x$ac_cv_header_alsa_asoundlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_ALSA_ASOUNDLIB_H 1 _ACEOF @@ -30077,7 +30444,7 @@ fi USE_EXTERNAL_LIBJPEG=true { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -ljpeg" >&5 $as_echo_n "checking for main in -ljpeg... " >&6; } -if test "${ac_cv_lib_jpeg_main+set}" = set; then : +if ${ac_cv_lib_jpeg_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -30105,7 +30472,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jpeg_main" >&5 $as_echo "$ac_cv_lib_jpeg_main" >&6; } -if test "x$ac_cv_lib_jpeg_main" = x""yes; then : +if test "x$ac_cv_lib_jpeg_main" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBJPEG 1 _ACEOF @@ -30129,7 +30496,7 @@ fi USE_EXTERNAL_LIBJPEG=true { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lgif" >&5 $as_echo_n "checking for main in -lgif... " >&6; } -if test "${ac_cv_lib_gif_main+set}" = set; then : +if ${ac_cv_lib_gif_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -30157,7 +30524,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gif_main" >&5 $as_echo "$ac_cv_lib_gif_main" >&6; } -if test "x$ac_cv_lib_gif_main" = x""yes; then : +if test "x$ac_cv_lib_gif_main" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBGIF 1 _ACEOF @@ -30187,7 +30554,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compress in -lz" >&5 $as_echo_n "checking for compress in -lz... " >&6; } -if test "${ac_cv_lib_z_compress+set}" = set; then : +if ${ac_cv_lib_z_compress+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -30221,7 +30588,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_compress" >&5 $as_echo "$ac_cv_lib_z_compress" >&6; } -if test "x$ac_cv_lib_z_compress" = x""yes; then : +if test "x$ac_cv_lib_z_compress" = xyes; then : ZLIB_FOUND=yes else ZLIB_FOUND=no @@ -30314,7 +30681,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5 $as_echo_n "checking for cos in -lm... " >&6; } -if test "${ac_cv_lib_m_cos+set}" = set; then : +if ${ac_cv_lib_m_cos+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -30348,7 +30715,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5 $as_echo "$ac_cv_lib_m_cos" >&6; } -if test "x$ac_cv_lib_m_cos" = x""yes; then : +if test "x$ac_cv_lib_m_cos" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBM 1 _ACEOF @@ -30372,7 +30739,7 @@ save_LIBS="$LIBS" LIBS="" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } -if test "${ac_cv_lib_dl_dlopen+set}" = set; then : +if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -30406,7 +30773,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBDL 1 _ACEOF @@ -31050,7 +31417,7 @@ fi set dummy ccache; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_CCACHE+set}" = set; then : +if ${ac_cv_path_CCACHE+:} false; then : $as_echo_n "(cached) " >&6 else case $CCACHE in @@ -31301,10 +31668,21 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then - test "x$cache_file" != "x/dev/null" && + if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} @@ -31336,7 +31714,7 @@ LTLIBOBJS=$ac_ltlibobjs -: ${CONFIG_STATUS=./config.status} +: "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" @@ -31437,6 +31815,7 @@ fi IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. +as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -31744,7 +32123,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by OpenJDK $as_me jdk8, which was -generated by GNU Autoconf 2.67. Invocation command line was +generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -31807,7 +32186,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ OpenJDK config.status jdk8 -configured by $0, generated by GNU Autoconf 2.67, +configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. @@ -31936,7 +32315,7 @@ do "$OUTPUT_ROOT/spec.sh") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/spec.sh:$AUTOCONF_DIR/spec.sh.in" ;; "$OUTPUT_ROOT/Makefile") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/Makefile:$AUTOCONF_DIR/Makefile.in" ;; - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done @@ -31958,9 +32337,10 @@ fi # after its creation but before its name has been assigned to `$tmp'. $debug || { - tmp= + tmp= ac_tmp= trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } @@ -31968,12 +32348,13 @@ $debug || { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" + test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. @@ -31995,7 +32376,7 @@ else ac_cs_awk_cr=$ac_cr fi -echo 'BEGIN {' >"$tmp/subs1.awk" && +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF @@ -32023,7 +32404,7 @@ done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$tmp/subs1.awk" <<\\_ACAWK && +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h @@ -32071,7 +32452,7 @@ t delim rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK -cat >>"\$tmp/subs1.awk" <<_ACAWK && +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" @@ -32103,7 +32484,7 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat -fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF @@ -32137,7 +32518,7 @@ fi # test -n "$CONFIG_FILES" # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then -cat >"$tmp/defines.awk" <<\_ACAWK || +cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF @@ -32149,8 +32530,8 @@ _ACEOF # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do - ac_t=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_t"; then + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 @@ -32251,7 +32632,7 @@ do esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -32270,7 +32651,7 @@ do for ac_f do case $ac_f in - -) ac_f="$tmp/stdin";; + -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. @@ -32279,7 +32660,7 @@ do [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" @@ -32305,8 +32686,8 @@ $as_echo "$as_me: creating $ac_file" >&6;} esac case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac @@ -32431,21 +32812,22 @@ s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t $ac_datarootdir_hack " -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} - rm -f "$tmp/stdin" + rm -f "$ac_tmp/stdin" case $ac_file in - -) cat "$tmp/out" && rm -f "$tmp/out";; - *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; @@ -32456,20 +32838,20 @@ which seems to be undefined. Please make sure it is defined" >&2;} if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" - } >"$tmp/config.h" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" - mv "$tmp/config.h" "$ac_file" \ + mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; diff --git a/common/autoconf/jdk-options.m4 b/common/autoconf/jdk-options.m4 index 756c614f439..0a6d10a3fc1 100644 --- a/common/autoconf/jdk-options.m4 +++ b/common/autoconf/jdk-options.m4 @@ -60,28 +60,30 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JVM_VARIANTS], # Currently we have: # server: normal interpreter and a tiered C1/C2 compiler # client: normal interpreter and C1 (no C2 compiler) (only 32-bit platforms) +# minimal1: reduced form of client with optional VM services and features stripped out # kernel: kernel footprint JVM that passes the TCK without major performance problems, # ie normal interpreter and C1, only the serial GC, kernel jvmti etc # zero: no machine code interpreter, no compiler # zeroshark: zero interpreter and shark/llvm compiler backend AC_MSG_CHECKING([which variants of the JVM to build]) AC_ARG_WITH([jvm-variants], [AS_HELP_STRING([--with-jvm-variants], - [JVM variants (separated by commas) to build (server, client, kernel, zero, zeroshark) @<:@server@:>@])]) + [JVM variants (separated by commas) to build (server, client, minimal1, kernel, zero, zeroshark) @<:@server@:>@])]) if test "x$with_jvm_variants" = x; then with_jvm_variants="server" fi JVM_VARIANTS=",$with_jvm_variants," -TEST_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/server,//' -e 's/client,//' -e 's/kernel,//' -e 's/zero,//' -e 's/zeroshark,//'` +TEST_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/server,//' -e 's/client,//' -e 's/minimal1,//' -e 's/kernel,//' -e 's/zero,//' -e 's/zeroshark,//'` if test "x$TEST_VARIANTS" != "x,"; then - AC_MSG_ERROR([The available JVM variants are: server, client, kernel, zero, zeroshark]) + AC_MSG_ERROR([The available JVM variants are: server, client, minimal1, kernel, zero, zeroshark]) fi AC_MSG_RESULT([$with_jvm_variants]) JVM_VARIANT_SERVER=`$ECHO "$JVM_VARIANTS" | $SED -e '/,server,/!s/.*/false/g' -e '/,server,/s/.*/true/g'` JVM_VARIANT_CLIENT=`$ECHO "$JVM_VARIANTS" | $SED -e '/,client,/!s/.*/false/g' -e '/,client,/s/.*/true/g'` +JVM_VARIANT_MINIMAL1=`$ECHO "$JVM_VARIANTS" | $SED -e '/,minimal1,/!s/.*/false/g' -e '/,minimal1,/s/.*/true/g'` JVM_VARIANT_KERNEL=`$ECHO "$JVM_VARIANTS" | $SED -e '/,kernel,/!s/.*/false/g' -e '/,kernel,/s/.*/true/g'` JVM_VARIANT_ZERO=`$ECHO "$JVM_VARIANTS" | $SED -e '/,zero,/!s/.*/false/g' -e '/,zero,/s/.*/true/g'` JVM_VARIANT_ZEROSHARK=`$ECHO "$JVM_VARIANTS" | $SED -e '/,zeroshark,/!s/.*/false/g' -e '/,zeroshark,/s/.*/true/g'` @@ -96,10 +98,15 @@ if test "x$JVM_VARIANT_KERNEL" = xtrue; then AC_MSG_ERROR([You cannot build a kernel JVM for a 64-bit machine.]) fi fi +if test "x$JVM_VARIANT_MINIMAL1" = xtrue; then + if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then + AC_MSG_ERROR([You cannot build a minimal JVM for a 64-bit machine.]) + fi +fi # Replace the commas with AND for use in the build directory name. ANDED_JVM_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/^,//' -e 's/,$//' -e 's/,/AND/'` -COUNT_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/server,/1/' -e 's/client,/1/' -e 's/kernel,/1/' -e 's/zero,/1/' -e 's/zeroshark,/1/'` +COUNT_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/server,/1/' -e 's/client,/1/' -e 's/minimal1,/1/' -e 's/kernel,/1/' -e 's/zero,/1/' -e 's/zeroshark,/1/'` if test "x$COUNT_VARIANTS" != "x,1"; then BUILDING_MULTIPLE_JVM_VARIANTS=yes else @@ -109,6 +116,7 @@ fi AC_SUBST(JVM_VARIANTS) AC_SUBST(JVM_VARIANT_SERVER) AC_SUBST(JVM_VARIANT_CLIENT) +AC_SUBST(JVM_VARIANT_MINIMAL1) AC_SUBST(JVM_VARIANT_KERNEL) AC_SUBST(JVM_VARIANT_ZERO) AC_SUBST(JVM_VARIANT_ZEROSHARK) @@ -191,7 +199,9 @@ esac ##### # Generate the legacy makefile targets for hotspot. # The hotspot api for selecting the build artifacts, really, needs to be improved. -# +# JDK-7195896 will fix this on the hotspot side by using the JVM_VARIANT_* variables to +# determine what needs to be built. All we will need to set here is all_product, all_fastdebug etc +# But until then ... HOTSPOT_TARGET="" if test "x$JVM_VARIANT_SERVER" = xtrue; then @@ -202,6 +212,10 @@ if test "x$JVM_VARIANT_CLIENT" = xtrue; then HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}1 " fi +if test "x$JVM_VARIANT_MINIMAL1" = xtrue; then + HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}minimal1 " +fi + if test "x$JVM_VARIANT_KERNEL" = xtrue; then HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}kernel " fi diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in index 1cdd2660623..5dab096eb03 100644 --- a/common/autoconf/spec.gmk.in +++ b/common/autoconf/spec.gmk.in @@ -185,11 +185,12 @@ SUPPORT_HEADLESS:=@SUPPORT_HEADLESS@ # These are the libjvms that we want to build. # The java launcher uses the default. -# The other can be selected by specifying -client -server -kernel -zero or -zeroshark +# The others can be selected by specifying -client -server -minimal1 -kernel -zero or -zeroshark # on the java launcher command line. JVM_VARIANTS:=@JVM_VARIANTS@ JVM_VARIANT_SERVER:=@JVM_VARIANT_SERVER@ JVM_VARIANT_CLIENT:=@JVM_VARIANT_CLIENT@ +JVM_VARIANT_MINIMAL1:=@JVM_VARIANT_MINIMAL1@ JVM_VARIANT_KERNEL:=@JVM_VARIANT_KERNEL@ JVM_VARIANT_ZERO:=@JVM_VARIANT_ZERO@ JVM_VARIANT_ZEROSHARK:=@JVM_VARIANT_ZEROSHARK@ diff --git a/common/autoconf/toolchain.m4 b/common/autoconf/toolchain.m4 index 92c9f2e5960..7b7f19fefa8 100644 --- a/common/autoconf/toolchain.m4 +++ b/common/autoconf/toolchain.m4 @@ -954,11 +954,14 @@ else # On some platforms (mac) the linker warns about non existing -L dirs. # Add server first if available. Linking aginst client does not always produce the same results. - # Only add client dir if client is being built. Default to server for other variants. + # Only add client dir if client is being built. Add minimal (note not minimal1) if only building minimal1. + # Default to server for other variants. if test "x$JVM_VARIANT_SERVER" = xtrue; then LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server" elif test "x$JVM_VARIANT_CLIENT" = xtrue; then LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/client" + elif test "x$JVM_VARIANT_MINIMAL1" = xtrue; then + LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/minimal" else LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server" fi diff --git a/common/bin/hgforest.sh b/common/bin/hgforest.sh new file mode 100644 index 00000000000..cbda87160ba --- /dev/null +++ b/common/bin/hgforest.sh @@ -0,0 +1,194 @@ +#!/bin/sh + +# +# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# Shell script for a fast parallel forest command +command="$1" +pull_extra_base="$2" + +# Python always buffers stdout significantly, thus we will not see any output from hg clone jdk, +# until a lot of time has passed! By passing -u to python, we get incremental updates +# on stdout. Much nicer. +whichhg="`which hg`" + +if [ "${whichhg}" = "" ] ; then + echo Cannot find hg! + exit 1 +fi + +if [ "" = "$command" ] ; then + echo No command to hg supplied! + exit 1 +fi + +has_hash_bang="`head -n 1 "${whichhg}" | cut -b 1-2`" +python="" +bpython="" + +if [ "#!" = "$has_hash_bang" ] ; then + python="`head -n 1 ${whichhg} | cut -b 3-`" + bpython="`basename "$python"`" +fi + +if [ "python" = "$bpython" -a -x "$python" ] ; then + hg="${python} -u ${whichhg}" +else + echo Cannot find python from hg launcher. Running plain hg, which probably has buffered stdout. + hg="hg" +fi + +# Clean out the temporary directory that stores the pid files. +tmp=/tmp/forest.$$ +rm -f -r ${tmp} +mkdir -p ${tmp} + +safe_interrupt () { + if [ -d ${tmp} ]; then + if [ "`ls ${tmp}`" != "" ]; then + echo "Waiting for processes ( `cat ${tmp}/* | tr '\n' ' '`) to terminate nicely!" + sleep 1 + # Pipe stderr to dev/null to silence kill, that complains when trying to kill + # a subprocess that has already exited. + kill -TERM `cat ${tmp}/* | tr '\n' ' '` 2> /dev/null + wait + echo Interrupt complete! + fi + fi + rm -f -r ${tmp} + exit 1 +} + +nice_exit () { + if [ -d ${tmp} ]; then + if [ "`ls ${tmp}`" != "" ]; then + wait + fi + fi + rm -f -r ${tmp} +} + +trap 'safe_interrupt' INT QUIT +trap 'nice_exit' EXIT + +# Only look in specific locations for possible forests (avoids long searches) +pull_default="" +repos="" +repos_extra="" +if [ "${command}" = "clone" -o "${command}" = "fclone" ] ; then + subrepos="corba jaxp jaxws langtools jdk hotspot" + if [ -f .hg/hgrc ] ; then + pull_default=`hg paths default` + if [ "${pull_default}" = "" ] ; then + echo "ERROR: Need initial clone with 'hg paths default' defined" + exit 1 + fi + fi + if [ "${pull_default}" = "" ] ; then + echo "ERROR: Need initial repository to use this script" + exit 1 + fi + for i in ${subrepos} ; do + if [ ! -f ${i}/.hg/hgrc ] ; then + repos="${repos} ${i}" + fi + done + if [ "${pull_extra_base}" != "" ] ; then + subrepos_extra="jdk/src/closed jdk/make/closed jdk/test/closed hotspot/make/closed hotspot/src/closed hotspot/test/closed deploy install sponsors pubs" + pull_default_tail=`echo ${pull_default} | sed -e 's@^.*://[^/]*/\(.*\)@\1@'` + pull_extra="${pull_extra_base}/${pull_default_tail}" + for i in ${subrepos_extra} ; do + if [ ! -f ${i}/.hg/hgrc ] ; then + repos_extra="${repos_extra} ${i}" + fi + done + fi + at_a_time=2 + # Any repos to deal with? + if [ "${repos}" = "" -a "${repos_extra}" = "" ] ; then + exit + fi +else + hgdirs=`ls -d ./.hg ./*/.hg ./*/*/.hg ./*/*/*/.hg ./*/*/*/*/.hg 2>/dev/null` + # Derive repository names from the .hg directory locations + for i in ${hgdirs} ; do + repos="${repos} `echo ${i} | sed -e 's@/.hg$@@'`" + done + for i in ${repos} ; do + if [ -h ${i}/.hg/store/lock -o -f ${i}/.hg/store/lock ] ; then + locked="${i} ${locked}" + fi + done + at_a_time=8 + # Any repos to deal with? + if [ "${repos}" = "" ] ; then + echo "No repositories to process." + exit + fi + if [ "${locked}" != "" ] ; then + echo "These repositories are locked: ${locked}" + exit + fi +fi + +# Echo out what repositories we do a command on. +echo "# Repositories: ${repos} ${repos_extra}" +echo + +# Run the supplied command on all repos in parallel. +n=0 +for i in ${repos} ${repos_extra} ; do + n=`expr ${n} '+' 1` + repopidfile=`echo ${i} | sed -e 's@./@@' -e 's@/@_@g'` + reponame=`echo ${i} | sed -e :a -e 's/^.\{1,20\}$/ &/;ta'` + pull_base="${pull_default}" + for j in $repos_extra ; do + if [ "$i" = "$j" ] ; then + pull_base="${pull_extra}" + fi + done + ( + ( + if [ "${command}" = "clone" -o "${command}" = "fclone" ] ; then + pull_newrepo="`echo ${pull_base}/${i} | sed -e 's@\([^:]/\)//*@\1@g'`" + echo ${hg} clone ${pull_newrepo} ${i} + ${hg} clone ${pull_newrepo} ${i} & + else + echo "cd ${i} && ${hg} $*" + cd ${i} && ${hg} "$@" & + fi + echo $! > ${tmp}/${repopidfile}.pid + ) 2>&1 | sed -e "s@^@${reponame}: @") & + + if [ `expr ${n} '%' ${at_a_time}` -eq 0 ] ; then + sleep 2 + echo Waiting 5 secs before spawning next background command. + sleep 3 + fi +done +# Wait for all hg commands to complete +wait + +# Terminate with exit 0 all the time (hard to know when to say "failed") +exit 0 + diff --git a/common/makefiles/RMICompilation.gmk b/common/makefiles/RMICompilation.gmk index fd332b4dbb5..4727412e958 100644 --- a/common/makefiles/RMICompilation.gmk +++ b/common/makefiles/RMICompilation.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/common/makefiles/javadoc/CORE_PKGS.gmk b/common/makefiles/javadoc/CORE_PKGS.gmk index e292869f951..dcfda026ded 100644 --- a/common/makefiles/javadoc/CORE_PKGS.gmk +++ b/common/makefiles/javadoc/CORE_PKGS.gmk @@ -131,6 +131,7 @@ CORE_PKGS = \ java.util.concurrent \ java.util.concurrent.atomic \ java.util.concurrent.locks \ + java.util.function \ java.util.jar \ java.util.logging \ java.util.prefs \ diff --git a/common/makefiles/javadoc/NON_CORE_PKGS.gmk b/common/makefiles/javadoc/NON_CORE_PKGS.gmk index b68d259168e..1d944d3dd19 100644 --- a/common/makefiles/javadoc/NON_CORE_PKGS.gmk +++ b/common/makefiles/javadoc/NON_CORE_PKGS.gmk @@ -78,7 +78,8 @@ ATTACH_PKGS = com.sun.tools.attach \ JCONSOLE_PKGS = com.sun.tools.jconsole -TREEAPI_PKGS = com.sun.source.tree \ +TREEAPI_PKGS = com.sun.source.doctree \ + com.sun.source.tree \ com.sun.source.util SMARTCARDIO_PKGS = javax.smartcardio diff --git a/corba/.hgtags b/corba/.hgtags index c9943de96b3..4b792172c50 100644 --- a/corba/.hgtags +++ b/corba/.hgtags @@ -189,3 +189,6 @@ d54dc53e223ed9ce7d5f4d2cd02ad9d5def3c2db jdk8-b59 5132f7900a8f0c30c3ca7f7a32f9433f4fee7745 jdk8-b65 65771ad1ca557ca26e4979d4dc633cf685435cb8 jdk8-b66 394515ad2a55d4d54df990b36065505d3e7a3cbb jdk8-b67 +82000531feaa7baef76b6406099e5cd88943d635 jdk8-b68 +22ddcac208a8dea894a16887d04f3ca4d3c5d267 jdk8-b69 +603cceb495c8133d47b26a7502d51c7d8a67d76b jdk8-b70 diff --git a/get_source.sh b/get_source.sh index 24dca4aed48..bc4d18d24c9 100644 --- a/get_source.sh +++ b/get_source.sh @@ -26,8 +26,8 @@ # # Get clones of all nested repositories -sh ./make/scripts/hgforest.sh clone $* +sh ./common/bin/hgforest.sh clone "$@" # Update all existing repositories to the latest sources -sh ./make/scripts/hgforest.sh pull -u +sh ./common/bin/hgforest.sh pull -u diff --git a/hotspot/.hgtags b/hotspot/.hgtags index c04b27715a8..a7ac93bb5cd 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -299,3 +299,8 @@ cfc5309f03b7bd6c1567618b63cf1fc74c0f2a8f hs25-b10 b61d9c88b759d1594b8af1655598e8fa00393672 hs25-b11 25bdce771bb3a7ae9825261a284d292cda700122 jdk8-b67 a35a72dd2e1255239d31f796f9f693e49b36bc9f hs25-b12 +121aa71316af6cd877bf455e775fa3fdbcdd4b65 jdk8-b68 +b6c9c0109a608eedbb6b868d260952990e3c91fe hs25-b13 +cb8a4e04bc8c104de8a2f67463c7e31232bf8d68 jdk8-b69 +990bbd393c239d95310ccc38094e57923bbf1d4a hs25-b14 +e94068d4ff52849c8aa0786a53a59b63d1312a39 jdk8-b70 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciArrayKlass.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciArrayKlass.java index 1be16eac97e..2abc8da855f 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciArrayKlass.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciArrayKlass.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciField.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciField.java index 80b1b337394..13c530099c5 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciField.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciField.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciInstance.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciInstance.java index 6a59cabd7f5..57f6ef3133c 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciInstance.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciInstance.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciKlass.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciKlass.java index fc92044e024..aba64a5015e 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciKlass.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciKlass.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciMetadata.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciMetadata.java index 1e5d763913f..d93dc011843 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciMetadata.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciMetadata.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciObjArrayKlass.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciObjArrayKlass.java index c412dee7237..d0907e56530 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciObjArrayKlass.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciObjArrayKlass.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciObject.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciObject.java index e44d21c3115..d435e0a15b0 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciObject.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciObject.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciObjectFactory.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciObjectFactory.java index be862491804..7f97400085b 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciObjectFactory.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciObjectFactory.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciReceiverTypeData.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciReceiverTypeData.java index dc68d7e7781..e568b3f7cec 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciReceiverTypeData.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciReceiverTypeData.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciSymbol.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciSymbol.java index 12f4c4bd16f..d94f1a4b53e 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciSymbol.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciSymbol.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciType.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciType.java index 7e8714523c9..586d57f30d3 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciType.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciType.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciTypeArrayKlass.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciTypeArrayKlass.java index cc0281784d1..37095b9f6ca 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciTypeArrayKlass.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciTypeArrayKlass.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciVirtualCallData.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciVirtualCallData.java index 4341fb15342..231ab844e3e 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciVirtualCallData.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciVirtualCallData.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/classfile/ClassLoaderData.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/classfile/ClassLoaderData.java index 0e7880b4496..4d34f9912df 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/classfile/ClassLoaderData.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/classfile/ClassLoaderData.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/LoaderConstraintTable.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/LoaderConstraintTable.java index 14d6c566b77..d2afad35f31 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/LoaderConstraintTable.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/LoaderConstraintTable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/BitData.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/BitData.java index 80902b0b090..fa48a7c9b16 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/BitData.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/BitData.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ConstMethod.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ConstMethod.java index 3e30820206a..ad495d73bea 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ConstMethod.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ConstMethod.java @@ -69,6 +69,8 @@ public class ConstMethod extends VMObject { signatureIndex = new CIntField(type.getCIntegerField("_signature_index"), 0); idnum = new CIntField(type.getCIntegerField("_method_idnum"), 0); maxStack = new CIntField(type.getCIntegerField("_max_stack"), 0); + maxLocals = new CIntField(type.getCIntegerField("_max_locals"), 0); + sizeOfParameters = new CIntField(type.getCIntegerField("_size_of_parameters"), 0); // start of byte code bytecodeOffset = type.getSize(); @@ -96,6 +98,8 @@ public class ConstMethod extends VMObject { private static CIntField signatureIndex; private static CIntField idnum; private static CIntField maxStack; + private static CIntField maxLocals; + private static CIntField sizeOfParameters; // start of bytecode private static long bytecodeOffset; @@ -151,6 +155,14 @@ public class ConstMethod extends VMObject { return maxStack.getValue(this); } + public long getMaxLocals() { + return maxLocals.getValue(this); + } + + public long getSizeOfParameters() { + return sizeOfParameters.getValue(this); + } + public Symbol getName() { return getMethod().getName(); } @@ -247,6 +259,8 @@ public class ConstMethod extends VMObject { visitor.doCInt(signatureIndex, true); visitor.doCInt(codeSize, true); visitor.doCInt(maxStack, true); + visitor.doCInt(maxLocals, true); + visitor.doCInt(sizeOfParameters, true); } // Accessors diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java index a12d0b1e84e..31dc39c5431 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java @@ -50,8 +50,6 @@ public class Method extends Metadata { constMethod = type.getAddressField("_constMethod"); methodData = type.getAddressField("_method_data"); methodSize = new CIntField(type.getCIntegerField("_method_size"), 0); - maxLocals = new CIntField(type.getCIntegerField("_max_locals"), 0); - sizeOfParameters = new CIntField(type.getCIntegerField("_size_of_parameters"), 0); accessFlags = new CIntField(type.getCIntegerField("_access_flags"), 0); code = type.getAddressField("_code"); vtableIndex = new CIntField(type.getCIntegerField("_vtable_index"), 0); @@ -83,8 +81,6 @@ public class Method extends Metadata { private static AddressField constMethod; private static AddressField methodData; private static CIntField methodSize; - private static CIntField maxLocals; - private static CIntField sizeOfParameters; private static CIntField accessFlags; private static CIntField vtableIndex; private static CIntField invocationCounter; @@ -134,8 +130,8 @@ public class Method extends Metadata { /** WARNING: this is in words, not useful in this system; use getObjectSize() instead */ public long getMethodSize() { return methodSize.getValue(this); } public long getMaxStack() { return getConstMethod().getMaxStack(); } - public long getMaxLocals() { return maxLocals.getValue(this); } - public long getSizeOfParameters() { return sizeOfParameters.getValue(this); } + public long getMaxLocals() { return getConstMethod().getMaxLocals(); } + public long getSizeOfParameters() { return getConstMethod().getSizeOfParameters(); } public long getNameIndex() { return getConstMethod().getNameIndex(); } public long getSignatureIndex() { return getConstMethod().getSignatureIndex(); } public long getGenericSignatureIndex() { return getConstMethod().getGenericSignatureIndex(); } @@ -282,8 +278,6 @@ public class Method extends Metadata { public void iterateFields(MetadataVisitor visitor) { visitor.doCInt(methodSize, true); - visitor.doCInt(maxLocals, true); - visitor.doCInt(sizeOfParameters, true); visitor.doCInt(accessFlags, true); } diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ProfileData.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ProfileData.java index 6cdaebd01e5..dce1b839d1c 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ProfileData.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ProfileData.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/RetData.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/RetData.java index 374623b852b..5ecd60bcb8e 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/RetData.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/RetData.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Block.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Block.java index 106713fce11..156e8def9ca 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Block.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Block.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Block_Array.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Block_Array.java index b219ca7c3aa..37bc600842f 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Block_Array.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Block_Array.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Block_List.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Block_List.java index 8945334e74f..357742b4dee 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Block_List.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Block_List.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/CallDynamicJavaNode.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/CallDynamicJavaNode.java index ca686433997..b3ba3eb05a1 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/CallDynamicJavaNode.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/CallDynamicJavaNode.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/CallJavaNode.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/CallJavaNode.java index cfff84bdb76..aa5baffec3c 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/CallJavaNode.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/CallJavaNode.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/CallNode.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/CallNode.java index 56349174ce5..7fd62cf2af5 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/CallNode.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/CallNode.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/CallRuntimeNode.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/CallRuntimeNode.java index 7f730ef680f..c8dcc85064b 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/CallRuntimeNode.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/CallRuntimeNode.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/CallStaticJavaNode.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/CallStaticJavaNode.java index 47ff13f1280..5b59c508664 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/CallStaticJavaNode.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/CallStaticJavaNode.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Compile.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Compile.java index 2b23b51a078..9e4cfa73b09 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Compile.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Compile.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/HaltNode.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/HaltNode.java index ea8ef89a1c9..bc2d69a6c88 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/HaltNode.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/HaltNode.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/InlineTree.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/InlineTree.java index 4a6d64d8bd4..4021e706e88 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/InlineTree.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/InlineTree.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/JVMState.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/JVMState.java index ec409e0787a..52996ee763e 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/JVMState.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/JVMState.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/LoopNode.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/LoopNode.java index c62ad089e1d..7cd4525d23b 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/LoopNode.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/LoopNode.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MachCallJavaNode.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MachCallJavaNode.java index ca7b9bf1bb3..91f4b16e23c 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MachCallJavaNode.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MachCallJavaNode.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MachCallNode.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MachCallNode.java index 7f3691e57bb..85de1386d3c 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MachCallNode.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MachCallNode.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MachCallRuntimeNode.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MachCallRuntimeNode.java index 9a6655f3b03..671067f94e1 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MachCallRuntimeNode.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MachCallRuntimeNode.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MachCallStaticJavaNode.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MachCallStaticJavaNode.java index 4668acb827e..63fe20e28b1 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MachCallStaticJavaNode.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MachCallStaticJavaNode.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MachIfNode.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MachIfNode.java index dc47e131297..cb11583e0ee 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MachIfNode.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MachIfNode.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MachNode.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MachNode.java index c59ef7a758f..996d7aa1024 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MachNode.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MachNode.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MachReturnNode.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MachReturnNode.java index a9bd39abff4..e9857a22f5c 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MachReturnNode.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MachReturnNode.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MachSafePointNode.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MachSafePointNode.java index 630f2690eff..a382b189e8a 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MachSafePointNode.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MachSafePointNode.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MultiNode.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MultiNode.java index 69d666ed6ce..ecba1c37c91 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MultiNode.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/MultiNode.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Node.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Node.java index e393383c4c7..a4f56d5da36 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Node.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Node.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Node_Array.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Node_Array.java index c4a2734202b..c95ae841fef 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Node_Array.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Node_Array.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Node_List.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Node_List.java index 0828bf56650..56e5f3cbd98 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Node_List.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Node_List.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Phase.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Phase.java index 5c010b0a7ab..ba12e08c38f 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Phase.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Phase.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/PhaseCFG.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/PhaseCFG.java index 986214f9e0f..2530f1af7a7 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/PhaseCFG.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/PhaseCFG.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/PhaseRegAlloc.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/PhaseRegAlloc.java index c51d952a97c..24edd1365e2 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/PhaseRegAlloc.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/PhaseRegAlloc.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/PhiNode.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/PhiNode.java index 6565e0372f2..64486200182 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/PhiNode.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/PhiNode.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/ProjNode.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/ProjNode.java index 6f3e9d4cc16..0bf38b55183 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/ProjNode.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/ProjNode.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/RegionNode.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/RegionNode.java index 5aa7763fd73..8aae1f56252 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/RegionNode.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/RegionNode.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/RootNode.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/RootNode.java index 9a050da6360..05cb31f9deb 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/RootNode.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/RootNode.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/SafePointNode.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/SafePointNode.java index 51585927bb1..d2df583f11a 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/SafePointNode.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/SafePointNode.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/TypeNode.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/TypeNode.java index 33e423a2337..56917077d3e 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/TypeNode.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/TypeNode.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/prims/JvmtiExport.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/prims/JvmtiExport.java index 83602a3bff4..8fd3f7099b6 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/prims/JvmtiExport.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/prims/JvmtiExport.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/GenericGrowableArray.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/GenericGrowableArray.java index a0fcac8f40e..825ffb8c197 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/GenericGrowableArray.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/GenericGrowableArray.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/GrowableArray.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/GrowableArray.java index 4a6f1af5a93..e66586e4b4f 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/GrowableArray.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/GrowableArray.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. * */ diff --git a/hotspot/agent/src/share/native/sadis.c b/hotspot/agent/src/share/native/sadis.c index 06525deecf5..f8bd9adbd64 100644 --- a/hotspot/agent/src/share/native/sadis.c +++ b/hotspot/agent/src/share/native/sadis.c @@ -1,5 +1,5 @@ /* - * Copyright 2012, Oracle and/or its affiliates. All Rights Reserved. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/hotspot/make/bsd/Makefile b/hotspot/make/bsd/Makefile index 7c047e99070..e95bb05502d 100644 --- a/hotspot/make/bsd/Makefile +++ b/hotspot/make/bsd/Makefile @@ -47,10 +47,10 @@ # Along with VM, Serviceability Agent (SA) is built for SA/JDI binding. # JDI binding on SA produces two binaries: -# 1. sa-jdi.jar - This is build before building libjvm[_g].so +# 1. sa-jdi.jar - This is built before building libjvm.so # Please refer to ./makefiles/sa.make -# 2. libsa[_g].so - Native library for SA - This is built after -# libjsig[_g].so (signal interposition library) +# 2. libsa.so - Native library for SA - This is built after +# libjsig.so (signal interposition library) # Please refer to ./makefiles/vm.make # If $(GAMMADIR)/agent dir is not present, SA components are not built. @@ -181,9 +181,9 @@ VARIANTARCH = $(subst i386,i486,$(ZERO_LIBARCH)) # # What you get with each target: # -# debug* - "thin" libjvm_g - debug info linked into the gamma_g launcher +# debug* - "thin" libjvm - debug info linked into the gamma launcher # fastdebug* - optimized compile, but with asserts enabled -# jvmg* - "fat" libjvm_g - debug info linked into libjvm_g.so +# jvmg* - "fat" libjvm - debug info linked into libjvm.so # optimized* - optimized compile, no asserts # profiled* - gprof # product* - the shippable thing: optimized compile, no asserts, -DPRODUCT diff --git a/hotspot/make/bsd/makefiles/buildtree.make b/hotspot/make/bsd/makefiles/buildtree.make index 800b68d225e..b8d92f6a4fc 100644 --- a/hotspot/make/bsd/makefiles/buildtree.make +++ b/hotspot/make/bsd/makefiles/buildtree.make @@ -449,12 +449,7 @@ test_gamma: $(BUILDTREE_MAKE) $(GAMMADIR)/make/test/Queens.java echo " exit 0"; \ echo "fi"; \ echo ""; \ - echo "# Use gamma_g if it exists"; \ - echo ""; \ echo "GAMMA_PROG=gamma"; \ - echo "if [ -f gamma_g ]; then "; \ - echo " GAMMA_PROG=gamma_g"; \ - echo "fi"; \ echo ""; \ echo "if [ \"$(OS_VENDOR)\" = \"Darwin\" ]; then "; \ echo " # Ensure architecture for gamma and JAVA_HOME is the same."; \ diff --git a/hotspot/make/bsd/makefiles/debug.make b/hotspot/make/bsd/makefiles/debug.make index f0aec179723..5849ed67eed 100644 --- a/hotspot/make/bsd/makefiles/debug.make +++ b/hotspot/make/bsd/makefiles/debug.make @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,6 @@ _JUNK_ := $(shell echo -e >&2 ""\ "Please use 'make jvmg' to build debug JVM. \n" \ "----------------------------------------------------------------------\n") -G_SUFFIX = _g VERSION = debug SYSDEFS += -DASSERT -DDEBUG PICFLAGS = DEFAULT diff --git a/hotspot/make/bsd/makefiles/dtrace.make b/hotspot/make/bsd/makefiles/dtrace.make index 98ce02f7e29..d325f2082dd 100644 --- a/hotspot/make/bsd/makefiles/dtrace.make +++ b/hotspot/make/bsd/makefiles/dtrace.make @@ -38,12 +38,10 @@ DtraceOutDir = $(GENERATED)/dtracefiles # Bsd does not build libjvm_db, does not compile on macosx # disabled in build: rule in vm.make JVM_DB = libjvm_db -#LIBJVM_DB = libjvm_db.dylib -LIBJVM_DB = libjvm$(G_SUFFIX)_db.dylib +LIBJVM_DB = libjvm_db.dylib JVM_DTRACE = jvm_dtrace -#LIBJVM_DTRACE = libjvm_dtrace.dylib -LIBJVM_DTRACE = libjvm$(G_SUFFIX)_dtrace.dylib +LIBJVM_DTRACE = libjvm_dtrace.dylib JVMOFFS = JvmOffsets JVMOFFS.o = $(JVMOFFS).o @@ -80,9 +78,7 @@ ISA = $(subst i386,i486,$(BUILDARCH)) ifneq ("${ISA}","${BUILDARCH}") XLIBJVM_DB = 64/$(LIBJVM_DB) -XLIBJVM_DB_G = 64/$(LIBJVM_DB_G) XLIBJVM_DTRACE = 64/$(LIBJVM_DTRACE) -XLIBJVM_DTRACE_G = 64/$(LIBJVM_DTRACE_G) XARCH = $(subst sparcv9,v9,$(shell echo $(ISA))) $(XLIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE) @@ -90,14 +86,12 @@ $(XLIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE) $(QUIETLY) mkdir -p 64/ ; \ $(CC) $(SYMFLAG) -xarch=$(XARCH) -D$(TYPE) -I. -I$(GENERATED) \ $(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c #-lc -# [ -f $(XLIBJVM_DB_G) ] || { ln -s $(LIBJVM_DB) $(XLIBJVM_DB_G); } $(XLIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) @echo Making $@ $(QUIETLY) mkdir -p 64/ ; \ $(CC) $(SYMFLAG) -xarch=$(XARCH) -D$(TYPE) -I. \ $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c #-lc -lthread -ldoor -# [ -f $(XLIBJVM_DTRACE_G) ] || { ln -s $(LIBJVM_DTRACE) $(XLIBJVM_DTRACE_G); } endif # ifneq ("${ISA}","${BUILDARCH}") @@ -141,13 +135,11 @@ $(LIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS.o) $(XLIBJVM_DB) $(LIBJVM_D @echo Making $@ $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. -I$(GENERATED) \ $(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -Wall # -lc -# [ -f $(LIBJVM_DB_G) ] || { ln -s $@ $(LIBJVM_DB_G); } $(LIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) @echo Making $@ $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. \ $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c #-lc -lthread -ldoor -# [ -f $(LIBJVM_DTRACE_G) ] || { ln -s $@ $(LIBJVM_DTRACE_G); } #$(DTRACE).d: $(DTRACE_SRCDIR)/hotspot.d $(DTRACE_SRCDIR)/hotspot_jni.d \ # $(DTRACE_SRCDIR)/hs_private.d $(DTRACE_SRCDIR)/jhelper.d diff --git a/hotspot/make/bsd/makefiles/fastdebug.make b/hotspot/make/bsd/makefiles/fastdebug.make index c550d9bdde6..c59310634c3 100644 --- a/hotspot/make/bsd/makefiles/fastdebug.make +++ b/hotspot/make/bsd/makefiles/fastdebug.make @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2012 Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -58,7 +58,6 @@ CFLAGS$(HOTSPARC_GENERIC) += $(OPT_CFLAGS/BYFILE) # Linker mapfile MAPFILE = $(GAMMADIR)/make/bsd/makefiles/mapfile-vers-debug -G_SUFFIX = _g VERSION = optimized SYSDEFS += -DASSERT -DFASTDEBUG PICFLAGS = DEFAULT diff --git a/hotspot/make/bsd/makefiles/gcc.make b/hotspot/make/bsd/makefiles/gcc.make index f9451d84f77..2cee1b0034e 100644 --- a/hotspot/make/bsd/makefiles/gcc.make +++ b/hotspot/make/bsd/makefiles/gcc.make @@ -284,9 +284,9 @@ endif # Use the stabs format for debugging information (this is the default # on gcc-2.91). It's good enough, has all the information about line -# numbers and local variables, and libjvm_g.so is only about 16M. +# numbers and local variables, and libjvm.so is only about 16M. # Change this back to "-g" if you want the most expressive format. -# (warning: that could easily inflate libjvm_g.so to 150M!) +# (warning: that could easily inflate libjvm.so to 150M!) # Note: The Itanium gcc compiler crashes when using -gstabs. DEBUG_CFLAGS/ia64 = -g DEBUG_CFLAGS/amd64 = -g diff --git a/hotspot/make/bsd/makefiles/jsig.make b/hotspot/make/bsd/makefiles/jsig.make index 80be2088677..481ff72f0b5 100644 --- a/hotspot/make/bsd/makefiles/jsig.make +++ b/hotspot/make/bsd/makefiles/jsig.make @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -24,16 +24,13 @@ # Rules to build signal interposition library, used by vm.make -# libjsig[_g].so: signal interposition library +# libjsig.so: signal interposition library JSIG = jsig -JSIG_G = $(JSIG)$(G_SUFFIX) ifeq ($(OS_VENDOR), Darwin) LIBJSIG = lib$(JSIG).dylib - LIBJSIG_G = lib$(JSIG_G).dylib else LIBJSIG = lib$(JSIG).so - LIBJSIG_G = lib$(JSIG_G).so endif JSIGSRCDIR = $(GAMMADIR)/src/os/$(Platform_os_family)/vm @@ -58,7 +55,6 @@ $(LIBJSIG): $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE) @echo Making signal interposition lib... $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \ $(LFLAGS_JSIG) $(JSIG_DEBUG_CFLAGS) -o $@ $< - $(QUIETLY) [ -f $(LIBJSIG_G) ] || { ln -s $@ $(LIBJSIG_G); } install_jsig: $(LIBJSIG) @echo "Copying $(LIBJSIG) to $(DEST_JSIG)" diff --git a/hotspot/make/bsd/makefiles/jvmg.make b/hotspot/make/bsd/makefiles/jvmg.make index 3f1061a2830..52dbdb94b98 100644 --- a/hotspot/make/bsd/makefiles/jvmg.make +++ b/hotspot/make/bsd/makefiles/jvmg.make @@ -37,7 +37,6 @@ CFLAGS += $(DEBUG_CFLAGS/BYFILE) -D_NMT_NOINLINE_ # Linker mapfile MAPFILE = $(GAMMADIR)/make/bsd/makefiles/mapfile-vers-debug -G_SUFFIX = _g VERSION = debug SYSDEFS += -DASSERT -DDEBUG PICFLAGS = DEFAULT diff --git a/hotspot/make/bsd/makefiles/optimized.make b/hotspot/make/bsd/makefiles/optimized.make index 6090c978465..6930997923e 100644 --- a/hotspot/make/bsd/makefiles/optimized.make +++ b/hotspot/make/bsd/makefiles/optimized.make @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -40,5 +40,4 @@ CFLAGS$(HOTSPARC_GENERIC) += $(OPT_CFLAGS/BYFILE) # Linker mapfile MAPFILE = $(GAMMADIR)/make/bsd/makefiles/mapfile-vers-debug -G_SUFFIX = VERSION = optimized diff --git a/hotspot/make/bsd/makefiles/product.make b/hotspot/make/bsd/makefiles/product.make index d27c0a6011c..0d6fb0e86d0 100644 --- a/hotspot/make/bsd/makefiles/product.make +++ b/hotspot/make/bsd/makefiles/product.make @@ -40,7 +40,6 @@ CFLAGS$(HOTSPARC_GENERIC) += $(OPT_CFLAGS/BYFILE) # Linker mapfile MAPFILE = $(GAMMADIR)/make/bsd/makefiles/mapfile-vers-product -G_SUFFIX = SYSDEFS += -DPRODUCT VERSION = optimized diff --git a/hotspot/make/bsd/makefiles/saproc.make b/hotspot/make/bsd/makefiles/saproc.make index 24109f6d50f..4fb216b41f6 100644 --- a/hotspot/make/bsd/makefiles/saproc.make +++ b/hotspot/make/bsd/makefiles/saproc.make @@ -24,16 +24,13 @@ # Rules to build serviceability agent library, used by vm.make -# libsaproc[_g].so: serviceability agent +# libsaproc.so: serviceability agent SAPROC = saproc -SAPROC_G = $(SAPROC)$(G_SUFFIX) ifeq ($(OS_VENDOR), Darwin) LIBSAPROC = lib$(SAPROC).dylib - LIBSAPROC_G = lib$(SAPROC_G).dylib else LIBSAPROC = lib$(SAPROC).so - LIBSAPROC_G = lib$(SAPROC_G).so endif AGENT_DIR = $(GAMMADIR)/agent @@ -114,7 +111,6 @@ $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE) $(SA_DEBUG_CFLAGS) \ -o $@ \ $(SALIBS) - $(QUIETLY) [ -f $(LIBSAPROC_G) ] || { ln -s $@ $(LIBSAPROC_G); } install_saproc: $(BUILDLIBSAPROC) $(QUIETLY) if [ -e $(LIBSAPROC) ] ; then \ diff --git a/hotspot/make/bsd/makefiles/vm.make b/hotspot/make/bsd/makefiles/vm.make index e60535821b6..fbcfb06ced2 100644 --- a/hotspot/make/bsd/makefiles/vm.make +++ b/hotspot/make/bsd/makefiles/vm.make @@ -138,11 +138,9 @@ include $(MAKEFILES_DIR)/dtrace.make JVM = jvm ifeq ($(OS_VENDOR), Darwin) LIBJVM = lib$(JVM).dylib - LIBJVM_G = lib$(JVM)$(G_SUFFIX).dylib CFLAGS += -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE else LIBJVM = lib$(JVM).so - LIBJVM_G = lib$(JVM)$(G_SUFFIX).so endif SPECIAL_PATHS:=adlc c1 gc_implementation opto shark libadt @@ -314,7 +312,6 @@ $(LIBJVM): $(LIBJVM.o) $(LIBJVM_MAPFILE) $(LD_SCRIPT) $(LFLAGS_VM) -o $@ $(sort $(LIBJVM.o)) $(LIBS_VM); \ $(LINK_LIB.CXX/POST_HOOK) \ rm -f $@.1; ln -s $@ $@.1; \ - [ -f $(LIBJVM_G) ] || { ln -s $@ $(LIBJVM_G); ln -s $@.1 $(LIBJVM_G).1; }; \ } DEST_JVM = $(JDK_LIBDIR)/$(VM_SUBDIR)/$(LIBJVM) diff --git a/hotspot/make/hotspot_version b/hotspot/make/hotspot_version index 4dc306b68cf..60535db5496 100644 --- a/hotspot/make/hotspot_version +++ b/hotspot/make/hotspot_version @@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2012 HS_MAJOR_VER=25 HS_MINOR_VER=0 -HS_BUILD_NUMBER=12 +HS_BUILD_NUMBER=14 JDK_MAJOR_VER=1 JDK_MINOR_VER=8 diff --git a/hotspot/make/linux/Makefile b/hotspot/make/linux/Makefile index 065ca0e83e7..e8ef90718a4 100644 --- a/hotspot/make/linux/Makefile +++ b/hotspot/make/linux/Makefile @@ -47,10 +47,10 @@ # Along with VM, Serviceability Agent (SA) is built for SA/JDI binding. # JDI binding on SA produces two binaries: -# 1. sa-jdi.jar - This is build before building libjvm[_g].so +# 1. sa-jdi.jar - This is built before building libjvm.so # Please refer to ./makefiles/sa.make -# 2. libsa[_g].so - Native library for SA - This is built after -# libjsig[_g].so (signal interposition library) +# 2. libsa.so - Native library for SA - This is built after +# libjsig.so (signal interposition library) # Please refer to ./makefiles/vm.make # If $(GAMMADIR)/agent dir is not present, SA components are not built. @@ -181,9 +181,9 @@ VARIANTARCH = $(subst i386,i486,$(ZERO_LIBARCH)) # # What you get with each target: # -# debug* - "thin" libjvm_g - debug info linked into the gamma_g launcher +# debug* - "thin" libjvm - debug info linked into the gamma launcher # fastdebug* - optimized compile, but with asserts enabled -# jvmg* - "fat" libjvm_g - debug info linked into libjvm_g.so +# jvmg* - "fat" libjvm - debug info linked into libjvm.so # optimized* - optimized compile, no asserts # profiled* - gprof # product* - the shippable thing: optimized compile, no asserts, -DPRODUCT diff --git a/hotspot/make/linux/makefiles/buildtree.make b/hotspot/make/linux/makefiles/buildtree.make index 639c11f87c8..960b8f316fb 100644 --- a/hotspot/make/linux/makefiles/buildtree.make +++ b/hotspot/make/linux/makefiles/buildtree.make @@ -442,12 +442,7 @@ test_gamma: $(BUILDTREE_MAKE) $(GAMMADIR)/make/test/Queens.java echo " exit 0"; \ echo "fi"; \ echo ""; \ - echo "# Use gamma_g if it exists"; \ - echo ""; \ echo "GAMMA_PROG=gamma"; \ - echo "if [ -f gamma_g ]; then "; \ - echo " GAMMA_PROG=gamma_g"; \ - echo "fi"; \ echo ""; \ echo "if [ \"$(OS_VENDOR)\" = \"Darwin\" ]; then "; \ echo " # Ensure architecture for gamma and JAVA_HOME is the same."; \ diff --git a/hotspot/make/linux/makefiles/debug.make b/hotspot/make/linux/makefiles/debug.make index 88a2ac03355..e51d4c192d2 100644 --- a/hotspot/make/linux/makefiles/debug.make +++ b/hotspot/make/linux/makefiles/debug.make @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,6 @@ _JUNK_ := $(shell echo -e >&2 ""\ "Please use 'make jvmg' to build debug JVM. \n" \ "----------------------------------------------------------------------\n") -G_SUFFIX = _g VERSION = debug SYSDEFS += -DASSERT -DDEBUG PICFLAGS = DEFAULT diff --git a/hotspot/make/linux/makefiles/fastdebug.make b/hotspot/make/linux/makefiles/fastdebug.make index 5b0569ca2ef..86ffc36b7c2 100644 --- a/hotspot/make/linux/makefiles/fastdebug.make +++ b/hotspot/make/linux/makefiles/fastdebug.make @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -58,7 +58,6 @@ CFLAGS$(HOTSPARC_GENERIC) += $(OPT_CFLAGS/BYFILE) # Linker mapfile MAPFILE = $(GAMMADIR)/make/linux/makefiles/mapfile-vers-debug -G_SUFFIX = _g VERSION = optimized SYSDEFS += -DASSERT -DFASTDEBUG PICFLAGS = DEFAULT diff --git a/hotspot/make/linux/makefiles/gcc.make b/hotspot/make/linux/makefiles/gcc.make index 3bed2c8562f..9ef83664535 100644 --- a/hotspot/make/linux/makefiles/gcc.make +++ b/hotspot/make/linux/makefiles/gcc.make @@ -229,9 +229,9 @@ ifeq ($(DEBUG_BINARIES), true) else # Use the stabs format for debugging information (this is the default # on gcc-2.91). It's good enough, has all the information about line - # numbers and local variables, and libjvm_g.so is only about 16M. + # numbers and local variables, and libjvm.so is only about 16M. # Change this back to "-g" if you want the most expressive format. - # (warning: that could easily inflate libjvm_g.so to 150M!) + # (warning: that could easily inflate libjvm.so to 150M!) # Note: The Itanium gcc compiler crashes when using -gstabs. DEBUG_CFLAGS/ia64 = -g DEBUG_CFLAGS/amd64 = -g diff --git a/hotspot/make/linux/makefiles/jsig.make b/hotspot/make/linux/makefiles/jsig.make index 1d013fcb1f6..a0c72453f54 100644 --- a/hotspot/make/linux/makefiles/jsig.make +++ b/hotspot/make/linux/makefiles/jsig.make @@ -24,17 +24,12 @@ # Rules to build signal interposition library, used by vm.make -# libjsig[_g].so: signal interposition library +# libjsig.so: signal interposition library JSIG = jsig LIBJSIG = lib$(JSIG).so -JSIG_G = $(JSIG)$(G_SUFFIX) -LIBJSIG_G = lib$(JSIG_G).so - LIBJSIG_DEBUGINFO = lib$(JSIG).debuginfo LIBJSIG_DIZ = lib$(JSIG).diz -LIBJSIG_G_DEBUGINFO = lib$(JSIG_G).debuginfo -LIBJSIG_G_DIZ = lib$(JSIG_G).diz JSIGSRCDIR = $(GAMMADIR)/src/os/$(Platform_os_family)/vm @@ -60,7 +55,6 @@ $(LIBJSIG): $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE) @echo Making signal interposition lib... $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \ $(LFLAGS_JSIG) $(JSIG_DEBUG_CFLAGS) -o $@ $< -ldl - $(QUIETLY) [ -f $(LIBJSIG_G) ] || { ln -s $@ $(LIBJSIG_G); } ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJSIG_DEBUGINFO) $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJSIG_DEBUGINFO) $@ @@ -72,11 +66,9 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) # implied else here is no stripping at all endif endif - [ -f $(LIBJSIG_G_DEBUGINFO) ] || { ln -s $(LIBJSIG_DEBUGINFO) $(LIBJSIG_G_DEBUGINFO); } ifeq ($(ZIP_DEBUGINFO_FILES),1) - $(ZIPEXE) -q -y $(LIBJSIG_DIZ) $(LIBJSIG_DEBUGINFO) $(LIBJSIG_G_DEBUGINFO) - $(RM) $(LIBJSIG_DEBUGINFO) $(LIBJSIG_G_DEBUGINFO) - [ -f $(LIBJSIG_G_DIZ) ] || { ln -s $(LIBJSIG_DIZ) $(LIBJSIG_G_DIZ); } + $(ZIPEXE) -q -y $(LIBJSIG_DIZ) $(LIBJSIG_DEBUGINFO) + $(RM) $(LIBJSIG_DEBUGINFO) endif endif diff --git a/hotspot/make/linux/makefiles/jvmg.make b/hotspot/make/linux/makefiles/jvmg.make index 3c0ae3a628e..24047f7c358 100644 --- a/hotspot/make/linux/makefiles/jvmg.make +++ b/hotspot/make/linux/makefiles/jvmg.make @@ -37,7 +37,6 @@ CFLAGS += $(DEBUG_CFLAGS/BYFILE) -D_NMT_NOINLINE_ # Linker mapfile MAPFILE = $(GAMMADIR)/make/linux/makefiles/mapfile-vers-debug -G_SUFFIX = _g VERSION = debug SYSDEFS += -DASSERT -DDEBUG PICFLAGS = DEFAULT diff --git a/hotspot/make/linux/makefiles/optimized.make b/hotspot/make/linux/makefiles/optimized.make index c457107567b..07470f0756a 100644 --- a/hotspot/make/linux/makefiles/optimized.make +++ b/hotspot/make/linux/makefiles/optimized.make @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -40,5 +40,4 @@ CFLAGS$(HOTSPARC_GENERIC) += $(OPT_CFLAGS/BYFILE) # Linker mapfile MAPFILE = $(GAMMADIR)/make/linux/makefiles/mapfile-vers-debug -G_SUFFIX = VERSION = optimized diff --git a/hotspot/make/linux/makefiles/product.make b/hotspot/make/linux/makefiles/product.make index a64d49f9d12..be241f41c92 100644 --- a/hotspot/make/linux/makefiles/product.make +++ b/hotspot/make/linux/makefiles/product.make @@ -40,7 +40,6 @@ CFLAGS$(HOTSPARC_GENERIC) += $(OPT_CFLAGS/BYFILE) # Linker mapfile MAPFILE = $(GAMMADIR)/make/linux/makefiles/mapfile-vers-product -G_SUFFIX = SYSDEFS += -DPRODUCT VERSION = optimized diff --git a/hotspot/make/linux/makefiles/saproc.make b/hotspot/make/linux/makefiles/saproc.make index cffafb8ad3d..c2a82d717c9 100644 --- a/hotspot/make/linux/makefiles/saproc.make +++ b/hotspot/make/linux/makefiles/saproc.make @@ -26,18 +26,13 @@ include $(GAMMADIR)/make/altsrc.make # Rules to build serviceability agent library, used by vm.make -# libsaproc[_g].so: serviceability agent +# libsaproc.so: serviceability agent SAPROC = saproc LIBSAPROC = lib$(SAPROC).so -SAPROC_G = $(SAPROC)$(G_SUFFIX) -LIBSAPROC_G = lib$(SAPROC_G).so - LIBSAPROC_DEBUGINFO = lib$(SAPROC).debuginfo LIBSAPROC_DIZ = lib$(SAPROC).diz -LIBSAPROC_G_DEBUGINFO = lib$(SAPROC_G).debuginfo -LIBSAPROC_G_DIZ = lib$(SAPROC_G).diz AGENT_DIR = $(GAMMADIR)/agent @@ -99,7 +94,6 @@ $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE) $(SA_DEBUG_CFLAGS) \ -o $@ \ -lthread_db - $(QUIETLY) [ -f $(LIBSAPROC_G) ] || { ln -s $@ $(LIBSAPROC_G); } ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBSAPROC_DEBUGINFO) $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@ @@ -111,11 +105,9 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) # implied else here is no stripping at all endif endif - [ -f $(LIBSAPROC_G_DEBUGINFO) ] || { ln -s $(LIBSAPROC_DEBUGINFO) $(LIBSAPROC_G_DEBUGINFO); } ifeq ($(ZIP_DEBUGINFO_FILES),1) - $(ZIPEXE) -q -y $(LIBSAPROC_DIZ) $(LIBSAPROC_DEBUGINFO) $(LIBSAPROC_G_DEBUGINFO) - $(RM) $(LIBSAPROC_DEBUGINFO) $(LIBSAPROC_G_DEBUGINFO) - [ -f $(LIBSAPROC_G_DIZ) ] || { ln -s $(LIBSAPROC_DIZ) $(LIBSAPROC_G_DIZ); } + $(ZIPEXE) -q -y $(LIBSAPROC_DIZ) $(LIBSAPROC_DEBUGINFO) + $(RM) $(LIBSAPROC_DEBUGINFO) endif endif diff --git a/hotspot/make/linux/makefiles/vm.make b/hotspot/make/linux/makefiles/vm.make index d1d6869bb23..705b34bb100 100644 --- a/hotspot/make/linux/makefiles/vm.make +++ b/hotspot/make/linux/makefiles/vm.make @@ -138,12 +138,9 @@ include $(MAKEFILES_DIR)/dtrace.make JVM = jvm LIBJVM = lib$(JVM).so -LIBJVM_G = lib$(JVM)$(G_SUFFIX).so LIBJVM_DEBUGINFO = lib$(JVM).debuginfo LIBJVM_DIZ = lib$(JVM).diz -LIBJVM_G_DEBUGINFO = lib$(JVM)$(G_SUFFIX).debuginfo -LIBJVM_G_DIZ = lib$(JVM)$(G_SUFFIX).diz SPECIAL_PATHS:=adlc c1 gc_implementation opto shark libadt @@ -323,7 +320,6 @@ $(LIBJVM): $(LIBJVM.o) $(LIBJVM_MAPFILE) $(LD_SCRIPT) $(LFLAGS_VM) -o $@ $(sort $(LIBJVM.o)) $(LIBS_VM); \ $(LINK_LIB.CXX/POST_HOOK) \ rm -f $@.1; ln -s $@ $@.1; \ - [ -f $(LIBJVM_G) ] || { ln -s $@ $(LIBJVM_G); ln -s $@.1 $(LIBJVM_G).1; }; \ if [ \"$(CROSS_COMPILE_ARCH)\" = \"\" ] ; then \ if [ -x /usr/sbin/selinuxenabled ] ; then \ /usr/sbin/selinuxenabled; \ @@ -348,11 +344,9 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) # implied else here is no stripping at all endif endif - $(QUIETLY) [ -f $(LIBJVM_G_DEBUGINFO) ] || ln -s $(LIBJVM_DEBUGINFO) $(LIBJVM_G_DEBUGINFO) ifeq ($(ZIP_DEBUGINFO_FILES),1) - $(ZIPEXE) -q -y $(LIBJVM_DIZ) $(LIBJVM_DEBUGINFO) $(LIBJVM_G_DEBUGINFO) - $(RM) $(LIBJVM_DEBUGINFO) $(LIBJVM_G_DEBUGINFO) - [ -f $(LIBJVM_G_DIZ) ] || { ln -s $(LIBJVM_DIZ) $(LIBJVM_G_DIZ); } + $(ZIPEXE) -q -y $(LIBJVM_DIZ) $(LIBJVM_DEBUGINFO) + $(RM) $(LIBJVM_DEBUGINFO) endif endif diff --git a/hotspot/make/solaris/Makefile b/hotspot/make/solaris/Makefile index 3a71eb541a2..4a47cb93716 100644 --- a/hotspot/make/solaris/Makefile +++ b/hotspot/make/solaris/Makefile @@ -38,10 +38,10 @@ # Along with VM, Serviceability Agent (SA) is built for SA/JDI binding. # JDI binding on SA produces two binaries: -# 1. sa-jdi.jar - This is build before building libjvm[_g].so +# 1. sa-jdi.jar - This is built before building libjvm.so # Please refer to ./makefiles/sa.make -# 2. libsaproc[_g].so - Native library for SA - This is built after -# libjsig[_g].so (signal interposition library) +# 2. libsaproc.so - Native library for SA - This is built after +# libjsig.so (signal interposition library) # Please refer to ./makefiles/vm.make # If $(GAMMADIR)/agent dir is not present, SA components are not built. @@ -141,9 +141,9 @@ endif # # What you get with each target: # -# debug* - "thin" libjvm_g - debug info linked into the gamma_g launcher +# debug* - "thin" libjvm - debug info linked into the gamma launcher # fastdebug* - optimized compile, but with asserts enabled -# jvmg* - "fat" libjvm_g - debug info linked into libjvm_g.so +# jvmg* - "fat" libjvm - debug info linked into libjvm.so # optimized* - optimized compile, no asserts # profiled* - gprof # product* - the shippable thing: optimized compile, no asserts, -DPRODUCT diff --git a/hotspot/make/solaris/makefiles/buildtree.make b/hotspot/make/solaris/makefiles/buildtree.make index 3bca3dcee79..a9e5a401c00 100644 --- a/hotspot/make/solaris/makefiles/buildtree.make +++ b/hotspot/make/solaris/makefiles/buildtree.make @@ -436,12 +436,7 @@ test_gamma: $(BUILDTREE_MAKE) $(GAMMADIR)/make/test/Queens.java echo " exit 0"; \ echo "fi"; \ echo ""; \ - echo "# Use gamma_g if it exists"; \ - echo ""; \ echo "GAMMA_PROG=gamma"; \ - echo "if [ -f gamma_g ]; then "; \ - echo " GAMMA_PROG=gamma_g"; \ - echo "fi"; \ echo ""; \ echo "if [ \"$(OS_VENDOR)\" = \"Darwin\" ]; then "; \ echo " # Ensure architecture for gamma and JAVA_HOME is the same."; \ diff --git a/hotspot/make/solaris/makefiles/debug.make b/hotspot/make/solaris/makefiles/debug.make index 60dc21b8a6a..602c07dc366 100644 --- a/hotspot/make/solaris/makefiles/debug.make +++ b/hotspot/make/solaris/makefiles/debug.make @@ -1,5 +1,5 @@ # -# Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -53,7 +53,6 @@ _JUNK_ := $(shell echo >&2 ""\ "Please use 'gnumake jvmg' to build debug JVM. \n" \ "-------------------------------------------------------------------------\n") -G_SUFFIX = _g VERSION = debug SYSDEFS += -DASSERT -DDEBUG PICFLAGS = DEFAULT diff --git a/hotspot/make/solaris/makefiles/dtrace.make b/hotspot/make/solaris/makefiles/dtrace.make index 1473a0f67b2..111acdb0d96 100644 --- a/hotspot/make/solaris/makefiles/dtrace.make +++ b/hotspot/make/solaris/makefiles/dtrace.make @@ -39,21 +39,15 @@ else JVM_DB = libjvm_db LIBJVM_DB = libjvm_db.so -LIBJVM_DB_G = libjvm$(G_SUFFIX)_db.so LIBJVM_DB_DEBUGINFO = libjvm_db.debuginfo LIBJVM_DB_DIZ = libjvm_db.diz -LIBJVM_DB_G_DEBUGINFO = libjvm$(G_SUFFIX)_db.debuginfo -LIBJVM_DB_G_DIZ = libjvm$(G_SUFFIX)_db.diz JVM_DTRACE = jvm_dtrace LIBJVM_DTRACE = libjvm_dtrace.so -LIBJVM_DTRACE_G = libjvm$(G_SUFFIX)_dtrace.so LIBJVM_DTRACE_DEBUGINFO = libjvm_dtrace.debuginfo LIBJVM_DTRACE_DIZ = libjvm_dtrace.diz -LIBJVM_DTRACE_G_DEBUGINFO = libjvm$(G_SUFFIX)_dtrace.debuginfo -LIBJVM_DTRACE_G_DIZ = libjvm$(G_SUFFIX)_dtrace.diz JVMOFFS = JvmOffsets JVMOFFS.o = $(JVMOFFS).o @@ -96,25 +90,18 @@ ifneq ("${ISA}","${BUILDARCH}") XLIBJVM_DIR = 64 XLIBJVM_DB = $(XLIBJVM_DIR)/$(LIBJVM_DB) -XLIBJVM_DB_G = $(XLIBJVM_DIR)/$(LIBJVM_DB_G) XLIBJVM_DTRACE = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE) -XLIBJVM_DTRACE_G = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE_G) XLIBJVM_DB_DEBUGINFO = $(XLIBJVM_DIR)/$(LIBJVM_DB_DEBUGINFO) XLIBJVM_DB_DIZ = $(XLIBJVM_DIR)/$(LIBJVM_DB_DIZ) -XLIBJVM_DB_G_DEBUGINFO = $(XLIBJVM_DIR)/$(LIBJVM_DB_G_DEBUGINFO) -XLIBJVM_DB_G_DIZ = $(XLIBJVM_DIR)/$(LIBJVM_DB_G_DIZ) XLIBJVM_DTRACE_DEBUGINFO = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE_DEBUGINFO) XLIBJVM_DTRACE_DIZ = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE_DIZ) -XLIBJVM_DTRACE_G_DEBUGINFO = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE_G_DEBUGINFO) -XLIBJVM_DTRACE_G_DIZ = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE_G_DIZ) $(XLIBJVM_DB): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE) @echo Making $@ $(QUIETLY) mkdir -p $(XLIBJVM_DIR) ; \ $(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. -I$(GENERATED) \ $(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc - [ -f $(XLIBJVM_DB_G) ] || { ln -s $(LIBJVM_DB) $(XLIBJVM_DB_G); } ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) # gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set. # Clear the SHF_ALLOC flag (if set) from empty section headers. @@ -137,13 +124,11 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) # implied else here is no stripping at all endif endif - [ -f $(XLIBJVM_DB_G_DEBUGINFO) ] || { cd $(XLIBJVM_DIR) && ln -s $(LIBJVM_DB_DEBUGINFO) $(LIBJVM_DB_G_DEBUGINFO); } ifeq ($(ZIP_DEBUGINFO_FILES),1) # Do this part in the $(XLIBJVM_DIR) subdir so $(XLIBJVM_DIR) is not # in the archived name: - ( cd $(XLIBJVM_DIR) && $(ZIPEXE) -q -y $(LIBJVM_DB_DIZ) $(LIBJVM_DB_DEBUGINFO) $(LIBJVM_DB_G_DEBUGINFO) ) - $(RM) $(XLIBJVM_DB_DEBUGINFO) $(XLIBJVM_DB_G_DEBUGINFO) - [ -f $(XLIBJVM_DB_G_DIZ) ] || { cd $(XLIBJVM_DIR) && ln -s $(LIBJVM_DB_DIZ) $(LIBJVM_DB_G_DIZ); } + ( cd $(XLIBJVM_DIR) && $(ZIPEXE) -q -y $(LIBJVM_DB_DIZ) $(LIBJVM_DB_DEBUGINFO) ) + $(RM) $(XLIBJVM_DB_DEBUGINFO) endif endif @@ -152,7 +137,6 @@ $(XLIBJVM_DTRACE): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCD $(QUIETLY) mkdir -p $(XLIBJVM_DIR) ; \ $(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. \ $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor - [ -f $(XLIBJVM_DTRACE_G) ] || { ln -s $(LIBJVM_DTRACE) $(XLIBJVM_DTRACE_G); } ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) # Clear the SHF_ALLOC flag (if set) from empty section headers. $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@ @@ -170,13 +154,11 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) # implied else here is no stripping at all endif endif - [ -f $(XLIBJVM_DTRACE_G_DEBUGINFO) ] || { cd $(XLIBJVM_DIR) && ln -s $(LIBJVM_DTRACE_DEBUGINFO) $(LIBJVM_DTRACE_G_DEBUGINFO); } ifeq ($(ZIP_DEBUGINFO_FILES),1) # Do this part in the $(XLIBJVM_DIR) subdir so $(XLIBJVM_DIR) is not # in the archived name: - ( cd $(XLIBJVM_DIR) && $(ZIPEXE) -q -y $(LIBJVM_DTRACE_DIZ) $(LIBJVM_DTRACE_DEBUGINFO) $(LIBJVM_DTRACE_G_DEBUGINFO) ) - $(RM) $(XLIBJVM_DTRACE_DEBUGINFO) $(XLIBJVM_DTRACE_G_DEBUGINFO) - [ -f $(XLIBJVM_DTRACE_G_DIZ) ] || { cd $(XLIBJVM_DIR) && ln -s $(LIBJVM_DTRACE_DIZ) $(LIBJVM_DTRACE_G_DIZ); } + ( cd $(XLIBJVM_DIR) && $(ZIPEXE) -q -y $(LIBJVM_DTRACE_DIZ) $(LIBJVM_DTRACE_DEBUGINFO)) + $(RM) $(XLIBJVM_DTRACE_DEBUGINFO) endif endif @@ -224,7 +206,6 @@ $(LIBJVM_DB): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$ @echo Making $@ $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. -I$(GENERATED) \ $(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc - [ -f $(LIBJVM_DB_G) ] || { ln -s $@ $(LIBJVM_DB_G); } ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) # Clear the SHF_ALLOC flag (if set) from empty section headers. $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@ @@ -240,11 +221,9 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) # implied else here is no stripping at all endif endif - [ -f $(LIBJVM_DB_G_DEBUGINFO) ] || { ln -s $(LIBJVM_DB_DEBUGINFO) $(LIBJVM_DB_G_DEBUGINFO); } ifeq ($(ZIP_DEBUGINFO_FILES),1) - $(ZIPEXE) -q -y $(LIBJVM_DB_DIZ) $(LIBJVM_DB_DEBUGINFO) $(LIBJVM_DB_G_DEBUGINFO) - $(RM) $(LIBJVM_DB_DEBUGINFO) $(LIBJVM_DB_G_DEBUGINFO) - [ -f $(LIBJVM_DB_G_DIZ) ] || { ln -s $(LIBJVM_DB_DIZ) $(LIBJVM_DB_G_DIZ); } + $(ZIPEXE) -q -y $(LIBJVM_DB_DIZ) $(LIBJVM_DB_DEBUGINFO) + $(RM) $(LIBJVM_DB_DEBUGINFO) endif endif @@ -252,7 +231,6 @@ $(LIBJVM_DTRACE): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDI @echo Making $@ $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. \ $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor - [ -f $(LIBJVM_DTRACE_G) ] || { ln -s $@ $(LIBJVM_DTRACE_G); } ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) # Clear the SHF_ALLOC flag (if set) from empty section headers. $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@ @@ -268,11 +246,9 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) # implied else here is no stripping at all endif endif - [ -f $(LIBJVM_DTRACE_G_DEBUGINFO) ] || { ln -s $(LIBJVM_DTRACE_DEBUGINFO) $(LIBJVM_DTRACE_G_DEBUGINFO); } ifeq ($(ZIP_DEBUGINFO_FILES),1) - $(ZIPEXE) -q -y $(LIBJVM_DTRACE_DIZ) $(LIBJVM_DTRACE_DEBUGINFO) $(LIBJVM_DTRACE_G_DEBUGINFO) - $(RM) $(LIBJVM_DTRACE_DEBUGINFO) $(LIBJVM_DTRACE_G_DEBUGINFO) - [ -f $(LIBJVM_DTRACE_G_DIZ) ] || { ln -s $(LIBJVM_DTRACE_DIZ) $(LIBJVM_DTRACE_G_DIZ); } + $(ZIPEXE) -q -y $(LIBJVM_DTRACE_DIZ) $(LIBJVM_DTRACE_DEBUGINFO) + $(RM) $(LIBJVM_DTRACE_DEBUGINFO) endif endif diff --git a/hotspot/make/solaris/makefiles/fastdebug.make b/hotspot/make/solaris/makefiles/fastdebug.make index 856b0eddded..fdafd773bd3 100644 --- a/hotspot/make/solaris/makefiles/fastdebug.make +++ b/hotspot/make/solaris/makefiles/fastdebug.make @@ -122,7 +122,6 @@ MAPFILE = $(GAMMADIR)/make/solaris/makefiles/mapfile-vers \ # and mustn't be otherwise. MAPFILE_DTRACE = $(GAMMADIR)/make/solaris/makefiles/mapfile-vers-$(TYPE) -G_SUFFIX = _g VERSION = optimized SYSDEFS += -DASSERT -DFASTDEBUG -DCHECK_UNHANDLED_OOPS PICFLAGS = DEFAULT diff --git a/hotspot/make/solaris/makefiles/gcc.make b/hotspot/make/solaris/makefiles/gcc.make index 8b2be7a7177..66ab8c55d6a 100644 --- a/hotspot/make/solaris/makefiles/gcc.make +++ b/hotspot/make/solaris/makefiles/gcc.make @@ -187,9 +187,9 @@ SHARED_FLAG = -shared # Use the stabs format for debugging information (this is the default # on gcc-2.91). It's good enough, has all the information about line -# numbers and local variables, and libjvm_g.so is only about 16M. +# numbers and local variables, and libjvm.so is only about 16M. # Change this back to "-g" if you want the most expressive format. -# (warning: that could easily inflate libjvm_g.so to 150M!) +# (warning: that could easily inflate libjvm.so to 150M!) # Note: The Itanium gcc compiler crashes when using -gstabs. DEBUG_CFLAGS/ia64 = -g DEBUG_CFLAGS/amd64 = -g diff --git a/hotspot/make/solaris/makefiles/jsig.make b/hotspot/make/solaris/makefiles/jsig.make index 3a7204715ef..59ac98401fc 100644 --- a/hotspot/make/solaris/makefiles/jsig.make +++ b/hotspot/make/solaris/makefiles/jsig.make @@ -24,17 +24,12 @@ # Rules to build signal interposition library, used by vm.make -# libjsig[_g].so: signal interposition library +# libjsig.so: signal interposition library JSIG = jsig LIBJSIG = lib$(JSIG).so -JSIG_G = $(JSIG)$(G_SUFFIX) -LIBJSIG_G = lib$(JSIG_G).so - LIBJSIG_DEBUGINFO = lib$(JSIG).debuginfo LIBJSIG_DIZ = lib$(JSIG).diz -LIBJSIG_G_DEBUGINFO = lib$(JSIG_G).debuginfo -LIBJSIG_G_DIZ = lib$(JSIG_G).diz JSIGSRCDIR = $(GAMMADIR)/src/os/$(Platform_os_family)/vm @@ -56,7 +51,6 @@ $(LIBJSIG): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(JSIGSRCDIR)/jsig.c @echo Making signal interposition lib... $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \ $(LFLAGS_JSIG) -o $@ $(JSIGSRCDIR)/jsig.c -ldl - [ -f $(LIBJSIG_G) ] || { ln -s $@ $(LIBJSIG_G); } ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) # gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set. # Clear the SHF_ALLOC flag (if set) from empty section headers. @@ -77,11 +71,9 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) # implied else here is no stripping at all endif endif - [ -f $(LIBJSIG_G_DEBUGINFO) ] || { ln -s $(LIBJSIG_DEBUGINFO) $(LIBJSIG_G_DEBUGINFO); } ifeq ($(ZIP_DEBUGINFO_FILES),1) - $(ZIPEXE) -q -y $(LIBJSIG_DIZ) $(LIBJSIG_DEBUGINFO) $(LIBJSIG_G_DEBUGINFO) - $(RM) $(LIBJSIG_DEBUGINFO) $(LIBJSIG_G_DEBUGINFO) - [ -f $(LIBJSIG_G_DIZ) ] || { ln -s $(LIBJSIG_DIZ) $(LIBJSIG_G_DIZ); } + $(ZIPEXE) -q -y $(LIBJSIG_DIZ) $(LIBJSIG_DEBUGINFO) + $(RM) $(LIBJSIG_DEBUGINFO) endif endif diff --git a/hotspot/make/solaris/makefiles/jvmg.make b/hotspot/make/solaris/makefiles/jvmg.make index 4605e13ff39..c9102393c8f 100644 --- a/hotspot/make/solaris/makefiles/jvmg.make +++ b/hotspot/make/solaris/makefiles/jvmg.make @@ -51,7 +51,6 @@ MAPFILE = $(GAMMADIR)/make/solaris/makefiles/mapfile-vers \ # and mustn't be otherwise. MAPFILE_DTRACE = $(GAMMADIR)/make/solaris/makefiles/mapfile-vers-$(TYPE) -G_SUFFIX = _g VERSION = debug SYSDEFS += -DASSERT -DDEBUG PICFLAGS = DEFAULT diff --git a/hotspot/make/solaris/makefiles/optimized.make b/hotspot/make/solaris/makefiles/optimized.make index 87716a88be0..08a8c347351 100644 --- a/hotspot/make/solaris/makefiles/optimized.make +++ b/hotspot/make/solaris/makefiles/optimized.make @@ -62,5 +62,4 @@ MAPFILE_DTRACE = $(GAMMADIR)/make/solaris/makefiles/mapfile-vers-$(TYPE) # Set the environment variable HOTSPARC_GENERIC to "true" # to inhibit the effect of the previous line on CFLAGS. -G_SUFFIX = VERSION = optimized diff --git a/hotspot/make/solaris/makefiles/product.make b/hotspot/make/solaris/makefiles/product.make index 76a90536379..0e26cbc82e1 100644 --- a/hotspot/make/solaris/makefiles/product.make +++ b/hotspot/make/solaris/makefiles/product.make @@ -78,6 +78,5 @@ endif # and this macro is not used. # LINK_LIB.CXX/POST_HOOK += $(STRIP_LIB.CXX/POST_HOOK) -G_SUFFIX = SYSDEFS += -DPRODUCT VERSION = optimized diff --git a/hotspot/make/solaris/makefiles/saproc.make b/hotspot/make/solaris/makefiles/saproc.make index 9e237615225..822735a5112 100644 --- a/hotspot/make/solaris/makefiles/saproc.make +++ b/hotspot/make/solaris/makefiles/saproc.make @@ -24,20 +24,15 @@ # Rules to build serviceability agent library, used by vm.make -# libsaproc[_g].so: serviceability agent +# libsaproc.so: serviceability agent SAPROC = saproc SADIS = sadis LIBSAPROC = lib$(SAPROC).so SADISOBJ = $(SADIS).o -SAPROC_G = $(SAPROC)$(G_SUFFIX) -LIBSAPROC_G = lib$(SAPROC_G).so - LIBSAPROC_DEBUGINFO = lib$(SAPROC).debuginfo LIBSAPROC_DIZ = lib$(SAPROC).diz -LIBSAPROC_G_DEBUGINFO = lib$(SAPROC_G).debuginfo -LIBSAPROC_G_DIZ = lib$(SAPROC_G).diz AGENT_DIR = $(GAMMADIR)/agent @@ -113,7 +108,6 @@ $(LIBSAPROC): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(SASRCFILES) $(SA $(SA_LFLAGS) \ -o $@ \ -ldl -ldemangle -lthread -lc - [ -f $(LIBSAPROC_G) ] || { ln -s $@ $(LIBSAPROC_G); } $(SADISOBJ): $(SADISSRCFILES) $(QUIETLY) $(CC) \ @@ -146,11 +140,9 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) # implied else here is no stripping at all endif endif - [ -f $(LIBSAPROC_G_DEBUGINFO) ] || { ln -s $(LIBSAPROC_DEBUGINFO) $(LIBSAPROC_G_DEBUGINFO); } ifeq ($(ZIP_DEBUGINFO_FILES),1) - $(ZIPEXE) -q -y $(LIBSAPROC_DIZ) $(LIBSAPROC_DEBUGINFO) $(LIBSAPROC_G_DEBUGINFO) - $(RM) $(LIBSAPROC_DEBUGINFO) $(LIBSAPROC_G_DEBUGINFO) - [ -f $(LIBSAPROC_G_DIZ) ] || { ln -s $(LIBSAPROC_DIZ) $(LIBSAPROC_G_DIZ); } + $(ZIPEXE) -q -y $(LIBSAPROC_DIZ) $(LIBSAPROC_DEBUGINFO) + $(RM) $(LIBSAPROC_DEBUGINFO) endif endif diff --git a/hotspot/make/solaris/makefiles/vm.make b/hotspot/make/solaris/makefiles/vm.make index d91cba35131..4a59e5ba638 100644 --- a/hotspot/make/solaris/makefiles/vm.make +++ b/hotspot/make/solaris/makefiles/vm.make @@ -157,12 +157,9 @@ include $(MAKEFILES_DIR)/fix_empty_sec_hdr_flags.make JVM = jvm LIBJVM = lib$(JVM).so -LIBJVM_G = lib$(JVM)$(G_SUFFIX).so LIBJVM_DEBUGINFO = lib$(JVM).debuginfo LIBJVM_DIZ = lib$(JVM).diz -LIBJVM_G_DEBUGINFO = lib$(JVM)$(G_SUFFIX).debuginfo -LIBJVM_G_DIZ = lib$(JVM)$(G_SUFFIX).diz SPECIAL_PATHS:=adlc c1 dist gc_implementation opto shark libadt @@ -291,8 +288,6 @@ ifeq ($(filter -sbfast -xsbfast, $(CFLAGS_BROWSE)),) $(QUIETLY) $(LINK_VM) $(LFLAGS_VM) -o $@ $(sort $(LIBJVM.o)) $(LIBS_VM) $(QUIETLY) $(LINK_LIB.CXX/POST_HOOK) $(QUIETLY) rm -f $@.1 && ln -s $@ $@.1 - $(QUIETLY) [ -f $(LIBJVM_G) ] || ln -s $@ $(LIBJVM_G) - $(QUIETLY) [ -f $(LIBJVM_G).1 ] || ln -s $@.1 $(LIBJVM_G).1 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) # gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set. # Clear the SHF_ALLOC flag (if set) from empty section headers. @@ -313,11 +308,9 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) # implied else here is no stripping at all endif endif - $(QUIETLY) [ -f $(LIBJVM_G_DEBUGINFO) ] || ln -s $(LIBJVM_DEBUGINFO) $(LIBJVM_G_DEBUGINFO) ifeq ($(ZIP_DEBUGINFO_FILES),1) - $(ZIPEXE) -q -y $(LIBJVM_DIZ) $(LIBJVM_DEBUGINFO) $(LIBJVM_G_DEBUGINFO) - $(RM) $(LIBJVM_DEBUGINFO) $(LIBJVM_G_DEBUGINFO) - [ -f $(LIBJVM_G_DIZ) ] || { ln -s $(LIBJVM_DIZ) $(LIBJVM_G_DIZ); } + $(ZIPEXE) -q -y $(LIBJVM_DIZ) $(LIBJVM_DEBUGINFO) + $(RM) $(LIBJVM_DEBUGINFO) endif endif endif # filter -sbfast -xsbfast diff --git a/hotspot/make/windows/build.make b/hotspot/make/windows/build.make index c215d595d98..8a53ee5d4b1 100644 --- a/hotspot/make/windows/build.make +++ b/hotspot/make/windows/build.make @@ -33,7 +33,7 @@ # SA components are built if BUILD_WIN_SA=1 is specified. # See notes in README. This produces files: # 1. sa-jdi.jar - This is built before building jvm.dll -# 2. sawindbg[_g].dll - Native library for SA - This is built after jvm.dll +# 2. sawindbg.dll - Native library for SA - This is built after jvm.dll # - Also, .lib, .map, .pdb. # # Please refer to ./makefiles/sa.make @@ -115,7 +115,7 @@ VARIANT_TEXT=Kernel !endif ######################################################################### -# Parameters for VERSIONINFO resource for jvm[_g].dll. +# Parameters for VERSIONINFO resource for jvm.dll. # These can be overridden via the nmake.exe command line. # They are overridden by RE during the control builds. # @@ -225,11 +225,6 @@ checkSA:: ######################################################################### -# With the jvm_g.dll now being named jvm.dll, we can't build both and place -# the dll's in the same directory, so we only build one at a time, -# re-directing the output to different output directories (done by user -# of this makefile). -# defaultTarget: product # The product or release build is an optimized build, and is the default diff --git a/hotspot/make/windows/projectfiles/compiler2/ADLCompiler.dsp b/hotspot/make/windows/projectfiles/compiler2/ADLCompiler.dsp index 8b524da4ce5..a93b8c46eca 100644 --- a/hotspot/make/windows/projectfiles/compiler2/ADLCompiler.dsp +++ b/hotspot/make/windows/projectfiles/compiler2/ADLCompiler.dsp @@ -72,11 +72,11 @@ LINK32=link.exe # ADD RSC /l 0x409 BSC32=bscmake.exe # ADD BASE BSC32 /nologo -# ADD BSC32 /o".\adlc\Debug\adlc_g.bsc" +# ADD BSC32 /o".\adlc\Debug\adlc.bsc" # SUBTRACT BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386 /out:".\bin\adlc_g.exe" +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386 /out:".\bin\adlc.exe" !ENDIF diff --git a/hotspot/make/windows/projectfiles/tiered/ADLCompiler.dsp b/hotspot/make/windows/projectfiles/tiered/ADLCompiler.dsp index 8b524da4ce5..a93b8c46eca 100644 --- a/hotspot/make/windows/projectfiles/tiered/ADLCompiler.dsp +++ b/hotspot/make/windows/projectfiles/tiered/ADLCompiler.dsp @@ -72,11 +72,11 @@ LINK32=link.exe # ADD RSC /l 0x409 BSC32=bscmake.exe # ADD BASE BSC32 /nologo -# ADD BSC32 /o".\adlc\Debug\adlc_g.bsc" +# ADD BSC32 /o".\adlc\Debug\adlc.bsc" # SUBTRACT BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386 /out:".\bin\adlc_g.exe" +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386 /out:".\bin\adlc.exe" !ENDIF diff --git a/hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp b/hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp index 30a8983f9eb..fa5ce4fa6be 100644 --- a/hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp @@ -298,7 +298,7 @@ void PatchingStub::emit_code(LIR_Assembler* ce) { for (int i = 0; i < _bytes_to_copy; i++) { address ptr = (address)(_pc_start + i); int a_byte = (*ptr) & 0xFF; - __ a_byte (a_byte); + __ emit_int8 (a_byte); } } @@ -340,10 +340,10 @@ void PatchingStub::emit_code(LIR_Assembler* ce) { int being_initialized_entry_offset = __ offset() - being_initialized_entry + sizeof_patch_record; // Emit the patch record. We need to emit a full word, so emit an extra empty byte - __ a_byte(0); - __ a_byte(being_initialized_entry_offset); - __ a_byte(bytes_to_skip); - __ a_byte(_bytes_to_copy); + __ emit_int8(0); + __ emit_int8(being_initialized_entry_offset); + __ emit_int8(bytes_to_skip); + __ emit_int8(_bytes_to_copy); address patch_info_pc = __ pc(); assert(patch_info_pc - end_of_patch == bytes_to_skip, "incorrect patch info"); diff --git a/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp b/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp index eacb4d3fd66..7031597b6cf 100644 --- a/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp @@ -582,7 +582,9 @@ address InterpreterGenerator::generate_native_entry(bool synchronized) { // the following temporary registers are used during frame creation const Register Gtmp1 = G3_scratch ; const Register Gtmp2 = G1_scratch; - const Address size_of_parameters(G5_method, 0, in_bytes(Method::size_of_parameters_offset())); + const Register RconstMethod = Gtmp1; + const Address constMethod(G5_method, 0, in_bytes(Method::const_offset())); + const Address size_of_parameters(RconstMethod, 0, in_bytes(ConstMethod::size_of_parameters_offset())); bool inc_counter = UseCompiler || CountCompiledCalls; @@ -618,6 +620,7 @@ address InterpreterGenerator::generate_native_entry(bool synchronized) { } #endif // ASSERT + __ ld_ptr(constMethod, RconstMethod); __ lduh(size_of_parameters, Gtmp1); __ sll(Gtmp1, LogBytesPerWord, Gtmp2); // parameter size in bytes __ add(Gargs, Gtmp2, Gargs); // points to first local + BytesPerWord @@ -1047,8 +1050,6 @@ void CppInterpreterGenerator::generate_compute_interpreter_state(const Register const Register Gtmp = G3_scratch; const Address constMethod (G5_method, 0, in_bytes(Method::const_offset())); const Address access_flags (G5_method, 0, in_bytes(Method::access_flags_offset())); - const Address size_of_parameters(G5_method, 0, in_bytes(Method::size_of_parameters_offset())); - const Address size_of_locals (G5_method, 0, in_bytes(Method::size_of_locals_offset())); // slop factor is two extra slots on the expression stack so that // we always have room to store a result when returning from a call without parameters @@ -1066,6 +1067,9 @@ void CppInterpreterGenerator::generate_compute_interpreter_state(const Register // Now compute new frame size if (native) { + const Register RconstMethod = Gtmp; + const Address size_of_parameters(RconstMethod, 0, in_bytes(ConstMethod::size_of_parameters_offset())); + __ ld_ptr(constMethod, RconstMethod); __ lduh( size_of_parameters, Gtmp ); __ calc_mem_param_words(Gtmp, Gtmp); // space for native call parameters passed on the stack in words } else { @@ -1236,9 +1240,13 @@ void CppInterpreterGenerator::generate_compute_interpreter_state(const Register } if (init_value != noreg) { Label clear_loop; + const Register RconstMethod = O1; + const Address size_of_parameters(RconstMethod, 0, in_bytes(ConstMethod::size_of_parameters_offset())); + const Address size_of_locals (RconstMethod, 0, in_bytes(ConstMethod::size_of_locals_offset())); // NOTE: If you change the frame layout, this code will need to // be updated! + __ ld_ptr( constMethod, RconstMethod ); __ lduh( size_of_locals, O2 ); __ lduh( size_of_parameters, O1 ); __ sll( O2, LogBytesPerWord, O2); @@ -1483,13 +1491,16 @@ void CppInterpreterGenerator::adjust_callers_stack(Register args) { // // assert_different_registers(state, prev_state); const Register Gtmp = G3_scratch; + const RconstMethod = G3_scratch; const Register tmp = O2; - const Address size_of_parameters(G5_method, 0, in_bytes(Method::size_of_parameters_offset())); - const Address size_of_locals (G5_method, 0, in_bytes(Method::size_of_locals_offset())); + const Address constMethod(G5_method, 0, in_bytes(Method::const_offset())); + const Address size_of_parameters(RconstMethod, 0, in_bytes(ConstMethod::size_of_parameters_offset())); + const Address size_of_locals (RconstMethod, 0, in_bytes(ConstMethod::size_of_locals_offset())); + __ ld_ptr(constMethod, RconstMethod); __ lduh(size_of_parameters, tmp); - __ sll(tmp, LogBytesPerWord, Gtmp); // parameter size in bytes - __ add(args, Gtmp, Gargs); // points to first local + BytesPerWord + __ sll(tmp, LogBytesPerWord, Gargs); // parameter size in bytes + __ add(args, Gargs, Gargs); // points to first local + BytesPerWord // NEW __ add(Gargs, -wordSize, Gargs); // points to first local[0] // determine extra space for non-argument locals & adjust caller's SP @@ -1541,8 +1552,6 @@ address InterpreterGenerator::generate_normal_entry(bool synchronized) { const Address constMethod (G5_method, 0, in_bytes(Method::const_offset())); const Address access_flags (G5_method, 0, in_bytes(Method::access_flags_offset())); - const Address size_of_parameters(G5_method, 0, in_bytes(Method::size_of_parameters_offset())); - const Address size_of_locals (G5_method, 0, in_bytes(Method::size_of_locals_offset())); address entry_point = __ pc(); __ mov(G0, prevState); // no current activation @@ -1750,7 +1759,9 @@ address InterpreterGenerator::generate_normal_entry(bool synchronized) { __ ld_ptr(STATE(_result._to_call._callee), L4_scratch); // called method __ ld_ptr(STATE(_stack), L1_scratch); // get top of java expr stack - __ lduh(L4_scratch, in_bytes(Method::size_of_parameters_offset()), L2_scratch); // get parameter size + // get parameter size + __ ld_ptr(L4_scratch, in_bytes(Method::const_offset()), L2_scratch); + __ lduh(L2_scratch, in_bytes(ConstMethod::size_of_parameters_offset()), L2_scratch); __ sll(L2_scratch, LogBytesPerWord, L2_scratch ); // parameter size in bytes __ add(L1_scratch, L2_scratch, L1_scratch); // stack destination for result __ ld(L4_scratch, in_bytes(Method::result_index_offset()), L3_scratch); // called method result type index diff --git a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp index 2801a35a10d..ac56573e766 100644 --- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp @@ -100,34 +100,6 @@ const char* Argument::name() const { bool AbstractAssembler::pd_check_instruction_mark() { return false; } #endif - -void MacroAssembler::print_instruction(int inst) { - const char* s; - switch (inv_op(inst)) { - default: s = "????"; break; - case call_op: s = "call"; break; - case branch_op: - switch (inv_op2(inst)) { - case fb_op2: s = "fb"; break; - case fbp_op2: s = "fbp"; break; - case br_op2: s = "br"; break; - case bp_op2: s = "bp"; break; - case cb_op2: s = "cb"; break; - case bpr_op2: { - if (is_cbcond(inst)) { - s = is_cxb(inst) ? "cxb" : "cwb"; - } else { - s = "bpr"; - } - break; - } - default: s = "????"; break; - } - } - ::tty->print("%s", s); -} - - // Patch instruction inst at offset inst_pos to refer to dest_pos // and return the resulting instruction. // We should have pcs, not offsets, but since all is relative, it will work out diff --git a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.hpp b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.hpp index 1e1e6de9e47..dffef7e794b 100644 --- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.hpp +++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.hpp @@ -603,7 +603,6 @@ class MacroAssembler : public Assembler { friend class Label; protected: - static void print_instruction(int inst); static int patched_branch(int dest_pos, int inst, int inst_pos); static int branch_destination(int inst, int pos); @@ -759,9 +758,6 @@ class MacroAssembler : public Assembler { // Required platform-specific helpers for Label::patch_instructions. // They _shadow_ the declarations in AbstractAssembler, which are undefined. void pd_patch_instruction(address branch, address target); -#ifndef PRODUCT - static void pd_print_patched_instruction(address branch); -#endif // sethi Macro handles optimizations and relocations private: diff --git a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.inline.hpp b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.inline.hpp index e9bdaea79ad..871853c684d 100644 --- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.inline.hpp +++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.inline.hpp @@ -43,14 +43,6 @@ inline void MacroAssembler::pd_patch_instruction(address branch, address target) stub_inst = patched_branch(target - branch, stub_inst, 0); } -#ifndef PRODUCT -inline void MacroAssembler::pd_print_patched_instruction(address branch) { - jint stub_inst = *(jint*) branch; - print_instruction(stub_inst); - ::tty->print("%s", " (unresolved)"); -} -#endif // PRODUCT - // Use the right loads/stores for the platform inline void MacroAssembler::ld_ptr( Register s1, Register s2, Register d ) { #ifdef _LP64 diff --git a/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp b/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp index f4637bf76de..546cfaf08f1 100644 --- a/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp @@ -171,7 +171,8 @@ void MethodHandles::jump_to_lambda_form(MacroAssembler* _masm, if (VerifyMethodHandles && !for_compiler_entry) { // make sure recv is already on stack - __ load_sized_value(Address(method_temp, Method::size_of_parameters_offset()), + __ ld_ptr(method_temp, in_bytes(Method::const_offset()), temp2); + __ load_sized_value(Address(temp2, ConstMethod::size_of_parameters_offset()), temp2, sizeof(u2), /*is_signed*/ false); // assert(sizeof(u2) == sizeof(Method::_size_of_parameters), ""); @@ -233,7 +234,8 @@ address MethodHandles::generate_method_handle_interpreter_entry(MacroAssembler* int ref_kind = signature_polymorphic_intrinsic_ref_kind(iid); assert(ref_kind != 0 || iid == vmIntrinsics::_invokeBasic, "must be _invokeBasic or a linkTo intrinsic"); if (ref_kind == 0 || MethodHandles::ref_kind_has_receiver(ref_kind)) { - __ load_sized_value(Address(G5_method, Method::size_of_parameters_offset()), + __ ld_ptr(G5_method, in_bytes(Method::const_offset()), O4_param_size); + __ load_sized_value(Address(O4_param_size, ConstMethod::size_of_parameters_offset()), O4_param_size, sizeof(u2), /*is_signed*/ false); // assert(sizeof(u2) == sizeof(Method::_size_of_parameters), ""); diff --git a/hotspot/src/cpu/sparc/vm/sparc.ad b/hotspot/src/cpu/sparc/vm/sparc.ad index b7029faa604..96accce0256 100644 --- a/hotspot/src/cpu/sparc/vm/sparc.ad +++ b/hotspot/src/cpu/sparc/vm/sparc.ad @@ -10224,7 +10224,7 @@ instruct array_equals(o0RegP ary1, o1RegP ary2, g3RegI tmp1, notemp_iRegI result //---------- Zeros Count Instructions ------------------------------------------ -instruct countLeadingZerosI(iRegI dst, iRegI src, iRegI tmp, flagsReg cr) %{ +instruct countLeadingZerosI(iRegIsafe dst, iRegI src, iRegI tmp, flagsReg cr) %{ predicate(UsePopCountInstruction); // See Matcher::match_rule_supported match(Set dst (CountLeadingZerosI src)); effect(TEMP dst, TEMP tmp, KILL cr); @@ -10321,7 +10321,7 @@ instruct countLeadingZerosL(iRegIsafe dst, iRegL src, iRegL tmp, flagsReg cr) %{ ins_pipe(ialu_reg); %} -instruct countTrailingZerosI(iRegI dst, iRegI src, flagsReg cr) %{ +instruct countTrailingZerosI(iRegIsafe dst, iRegI src, flagsReg cr) %{ predicate(UsePopCountInstruction); // See Matcher::match_rule_supported match(Set dst (CountTrailingZerosI src)); effect(TEMP dst, KILL cr); @@ -10364,19 +10364,21 @@ instruct countTrailingZerosL(iRegIsafe dst, iRegL src, flagsReg cr) %{ //---------- Population Count Instructions ------------------------------------- -instruct popCountI(iRegI dst, iRegI src) %{ +instruct popCountI(iRegIsafe dst, iRegI src) %{ predicate(UsePopCountInstruction); match(Set dst (PopCountI src)); - format %{ "POPC $src, $dst" %} + format %{ "SRL $src, G0, $dst\t! clear upper word for 64 bit POPC\n\t" + "POPC $dst, $dst" %} ins_encode %{ - __ popc($src$$Register, $dst$$Register); + __ srl($src$$Register, G0, $dst$$Register); + __ popc($dst$$Register, $dst$$Register); %} ins_pipe(ialu_reg); %} // Note: Long.bitCount(long) returns an int. -instruct popCountL(iRegI dst, iRegL src) %{ +instruct popCountL(iRegIsafe dst, iRegL src) %{ predicate(UsePopCountInstruction); match(Set dst (PopCountL src)); diff --git a/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp b/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp index 2de866adb07..0827c0b1a9c 100644 --- a/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp @@ -434,7 +434,7 @@ void TemplateInterpreterGenerator::generate_stack_overflow_check(Register Rframe // the frame is greater than one page in size, so check against // the bottom of the stack - __ cmp_and_brx_short(SP, Rscratch, Assembler::greater, Assembler::pt, after_frame_check); + __ cmp_and_brx_short(SP, Rscratch, Assembler::greaterUnsigned, Assembler::pt, after_frame_check); // the stack will overflow, throw an exception @@ -494,9 +494,6 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) { // (gri - 2/25/2000) - const Address size_of_parameters(G5_method, Method::size_of_parameters_offset()); - const Address size_of_locals (G5_method, Method::size_of_locals_offset()); - const Address constMethod (G5_method, Method::const_offset()); int rounded_vm_local_words = round_to( frame::interpreter_frame_vm_local_words, WordsPerLong ); const int extra_space = @@ -506,11 +503,15 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) { (native_call ? frame::interpreter_frame_extra_outgoing_argument_words : 0); const Register Glocals_size = G3; + const Register RconstMethod = Glocals_size; const Register Otmp1 = O3; const Register Otmp2 = O4; // Lscratch can't be used as a temporary because the call_stub uses // it to assert that the stack frame was setup correctly. + const Address constMethod (G5_method, Method::const_offset()); + const Address size_of_parameters(RconstMethod, ConstMethod::size_of_parameters_offset()); + __ ld_ptr( constMethod, RconstMethod ); __ lduh( size_of_parameters, Glocals_size); // Gargs points to first local + BytesPerWord @@ -530,6 +531,8 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) { // // Compute number of locals in method apart from incoming parameters // + const Address size_of_locals (Otmp1, ConstMethod::size_of_locals_offset()); + __ ld_ptr( constMethod, Otmp1 ); __ lduh( size_of_locals, Otmp1 ); __ sub( Otmp1, Glocals_size, Glocals_size ); __ round_to( Glocals_size, WordsPerLong ); @@ -1256,8 +1259,7 @@ address InterpreterGenerator::generate_normal_entry(bool synchronized) { // make sure registers are different! assert_different_registers(G2_thread, G5_method, Gargs, Gtmp1, Gtmp2); - const Address size_of_parameters(G5_method, Method::size_of_parameters_offset()); - const Address size_of_locals (G5_method, Method::size_of_locals_offset()); + const Address constMethod (G5_method, Method::const_offset()); // Seems like G5_method is live at the point this is used. So we could make this look consistent // and use in the asserts. const Address access_flags (Lmethod, Method::access_flags_offset()); @@ -1307,8 +1309,13 @@ address InterpreterGenerator::generate_normal_entry(bool synchronized) { init_value = G0; Label clear_loop; + const Register RconstMethod = O1; + const Address size_of_parameters(RconstMethod, ConstMethod::size_of_parameters_offset()); + const Address size_of_locals (RconstMethod, ConstMethod::size_of_locals_offset()); + // NOTE: If you change the frame layout, this code will need to // be updated! + __ ld_ptr( constMethod, RconstMethod ); __ lduh( size_of_locals, O2 ); __ lduh( size_of_parameters, O1 ); __ sll( O2, Interpreter::logStackElementSize, O2); @@ -1823,9 +1830,13 @@ void TemplateInterpreterGenerator::generate_throw_exception() { const Register Gtmp1 = G3_scratch; const Register Gtmp2 = G1_scratch; + const Register RconstMethod = Gtmp1; + const Address constMethod(Lmethod, Method::const_offset()); + const Address size_of_parameters(RconstMethod, ConstMethod::size_of_parameters_offset()); // Compute size of arguments for saving when returning to deoptimized caller - __ lduh(Lmethod, in_bytes(Method::size_of_parameters_offset()), Gtmp1); + __ ld_ptr(constMethod, RconstMethod); + __ lduh(size_of_parameters, Gtmp1); __ sll(Gtmp1, Interpreter::logStackElementSize, Gtmp1); __ sub(Llocals, Gtmp1, Gtmp2); __ add(Gtmp2, wordSize, Gtmp2); diff --git a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp index 5b1887dbbca..931342ded12 100644 --- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp @@ -3040,7 +3040,8 @@ void TemplateTable::invokevfinal_helper(Register Rscratch, Register Rret) { Register Rtemp = G4_scratch; // Load receiver from stack slot - __ lduh(G5_method, in_bytes(Method::size_of_parameters_offset()), G4_scratch); + __ ld_ptr(G5_method, in_bytes(Method::const_offset()), G4_scratch); + __ lduh(G4_scratch, in_bytes(ConstMethod::size_of_parameters_offset()), G4_scratch); __ load_receiver(G4_scratch, O0); // receiver NULL check diff --git a/hotspot/src/cpu/x86/vm/assembler_x86.cpp b/hotspot/src/cpu/x86/vm/assembler_x86.cpp index 0a51534ed24..6f97f963084 100644 --- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp +++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp @@ -226,9 +226,9 @@ void Assembler::emit_arith_b(int op1, int op2, Register dst, int imm8) { assert(isByte(op1) && isByte(op2), "wrong opcode"); assert(isByte(imm8), "not a byte"); assert((op1 & 0x01) == 0, "should be 8bit operation"); - emit_byte(op1); - emit_byte(op2 | encode(dst)); - emit_byte(imm8); + emit_int8(op1); + emit_int8(op2 | encode(dst)); + emit_int8(imm8); } @@ -237,12 +237,12 @@ void Assembler::emit_arith(int op1, int op2, Register dst, int32_t imm32) { assert((op1 & 0x01) == 1, "should be 32bit operation"); assert((op1 & 0x02) == 0, "sign-extension bit should not be set"); if (is8bit(imm32)) { - emit_byte(op1 | 0x02); // set sign bit - emit_byte(op2 | encode(dst)); - emit_byte(imm32 & 0xFF); + emit_int8(op1 | 0x02); // set sign bit + emit_int8(op2 | encode(dst)); + emit_int8(imm32 & 0xFF); } else { - emit_byte(op1); - emit_byte(op2 | encode(dst)); + emit_int8(op1); + emit_int8(op2 | encode(dst)); emit_long(imm32); } } @@ -252,8 +252,8 @@ void Assembler::emit_arith_imm32(int op1, int op2, Register dst, int32_t imm32) assert(isByte(op1) && isByte(op2), "wrong opcode"); assert((op1 & 0x01) == 1, "should be 32bit operation"); assert((op1 & 0x02) == 0, "sign-extension bit should not be set"); - emit_byte(op1); - emit_byte(op2 | encode(dst)); + emit_int8(op1); + emit_int8(op2 | encode(dst)); emit_long(imm32); } @@ -262,11 +262,11 @@ void Assembler::emit_arith_operand(int op1, Register rm, Address adr, int32_t im assert((op1 & 0x01) == 1, "should be 32bit operation"); assert((op1 & 0x02) == 0, "sign-extension bit should not be set"); if (is8bit(imm32)) { - emit_byte(op1 | 0x02); // set sign bit + emit_int8(op1 | 0x02); // set sign bit emit_operand(rm, adr, 1); - emit_byte(imm32 & 0xFF); + emit_int8(imm32 & 0xFF); } else { - emit_byte(op1); + emit_int8(op1); emit_operand(rm, adr, 4); emit_long(imm32); } @@ -275,8 +275,8 @@ void Assembler::emit_arith_operand(int op1, Register rm, Address adr, int32_t im void Assembler::emit_arith(int op1, int op2, Register dst, Register src) { assert(isByte(op1) && isByte(op2), "wrong opcode"); - emit_byte(op1); - emit_byte(op2 | encode(dst) << 3 | encode(src)); + emit_int8(op1); + emit_int8(op2 | encode(dst) << 3 | encode(src)); } @@ -301,21 +301,21 @@ void Assembler::emit_operand(Register reg, Register base, Register index, // [base + index*scale] // [00 reg 100][ss index base] assert(index != rsp, "illegal addressing mode"); - emit_byte(0x04 | regenc); - emit_byte(scale << 6 | indexenc | baseenc); + emit_int8(0x04 | regenc); + emit_int8(scale << 6 | indexenc | baseenc); } else if (is8bit(disp) && rtype == relocInfo::none) { // [base + index*scale + imm8] // [01 reg 100][ss index base] imm8 assert(index != rsp, "illegal addressing mode"); - emit_byte(0x44 | regenc); - emit_byte(scale << 6 | indexenc | baseenc); - emit_byte(disp & 0xFF); + emit_int8(0x44 | regenc); + emit_int8(scale << 6 | indexenc | baseenc); + emit_int8(disp & 0xFF); } else { // [base + index*scale + disp32] // [10 reg 100][ss index base] disp32 assert(index != rsp, "illegal addressing mode"); - emit_byte(0x84 | regenc); - emit_byte(scale << 6 | indexenc | baseenc); + emit_int8(0x84 | regenc); + emit_int8(scale << 6 | indexenc | baseenc); emit_data(disp, rspec, disp32_operand); } } else if (base == rsp LP64_ONLY(|| base == r12)) { @@ -323,19 +323,19 @@ void Assembler::emit_operand(Register reg, Register base, Register index, if (disp == 0 && rtype == relocInfo::none) { // [rsp] // [00 reg 100][00 100 100] - emit_byte(0x04 | regenc); - emit_byte(0x24); + emit_int8(0x04 | regenc); + emit_int8(0x24); } else if (is8bit(disp) && rtype == relocInfo::none) { // [rsp + imm8] // [01 reg 100][00 100 100] disp8 - emit_byte(0x44 | regenc); - emit_byte(0x24); - emit_byte(disp & 0xFF); + emit_int8(0x44 | regenc); + emit_int8(0x24); + emit_int8(disp & 0xFF); } else { // [rsp + imm32] // [10 reg 100][00 100 100] disp32 - emit_byte(0x84 | regenc); - emit_byte(0x24); + emit_int8(0x84 | regenc); + emit_int8(0x24); emit_data(disp, rspec, disp32_operand); } } else { @@ -345,16 +345,16 @@ void Assembler::emit_operand(Register reg, Register base, Register index, base != rbp LP64_ONLY(&& base != r13)) { // [base] // [00 reg base] - emit_byte(0x00 | regenc | baseenc); + emit_int8(0x00 | regenc | baseenc); } else if (is8bit(disp) && rtype == relocInfo::none) { // [base + disp8] // [01 reg base] disp8 - emit_byte(0x40 | regenc | baseenc); - emit_byte(disp & 0xFF); + emit_int8(0x40 | regenc | baseenc); + emit_int8(disp & 0xFF); } else { // [base + disp32] // [10 reg base] disp32 - emit_byte(0x80 | regenc | baseenc); + emit_int8(0x80 | regenc | baseenc); emit_data(disp, rspec, disp32_operand); } } @@ -364,14 +364,14 @@ void Assembler::emit_operand(Register reg, Register base, Register index, // [index*scale + disp] // [00 reg 100][ss index 101] disp32 assert(index != rsp, "illegal addressing mode"); - emit_byte(0x04 | regenc); - emit_byte(scale << 6 | indexenc | 0x05); + emit_int8(0x04 | regenc); + emit_int8(scale << 6 | indexenc | 0x05); emit_data(disp, rspec, disp32_operand); } else if (rtype != relocInfo::none ) { // [disp] (64bit) RIP-RELATIVE (32bit) abs // [00 000 101] disp32 - emit_byte(0x05 | regenc); + emit_int8(0x05 | regenc); // Note that the RIP-rel. correction applies to the generated // disp field, but _not_ to the target address in the rspec. @@ -391,8 +391,8 @@ void Assembler::emit_operand(Register reg, Register base, Register index, // 32bit never did this, did everything as the rip-rel/disp code above // [disp] ABSOLUTE // [00 reg 100][00 100 101] disp32 - emit_byte(0x04 | regenc); - emit_byte(0x25); + emit_int8(0x04 | regenc); + emit_int8(0x25); emit_data(disp, rspec, disp32_operand); } } @@ -883,8 +883,8 @@ void Assembler::emit_operand(Address adr, MMXRegister reg) { void Assembler::emit_farith(int b1, int b2, int i) { assert(isByte(b1) && isByte(b2), "wrong opcode"); assert(0 <= i && i < 8, "illegal stack offset"); - emit_byte(b1); - emit_byte(b2 + i); + emit_int8(b1); + emit_int8(b2 + i); } @@ -899,7 +899,7 @@ void Assembler::adcl(Address dst, int32_t imm32) { void Assembler::adcl(Address dst, Register src) { InstructionMark im(this); prefix(dst, src); - emit_byte(0x11); + emit_int8(0x11); emit_operand(src, dst); } @@ -911,7 +911,7 @@ void Assembler::adcl(Register dst, int32_t imm32) { void Assembler::adcl(Register dst, Address src) { InstructionMark im(this); prefix(src, dst); - emit_byte(0x13); + emit_int8(0x13); emit_operand(dst, src); } @@ -929,7 +929,7 @@ void Assembler::addl(Address dst, int32_t imm32) { void Assembler::addl(Address dst, Register src) { InstructionMark im(this); prefix(dst, src); - emit_byte(0x01); + emit_int8(0x01); emit_operand(src, dst); } @@ -941,7 +941,7 @@ void Assembler::addl(Register dst, int32_t imm32) { void Assembler::addl(Register dst, Address src) { InstructionMark im(this); prefix(src, dst); - emit_byte(0x03); + emit_int8(0x03); emit_operand(dst, src); } @@ -953,38 +953,40 @@ void Assembler::addl(Register dst, Register src) { void Assembler::addr_nop_4() { assert(UseAddressNop, "no CPU support"); // 4 bytes: NOP DWORD PTR [EAX+0] - emit_byte(0x0F); - emit_byte(0x1F); - emit_byte(0x40); // emit_rm(cbuf, 0x1, EAX_enc, EAX_enc); - emit_byte(0); // 8-bits offset (1 byte) + emit_int8(0x0F); + emit_int8(0x1F); + emit_int8(0x40); // emit_rm(cbuf, 0x1, EAX_enc, EAX_enc); + emit_int8(0); // 8-bits offset (1 byte) } void Assembler::addr_nop_5() { assert(UseAddressNop, "no CPU support"); // 5 bytes: NOP DWORD PTR [EAX+EAX*0+0] 8-bits offset - emit_byte(0x0F); - emit_byte(0x1F); - emit_byte(0x44); // emit_rm(cbuf, 0x1, EAX_enc, 0x4); - emit_byte(0x00); // emit_rm(cbuf, 0x0, EAX_enc, EAX_enc); - emit_byte(0); // 8-bits offset (1 byte) + emit_int8(0x0F); + emit_int8(0x1F); + emit_int8(0x44); // emit_rm(cbuf, 0x1, EAX_enc, 0x4); + emit_int8(0x00); // emit_rm(cbuf, 0x0, EAX_enc, EAX_enc); + emit_int8(0); // 8-bits offset (1 byte) } void Assembler::addr_nop_7() { assert(UseAddressNop, "no CPU support"); // 7 bytes: NOP DWORD PTR [EAX+0] 32-bits offset - emit_byte(0x0F); - emit_byte(0x1F); - emit_byte(0x80); // emit_rm(cbuf, 0x2, EAX_enc, EAX_enc); + emit_int8(0x0F); + emit_int8(0x1F); + emit_int8((unsigned char)0x80); + // emit_rm(cbuf, 0x2, EAX_enc, EAX_enc); emit_long(0); // 32-bits offset (4 bytes) } void Assembler::addr_nop_8() { assert(UseAddressNop, "no CPU support"); // 8 bytes: NOP DWORD PTR [EAX+EAX*0+0] 32-bits offset - emit_byte(0x0F); - emit_byte(0x1F); - emit_byte(0x84); // emit_rm(cbuf, 0x2, EAX_enc, 0x4); - emit_byte(0x00); // emit_rm(cbuf, 0x0, EAX_enc, EAX_enc); + emit_int8(0x0F); + emit_int8(0x1F); + emit_int8((unsigned char)0x84); + // emit_rm(cbuf, 0x2, EAX_enc, 0x4); + emit_int8(0x00); // emit_rm(cbuf, 0x0, EAX_enc, EAX_enc); emit_long(0); // 32-bits offset (4 bytes) } @@ -1012,67 +1014,67 @@ void Assembler::aesdec(XMMRegister dst, Address src) { assert(VM_Version::supports_aes(), ""); InstructionMark im(this); simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38); - emit_byte(0xde); + emit_int8((unsigned char)0xDE); emit_operand(dst, src); } void Assembler::aesdec(XMMRegister dst, XMMRegister src) { assert(VM_Version::supports_aes(), ""); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38); - emit_byte(0xde); - emit_byte(0xC0 | encode); + emit_int8((unsigned char)0xDE); + emit_int8(0xC0 | encode); } void Assembler::aesdeclast(XMMRegister dst, Address src) { assert(VM_Version::supports_aes(), ""); InstructionMark im(this); simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38); - emit_byte(0xdf); + emit_int8((unsigned char)0xDF); emit_operand(dst, src); } void Assembler::aesdeclast(XMMRegister dst, XMMRegister src) { assert(VM_Version::supports_aes(), ""); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38); - emit_byte(0xdf); - emit_byte(0xC0 | encode); + emit_int8((unsigned char)0xDF); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::aesenc(XMMRegister dst, Address src) { assert(VM_Version::supports_aes(), ""); InstructionMark im(this); simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38); - emit_byte(0xdc); + emit_int8((unsigned char)0xDC); emit_operand(dst, src); } void Assembler::aesenc(XMMRegister dst, XMMRegister src) { assert(VM_Version::supports_aes(), ""); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38); - emit_byte(0xdc); - emit_byte(0xC0 | encode); + emit_int8((unsigned char)0xDC); + emit_int8(0xC0 | encode); } void Assembler::aesenclast(XMMRegister dst, Address src) { assert(VM_Version::supports_aes(), ""); InstructionMark im(this); simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38); - emit_byte(0xdd); + emit_int8((unsigned char)0xDD); emit_operand(dst, src); } void Assembler::aesenclast(XMMRegister dst, XMMRegister src) { assert(VM_Version::supports_aes(), ""); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38); - emit_byte(0xdd); - emit_byte(0xC0 | encode); + emit_int8((unsigned char)0xDD); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::andl(Address dst, int32_t imm32) { InstructionMark im(this); prefix(dst); - emit_byte(0x81); + emit_int8((unsigned char)0x81); emit_operand(rsp, dst, 4); emit_long(imm32); } @@ -1085,7 +1087,7 @@ void Assembler::andl(Register dst, int32_t imm32) { void Assembler::andl(Register dst, Address src) { InstructionMark im(this); prefix(src, dst); - emit_byte(0x23); + emit_int8(0x23); emit_operand(dst, src); } @@ -1096,23 +1098,23 @@ void Assembler::andl(Register dst, Register src) { void Assembler::bsfl(Register dst, Register src) { int encode = prefix_and_encode(dst->encoding(), src->encoding()); - emit_byte(0x0F); - emit_byte(0xBC); - emit_byte(0xC0 | encode); + emit_int8(0x0F); + emit_int8((unsigned char)0xBC); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::bsrl(Register dst, Register src) { assert(!VM_Version::supports_lzcnt(), "encoding is treated as LZCNT"); int encode = prefix_and_encode(dst->encoding(), src->encoding()); - emit_byte(0x0F); - emit_byte(0xBD); - emit_byte(0xC0 | encode); + emit_int8(0x0F); + emit_int8((unsigned char)0xBD); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::bswapl(Register reg) { // bswap int encode = prefix_and_encode(reg->encoding()); - emit_byte(0x0F); - emit_byte(0xC8 | encode); + emit_int8(0x0F); + emit_int8((unsigned char)(0xC8 | encode)); } void Assembler::call(Label& L, relocInfo::relocType rtype) { @@ -1125,36 +1127,36 @@ void Assembler::call(Label& L, relocInfo::relocType rtype) { assert(offs <= 0, "assembler error"); InstructionMark im(this); // 1110 1000 #32-bit disp - emit_byte(0xE8); + emit_int8((unsigned char)0xE8); emit_data(offs - long_size, rtype, operand); } else { InstructionMark im(this); // 1110 1000 #32-bit disp L.add_patch_at(code(), locator()); - emit_byte(0xE8); + emit_int8((unsigned char)0xE8); emit_data(int(0), rtype, operand); } } void Assembler::call(Register dst) { int encode = prefix_and_encode(dst->encoding()); - emit_byte(0xFF); - emit_byte(0xD0 | encode); + emit_int8((unsigned char)0xFF); + emit_int8((unsigned char)(0xD0 | encode)); } void Assembler::call(Address adr) { InstructionMark im(this); prefix(adr); - emit_byte(0xFF); + emit_int8((unsigned char)0xFF); emit_operand(rdx, adr); } void Assembler::call_literal(address entry, RelocationHolder const& rspec) { assert(entry != NULL, "call most probably wrong"); InstructionMark im(this); - emit_byte(0xE8); + emit_int8((unsigned char)0xE8); intptr_t disp = entry - (pc() + sizeof(int32_t)); assert(is_simm32(disp), "must be 32bit offset (call2)"); // Technically, should use call32_operand, but this format is @@ -1165,42 +1167,42 @@ void Assembler::call_literal(address entry, RelocationHolder const& rspec) { } void Assembler::cdql() { - emit_byte(0x99); + emit_int8((unsigned char)0x99); } void Assembler::cld() { - emit_byte(0xfc); + emit_int8((unsigned char)0xFC); } void Assembler::cmovl(Condition cc, Register dst, Register src) { NOT_LP64(guarantee(VM_Version::supports_cmov(), "illegal instruction")); int encode = prefix_and_encode(dst->encoding(), src->encoding()); - emit_byte(0x0F); - emit_byte(0x40 | cc); - emit_byte(0xC0 | encode); + emit_int8(0x0F); + emit_int8(0x40 | cc); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::cmovl(Condition cc, Register dst, Address src) { NOT_LP64(guarantee(VM_Version::supports_cmov(), "illegal instruction")); prefix(src, dst); - emit_byte(0x0F); - emit_byte(0x40 | cc); + emit_int8(0x0F); + emit_int8(0x40 | cc); emit_operand(dst, src); } void Assembler::cmpb(Address dst, int imm8) { InstructionMark im(this); prefix(dst); - emit_byte(0x80); + emit_int8((unsigned char)0x80); emit_operand(rdi, dst, 1); - emit_byte(imm8); + emit_int8(imm8); } void Assembler::cmpl(Address dst, int32_t imm32) { InstructionMark im(this); prefix(dst); - emit_byte(0x81); + emit_int8((unsigned char)0x81); emit_operand(rdi, dst, 4); emit_long(imm32); } @@ -1219,17 +1221,17 @@ void Assembler::cmpl(Register dst, Register src) { void Assembler::cmpl(Register dst, Address src) { InstructionMark im(this); prefix(src, dst); - emit_byte(0x3B); + emit_int8((unsigned char)0x3B); emit_operand(dst, src); } void Assembler::cmpw(Address dst, int imm16) { InstructionMark im(this); assert(!dst.base_needs_rex() && !dst.index_needs_rex(), "no extended registers"); - emit_byte(0x66); - emit_byte(0x81); + emit_int8(0x66); + emit_int8((unsigned char)0x81); emit_operand(rdi, dst, 2); - emit_word(imm16); + emit_int16(imm16); } // The 32-bit cmpxchg compares the value at adr with the contents of rax, @@ -1238,8 +1240,8 @@ void Assembler::cmpw(Address dst, int imm16) { void Assembler::cmpxchgl(Register reg, Address adr) { // cmpxchg InstructionMark im(this); prefix(adr, reg); - emit_byte(0x0F); - emit_byte(0xB1); + emit_int8(0x0F); + emit_int8((unsigned char)0xB1); emit_operand(reg, adr); } @@ -1266,8 +1268,8 @@ void Assembler::comiss(XMMRegister dst, XMMRegister src) { } void Assembler::cpuid() { - emit_byte(0x0F); - emit_byte(0xA2); + emit_int8(0x0F); + emit_int8((unsigned char)0xA2); } void Assembler::cvtdq2pd(XMMRegister dst, XMMRegister src) { @@ -1293,8 +1295,8 @@ void Assembler::cvtsd2ss(XMMRegister dst, Address src) { void Assembler::cvtsi2sdl(XMMRegister dst, Register src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_F2); - emit_byte(0x2A); - emit_byte(0xC0 | encode); + emit_int8(0x2A); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::cvtsi2sdl(XMMRegister dst, Address src) { @@ -1305,8 +1307,8 @@ void Assembler::cvtsi2sdl(XMMRegister dst, Address src) { void Assembler::cvtsi2ssl(XMMRegister dst, Register src) { NOT_LP64(assert(VM_Version::supports_sse(), "")); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_F3); - emit_byte(0x2A); - emit_byte(0xC0 | encode); + emit_int8(0x2A); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::cvtsi2ssl(XMMRegister dst, Address src) { @@ -1328,22 +1330,22 @@ void Assembler::cvtss2sd(XMMRegister dst, Address src) { void Assembler::cvttsd2sil(Register dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); int encode = simd_prefix_and_encode(dst, src, VEX_SIMD_F2); - emit_byte(0x2C); - emit_byte(0xC0 | encode); + emit_int8(0x2C); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::cvttss2sil(Register dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse(), "")); int encode = simd_prefix_and_encode(dst, src, VEX_SIMD_F3); - emit_byte(0x2C); - emit_byte(0xC0 | encode); + emit_int8(0x2C); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::decl(Address dst) { // Don't use it directly. Use MacroAssembler::decrement() instead. InstructionMark im(this); prefix(dst); - emit_byte(0xFF); + emit_int8((unsigned char)0xFF); emit_operand(rcx, dst); } @@ -1369,43 +1371,43 @@ void Assembler::divss(XMMRegister dst, XMMRegister src) { void Assembler::emms() { NOT_LP64(assert(VM_Version::supports_mmx(), "")); - emit_byte(0x0F); - emit_byte(0x77); + emit_int8(0x0F); + emit_int8(0x77); } void Assembler::hlt() { - emit_byte(0xF4); + emit_int8((unsigned char)0xF4); } void Assembler::idivl(Register src) { int encode = prefix_and_encode(src->encoding()); - emit_byte(0xF7); - emit_byte(0xF8 | encode); + emit_int8((unsigned char)0xF7); + emit_int8((unsigned char)(0xF8 | encode)); } void Assembler::divl(Register src) { // Unsigned int encode = prefix_and_encode(src->encoding()); - emit_byte(0xF7); - emit_byte(0xF0 | encode); + emit_int8((unsigned char)0xF7); + emit_int8((unsigned char)(0xF0 | encode)); } void Assembler::imull(Register dst, Register src) { int encode = prefix_and_encode(dst->encoding(), src->encoding()); - emit_byte(0x0F); - emit_byte(0xAF); - emit_byte(0xC0 | encode); + emit_int8(0x0F); + emit_int8((unsigned char)0xAF); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::imull(Register dst, Register src, int value) { int encode = prefix_and_encode(dst->encoding(), src->encoding()); if (is8bit(value)) { - emit_byte(0x6B); - emit_byte(0xC0 | encode); - emit_byte(value & 0xFF); + emit_int8(0x6B); + emit_int8((unsigned char)(0xC0 | encode)); + emit_int8(value & 0xFF); } else { - emit_byte(0x69); - emit_byte(0xC0 | encode); + emit_int8(0x69); + emit_int8((unsigned char)(0xC0 | encode)); emit_long(value); } } @@ -1414,7 +1416,7 @@ void Assembler::incl(Address dst) { // Don't use it directly. Use MacroAssembler::increment() instead. InstructionMark im(this); prefix(dst); - emit_byte(0xFF); + emit_int8((unsigned char)0xFF); emit_operand(rax, dst); } @@ -1430,14 +1432,14 @@ void Assembler::jcc(Condition cc, Label& L, bool maybe_short) { intptr_t offs = (intptr_t)dst - (intptr_t)pc(); if (maybe_short && is8bit(offs - short_size)) { // 0111 tttn #8-bit disp - emit_byte(0x70 | cc); - emit_byte((offs - short_size) & 0xFF); + emit_int8(0x70 | cc); + emit_int8((offs - short_size) & 0xFF); } else { // 0000 1111 1000 tttn #32-bit disp assert(is_simm32(offs - long_size), "must be 32bit offset (call4)"); - emit_byte(0x0F); - emit_byte(0x80 | cc); + emit_int8(0x0F); + emit_int8((unsigned char)(0x80 | cc)); emit_long(offs - long_size); } } else { @@ -1446,8 +1448,8 @@ void Assembler::jcc(Condition cc, Label& L, bool maybe_short) { // Note: use jccb() if label to be bound is very close to get // an 8-bit displacement L.add_patch_at(code(), locator()); - emit_byte(0x0F); - emit_byte(0x80 | cc); + emit_int8(0x0F); + emit_int8((unsigned char)(0x80 | cc)); emit_long(0); } } @@ -1466,20 +1468,20 @@ void Assembler::jccb(Condition cc, Label& L) { #endif intptr_t offs = (intptr_t)entry - (intptr_t)pc(); // 0111 tttn #8-bit disp - emit_byte(0x70 | cc); - emit_byte((offs - short_size) & 0xFF); + emit_int8(0x70 | cc); + emit_int8((offs - short_size) & 0xFF); } else { InstructionMark im(this); L.add_patch_at(code(), locator()); - emit_byte(0x70 | cc); - emit_byte(0); + emit_int8(0x70 | cc); + emit_int8(0); } } void Assembler::jmp(Address adr) { InstructionMark im(this); prefix(adr); - emit_byte(0xFF); + emit_int8((unsigned char)0xFF); emit_operand(rsp, adr); } @@ -1492,10 +1494,10 @@ void Assembler::jmp(Label& L, bool maybe_short) { const int long_size = 5; intptr_t offs = entry - pc(); if (maybe_short && is8bit(offs - short_size)) { - emit_byte(0xEB); - emit_byte((offs - short_size) & 0xFF); + emit_int8((unsigned char)0xEB); + emit_int8((offs - short_size) & 0xFF); } else { - emit_byte(0xE9); + emit_int8((unsigned char)0xE9); emit_long(offs - long_size); } } else { @@ -1505,20 +1507,20 @@ void Assembler::jmp(Label& L, bool maybe_short) { // force an 8-bit displacement. InstructionMark im(this); L.add_patch_at(code(), locator()); - emit_byte(0xE9); + emit_int8((unsigned char)0xE9); emit_long(0); } } void Assembler::jmp(Register entry) { int encode = prefix_and_encode(entry->encoding()); - emit_byte(0xFF); - emit_byte(0xE0 | encode); + emit_int8((unsigned char)0xFF); + emit_int8((unsigned char)(0xE0 | encode)); } void Assembler::jmp_literal(address dest, RelocationHolder const& rspec) { InstructionMark im(this); - emit_byte(0xE9); + emit_int8((unsigned char)0xE9); assert(dest != NULL, "must have a target"); intptr_t disp = dest - (pc() + sizeof(int32_t)); assert(is_simm32(disp), "must be 32bit offset (jmp)"); @@ -1539,13 +1541,13 @@ void Assembler::jmpb(Label& L) { assert(is8bit(dist), "Dispacement too large for a short jmp"); #endif intptr_t offs = entry - pc(); - emit_byte(0xEB); - emit_byte((offs - short_size) & 0xFF); + emit_int8((unsigned char)0xEB); + emit_int8((offs - short_size) & 0xFF); } else { InstructionMark im(this); L.add_patch_at(code(), locator()); - emit_byte(0xEB); - emit_byte(0); + emit_int8((unsigned char)0xEB); + emit_int8(0); } } @@ -1553,46 +1555,46 @@ void Assembler::ldmxcsr( Address src) { NOT_LP64(assert(VM_Version::supports_sse(), "")); InstructionMark im(this); prefix(src); - emit_byte(0x0F); - emit_byte(0xAE); + emit_int8(0x0F); + emit_int8((unsigned char)0xAE); emit_operand(as_Register(2), src); } void Assembler::leal(Register dst, Address src) { InstructionMark im(this); #ifdef _LP64 - emit_byte(0x67); // addr32 + emit_int8(0x67); // addr32 prefix(src, dst); #endif // LP64 - emit_byte(0x8D); + emit_int8((unsigned char)0x8D); emit_operand(dst, src); } void Assembler::lfence() { - emit_byte(0x0F); - emit_byte(0xAE); - emit_byte(0xE8); + emit_int8(0x0F); + emit_int8((unsigned char)0xAE); + emit_int8((unsigned char)0xE8); } void Assembler::lock() { - emit_byte(0xF0); + emit_int8((unsigned char)0xF0); } void Assembler::lzcntl(Register dst, Register src) { assert(VM_Version::supports_lzcnt(), "encoding is treated as BSR"); - emit_byte(0xF3); + emit_int8((unsigned char)0xF3); int encode = prefix_and_encode(dst->encoding(), src->encoding()); - emit_byte(0x0F); - emit_byte(0xBD); - emit_byte(0xC0 | encode); + emit_int8(0x0F); + emit_int8((unsigned char)0xBD); + emit_int8((unsigned char)(0xC0 | encode)); } // Emit mfence instruction void Assembler::mfence() { NOT_LP64(assert(VM_Version::supports_sse2(), "unsupported");) - emit_byte( 0x0F ); - emit_byte( 0xAE ); - emit_byte( 0xF0 ); + emit_int8(0x0F); + emit_int8((unsigned char)0xAE); + emit_int8((unsigned char)0xF0); } void Assembler::mov(Register dst, Register src) { @@ -1612,15 +1614,15 @@ void Assembler::movaps(XMMRegister dst, XMMRegister src) { void Assembler::movlhps(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse(), "")); int encode = simd_prefix_and_encode(dst, src, src, VEX_SIMD_NONE); - emit_byte(0x16); - emit_byte(0xC0 | encode); + emit_int8(0x16); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::movb(Register dst, Address src) { NOT_LP64(assert(dst->has_byte_register(), "must have byte register")); InstructionMark im(this); prefix(src, dst, true); - emit_byte(0x8A); + emit_int8((unsigned char)0x8A); emit_operand(dst, src); } @@ -1628,9 +1630,9 @@ void Assembler::movb(Register dst, Address src) { void Assembler::movb(Address dst, int imm8) { InstructionMark im(this); prefix(dst); - emit_byte(0xC6); + emit_int8((unsigned char)0xC6); emit_operand(rax, dst, 1); - emit_byte(imm8); + emit_int8(imm8); } @@ -1638,30 +1640,30 @@ void Assembler::movb(Address dst, Register src) { assert(src->has_byte_register(), "must have byte register"); InstructionMark im(this); prefix(dst, src, true); - emit_byte(0x88); + emit_int8((unsigned char)0x88); emit_operand(src, dst); } void Assembler::movdl(XMMRegister dst, Register src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); int encode = simd_prefix_and_encode(dst, src, VEX_SIMD_66); - emit_byte(0x6E); - emit_byte(0xC0 | encode); + emit_int8(0x6E); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::movdl(Register dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); // swap src/dst to get correct prefix int encode = simd_prefix_and_encode(src, dst, VEX_SIMD_66); - emit_byte(0x7E); - emit_byte(0xC0 | encode); + emit_int8(0x7E); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::movdl(XMMRegister dst, Address src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionMark im(this); simd_prefix(dst, src, VEX_SIMD_66); - emit_byte(0x6E); + emit_int8(0x6E); emit_operand(dst, src); } @@ -1669,7 +1671,7 @@ void Assembler::movdl(Address dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionMark im(this); simd_prefix(dst, src, VEX_SIMD_66); - emit_byte(0x7E); + emit_int8(0x7E); emit_operand(src, dst); } @@ -1692,7 +1694,7 @@ void Assembler::movdqu(Address dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionMark im(this); simd_prefix(dst, src, VEX_SIMD_F3); - emit_byte(0x7F); + emit_int8(0x7F); emit_operand(src, dst); } @@ -1701,8 +1703,8 @@ void Assembler::vmovdqu(XMMRegister dst, XMMRegister src) { assert(UseAVX, ""); bool vector256 = true; int encode = vex_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_F3, vector256); - emit_byte(0x6F); - emit_byte(0xC0 | encode); + emit_int8(0x6F); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::vmovdqu(XMMRegister dst, Address src) { @@ -1710,7 +1712,7 @@ void Assembler::vmovdqu(XMMRegister dst, Address src) { InstructionMark im(this); bool vector256 = true; vex_prefix(dst, xnoreg, src, VEX_SIMD_F3, vector256); - emit_byte(0x6F); + emit_int8(0x6F); emit_operand(dst, src); } @@ -1721,7 +1723,7 @@ void Assembler::vmovdqu(Address dst, XMMRegister src) { // swap src<->dst for encoding assert(src != xnoreg, "sanity"); vex_prefix(src, xnoreg, dst, VEX_SIMD_F3, vector256); - emit_byte(0x7F); + emit_int8(0x7F); emit_operand(src, dst); } @@ -1729,27 +1731,27 @@ void Assembler::vmovdqu(Address dst, XMMRegister src) { void Assembler::movl(Register dst, int32_t imm32) { int encode = prefix_and_encode(dst->encoding()); - emit_byte(0xB8 | encode); + emit_int8((unsigned char)(0xB8 | encode)); emit_long(imm32); } void Assembler::movl(Register dst, Register src) { int encode = prefix_and_encode(dst->encoding(), src->encoding()); - emit_byte(0x8B); - emit_byte(0xC0 | encode); + emit_int8((unsigned char)0x8B); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::movl(Register dst, Address src) { InstructionMark im(this); prefix(src, dst); - emit_byte(0x8B); + emit_int8((unsigned char)0x8B); emit_operand(dst, src); } void Assembler::movl(Address dst, int32_t imm32) { InstructionMark im(this); prefix(dst); - emit_byte(0xC7); + emit_int8((unsigned char)0xC7); emit_operand(rax, dst, 4); emit_long(imm32); } @@ -1757,7 +1759,7 @@ void Assembler::movl(Address dst, int32_t imm32) { void Assembler::movl(Address dst, Register src) { InstructionMark im(this); prefix(dst, src); - emit_byte(0x89); + emit_int8((unsigned char)0x89); emit_operand(src, dst); } @@ -1771,15 +1773,15 @@ void Assembler::movlpd(XMMRegister dst, Address src) { void Assembler::movq( MMXRegister dst, Address src ) { assert( VM_Version::supports_mmx(), "" ); - emit_byte(0x0F); - emit_byte(0x6F); + emit_int8(0x0F); + emit_int8(0x6F); emit_operand(dst, src); } void Assembler::movq( Address dst, MMXRegister src ) { assert( VM_Version::supports_mmx(), "" ); - emit_byte(0x0F); - emit_byte(0x7F); + emit_int8(0x0F); + emit_int8(0x7F); // workaround gcc (3.2.1-7a) bug // In that version of gcc with only an emit_operand(MMX, Address) // gcc will tail jump and try and reverse the parameters completely @@ -1793,7 +1795,7 @@ void Assembler::movq(XMMRegister dst, Address src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionMark im(this); simd_prefix(dst, src, VEX_SIMD_F3); - emit_byte(0x7E); + emit_int8(0x7E); emit_operand(dst, src); } @@ -1801,24 +1803,24 @@ void Assembler::movq(Address dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionMark im(this); simd_prefix(dst, src, VEX_SIMD_66); - emit_byte(0xD6); + emit_int8((unsigned char)0xD6); emit_operand(src, dst); } void Assembler::movsbl(Register dst, Address src) { // movsxb InstructionMark im(this); prefix(src, dst); - emit_byte(0x0F); - emit_byte(0xBE); + emit_int8(0x0F); + emit_int8((unsigned char)0xBE); emit_operand(dst, src); } void Assembler::movsbl(Register dst, Register src) { // movsxb NOT_LP64(assert(src->has_byte_register(), "must have byte register")); int encode = prefix_and_encode(dst->encoding(), src->encoding(), true); - emit_byte(0x0F); - emit_byte(0xBE); - emit_byte(0xC0 | encode); + emit_int8(0x0F); + emit_int8((unsigned char)0xBE); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::movsd(XMMRegister dst, XMMRegister src) { @@ -1835,7 +1837,7 @@ void Assembler::movsd(Address dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionMark im(this); simd_prefix(dst, src, VEX_SIMD_F2); - emit_byte(0x11); + emit_int8(0x11); emit_operand(src, dst); } @@ -1853,93 +1855,93 @@ void Assembler::movss(Address dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse(), "")); InstructionMark im(this); simd_prefix(dst, src, VEX_SIMD_F3); - emit_byte(0x11); + emit_int8(0x11); emit_operand(src, dst); } void Assembler::movswl(Register dst, Address src) { // movsxw InstructionMark im(this); prefix(src, dst); - emit_byte(0x0F); - emit_byte(0xBF); + emit_int8(0x0F); + emit_int8((unsigned char)0xBF); emit_operand(dst, src); } void Assembler::movswl(Register dst, Register src) { // movsxw int encode = prefix_and_encode(dst->encoding(), src->encoding()); - emit_byte(0x0F); - emit_byte(0xBF); - emit_byte(0xC0 | encode); + emit_int8(0x0F); + emit_int8((unsigned char)0xBF); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::movw(Address dst, int imm16) { InstructionMark im(this); - emit_byte(0x66); // switch to 16-bit mode + emit_int8(0x66); // switch to 16-bit mode prefix(dst); - emit_byte(0xC7); + emit_int8((unsigned char)0xC7); emit_operand(rax, dst, 2); - emit_word(imm16); + emit_int16(imm16); } void Assembler::movw(Register dst, Address src) { InstructionMark im(this); - emit_byte(0x66); + emit_int8(0x66); prefix(src, dst); - emit_byte(0x8B); + emit_int8((unsigned char)0x8B); emit_operand(dst, src); } void Assembler::movw(Address dst, Register src) { InstructionMark im(this); - emit_byte(0x66); + emit_int8(0x66); prefix(dst, src); - emit_byte(0x89); + emit_int8((unsigned char)0x89); emit_operand(src, dst); } void Assembler::movzbl(Register dst, Address src) { // movzxb InstructionMark im(this); prefix(src, dst); - emit_byte(0x0F); - emit_byte(0xB6); + emit_int8(0x0F); + emit_int8((unsigned char)0xB6); emit_operand(dst, src); } void Assembler::movzbl(Register dst, Register src) { // movzxb NOT_LP64(assert(src->has_byte_register(), "must have byte register")); int encode = prefix_and_encode(dst->encoding(), src->encoding(), true); - emit_byte(0x0F); - emit_byte(0xB6); - emit_byte(0xC0 | encode); + emit_int8(0x0F); + emit_int8((unsigned char)0xB6); + emit_int8(0xC0 | encode); } void Assembler::movzwl(Register dst, Address src) { // movzxw InstructionMark im(this); prefix(src, dst); - emit_byte(0x0F); - emit_byte(0xB7); + emit_int8(0x0F); + emit_int8((unsigned char)0xB7); emit_operand(dst, src); } void Assembler::movzwl(Register dst, Register src) { // movzxw int encode = prefix_and_encode(dst->encoding(), src->encoding()); - emit_byte(0x0F); - emit_byte(0xB7); - emit_byte(0xC0 | encode); + emit_int8(0x0F); + emit_int8((unsigned char)0xB7); + emit_int8(0xC0 | encode); } void Assembler::mull(Address src) { InstructionMark im(this); prefix(src); - emit_byte(0xF7); + emit_int8((unsigned char)0xF7); emit_operand(rsp, src); } void Assembler::mull(Register src) { int encode = prefix_and_encode(src->encoding()); - emit_byte(0xF7); - emit_byte(0xE0 | encode); + emit_int8((unsigned char)0xF7); + emit_int8((unsigned char)(0xE0 | encode)); } void Assembler::mulsd(XMMRegister dst, Address src) { @@ -1964,8 +1966,8 @@ void Assembler::mulss(XMMRegister dst, XMMRegister src) { void Assembler::negl(Register dst) { int encode = prefix_and_encode(dst->encoding()); - emit_byte(0xF7); - emit_byte(0xD8 | encode); + emit_int8((unsigned char)0xF7); + emit_int8((unsigned char)(0xD8 | encode)); } void Assembler::nop(int i) { @@ -1976,7 +1978,7 @@ void Assembler::nop(int i) { // speed is not an issue so simply use the single byte traditional nop // to do alignment. - for (; i > 0 ; i--) emit_byte(0x90); + for (; i > 0 ; i--) emit_int8((unsigned char)0x90); return; #endif // ASSERT @@ -2006,33 +2008,35 @@ void Assembler::nop(int i) { while(i >= 15) { // For Intel don't generate consecutive addess nops (mix with regular nops) i -= 15; - emit_byte(0x66); // size prefix - emit_byte(0x66); // size prefix - emit_byte(0x66); // size prefix + emit_int8(0x66); // size prefix + emit_int8(0x66); // size prefix + emit_int8(0x66); // size prefix addr_nop_8(); - emit_byte(0x66); // size prefix - emit_byte(0x66); // size prefix - emit_byte(0x66); // size prefix - emit_byte(0x90); // nop + emit_int8(0x66); // size prefix + emit_int8(0x66); // size prefix + emit_int8(0x66); // size prefix + emit_int8((unsigned char)0x90); + // nop } switch (i) { case 14: - emit_byte(0x66); // size prefix + emit_int8(0x66); // size prefix case 13: - emit_byte(0x66); // size prefix + emit_int8(0x66); // size prefix case 12: addr_nop_8(); - emit_byte(0x66); // size prefix - emit_byte(0x66); // size prefix - emit_byte(0x66); // size prefix - emit_byte(0x90); // nop + emit_int8(0x66); // size prefix + emit_int8(0x66); // size prefix + emit_int8(0x66); // size prefix + emit_int8((unsigned char)0x90); + // nop break; case 11: - emit_byte(0x66); // size prefix + emit_int8(0x66); // size prefix case 10: - emit_byte(0x66); // size prefix + emit_int8(0x66); // size prefix case 9: - emit_byte(0x66); // size prefix + emit_int8(0x66); // size prefix case 8: addr_nop_8(); break; @@ -2040,7 +2044,7 @@ void Assembler::nop(int i) { addr_nop_7(); break; case 6: - emit_byte(0x66); // size prefix + emit_int8(0x66); // size prefix case 5: addr_nop_5(); break; @@ -2049,11 +2053,12 @@ void Assembler::nop(int i) { break; case 3: // Don't use "0x0F 0x1F 0x00" - need patching safe padding - emit_byte(0x66); // size prefix + emit_int8(0x66); // size prefix case 2: - emit_byte(0x66); // size prefix + emit_int8(0x66); // size prefix case 1: - emit_byte(0x90); // nop + emit_int8((unsigned char)0x90); + // nop break; default: assert(i == 0, " "); @@ -2086,24 +2091,24 @@ void Assembler::nop(int i) { while(i >= 22) { i -= 11; - emit_byte(0x66); // size prefix - emit_byte(0x66); // size prefix - emit_byte(0x66); // size prefix + emit_int8(0x66); // size prefix + emit_int8(0x66); // size prefix + emit_int8(0x66); // size prefix addr_nop_8(); } // Generate first nop for size between 21-12 switch (i) { case 21: i -= 1; - emit_byte(0x66); // size prefix + emit_int8(0x66); // size prefix case 20: case 19: i -= 1; - emit_byte(0x66); // size prefix + emit_int8(0x66); // size prefix case 18: case 17: i -= 1; - emit_byte(0x66); // size prefix + emit_int8(0x66); // size prefix case 16: case 15: i -= 8; @@ -2116,7 +2121,7 @@ void Assembler::nop(int i) { break; case 12: i -= 6; - emit_byte(0x66); // size prefix + emit_int8(0x66); // size prefix addr_nop_5(); break; default: @@ -2126,11 +2131,11 @@ void Assembler::nop(int i) { // Generate second nop for size between 11-1 switch (i) { case 11: - emit_byte(0x66); // size prefix + emit_int8(0x66); // size prefix case 10: - emit_byte(0x66); // size prefix + emit_int8(0x66); // size prefix case 9: - emit_byte(0x66); // size prefix + emit_int8(0x66); // size prefix case 8: addr_nop_8(); break; @@ -2138,7 +2143,7 @@ void Assembler::nop(int i) { addr_nop_7(); break; case 6: - emit_byte(0x66); // size prefix + emit_int8(0x66); // size prefix case 5: addr_nop_5(); break; @@ -2147,11 +2152,12 @@ void Assembler::nop(int i) { break; case 3: // Don't use "0x0F 0x1F 0x00" - need patching safe padding - emit_byte(0x66); // size prefix + emit_int8(0x66); // size prefix case 2: - emit_byte(0x66); // size prefix + emit_int8(0x66); // size prefix case 1: - emit_byte(0x90); // nop + emit_int8((unsigned char)0x90); + // nop break; default: assert(i == 0, " "); @@ -2174,42 +2180,43 @@ void Assembler::nop(int i) { // while(i > 12) { i -= 4; - emit_byte(0x66); // size prefix - emit_byte(0x66); - emit_byte(0x66); - emit_byte(0x90); // nop + emit_int8(0x66); // size prefix + emit_int8(0x66); + emit_int8(0x66); + emit_int8((unsigned char)0x90); + // nop } // 1 - 12 nops if(i > 8) { if(i > 9) { i -= 1; - emit_byte(0x66); + emit_int8(0x66); } i -= 3; - emit_byte(0x66); - emit_byte(0x66); - emit_byte(0x90); + emit_int8(0x66); + emit_int8(0x66); + emit_int8((unsigned char)0x90); } // 1 - 8 nops if(i > 4) { if(i > 6) { i -= 1; - emit_byte(0x66); + emit_int8(0x66); } i -= 3; - emit_byte(0x66); - emit_byte(0x66); - emit_byte(0x90); + emit_int8(0x66); + emit_int8(0x66); + emit_int8((unsigned char)0x90); } switch (i) { case 4: - emit_byte(0x66); + emit_int8(0x66); case 3: - emit_byte(0x66); + emit_int8(0x66); case 2: - emit_byte(0x66); + emit_int8(0x66); case 1: - emit_byte(0x90); + emit_int8((unsigned char)0x90); break; default: assert(i == 0, " "); @@ -2218,8 +2225,8 @@ void Assembler::nop(int i) { void Assembler::notl(Register dst) { int encode = prefix_and_encode(dst->encoding()); - emit_byte(0xF7); - emit_byte(0xD0 | encode ); + emit_int8((unsigned char)0xF7); + emit_int8((unsigned char)(0xD0 | encode)); } void Assembler::orl(Address dst, int32_t imm32) { @@ -2236,7 +2243,7 @@ void Assembler::orl(Register dst, int32_t imm32) { void Assembler::orl(Register dst, Address src) { InstructionMark im(this); prefix(src, dst); - emit_byte(0x0B); + emit_int8(0x0B); emit_operand(dst, src); } @@ -2260,61 +2267,61 @@ void Assembler::pcmpestri(XMMRegister dst, Address src, int imm8) { assert(VM_Version::supports_sse4_2(), ""); InstructionMark im(this); simd_prefix(dst, src, VEX_SIMD_66, VEX_OPCODE_0F_3A); - emit_byte(0x61); + emit_int8(0x61); emit_operand(dst, src); - emit_byte(imm8); + emit_int8(imm8); } void Assembler::pcmpestri(XMMRegister dst, XMMRegister src, int imm8) { assert(VM_Version::supports_sse4_2(), ""); int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_3A); - emit_byte(0x61); - emit_byte(0xC0 | encode); - emit_byte(imm8); + emit_int8(0x61); + emit_int8((unsigned char)(0xC0 | encode)); + emit_int8(imm8); } void Assembler::pmovzxbw(XMMRegister dst, Address src) { assert(VM_Version::supports_sse4_1(), ""); InstructionMark im(this); simd_prefix(dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38); - emit_byte(0x30); + emit_int8(0x30); emit_operand(dst, src); } void Assembler::pmovzxbw(XMMRegister dst, XMMRegister src) { assert(VM_Version::supports_sse4_1(), ""); int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_38); - emit_byte(0x30); - emit_byte(0xC0 | encode); + emit_int8(0x30); + emit_int8((unsigned char)(0xC0 | encode)); } // generic void Assembler::pop(Register dst) { int encode = prefix_and_encode(dst->encoding()); - emit_byte(0x58 | encode); + emit_int8(0x58 | encode); } void Assembler::popcntl(Register dst, Address src) { assert(VM_Version::supports_popcnt(), "must support"); InstructionMark im(this); - emit_byte(0xF3); + emit_int8((unsigned char)0xF3); prefix(src, dst); - emit_byte(0x0F); - emit_byte(0xB8); + emit_int8(0x0F); + emit_int8((unsigned char)0xB8); emit_operand(dst, src); } void Assembler::popcntl(Register dst, Register src) { assert(VM_Version::supports_popcnt(), "must support"); - emit_byte(0xF3); + emit_int8((unsigned char)0xF3); int encode = prefix_and_encode(dst->encoding(), src->encoding()); - emit_byte(0x0F); - emit_byte(0xB8); - emit_byte(0xC0 | encode); + emit_int8(0x0F); + emit_int8((unsigned char)0xB8); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::popf() { - emit_byte(0x9D); + emit_int8((unsigned char)0x9D); } #ifndef _LP64 // no 32bit push/pop on amd64 @@ -2322,21 +2329,21 @@ void Assembler::popl(Address dst) { // NOTE: this will adjust stack by 8byte on 64bits InstructionMark im(this); prefix(dst); - emit_byte(0x8F); + emit_int8((unsigned char)0x8F); emit_operand(rax, dst); } #endif void Assembler::prefetch_prefix(Address src) { prefix(src); - emit_byte(0x0F); + emit_int8(0x0F); } void Assembler::prefetchnta(Address src) { NOT_LP64(assert(VM_Version::supports_sse(), "must support")); InstructionMark im(this); prefetch_prefix(src); - emit_byte(0x18); + emit_int8(0x18); emit_operand(rax, src); // 0, src } @@ -2344,7 +2351,7 @@ void Assembler::prefetchr(Address src) { assert(VM_Version::supports_3dnow_prefetch(), "must support"); InstructionMark im(this); prefetch_prefix(src); - emit_byte(0x0D); + emit_int8(0x0D); emit_operand(rax, src); // 0, src } @@ -2352,7 +2359,7 @@ void Assembler::prefetcht0(Address src) { NOT_LP64(assert(VM_Version::supports_sse(), "must support")); InstructionMark im(this); prefetch_prefix(src); - emit_byte(0x18); + emit_int8(0x18); emit_operand(rcx, src); // 1, src } @@ -2360,7 +2367,7 @@ void Assembler::prefetcht1(Address src) { NOT_LP64(assert(VM_Version::supports_sse(), "must support")); InstructionMark im(this); prefetch_prefix(src); - emit_byte(0x18); + emit_int8(0x18); emit_operand(rdx, src); // 2, src } @@ -2368,7 +2375,7 @@ void Assembler::prefetcht2(Address src) { NOT_LP64(assert(VM_Version::supports_sse(), "must support")); InstructionMark im(this); prefetch_prefix(src); - emit_byte(0x18); + emit_int8(0x18); emit_operand(rbx, src); // 3, src } @@ -2376,27 +2383,26 @@ void Assembler::prefetchw(Address src) { assert(VM_Version::supports_3dnow_prefetch(), "must support"); InstructionMark im(this); prefetch_prefix(src); - emit_byte(0x0D); + emit_int8(0x0D); emit_operand(rcx, src); // 1, src } void Assembler::prefix(Prefix p) { - a_byte(p); + emit_int8(p); } void Assembler::pshufb(XMMRegister dst, XMMRegister src) { assert(VM_Version::supports_ssse3(), ""); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38); - emit_byte(0x00); - emit_byte(0xC0 | encode); + emit_int8(0x00); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::pshufb(XMMRegister dst, Address src) { assert(VM_Version::supports_ssse3(), ""); - assert((UseAVX > 0), "SSE mode requires address alignment 16 bytes"); InstructionMark im(this); simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38); - emit_byte(0x00); + emit_int8(0x00); emit_operand(dst, src); } @@ -2404,7 +2410,7 @@ void Assembler::pshufd(XMMRegister dst, XMMRegister src, int mode) { assert(isByte(mode), "invalid value"); NOT_LP64(assert(VM_Version::supports_sse2(), "")); emit_simd_arith_nonds(0x70, dst, src, VEX_SIMD_66); - emit_byte(mode & 0xFF); + emit_int8(mode & 0xFF); } @@ -2414,16 +2420,16 @@ void Assembler::pshufd(XMMRegister dst, Address src, int mode) { assert((UseAVX > 0), "SSE mode requires address alignment 16 bytes"); InstructionMark im(this); simd_prefix(dst, src, VEX_SIMD_66); - emit_byte(0x70); + emit_int8(0x70); emit_operand(dst, src); - emit_byte(mode & 0xFF); + emit_int8(mode & 0xFF); } void Assembler::pshuflw(XMMRegister dst, XMMRegister src, int mode) { assert(isByte(mode), "invalid value"); NOT_LP64(assert(VM_Version::supports_sse2(), "")); emit_simd_arith_nonds(0x70, dst, src, VEX_SIMD_F2); - emit_byte(mode & 0xFF); + emit_int8(mode & 0xFF); } void Assembler::pshuflw(XMMRegister dst, Address src, int mode) { @@ -2432,18 +2438,18 @@ void Assembler::pshuflw(XMMRegister dst, Address src, int mode) { assert((UseAVX > 0), "SSE mode requires address alignment 16 bytes"); InstructionMark im(this); simd_prefix(dst, src, VEX_SIMD_F2); - emit_byte(0x70); + emit_int8(0x70); emit_operand(dst, src); - emit_byte(mode & 0xFF); + emit_int8(mode & 0xFF); } void Assembler::psrldq(XMMRegister dst, int shift) { // Shift 128 bit value in xmm register by number of bytes. NOT_LP64(assert(VM_Version::supports_sse2(), "")); int encode = simd_prefix_and_encode(xmm3, dst, dst, VEX_SIMD_66); - emit_byte(0x73); - emit_byte(0xC0 | encode); - emit_byte(shift); + emit_int8(0x73); + emit_int8((unsigned char)(0xC0 | encode)); + emit_int8(shift); } void Assembler::ptest(XMMRegister dst, Address src) { @@ -2451,15 +2457,15 @@ void Assembler::ptest(XMMRegister dst, Address src) { assert((UseAVX > 0), "SSE mode requires address alignment 16 bytes"); InstructionMark im(this); simd_prefix(dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38); - emit_byte(0x17); + emit_int8(0x17); emit_operand(dst, src); } void Assembler::ptest(XMMRegister dst, XMMRegister src) { assert(VM_Version::supports_sse4_1(), ""); int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_38); - emit_byte(0x17); - emit_byte(0xC0 | encode); + emit_int8(0x17); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::punpcklbw(XMMRegister dst, Address src) { @@ -2492,18 +2498,18 @@ void Assembler::punpcklqdq(XMMRegister dst, XMMRegister src) { void Assembler::push(int32_t imm32) { // in 64bits we push 64bits onto the stack but only // take a 32bit immediate - emit_byte(0x68); + emit_int8(0x68); emit_long(imm32); } void Assembler::push(Register src) { int encode = prefix_and_encode(src->encoding()); - emit_byte(0x50 | encode); + emit_int8(0x50 | encode); } void Assembler::pushf() { - emit_byte(0x9C); + emit_int8((unsigned char)0x9C); } #ifndef _LP64 // no 32bit push/pop on amd64 @@ -2511,7 +2517,7 @@ void Assembler::pushl(Address src) { // Note this will push 64bit on 64bit InstructionMark im(this); prefix(src); - emit_byte(0xFF); + emit_int8((unsigned char)0xFF); emit_operand(rsi, src); } #endif @@ -2520,58 +2526,58 @@ void Assembler::rcll(Register dst, int imm8) { assert(isShiftCount(imm8), "illegal shift count"); int encode = prefix_and_encode(dst->encoding()); if (imm8 == 1) { - emit_byte(0xD1); - emit_byte(0xD0 | encode); + emit_int8((unsigned char)0xD1); + emit_int8((unsigned char)(0xD0 | encode)); } else { - emit_byte(0xC1); - emit_byte(0xD0 | encode); - emit_byte(imm8); + emit_int8((unsigned char)0xC1); + emit_int8((unsigned char)0xD0 | encode); + emit_int8(imm8); } } // copies data from [esi] to [edi] using rcx pointer sized words // generic void Assembler::rep_mov() { - emit_byte(0xF3); + emit_int8((unsigned char)0xF3); // MOVSQ LP64_ONLY(prefix(REX_W)); - emit_byte(0xA5); + emit_int8((unsigned char)0xA5); } // sets rcx pointer sized words with rax, value at [edi] // generic void Assembler::rep_set() { // rep_set - emit_byte(0xF3); + emit_int8((unsigned char)0xF3); // STOSQ LP64_ONLY(prefix(REX_W)); - emit_byte(0xAB); + emit_int8((unsigned char)0xAB); } // scans rcx pointer sized words at [edi] for occurance of rax, // generic void Assembler::repne_scan() { // repne_scan - emit_byte(0xF2); + emit_int8((unsigned char)0xF2); // SCASQ LP64_ONLY(prefix(REX_W)); - emit_byte(0xAF); + emit_int8((unsigned char)0xAF); } #ifdef _LP64 // scans rcx 4 byte words at [edi] for occurance of rax, // generic void Assembler::repne_scanl() { // repne_scan - emit_byte(0xF2); + emit_int8((unsigned char)0xF2); // SCASL - emit_byte(0xAF); + emit_int8((unsigned char)0xAF); } #endif void Assembler::ret(int imm16) { if (imm16 == 0) { - emit_byte(0xC3); + emit_int8((unsigned char)0xC3); } else { - emit_byte(0xC2); - emit_word(imm16); + emit_int8((unsigned char)0xC2); + emit_int16(imm16); } } @@ -2580,26 +2586,26 @@ void Assembler::sahf() { // Not supported in 64bit mode ShouldNotReachHere(); #endif - emit_byte(0x9E); + emit_int8((unsigned char)0x9E); } void Assembler::sarl(Register dst, int imm8) { int encode = prefix_and_encode(dst->encoding()); assert(isShiftCount(imm8), "illegal shift count"); if (imm8 == 1) { - emit_byte(0xD1); - emit_byte(0xF8 | encode); + emit_int8((unsigned char)0xD1); + emit_int8((unsigned char)(0xF8 | encode)); } else { - emit_byte(0xC1); - emit_byte(0xF8 | encode); - emit_byte(imm8); + emit_int8((unsigned char)0xC1); + emit_int8((unsigned char)(0xF8 | encode)); + emit_int8(imm8); } } void Assembler::sarl(Register dst) { int encode = prefix_and_encode(dst->encoding()); - emit_byte(0xD3); - emit_byte(0xF8 | encode); + emit_int8((unsigned char)0xD3); + emit_int8((unsigned char)(0xF8 | encode)); } void Assembler::sbbl(Address dst, int32_t imm32) { @@ -2617,7 +2623,7 @@ void Assembler::sbbl(Register dst, int32_t imm32) { void Assembler::sbbl(Register dst, Address src) { InstructionMark im(this); prefix(src, dst); - emit_byte(0x1B); + emit_int8(0x1B); emit_operand(dst, src); } @@ -2629,47 +2635,47 @@ void Assembler::sbbl(Register dst, Register src) { void Assembler::setb(Condition cc, Register dst) { assert(0 <= cc && cc < 16, "illegal cc"); int encode = prefix_and_encode(dst->encoding(), true); - emit_byte(0x0F); - emit_byte(0x90 | cc); - emit_byte(0xC0 | encode); + emit_int8(0x0F); + emit_int8((unsigned char)0x90 | cc); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::shll(Register dst, int imm8) { assert(isShiftCount(imm8), "illegal shift count"); int encode = prefix_and_encode(dst->encoding()); if (imm8 == 1 ) { - emit_byte(0xD1); - emit_byte(0xE0 | encode); + emit_int8((unsigned char)0xD1); + emit_int8((unsigned char)(0xE0 | encode)); } else { - emit_byte(0xC1); - emit_byte(0xE0 | encode); - emit_byte(imm8); + emit_int8((unsigned char)0xC1); + emit_int8((unsigned char)(0xE0 | encode)); + emit_int8(imm8); } } void Assembler::shll(Register dst) { int encode = prefix_and_encode(dst->encoding()); - emit_byte(0xD3); - emit_byte(0xE0 | encode); + emit_int8((unsigned char)0xD3); + emit_int8((unsigned char)(0xE0 | encode)); } void Assembler::shrl(Register dst, int imm8) { assert(isShiftCount(imm8), "illegal shift count"); int encode = prefix_and_encode(dst->encoding()); - emit_byte(0xC1); - emit_byte(0xE8 | encode); - emit_byte(imm8); + emit_int8((unsigned char)0xC1); + emit_int8((unsigned char)(0xE8 | encode)); + emit_int8(imm8); } void Assembler::shrl(Register dst) { int encode = prefix_and_encode(dst->encoding()); - emit_byte(0xD3); - emit_byte(0xE8 | encode); + emit_int8((unsigned char)0xD3); + emit_int8((unsigned char)(0xE8 | encode)); } // copies a single word from [esi] to [edi] void Assembler::smovl() { - emit_byte(0xA5); + emit_int8((unsigned char)0xA5); } void Assembler::sqrtsd(XMMRegister dst, XMMRegister src) { @@ -2688,7 +2694,7 @@ void Assembler::sqrtss(XMMRegister dst, XMMRegister src) { } void Assembler::std() { - emit_byte(0xfd); + emit_int8((unsigned char)0xFD); } void Assembler::sqrtss(XMMRegister dst, Address src) { @@ -2700,8 +2706,8 @@ void Assembler::stmxcsr( Address dst) { NOT_LP64(assert(VM_Version::supports_sse(), "")); InstructionMark im(this); prefix(dst); - emit_byte(0x0F); - emit_byte(0xAE); + emit_int8(0x0F); + emit_int8((unsigned char)0xAE); emit_operand(as_Register(3), dst); } @@ -2714,7 +2720,7 @@ void Assembler::subl(Address dst, int32_t imm32) { void Assembler::subl(Address dst, Register src) { InstructionMark im(this); prefix(dst, src); - emit_byte(0x29); + emit_int8(0x29); emit_operand(src, dst); } @@ -2732,7 +2738,7 @@ void Assembler::subl_imm32(Register dst, int32_t imm32) { void Assembler::subl(Register dst, Address src) { InstructionMark im(this); prefix(src, dst); - emit_byte(0x2B); + emit_int8(0x2B); emit_operand(dst, src); } @@ -2773,11 +2779,11 @@ void Assembler::testl(Register dst, int32_t imm32) { // 8bit operands int encode = dst->encoding(); if (encode == 0) { - emit_byte(0xA9); + emit_int8((unsigned char)0xA9); } else { encode = prefix_and_encode(encode); - emit_byte(0xF7); - emit_byte(0xC0 | encode); + emit_int8((unsigned char)0xF7); + emit_int8((unsigned char)(0xC0 | encode)); } emit_long(imm32); } @@ -2790,7 +2796,7 @@ void Assembler::testl(Register dst, Register src) { void Assembler::testl(Register dst, Address src) { InstructionMark im(this); prefix(src, dst); - emit_byte(0x85); + emit_int8((unsigned char)0x85); emit_operand(dst, src); } @@ -2818,28 +2824,28 @@ void Assembler::ucomiss(XMMRegister dst, XMMRegister src) { void Assembler::xaddl(Address dst, Register src) { InstructionMark im(this); prefix(dst, src); - emit_byte(0x0F); - emit_byte(0xC1); + emit_int8(0x0F); + emit_int8((unsigned char)0xC1); emit_operand(src, dst); } void Assembler::xchgl(Register dst, Address src) { // xchg InstructionMark im(this); prefix(src, dst); - emit_byte(0x87); + emit_int8((unsigned char)0x87); emit_operand(dst, src); } void Assembler::xchgl(Register dst, Register src) { int encode = prefix_and_encode(dst->encoding(), src->encoding()); - emit_byte(0x87); - emit_byte(0xc0 | encode); + emit_int8((unsigned char)0x87); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::xgetbv() { - emit_byte(0x0F); - emit_byte(0x01); - emit_byte(0xD0); + emit_int8(0x0F); + emit_int8(0x01); + emit_int8((unsigned char)0xD0); } void Assembler::xorl(Register dst, int32_t imm32) { @@ -2850,7 +2856,7 @@ void Assembler::xorl(Register dst, int32_t imm32) { void Assembler::xorl(Register dst, Address src) { InstructionMark im(this); prefix(src, dst); - emit_byte(0x33); + emit_int8(0x33); emit_operand(dst, src); } @@ -3276,8 +3282,8 @@ void Assembler::pmullw(XMMRegister dst, XMMRegister src) { void Assembler::pmulld(XMMRegister dst, XMMRegister src) { assert(VM_Version::supports_sse4_1(), ""); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38); - emit_byte(0x40); - emit_byte(0xC0 | encode); + emit_int8(0x40); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::vpmullw(XMMRegister dst, XMMRegister nds, XMMRegister src, bool vector256) { @@ -3288,8 +3294,8 @@ void Assembler::vpmullw(XMMRegister dst, XMMRegister nds, XMMRegister src, bool void Assembler::vpmulld(XMMRegister dst, XMMRegister nds, XMMRegister src, bool vector256) { assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2"); int encode = vex_prefix_and_encode(dst, nds, src, VEX_SIMD_66, vector256, VEX_OPCODE_0F_38); - emit_byte(0x40); - emit_byte(0xC0 | encode); + emit_int8(0x40); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::vpmullw(XMMRegister dst, XMMRegister nds, Address src, bool vector256) { @@ -3303,7 +3309,7 @@ void Assembler::vpmulld(XMMRegister dst, XMMRegister nds, Address src, bool vect int dst_enc = dst->encoding(); int nds_enc = nds->is_valid() ? nds->encoding() : 0; vex_prefix(src, nds_enc, dst_enc, VEX_SIMD_66, VEX_OPCODE_0F_38, false, vector256); - emit_byte(0x40); + emit_int8(0x40); emit_operand(dst, src); } @@ -3312,27 +3318,27 @@ void Assembler::psllw(XMMRegister dst, int shift) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); // XMM6 is for /6 encoding: 66 0F 71 /6 ib int encode = simd_prefix_and_encode(xmm6, dst, dst, VEX_SIMD_66); - emit_byte(0x71); - emit_byte(0xC0 | encode); - emit_byte(shift & 0xFF); + emit_int8(0x71); + emit_int8((unsigned char)(0xC0 | encode)); + emit_int8(shift & 0xFF); } void Assembler::pslld(XMMRegister dst, int shift) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); // XMM6 is for /6 encoding: 66 0F 72 /6 ib int encode = simd_prefix_and_encode(xmm6, dst, dst, VEX_SIMD_66); - emit_byte(0x72); - emit_byte(0xC0 | encode); - emit_byte(shift & 0xFF); + emit_int8(0x72); + emit_int8((unsigned char)(0xC0 | encode)); + emit_int8(shift & 0xFF); } void Assembler::psllq(XMMRegister dst, int shift) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); // XMM6 is for /6 encoding: 66 0F 73 /6 ib int encode = simd_prefix_and_encode(xmm6, dst, dst, VEX_SIMD_66); - emit_byte(0x73); - emit_byte(0xC0 | encode); - emit_byte(shift & 0xFF); + emit_int8(0x73); + emit_int8((unsigned char)(0xC0 | encode)); + emit_int8(shift & 0xFF); } void Assembler::psllw(XMMRegister dst, XMMRegister shift) { @@ -3354,21 +3360,21 @@ void Assembler::vpsllw(XMMRegister dst, XMMRegister src, int shift, bool vector2 assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2"); // XMM6 is for /6 encoding: 66 0F 71 /6 ib emit_vex_arith(0x71, xmm6, dst, src, VEX_SIMD_66, vector256); - emit_byte(shift & 0xFF); + emit_int8(shift & 0xFF); } void Assembler::vpslld(XMMRegister dst, XMMRegister src, int shift, bool vector256) { assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2"); // XMM6 is for /6 encoding: 66 0F 72 /6 ib emit_vex_arith(0x72, xmm6, dst, src, VEX_SIMD_66, vector256); - emit_byte(shift & 0xFF); + emit_int8(shift & 0xFF); } void Assembler::vpsllq(XMMRegister dst, XMMRegister src, int shift, bool vector256) { assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2"); // XMM6 is for /6 encoding: 66 0F 73 /6 ib emit_vex_arith(0x73, xmm6, dst, src, VEX_SIMD_66, vector256); - emit_byte(shift & 0xFF); + emit_int8(shift & 0xFF); } void Assembler::vpsllw(XMMRegister dst, XMMRegister src, XMMRegister shift, bool vector256) { @@ -3391,18 +3397,18 @@ void Assembler::psrlw(XMMRegister dst, int shift) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); // XMM2 is for /2 encoding: 66 0F 71 /2 ib int encode = simd_prefix_and_encode(xmm2, dst, dst, VEX_SIMD_66); - emit_byte(0x71); - emit_byte(0xC0 | encode); - emit_byte(shift & 0xFF); + emit_int8(0x71); + emit_int8((unsigned char)(0xC0 | encode)); + emit_int8(shift & 0xFF); } void Assembler::psrld(XMMRegister dst, int shift) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); // XMM2 is for /2 encoding: 66 0F 72 /2 ib int encode = simd_prefix_and_encode(xmm2, dst, dst, VEX_SIMD_66); - emit_byte(0x72); - emit_byte(0xC0 | encode); - emit_byte(shift & 0xFF); + emit_int8(0x72); + emit_int8((unsigned char)(0xC0 | encode)); + emit_int8(shift & 0xFF); } void Assembler::psrlq(XMMRegister dst, int shift) { @@ -3411,9 +3417,9 @@ void Assembler::psrlq(XMMRegister dst, int shift) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); // XMM2 is for /2 encoding: 66 0F 73 /2 ib int encode = simd_prefix_and_encode(xmm2, dst, dst, VEX_SIMD_66); - emit_byte(0x73); - emit_byte(0xC0 | encode); - emit_byte(shift & 0xFF); + emit_int8(0x73); + emit_int8((unsigned char)(0xC0 | encode)); + emit_int8(shift & 0xFF); } void Assembler::psrlw(XMMRegister dst, XMMRegister shift) { @@ -3435,21 +3441,21 @@ void Assembler::vpsrlw(XMMRegister dst, XMMRegister src, int shift, bool vector2 assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2"); // XMM2 is for /2 encoding: 66 0F 73 /2 ib emit_vex_arith(0x71, xmm2, dst, src, VEX_SIMD_66, vector256); - emit_byte(shift & 0xFF); + emit_int8(shift & 0xFF); } void Assembler::vpsrld(XMMRegister dst, XMMRegister src, int shift, bool vector256) { assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2"); // XMM2 is for /2 encoding: 66 0F 73 /2 ib emit_vex_arith(0x72, xmm2, dst, src, VEX_SIMD_66, vector256); - emit_byte(shift & 0xFF); + emit_int8(shift & 0xFF); } void Assembler::vpsrlq(XMMRegister dst, XMMRegister src, int shift, bool vector256) { assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2"); // XMM2 is for /2 encoding: 66 0F 73 /2 ib emit_vex_arith(0x73, xmm2, dst, src, VEX_SIMD_66, vector256); - emit_byte(shift & 0xFF); + emit_int8(shift & 0xFF); } void Assembler::vpsrlw(XMMRegister dst, XMMRegister src, XMMRegister shift, bool vector256) { @@ -3472,18 +3478,18 @@ void Assembler::psraw(XMMRegister dst, int shift) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); // XMM4 is for /4 encoding: 66 0F 71 /4 ib int encode = simd_prefix_and_encode(xmm4, dst, dst, VEX_SIMD_66); - emit_byte(0x71); - emit_byte(0xC0 | encode); - emit_byte(shift & 0xFF); + emit_int8(0x71); + emit_int8((unsigned char)(0xC0 | encode)); + emit_int8(shift & 0xFF); } void Assembler::psrad(XMMRegister dst, int shift) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); // XMM4 is for /4 encoding: 66 0F 72 /4 ib int encode = simd_prefix_and_encode(xmm4, dst, dst, VEX_SIMD_66); - emit_byte(0x72); - emit_byte(0xC0 | encode); - emit_byte(shift & 0xFF); + emit_int8(0x72); + emit_int8((unsigned char)(0xC0 | encode)); + emit_int8(shift & 0xFF); } void Assembler::psraw(XMMRegister dst, XMMRegister shift) { @@ -3500,14 +3506,14 @@ void Assembler::vpsraw(XMMRegister dst, XMMRegister src, int shift, bool vector2 assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2"); // XMM4 is for /4 encoding: 66 0F 71 /4 ib emit_vex_arith(0x71, xmm4, dst, src, VEX_SIMD_66, vector256); - emit_byte(shift & 0xFF); + emit_int8(shift & 0xFF); } void Assembler::vpsrad(XMMRegister dst, XMMRegister src, int shift, bool vector256) { assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2"); // XMM4 is for /4 encoding: 66 0F 71 /4 ib emit_vex_arith(0x72, xmm4, dst, src, VEX_SIMD_66, vector256); - emit_byte(shift & 0xFF); + emit_int8(shift & 0xFF); } void Assembler::vpsraw(XMMRegister dst, XMMRegister src, XMMRegister shift, bool vector256) { @@ -3572,11 +3578,11 @@ void Assembler::vinsertf128h(XMMRegister dst, XMMRegister nds, XMMRegister src) assert(VM_Version::supports_avx(), ""); bool vector256 = true; int encode = vex_prefix_and_encode(dst, nds, src, VEX_SIMD_66, vector256, VEX_OPCODE_0F_3A); - emit_byte(0x18); - emit_byte(0xC0 | encode); + emit_int8(0x18); + emit_int8((unsigned char)(0xC0 | encode)); // 0x00 - insert into lower 128 bits // 0x01 - insert into upper 128 bits - emit_byte(0x01); + emit_int8(0x01); } void Assembler::vinsertf128h(XMMRegister dst, Address src) { @@ -3587,10 +3593,10 @@ void Assembler::vinsertf128h(XMMRegister dst, Address src) { int dst_enc = dst->encoding(); // swap src<->dst for encoding vex_prefix(src, dst_enc, dst_enc, VEX_SIMD_66, VEX_OPCODE_0F_3A, false, vector256); - emit_byte(0x18); + emit_int8(0x18); emit_operand(dst, src); // 0x01 - insert into upper 128 bits - emit_byte(0x01); + emit_int8(0x01); } void Assembler::vextractf128h(Address dst, XMMRegister src) { @@ -3600,21 +3606,21 @@ void Assembler::vextractf128h(Address dst, XMMRegister src) { assert(src != xnoreg, "sanity"); int src_enc = src->encoding(); vex_prefix(dst, 0, src_enc, VEX_SIMD_66, VEX_OPCODE_0F_3A, false, vector256); - emit_byte(0x19); + emit_int8(0x19); emit_operand(src, dst); // 0x01 - extract from upper 128 bits - emit_byte(0x01); + emit_int8(0x01); } void Assembler::vinserti128h(XMMRegister dst, XMMRegister nds, XMMRegister src) { assert(VM_Version::supports_avx2(), ""); bool vector256 = true; int encode = vex_prefix_and_encode(dst, nds, src, VEX_SIMD_66, vector256, VEX_OPCODE_0F_3A); - emit_byte(0x38); - emit_byte(0xC0 | encode); + emit_int8(0x38); + emit_int8((unsigned char)(0xC0 | encode)); // 0x00 - insert into lower 128 bits // 0x01 - insert into upper 128 bits - emit_byte(0x01); + emit_int8(0x01); } void Assembler::vinserti128h(XMMRegister dst, Address src) { @@ -3625,10 +3631,10 @@ void Assembler::vinserti128h(XMMRegister dst, Address src) { int dst_enc = dst->encoding(); // swap src<->dst for encoding vex_prefix(src, dst_enc, dst_enc, VEX_SIMD_66, VEX_OPCODE_0F_3A, false, vector256); - emit_byte(0x38); + emit_int8(0x38); emit_operand(dst, src); // 0x01 - insert into upper 128 bits - emit_byte(0x01); + emit_int8(0x01); } void Assembler::vextracti128h(Address dst, XMMRegister src) { @@ -3638,16 +3644,16 @@ void Assembler::vextracti128h(Address dst, XMMRegister src) { assert(src != xnoreg, "sanity"); int src_enc = src->encoding(); vex_prefix(dst, 0, src_enc, VEX_SIMD_66, VEX_OPCODE_0F_3A, false, vector256); - emit_byte(0x39); + emit_int8(0x39); emit_operand(src, dst); // 0x01 - extract from upper 128 bits - emit_byte(0x01); + emit_int8(0x01); } void Assembler::vzeroupper() { assert(VM_Version::supports_avx(), ""); (void)vex_prefix_and_encode(xmm0, xmm0, xmm0, VEX_SIMD_NONE); - emit_byte(0x77); + emit_int8(0x77); } @@ -3657,15 +3663,15 @@ void Assembler::vzeroupper() { void Assembler::cmp_literal32(Register src1, int32_t imm32, RelocationHolder const& rspec) { // NO PREFIX AS NEVER 64BIT InstructionMark im(this); - emit_byte(0x81); - emit_byte(0xF8 | src1->encoding()); + emit_int8((unsigned char)0x81); + emit_int8((unsigned char)(0xF8 | src1->encoding())); emit_data(imm32, rspec, 0); } void Assembler::cmp_literal32(Address src1, int32_t imm32, RelocationHolder const& rspec) { // NO PREFIX AS NEVER 64BIT (not even 32bit versions of 64bit regs InstructionMark im(this); - emit_byte(0x81); + emit_int8((unsigned char)0x81); emit_operand(rdi, src1); emit_data(imm32, rspec, 0); } @@ -3675,14 +3681,14 @@ void Assembler::cmp_literal32(Address src1, int32_t imm32, RelocationHolder cons // into rdx:rax. The ZF is set if the compared values were equal, and cleared otherwise. void Assembler::cmpxchg8(Address adr) { InstructionMark im(this); - emit_byte(0x0F); - emit_byte(0xc7); + emit_int8(0x0F); + emit_int8((unsigned char)0xC7); emit_operand(rcx, adr); } void Assembler::decl(Register dst) { // Don't use it directly. Use MacroAssembler::decrementl() instead. - emit_byte(0x48 | dst->encoding()); + emit_int8(0x48 | dst->encoding()); } #endif // _LP64 @@ -3690,8 +3696,8 @@ void Assembler::decl(Register dst) { // 64bit typically doesn't use the x87 but needs to for the trig funcs void Assembler::fabs() { - emit_byte(0xD9); - emit_byte(0xE1); + emit_int8((unsigned char)0xD9); + emit_int8((unsigned char)0xE1); } void Assembler::fadd(int i) { @@ -3700,13 +3706,13 @@ void Assembler::fadd(int i) { void Assembler::fadd_d(Address src) { InstructionMark im(this); - emit_byte(0xDC); + emit_int8((unsigned char)0xDC); emit_operand32(rax, src); } void Assembler::fadd_s(Address src) { InstructionMark im(this); - emit_byte(0xD8); + emit_int8((unsigned char)0xD8); emit_operand32(rax, src); } @@ -3719,8 +3725,8 @@ void Assembler::faddp(int i) { } void Assembler::fchs() { - emit_byte(0xD9); - emit_byte(0xE0); + emit_int8((unsigned char)0xD9); + emit_int8((unsigned char)0xE0); } void Assembler::fcom(int i) { @@ -3733,29 +3739,29 @@ void Assembler::fcomp(int i) { void Assembler::fcomp_d(Address src) { InstructionMark im(this); - emit_byte(0xDC); + emit_int8((unsigned char)0xDC); emit_operand32(rbx, src); } void Assembler::fcomp_s(Address src) { InstructionMark im(this); - emit_byte(0xD8); + emit_int8((unsigned char)0xD8); emit_operand32(rbx, src); } void Assembler::fcompp() { - emit_byte(0xDE); - emit_byte(0xD9); + emit_int8((unsigned char)0xDE); + emit_int8((unsigned char)0xD9); } void Assembler::fcos() { - emit_byte(0xD9); - emit_byte(0xFF); + emit_int8((unsigned char)0xD9); + emit_int8((unsigned char)0xFF); } void Assembler::fdecstp() { - emit_byte(0xD9); - emit_byte(0xF6); + emit_int8((unsigned char)0xD9); + emit_int8((unsigned char)0xF6); } void Assembler::fdiv(int i) { @@ -3764,13 +3770,13 @@ void Assembler::fdiv(int i) { void Assembler::fdiv_d(Address src) { InstructionMark im(this); - emit_byte(0xDC); + emit_int8((unsigned char)0xDC); emit_operand32(rsi, src); } void Assembler::fdiv_s(Address src) { InstructionMark im(this); - emit_byte(0xD8); + emit_int8((unsigned char)0xD8); emit_operand32(rsi, src); } @@ -3791,13 +3797,13 @@ void Assembler::fdivr(int i) { void Assembler::fdivr_d(Address src) { InstructionMark im(this); - emit_byte(0xDC); + emit_int8((unsigned char)0xDC); emit_operand32(rdi, src); } void Assembler::fdivr_s(Address src) { InstructionMark im(this); - emit_byte(0xD8); + emit_int8((unsigned char)0xD8); emit_operand32(rdi, src); } @@ -3815,59 +3821,59 @@ void Assembler::ffree(int i) { void Assembler::fild_d(Address adr) { InstructionMark im(this); - emit_byte(0xDF); + emit_int8((unsigned char)0xDF); emit_operand32(rbp, adr); } void Assembler::fild_s(Address adr) { InstructionMark im(this); - emit_byte(0xDB); + emit_int8((unsigned char)0xDB); emit_operand32(rax, adr); } void Assembler::fincstp() { - emit_byte(0xD9); - emit_byte(0xF7); + emit_int8((unsigned char)0xD9); + emit_int8((unsigned char)0xF7); } void Assembler::finit() { - emit_byte(0x9B); - emit_byte(0xDB); - emit_byte(0xE3); + emit_int8((unsigned char)0x9B); + emit_int8((unsigned char)0xDB); + emit_int8((unsigned char)0xE3); } void Assembler::fist_s(Address adr) { InstructionMark im(this); - emit_byte(0xDB); + emit_int8((unsigned char)0xDB); emit_operand32(rdx, adr); } void Assembler::fistp_d(Address adr) { InstructionMark im(this); - emit_byte(0xDF); + emit_int8((unsigned char)0xDF); emit_operand32(rdi, adr); } void Assembler::fistp_s(Address adr) { InstructionMark im(this); - emit_byte(0xDB); + emit_int8((unsigned char)0xDB); emit_operand32(rbx, adr); } void Assembler::fld1() { - emit_byte(0xD9); - emit_byte(0xE8); + emit_int8((unsigned char)0xD9); + emit_int8((unsigned char)0xE8); } void Assembler::fld_d(Address adr) { InstructionMark im(this); - emit_byte(0xDD); + emit_int8((unsigned char)0xDD); emit_operand32(rax, adr); } void Assembler::fld_s(Address adr) { InstructionMark im(this); - emit_byte(0xD9); + emit_int8((unsigned char)0xD9); emit_operand32(rax, adr); } @@ -3878,35 +3884,35 @@ void Assembler::fld_s(int index) { void Assembler::fld_x(Address adr) { InstructionMark im(this); - emit_byte(0xDB); + emit_int8((unsigned char)0xDB); emit_operand32(rbp, adr); } void Assembler::fldcw(Address src) { InstructionMark im(this); - emit_byte(0xd9); + emit_int8((unsigned char)0xD9); emit_operand32(rbp, src); } void Assembler::fldenv(Address src) { InstructionMark im(this); - emit_byte(0xD9); + emit_int8((unsigned char)0xD9); emit_operand32(rsp, src); } void Assembler::fldlg2() { - emit_byte(0xD9); - emit_byte(0xEC); + emit_int8((unsigned char)0xD9); + emit_int8((unsigned char)0xEC); } void Assembler::fldln2() { - emit_byte(0xD9); - emit_byte(0xED); + emit_int8((unsigned char)0xD9); + emit_int8((unsigned char)0xED); } void Assembler::fldz() { - emit_byte(0xD9); - emit_byte(0xEE); + emit_int8((unsigned char)0xD9); + emit_int8((unsigned char)0xEE); } void Assembler::flog() { @@ -3927,13 +3933,13 @@ void Assembler::fmul(int i) { void Assembler::fmul_d(Address src) { InstructionMark im(this); - emit_byte(0xDC); + emit_int8((unsigned char)0xDC); emit_operand32(rcx, src); } void Assembler::fmul_s(Address src) { InstructionMark im(this); - emit_byte(0xD8); + emit_int8((unsigned char)0xD8); emit_operand32(rcx, src); } @@ -3947,63 +3953,63 @@ void Assembler::fmulp(int i) { void Assembler::fnsave(Address dst) { InstructionMark im(this); - emit_byte(0xDD); + emit_int8((unsigned char)0xDD); emit_operand32(rsi, dst); } void Assembler::fnstcw(Address src) { InstructionMark im(this); - emit_byte(0x9B); - emit_byte(0xD9); + emit_int8((unsigned char)0x9B); + emit_int8((unsigned char)0xD9); emit_operand32(rdi, src); } void Assembler::fnstsw_ax() { - emit_byte(0xdF); - emit_byte(0xE0); + emit_int8((unsigned char)0xDF); + emit_int8((unsigned char)0xE0); } void Assembler::fprem() { - emit_byte(0xD9); - emit_byte(0xF8); + emit_int8((unsigned char)0xD9); + emit_int8((unsigned char)0xF8); } void Assembler::fprem1() { - emit_byte(0xD9); - emit_byte(0xF5); + emit_int8((unsigned char)0xD9); + emit_int8((unsigned char)0xF5); } void Assembler::frstor(Address src) { InstructionMark im(this); - emit_byte(0xDD); + emit_int8((unsigned char)0xDD); emit_operand32(rsp, src); } void Assembler::fsin() { - emit_byte(0xD9); - emit_byte(0xFE); + emit_int8((unsigned char)0xD9); + emit_int8((unsigned char)0xFE); } void Assembler::fsqrt() { - emit_byte(0xD9); - emit_byte(0xFA); + emit_int8((unsigned char)0xD9); + emit_int8((unsigned char)0xFA); } void Assembler::fst_d(Address adr) { InstructionMark im(this); - emit_byte(0xDD); + emit_int8((unsigned char)0xDD); emit_operand32(rdx, adr); } void Assembler::fst_s(Address adr) { InstructionMark im(this); - emit_byte(0xD9); + emit_int8((unsigned char)0xD9); emit_operand32(rdx, adr); } void Assembler::fstp_d(Address adr) { InstructionMark im(this); - emit_byte(0xDD); + emit_int8((unsigned char)0xDD); emit_operand32(rbx, adr); } @@ -4013,13 +4019,13 @@ void Assembler::fstp_d(int index) { void Assembler::fstp_s(Address adr) { InstructionMark im(this); - emit_byte(0xD9); + emit_int8((unsigned char)0xD9); emit_operand32(rbx, adr); } void Assembler::fstp_x(Address adr) { InstructionMark im(this); - emit_byte(0xDB); + emit_int8((unsigned char)0xDB); emit_operand32(rdi, adr); } @@ -4029,13 +4035,13 @@ void Assembler::fsub(int i) { void Assembler::fsub_d(Address src) { InstructionMark im(this); - emit_byte(0xDC); + emit_int8((unsigned char)0xDC); emit_operand32(rsp, src); } void Assembler::fsub_s(Address src) { InstructionMark im(this); - emit_byte(0xD8); + emit_int8((unsigned char)0xD8); emit_operand32(rsp, src); } @@ -4053,13 +4059,13 @@ void Assembler::fsubr(int i) { void Assembler::fsubr_d(Address src) { InstructionMark im(this); - emit_byte(0xDC); + emit_int8((unsigned char)0xDC); emit_operand32(rbp, src); } void Assembler::fsubr_s(Address src) { InstructionMark im(this); - emit_byte(0xD8); + emit_int8((unsigned char)0xD8); emit_operand32(rbp, src); } @@ -4072,15 +4078,15 @@ void Assembler::fsubrp(int i) { } void Assembler::ftan() { - emit_byte(0xD9); - emit_byte(0xF2); - emit_byte(0xDD); - emit_byte(0xD8); + emit_int8((unsigned char)0xD9); + emit_int8((unsigned char)0xF2); + emit_int8((unsigned char)0xDD); + emit_int8((unsigned char)0xD8); } void Assembler::ftst() { - emit_byte(0xD9); - emit_byte(0xE4); + emit_int8((unsigned char)0xD9); + emit_int8((unsigned char)0xE4); } void Assembler::fucomi(int i) { @@ -4096,7 +4102,7 @@ void Assembler::fucomip(int i) { } void Assembler::fwait() { - emit_byte(0x9B); + emit_int8((unsigned char)0x9B); } void Assembler::fxch(int i) { @@ -4104,23 +4110,23 @@ void Assembler::fxch(int i) { } void Assembler::fyl2x() { - emit_byte(0xD9); - emit_byte(0xF1); + emit_int8((unsigned char)0xD9); + emit_int8((unsigned char)0xF1); } void Assembler::frndint() { - emit_byte(0xD9); - emit_byte(0xFC); + emit_int8((unsigned char)0xD9); + emit_int8((unsigned char)0xFC); } void Assembler::f2xm1() { - emit_byte(0xD9); - emit_byte(0xF0); + emit_int8((unsigned char)0xD9); + emit_int8((unsigned char)0xF0); } void Assembler::fldl2e() { - emit_byte(0xD9); - emit_byte(0xEA); + emit_int8((unsigned char)0xD9); + emit_int8((unsigned char)0xEA); } // SSE SIMD prefix byte values corresponding to VexSimdPrefix encoding. @@ -4131,7 +4137,7 @@ static int simd_opc[4] = { 0, 0, 0x38, 0x3A }; // Generate SSE legacy REX prefix and SIMD opcode based on VEX encoding. void Assembler::rex_prefix(Address adr, XMMRegister xreg, VexSimdPrefix pre, VexOpcode opc, bool rex_w) { if (pre > 0) { - emit_byte(simd_pre[pre]); + emit_int8(simd_pre[pre]); } if (rex_w) { prefixq(adr, xreg); @@ -4139,25 +4145,25 @@ void Assembler::rex_prefix(Address adr, XMMRegister xreg, VexSimdPrefix pre, Vex prefix(adr, xreg); } if (opc > 0) { - emit_byte(0x0F); + emit_int8(0x0F); int opc2 = simd_opc[opc]; if (opc2 > 0) { - emit_byte(opc2); + emit_int8(opc2); } } } int Assembler::rex_prefix_and_encode(int dst_enc, int src_enc, VexSimdPrefix pre, VexOpcode opc, bool rex_w) { if (pre > 0) { - emit_byte(simd_pre[pre]); + emit_int8(simd_pre[pre]); } int encode = (rex_w) ? prefixq_and_encode(dst_enc, src_enc) : prefix_and_encode(dst_enc, src_enc); if (opc > 0) { - emit_byte(0x0F); + emit_int8(0x0F); int opc2 = simd_opc[opc]; if (opc2 > 0) { - emit_byte(opc2); + emit_int8(opc2); } } return encode; @@ -4171,11 +4177,11 @@ void Assembler::vex_prefix(bool vex_r, bool vex_b, bool vex_x, bool vex_w, int n int byte1 = (vex_r ? VEX_R : 0) | (vex_x ? VEX_X : 0) | (vex_b ? VEX_B : 0); byte1 = (~byte1) & 0xE0; byte1 |= opc; - a_byte(byte1); + emit_int8(byte1); int byte2 = ((~nds_enc) & 0xf) << 3; byte2 |= (vex_w ? VEX_W : 0) | (vector256 ? 4 : 0) | pre; - emit_byte(byte2); + emit_int8(byte2); } else { prefix(VEX_2bytes); @@ -4183,7 +4189,7 @@ void Assembler::vex_prefix(bool vex_r, bool vex_b, bool vex_x, bool vex_w, int n byte1 = (~byte1) & 0x80; byte1 |= ((~nds_enc) & 0xf) << 3; byte1 |= (vector256 ? 4 : 0) | pre; - emit_byte(byte1); + emit_int8(byte1); } } @@ -4229,28 +4235,28 @@ int Assembler::simd_prefix_and_encode(XMMRegister dst, XMMRegister nds, XMMRegis void Assembler::emit_simd_arith(int opcode, XMMRegister dst, Address src, VexSimdPrefix pre) { InstructionMark im(this); simd_prefix(dst, dst, src, pre); - emit_byte(opcode); + emit_int8(opcode); emit_operand(dst, src); } void Assembler::emit_simd_arith(int opcode, XMMRegister dst, XMMRegister src, VexSimdPrefix pre) { int encode = simd_prefix_and_encode(dst, dst, src, pre); - emit_byte(opcode); - emit_byte(0xC0 | encode); + emit_int8(opcode); + emit_int8((unsigned char)(0xC0 | encode)); } // Versions with no second source register (non-destructive source). void Assembler::emit_simd_arith_nonds(int opcode, XMMRegister dst, Address src, VexSimdPrefix pre) { InstructionMark im(this); simd_prefix(dst, xnoreg, src, pre); - emit_byte(opcode); + emit_int8(opcode); emit_operand(dst, src); } void Assembler::emit_simd_arith_nonds(int opcode, XMMRegister dst, XMMRegister src, VexSimdPrefix pre) { int encode = simd_prefix_and_encode(dst, xnoreg, src, pre); - emit_byte(opcode); - emit_byte(0xC0 | encode); + emit_int8(opcode); + emit_int8((unsigned char)(0xC0 | encode)); } // 3-operands AVX instructions @@ -4258,22 +4264,22 @@ void Assembler::emit_vex_arith(int opcode, XMMRegister dst, XMMRegister nds, Address src, VexSimdPrefix pre, bool vector256) { InstructionMark im(this); vex_prefix(dst, nds, src, pre, vector256); - emit_byte(opcode); + emit_int8(opcode); emit_operand(dst, src); } void Assembler::emit_vex_arith(int opcode, XMMRegister dst, XMMRegister nds, XMMRegister src, VexSimdPrefix pre, bool vector256) { int encode = vex_prefix_and_encode(dst, nds, src, pre, vector256); - emit_byte(opcode); - emit_byte(0xC0 | encode); + emit_int8(opcode); + emit_int8((unsigned char)(0xC0 | encode)); } #ifndef _LP64 void Assembler::incl(Register dst) { // Don't use it directly. Use MacroAssembler::incrementl() instead. - emit_byte(0x40 | dst->encoding()); + emit_int8(0x40 | dst->encoding()); } void Assembler::lea(Register dst, Address src) { @@ -4282,7 +4288,7 @@ void Assembler::lea(Register dst, Address src) { void Assembler::mov_literal32(Address dst, int32_t imm32, RelocationHolder const& rspec) { InstructionMark im(this); - emit_byte(0xC7); + emit_int8((unsigned char)0xC7); emit_operand(rax, dst); emit_data((int)imm32, rspec, 0); } @@ -4290,49 +4296,49 @@ void Assembler::mov_literal32(Address dst, int32_t imm32, RelocationHolder cons void Assembler::mov_literal32(Register dst, int32_t imm32, RelocationHolder const& rspec) { InstructionMark im(this); int encode = prefix_and_encode(dst->encoding()); - emit_byte(0xB8 | encode); + emit_int8((unsigned char)(0xB8 | encode)); emit_data((int)imm32, rspec, 0); } void Assembler::popa() { // 32bit - emit_byte(0x61); + emit_int8(0x61); } void Assembler::push_literal32(int32_t imm32, RelocationHolder const& rspec) { InstructionMark im(this); - emit_byte(0x68); + emit_int8(0x68); emit_data(imm32, rspec, 0); } void Assembler::pusha() { // 32bit - emit_byte(0x60); + emit_int8(0x60); } void Assembler::set_byte_if_not_zero(Register dst) { - emit_byte(0x0F); - emit_byte(0x95); - emit_byte(0xE0 | dst->encoding()); + emit_int8(0x0F); + emit_int8((unsigned char)0x95); + emit_int8((unsigned char)(0xE0 | dst->encoding())); } void Assembler::shldl(Register dst, Register src) { - emit_byte(0x0F); - emit_byte(0xA5); - emit_byte(0xC0 | src->encoding() << 3 | dst->encoding()); + emit_int8(0x0F); + emit_int8((unsigned char)0xA5); + emit_int8((unsigned char)(0xC0 | src->encoding() << 3 | dst->encoding())); } void Assembler::shrdl(Register dst, Register src) { - emit_byte(0x0F); - emit_byte(0xAD); - emit_byte(0xC0 | src->encoding() << 3 | dst->encoding()); + emit_int8(0x0F); + emit_int8((unsigned char)0xAD); + emit_int8((unsigned char)(0xC0 | src->encoding() << 3 | dst->encoding())); } #else // LP64 void Assembler::set_byte_if_not_zero(Register dst) { int enc = prefix_and_encode(dst->encoding(), true); - emit_byte(0x0F); - emit_byte(0x95); - emit_byte(0xE0 | enc); + emit_int8(0x0F); + emit_int8((unsigned char)0x95); + emit_int8((unsigned char)(0xE0 | enc)); } // 64bit only pieces of the assembler @@ -4670,7 +4676,7 @@ void Assembler::adcq(Register dst, int32_t imm32) { void Assembler::adcq(Register dst, Address src) { InstructionMark im(this); prefixq(src, dst); - emit_byte(0x13); + emit_int8(0x13); emit_operand(dst, src); } @@ -4688,7 +4694,7 @@ void Assembler::addq(Address dst, int32_t imm32) { void Assembler::addq(Address dst, Register src) { InstructionMark im(this); prefixq(dst, src); - emit_byte(0x01); + emit_int8(0x01); emit_operand(src, dst); } @@ -4700,7 +4706,7 @@ void Assembler::addq(Register dst, int32_t imm32) { void Assembler::addq(Register dst, Address src) { InstructionMark im(this); prefixq(src, dst); - emit_byte(0x03); + emit_int8(0x03); emit_operand(dst, src); } @@ -4712,7 +4718,7 @@ void Assembler::addq(Register dst, Register src) { void Assembler::andq(Address dst, int32_t imm32) { InstructionMark im(this); prefixq(dst); - emit_byte(0x81); + emit_int8((unsigned char)0x81); emit_operand(rsp, dst, 4); emit_long(imm32); } @@ -4725,7 +4731,7 @@ void Assembler::andq(Register dst, int32_t imm32) { void Assembler::andq(Register dst, Address src) { InstructionMark im(this); prefixq(src, dst); - emit_byte(0x23); + emit_int8(0x23); emit_operand(dst, src); } @@ -4736,56 +4742,56 @@ void Assembler::andq(Register dst, Register src) { void Assembler::bsfq(Register dst, Register src) { int encode = prefixq_and_encode(dst->encoding(), src->encoding()); - emit_byte(0x0F); - emit_byte(0xBC); - emit_byte(0xC0 | encode); + emit_int8(0x0F); + emit_int8((unsigned char)0xBC); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::bsrq(Register dst, Register src) { assert(!VM_Version::supports_lzcnt(), "encoding is treated as LZCNT"); int encode = prefixq_and_encode(dst->encoding(), src->encoding()); - emit_byte(0x0F); - emit_byte(0xBD); - emit_byte(0xC0 | encode); + emit_int8(0x0F); + emit_int8((unsigned char)0xBD); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::bswapq(Register reg) { int encode = prefixq_and_encode(reg->encoding()); - emit_byte(0x0F); - emit_byte(0xC8 | encode); + emit_int8(0x0F); + emit_int8((unsigned char)(0xC8 | encode)); } void Assembler::cdqq() { prefix(REX_W); - emit_byte(0x99); + emit_int8((unsigned char)0x99); } void Assembler::clflush(Address adr) { prefix(adr); - emit_byte(0x0F); - emit_byte(0xAE); + emit_int8(0x0F); + emit_int8((unsigned char)0xAE); emit_operand(rdi, adr); } void Assembler::cmovq(Condition cc, Register dst, Register src) { int encode = prefixq_and_encode(dst->encoding(), src->encoding()); - emit_byte(0x0F); - emit_byte(0x40 | cc); - emit_byte(0xC0 | encode); + emit_int8(0x0F); + emit_int8(0x40 | cc); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::cmovq(Condition cc, Register dst, Address src) { InstructionMark im(this); prefixq(src, dst); - emit_byte(0x0F); - emit_byte(0x40 | cc); + emit_int8(0x0F); + emit_int8(0x40 | cc); emit_operand(dst, src); } void Assembler::cmpq(Address dst, int32_t imm32) { InstructionMark im(this); prefixq(dst); - emit_byte(0x81); + emit_int8((unsigned char)0x81); emit_operand(rdi, dst, 4); emit_long(imm32); } @@ -4798,7 +4804,7 @@ void Assembler::cmpq(Register dst, int32_t imm32) { void Assembler::cmpq(Address dst, Register src) { InstructionMark im(this); prefixq(dst, src); - emit_byte(0x3B); + emit_int8(0x3B); emit_operand(src, dst); } @@ -4810,122 +4816,122 @@ void Assembler::cmpq(Register dst, Register src) { void Assembler::cmpq(Register dst, Address src) { InstructionMark im(this); prefixq(src, dst); - emit_byte(0x3B); + emit_int8(0x3B); emit_operand(dst, src); } void Assembler::cmpxchgq(Register reg, Address adr) { InstructionMark im(this); prefixq(adr, reg); - emit_byte(0x0F); - emit_byte(0xB1); + emit_int8(0x0F); + emit_int8((unsigned char)0xB1); emit_operand(reg, adr); } void Assembler::cvtsi2sdq(XMMRegister dst, Register src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); int encode = simd_prefix_and_encode_q(dst, dst, src, VEX_SIMD_F2); - emit_byte(0x2A); - emit_byte(0xC0 | encode); + emit_int8(0x2A); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::cvtsi2sdq(XMMRegister dst, Address src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionMark im(this); simd_prefix_q(dst, dst, src, VEX_SIMD_F2); - emit_byte(0x2A); + emit_int8(0x2A); emit_operand(dst, src); } void Assembler::cvtsi2ssq(XMMRegister dst, Register src) { NOT_LP64(assert(VM_Version::supports_sse(), "")); int encode = simd_prefix_and_encode_q(dst, dst, src, VEX_SIMD_F3); - emit_byte(0x2A); - emit_byte(0xC0 | encode); + emit_int8(0x2A); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::cvtsi2ssq(XMMRegister dst, Address src) { NOT_LP64(assert(VM_Version::supports_sse(), "")); InstructionMark im(this); simd_prefix_q(dst, dst, src, VEX_SIMD_F3); - emit_byte(0x2A); + emit_int8(0x2A); emit_operand(dst, src); } void Assembler::cvttsd2siq(Register dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); int encode = simd_prefix_and_encode_q(dst, src, VEX_SIMD_F2); - emit_byte(0x2C); - emit_byte(0xC0 | encode); + emit_int8(0x2C); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::cvttss2siq(Register dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse(), "")); int encode = simd_prefix_and_encode_q(dst, src, VEX_SIMD_F3); - emit_byte(0x2C); - emit_byte(0xC0 | encode); + emit_int8(0x2C); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::decl(Register dst) { // Don't use it directly. Use MacroAssembler::decrementl() instead. // Use two-byte form (one-byte form is a REX prefix in 64-bit mode) int encode = prefix_and_encode(dst->encoding()); - emit_byte(0xFF); - emit_byte(0xC8 | encode); + emit_int8((unsigned char)0xFF); + emit_int8((unsigned char)(0xC8 | encode)); } void Assembler::decq(Register dst) { // Don't use it directly. Use MacroAssembler::decrementq() instead. // Use two-byte form (one-byte from is a REX prefix in 64-bit mode) int encode = prefixq_and_encode(dst->encoding()); - emit_byte(0xFF); - emit_byte(0xC8 | encode); + emit_int8((unsigned char)0xFF); + emit_int8(0xC8 | encode); } void Assembler::decq(Address dst) { // Don't use it directly. Use MacroAssembler::decrementq() instead. InstructionMark im(this); prefixq(dst); - emit_byte(0xFF); + emit_int8((unsigned char)0xFF); emit_operand(rcx, dst); } void Assembler::fxrstor(Address src) { prefixq(src); - emit_byte(0x0F); - emit_byte(0xAE); + emit_int8(0x0F); + emit_int8((unsigned char)0xAE); emit_operand(as_Register(1), src); } void Assembler::fxsave(Address dst) { prefixq(dst); - emit_byte(0x0F); - emit_byte(0xAE); + emit_int8(0x0F); + emit_int8((unsigned char)0xAE); emit_operand(as_Register(0), dst); } void Assembler::idivq(Register src) { int encode = prefixq_and_encode(src->encoding()); - emit_byte(0xF7); - emit_byte(0xF8 | encode); + emit_int8((unsigned char)0xF7); + emit_int8((unsigned char)(0xF8 | encode)); } void Assembler::imulq(Register dst, Register src) { int encode = prefixq_and_encode(dst->encoding(), src->encoding()); - emit_byte(0x0F); - emit_byte(0xAF); - emit_byte(0xC0 | encode); + emit_int8(0x0F); + emit_int8((unsigned char)0xAF); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::imulq(Register dst, Register src, int value) { int encode = prefixq_and_encode(dst->encoding(), src->encoding()); if (is8bit(value)) { - emit_byte(0x6B); - emit_byte(0xC0 | encode); - emit_byte(value & 0xFF); + emit_int8(0x6B); + emit_int8((unsigned char)(0xC0 | encode)); + emit_int8(value & 0xFF); } else { - emit_byte(0x69); - emit_byte(0xC0 | encode); + emit_int8(0x69); + emit_int8((unsigned char)(0xC0 | encode)); emit_long(value); } } @@ -4934,23 +4940,23 @@ void Assembler::incl(Register dst) { // Don't use it directly. Use MacroAssembler::incrementl() instead. // Use two-byte form (one-byte from is a REX prefix in 64-bit mode) int encode = prefix_and_encode(dst->encoding()); - emit_byte(0xFF); - emit_byte(0xC0 | encode); + emit_int8((unsigned char)0xFF); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::incq(Register dst) { // Don't use it directly. Use MacroAssembler::incrementq() instead. // Use two-byte form (one-byte from is a REX prefix in 64-bit mode) int encode = prefixq_and_encode(dst->encoding()); - emit_byte(0xFF); - emit_byte(0xC0 | encode); + emit_int8((unsigned char)0xFF); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::incq(Address dst) { // Don't use it directly. Use MacroAssembler::incrementq() instead. InstructionMark im(this); prefixq(dst); - emit_byte(0xFF); + emit_int8((unsigned char)0xFF); emit_operand(rax, dst); } @@ -4961,35 +4967,35 @@ void Assembler::lea(Register dst, Address src) { void Assembler::leaq(Register dst, Address src) { InstructionMark im(this); prefixq(src, dst); - emit_byte(0x8D); + emit_int8((unsigned char)0x8D); emit_operand(dst, src); } void Assembler::mov64(Register dst, int64_t imm64) { InstructionMark im(this); int encode = prefixq_and_encode(dst->encoding()); - emit_byte(0xB8 | encode); + emit_int8((unsigned char)(0xB8 | encode)); emit_int64(imm64); } void Assembler::mov_literal64(Register dst, intptr_t imm64, RelocationHolder const& rspec) { InstructionMark im(this); int encode = prefixq_and_encode(dst->encoding()); - emit_byte(0xB8 | encode); + emit_int8(0xB8 | encode); emit_data64(imm64, rspec); } void Assembler::mov_narrow_oop(Register dst, int32_t imm32, RelocationHolder const& rspec) { InstructionMark im(this); int encode = prefix_and_encode(dst->encoding()); - emit_byte(0xB8 | encode); + emit_int8((unsigned char)(0xB8 | encode)); emit_data((int)imm32, rspec, narrow_oop_operand); } void Assembler::mov_narrow_oop(Address dst, int32_t imm32, RelocationHolder const& rspec) { InstructionMark im(this); prefix(dst); - emit_byte(0xC7); + emit_int8((unsigned char)0xC7); emit_operand(rax, dst, 4); emit_data((int)imm32, rspec, narrow_oop_operand); } @@ -4997,34 +5003,34 @@ void Assembler::mov_narrow_oop(Address dst, int32_t imm32, RelocationHolder con void Assembler::cmp_narrow_oop(Register src1, int32_t imm32, RelocationHolder const& rspec) { InstructionMark im(this); int encode = prefix_and_encode(src1->encoding()); - emit_byte(0x81); - emit_byte(0xF8 | encode); + emit_int8((unsigned char)0x81); + emit_int8((unsigned char)(0xF8 | encode)); emit_data((int)imm32, rspec, narrow_oop_operand); } void Assembler::cmp_narrow_oop(Address src1, int32_t imm32, RelocationHolder const& rspec) { InstructionMark im(this); prefix(src1); - emit_byte(0x81); + emit_int8((unsigned char)0x81); emit_operand(rax, src1, 4); emit_data((int)imm32, rspec, narrow_oop_operand); } void Assembler::lzcntq(Register dst, Register src) { assert(VM_Version::supports_lzcnt(), "encoding is treated as BSR"); - emit_byte(0xF3); + emit_int8((unsigned char)0xF3); int encode = prefixq_and_encode(dst->encoding(), src->encoding()); - emit_byte(0x0F); - emit_byte(0xBD); - emit_byte(0xC0 | encode); + emit_int8(0x0F); + emit_int8((unsigned char)0xBD); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::movdq(XMMRegister dst, Register src) { // table D-1 says MMX/SSE2 NOT_LP64(assert(VM_Version::supports_sse2(), "")); int encode = simd_prefix_and_encode_q(dst, src, VEX_SIMD_66); - emit_byte(0x6E); - emit_byte(0xC0 | encode); + emit_int8(0x6E); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::movdq(Register dst, XMMRegister src) { @@ -5032,43 +5038,43 @@ void Assembler::movdq(Register dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); // swap src/dst to get correct prefix int encode = simd_prefix_and_encode_q(src, dst, VEX_SIMD_66); - emit_byte(0x7E); - emit_byte(0xC0 | encode); + emit_int8(0x7E); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::movq(Register dst, Register src) { int encode = prefixq_and_encode(dst->encoding(), src->encoding()); - emit_byte(0x8B); - emit_byte(0xC0 | encode); + emit_int8((unsigned char)0x8B); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::movq(Register dst, Address src) { InstructionMark im(this); prefixq(src, dst); - emit_byte(0x8B); + emit_int8((unsigned char)0x8B); emit_operand(dst, src); } void Assembler::movq(Address dst, Register src) { InstructionMark im(this); prefixq(dst, src); - emit_byte(0x89); + emit_int8((unsigned char)0x89); emit_operand(src, dst); } void Assembler::movsbq(Register dst, Address src) { InstructionMark im(this); prefixq(src, dst); - emit_byte(0x0F); - emit_byte(0xBE); + emit_int8(0x0F); + emit_int8((unsigned char)0xBE); emit_operand(dst, src); } void Assembler::movsbq(Register dst, Register src) { int encode = prefixq_and_encode(dst->encoding(), src->encoding()); - emit_byte(0x0F); - emit_byte(0xBE); - emit_byte(0xC0 | encode); + emit_int8(0x0F); + emit_int8((unsigned char)0xBE); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::movslq(Register dst, int32_t imm32) { @@ -5078,7 +5084,7 @@ void Assembler::movslq(Register dst, int32_t imm32) { ShouldNotReachHere(); InstructionMark im(this); int encode = prefixq_and_encode(dst->encoding()); - emit_byte(0xC7 | encode); + emit_int8((unsigned char)(0xC7 | encode)); emit_long(imm32); } @@ -5086,7 +5092,7 @@ void Assembler::movslq(Address dst, int32_t imm32) { assert(is_simm32(imm32), "lost bits"); InstructionMark im(this); prefixq(dst); - emit_byte(0xC7); + emit_int8((unsigned char)0xC7); emit_operand(rax, dst, 4); emit_long(imm32); } @@ -5094,77 +5100,77 @@ void Assembler::movslq(Address dst, int32_t imm32) { void Assembler::movslq(Register dst, Address src) { InstructionMark im(this); prefixq(src, dst); - emit_byte(0x63); + emit_int8(0x63); emit_operand(dst, src); } void Assembler::movslq(Register dst, Register src) { int encode = prefixq_and_encode(dst->encoding(), src->encoding()); - emit_byte(0x63); - emit_byte(0xC0 | encode); + emit_int8(0x63); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::movswq(Register dst, Address src) { InstructionMark im(this); prefixq(src, dst); - emit_byte(0x0F); - emit_byte(0xBF); + emit_int8(0x0F); + emit_int8((unsigned char)0xBF); emit_operand(dst, src); } void Assembler::movswq(Register dst, Register src) { int encode = prefixq_and_encode(dst->encoding(), src->encoding()); - emit_byte(0x0F); - emit_byte(0xBF); - emit_byte(0xC0 | encode); + emit_int8((unsigned char)0x0F); + emit_int8((unsigned char)0xBF); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::movzbq(Register dst, Address src) { InstructionMark im(this); prefixq(src, dst); - emit_byte(0x0F); - emit_byte(0xB6); + emit_int8((unsigned char)0x0F); + emit_int8((unsigned char)0xB6); emit_operand(dst, src); } void Assembler::movzbq(Register dst, Register src) { int encode = prefixq_and_encode(dst->encoding(), src->encoding()); - emit_byte(0x0F); - emit_byte(0xB6); - emit_byte(0xC0 | encode); + emit_int8(0x0F); + emit_int8((unsigned char)0xB6); + emit_int8(0xC0 | encode); } void Assembler::movzwq(Register dst, Address src) { InstructionMark im(this); prefixq(src, dst); - emit_byte(0x0F); - emit_byte(0xB7); + emit_int8((unsigned char)0x0F); + emit_int8((unsigned char)0xB7); emit_operand(dst, src); } void Assembler::movzwq(Register dst, Register src) { int encode = prefixq_and_encode(dst->encoding(), src->encoding()); - emit_byte(0x0F); - emit_byte(0xB7); - emit_byte(0xC0 | encode); + emit_int8((unsigned char)0x0F); + emit_int8((unsigned char)0xB7); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::negq(Register dst) { int encode = prefixq_and_encode(dst->encoding()); - emit_byte(0xF7); - emit_byte(0xD8 | encode); + emit_int8((unsigned char)0xF7); + emit_int8((unsigned char)(0xD8 | encode)); } void Assembler::notq(Register dst) { int encode = prefixq_and_encode(dst->encoding()); - emit_byte(0xF7); - emit_byte(0xD0 | encode); + emit_int8((unsigned char)0xF7); + emit_int8((unsigned char)(0xD0 | encode)); } void Assembler::orq(Address dst, int32_t imm32) { InstructionMark im(this); prefixq(dst); - emit_byte(0x81); + emit_int8((unsigned char)0x81); emit_operand(rcx, dst, 4); emit_long(imm32); } @@ -5177,7 +5183,7 @@ void Assembler::orq(Register dst, int32_t imm32) { void Assembler::orq(Register dst, Address src) { InstructionMark im(this); prefixq(src, dst); - emit_byte(0x0B); + emit_int8(0x0B); emit_operand(dst, src); } @@ -5210,26 +5216,26 @@ void Assembler::popa() { // 64bit void Assembler::popcntq(Register dst, Address src) { assert(VM_Version::supports_popcnt(), "must support"); InstructionMark im(this); - emit_byte(0xF3); + emit_int8((unsigned char)0xF3); prefixq(src, dst); - emit_byte(0x0F); - emit_byte(0xB8); + emit_int8((unsigned char)0x0F); + emit_int8((unsigned char)0xB8); emit_operand(dst, src); } void Assembler::popcntq(Register dst, Register src) { assert(VM_Version::supports_popcnt(), "must support"); - emit_byte(0xF3); + emit_int8((unsigned char)0xF3); int encode = prefixq_and_encode(dst->encoding(), src->encoding()); - emit_byte(0x0F); - emit_byte(0xB8); - emit_byte(0xC0 | encode); + emit_int8((unsigned char)0x0F); + emit_int8((unsigned char)0xB8); + emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::popq(Address dst) { InstructionMark im(this); prefixq(dst); - emit_byte(0x8F); + emit_int8((unsigned char)0x8F); emit_operand(rax, dst); } @@ -5261,7 +5267,7 @@ void Assembler::pusha() { // 64bit void Assembler::pushq(Address src) { InstructionMark im(this); prefixq(src); - emit_byte(0xFF); + emit_int8((unsigned char)0xFF); emit_operand(rsi, src); } @@ -5269,31 +5275,31 @@ void Assembler::rclq(Register dst, int imm8) { assert(isShiftCount(imm8 >> 1), "illegal shift count"); int encode = prefixq_and_encode(dst->encoding()); if (imm8 == 1) { - emit_byte(0xD1); - emit_byte(0xD0 | encode); + emit_int8((unsigned char)0xD1); + emit_int8((unsigned char)(0xD0 | encode)); } else { - emit_byte(0xC1); - emit_byte(0xD0 | encode); - emit_byte(imm8); + emit_int8((unsigned char)0xC1); + emit_int8((unsigned char)(0xD0 | encode)); + emit_int8(imm8); } } void Assembler::sarq(Register dst, int imm8) { assert(isShiftCount(imm8 >> 1), "illegal shift count"); int encode = prefixq_and_encode(dst->encoding()); if (imm8 == 1) { - emit_byte(0xD1); - emit_byte(0xF8 | encode); + emit_int8((unsigned char)0xD1); + emit_int8((unsigned char)(0xF8 | encode)); } else { - emit_byte(0xC1); - emit_byte(0xF8 | encode); - emit_byte(imm8); + emit_int8((unsigned char)0xC1); + emit_int8((unsigned char)(0xF8 | encode)); + emit_int8(imm8); } } void Assembler::sarq(Register dst) { int encode = prefixq_and_encode(dst->encoding()); - emit_byte(0xD3); - emit_byte(0xF8 | encode); + emit_int8((unsigned char)0xD3); + emit_int8((unsigned char)(0xF8 | encode)); } void Assembler::sbbq(Address dst, int32_t imm32) { @@ -5310,7 +5316,7 @@ void Assembler::sbbq(Register dst, int32_t imm32) { void Assembler::sbbq(Register dst, Address src) { InstructionMark im(this); prefixq(src, dst); - emit_byte(0x1B); + emit_int8(0x1B); emit_operand(dst, src); } @@ -5323,33 +5329,33 @@ void Assembler::shlq(Register dst, int imm8) { assert(isShiftCount(imm8 >> 1), "illegal shift count"); int encode = prefixq_and_encode(dst->encoding()); if (imm8 == 1) { - emit_byte(0xD1); - emit_byte(0xE0 | encode); + emit_int8((unsigned char)0xD1); + emit_int8((unsigned char)(0xE0 | encode)); } else { - emit_byte(0xC1); - emit_byte(0xE0 | encode); - emit_byte(imm8); + emit_int8((unsigned char)0xC1); + emit_int8((unsigned char)(0xE0 | encode)); + emit_int8(imm8); } } void Assembler::shlq(Register dst) { int encode = prefixq_and_encode(dst->encoding()); - emit_byte(0xD3); - emit_byte(0xE0 | encode); + emit_int8((unsigned char)0xD3); + emit_int8((unsigned char)(0xE0 | encode)); } void Assembler::shrq(Register dst, int imm8) { assert(isShiftCount(imm8 >> 1), "illegal shift count"); int encode = prefixq_and_encode(dst->encoding()); - emit_byte(0xC1); - emit_byte(0xE8 | encode); - emit_byte(imm8); + emit_int8((unsigned char)0xC1); + emit_int8((unsigned char)(0xE8 | encode)); + emit_int8(imm8); } void Assembler::shrq(Register dst) { int encode = prefixq_and_encode(dst->encoding()); - emit_byte(0xD3); - emit_byte(0xE8 | encode); + emit_int8((unsigned char)0xD3); + emit_int8(0xE8 | encode); } void Assembler::subq(Address dst, int32_t imm32) { @@ -5361,7 +5367,7 @@ void Assembler::subq(Address dst, int32_t imm32) { void Assembler::subq(Address dst, Register src) { InstructionMark im(this); prefixq(dst, src); - emit_byte(0x29); + emit_int8(0x29); emit_operand(src, dst); } @@ -5379,7 +5385,7 @@ void Assembler::subq_imm32(Register dst, int32_t imm32) { void Assembler::subq(Register dst, Address src) { InstructionMark im(this); prefixq(src, dst); - emit_byte(0x2B); + emit_int8(0x2B); emit_operand(dst, src); } @@ -5395,11 +5401,11 @@ void Assembler::testq(Register dst, int32_t imm32) { int encode = dst->encoding(); if (encode == 0) { prefix(REX_W); - emit_byte(0xA9); + emit_int8((unsigned char)0xA9); } else { encode = prefixq_and_encode(encode); - emit_byte(0xF7); - emit_byte(0xC0 | encode); + emit_int8((unsigned char)0xF7); + emit_int8((unsigned char)(0xC0 | encode)); } emit_long(imm32); } @@ -5412,22 +5418,22 @@ void Assembler::testq(Register dst, Register src) { void Assembler::xaddq(Address dst, Register src) { InstructionMark im(this); prefixq(dst, src); - emit_byte(0x0F); - emit_byte(0xC1); + emit_int8(0x0F); + emit_int8((unsigned char)0xC1); emit_operand(src, dst); } void Assembler::xchgq(Register dst, Address src) { InstructionMark im(this); prefixq(src, dst); - emit_byte(0x87); + emit_int8((unsigned char)0x87); emit_operand(dst, src); } void Assembler::xchgq(Register dst, Register src) { int encode = prefixq_and_encode(dst->encoding(), src->encoding()); - emit_byte(0x87); - emit_byte(0xc0 | encode); + emit_int8((unsigned char)0x87); + emit_int8((unsigned char)(0xc0 | encode)); } void Assembler::xorq(Register dst, Register src) { @@ -5438,7 +5444,7 @@ void Assembler::xorq(Register dst, Register src) { void Assembler::xorq(Register dst, Address src) { InstructionMark im(this); prefixq(src, dst); - emit_byte(0x33); + emit_int8(0x33); emit_operand(dst, src); } diff --git a/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp b/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp index be2c1097a45..53c7cbacd1c 100644 --- a/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp +++ b/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp @@ -313,10 +313,10 @@ void PatchingStub::emit_code(LIR_Assembler* ce) { #endif } else { // make a copy the code which is going to be patched. - for ( int i = 0; i < _bytes_to_copy; i++) { + for (int i = 0; i < _bytes_to_copy; i++) { address ptr = (address)(_pc_start + i); int a_byte = (*ptr) & 0xFF; - __ a_byte (a_byte); + __ emit_int8(a_byte); *ptr = 0x90; // make the site look like a nop } } @@ -363,11 +363,11 @@ void PatchingStub::emit_code(LIR_Assembler* ce) { // emit the offsets needed to find the code to patch int being_initialized_entry_offset = __ pc() - being_initialized_entry + sizeof_patch_record; - __ a_byte(0xB8); - __ a_byte(0); - __ a_byte(being_initialized_entry_offset); - __ a_byte(bytes_to_skip); - __ a_byte(_bytes_to_copy); + __ emit_int8((unsigned char)0xB8); + __ emit_int8(0); + __ emit_int8(being_initialized_entry_offset); + __ emit_int8(bytes_to_skip); + __ emit_int8(_bytes_to_copy); address patch_info_pc = __ pc(); assert(patch_info_pc - end_of_patch == bytes_to_skip, "incorrect patch info"); diff --git a/hotspot/src/cpu/x86/vm/cppInterpreter_x86.cpp b/hotspot/src/cpu/x86/vm/cppInterpreter_x86.cpp index 946c400e590..9c3a2f31aeb 100644 --- a/hotspot/src/cpu/x86/vm/cppInterpreter_x86.cpp +++ b/hotspot/src/cpu/x86/vm/cppInterpreter_x86.cpp @@ -611,8 +611,6 @@ void InterpreterGenerator::generate_counter_overflow(Label* do_continue) { // C++ interpreter only // rsi/r13 - previous interpreter state pointer - const Address size_of_parameters(rbx, Method::size_of_parameters_offset()); - // InterpreterRuntime::frequency_counter_overflow takes one argument // indicating if the counter overflow occurs at a backwards branch (non-NULL bcp). // The call returns the address of the verified entry point for the method or NULL @@ -977,15 +975,16 @@ address InterpreterGenerator::generate_native_entry(bool synchronized) { // to save/restore. address entry_point = __ pc(); - const Address size_of_parameters(rbx, Method::size_of_parameters_offset()); - const Address size_of_locals (rbx, Method::size_of_locals_offset()); + const Address constMethod (rbx, Method::const_offset()); const Address invocation_counter(rbx, Method::invocation_counter_offset() + InvocationCounter::counter_offset()); const Address access_flags (rbx, Method::access_flags_offset()); + const Address size_of_parameters(rcx, ConstMethod::size_of_parameters_offset()); // rsi/r13 == state/locals rdi == prevstate const Register locals = rdi; // get parameter size (always needed) + __ movptr(rcx, constMethod); __ load_unsigned_short(rcx, size_of_parameters); // rbx: Method* @@ -994,6 +993,7 @@ address InterpreterGenerator::generate_native_entry(bool synchronized) { // for natives the size of locals is zero // compute beginning of parameters /locals + __ lea(locals, Address(rsp, rcx, Address::times_ptr, -wordSize)); // initialize fixed part of activation frame @@ -1107,11 +1107,14 @@ address InterpreterGenerator::generate_native_entry(bool synchronized) { const Register method = rbx; const Register thread = LP64_ONLY(r15_thread) NOT_LP64(rdi); const Register t = InterpreterRuntime::SignatureHandlerGenerator::temp(); // rcx|rscratch1 + const Address constMethod (method, Method::const_offset()); + const Address size_of_parameters(t, ConstMethod::size_of_parameters_offset()); // allocate space for parameters __ movptr(method, STATE(_method)); __ verify_method_ptr(method); - __ load_unsigned_short(t, Address(method, Method::size_of_parameters_offset())); + __ movptr(t, constMethod); + __ load_unsigned_short(t, size_of_parameters); __ shll(t, 2); #ifdef _LP64 __ subptr(rsp, t); @@ -1700,15 +1703,17 @@ address InterpreterGenerator::generate_normal_entry(bool synchronized) { // save sender sp __ push(rcx); - const Address size_of_parameters(rbx, Method::size_of_parameters_offset()); - const Address size_of_locals (rbx, Method::size_of_locals_offset()); + const Address constMethod (rbx, Method::const_offset()); const Address access_flags (rbx, Method::access_flags_offset()); + const Address size_of_parameters(rdx, ConstMethod::size_of_parameters_offset()); + const Address size_of_locals (rdx, ConstMethod::size_of_locals_offset()); // const Address monitor_block_top (rbp, frame::interpreter_frame_monitor_block_top_offset * wordSize); // const Address monitor_block_bot (rbp, frame::interpreter_frame_initial_sp_offset * wordSize); // const Address monitor(rbp, frame::interpreter_frame_initial_sp_offset * wordSize - (int)sizeof(BasicObjectLock)); // get parameter size (always needed) + __ movptr(rdx, constMethod); __ load_unsigned_short(rcx, size_of_parameters); // rbx: Method* @@ -1989,7 +1994,9 @@ address InterpreterGenerator::generate_normal_entry(bool synchronized) { __ movptr(rbx, STATE(_result._to_call._callee)); // callee left args on top of expression stack, remove them - __ load_unsigned_short(rcx, Address(rbx, Method::size_of_parameters_offset())); + __ movptr(rcx, constMethod); + __ load_unsigned_short(rcx, Address(rcx, ConstMethod::size_of_parameters_offset())); + __ lea(rsp, Address(rsp, rcx, Address::times_ptr)); __ movl(rcx, Address(rbx, Method::result_index_offset())); @@ -2159,7 +2166,9 @@ address InterpreterGenerator::generate_normal_entry(bool synchronized) { // Make it look like call_stub calling conventions // Get (potential) receiver - __ load_unsigned_short(rcx, size_of_parameters); // get size of parameters in words + // get size of parameters in words + __ movptr(rcx, constMethod); + __ load_unsigned_short(rcx, Address(rcx, ConstMethod::size_of_parameters_offset())); ExternalAddress recursive(CAST_FROM_FN_PTR(address, RecursiveInterpreterActivation)); __ pushptr(recursive.addr()); // make it look good in the debugger diff --git a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp index fa2d7fa4376..b9d85636cf8 100644 --- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp +++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp @@ -1023,7 +1023,7 @@ void MacroAssembler::lea(Address dst, AddressLiteral adr) { void MacroAssembler::leave() { // %%% is this really better? Why not on 32bit too? - emit_byte(0xC9); // LEAVE + emit_int8((unsigned char)0xC9); // LEAVE } void MacroAssembler::lneg(Register hi, Register lo) { @@ -2112,11 +2112,11 @@ void MacroAssembler::fat_nop() { if (UseAddressNop) { addr_nop_5(); } else { - emit_byte(0x26); // es: - emit_byte(0x2e); // cs: - emit_byte(0x64); // fs: - emit_byte(0x65); // gs: - emit_byte(0x90); + emit_int8(0x26); // es: + emit_int8(0x2e); // cs: + emit_int8(0x64); // fs: + emit_int8(0x65); // gs: + emit_int8((unsigned char)0x90); } } @@ -2534,12 +2534,12 @@ void MacroAssembler::jump_cc(Condition cc, AddressLiteral dst) { int offs = (intptr_t)dst.target() - ((intptr_t)pc()); if (dst.reloc() == relocInfo::none && is8bit(offs - short_size)) { // 0111 tttn #8-bit disp - emit_byte(0x70 | cc); - emit_byte((offs - short_size) & 0xFF); + emit_int8(0x70 | cc); + emit_int8((offs - short_size) & 0xFF); } else { // 0000 1111 1000 tttn #32-bit disp - emit_byte(0x0F); - emit_byte(0x80 | cc); + emit_int8(0x0F); + emit_int8((unsigned char)(0x80 | cc)); emit_long(offs - long_size); } } else { @@ -3085,7 +3085,8 @@ void MacroAssembler::xorps(XMMRegister dst, AddressLiteral src) { void MacroAssembler::pshufb(XMMRegister dst, AddressLiteral src) { // Used in sign-bit flipping with aligned address. - assert((UseAVX > 0) || (((intptr_t)src.target() & 15) == 0), "SSE mode requires address alignment 16 bytes"); + bool aligned_adr = (((intptr_t)src.target() & 15) == 0); + assert((UseAVX > 0) || aligned_adr, "SSE mode requires address alignment 16 bytes"); if (reachable(src)) { Assembler::pshufb(dst, as_Address(src)); } else { diff --git a/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp b/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp index 36d4d231155..10eab0c8a4f 100644 --- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp +++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp @@ -126,25 +126,6 @@ class MacroAssembler: public Assembler { } } -#ifndef PRODUCT - static void pd_print_patched_instruction(address branch) { - const char* s; - unsigned char op = branch[0]; - if (op == 0xE8) { - s = "call"; - } else if (op == 0xE9 || op == 0xEB) { - s = "jmp"; - } else if ((op & 0xF0) == 0x70) { - s = "jcc"; - } else if (op == 0x0F) { - s = "jcc"; - } else { - s = "????"; - } - tty->print("%s (unresolved)", s); - } -#endif - // The following 4 methods return the offset of the appropriate move instruction // Support for fast byte/short loading with zero extension (depending on particular CPU) diff --git a/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp b/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp index 7da3a2c423a..95d5123f406 100644 --- a/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp +++ b/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp @@ -169,8 +169,9 @@ void MethodHandles::jump_to_lambda_form(MacroAssembler* _masm, if (VerifyMethodHandles && !for_compiler_entry) { // make sure recv is already on stack + __ movptr(temp2, Address(method_temp, Method::const_offset())); __ load_sized_value(temp2, - Address(method_temp, Method::size_of_parameters_offset()), + Address(temp2, ConstMethod::size_of_parameters_offset()), sizeof(u2), /*is_signed*/ false); // assert(sizeof(u2) == sizeof(Method::_size_of_parameters), ""); Label L; @@ -234,8 +235,9 @@ address MethodHandles::generate_method_handle_interpreter_entry(MacroAssembler* int ref_kind = signature_polymorphic_intrinsic_ref_kind(iid); assert(ref_kind != 0 || iid == vmIntrinsics::_invokeBasic, "must be _invokeBasic or a linkTo intrinsic"); if (ref_kind == 0 || MethodHandles::ref_kind_has_receiver(ref_kind)) { + __ movptr(rdx_argp, Address(rbx_method, Method::const_offset())); __ load_sized_value(rdx_argp, - Address(rbx_method, Method::size_of_parameters_offset()), + Address(rdx_argp, ConstMethod::size_of_parameters_offset()), sizeof(u2), /*is_signed*/ false); // assert(sizeof(u2) == sizeof(Method::_size_of_parameters), ""); rdx_first_arg_addr = __ argument_address(rdx_argp, -1); diff --git a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp index 52e3f4169af..3bf5dc5e0fc 100644 --- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp @@ -2174,13 +2174,13 @@ class StubGenerator: public StubCodeGenerator { // c_rarg2 - K (key) in little endian int array // address generate_aescrypt_encryptBlock() { - assert(UseAES && (UseAVX > 0), "need AES instructions and misaligned SSE support"); + assert(UseAES, "need AES instructions and misaligned SSE support"); __ align(CodeEntryAlignment); StubCodeMark mark(this, "StubRoutines", "aescrypt_encryptBlock"); Label L_doLast; address start = __ pc(); - const Register from = rsi; // source array address + const Register from = rdx; // source array address const Register to = rdx; // destination array address const Register key = rcx; // key array address const Register keylen = rax; @@ -2189,47 +2189,74 @@ class StubGenerator: public StubCodeGenerator { const Address key_param (rbp, 8+8); const XMMRegister xmm_result = xmm0; - const XMMRegister xmm_temp = xmm1; - const XMMRegister xmm_key_shuf_mask = xmm2; + const XMMRegister xmm_key_shuf_mask = xmm1; + const XMMRegister xmm_temp1 = xmm2; + const XMMRegister xmm_temp2 = xmm3; + const XMMRegister xmm_temp3 = xmm4; + const XMMRegister xmm_temp4 = xmm5; - __ enter(); // required for proper stackwalking of RuntimeStub frame - __ push(rsi); - __ movptr(from , from_param); - __ movptr(to , to_param); - __ movptr(key , key_param); + __ enter(); // required for proper stackwalking of RuntimeStub frame + __ movptr(from, from_param); + __ movptr(key, key_param); + // keylen could be only {11, 13, 15} * 4 = {44, 52, 60} __ movl(keylen, Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT))); - // keylen = # of 32-bit words, convert to 128-bit words - __ shrl(keylen, 2); - __ subl(keylen, 11); // every key has at least 11 128-bit words, some have more __ movdqu(xmm_key_shuf_mask, ExternalAddress(StubRoutines::x86::key_shuffle_mask_addr())); __ movdqu(xmm_result, Address(from, 0)); // get 16 bytes of input + __ movptr(to, to_param); // For encryption, the java expanded key ordering is just what we need - load_key(xmm_temp, key, 0x00, xmm_key_shuf_mask); - __ pxor(xmm_result, xmm_temp); - for (int offset = 0x10; offset <= 0x90; offset += 0x10) { - aes_enc_key(xmm_result, xmm_temp, key, offset, xmm_key_shuf_mask); - } - load_key (xmm_temp, key, 0xa0, xmm_key_shuf_mask); - __ cmpl(keylen, 0); - __ jcc(Assembler::equal, L_doLast); - __ aesenc(xmm_result, xmm_temp); // only in 192 and 256 bit keys - aes_enc_key(xmm_result, xmm_temp, key, 0xb0, xmm_key_shuf_mask); - load_key(xmm_temp, key, 0xc0, xmm_key_shuf_mask); - __ subl(keylen, 2); - __ jcc(Assembler::equal, L_doLast); - __ aesenc(xmm_result, xmm_temp); // only in 256 bit keys - aes_enc_key(xmm_result, xmm_temp, key, 0xd0, xmm_key_shuf_mask); - load_key(xmm_temp, key, 0xe0, xmm_key_shuf_mask); + load_key(xmm_temp1, key, 0x00, xmm_key_shuf_mask); + __ pxor(xmm_result, xmm_temp1); + + load_key(xmm_temp1, key, 0x10, xmm_key_shuf_mask); + load_key(xmm_temp2, key, 0x20, xmm_key_shuf_mask); + load_key(xmm_temp3, key, 0x30, xmm_key_shuf_mask); + load_key(xmm_temp4, key, 0x40, xmm_key_shuf_mask); + + __ aesenc(xmm_result, xmm_temp1); + __ aesenc(xmm_result, xmm_temp2); + __ aesenc(xmm_result, xmm_temp3); + __ aesenc(xmm_result, xmm_temp4); + + load_key(xmm_temp1, key, 0x50, xmm_key_shuf_mask); + load_key(xmm_temp2, key, 0x60, xmm_key_shuf_mask); + load_key(xmm_temp3, key, 0x70, xmm_key_shuf_mask); + load_key(xmm_temp4, key, 0x80, xmm_key_shuf_mask); + + __ aesenc(xmm_result, xmm_temp1); + __ aesenc(xmm_result, xmm_temp2); + __ aesenc(xmm_result, xmm_temp3); + __ aesenc(xmm_result, xmm_temp4); + + load_key(xmm_temp1, key, 0x90, xmm_key_shuf_mask); + load_key(xmm_temp2, key, 0xa0, xmm_key_shuf_mask); + + __ cmpl(keylen, 44); + __ jccb(Assembler::equal, L_doLast); + + __ aesenc(xmm_result, xmm_temp1); + __ aesenc(xmm_result, xmm_temp2); + + load_key(xmm_temp1, key, 0xb0, xmm_key_shuf_mask); + load_key(xmm_temp2, key, 0xc0, xmm_key_shuf_mask); + + __ cmpl(keylen, 52); + __ jccb(Assembler::equal, L_doLast); + + __ aesenc(xmm_result, xmm_temp1); + __ aesenc(xmm_result, xmm_temp2); + + load_key(xmm_temp1, key, 0xd0, xmm_key_shuf_mask); + load_key(xmm_temp2, key, 0xe0, xmm_key_shuf_mask); __ BIND(L_doLast); - __ aesenclast(xmm_result, xmm_temp); + __ aesenc(xmm_result, xmm_temp1); + __ aesenclast(xmm_result, xmm_temp2); __ movdqu(Address(to, 0), xmm_result); // store the result __ xorptr(rax, rax); // return 0 - __ pop(rsi); __ leave(); // required for proper stackwalking of RuntimeStub frame __ ret(0); @@ -2245,13 +2272,13 @@ class StubGenerator: public StubCodeGenerator { // c_rarg2 - K (key) in little endian int array // address generate_aescrypt_decryptBlock() { - assert(UseAES && (UseAVX > 0), "need AES instructions and misaligned SSE support"); + assert(UseAES, "need AES instructions and misaligned SSE support"); __ align(CodeEntryAlignment); StubCodeMark mark(this, "StubRoutines", "aescrypt_decryptBlock"); Label L_doLast; address start = __ pc(); - const Register from = rsi; // source array address + const Register from = rdx; // source array address const Register to = rdx; // destination array address const Register key = rcx; // key array address const Register keylen = rax; @@ -2260,51 +2287,76 @@ class StubGenerator: public StubCodeGenerator { const Address key_param (rbp, 8+8); const XMMRegister xmm_result = xmm0; - const XMMRegister xmm_temp = xmm1; - const XMMRegister xmm_key_shuf_mask = xmm2; + const XMMRegister xmm_key_shuf_mask = xmm1; + const XMMRegister xmm_temp1 = xmm2; + const XMMRegister xmm_temp2 = xmm3; + const XMMRegister xmm_temp3 = xmm4; + const XMMRegister xmm_temp4 = xmm5; __ enter(); // required for proper stackwalking of RuntimeStub frame - __ push(rsi); - __ movptr(from , from_param); - __ movptr(to , to_param); - __ movptr(key , key_param); + __ movptr(from, from_param); + __ movptr(key, key_param); + // keylen could be only {11, 13, 15} * 4 = {44, 52, 60} __ movl(keylen, Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT))); - // keylen = # of 32-bit words, convert to 128-bit words - __ shrl(keylen, 2); - __ subl(keylen, 11); // every key has at least 11 128-bit words, some have more __ movdqu(xmm_key_shuf_mask, ExternalAddress(StubRoutines::x86::key_shuffle_mask_addr())); __ movdqu(xmm_result, Address(from, 0)); + __ movptr(to, to_param); // for decryption java expanded key ordering is rotated one position from what we want // so we start from 0x10 here and hit 0x00 last // we don't know if the key is aligned, hence not using load-execute form - load_key(xmm_temp, key, 0x10, xmm_key_shuf_mask); - __ pxor (xmm_result, xmm_temp); - for (int offset = 0x20; offset <= 0xa0; offset += 0x10) { - aes_dec_key(xmm_result, xmm_temp, key, offset, xmm_key_shuf_mask); - } - __ cmpl(keylen, 0); - __ jcc(Assembler::equal, L_doLast); - // only in 192 and 256 bit keys - aes_dec_key(xmm_result, xmm_temp, key, 0xb0, xmm_key_shuf_mask); - aes_dec_key(xmm_result, xmm_temp, key, 0xc0, xmm_key_shuf_mask); - __ subl(keylen, 2); - __ jcc(Assembler::equal, L_doLast); - // only in 256 bit keys - aes_dec_key(xmm_result, xmm_temp, key, 0xd0, xmm_key_shuf_mask); - aes_dec_key(xmm_result, xmm_temp, key, 0xe0, xmm_key_shuf_mask); + load_key(xmm_temp1, key, 0x10, xmm_key_shuf_mask); + load_key(xmm_temp2, key, 0x20, xmm_key_shuf_mask); + load_key(xmm_temp3, key, 0x30, xmm_key_shuf_mask); + load_key(xmm_temp4, key, 0x40, xmm_key_shuf_mask); + + __ pxor (xmm_result, xmm_temp1); + __ aesdec(xmm_result, xmm_temp2); + __ aesdec(xmm_result, xmm_temp3); + __ aesdec(xmm_result, xmm_temp4); + + load_key(xmm_temp1, key, 0x50, xmm_key_shuf_mask); + load_key(xmm_temp2, key, 0x60, xmm_key_shuf_mask); + load_key(xmm_temp3, key, 0x70, xmm_key_shuf_mask); + load_key(xmm_temp4, key, 0x80, xmm_key_shuf_mask); + + __ aesdec(xmm_result, xmm_temp1); + __ aesdec(xmm_result, xmm_temp2); + __ aesdec(xmm_result, xmm_temp3); + __ aesdec(xmm_result, xmm_temp4); + + load_key(xmm_temp1, key, 0x90, xmm_key_shuf_mask); + load_key(xmm_temp2, key, 0xa0, xmm_key_shuf_mask); + load_key(xmm_temp3, key, 0x00, xmm_key_shuf_mask); + + __ cmpl(keylen, 44); + __ jccb(Assembler::equal, L_doLast); + + __ aesdec(xmm_result, xmm_temp1); + __ aesdec(xmm_result, xmm_temp2); + + load_key(xmm_temp1, key, 0xb0, xmm_key_shuf_mask); + load_key(xmm_temp2, key, 0xc0, xmm_key_shuf_mask); + + __ cmpl(keylen, 52); + __ jccb(Assembler::equal, L_doLast); + + __ aesdec(xmm_result, xmm_temp1); + __ aesdec(xmm_result, xmm_temp2); + + load_key(xmm_temp1, key, 0xd0, xmm_key_shuf_mask); + load_key(xmm_temp2, key, 0xe0, xmm_key_shuf_mask); __ BIND(L_doLast); + __ aesdec(xmm_result, xmm_temp1); + __ aesdec(xmm_result, xmm_temp2); + // for decryption the aesdeclast operation is always on key+0x00 - load_key(xmm_temp, key, 0x00, xmm_key_shuf_mask); - __ aesdeclast(xmm_result, xmm_temp); - + __ aesdeclast(xmm_result, xmm_temp3); __ movdqu(Address(to, 0), xmm_result); // store the result - __ xorptr(rax, rax); // return 0 - __ pop(rsi); __ leave(); // required for proper stackwalking of RuntimeStub frame __ ret(0); @@ -2340,7 +2392,7 @@ class StubGenerator: public StubCodeGenerator { // c_rarg4 - input length // address generate_cipherBlockChaining_encryptAESCrypt() { - assert(UseAES && (UseAVX > 0), "need AES instructions and misaligned SSE support"); + assert(UseAES, "need AES instructions and misaligned SSE support"); __ align(CodeEntryAlignment); StubCodeMark mark(this, "StubRoutines", "cipherBlockChaining_encryptAESCrypt"); address start = __ pc(); @@ -2393,7 +2445,7 @@ class StubGenerator: public StubCodeGenerator { __ jcc(Assembler::notEqual, L_key_192_256); // 128 bit code follows here - __ movptr(pos, 0); + __ movl(pos, 0); __ align(OptoLoopAlignment); __ BIND(L_loopTop_128); __ movdqu(xmm_temp, Address(from, pos, Address::times_1, 0)); // get next 16 bytes of input @@ -2423,15 +2475,15 @@ class StubGenerator: public StubCodeGenerator { __ leave(); // required for proper stackwalking of RuntimeStub frame __ ret(0); - __ BIND(L_key_192_256); - // here rax = len in ints of AESCrypt.KLE array (52=192, or 60=256) + __ BIND(L_key_192_256); + // here rax = len in ints of AESCrypt.KLE array (52=192, or 60=256) __ cmpl(rax, 52); __ jcc(Assembler::notEqual, L_key_256); // 192-bit code follows here (could be changed to use more xmm registers) - __ movptr(pos, 0); - __ align(OptoLoopAlignment); - __ BIND(L_loopTop_192); + __ movl(pos, 0); + __ align(OptoLoopAlignment); + __ BIND(L_loopTop_192); __ movdqu(xmm_temp, Address(from, pos, Address::times_1, 0)); // get next 16 bytes of input __ pxor (xmm_result, xmm_temp); // xor with the current r vector @@ -2452,11 +2504,11 @@ class StubGenerator: public StubCodeGenerator { __ jcc(Assembler::notEqual, L_loopTop_192); __ jmp(L_exit); - __ BIND(L_key_256); + __ BIND(L_key_256); // 256-bit code follows here (could be changed to use more xmm registers) - __ movptr(pos, 0); - __ align(OptoLoopAlignment); - __ BIND(L_loopTop_256); + __ movl(pos, 0); + __ align(OptoLoopAlignment); + __ BIND(L_loopTop_256); __ movdqu(xmm_temp, Address(from, pos, Address::times_1, 0)); // get next 16 bytes of input __ pxor (xmm_result, xmm_temp); // xor with the current r vector @@ -2495,7 +2547,7 @@ class StubGenerator: public StubCodeGenerator { // address generate_cipherBlockChaining_decryptAESCrypt() { - assert(UseAES && (UseAVX > 0), "need AES instructions and misaligned SSE support"); + assert(UseAES, "need AES instructions and misaligned SSE support"); __ align(CodeEntryAlignment); StubCodeMark mark(this, "StubRoutines", "cipherBlockChaining_decryptAESCrypt"); address start = __ pc(); @@ -2556,9 +2608,9 @@ class StubGenerator: public StubCodeGenerator { // 128-bit code follows here, parallelized - __ movptr(pos, 0); - __ align(OptoLoopAlignment); - __ BIND(L_singleBlock_loopTop_128); + __ movl(pos, 0); + __ align(OptoLoopAlignment); + __ BIND(L_singleBlock_loopTop_128); __ cmpptr(len_reg, 0); // any blocks left?? __ jcc(Assembler::equal, L_exit); __ movdqu(xmm_result, Address(from, pos, Address::times_1, 0)); // get next 16 bytes of cipher input @@ -2597,7 +2649,7 @@ class StubGenerator: public StubCodeGenerator { __ jcc(Assembler::notEqual, L_key_256); // 192-bit code follows here (could be optimized to use parallelism) - __ movptr(pos, 0); + __ movl(pos, 0); __ align(OptoLoopAlignment); __ BIND(L_singleBlock_loopTop_192); __ movdqu(xmm_result, Address(from, pos, Address::times_1, 0)); // get next 16 bytes of cipher input @@ -2622,7 +2674,7 @@ class StubGenerator: public StubCodeGenerator { __ BIND(L_key_256); // 256-bit code follows here (could be optimized to use parallelism) - __ movptr(pos, 0); + __ movl(pos, 0); __ align(OptoLoopAlignment); __ BIND(L_singleBlock_loopTop_256); __ movdqu(xmm_result, Address(from, pos, Address::times_1, 0)); // get next 16 bytes of cipher input diff --git a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp index 48f4af8dc17..00fa0e9ccc0 100644 --- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp @@ -2953,21 +2953,6 @@ class StubGenerator: public StubCodeGenerator { } } - // aesenc using specified key+offset - // can optionally specify that the shuffle mask is already in an xmmregister - void aes_enc_key(XMMRegister xmmdst, XMMRegister xmmtmp, Register key, int offset, XMMRegister xmm_shuf_mask=NULL) { - load_key(xmmtmp, key, offset, xmm_shuf_mask); - __ aesenc(xmmdst, xmmtmp); - } - - // aesdec using specified key+offset - // can optionally specify that the shuffle mask is already in an xmmregister - void aes_dec_key(XMMRegister xmmdst, XMMRegister xmmtmp, Register key, int offset, XMMRegister xmm_shuf_mask=NULL) { - load_key(xmmtmp, key, offset, xmm_shuf_mask); - __ aesdec(xmmdst, xmmtmp); - } - - // Arguments: // // Inputs: @@ -2976,7 +2961,7 @@ class StubGenerator: public StubCodeGenerator { // c_rarg2 - K (key) in little endian int array // address generate_aescrypt_encryptBlock() { - assert(UseAES && (UseAVX > 0), "need AES instructions and misaligned SSE support"); + assert(UseAES, "need AES instructions and misaligned SSE support"); __ align(CodeEntryAlignment); StubCodeMark mark(this, "StubRoutines", "aescrypt_encryptBlock"); Label L_doLast; @@ -2988,15 +2973,17 @@ class StubGenerator: public StubCodeGenerator { const Register keylen = rax; const XMMRegister xmm_result = xmm0; - const XMMRegister xmm_temp = xmm1; - const XMMRegister xmm_key_shuf_mask = xmm2; + const XMMRegister xmm_key_shuf_mask = xmm1; + // On win64 xmm6-xmm15 must be preserved so don't use them. + const XMMRegister xmm_temp1 = xmm2; + const XMMRegister xmm_temp2 = xmm3; + const XMMRegister xmm_temp3 = xmm4; + const XMMRegister xmm_temp4 = xmm5; __ enter(); // required for proper stackwalking of RuntimeStub frame + // keylen could be only {11, 13, 15} * 4 = {44, 52, 60} __ movl(keylen, Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT))); - // keylen = # of 32-bit words, convert to 128-bit words - __ shrl(keylen, 2); - __ subl(keylen, 11); // every key has at least 11 128-bit words, some have more __ movdqu(xmm_key_shuf_mask, ExternalAddress(StubRoutines::x86::key_shuffle_mask_addr())); __ movdqu(xmm_result, Address(from, 0)); // get 16 bytes of input @@ -3004,25 +2991,53 @@ class StubGenerator: public StubCodeGenerator { // For encryption, the java expanded key ordering is just what we need // we don't know if the key is aligned, hence not using load-execute form - load_key(xmm_temp, key, 0x00, xmm_key_shuf_mask); - __ pxor(xmm_result, xmm_temp); - for (int offset = 0x10; offset <= 0x90; offset += 0x10) { - aes_enc_key(xmm_result, xmm_temp, key, offset, xmm_key_shuf_mask); - } - load_key (xmm_temp, key, 0xa0, xmm_key_shuf_mask); - __ cmpl(keylen, 0); - __ jcc(Assembler::equal, L_doLast); - __ aesenc(xmm_result, xmm_temp); // only in 192 and 256 bit keys - aes_enc_key(xmm_result, xmm_temp, key, 0xb0, xmm_key_shuf_mask); - load_key(xmm_temp, key, 0xc0, xmm_key_shuf_mask); - __ subl(keylen, 2); - __ jcc(Assembler::equal, L_doLast); - __ aesenc(xmm_result, xmm_temp); // only in 256 bit keys - aes_enc_key(xmm_result, xmm_temp, key, 0xd0, xmm_key_shuf_mask); - load_key(xmm_temp, key, 0xe0, xmm_key_shuf_mask); + load_key(xmm_temp1, key, 0x00, xmm_key_shuf_mask); + __ pxor(xmm_result, xmm_temp1); + + load_key(xmm_temp1, key, 0x10, xmm_key_shuf_mask); + load_key(xmm_temp2, key, 0x20, xmm_key_shuf_mask); + load_key(xmm_temp3, key, 0x30, xmm_key_shuf_mask); + load_key(xmm_temp4, key, 0x40, xmm_key_shuf_mask); + + __ aesenc(xmm_result, xmm_temp1); + __ aesenc(xmm_result, xmm_temp2); + __ aesenc(xmm_result, xmm_temp3); + __ aesenc(xmm_result, xmm_temp4); + + load_key(xmm_temp1, key, 0x50, xmm_key_shuf_mask); + load_key(xmm_temp2, key, 0x60, xmm_key_shuf_mask); + load_key(xmm_temp3, key, 0x70, xmm_key_shuf_mask); + load_key(xmm_temp4, key, 0x80, xmm_key_shuf_mask); + + __ aesenc(xmm_result, xmm_temp1); + __ aesenc(xmm_result, xmm_temp2); + __ aesenc(xmm_result, xmm_temp3); + __ aesenc(xmm_result, xmm_temp4); + + load_key(xmm_temp1, key, 0x90, xmm_key_shuf_mask); + load_key(xmm_temp2, key, 0xa0, xmm_key_shuf_mask); + + __ cmpl(keylen, 44); + __ jccb(Assembler::equal, L_doLast); + + __ aesenc(xmm_result, xmm_temp1); + __ aesenc(xmm_result, xmm_temp2); + + load_key(xmm_temp1, key, 0xb0, xmm_key_shuf_mask); + load_key(xmm_temp2, key, 0xc0, xmm_key_shuf_mask); + + __ cmpl(keylen, 52); + __ jccb(Assembler::equal, L_doLast); + + __ aesenc(xmm_result, xmm_temp1); + __ aesenc(xmm_result, xmm_temp2); + + load_key(xmm_temp1, key, 0xd0, xmm_key_shuf_mask); + load_key(xmm_temp2, key, 0xe0, xmm_key_shuf_mask); __ BIND(L_doLast); - __ aesenclast(xmm_result, xmm_temp); + __ aesenc(xmm_result, xmm_temp1); + __ aesenclast(xmm_result, xmm_temp2); __ movdqu(Address(to, 0), xmm_result); // store the result __ xorptr(rax, rax); // return 0 __ leave(); // required for proper stackwalking of RuntimeStub frame @@ -3040,7 +3055,7 @@ class StubGenerator: public StubCodeGenerator { // c_rarg2 - K (key) in little endian int array // address generate_aescrypt_decryptBlock() { - assert(UseAES && (UseAVX > 0), "need AES instructions and misaligned SSE support"); + assert(UseAES, "need AES instructions and misaligned SSE support"); __ align(CodeEntryAlignment); StubCodeMark mark(this, "StubRoutines", "aescrypt_decryptBlock"); Label L_doLast; @@ -3052,15 +3067,17 @@ class StubGenerator: public StubCodeGenerator { const Register keylen = rax; const XMMRegister xmm_result = xmm0; - const XMMRegister xmm_temp = xmm1; - const XMMRegister xmm_key_shuf_mask = xmm2; + const XMMRegister xmm_key_shuf_mask = xmm1; + // On win64 xmm6-xmm15 must be preserved so don't use them. + const XMMRegister xmm_temp1 = xmm2; + const XMMRegister xmm_temp2 = xmm3; + const XMMRegister xmm_temp3 = xmm4; + const XMMRegister xmm_temp4 = xmm5; __ enter(); // required for proper stackwalking of RuntimeStub frame + // keylen could be only {11, 13, 15} * 4 = {44, 52, 60} __ movl(keylen, Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT))); - // keylen = # of 32-bit words, convert to 128-bit words - __ shrl(keylen, 2); - __ subl(keylen, 11); // every key has at least 11 128-bit words, some have more __ movdqu(xmm_key_shuf_mask, ExternalAddress(StubRoutines::x86::key_shuffle_mask_addr())); __ movdqu(xmm_result, Address(from, 0)); @@ -3068,29 +3085,55 @@ class StubGenerator: public StubCodeGenerator { // for decryption java expanded key ordering is rotated one position from what we want // so we start from 0x10 here and hit 0x00 last // we don't know if the key is aligned, hence not using load-execute form - load_key(xmm_temp, key, 0x10, xmm_key_shuf_mask); - __ pxor (xmm_result, xmm_temp); - for (int offset = 0x20; offset <= 0xa0; offset += 0x10) { - aes_dec_key(xmm_result, xmm_temp, key, offset, xmm_key_shuf_mask); - } - __ cmpl(keylen, 0); - __ jcc(Assembler::equal, L_doLast); - // only in 192 and 256 bit keys - aes_dec_key(xmm_result, xmm_temp, key, 0xb0, xmm_key_shuf_mask); - aes_dec_key(xmm_result, xmm_temp, key, 0xc0, xmm_key_shuf_mask); - __ subl(keylen, 2); - __ jcc(Assembler::equal, L_doLast); - // only in 256 bit keys - aes_dec_key(xmm_result, xmm_temp, key, 0xd0, xmm_key_shuf_mask); - aes_dec_key(xmm_result, xmm_temp, key, 0xe0, xmm_key_shuf_mask); + load_key(xmm_temp1, key, 0x10, xmm_key_shuf_mask); + load_key(xmm_temp2, key, 0x20, xmm_key_shuf_mask); + load_key(xmm_temp3, key, 0x30, xmm_key_shuf_mask); + load_key(xmm_temp4, key, 0x40, xmm_key_shuf_mask); + + __ pxor (xmm_result, xmm_temp1); + __ aesdec(xmm_result, xmm_temp2); + __ aesdec(xmm_result, xmm_temp3); + __ aesdec(xmm_result, xmm_temp4); + + load_key(xmm_temp1, key, 0x50, xmm_key_shuf_mask); + load_key(xmm_temp2, key, 0x60, xmm_key_shuf_mask); + load_key(xmm_temp3, key, 0x70, xmm_key_shuf_mask); + load_key(xmm_temp4, key, 0x80, xmm_key_shuf_mask); + + __ aesdec(xmm_result, xmm_temp1); + __ aesdec(xmm_result, xmm_temp2); + __ aesdec(xmm_result, xmm_temp3); + __ aesdec(xmm_result, xmm_temp4); + + load_key(xmm_temp1, key, 0x90, xmm_key_shuf_mask); + load_key(xmm_temp2, key, 0xa0, xmm_key_shuf_mask); + load_key(xmm_temp3, key, 0x00, xmm_key_shuf_mask); + + __ cmpl(keylen, 44); + __ jccb(Assembler::equal, L_doLast); + + __ aesdec(xmm_result, xmm_temp1); + __ aesdec(xmm_result, xmm_temp2); + + load_key(xmm_temp1, key, 0xb0, xmm_key_shuf_mask); + load_key(xmm_temp2, key, 0xc0, xmm_key_shuf_mask); + + __ cmpl(keylen, 52); + __ jccb(Assembler::equal, L_doLast); + + __ aesdec(xmm_result, xmm_temp1); + __ aesdec(xmm_result, xmm_temp2); + + load_key(xmm_temp1, key, 0xd0, xmm_key_shuf_mask); + load_key(xmm_temp2, key, 0xe0, xmm_key_shuf_mask); __ BIND(L_doLast); + __ aesdec(xmm_result, xmm_temp1); + __ aesdec(xmm_result, xmm_temp2); + // for decryption the aesdeclast operation is always on key+0x00 - load_key(xmm_temp, key, 0x00, xmm_key_shuf_mask); - __ aesdeclast(xmm_result, xmm_temp); - + __ aesdeclast(xmm_result, xmm_temp3); __ movdqu(Address(to, 0), xmm_result); // store the result - __ xorptr(rax, rax); // return 0 __ leave(); // required for proper stackwalking of RuntimeStub frame __ ret(0); @@ -3109,7 +3152,7 @@ class StubGenerator: public StubCodeGenerator { // c_rarg4 - input length // address generate_cipherBlockChaining_encryptAESCrypt() { - assert(UseAES && (UseAVX > 0), "need AES instructions and misaligned SSE support"); + assert(UseAES, "need AES instructions and misaligned SSE support"); __ align(CodeEntryAlignment); StubCodeMark mark(this, "StubRoutines", "cipherBlockChaining_encryptAESCrypt"); address start = __ pc(); @@ -3133,16 +3176,19 @@ class StubGenerator: public StubCodeGenerator { const XMMRegister xmm_temp = xmm1; // keys 0-10 preloaded into xmm2-xmm12 const int XMM_REG_NUM_KEY_FIRST = 2; - const int XMM_REG_NUM_KEY_LAST = 12; + const int XMM_REG_NUM_KEY_LAST = 15; const XMMRegister xmm_key0 = as_XMMRegister(XMM_REG_NUM_KEY_FIRST); - const XMMRegister xmm_key10 = as_XMMRegister(XMM_REG_NUM_KEY_LAST); + const XMMRegister xmm_key10 = as_XMMRegister(XMM_REG_NUM_KEY_FIRST+10); + const XMMRegister xmm_key11 = as_XMMRegister(XMM_REG_NUM_KEY_FIRST+11); + const XMMRegister xmm_key12 = as_XMMRegister(XMM_REG_NUM_KEY_FIRST+12); + const XMMRegister xmm_key13 = as_XMMRegister(XMM_REG_NUM_KEY_FIRST+13); __ enter(); // required for proper stackwalking of RuntimeStub frame #ifdef _WIN64 // on win64, fill len_reg from stack position __ movl(len_reg, len_mem); - // save the xmm registers which must be preserved 6-12 + // save the xmm registers which must be preserved 6-15 __ subptr(rsp, -rsp_after_call_off * wordSize); for (int i = 6; i <= XMM_REG_NUM_KEY_LAST; i++) { __ movdqu(xmm_save(i), as_XMMRegister(i)); @@ -3151,12 +3197,11 @@ class StubGenerator: public StubCodeGenerator { const XMMRegister xmm_key_shuf_mask = xmm_temp; // used temporarily to swap key bytes up front __ movdqu(xmm_key_shuf_mask, ExternalAddress(StubRoutines::x86::key_shuffle_mask_addr())); - // load up xmm regs 2 thru 12 with key 0x00 - 0xa0 - for (int rnum = XMM_REG_NUM_KEY_FIRST, offset = 0x00; rnum <= XMM_REG_NUM_KEY_LAST; rnum++) { + // load up xmm regs xmm2 thru xmm12 with key 0x00 - 0xa0 + for (int rnum = XMM_REG_NUM_KEY_FIRST, offset = 0x00; rnum <= XMM_REG_NUM_KEY_FIRST+10; rnum++) { load_key(as_XMMRegister(rnum), key, offset, xmm_key_shuf_mask); offset += 0x10; } - __ movdqu(xmm_result, Address(rvec, 0x00)); // initialize xmm_result with r vec // now split to different paths depending on the keylen (len in ints of AESCrypt.KLE array (52=192, or 60=256)) @@ -3167,16 +3212,15 @@ class StubGenerator: public StubCodeGenerator { // 128 bit code follows here __ movptr(pos, 0); __ align(OptoLoopAlignment); + __ BIND(L_loopTop_128); __ movdqu(xmm_temp, Address(from, pos, Address::times_1, 0)); // get next 16 bytes of input __ pxor (xmm_result, xmm_temp); // xor with the current r vector - __ pxor (xmm_result, xmm_key0); // do the aes rounds - for (int rnum = XMM_REG_NUM_KEY_FIRST + 1; rnum <= XMM_REG_NUM_KEY_LAST - 1; rnum++) { + for (int rnum = XMM_REG_NUM_KEY_FIRST + 1; rnum <= XMM_REG_NUM_KEY_FIRST + 9; rnum++) { __ aesenc(xmm_result, as_XMMRegister(rnum)); } __ aesenclast(xmm_result, xmm_key10); - __ movdqu(Address(to, pos, Address::times_1, 0), xmm_result); // store into the next 16 bytes of output // no need to store r to memory until we exit __ addptr(pos, AESBlockSize); @@ -3198,24 +3242,23 @@ class StubGenerator: public StubCodeGenerator { __ BIND(L_key_192_256); // here rax = len in ints of AESCrypt.KLE array (52=192, or 60=256) + load_key(xmm_key11, key, 0xb0, xmm_key_shuf_mask); + load_key(xmm_key12, key, 0xc0, xmm_key_shuf_mask); __ cmpl(rax, 52); __ jcc(Assembler::notEqual, L_key_256); // 192-bit code follows here (could be changed to use more xmm registers) __ movptr(pos, 0); __ align(OptoLoopAlignment); + __ BIND(L_loopTop_192); __ movdqu(xmm_temp, Address(from, pos, Address::times_1, 0)); // get next 16 bytes of input __ pxor (xmm_result, xmm_temp); // xor with the current r vector - __ pxor (xmm_result, xmm_key0); // do the aes rounds - for (int rnum = XMM_REG_NUM_KEY_FIRST + 1; rnum <= XMM_REG_NUM_KEY_LAST; rnum++) { + for (int rnum = XMM_REG_NUM_KEY_FIRST + 1; rnum <= XMM_REG_NUM_KEY_FIRST + 11; rnum++) { __ aesenc(xmm_result, as_XMMRegister(rnum)); } - aes_enc_key(xmm_result, xmm_temp, key, 0xb0); - load_key(xmm_temp, key, 0xc0); - __ aesenclast(xmm_result, xmm_temp); - + __ aesenclast(xmm_result, xmm_key12); __ movdqu(Address(to, pos, Address::times_1, 0), xmm_result); // store into the next 16 bytes of output // no need to store r to memory until we exit __ addptr(pos, AESBlockSize); @@ -3225,22 +3268,19 @@ class StubGenerator: public StubCodeGenerator { __ BIND(L_key_256); // 256-bit code follows here (could be changed to use more xmm registers) + load_key(xmm_key13, key, 0xd0, xmm_key_shuf_mask); __ movptr(pos, 0); __ align(OptoLoopAlignment); + __ BIND(L_loopTop_256); __ movdqu(xmm_temp, Address(from, pos, Address::times_1, 0)); // get next 16 bytes of input __ pxor (xmm_result, xmm_temp); // xor with the current r vector - __ pxor (xmm_result, xmm_key0); // do the aes rounds - for (int rnum = XMM_REG_NUM_KEY_FIRST + 1; rnum <= XMM_REG_NUM_KEY_LAST; rnum++) { + for (int rnum = XMM_REG_NUM_KEY_FIRST + 1; rnum <= XMM_REG_NUM_KEY_FIRST + 13; rnum++) { __ aesenc(xmm_result, as_XMMRegister(rnum)); } - aes_enc_key(xmm_result, xmm_temp, key, 0xb0); - aes_enc_key(xmm_result, xmm_temp, key, 0xc0); - aes_enc_key(xmm_result, xmm_temp, key, 0xd0); load_key(xmm_temp, key, 0xe0); __ aesenclast(xmm_result, xmm_temp); - __ movdqu(Address(to, pos, Address::times_1, 0), xmm_result); // store into the next 16 bytes of output // no need to store r to memory until we exit __ addptr(pos, AESBlockSize); @@ -3267,7 +3307,7 @@ class StubGenerator: public StubCodeGenerator { // address generate_cipherBlockChaining_decryptAESCrypt_Parallel() { - assert(UseAES && (UseAVX > 0), "need AES instructions and misaligned SSE support"); + assert(UseAES, "need AES instructions and misaligned SSE support"); __ align(CodeEntryAlignment); StubCodeMark mark(this, "StubRoutines", "cipherBlockChaining_decryptAESCrypt"); address start = __ pc(); @@ -3288,12 +3328,10 @@ class StubGenerator: public StubCodeGenerator { #endif const Register pos = rax; - // xmm register assignments for the loops below - const XMMRegister xmm_result = xmm0; // keys 0-10 preloaded into xmm2-xmm12 const int XMM_REG_NUM_KEY_FIRST = 5; const int XMM_REG_NUM_KEY_LAST = 15; - const XMMRegister xmm_key_first = as_XMMRegister(XMM_REG_NUM_KEY_FIRST); + const XMMRegister xmm_key_first = as_XMMRegister(XMM_REG_NUM_KEY_FIRST); const XMMRegister xmm_key_last = as_XMMRegister(XMM_REG_NUM_KEY_LAST); __ enter(); // required for proper stackwalking of RuntimeStub frame @@ -3312,13 +3350,14 @@ class StubGenerator: public StubCodeGenerator { const XMMRegister xmm_key_shuf_mask = xmm1; // used temporarily to swap key bytes up front __ movdqu(xmm_key_shuf_mask, ExternalAddress(StubRoutines::x86::key_shuffle_mask_addr())); // load up xmm regs 5 thru 15 with key 0x10 - 0xa0 - 0x00 - for (int rnum = XMM_REG_NUM_KEY_FIRST, offset = 0x10; rnum <= XMM_REG_NUM_KEY_LAST; rnum++) { - if (rnum == XMM_REG_NUM_KEY_LAST) offset = 0x00; + for (int rnum = XMM_REG_NUM_KEY_FIRST, offset = 0x10; rnum < XMM_REG_NUM_KEY_LAST; rnum++) { load_key(as_XMMRegister(rnum), key, offset, xmm_key_shuf_mask); offset += 0x10; } + load_key(xmm_key_last, key, 0x00, xmm_key_shuf_mask); const XMMRegister xmm_prev_block_cipher = xmm1; // holds cipher of previous block + // registers holding the four results in the parallelized loop const XMMRegister xmm_result0 = xmm0; const XMMRegister xmm_result1 = xmm2; @@ -3376,8 +3415,12 @@ class StubGenerator: public StubCodeGenerator { __ jmp(L_multiBlock_loopTop_128); // registers used in the non-parallelized loops + // xmm register assignments for the loops below + const XMMRegister xmm_result = xmm0; const XMMRegister xmm_prev_block_cipher_save = xmm2; - const XMMRegister xmm_temp = xmm3; + const XMMRegister xmm_key11 = xmm3; + const XMMRegister xmm_key12 = xmm4; + const XMMRegister xmm_temp = xmm4; __ align(OptoLoopAlignment); __ BIND(L_singleBlock_loopTop_128); @@ -3415,12 +3458,15 @@ class StubGenerator: public StubCodeGenerator { __ BIND(L_key_192_256); // here rax = len in ints of AESCrypt.KLE array (52=192, or 60=256) + load_key(xmm_key11, key, 0xb0); __ cmpl(rax, 52); __ jcc(Assembler::notEqual, L_key_256); // 192-bit code follows here (could be optimized to use parallelism) + load_key(xmm_key12, key, 0xc0); // 192-bit key goes up to c0 __ movptr(pos, 0); __ align(OptoLoopAlignment); + __ BIND(L_singleBlock_loopTop_192); __ movdqu(xmm_result, Address(from, pos, Address::times_1, 0)); // get next 16 bytes of cipher input __ movdqa(xmm_prev_block_cipher_save, xmm_result); // save for next r vector @@ -3428,14 +3474,13 @@ class StubGenerator: public StubCodeGenerator { for (int rnum = XMM_REG_NUM_KEY_FIRST + 1; rnum <= XMM_REG_NUM_KEY_LAST - 1; rnum++) { __ aesdec(xmm_result, as_XMMRegister(rnum)); } - aes_dec_key(xmm_result, xmm_temp, key, 0xb0); // 192-bit key goes up to c0 - aes_dec_key(xmm_result, xmm_temp, key, 0xc0); + __ aesdec(xmm_result, xmm_key11); + __ aesdec(xmm_result, xmm_key12); __ aesdeclast(xmm_result, xmm_key_last); // xmm15 always came from key+0 __ pxor (xmm_result, xmm_prev_block_cipher); // xor with the current r vector - __ movdqu(Address(to, pos, Address::times_1, 0), xmm_result); // store into the next 16 bytes of output + __ movdqu(Address(to, pos, Address::times_1, 0), xmm_result); // store into the next 16 bytes of output // no need to store r to memory until we exit - __ movdqa(xmm_prev_block_cipher, xmm_prev_block_cipher_save); // set up next r vector with cipher input from this block - + __ movdqa(xmm_prev_block_cipher, xmm_prev_block_cipher_save); // set up next r vector with cipher input from this block __ addptr(pos, AESBlockSize); __ subptr(len_reg, AESBlockSize); __ jcc(Assembler::notEqual,L_singleBlock_loopTop_192); @@ -3445,23 +3490,26 @@ class StubGenerator: public StubCodeGenerator { // 256-bit code follows here (could be optimized to use parallelism) __ movptr(pos, 0); __ align(OptoLoopAlignment); + __ BIND(L_singleBlock_loopTop_256); - __ movdqu(xmm_result, Address(from, pos, Address::times_1, 0)); // get next 16 bytes of cipher input + __ movdqu(xmm_result, Address(from, pos, Address::times_1, 0)); // get next 16 bytes of cipher input __ movdqa(xmm_prev_block_cipher_save, xmm_result); // save for next r vector __ pxor (xmm_result, xmm_key_first); // do the aes dec rounds for (int rnum = XMM_REG_NUM_KEY_FIRST + 1; rnum <= XMM_REG_NUM_KEY_LAST - 1; rnum++) { __ aesdec(xmm_result, as_XMMRegister(rnum)); } - aes_dec_key(xmm_result, xmm_temp, key, 0xb0); // 256-bit key goes up to e0 - aes_dec_key(xmm_result, xmm_temp, key, 0xc0); - aes_dec_key(xmm_result, xmm_temp, key, 0xd0); - aes_dec_key(xmm_result, xmm_temp, key, 0xe0); - __ aesdeclast(xmm_result, xmm_key_last); // xmm15 came from key+0 + __ aesdec(xmm_result, xmm_key11); + load_key(xmm_temp, key, 0xc0); + __ aesdec(xmm_result, xmm_temp); + load_key(xmm_temp, key, 0xd0); + __ aesdec(xmm_result, xmm_temp); + load_key(xmm_temp, key, 0xe0); // 256-bit key goes up to e0 + __ aesdec(xmm_result, xmm_temp); + __ aesdeclast(xmm_result, xmm_key_last); // xmm15 came from key+0 __ pxor (xmm_result, xmm_prev_block_cipher); // xor with the current r vector - __ movdqu(Address(to, pos, Address::times_1, 0), xmm_result); // store into the next 16 bytes of output + __ movdqu(Address(to, pos, Address::times_1, 0), xmm_result); // store into the next 16 bytes of output // no need to store r to memory until we exit - __ movdqa(xmm_prev_block_cipher, xmm_prev_block_cipher_save); // set up next r vector with cipher input from this block - + __ movdqa(xmm_prev_block_cipher, xmm_prev_block_cipher_save); // set up next r vector with cipher input from this block __ addptr(pos, AESBlockSize); __ subptr(len_reg, AESBlockSize); __ jcc(Assembler::notEqual,L_singleBlock_loopTop_256); diff --git a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp index 19a2a45c9f7..aabc3dbbacd 100644 --- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp @@ -424,8 +424,6 @@ void InterpreterGenerator::generate_counter_overflow(Label* do_continue) { // C++ interpreter only // rsi - previous interpreter state pointer - const Address size_of_parameters(rbx, Method::size_of_parameters_offset()); - // InterpreterRuntime::frequency_counter_overflow takes one argument // indicating if the counter overflow occurs at a backwards branch (non-NULL bcp). // The call returns the address of the verified entry point for the method or NULL @@ -868,12 +866,13 @@ address InterpreterGenerator::generate_native_entry(bool synchronized) { // rsi: previous interpreter state (C++ interpreter) must preserve address entry_point = __ pc(); - - const Address size_of_parameters(rbx, Method::size_of_parameters_offset()); + const Address constMethod (rbx, Method::const_offset()); const Address invocation_counter(rbx, Method::invocation_counter_offset() + InvocationCounter::counter_offset()); const Address access_flags (rbx, Method::access_flags_offset()); + const Address size_of_parameters(rcx, ConstMethod::size_of_parameters_offset()); // get parameter size (always needed) + __ movptr(rcx, constMethod); __ load_unsigned_short(rcx, size_of_parameters); // native calls don't need the stack size check since they have no expression stack @@ -988,7 +987,9 @@ address InterpreterGenerator::generate_native_entry(bool synchronized) { // allocate space for parameters __ get_method(method); - __ load_unsigned_short(t, Address(method, Method::size_of_parameters_offset())); + __ movptr(t, Address(method, Method::const_offset())); + __ load_unsigned_short(t, Address(t, ConstMethod::size_of_parameters_offset())); + __ shlptr(t, Interpreter::logStackElementSize); __ addptr(t, 2*wordSize); // allocate two more slots for JNIEnv and possible mirror __ subptr(rsp, t); @@ -1297,13 +1298,14 @@ address InterpreterGenerator::generate_normal_entry(bool synchronized) { // rsi: sender sp address entry_point = __ pc(); - - const Address size_of_parameters(rbx, Method::size_of_parameters_offset()); - const Address size_of_locals (rbx, Method::size_of_locals_offset()); + const Address constMethod (rbx, Method::const_offset()); const Address invocation_counter(rbx, Method::invocation_counter_offset() + InvocationCounter::counter_offset()); const Address access_flags (rbx, Method::access_flags_offset()); + const Address size_of_parameters(rdx, ConstMethod::size_of_parameters_offset()); + const Address size_of_locals (rdx, ConstMethod::size_of_locals_offset()); // get parameter size (always needed) + __ movptr(rdx, constMethod); __ load_unsigned_short(rcx, size_of_parameters); // rbx,: Method* @@ -1734,7 +1736,8 @@ void TemplateInterpreterGenerator::generate_throw_exception() { // Compute size of arguments for saving when returning to deoptimized caller __ get_method(rax); - __ load_unsigned_short(rax, Address(rax, in_bytes(Method::size_of_parameters_offset()))); + __ movptr(rax, Address(rax, Method::const_offset())); + __ load_unsigned_short(rax, Address(rax, ConstMethod::size_of_parameters_offset())); __ shlptr(rax, Interpreter::logStackElementSize); __ restore_locals(); __ subptr(rdi, rax); diff --git a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp index e2b46fc78bc..3e3cc0fc1f5 100644 --- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp @@ -369,9 +369,6 @@ void InterpreterGenerator::generate_counter_overflow(Label* do_continue) { // Everything as it was on entry // rdx is not restored. Doesn't appear to really be set. - const Address size_of_parameters(rbx, - Method::size_of_parameters_offset()); - // InterpreterRuntime::frequency_counter_overflow takes two // arguments, the first (thread) is passed by call_VM, the second // indicates if the counter overflow occurs at a backwards branch @@ -844,14 +841,17 @@ address InterpreterGenerator::generate_native_entry(bool synchronized) { address entry_point = __ pc(); - const Address size_of_parameters(rbx, Method:: - size_of_parameters_offset()); + const Address constMethod (rbx, Method::const_offset()); const Address invocation_counter(rbx, Method:: invocation_counter_offset() + InvocationCounter::counter_offset()); const Address access_flags (rbx, Method::access_flags_offset()); + const Address size_of_parameters(rcx, ConstMethod:: + size_of_parameters_offset()); + // get parameter size (always needed) + __ movptr(rcx, constMethod); __ load_unsigned_short(rcx, size_of_parameters); // native calls don't need the stack size check since they have no @@ -967,9 +967,8 @@ address InterpreterGenerator::generate_native_entry(bool synchronized) { // allocate space for parameters __ get_method(method); - __ load_unsigned_short(t, - Address(method, - Method::size_of_parameters_offset())); + __ movptr(t, Address(method, Method::const_offset())); + __ load_unsigned_short(t, Address(t, ConstMethod::size_of_parameters_offset())); __ shll(t, Interpreter::logStackElementSize); __ subptr(rsp, t); @@ -1302,15 +1301,18 @@ address InterpreterGenerator::generate_normal_entry(bool synchronized) { // r13: sender sp address entry_point = __ pc(); - const Address size_of_parameters(rbx, - Method::size_of_parameters_offset()); - const Address size_of_locals(rbx, Method::size_of_locals_offset()); + const Address constMethod(rbx, Method::const_offset()); const Address invocation_counter(rbx, Method::invocation_counter_offset() + InvocationCounter::counter_offset()); const Address access_flags(rbx, Method::access_flags_offset()); + const Address size_of_parameters(rdx, + ConstMethod::size_of_parameters_offset()); + const Address size_of_locals(rdx, ConstMethod::size_of_locals_offset()); + // get parameter size (always needed) + __ movptr(rdx, constMethod); __ load_unsigned_short(rcx, size_of_parameters); // rbx: Method* @@ -1752,7 +1754,8 @@ void TemplateInterpreterGenerator::generate_throw_exception() { // Compute size of arguments for saving when returning to // deoptimized caller __ get_method(rax); - __ load_unsigned_short(rax, Address(rax, in_bytes(Method:: + __ movptr(rax, Address(rax, Method::const_offset())); + __ load_unsigned_short(rax, Address(rax, in_bytes(ConstMethod:: size_of_parameters_offset()))); __ shll(rax, Interpreter::logStackElementSize); __ restore_locals(); // XXX do we need this? diff --git a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp index f48e66012a8..fc046676739 100644 --- a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp +++ b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp @@ -489,8 +489,8 @@ void VM_Version::get_processor_features() { } // The AES intrinsic stubs require AES instruction support (of course) - // but also require AVX and sse3 modes for instructions it use. - if (UseAES && (UseAVX > 0) && (UseSSE > 2)) { + // but also require sse3 mode for instructions it use. + if (UseAES && (UseSSE > 2)) { if (FLAG_IS_DEFAULT(UseAESIntrinsics)) { UseAESIntrinsics = true; } diff --git a/hotspot/src/cpu/zero/vm/assembler_zero.cpp b/hotspot/src/cpu/zero/vm/assembler_zero.cpp index e37938c1fa7..d70a2adc746 100644 --- a/hotspot/src/cpu/zero/vm/assembler_zero.cpp +++ b/hotspot/src/cpu/zero/vm/assembler_zero.cpp @@ -56,15 +56,9 @@ void Assembler::pd_patch_instruction(address branch, address target) { ShouldNotCallThis(); } -#ifndef PRODUCT -void Assembler::pd_print_patched_instruction(address branch) { - ShouldNotCallThis(); -} -#endif // PRODUCT - void MacroAssembler::align(int modulus) { while (offset() % modulus != 0) - emit_byte(AbstractAssembler::code_fill_byte()); + emit_int8(AbstractAssembler::code_fill_byte()); } void MacroAssembler::bang_stack_with_offset(int offset) { @@ -72,8 +66,7 @@ void MacroAssembler::bang_stack_with_offset(int offset) { } void MacroAssembler::advance(int bytes) { - _code_pos += bytes; - sync(); + code_section()->set_end(code_section()->end() + bytes); } RegisterOrConstant MacroAssembler::delayed_value_impl( diff --git a/hotspot/src/cpu/zero/vm/assembler_zero.hpp b/hotspot/src/cpu/zero/vm/assembler_zero.hpp index 724153982ac..f9564a54c0a 100644 --- a/hotspot/src/cpu/zero/vm/assembler_zero.hpp +++ b/hotspot/src/cpu/zero/vm/assembler_zero.hpp @@ -37,9 +37,6 @@ class Assembler : public AbstractAssembler { public: void pd_patch_instruction(address branch, address target); -#ifndef PRODUCT - static void pd_print_patched_instruction(address branch); -#endif // PRODUCT }; class MacroAssembler : public Assembler { diff --git a/hotspot/src/os/posix/vm/os_posix.cpp b/hotspot/src/os/posix/vm/os_posix.cpp index cbffa3279af..af75b3b362d 100644 --- a/hotspot/src/os/posix/vm/os_posix.cpp +++ b/hotspot/src/os/posix/vm/os_posix.cpp @@ -93,6 +93,47 @@ void os::wait_for_keypress_at_exit(void) { return; } +// Multiple threads can race in this code, and can remap over each other with MAP_FIXED, +// so on posix, unmap the section at the start and at the end of the chunk that we mapped +// rather than unmapping and remapping the whole chunk to get requested alignment. +char* os::reserve_memory_aligned(size_t size, size_t alignment) { + assert((alignment & (os::vm_allocation_granularity() - 1)) == 0, + "Alignment must be a multiple of allocation granularity (page size)"); + assert((size & (alignment -1)) == 0, "size must be 'alignment' aligned"); + + size_t extra_size = size + alignment; + assert(extra_size >= size, "overflow, size is too large to allow alignment"); + + char* extra_base = os::reserve_memory(extra_size, NULL, alignment); + + if (extra_base == NULL) { + return NULL; + } + + // Do manual alignment + char* aligned_base = (char*) align_size_up((uintptr_t) extra_base, alignment); + + // [ | | ] + // ^ extra_base + // ^ extra_base + begin_offset == aligned_base + // extra_base + begin_offset + size ^ + // extra_base + extra_size ^ + // |<>| == begin_offset + // end_offset == |<>| + size_t begin_offset = aligned_base - extra_base; + size_t end_offset = (extra_base + extra_size) - (aligned_base + size); + + if (begin_offset > 0) { + os::release_memory(extra_base, begin_offset); + } + + if (end_offset > 0) { + os::release_memory(extra_base + begin_offset + size, end_offset); + } + + return aligned_base; +} + void os::Posix::print_load_average(outputStream* st) { st->print("load average:"); double loadavg[3]; diff --git a/hotspot/src/os/windows/vm/os_windows.cpp b/hotspot/src/os/windows/vm/os_windows.cpp index ddd3a79bfe2..81bed6dcbbe 100644 --- a/hotspot/src/os/windows/vm/os_windows.cpp +++ b/hotspot/src/os/windows/vm/os_windows.cpp @@ -2895,6 +2895,36 @@ void os::pd_split_reserved_memory(char *base, size_t size, size_t split, } } +// Multiple threads can race in this code but it's not possible to unmap small sections of +// virtual space to get requested alignment, like posix-like os's. +// Windows prevents multiple thread from remapping over each other so this loop is thread-safe. +char* os::reserve_memory_aligned(size_t size, size_t alignment) { + assert((alignment & (os::vm_allocation_granularity() - 1)) == 0, + "Alignment must be a multiple of allocation granularity (page size)"); + assert((size & (alignment -1)) == 0, "size must be 'alignment' aligned"); + + size_t extra_size = size + alignment; + assert(extra_size >= size, "overflow, size is too large to allow alignment"); + + char* aligned_base = NULL; + + do { + char* extra_base = os::reserve_memory(extra_size, NULL, alignment); + if (extra_base == NULL) { + return NULL; + } + // Do manual alignment + aligned_base = (char*) align_size_up((uintptr_t) extra_base, alignment); + + os::release_memory(extra_base, extra_size); + + aligned_base = os::reserve_memory(size, aligned_base); + + } while (aligned_base == NULL); + + return aligned_base; +} + char* os::pd_reserve_memory(size_t bytes, char* addr, size_t alignment_hint) { assert((size_t)addr % os::vm_allocation_granularity() == 0, "reserve alignment"); diff --git a/hotspot/src/os_cpu/solaris_x86/vm/assembler_solaris_x86.cpp b/hotspot/src/os_cpu/solaris_x86/vm/assembler_solaris_x86.cpp index ed25848bca8..203da611c01 100644 --- a/hotspot/src/os_cpu/solaris_x86/vm/assembler_solaris_x86.cpp +++ b/hotspot/src/os_cpu/solaris_x86/vm/assembler_solaris_x86.cpp @@ -116,7 +116,7 @@ void MacroAssembler::get_thread(Register thread) { ThreadLocalStorage::pd_tlsAccessMode tlsMode = ThreadLocalStorage::pd_getTlsAccessMode (); if (tlsMode == ThreadLocalStorage::pd_tlsAccessIndirect) { // T1 // Use thread as a temporary: mov r, gs:[0]; mov r, [r+tlsOffset] - emit_byte (segment); + emit_int8 (segment); // ExternalAddress doesn't work because it can't take NULL AddressLiteral null(0, relocInfo::none); movptr (thread, null); @@ -125,7 +125,7 @@ void MacroAssembler::get_thread(Register thread) { } else if (tlsMode == ThreadLocalStorage::pd_tlsAccessDirect) { // T2 // mov r, gs:[tlsOffset] - emit_byte (segment); + emit_int8 (segment); AddressLiteral tls_off((address)ThreadLocalStorage::pd_getTlsOffset(), relocInfo::none); movptr (thread, tls_off); return ; diff --git a/hotspot/src/os_cpu/windows_x86/vm/assembler_windows_x86.cpp b/hotspot/src/os_cpu/windows_x86/vm/assembler_windows_x86.cpp index ce629e20762..ce48421c6d4 100644 --- a/hotspot/src/os_cpu/windows_x86/vm/assembler_windows_x86.cpp +++ b/hotspot/src/os_cpu/windows_x86/vm/assembler_windows_x86.cpp @@ -30,7 +30,7 @@ void MacroAssembler::int3() { - emit_byte(0xCC); + emit_int8((unsigned char)0xCC); } #ifndef _LP64 diff --git a/hotspot/src/share/vm/asm/assembler.cpp b/hotspot/src/share/vm/asm/assembler.cpp index 6a34989ec7b..669f49039fc 100644 --- a/hotspot/src/share/vm/asm/assembler.cpp +++ b/hotspot/src/share/vm/asm/assembler.cpp @@ -109,37 +109,6 @@ void AbstractAssembler::flush() { ICache::invalidate_range(addr_at(0), offset()); } - -void AbstractAssembler::a_byte(int x) { - emit_byte(x); -} - - -void AbstractAssembler::a_long(jint x) { - emit_long(x); -} - -// Labels refer to positions in the (to be) generated code. There are bound -// and unbound -// -// Bound labels refer to known positions in the already generated code. -// offset() is the position the label refers to. -// -// Unbound labels refer to unknown positions in the code to be generated; it -// may contain a list of unresolved displacements that refer to it -#ifndef PRODUCT -void AbstractAssembler::print(Label& L) { - if (L.is_bound()) { - tty->print_cr("bound label to %d|%d", L.loc_pos(), L.loc_sect()); - } else if (L.is_unbound()) { - L.print_instructions((MacroAssembler*)this); - } else { - tty->print_cr("label in inconsistent state (loc = %d)", L.loc()); - } -} -#endif // PRODUCT - - void AbstractAssembler::bind(Label& L) { if (L.is_bound()) { // Assembler can bind a label more than once to the same place. @@ -342,28 +311,3 @@ bool MacroAssembler::needs_explicit_null_check(intptr_t offset) { #endif return offset < 0 || os::vm_page_size() <= offset; } - -#ifndef PRODUCT -void Label::print_instructions(MacroAssembler* masm) const { - CodeBuffer* cb = masm->code(); - for (int i = 0; i < _patch_index; ++i) { - int branch_loc; - if (i >= PatchCacheSize) { - branch_loc = _patch_overflow->at(i - PatchCacheSize); - } else { - branch_loc = _patches[i]; - } - int branch_pos = CodeBuffer::locator_pos(branch_loc); - int branch_sect = CodeBuffer::locator_sect(branch_loc); - address branch = cb->locator_address(branch_loc); - tty->print_cr("unbound label"); - tty->print("@ %d|%d ", branch_pos, branch_sect); - if (branch_sect == CodeBuffer::SECT_CONSTS) { - tty->print_cr(PTR_FORMAT, *(address*)branch); - continue; - } - masm->pd_print_patched_instruction(branch); - tty->cr(); - } -} -#endif // ndef PRODUCT diff --git a/hotspot/src/share/vm/asm/assembler.hpp b/hotspot/src/share/vm/asm/assembler.hpp index 5de33dd503e..ca26ea5bba9 100644 --- a/hotspot/src/share/vm/asm/assembler.hpp +++ b/hotspot/src/share/vm/asm/assembler.hpp @@ -216,17 +216,6 @@ class AbstractAssembler : public ResourceObj { bool isByte(int x) const { return 0 <= x && x < 0x100; } bool isShiftCount(int x) const { return 0 <= x && x < 32; } - void emit_int8( int8_t x) { code_section()->emit_int8( x); } - void emit_int16( int16_t x) { code_section()->emit_int16( x); } - void emit_int32( int32_t x) { code_section()->emit_int32( x); } - void emit_int64( int64_t x) { code_section()->emit_int64( x); } - - void emit_float( jfloat x) { code_section()->emit_float( x); } - void emit_double( jdouble x) { code_section()->emit_double( x); } - void emit_address(address x) { code_section()->emit_address(x); } - - void emit_byte(int x) { emit_int8 (x); } // deprecated - void emit_word(int x) { emit_int16(x); } // deprecated void emit_long(jint x) { emit_int32(x); } // deprecated // Instruction boundaries (required when emitting relocatable values). @@ -277,9 +266,6 @@ class AbstractAssembler : public ResourceObj { }; #endif - // Label functions - void print(Label& L); - public: // Creation @@ -288,6 +274,15 @@ class AbstractAssembler : public ResourceObj { // ensure buf contains all code (call this before using/copying the code) void flush(); + void emit_int8( int8_t x) { code_section()->emit_int8( x); } + void emit_int16( int16_t x) { code_section()->emit_int16( x); } + void emit_int32( int32_t x) { code_section()->emit_int32( x); } + void emit_int64( int64_t x) { code_section()->emit_int64( x); } + + void emit_float( jfloat x) { code_section()->emit_float( x); } + void emit_double( jdouble x) { code_section()->emit_double( x); } + void emit_address(address x) { code_section()->emit_address(x); } + // min and max values for signed immediate ranges static int min_simm(int nbits) { return -(intptr_t(1) << (nbits - 1)) ; } static int max_simm(int nbits) { return (intptr_t(1) << (nbits - 1)) - 1; } @@ -327,8 +322,6 @@ class AbstractAssembler : public ResourceObj { void clear_inst_mark() { code_section()->clear_mark(); } // Constants in code - void a_byte(int x); - void a_long(jint x); void relocate(RelocationHolder const& rspec, int format = 0) { assert(!pd_check_instruction_mark() || inst_mark() == NULL || inst_mark() == code_section()->end(), @@ -441,15 +434,6 @@ class AbstractAssembler : public ResourceObj { */ void pd_patch_instruction(address branch, address target); -#ifndef PRODUCT - /** - * Platform-dependent method of printing an instruction that needs to be - * patched. - * - * @param branch the instruction to be patched in the buffer. - */ - static void pd_print_patched_instruction(address branch); -#endif // PRODUCT }; #ifdef TARGET_ARCH_x86 diff --git a/hotspot/src/share/vm/asm/codeBuffer.cpp b/hotspot/src/share/vm/asm/codeBuffer.cpp index 6b5548a1951..2a4a8f2981f 100644 --- a/hotspot/src/share/vm/asm/codeBuffer.cpp +++ b/hotspot/src/share/vm/asm/codeBuffer.cpp @@ -496,21 +496,9 @@ void CodeBuffer::compute_final_layout(CodeBuffer* dest) const { dest->verify_section_allocation(); } -// Anonymous classes need mirror to keep the metadata alive but -// for regular classes, the class_loader is sufficient. +// Append an oop reference that keeps the class alive. static void append_oop_references(GrowableArray* oops, Klass* k) { - if (k->oop_is_instance()) { - InstanceKlass* ik = InstanceKlass::cast(k); - if (ik->is_anonymous()) { - oop o = ik->java_mirror(); - assert (o != NULL, "should have a mirror"); - if (!oops->contains(o)) { - oops->append(o); - } - return; // only need the mirror - } - } - oop cl = k->class_loader(); + oop cl = k->klass_holder(); if (cl != NULL && !oops->contains(cl)) { oops->append(cl); } diff --git a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp index 70b69157530..85c3aa1c9a9 100644 --- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp +++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp @@ -3442,6 +3442,11 @@ bool GraphBuilder::try_inline_intrinsics(ciMethod* callee) { preserves_state = true; break; + case vmIntrinsics::_loadFence : + case vmIntrinsics::_storeFence: + case vmIntrinsics::_fullFence : + break; + default : return false; // do not inline } // create intrinsic node diff --git a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp index cf865f1b557..65bc34e3de6 100644 --- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp +++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp @@ -2977,6 +2977,16 @@ void LIRGenerator::do_Intrinsic(Intrinsic* x) { do_CompareAndSwap(x, longType); break; + case vmIntrinsics::_loadFence : + if (os::is_MP()) __ membar_acquire(); + break; + case vmIntrinsics::_storeFence: + if (os::is_MP()) __ membar_release(); + break; + case vmIntrinsics::_fullFence : + if (os::is_MP()) __ membar(); + break; + case vmIntrinsics::_Reference_get: do_Reference_get(x); break; diff --git a/hotspot/src/share/vm/ci/ciField.cpp b/hotspot/src/share/vm/ci/ciField.cpp index 5cfa47b277a..fe967554c3a 100644 --- a/hotspot/src/share/vm/ci/ciField.cpp +++ b/hotspot/src/share/vm/ci/ciField.cpp @@ -366,10 +366,12 @@ bool ciField::will_link(ciInstanceKlass* accessing_klass, // ------------------------------------------------------------------ // ciField::print void ciField::print() { - tty->print("print("print_symbol(); + tty->print(" signature="); + _signature->print_symbol(); tty->print(" offset=%d type=", _offset); if (_type != NULL) _type->print_name(); else tty->print("(reference)"); diff --git a/hotspot/src/share/vm/classfile/classLoaderData.cpp b/hotspot/src/share/vm/classfile/classLoaderData.cpp index c4479bfcf69..eaf829738d0 100644 --- a/hotspot/src/share/vm/classfile/classLoaderData.cpp +++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp @@ -64,8 +64,10 @@ ClassLoaderData * ClassLoaderData::_the_null_class_loader_data = NULL; -ClassLoaderData::ClassLoaderData(Handle h_class_loader) : _class_loader(h_class_loader()), - _metaspace(NULL), _unloading(false), _keep_alive(false), _klasses(NULL), +ClassLoaderData::ClassLoaderData(Handle h_class_loader, bool is_anonymous) : + _class_loader(h_class_loader()), + _is_anonymous(is_anonymous), _keep_alive(is_anonymous), // initially + _metaspace(NULL), _unloading(false), _klasses(NULL), _claimed(0), _jmethod_ids(NULL), _handles(NULL), _deallocate_list(NULL), _next(NULL), _dependencies(NULL), _metaspace_lock(new Mutex(Monitor::leaf+1, "Metaspace allocation lock", true)) { @@ -167,16 +169,18 @@ void ClassLoaderData::add_dependency(Handle dependency, TRAPS) { ok = (objArrayOop)ok->obj_at(1); } + // Must handle over GC points + assert (last != NULL, "dependencies should be initialized"); + objArrayHandle last_handle(THREAD, last); + // Create a new dependency node with fields for (class_loader or mirror, next) objArrayOop deps = oopFactory::new_objectArray(2, CHECK); deps->obj_at_put(0, dependency()); - // Must handle over more GC points + // Must handle over GC points objArrayHandle new_dependency(THREAD, deps); // Add the dependency under lock - assert (last != NULL, "dependencies should be initialized"); - objArrayHandle last_handle(THREAD, last); locked_add_dependency(last_handle, new_dependency); } @@ -257,13 +261,6 @@ void ClassLoaderData::remove_class(Klass* scratch_class) { ShouldNotReachHere(); // should have found this class!! } - -bool ClassLoaderData::is_anonymous() const { - Klass* k = _klasses; - return (_keep_alive || (k != NULL && k->oop_is_instance() && - InstanceKlass::cast(k)->is_anonymous())); -} - void ClassLoaderData::unload() { _unloading = true; @@ -396,8 +393,7 @@ void ClassLoaderData::free_deallocate_list() { // These anonymous class loaders are to contain classes used for JSR292 ClassLoaderData* ClassLoaderData::anonymous_class_loader_data(oop loader, TRAPS) { // Add a new class loader data to the graph. - ClassLoaderData* cld = ClassLoaderDataGraph::add(NULL, loader, CHECK_NULL); - return cld; + return ClassLoaderDataGraph::add(NULL, loader, CHECK_NULL); } const char* ClassLoaderData::loader_name() { @@ -475,7 +471,9 @@ ClassLoaderData* ClassLoaderDataGraph::add(ClassLoaderData** cld_addr, Handle lo // Create one. ClassLoaderData* *list_head = &_head; ClassLoaderData* next = _head; - ClassLoaderData* cld = new ClassLoaderData(loader); + + bool is_anonymous = (cld_addr == NULL); + ClassLoaderData* cld = new ClassLoaderData(loader, is_anonymous); if (cld_addr != NULL) { // First, Atomically set it @@ -485,10 +483,6 @@ ClassLoaderData* ClassLoaderDataGraph::add(ClassLoaderData** cld_addr, Handle lo // Returns the data. return old; } - } else { - // Disallow unloading for this CLD during initialization if there is no - // class_loader oop to link this to. - cld->set_keep_alive(true); } // We won the race, and therefore the task of adding the data to the list of diff --git a/hotspot/src/share/vm/classfile/classLoaderData.hpp b/hotspot/src/share/vm/classfile/classLoaderData.hpp index 71cd7b2a4fa..9525658e67a 100644 --- a/hotspot/src/share/vm/classfile/classLoaderData.hpp +++ b/hotspot/src/share/vm/classfile/classLoaderData.hpp @@ -8,7 +8,7 @@ * * 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 + * 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). * @@ -109,6 +109,7 @@ class ClassLoaderData : public CHeapObj { Mutex* _metaspace_lock; // Locks the metaspace for allocations and setup. bool _unloading; // true if this class loader goes away bool _keep_alive; // if this CLD can be unloaded for anonymous loaders + bool _is_anonymous; // if this CLD is for an anonymous class volatile int _claimed; // true if claimed, for example during GC traces. // To avoid applying oop closure more than once. // Has to be an int because we cas it. @@ -139,7 +140,7 @@ class ClassLoaderData : public CHeapObj { void set_next(ClassLoaderData* next) { _next = next; } ClassLoaderData* next() const { return _next; } - ClassLoaderData(Handle h_class_loader); + ClassLoaderData(Handle h_class_loader, bool is_anonymous); ~ClassLoaderData(); void set_metaspace(Metaspace* m) { _metaspace = m; } @@ -174,12 +175,12 @@ class ClassLoaderData : public CHeapObj { return _the_null_class_loader_data; } - bool is_anonymous() const; + bool is_anonymous() const { return _is_anonymous; } static void init_null_class_loader_data() { assert(_the_null_class_loader_data == NULL, "cannot initialize twice"); assert(ClassLoaderDataGraph::_head == NULL, "cannot initialize twice"); - _the_null_class_loader_data = new ClassLoaderData((oop)NULL); + _the_null_class_loader_data = new ClassLoaderData((oop)NULL, false); ClassLoaderDataGraph::_head = _the_null_class_loader_data; assert(_the_null_class_loader_data->is_the_null_class_loader_data(), "Must be"); if (DumpSharedSpaces) { diff --git a/hotspot/src/share/vm/classfile/javaClasses.cpp b/hotspot/src/share/vm/classfile/javaClasses.cpp index 80b15fbd2d1..514e15b3fde 100644 --- a/hotspot/src/share/vm/classfile/javaClasses.cpp +++ b/hotspot/src/share/vm/classfile/javaClasses.cpp @@ -327,14 +327,14 @@ jchar* java_lang_String::as_unicode_string(oop java_string, int& length) { return result; } -unsigned int java_lang_String::to_hash(oop java_string) { +unsigned int java_lang_String::hash_code(oop java_string) { int length = java_lang_String::length(java_string); - // Zero length string will hash to zero with String.toHash() function. + // Zero length string will hash to zero with String.hashCode() function. if (length == 0) return 0; typeArrayOop value = java_lang_String::value(java_string); int offset = java_lang_String::offset(java_string); - return java_lang_String::to_hash(value->char_at_addr(offset), length); + return java_lang_String::hash_code(value->char_at_addr(offset), length); } char* java_lang_String::as_quoted_ascii(oop java_string) { diff --git a/hotspot/src/share/vm/classfile/javaClasses.hpp b/hotspot/src/share/vm/classfile/javaClasses.hpp index 9359d5b3c6e..a60872b365a 100644 --- a/hotspot/src/share/vm/classfile/javaClasses.hpp +++ b/hotspot/src/share/vm/classfile/javaClasses.hpp @@ -166,8 +166,8 @@ class java_lang_String : AllStatic { // objects in the shared archive file. // hash P(31) from Kernighan & Ritchie // - // For this reason, THIS ALGORITHM MUST MATCH String.toHash(). - template static unsigned int to_hash(T* s, int len) { + // For this reason, THIS ALGORITHM MUST MATCH String.hashCode(). + template static unsigned int hash_code(T* s, int len) { unsigned int h = 0; while (len-- > 0) { h = 31*h + (unsigned int) *s; @@ -175,10 +175,10 @@ class java_lang_String : AllStatic { } return h; } - static unsigned int to_hash(oop java_string); + static unsigned int hash_code(oop java_string); // This is the string hash code used by the StringTable, which may be - // the same as String.toHash or an alternate hash code. + // the same as String.hashCode or an alternate hash code. static unsigned int hash_string(oop java_string); static bool equals(oop java_string, jchar* chars, int len); diff --git a/hotspot/src/share/vm/classfile/symbolTable.cpp b/hotspot/src/share/vm/classfile/symbolTable.cpp index 3c936620521..87de232d7a5 100644 --- a/hotspot/src/share/vm/classfile/symbolTable.cpp +++ b/hotspot/src/share/vm/classfile/symbolTable.cpp @@ -179,7 +179,7 @@ Symbol* SymbolTable::lookup(int index, const char* name, unsigned int SymbolTable::hash_symbol(const char* s, int len) { return use_alternate_hashcode() ? AltHashing::murmur3_32(seed(), (const jbyte*)s, len) : - java_lang_String::to_hash(s, len); + java_lang_String::hash_code(s, len); } @@ -617,7 +617,7 @@ bool StringTable::_needs_rehashing = false; // Pick hashing algorithm unsigned int StringTable::hash_string(const jchar* s, int len) { return use_alternate_hashcode() ? AltHashing::murmur3_32(seed(), s, len) : - java_lang_String::to_hash(s, len); + java_lang_String::hash_code(s, len); } oop StringTable::lookup(int index, jchar* name, diff --git a/hotspot/src/share/vm/classfile/vmSymbols.hpp b/hotspot/src/share/vm/classfile/vmSymbols.hpp index 940aac3c29b..adef4594c2f 100644 --- a/hotspot/src/share/vm/classfile/vmSymbols.hpp +++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp @@ -756,6 +756,15 @@ do_intrinsic(_unpark, sun_misc_Unsafe, unpark_name, unpark_signature, F_RN) \ do_name( unpark_name, "unpark") \ do_alias( unpark_signature, /*(LObject;)V*/ object_void_signature) \ + do_intrinsic(_loadFence, sun_misc_Unsafe, loadFence_name, loadFence_signature, F_RN) \ + do_name( loadFence_name, "loadFence") \ + do_alias( loadFence_signature, void_method_signature) \ + do_intrinsic(_storeFence, sun_misc_Unsafe, storeFence_name, storeFence_signature, F_RN) \ + do_name( storeFence_name, "storeFence") \ + do_alias( storeFence_signature, void_method_signature) \ + do_intrinsic(_fullFence, sun_misc_Unsafe, fullFence_name, fullFence_signature, F_RN) \ + do_name( fullFence_name, "fullFence") \ + do_alias( fullFence_signature, void_method_signature) \ \ /* unsafe memory references (there are a lot of them...) */ \ do_signature(getObject_signature, "(Ljava/lang/Object;J)Ljava/lang/Object;") \ @@ -897,12 +906,14 @@ do_intrinsic(_getAndAddLong, sun_misc_Unsafe, getAndAddLong_name, getAndAddLong_signature, F_R) \ do_name( getAndAddLong_name, "getAndAddLong") \ do_signature(getAndAddLong_signature, "(Ljava/lang/Object;JJ)J" ) \ - do_intrinsic(_getAndSetInt, sun_misc_Unsafe, getAndSet_name, getAndSetInt_signature, F_R) \ - do_name( getAndSet_name, "getAndSet") \ + do_intrinsic(_getAndSetInt, sun_misc_Unsafe, getAndSetInt_name, getAndSetInt_signature, F_R) \ + do_name( getAndSetInt_name, "getAndSetInt") \ do_alias( getAndSetInt_signature, /*"(Ljava/lang/Object;JI)I"*/ getAndAddInt_signature) \ - do_intrinsic(_getAndSetLong, sun_misc_Unsafe, getAndSet_name, getAndSetLong_signature, F_R) \ + do_intrinsic(_getAndSetLong, sun_misc_Unsafe, getAndSetLong_name, getAndSetLong_signature, F_R) \ + do_name( getAndSetLong_name, "getAndSetLong") \ do_alias( getAndSetLong_signature, /*"(Ljava/lang/Object;JJ)J"*/ getAndAddLong_signature) \ - do_intrinsic(_getAndSetObject, sun_misc_Unsafe, getAndSet_name, getAndSetObject_signature, F_R) \ + do_intrinsic(_getAndSetObject, sun_misc_Unsafe, getAndSetObject_name, getAndSetObject_signature, F_R)\ + do_name( getAndSetObject_name, "getAndSetObject") \ do_signature(getAndSetObject_signature, "(Ljava/lang/Object;JLjava/lang/Object;)Ljava/lang/Object;" ) \ \ /* prefetch_signature is shared by all prefetch variants */ \ diff --git a/hotspot/src/share/vm/compiler/compileBroker.cpp b/hotspot/src/share/vm/compiler/compileBroker.cpp index bd76850ee3b..73ab865dc74 100644 --- a/hotspot/src/share/vm/compiler/compileBroker.cpp +++ b/hotspot/src/share/vm/compiler/compileBroker.cpp @@ -269,12 +269,10 @@ void CompileTask::initialize(int compile_id, const char* comment, bool is_blocking) { assert(!_lock->is_locked(), "bad locking"); - InstanceKlass* holder = method->method_holder(); _compile_id = compile_id; _method = method(); - _method_holder = JNIHandles::make_global( - holder->is_anonymous() ? holder->java_mirror(): holder->class_loader()); + _method_holder = JNIHandles::make_global(method->method_holder()->klass_holder()); _osr_bci = osr_bci; _is_blocking = is_blocking; _comp_level = comp_level; @@ -298,10 +296,7 @@ void CompileTask::initialize(int compile_id, } else { _hot_method = hot_method(); // only add loader or mirror if different from _method_holder - InstanceKlass* hot_holder = hot_method->method_holder(); - _hot_method_holder = JNIHandles::make_global( - hot_holder->is_anonymous() ? hot_holder->java_mirror() : - hot_holder->class_loader()); + _hot_method_holder = JNIHandles::make_global(hot_method->method_holder()->klass_holder()); } } } diff --git a/hotspot/src/share/vm/compiler/compilerOracle.cpp b/hotspot/src/share/vm/compiler/compilerOracle.cpp index 7e620cec9fd..73e348bc97c 100644 --- a/hotspot/src/share/vm/compiler/compilerOracle.cpp +++ b/hotspot/src/share/vm/compiler/compilerOracle.cpp @@ -538,6 +538,7 @@ void CompilerOracle::parse_from_line(char* line) { if (match != NULL) { if (!_quiet) { + ResourceMark rm; tty->print("CompilerOracle: %s ", command_names[command]); match->print(); } diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp index d3dc1eb7bb7..e03b2f41cfc 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp @@ -46,27 +46,11 @@ // Concurrent marking bit map wrapper -CMBitMapRO::CMBitMapRO(ReservedSpace rs, int shifter) : - _bm((uintptr_t*)NULL,0), +CMBitMapRO::CMBitMapRO(int shifter) : + _bm(), _shifter(shifter) { - _bmStartWord = (HeapWord*)(rs.base()); - _bmWordSize = rs.size()/HeapWordSize; // rs.size() is in bytes - ReservedSpace brs(ReservedSpace::allocation_align_size_up( - (_bmWordSize >> (_shifter + LogBitsPerByte)) + 1)); - - MemTracker::record_virtual_memory_type((address)brs.base(), mtGC); - - guarantee(brs.is_reserved(), "couldn't allocate concurrent marking bit map"); - // For now we'll just commit all of the bit map up fromt. - // Later on we'll try to be more parsimonious with swap. - guarantee(_virtual_space.initialize(brs, brs.size()), - "couldn't reseve backing store for concurrent marking bit map"); - assert(_virtual_space.committed_size() == brs.size(), - "didn't reserve backing store for all of concurrent marking bit map?"); - _bm.set_map((uintptr_t*)_virtual_space.low()); - assert(_virtual_space.committed_size() << (_shifter + LogBitsPerByte) >= - _bmWordSize, "inconsistency in bit map sizing"); - _bm.set_size(_bmWordSize >> _shifter); + _bmStartWord = 0; + _bmWordSize = 0; } HeapWord* CMBitMapRO::getNextMarkedWordAddress(HeapWord* addr, @@ -108,15 +92,40 @@ int CMBitMapRO::heapWordDiffToOffsetDiff(size_t diff) const { } #ifndef PRODUCT -bool CMBitMapRO::covers(ReservedSpace rs) const { +bool CMBitMapRO::covers(ReservedSpace heap_rs) const { // assert(_bm.map() == _virtual_space.low(), "map inconsistency"); assert(((size_t)_bm.size() * ((size_t)1 << _shifter)) == _bmWordSize, "size inconsistency"); - return _bmStartWord == (HeapWord*)(rs.base()) && - _bmWordSize == rs.size()>>LogHeapWordSize; + return _bmStartWord == (HeapWord*)(heap_rs.base()) && + _bmWordSize == heap_rs.size()>>LogHeapWordSize; } #endif +bool CMBitMap::allocate(ReservedSpace heap_rs) { + _bmStartWord = (HeapWord*)(heap_rs.base()); + _bmWordSize = heap_rs.size()/HeapWordSize; // heap_rs.size() is in bytes + ReservedSpace brs(ReservedSpace::allocation_align_size_up( + (_bmWordSize >> (_shifter + LogBitsPerByte)) + 1)); + if (!brs.is_reserved()) { + warning("ConcurrentMark marking bit map allocation failure"); + return false; + } + MemTracker::record_virtual_memory_type((address)brs.base(), mtGC); + // For now we'll just commit all of the bit map up front. + // Later on we'll try to be more parsimonious with swap. + if (!_virtual_space.initialize(brs, brs.size())) { + warning("ConcurrentMark marking bit map backing store failure"); + return false; + } + assert(_virtual_space.committed_size() == brs.size(), + "didn't reserve backing store for all of concurrent marking bit map?"); + _bm.set_map((uintptr_t*)_virtual_space.low()); + assert(_virtual_space.committed_size() << (_shifter + LogBitsPerByte) >= + _bmWordSize, "inconsistency in bit map sizing"); + _bm.set_size(_bmWordSize >> _shifter); + return true; +} + void CMBitMap::clearAll() { _bm.clear(); return; @@ -163,20 +172,79 @@ CMMarkStack::CMMarkStack(ConcurrentMark* cm) : #endif {} -void CMMarkStack::allocate(size_t size) { - _base = NEW_C_HEAP_ARRAY(oop, size, mtGC); - if (_base == NULL) { - vm_exit_during_initialization("Failed to allocate CM region mark stack"); +bool CMMarkStack::allocate(size_t capacity) { + // allocate a stack of the requisite depth + ReservedSpace rs(ReservedSpace::allocation_align_size_up(capacity * sizeof(oop))); + if (!rs.is_reserved()) { + warning("ConcurrentMark MarkStack allocation failure"); + return false; } - _index = 0; - _capacity = (jint) size; + MemTracker::record_virtual_memory_type((address)rs.base(), mtGC); + if (!_virtual_space.initialize(rs, rs.size())) { + warning("ConcurrentMark MarkStack backing store failure"); + // Release the virtual memory reserved for the marking stack + rs.release(); + return false; + } + assert(_virtual_space.committed_size() == rs.size(), + "Didn't reserve backing store for all of ConcurrentMark stack?"); + _base = (oop*) _virtual_space.low(); + setEmpty(); + _capacity = (jint) capacity; _saved_index = -1; NOT_PRODUCT(_max_depth = 0); + return true; +} + +void CMMarkStack::expand() { + // Called, during remark, if we've overflown the marking stack during marking. + assert(isEmpty(), "stack should been emptied while handling overflow"); + assert(_capacity <= (jint) MarkStackSizeMax, "stack bigger than permitted"); + // Clear expansion flag + _should_expand = false; + if (_capacity == (jint) MarkStackSizeMax) { + if (PrintGCDetails && Verbose) { + gclog_or_tty->print_cr(" (benign) Can't expand marking stack capacity, at max size limit"); + } + return; + } + // Double capacity if possible + jint new_capacity = MIN2(_capacity*2, (jint) MarkStackSizeMax); + // Do not give up existing stack until we have managed to + // get the double capacity that we desired. + ReservedSpace rs(ReservedSpace::allocation_align_size_up(new_capacity * + sizeof(oop))); + if (rs.is_reserved()) { + // Release the backing store associated with old stack + _virtual_space.release(); + // Reinitialize virtual space for new stack + if (!_virtual_space.initialize(rs, rs.size())) { + fatal("Not enough swap for expanded marking stack capacity"); + } + _base = (oop*)(_virtual_space.low()); + _index = 0; + _capacity = new_capacity; + } else { + if (PrintGCDetails && Verbose) { + // Failed to double capacity, continue; + gclog_or_tty->print(" (benign) Failed to expand marking stack capacity from " + SIZE_FORMAT"K to " SIZE_FORMAT"K", + _capacity / K, new_capacity / K); + } + } +} + +void CMMarkStack::set_should_expand() { + // If we're resetting the marking state because of an + // marking stack overflow, record that we should, if + // possible, expand the stack. + _should_expand = _cm->has_overflown(); } CMMarkStack::~CMMarkStack() { if (_base != NULL) { - FREE_C_HEAP_ARRAY(oop, _base, mtGC); + _base = NULL; + _virtual_space.release(); } } @@ -217,7 +285,7 @@ void CMMarkStack::par_adjoin_arr(oop* ptr_arr, int n) { jint res = Atomic::cmpxchg(next_index, &_index, index); if (res == index) { for (int i = 0; i < n; i++) { - int ind = index + i; + int ind = index + i; assert(ind < _capacity, "By overflow test above."); _base[ind] = ptr_arr[i]; } @@ -228,7 +296,6 @@ void CMMarkStack::par_adjoin_arr(oop* ptr_arr, int n) { } } - void CMMarkStack::par_push_arr(oop* ptr_arr, int n) { MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag); jint start = _index; @@ -244,9 +311,9 @@ void CMMarkStack::par_push_arr(oop* ptr_arr, int n) { assert(ind < _capacity, "By overflow test above."); _base[ind] = ptr_arr[i]; } + NOT_PRODUCT(_max_depth = MAX2(_max_depth, next_index)); } - bool CMMarkStack::par_pop_arr(oop* ptr_arr, int max, int* n) { MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag); jint index = _index; @@ -255,7 +322,7 @@ bool CMMarkStack::par_pop_arr(oop* ptr_arr, int max, int* n) { return false; } else { int k = MIN2(max, index); - jint new_ind = index - k; + jint new_ind = index - k; for (int j = 0; j < k; j++) { ptr_arr[j] = _base[new_ind + j]; } @@ -404,9 +471,10 @@ uint ConcurrentMark::scale_parallel_threads(uint n_par_threads) { return MAX2((n_par_threads + 2) / 4, 1U); } -ConcurrentMark::ConcurrentMark(ReservedSpace rs, uint max_regions) : - _markBitMap1(rs, MinObjAlignment - 1), - _markBitMap2(rs, MinObjAlignment - 1), +ConcurrentMark::ConcurrentMark(G1CollectedHeap* g1h, ReservedSpace heap_rs) : + _g1h(g1h), + _markBitMap1(MinObjAlignment - 1), + _markBitMap2(MinObjAlignment - 1), _parallel_marking_threads(0), _max_parallel_marking_threads(0), @@ -415,10 +483,10 @@ ConcurrentMark::ConcurrentMark(ReservedSpace rs, uint max_regions) : _cleanup_sleep_factor(0.0), _cleanup_task_overhead(1.0), _cleanup_list("Cleanup List"), - _region_bm((BitMap::idx_t) max_regions, false /* in_resource_area*/), - _card_bm((rs.size() + CardTableModRefBS::card_size - 1) >> - CardTableModRefBS::card_shift, - false /* in_resource_area*/), + _region_bm((BitMap::idx_t)(g1h->max_regions()), false /* in_resource_area*/), + _card_bm((heap_rs.size() + CardTableModRefBS::card_size - 1) >> + CardTableModRefBS::card_shift, + false /* in_resource_area*/), _prevMarkBitMap(&_markBitMap1), _nextMarkBitMap(&_markBitMap2), @@ -449,7 +517,8 @@ ConcurrentMark::ConcurrentMark(ReservedSpace rs, uint max_regions) : _parallel_workers(NULL), _count_card_bitmaps(NULL), - _count_marked_bytes(NULL) { + _count_marked_bytes(NULL), + _completed_initialization(false) { CMVerboseLevel verbose_level = (CMVerboseLevel) G1MarkingVerboseLevel; if (verbose_level < no_verbose) { verbose_level = no_verbose; @@ -464,61 +533,34 @@ ConcurrentMark::ConcurrentMark(ReservedSpace rs, uint max_regions) : "heap end = "PTR_FORMAT, _heap_start, _heap_end); } - _markStack.allocate(MarkStackSize); + if (!_markBitMap1.allocate(heap_rs)) { + warning("Failed to allocate first CM bit map"); + return; + } + if (!_markBitMap2.allocate(heap_rs)) { + warning("Failed to allocate second CM bit map"); + return; + } // Create & start a ConcurrentMark thread. _cmThread = new ConcurrentMarkThread(this); assert(cmThread() != NULL, "CM Thread should have been created"); assert(cmThread()->cm() != NULL, "CM Thread should refer to this cm"); - _g1h = G1CollectedHeap::heap(); assert(CGC_lock != NULL, "Where's the CGC_lock?"); - assert(_markBitMap1.covers(rs), "_markBitMap1 inconsistency"); - assert(_markBitMap2.covers(rs), "_markBitMap2 inconsistency"); + assert(_markBitMap1.covers(heap_rs), "_markBitMap1 inconsistency"); + assert(_markBitMap2.covers(heap_rs), "_markBitMap2 inconsistency"); SATBMarkQueueSet& satb_qs = JavaThread::satb_mark_queue_set(); satb_qs.set_buffer_size(G1SATBBufferSize); _root_regions.init(_g1h, this); - _tasks = NEW_C_HEAP_ARRAY(CMTask*, _max_worker_id, mtGC); - _accum_task_vtime = NEW_C_HEAP_ARRAY(double, _max_worker_id, mtGC); - - _count_card_bitmaps = NEW_C_HEAP_ARRAY(BitMap, _max_worker_id, mtGC); - _count_marked_bytes = NEW_C_HEAP_ARRAY(size_t*, _max_worker_id, mtGC); - - BitMap::idx_t card_bm_size = _card_bm.size(); - - // so that the assertion in MarkingTaskQueue::task_queue doesn't fail - _active_tasks = _max_worker_id; - for (uint i = 0; i < _max_worker_id; ++i) { - CMTaskQueue* task_queue = new CMTaskQueue(); - task_queue->initialize(); - _task_queues->register_queue(i, task_queue); - - _count_card_bitmaps[i] = BitMap(card_bm_size, false); - _count_marked_bytes[i] = NEW_C_HEAP_ARRAY(size_t, (size_t) max_regions, mtGC); - - _tasks[i] = new CMTask(i, this, - _count_marked_bytes[i], - &_count_card_bitmaps[i], - task_queue, _task_queues); - - _accum_task_vtime[i] = 0.0; - } - - // Calculate the card number for the bottom of the heap. Used - // in biasing indexes into the accounting card bitmaps. - _heap_bottom_card_num = - intptr_t(uintptr_t(_g1h->reserved_region().start()) >> - CardTableModRefBS::card_shift); - - // Clear all the liveness counting data - clear_all_count_data(); - if (ConcGCThreads > ParallelGCThreads) { - vm_exit_during_initialization("Can't have more ConcGCThreads " - "than ParallelGCThreads."); + warning("Can't have more ConcGCThreads (" UINT32_FORMAT ") " + "than ParallelGCThreads (" UINT32_FORMAT ").", + ConcGCThreads, ParallelGCThreads); + return; } if (ParallelGCThreads == 0) { // if we are not running with any parallel GC threads we will not @@ -590,9 +632,86 @@ ConcurrentMark::ConcurrentMark(ReservedSpace rs, uint max_regions) : } } + if (FLAG_IS_DEFAULT(MarkStackSize)) { + uintx mark_stack_size = + MIN2(MarkStackSizeMax, + MAX2(MarkStackSize, (uintx) (parallel_marking_threads() * TASKQUEUE_SIZE))); + // Verify that the calculated value for MarkStackSize is in range. + // It would be nice to use the private utility routine from Arguments. + if (!(mark_stack_size >= 1 && mark_stack_size <= MarkStackSizeMax)) { + warning("Invalid value calculated for MarkStackSize (" UINTX_FORMAT "): " + "must be between " UINTX_FORMAT " and " UINTX_FORMAT, + mark_stack_size, 1, MarkStackSizeMax); + return; + } + FLAG_SET_ERGO(uintx, MarkStackSize, mark_stack_size); + } else { + // Verify MarkStackSize is in range. + if (FLAG_IS_CMDLINE(MarkStackSize)) { + if (FLAG_IS_DEFAULT(MarkStackSizeMax)) { + if (!(MarkStackSize >= 1 && MarkStackSize <= MarkStackSizeMax)) { + warning("Invalid value specified for MarkStackSize (" UINTX_FORMAT "): " + "must be between " UINTX_FORMAT " and " UINTX_FORMAT, + MarkStackSize, 1, MarkStackSizeMax); + return; + } + } else if (FLAG_IS_CMDLINE(MarkStackSizeMax)) { + if (!(MarkStackSize >= 1 && MarkStackSize <= MarkStackSizeMax)) { + warning("Invalid value specified for MarkStackSize (" UINTX_FORMAT ")" + " or for MarkStackSizeMax (" UINTX_FORMAT ")", + MarkStackSize, MarkStackSizeMax); + return; + } + } + } + } + + if (!_markStack.allocate(MarkStackSize)) { + warning("Failed to allocate CM marking stack"); + return; + } + + _tasks = NEW_C_HEAP_ARRAY(CMTask*, _max_worker_id, mtGC); + _accum_task_vtime = NEW_C_HEAP_ARRAY(double, _max_worker_id, mtGC); + + _count_card_bitmaps = NEW_C_HEAP_ARRAY(BitMap, _max_worker_id, mtGC); + _count_marked_bytes = NEW_C_HEAP_ARRAY(size_t*, _max_worker_id, mtGC); + + BitMap::idx_t card_bm_size = _card_bm.size(); + + // so that the assertion in MarkingTaskQueue::task_queue doesn't fail + _active_tasks = _max_worker_id; + + size_t max_regions = (size_t) _g1h->max_regions(); + for (uint i = 0; i < _max_worker_id; ++i) { + CMTaskQueue* task_queue = new CMTaskQueue(); + task_queue->initialize(); + _task_queues->register_queue(i, task_queue); + + _count_card_bitmaps[i] = BitMap(card_bm_size, false); + _count_marked_bytes[i] = NEW_C_HEAP_ARRAY(size_t, max_regions, mtGC); + + _tasks[i] = new CMTask(i, this, + _count_marked_bytes[i], + &_count_card_bitmaps[i], + task_queue, _task_queues); + + _accum_task_vtime[i] = 0.0; + } + + // Calculate the card number for the bottom of the heap. Used + // in biasing indexes into the accounting card bitmaps. + _heap_bottom_card_num = + intptr_t(uintptr_t(_g1h->reserved_region().start()) >> + CardTableModRefBS::card_shift); + + // Clear all the liveness counting data + clear_all_count_data(); + // so that the call below can read a sensible value - _heap_start = (HeapWord*) rs.base(); + _heap_start = (HeapWord*) heap_rs.base(); set_non_marking_state(); + _completed_initialization = true; } void ConcurrentMark::update_g1_committed(bool force) { @@ -1165,6 +1284,11 @@ void ConcurrentMark::checkpointRootsFinal(bool clear_all_soft_refs) { assert(!restart_for_overflow(), "sanity"); } + // Expand the marking stack, if we have to and if we can. + if (_markStack.should_expand()) { + _markStack.expand(); + } + // Reset the marking state if marking completed if (!restart_for_overflow()) { set_non_marking_state(); @@ -2785,7 +2909,7 @@ void ConcurrentMark::verify_no_cset_oops(bool verify_stacks, // Verify entries on the task queues for (uint i = 0; i < _max_worker_id; i += 1) { cl.set_phase(VerifyNoCSetOopsQueues, i); - OopTaskQueue* queue = _task_queues->queue(i); + CMTaskQueue* queue = _task_queues->queue(i); queue->oops_do(&cl); } } @@ -2840,8 +2964,8 @@ void ConcurrentMark::verify_no_cset_oops(bool verify_stacks, #endif // PRODUCT void ConcurrentMark::clear_marking_state(bool clear_overflow) { - _markStack.setEmpty(); - _markStack.clear_overflow(); + _markStack.set_should_expand(); + _markStack.setEmpty(); // Also clears the _markStack overflow flag if (clear_overflow) { clear_has_overflown(); } else { @@ -2850,7 +2974,7 @@ void ConcurrentMark::clear_marking_state(bool clear_overflow) { _finger = _heap_start; for (uint i = 0; i < _max_worker_id; ++i) { - OopTaskQueue* queue = _task_queues->queue(i); + CMTaskQueue* queue = _task_queues->queue(i); queue->set_empty(); } } diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp index 5bac7a6b34d..8089c98294a 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp @@ -63,7 +63,7 @@ class CMBitMapRO VALUE_OBJ_CLASS_SPEC { public: // constructor - CMBitMapRO(ReservedSpace rs, int shifter); + CMBitMapRO(int shifter); enum { do_yield = true }; @@ -117,8 +117,11 @@ class CMBitMap : public CMBitMapRO { public: // constructor - CMBitMap(ReservedSpace rs, int shifter) : - CMBitMapRO(rs, shifter) {} + CMBitMap(int shifter) : + CMBitMapRO(shifter) {} + + // Allocates the back store for the marking bitmap + bool allocate(ReservedSpace heap_rs); // write marks void mark(HeapWord* addr) { @@ -155,17 +158,18 @@ class CMBitMap : public CMBitMapRO { MemRegion getAndClearMarkedRegion(HeapWord* addr, HeapWord* end_addr); }; -// Represents a marking stack used by the CM collector. -// Ideally this should be GrowableArray<> just like MSC's marking stack(s). +// Represents a marking stack used by ConcurrentMarking in the G1 collector. class CMMarkStack VALUE_OBJ_CLASS_SPEC { + VirtualSpace _virtual_space; // Underlying backing store for actual stack ConcurrentMark* _cm; oop* _base; // bottom of stack - jint _index; // one more than last occupied index - jint _capacity; // max #elements - jint _saved_index; // value of _index saved at start of GC - NOT_PRODUCT(jint _max_depth;) // max depth plumbed during run + jint _index; // one more than last occupied index + jint _capacity; // max #elements + jint _saved_index; // value of _index saved at start of GC + NOT_PRODUCT(jint _max_depth;) // max depth plumbed during run - bool _overflow; + bool _overflow; + bool _should_expand; DEBUG_ONLY(bool _drain_in_progress;) DEBUG_ONLY(bool _drain_in_progress_yields;) @@ -173,7 +177,13 @@ class CMMarkStack VALUE_OBJ_CLASS_SPEC { CMMarkStack(ConcurrentMark* cm); ~CMMarkStack(); - void allocate(size_t size); +#ifndef PRODUCT + jint max_depth() const { + return _max_depth; + } +#endif + + bool allocate(size_t capacity); oop pop() { if (!isEmpty()) { @@ -231,11 +241,17 @@ class CMMarkStack VALUE_OBJ_CLASS_SPEC { bool isEmpty() { return _index == 0; } bool isFull() { return _index == _capacity; } - int maxElems() { return _capacity; } + int maxElems() { return _capacity; } bool overflow() { return _overflow; } void clear_overflow() { _overflow = false; } + bool should_expand() const { return _should_expand; } + void set_should_expand(); + + // Expand the stack, typically in response to an overflow condition + void expand(); + int size() { return _index; } void setEmpty() { _index = 0; clear_overflow(); } @@ -344,6 +360,7 @@ public: class ConcurrentMarkThread; class ConcurrentMark: public CHeapObj { + friend class CMMarkStack; friend class ConcurrentMarkThread; friend class CMTask; friend class CMBitMapClosure; @@ -577,6 +594,9 @@ protected: // the card bitmaps. intptr_t _heap_bottom_card_num; + // Set to true when initialization is complete + bool _completed_initialization; + public: // Manipulation of the global mark stack. // Notice that the first mark_stack_push is CAS-based, whereas the @@ -636,7 +656,7 @@ public: return _task_queues->steal(worker_id, hash_seed, obj); } - ConcurrentMark(ReservedSpace rs, uint max_regions); + ConcurrentMark(G1CollectedHeap* g1h, ReservedSpace heap_rs); ~ConcurrentMark(); ConcurrentMarkThread* cmThread() { return _cmThread; } @@ -907,6 +927,11 @@ public: // Should *not* be called from parallel code. inline bool mark_and_count(oop obj); + // Returns true if initialization was successfully completed. + bool completed_initialization() const { + return _completed_initialization; + } + protected: // Clear all the per-task bitmaps and arrays used to store the // counting data. diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index 70b45fea4f0..448c5707787 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -2079,7 +2079,11 @@ jint G1CollectedHeap::initialize() { // Create the ConcurrentMark data structure and thread. // (Must do this late, so that "max_regions" is defined.) - _cm = new ConcurrentMark(heap_rs, max_regions()); + _cm = new ConcurrentMark(this, heap_rs); + if (_cm == NULL || !_cm->completed_initialization()) { + vm_shutdown_during_initialization("Could not create/initialize ConcurrentMark"); + return JNI_ENOMEM; + } _cmThread = _cm->cmThread(); // Initialize the from_card cache structure of HeapRegionRemSet. @@ -2087,7 +2091,7 @@ jint G1CollectedHeap::initialize() { // Now expand into the initial heap size. if (!expand(init_byte_size)) { - vm_exit_during_initialization("Failed to allocate initial heap."); + vm_shutdown_during_initialization("Failed to allocate initial heap."); return JNI_ENOMEM; } diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/adjoiningVirtualSpaces.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/adjoiningVirtualSpaces.cpp index e21f7a7a6e4..e5ca1f5c097 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/adjoiningVirtualSpaces.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/adjoiningVirtualSpaces.cpp @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "gc_implementation/parallelScavenge/adjoiningVirtualSpaces.hpp" +#include "memory/allocation.inline.hpp" #include "runtime/java.hpp" AdjoiningVirtualSpaces::AdjoiningVirtualSpaces(ReservedSpace rs, diff --git a/hotspot/src/share/vm/gc_implementation/shared/gcStats.cpp b/hotspot/src/share/vm/gc_implementation/shared/gcStats.cpp index faef280f632..745f8f3ab65 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/gcStats.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/gcStats.cpp @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "gc_implementation/shared/gcStats.hpp" #include "gc_implementation/shared/gcUtil.hpp" +#include "memory/allocation.inline.hpp" GCStats::GCStats() { _avg_promoted = new AdaptivePaddedNoZeroDevAverage( diff --git a/hotspot/src/share/vm/memory/allocation.hpp b/hotspot/src/share/vm/memory/allocation.hpp index 8bf63ac72f6..3cade72c260 100644 --- a/hotspot/src/share/vm/memory/allocation.hpp +++ b/hotspot/src/share/vm/memory/allocation.hpp @@ -202,7 +202,7 @@ template class CHeapObj ALLOCATION_SUPER_CLASS_SPEC { // Calling new or delete will result in fatal error. class StackObj ALLOCATION_SUPER_CLASS_SPEC { - public: + private: void* operator new(size_t size); void operator delete(void* p); }; @@ -226,7 +226,7 @@ class StackObj ALLOCATION_SUPER_CLASS_SPEC { // be defined as a an empty string "". // class _ValueObj { - public: + private: void* operator new(size_t size); void operator delete(void* p); }; diff --git a/hotspot/src/share/vm/memory/metaspace.cpp b/hotspot/src/share/vm/memory/metaspace.cpp index 42870cd0fda..6c0b4210faa 100644 --- a/hotspot/src/share/vm/memory/metaspace.cpp +++ b/hotspot/src/share/vm/memory/metaspace.cpp @@ -2192,11 +2192,6 @@ void SpaceManager::mangle_freed_chunks() { // MetaspaceAux -size_t MetaspaceAux::used_in_bytes() { - return (Metaspace::class_space_list()->used_words_sum() + - Metaspace::space_list()->used_words_sum()) * BytesPerWord; -} - size_t MetaspaceAux::used_in_bytes(Metaspace::MetadataType mdtype) { size_t used = 0; ClassLoaderDataGraphMetaspaceIterator iter; @@ -2222,14 +2217,6 @@ size_t MetaspaceAux::free_in_bytes(Metaspace::MetadataType mdtype) { return free * BytesPerWord; } -// The total words available for metadata allocation. This -// uses Metaspace capacity_words() which is the total words -// in chunks allocated for a Metaspace. -size_t MetaspaceAux::capacity_in_bytes() { - return (Metaspace::class_space_list()->capacity_words_sum() + - Metaspace::space_list()->capacity_words_sum()) * BytesPerWord; -} - size_t MetaspaceAux::capacity_in_bytes(Metaspace::MetadataType mdtype) { size_t capacity = free_chunks_total(mdtype); ClassLoaderDataGraphMetaspaceIterator iter; @@ -2242,11 +2229,6 @@ size_t MetaspaceAux::capacity_in_bytes(Metaspace::MetadataType mdtype) { return capacity * BytesPerWord; } -size_t MetaspaceAux::reserved_in_bytes() { - return (Metaspace::class_space_list()->virtual_space_total() + - Metaspace::space_list()->virtual_space_total()) * BytesPerWord; -} - size_t MetaspaceAux::reserved_in_bytes(Metaspace::MetadataType mdtype) { size_t reserved = (mdtype == Metaspace::ClassType) ? Metaspace::class_space_list()->virtual_space_total() : diff --git a/hotspot/src/share/vm/memory/metaspace.hpp b/hotspot/src/share/vm/memory/metaspace.hpp index 993419436bb..bfc6d90ae65 100644 --- a/hotspot/src/share/vm/memory/metaspace.hpp +++ b/hotspot/src/share/vm/memory/metaspace.hpp @@ -156,16 +156,25 @@ class MetaspaceAux : AllStatic { public: // Total of space allocated to metadata in all Metaspaces - static size_t used_in_bytes(); + static size_t used_in_bytes() { + return used_in_bytes(Metaspace::ClassType) + + used_in_bytes(Metaspace::NonClassType); + } // Total of available space in all Metaspaces // Total of capacity allocated to all Metaspaces. This includes // space in Metachunks not yet allocated and in the Metachunk // freelist. - static size_t capacity_in_bytes(); + static size_t capacity_in_bytes() { + return capacity_in_bytes(Metaspace::ClassType) + + capacity_in_bytes(Metaspace::NonClassType); + } // Total space reserved in all Metaspaces - static size_t reserved_in_bytes(); + static size_t reserved_in_bytes() { + return reserved_in_bytes(Metaspace::ClassType) + + reserved_in_bytes(Metaspace::NonClassType); + } static size_t min_chunk_size(); diff --git a/hotspot/src/share/vm/memory/metaspaceCounters.cpp b/hotspot/src/share/vm/memory/metaspaceCounters.cpp index d8237f73418..17b94597b94 100644 --- a/hotspot/src/share/vm/memory/metaspaceCounters.cpp +++ b/hotspot/src/share/vm/memory/metaspaceCounters.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/hotspot/src/share/vm/memory/metaspaceCounters.hpp b/hotspot/src/share/vm/memory/metaspaceCounters.hpp index d6183b92315..ab0556fd160 100644 --- a/hotspot/src/share/vm/memory/metaspaceCounters.hpp +++ b/hotspot/src/share/vm/memory/metaspaceCounters.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/hotspot/src/share/vm/oops/constMethod.hpp b/hotspot/src/share/vm/oops/constMethod.hpp index 771bf7b169c..2819b3e7756 100644 --- a/hotspot/src/share/vm/oops/constMethod.hpp +++ b/hotspot/src/share/vm/oops/constMethod.hpp @@ -46,6 +46,7 @@ // | interp_kind | flags | code_size | // | name index | signature index | // | method_idnum | max_stack | +// | max_locals | size_of_parameters | // |------------------------------------------------------| // | | // | byte codes | @@ -150,7 +151,8 @@ private: // initially corresponds to the index into the methods array. // but this may change with redefinition u2 _max_stack; // Maximum number of entries on the expression stack - + u2 _max_locals; // Number of local variables used by this method + u2 _size_of_parameters; // size of the parameter block (receiver + arguments) in words // Constructor ConstMethod(int byte_code_size, @@ -338,6 +340,11 @@ public: static ByteSize max_stack_offset() { return byte_offset_of(ConstMethod, _max_stack); } + static ByteSize size_of_locals_offset() + { return byte_offset_of(ConstMethod, _max_locals); } + static ByteSize size_of_parameters_offset() + { return byte_offset_of(ConstMethod, _size_of_parameters); } + // Unique id for the method static const u2 MAX_IDNUM; @@ -349,6 +356,14 @@ public: int max_stack() const { return _max_stack; } void set_max_stack(int size) { _max_stack = size; } + // max locals + int max_locals() const { return _max_locals; } + void set_max_locals(int size) { _max_locals = size; } + + // size of parameters + int size_of_parameters() const { return _size_of_parameters; } + void set_size_of_parameters(int size) { _size_of_parameters = size; } + // Deallocation for RedefineClasses void deallocate_contents(ClassLoaderData* loader_data); bool is_klass() const { return false; } diff --git a/hotspot/src/share/vm/oops/instanceKlass.hpp b/hotspot/src/share/vm/oops/instanceKlass.hpp index ad59ab0632f..ddbdbd68024 100644 --- a/hotspot/src/share/vm/oops/instanceKlass.hpp +++ b/hotspot/src/share/vm/oops/instanceKlass.hpp @@ -538,6 +538,12 @@ class InstanceKlass: public Klass { } } + // Oop that keeps the metadata for this class from being unloaded + // in places where the metadata is stored in other places, like nmethods + oop klass_holder() const { + return is_anonymous() ? java_mirror() : class_loader(); + } + // signers objArrayOop signers() const { return _signers; } void set_signers(objArrayOop s) { klass_oop_store((oop*)&_signers, s); } diff --git a/hotspot/src/share/vm/oops/klass.hpp b/hotspot/src/share/vm/oops/klass.hpp index 3e8c846990e..be5d0c5293d 100644 --- a/hotspot/src/share/vm/oops/klass.hpp +++ b/hotspot/src/share/vm/oops/klass.hpp @@ -451,6 +451,8 @@ class Klass : public Metadata { oop class_loader() const; + virtual oop klass_holder() const { return class_loader(); } + protected: virtual Klass* array_klass_impl(bool or_null, int rank, TRAPS); virtual Klass* array_klass_impl(bool or_null, TRAPS); diff --git a/hotspot/src/share/vm/oops/method.hpp b/hotspot/src/share/vm/oops/method.hpp index ff7bc0ee53d..9e5e3b9da6a 100644 --- a/hotspot/src/share/vm/oops/method.hpp +++ b/hotspot/src/share/vm/oops/method.hpp @@ -73,8 +73,7 @@ // |------------------------------------------------------| // | result_index (C++ interpreter only) | // |------------------------------------------------------| -// | method_size | max_locals | -// | size_of_parameters | intrinsic_id| flags | +// | method_size | intrinsic_id| flags | // |------------------------------------------------------| // | throwout_count | num_breakpoints | // |------------------------------------------------------| @@ -116,8 +115,6 @@ class Method : public Metadata { int _result_index; // C++ interpreter needs for converting results to/from stack #endif u2 _method_size; // size of this object - u2 _max_locals; // Number of local variables used by this method - u2 _size_of_parameters; // size of the parameter block (receiver + arguments) in words u1 _intrinsic_id; // vmSymbols::intrinsic_id (0 == _none) u1 _jfr_towrite : 1, // Flags _force_inline : 1, @@ -292,8 +289,8 @@ class Method : public Metadata { void set_max_stack(int size) { constMethod()->set_max_stack(size); } // max locals - int max_locals() const { return _max_locals; } - void set_max_locals(int size) { _max_locals = size; } + int max_locals() const { return constMethod()->max_locals(); } + void set_max_locals(int size) { constMethod()->set_max_locals(size); } int highest_comp_level() const; void set_highest_comp_level(int level); @@ -311,7 +308,8 @@ class Method : public Metadata { void set_interpreter_throwout_count(int count) { _interpreter_throwout_count = count; } // size of parameters - int size_of_parameters() const { return _size_of_parameters; } + int size_of_parameters() const { return constMethod()->size_of_parameters(); } + void set_size_of_parameters(int size) { constMethod()->set_size_of_parameters(size); } bool has_stackmap_table() const { return constMethod()->has_stackmap_table(); @@ -588,8 +586,6 @@ class Method : public Metadata { #ifdef CC_INTERP static ByteSize result_index_offset() { return byte_offset_of(Method, _result_index ); } #endif /* CC_INTERP */ - static ByteSize size_of_locals_offset() { return byte_offset_of(Method, _max_locals ); } - static ByteSize size_of_parameters_offset() { return byte_offset_of(Method, _size_of_parameters); } static ByteSize from_compiled_offset() { return byte_offset_of(Method, _from_compiled_entry); } static ByteSize code_offset() { return byte_offset_of(Method, _code); } static ByteSize invocation_counter_offset() { return byte_offset_of(Method, _invocation_counter); } @@ -796,9 +792,6 @@ class Method : public Metadata { Array* methods_default_annotations, bool idempotent = false); - // size of parameters - void set_size_of_parameters(int size) { _size_of_parameters = size; } - // Deallocation function for redefine classes or if an error occurs void deallocate_contents(ClassLoaderData* loader_data); diff --git a/hotspot/src/share/vm/opto/addnode.cpp b/hotspot/src/share/vm/opto/addnode.cpp index 6e54990281b..045e4f20918 100644 --- a/hotspot/src/share/vm/opto/addnode.cpp +++ b/hotspot/src/share/vm/opto/addnode.cpp @@ -189,6 +189,11 @@ Node *AddNode::Ideal(PhaseGVN *phase, bool can_reshape) { set_req(1, addx); set_req(2, a22); progress = this; + PhaseIterGVN *igvn = phase->is_IterGVN(); + if (add2->outcnt() == 0 && igvn) { + // add disconnected. + igvn->_worklist.push(add2); + } } } @@ -624,6 +629,11 @@ Node *AddPNode::Ideal(PhaseGVN *phase, bool can_reshape) { if( t22->singleton() && (t22 != Type::TOP) ) { // Right input is an add of a constant? set_req(Address, phase->transform(new (phase->C) AddPNode(in(Base),in(Address),add->in(1)))); set_req(Offset, add->in(2)); + PhaseIterGVN *igvn = phase->is_IterGVN(); + if (add->outcnt() == 0 && igvn) { + // add disconnected. + igvn->_worklist.push((Node*)add); + } return this; // Made progress } } diff --git a/hotspot/src/share/vm/opto/bytecodeInfo.cpp b/hotspot/src/share/vm/opto/bytecodeInfo.cpp index 80117960dc5..7392ee0f614 100644 --- a/hotspot/src/share/vm/opto/bytecodeInfo.cpp +++ b/hotspot/src/share/vm/opto/bytecodeInfo.cpp @@ -403,7 +403,7 @@ const char* InlineTree::check_can_parse(ciMethod* callee) { //------------------------------print_inlining--------------------------------- // Really, the failure_msg can be a success message also. void InlineTree::print_inlining(ciMethod* callee_method, int caller_bci, const char* failure_msg) const { - CompileTask::print_inlining(callee_method, inline_level(), caller_bci, failure_msg ? failure_msg : "inline"); + C->print_inlining(callee_method, inline_level(), caller_bci, failure_msg ? failure_msg : "inline"); if (callee_method == NULL) tty->print(" callee not monotonic or profiled"); if (Verbose && callee_method) { const InlineTree *top = this; diff --git a/hotspot/src/share/vm/opto/callGenerator.cpp b/hotspot/src/share/vm/opto/callGenerator.cpp index 33d8c0c6241..66b53abf8ad 100644 --- a/hotspot/src/share/vm/opto/callGenerator.cpp +++ b/hotspot/src/share/vm/opto/callGenerator.cpp @@ -274,6 +274,9 @@ class LateInlineCallGenerator : public DirectCallGenerator { virtual void do_late_inline(); virtual JVMState* generate(JVMState* jvms) { + Compile *C = Compile::current(); + C->print_inlining_skip(this); + // Record that this call site should be revisited once the main // parse is finished. Compile::current()->add_late_inline(this); @@ -284,7 +287,6 @@ class LateInlineCallGenerator : public DirectCallGenerator { // as is done for allocations and macro expansion. return DirectCallGenerator::generate(jvms); } - }; @@ -307,7 +309,9 @@ void LateInlineCallGenerator::do_late_inline() { // Make sure the state is a MergeMem for parsing. if (!map->in(TypeFunc::Memory)->is_MergeMem()) { - map->set_req(TypeFunc::Memory, MergeMemNode::make(C, map->in(TypeFunc::Memory))); + Node* mem = MergeMemNode::make(C, map->in(TypeFunc::Memory)); + C->initial_gvn()->set_type_bottom(mem); + map->set_req(TypeFunc::Memory, mem); } // Make enough space for the expression stack and transfer the incoming arguments @@ -320,6 +324,8 @@ void LateInlineCallGenerator::do_late_inline() { } } + C->print_inlining_insert(this); + CompileLog* log = C->log(); if (log != NULL) { log->head("late_inline method='%d'", log->identify(method())); @@ -608,7 +614,7 @@ CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod* if (cg != NULL && cg->is_inline()) return cg; } else { - if (PrintInlining) CompileTask::print_inlining(callee, jvms->depth() - 1, jvms->bci(), "receiver not constant"); + if (PrintInlining) C->print_inlining(callee, jvms->depth() - 1, jvms->bci(), "receiver not constant"); } } break; diff --git a/hotspot/src/share/vm/opto/callGenerator.hpp b/hotspot/src/share/vm/opto/callGenerator.hpp index ae59173bf7d..8b3bdada39f 100644 --- a/hotspot/src/share/vm/opto/callGenerator.hpp +++ b/hotspot/src/share/vm/opto/callGenerator.hpp @@ -147,9 +147,9 @@ class CallGenerator : public ResourceObj { CallGenerator* cg); virtual Node* generate_predicate(JVMState* jvms) { return NULL; }; - static void print_inlining(ciMethod* callee, int inline_level, int bci, const char* msg) { + static void print_inlining(Compile* C, ciMethod* callee, int inline_level, int bci, const char* msg) { if (PrintInlining) - CompileTask::print_inlining(callee, inline_level, bci, msg); + C->print_inlining(callee, inline_level, bci, msg); } }; diff --git a/hotspot/src/share/vm/opto/callnode.cpp b/hotspot/src/share/vm/opto/callnode.cpp index 067e9197d20..95f1934c6c1 100644 --- a/hotspot/src/share/vm/opto/callnode.cpp +++ b/hotspot/src/share/vm/opto/callnode.cpp @@ -751,7 +751,7 @@ void CallNode::extract_projections(CallProjections* projs, bool separate_io_proj projs->fallthrough_ioproj = pn; for (DUIterator j = pn->outs(); pn->has_out(j); j++) { Node* e = pn->out(j); - if (e->Opcode() == Op_CreateEx && e->in(0)->is_CatchProj()) { + if (e->Opcode() == Op_CreateEx && e->in(0)->is_CatchProj() && e->outcnt() > 0) { assert(projs->exobj == NULL, "only one"); projs->exobj = e; } diff --git a/hotspot/src/share/vm/opto/cfgnode.cpp b/hotspot/src/share/vm/opto/cfgnode.cpp index 24d51afd2fa..3ee9fffe04b 100644 --- a/hotspot/src/share/vm/opto/cfgnode.cpp +++ b/hotspot/src/share/vm/opto/cfgnode.cpp @@ -1566,6 +1566,10 @@ Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) { Node* n = in(j); // Get the input if (rc == NULL || phase->type(rc) == Type::TOP) { if (n != top) { // Not already top? + PhaseIterGVN *igvn = phase->is_IterGVN(); + if (can_reshape && igvn != NULL) { + igvn->_worklist.push(r); + } set_req(j, top); // Nuke it down progress = this; // Record progress } diff --git a/hotspot/src/share/vm/opto/compile.cpp b/hotspot/src/share/vm/opto/compile.cpp index ffb7ed7b8d5..5ea8049c735 100644 --- a/hotspot/src/share/vm/opto/compile.cpp +++ b/hotspot/src/share/vm/opto/compile.cpp @@ -610,7 +610,9 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr _trace_opto_output(TraceOptoOutput || method()->has_option("TraceOptoOutput")), _printer(IdealGraphPrinter::printer()), #endif - _congraph(NULL) { + _congraph(NULL), + _print_inlining_list(NULL), + _print_inlining(0) { C = this; CompileWrapper cw(this); @@ -666,6 +668,9 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr PhaseGVN gvn(node_arena(), estimated_size); set_initial_gvn(&gvn); + if (PrintInlining) { + _print_inlining_list = new (comp_arena())GrowableArray(comp_arena(), 1, 1, PrintInliningBuffer()); + } { // Scope for timing the parser TracePhase t3("parse", &_t_parser, true); @@ -754,6 +759,7 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr } } assert(_late_inlines.length() == 0, "should have been processed"); + dump_inlining(); print_method("Before RemoveUseless", 3); @@ -899,7 +905,9 @@ Compile::Compile( ciEnv* ci_env, #endif _dead_node_list(comp_arena()), _dead_node_count(0), - _congraph(NULL) { + _congraph(NULL), + _print_inlining_list(NULL), + _print_inlining(0) { C = this; #ifndef PRODUCT @@ -3351,3 +3359,11 @@ void Compile::ConstantTable::fill_jump_table(CodeBuffer& cb, MachConstantNode* n cb.consts()->relocate((address) constant_addr, relocInfo::internal_word_type); } } + +void Compile::dump_inlining() { + if (PrintInlining) { + for (int i = 0; i < _print_inlining_list->length(); i++) { + tty->print(_print_inlining_list->at(i).ss()->as_string()); + } + } +} diff --git a/hotspot/src/share/vm/opto/compile.hpp b/hotspot/src/share/vm/opto/compile.hpp index aacb72cbfb4..32767e2ddd8 100644 --- a/hotspot/src/share/vm/opto/compile.hpp +++ b/hotspot/src/share/vm/opto/compile.hpp @@ -30,6 +30,7 @@ #include "code/debugInfoRec.hpp" #include "code/exceptionHandlerTable.hpp" #include "compiler/compilerOracle.hpp" +#include "compiler/compileBroker.hpp" #include "libadt/dict.hpp" #include "libadt/port.hpp" #include "libadt/vectset.hpp" @@ -369,6 +370,61 @@ class Compile : public Phase { GrowableArray _late_inlines; // List of CallGenerators to be revisited after // main parsing has finished. + // Inlining may not happen in parse order which would make + // PrintInlining output confusing. Keep track of PrintInlining + // pieces in order. + class PrintInliningBuffer : public ResourceObj { + private: + CallGenerator* _cg; + stringStream* _ss; + + public: + PrintInliningBuffer() + : _cg(NULL) { _ss = new stringStream(); } + + stringStream* ss() const { return _ss; } + CallGenerator* cg() const { return _cg; } + void set_cg(CallGenerator* cg) { _cg = cg; } + }; + + GrowableArray* _print_inlining_list; + int _print_inlining; + + public: + + outputStream* print_inlining_stream() const { + return _print_inlining_list->at(_print_inlining).ss(); + } + + void print_inlining_skip(CallGenerator* cg) { + if (PrintInlining) { + _print_inlining_list->at(_print_inlining).set_cg(cg); + _print_inlining++; + _print_inlining_list->insert_before(_print_inlining, PrintInliningBuffer()); + } + } + + void print_inlining_insert(CallGenerator* cg) { + if (PrintInlining) { + for (int i = 0; i < _print_inlining_list->length(); i++) { + if (_print_inlining_list->at(i).cg() == cg) { + _print_inlining_list->insert_before(i+1, PrintInliningBuffer()); + _print_inlining = i+1; + _print_inlining_list->at(i).set_cg(NULL); + return; + } + } + ShouldNotReachHere(); + } + } + + void print_inlining(ciMethod* method, int inline_level, int bci, const char* msg = NULL) { + stringStream ss; + CompileTask::print_inlining(&ss, method, inline_level, bci, msg); + print_inlining_stream()->print(ss.as_string()); + } + + private: // Matching, CFG layout, allocation, code generation PhaseCFG* _cfg; // Results of CFG finding bool _select_24_bit_instr; // We selected an instruction with a 24-bit result @@ -591,7 +647,7 @@ class Compile : public Phase { void reset_dead_node_list() { _dead_node_list.Reset(); _dead_node_count = 0; } - uint live_nodes() { + uint live_nodes() const { int val = _unique - _dead_node_count; assert (val >= 0, err_msg_res("number of tracked dead nodes %d more than created nodes %d", _unique, _dead_node_count)); return (uint) val; @@ -702,7 +758,7 @@ class Compile : public Phase { void identify_useful_nodes(Unique_Node_List &useful); void update_dead_node_list(Unique_Node_List &useful); - void remove_useless_nodes (Unique_Node_List &useful); + void remove_useless_nodes (Unique_Node_List &useful); WarmCallInfo* warm_calls() const { return _warm_calls; } void set_warm_calls(WarmCallInfo* l) { _warm_calls = l; } @@ -711,6 +767,8 @@ class Compile : public Phase { // Record this CallGenerator for inlining at the end of parsing. void add_late_inline(CallGenerator* cg) { _late_inlines.push(cg); } + void dump_inlining(); + // Matching, CFG layout, allocation, code generation PhaseCFG* cfg() { return _cfg; } bool select_24_bit_instr() const { return _select_24_bit_instr; } diff --git a/hotspot/src/share/vm/opto/doCall.cpp b/hotspot/src/share/vm/opto/doCall.cpp index ca9a0a6d67e..1f21043c32e 100644 --- a/hotspot/src/share/vm/opto/doCall.cpp +++ b/hotspot/src/share/vm/opto/doCall.cpp @@ -40,19 +40,24 @@ #include "prims/nativeLookup.hpp" #include "runtime/sharedRuntime.hpp" -void trace_type_profile(ciMethod *method, int depth, int bci, ciMethod *prof_method, ciKlass *prof_klass, int site_count, int receiver_count) { +void trace_type_profile(Compile* C, ciMethod *method, int depth, int bci, ciMethod *prof_method, ciKlass *prof_klass, int site_count, int receiver_count) { if (TraceTypeProfile || PrintInlining NOT_PRODUCT(|| PrintOptoInlining)) { + outputStream* out = tty; if (!PrintInlining) { if (NOT_PRODUCT(!PrintOpto &&) !PrintCompilation) { method->print_short_name(); tty->cr(); } CompileTask::print_inlining(prof_method, depth, bci); + } else { + out = C->print_inlining_stream(); } - CompileTask::print_inline_indent(depth); - tty->print(" \\-> TypeProfile (%d/%d counts) = ", receiver_count, site_count); - prof_klass->name()->print_symbol(); - tty->cr(); + CompileTask::print_inline_indent(depth, out); + out->print(" \\-> TypeProfile (%d/%d counts) = ", receiver_count, site_count); + stringStream ss; + prof_klass->name()->print_symbol_on(&ss); + out->print(ss.as_string()); + out->cr(); } } @@ -233,13 +238,13 @@ CallGenerator* Compile::call_generator(ciMethod* callee, int vtable_index, bool } if (miss_cg != NULL) { if (next_hit_cg != NULL) { - trace_type_profile(jvms->method(), jvms->depth() - 1, jvms->bci(), next_receiver_method, profile.receiver(1), site_count, profile.receiver_count(1)); + trace_type_profile(C, jvms->method(), jvms->depth() - 1, jvms->bci(), next_receiver_method, profile.receiver(1), site_count, profile.receiver_count(1)); // We don't need to record dependency on a receiver here and below. // Whenever we inline, the dependency is added by Parse::Parse(). miss_cg = CallGenerator::for_predicted_call(profile.receiver(1), miss_cg, next_hit_cg, PROB_MAX); } if (miss_cg != NULL) { - trace_type_profile(jvms->method(), jvms->depth() - 1, jvms->bci(), receiver_method, profile.receiver(0), site_count, receiver_count); + trace_type_profile(C, jvms->method(), jvms->depth() - 1, jvms->bci(), receiver_method, profile.receiver(0), site_count, receiver_count); CallGenerator* cg = CallGenerator::for_predicted_call(profile.receiver(0), miss_cg, hit_cg, profile.receiver_prob(0)); if (cg != NULL) return cg; } diff --git a/hotspot/src/share/vm/opto/graphKit.cpp b/hotspot/src/share/vm/opto/graphKit.cpp index ba7ec2caf77..115952ad65c 100644 --- a/hotspot/src/share/vm/opto/graphKit.cpp +++ b/hotspot/src/share/vm/opto/graphKit.cpp @@ -1771,11 +1771,21 @@ void GraphKit::replace_call(CallNode* call, Node* result) { CallProjections callprojs; call->extract_projections(&callprojs, true); - // Replace all the old call edges with the edges from the inlining result - C->gvn_replace_by(callprojs.fallthrough_catchproj, final_state->in(TypeFunc::Control)); - C->gvn_replace_by(callprojs.fallthrough_memproj, final_state->in(TypeFunc::Memory)); - C->gvn_replace_by(callprojs.fallthrough_ioproj, final_state->in(TypeFunc::I_O)); + Node* init_mem = call->in(TypeFunc::Memory); Node* final_mem = final_state->in(TypeFunc::Memory); + Node* final_ctl = final_state->in(TypeFunc::Control); + Node* final_io = final_state->in(TypeFunc::I_O); + + // Replace all the old call edges with the edges from the inlining result + if (callprojs.fallthrough_catchproj != NULL) { + C->gvn_replace_by(callprojs.fallthrough_catchproj, final_ctl); + } + if (callprojs.fallthrough_memproj != NULL) { + C->gvn_replace_by(callprojs.fallthrough_memproj, final_mem); + } + if (callprojs.fallthrough_ioproj != NULL) { + C->gvn_replace_by(callprojs.fallthrough_ioproj, final_io); + } // Replace the result with the new result if it exists and is used if (callprojs.resproj != NULL && result != NULL) { @@ -2980,7 +2990,7 @@ Node* GraphKit::set_output_for_allocation(AllocateNode* alloc, set_control( _gvn.transform(new (C) ProjNode(allocx, TypeFunc::Control) ) ); // create memory projection for i_o set_memory ( _gvn.transform( new (C) ProjNode(allocx, TypeFunc::Memory, true) ), rawidx ); - make_slow_call_ex(allocx, env()->OutOfMemoryError_klass(), true); + make_slow_call_ex(allocx, env()->Throwable_klass(), true); // create a memory projection as for the normal control path Node* malloc = _gvn.transform(new (C) ProjNode(allocx, TypeFunc::Memory)); diff --git a/hotspot/src/share/vm/opto/library_call.cpp b/hotspot/src/share/vm/opto/library_call.cpp index 43d4d05022e..313339edfde 100644 --- a/hotspot/src/share/vm/opto/library_call.cpp +++ b/hotspot/src/share/vm/opto/library_call.cpp @@ -282,6 +282,7 @@ class LibraryCallKit : public GraphKit { typedef enum { LS_xadd, LS_xchg, LS_cmpxchg } LoadStoreKind; bool inline_unsafe_load_store(BasicType type, LoadStoreKind kind); bool inline_unsafe_ordered_store(BasicType type); + bool inline_unsafe_fence(vmIntrinsics::ID id); bool inline_fp_conversions(vmIntrinsics::ID id); bool inline_number_methods(vmIntrinsics::ID id); bool inline_reference_get(); @@ -334,6 +335,9 @@ CallGenerator* Compile::make_vm_intrinsic(ciMethod* m, bool is_virtual) { case vmIntrinsics::_getAndSetInt: case vmIntrinsics::_getAndSetLong: case vmIntrinsics::_getAndSetObject: + case vmIntrinsics::_loadFence: + case vmIntrinsics::_storeFence: + case vmIntrinsics::_fullFence: break; // InlineNatives does not control String.compareTo case vmIntrinsics::_Reference_get: break; // InlineNatives does not control Reference.get @@ -412,16 +416,16 @@ CallGenerator* Compile::make_vm_intrinsic(ciMethod* m, bool is_virtual) { break; case vmIntrinsics::_reverseBytes_c: - if (!Matcher::match_rule_supported(Op_ReverseBytesUS)) return false; + if (!Matcher::match_rule_supported(Op_ReverseBytesUS)) return NULL; break; case vmIntrinsics::_reverseBytes_s: - if (!Matcher::match_rule_supported(Op_ReverseBytesS)) return false; + if (!Matcher::match_rule_supported(Op_ReverseBytesS)) return NULL; break; case vmIntrinsics::_reverseBytes_i: - if (!Matcher::match_rule_supported(Op_ReverseBytesI)) return false; + if (!Matcher::match_rule_supported(Op_ReverseBytesI)) return NULL; break; case vmIntrinsics::_reverseBytes_l: - if (!Matcher::match_rule_supported(Op_ReverseBytesL)) return false; + if (!Matcher::match_rule_supported(Op_ReverseBytesL)) return NULL; break; case vmIntrinsics::_Reference_get: @@ -536,7 +540,7 @@ JVMState* LibraryIntrinsic::generate(JVMState* jvms) { // Try to inline the intrinsic. if (kit.try_to_inline()) { if (PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) { - CompileTask::print_inlining(callee, jvms->depth() - 1, bci, is_virtual() ? "(intrinsic, virtual)" : "(intrinsic)"); + C->print_inlining(callee, jvms->depth() - 1, bci, is_virtual() ? "(intrinsic, virtual)" : "(intrinsic)"); } C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_worked); if (C->log()) { @@ -555,7 +559,7 @@ JVMState* LibraryIntrinsic::generate(JVMState* jvms) { if (jvms->has_method()) { // Not a root compile. const char* msg = is_virtual() ? "failed to inline (intrinsic, virtual)" : "failed to inline (intrinsic)"; - CompileTask::print_inlining(callee, jvms->depth() - 1, bci, msg); + C->print_inlining(callee, jvms->depth() - 1, bci, msg); } else { // Root compile tty->print("Did not generate intrinsic %s%s at bci:%d in", @@ -585,7 +589,7 @@ Node* LibraryIntrinsic::generate_predicate(JVMState* jvms) { Node* slow_ctl = kit.try_to_predicate(); if (!kit.failing()) { if (PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) { - CompileTask::print_inlining(callee, jvms->depth() - 1, bci, is_virtual() ? "(intrinsic, virtual)" : "(intrinsic)"); + C->print_inlining(callee, jvms->depth() - 1, bci, is_virtual() ? "(intrinsic, virtual)" : "(intrinsic)"); } C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_worked); if (C->log()) { @@ -602,12 +606,12 @@ Node* LibraryIntrinsic::generate_predicate(JVMState* jvms) { if (jvms->has_method()) { // Not a root compile. const char* msg = "failed to generate predicate for intrinsic"; - CompileTask::print_inlining(kit.callee(), jvms->depth() - 1, bci, msg); + C->print_inlining(kit.callee(), jvms->depth() - 1, bci, msg); } else { // Root compile - tty->print("Did not generate predicate for intrinsic %s%s at bci:%d in", - vmIntrinsics::name_at(intrinsic_id()), - (is_virtual() ? " (virtual)" : ""), bci); + C->print_inlining_stream()->print("Did not generate predicate for intrinsic %s%s at bci:%d in", + vmIntrinsics::name_at(intrinsic_id()), + (is_virtual() ? " (virtual)" : ""), bci); } } C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_failed); @@ -732,6 +736,10 @@ bool LibraryCallKit::try_to_inline() { case vmIntrinsics::_getAndSetLong: return inline_unsafe_load_store(T_LONG, LS_xchg); case vmIntrinsics::_getAndSetObject: return inline_unsafe_load_store(T_OBJECT, LS_xchg); + case vmIntrinsics::_loadFence: + case vmIntrinsics::_storeFence: + case vmIntrinsics::_fullFence: return inline_unsafe_fence(intrinsic_id()); + case vmIntrinsics::_currentThread: return inline_native_currentThread(); case vmIntrinsics::_isInterrupted: return inline_native_isInterrupted(); @@ -2840,6 +2848,26 @@ bool LibraryCallKit::inline_unsafe_ordered_store(BasicType type) { return true; } +bool LibraryCallKit::inline_unsafe_fence(vmIntrinsics::ID id) { + // Regardless of form, don't allow previous ld/st to move down, + // then issue acquire, release, or volatile mem_bar. + insert_mem_bar(Op_MemBarCPUOrder); + switch(id) { + case vmIntrinsics::_loadFence: + insert_mem_bar(Op_MemBarAcquire); + return true; + case vmIntrinsics::_storeFence: + insert_mem_bar(Op_MemBarRelease); + return true; + case vmIntrinsics::_fullFence: + insert_mem_bar(Op_MemBarVolatile); + return true; + default: + fatal_unexpected_iid(id); + return false; + } +} + //----------------------------inline_unsafe_allocate--------------------------- // public native Object sun.mics.Unsafe.allocateInstance(Class cls); bool LibraryCallKit::inline_unsafe_allocate() { @@ -2952,14 +2980,23 @@ bool LibraryCallKit::inline_native_isInterrupted() { // We only go to the fast case code if we pass two guards. // Paths which do not pass are accumulated in the slow_region. + + enum { + no_int_result_path = 1, // t == Thread.current() && !TLS._osthread._interrupted + no_clear_result_path = 2, // t == Thread.current() && TLS._osthread._interrupted && !clear_int + slow_result_path = 3, // slow path: t.isInterrupted(clear_int) + PATH_LIMIT + }; + + // Ensure that it's not possible to move the load of TLS._osthread._interrupted flag + // out of the function. + insert_mem_bar(Op_MemBarCPUOrder); + + RegionNode* result_rgn = new (C) RegionNode(PATH_LIMIT); + PhiNode* result_val = new (C) PhiNode(result_rgn, TypeInt::BOOL); + RegionNode* slow_region = new (C) RegionNode(1); record_for_igvn(slow_region); - RegionNode* result_rgn = new (C) RegionNode(1+3); // fast1, fast2, slow - PhiNode* result_val = new (C) PhiNode(result_rgn, TypeInt::BOOL); - enum { no_int_result_path = 1, - no_clear_result_path = 2, - slow_result_path = 3 - }; // (a) Receiving thread must be the current thread. Node* rec_thr = argument(0); @@ -2968,14 +3005,13 @@ bool LibraryCallKit::inline_native_isInterrupted() { Node* cmp_thr = _gvn.transform( new (C) CmpPNode(cur_thr, rec_thr) ); Node* bol_thr = _gvn.transform( new (C) BoolNode(cmp_thr, BoolTest::ne) ); - bool known_current_thread = (_gvn.type(bol_thr) == TypeInt::ZERO); - if (!known_current_thread) - generate_slow_guard(bol_thr, slow_region); + generate_slow_guard(bol_thr, slow_region); // (b) Interrupt bit on TLS must be false. Node* p = basic_plus_adr(top()/*!oop*/, tls_ptr, in_bytes(JavaThread::osthread_offset())); Node* osthread = make_load(NULL, p, TypeRawPtr::NOTNULL, T_ADDRESS); p = basic_plus_adr(top()/*!oop*/, osthread, in_bytes(OSThread::interrupted_offset())); + // Set the control input on the field _interrupted read to prevent it floating up. Node* int_bit = make_load(control(), p, TypeInt::BOOL, T_INT); Node* cmp_bit = _gvn.transform( new (C) CmpINode(int_bit, intcon(0)) ); @@ -3020,22 +3056,20 @@ bool LibraryCallKit::inline_native_isInterrupted() { Node* slow_val = set_results_for_java_call(slow_call); // this->control() comes from set_results_for_java_call - // If we know that the result of the slow call will be true, tell the optimizer! - if (known_current_thread) slow_val = intcon(1); - Node* fast_io = slow_call->in(TypeFunc::I_O); Node* fast_mem = slow_call->in(TypeFunc::Memory); + // These two phis are pre-filled with copies of of the fast IO and Memory - Node* io_phi = PhiNode::make(result_rgn, fast_io, Type::ABIO); - Node* mem_phi = PhiNode::make(result_rgn, fast_mem, Type::MEMORY, TypePtr::BOTTOM); + PhiNode* result_mem = PhiNode::make(result_rgn, fast_mem, Type::MEMORY, TypePtr::BOTTOM); + PhiNode* result_io = PhiNode::make(result_rgn, fast_io, Type::ABIO); result_rgn->init_req(slow_result_path, control()); - io_phi ->init_req(slow_result_path, i_o()); - mem_phi ->init_req(slow_result_path, reset_memory()); + result_io ->init_req(slow_result_path, i_o()); + result_mem->init_req(slow_result_path, reset_memory()); result_val->init_req(slow_result_path, slow_val); - set_all_memory( _gvn.transform(mem_phi) ); - set_i_o( _gvn.transform(io_phi) ); + set_all_memory(_gvn.transform(result_mem)); + set_i_o( _gvn.transform(result_io)); } C->set_has_split_ifs(true); // Has chance for split-if optimization @@ -3319,7 +3353,7 @@ bool LibraryCallKit::inline_native_subtype_check() { Node* arg = args[which_arg]; arg = null_check(arg); if (stopped()) break; - args[which_arg] = _gvn.transform(arg); + args[which_arg] = arg; Node* p = basic_plus_adr(arg, class_klass_offset); Node* kls = LoadKlassNode::make(_gvn, immutable_memory(), p, adr_type, kls_type); diff --git a/hotspot/src/share/vm/opto/node.cpp b/hotspot/src/share/vm/opto/node.cpp index 4c83d906003..9983c84d8e2 100644 --- a/hotspot/src/share/vm/opto/node.cpp +++ b/hotspot/src/share/vm/opto/node.cpp @@ -1839,15 +1839,16 @@ uint Node::match_edge(uint idx) const { return idx; // True for other than index 0 (control) } +static RegMask _not_used_at_all; // Register classes are defined for specific machines const RegMask &Node::out_RegMask() const { ShouldNotCallThis(); - return *(new RegMask()); + return _not_used_at_all; } const RegMask &Node::in_RegMask(uint) const { ShouldNotCallThis(); - return *(new RegMask()); + return _not_used_at_all; } //============================================================================= diff --git a/hotspot/src/share/vm/opto/parse3.cpp b/hotspot/src/share/vm/opto/parse3.cpp index 0f92b53f135..ac6f4ec8f76 100644 --- a/hotspot/src/share/vm/opto/parse3.cpp +++ b/hotspot/src/share/vm/opto/parse3.cpp @@ -509,6 +509,7 @@ void Parse::do_multianewarray() { makecon(TypeKlassPtr::make(array_klass)), dims); } + make_slow_call_ex(c, env()->Throwable_klass(), false); Node* res = _gvn.transform(new (C) ProjNode(c, TypeFunc::Parms)); diff --git a/hotspot/src/share/vm/opto/runtime.cpp b/hotspot/src/share/vm/opto/runtime.cpp index fb90705726e..7edb97e0bba 100644 --- a/hotspot/src/share/vm/opto/runtime.cpp +++ b/hotspot/src/share/vm/opto/runtime.cpp @@ -989,7 +989,7 @@ JRT_ENTRY_NO_ASYNC(address, OptoRuntime::handle_exception_C_helper(JavaThread* t // since we're notifying the VM on every catch. // Force deoptimization and the rest of the lookup // will be fine. - deoptimize_caller_frame(thread, true); + deoptimize_caller_frame(thread); } // Check the stack guard pages. If enabled, look for handler in this frame; @@ -1143,19 +1143,24 @@ const TypeFunc *OptoRuntime::rethrow_Type() { void OptoRuntime::deoptimize_caller_frame(JavaThread *thread, bool doit) { - // Deoptimize frame - if (doit) { - // Called from within the owner thread, so no need for safepoint - RegisterMap reg_map(thread); - frame stub_frame = thread->last_frame(); - assert(stub_frame.is_runtime_frame() || exception_blob()->contains(stub_frame.pc()), "sanity check"); - frame caller_frame = stub_frame.sender(®_map); - - // Deoptimize the caller frame. - Deoptimization::deoptimize_frame(thread, caller_frame.id()); + // Deoptimize the caller before continuing, as the compiled + // exception handler table may not be valid. + if (!StressCompiledExceptionHandlers && doit) { + deoptimize_caller_frame(thread); } } +void OptoRuntime::deoptimize_caller_frame(JavaThread *thread) { + // Called from within the owner thread, so no need for safepoint + RegisterMap reg_map(thread); + frame stub_frame = thread->last_frame(); + assert(stub_frame.is_runtime_frame() || exception_blob()->contains(stub_frame.pc()), "sanity check"); + frame caller_frame = stub_frame.sender(®_map); + + // Deoptimize the caller frame. + Deoptimization::deoptimize_frame(thread, caller_frame.id()); +} + bool OptoRuntime::is_deoptimized_caller_frame(JavaThread *thread) { // Called from within the owner thread, so no need for safepoint diff --git a/hotspot/src/share/vm/opto/runtime.hpp b/hotspot/src/share/vm/opto/runtime.hpp index 13da255b742..295b7123757 100644 --- a/hotspot/src/share/vm/opto/runtime.hpp +++ b/hotspot/src/share/vm/opto/runtime.hpp @@ -174,6 +174,7 @@ private: static address handle_exception_C (JavaThread* thread); static address handle_exception_C_helper(JavaThread* thread, nmethod*& nm); static address rethrow_C (oopDesc* exception, JavaThread *thread, address return_pc ); + static void deoptimize_caller_frame (JavaThread *thread); static void deoptimize_caller_frame (JavaThread *thread, bool doit); static bool is_deoptimized_caller_frame (JavaThread *thread); diff --git a/hotspot/src/share/vm/opto/stringopts.cpp b/hotspot/src/share/vm/opto/stringopts.cpp index c471887d881..4e00945c73a 100644 --- a/hotspot/src/share/vm/opto/stringopts.cpp +++ b/hotspot/src/share/vm/opto/stringopts.cpp @@ -744,7 +744,9 @@ bool StringConcat::validate_control_flow() { ctrl_path.push(cn); ctrl_path.push(cn->proj_out(0)); ctrl_path.push(cn->proj_out(0)->unique_out()); - ctrl_path.push(cn->proj_out(0)->unique_out()->as_Catch()->proj_out(0)); + if (cn->proj_out(0)->unique_out()->as_Catch()->proj_out(0) != NULL) { + ctrl_path.push(cn->proj_out(0)->unique_out()->as_Catch()->proj_out(0)); + } } else { ShouldNotReachHere(); } @@ -762,6 +764,12 @@ bool StringConcat::validate_control_flow() { } else if (ptr->is_IfTrue()) { IfNode* iff = ptr->in(0)->as_If(); BoolNode* b = iff->in(1)->isa_Bool(); + + if (b == NULL) { + fail = true; + break; + } + Node* cmp = b->in(1); Node* v1 = cmp->in(1); Node* v2 = cmp->in(2); @@ -1408,71 +1416,76 @@ void PhaseStringOpts::replace_string_concat(StringConcat* sc) { Deoptimization::Action_make_not_entrant); } - // length now contains the number of characters needed for the - // char[] so create a new AllocateArray for the char[] - Node* char_array = NULL; - { - PreserveReexecuteState preexecs(&kit); - // The original jvms is for an allocation of either a String or - // StringBuffer so no stack adjustment is necessary for proper - // reexecution. If we deoptimize in the slow path the bytecode - // will be reexecuted and the char[] allocation will be thrown away. - kit.jvms()->set_should_reexecute(true); - char_array = kit.new_array(__ makecon(TypeKlassPtr::make(ciTypeArrayKlass::make(T_CHAR))), - length, 1); - } + Node* result; + if (!kit.stopped()) { - // Mark the allocation so that zeroing is skipped since the code - // below will overwrite the entire array - AllocateArrayNode* char_alloc = AllocateArrayNode::Ideal_array_allocation(char_array, _gvn); - char_alloc->maybe_set_complete(_gvn); - - // Now copy the string representations into the final char[] - Node* start = __ intcon(0); - for (int argi = 0; argi < sc->num_arguments(); argi++) { - Node* arg = sc->argument(argi); - switch (sc->mode(argi)) { - case StringConcat::IntMode: { - Node* end = __ AddI(start, string_sizes->in(argi)); - // getChars words backwards so pass the ending point as well as the start - int_getChars(kit, arg, char_array, start, end); - start = end; - break; - } - case StringConcat::StringNullCheckMode: - case StringConcat::StringMode: { - start = copy_string(kit, arg, char_array, start); - break; - } - case StringConcat::CharMode: { - __ store_to_memory(kit.control(), kit.array_element_address(char_array, start, T_CHAR), - arg, T_CHAR, char_adr_idx); - start = __ AddI(start, __ intcon(1)); - break; - } - default: - ShouldNotReachHere(); + // length now contains the number of characters needed for the + // char[] so create a new AllocateArray for the char[] + Node* char_array = NULL; + { + PreserveReexecuteState preexecs(&kit); + // The original jvms is for an allocation of either a String or + // StringBuffer so no stack adjustment is necessary for proper + // reexecution. If we deoptimize in the slow path the bytecode + // will be reexecuted and the char[] allocation will be thrown away. + kit.jvms()->set_should_reexecute(true); + char_array = kit.new_array(__ makecon(TypeKlassPtr::make(ciTypeArrayKlass::make(T_CHAR))), + length, 1); } - } - // If we're not reusing an existing String allocation then allocate one here. - Node* result = sc->string_alloc(); - if (result == NULL) { - PreserveReexecuteState preexecs(&kit); - // The original jvms is for an allocation of either a String or - // StringBuffer so no stack adjustment is necessary for proper - // reexecution. - kit.jvms()->set_should_reexecute(true); - result = kit.new_instance(__ makecon(TypeKlassPtr::make(C->env()->String_klass()))); - } + // Mark the allocation so that zeroing is skipped since the code + // below will overwrite the entire array + AllocateArrayNode* char_alloc = AllocateArrayNode::Ideal_array_allocation(char_array, _gvn); + char_alloc->maybe_set_complete(_gvn); - // Intialize the string - if (java_lang_String::has_offset_field()) { - kit.store_String_offset(kit.control(), result, __ intcon(0)); - kit.store_String_length(kit.control(), result, length); - } - kit.store_String_value(kit.control(), result, char_array); + // Now copy the string representations into the final char[] + Node* start = __ intcon(0); + for (int argi = 0; argi < sc->num_arguments(); argi++) { + Node* arg = sc->argument(argi); + switch (sc->mode(argi)) { + case StringConcat::IntMode: { + Node* end = __ AddI(start, string_sizes->in(argi)); + // getChars words backwards so pass the ending point as well as the start + int_getChars(kit, arg, char_array, start, end); + start = end; + break; + } + case StringConcat::StringNullCheckMode: + case StringConcat::StringMode: { + start = copy_string(kit, arg, char_array, start); + break; + } + case StringConcat::CharMode: { + __ store_to_memory(kit.control(), kit.array_element_address(char_array, start, T_CHAR), + arg, T_CHAR, char_adr_idx); + start = __ AddI(start, __ intcon(1)); + break; + } + default: + ShouldNotReachHere(); + } + } + // If we're not reusing an existing String allocation then allocate one here. + result = sc->string_alloc(); + if (result == NULL) { + PreserveReexecuteState preexecs(&kit); + // The original jvms is for an allocation of either a String or + // StringBuffer so no stack adjustment is necessary for proper + // reexecution. + kit.jvms()->set_should_reexecute(true); + result = kit.new_instance(__ makecon(TypeKlassPtr::make(C->env()->String_klass()))); + } + + // Intialize the string + if (java_lang_String::has_offset_field()) { + kit.store_String_offset(kit.control(), result, __ intcon(0)); + kit.store_String_length(kit.control(), result, length); + } + kit.store_String_value(kit.control(), result, char_array); + } else { + result = C->top(); + } // hook up the outgoing control and result kit.replace_call(sc->end(), result); diff --git a/hotspot/src/share/vm/prims/methodHandles.cpp b/hotspot/src/share/vm/prims/methodHandles.cpp index 67e6f954c80..c3b58796723 100644 --- a/hotspot/src/share/vm/prims/methodHandles.cpp +++ b/hotspot/src/share/vm/prims/methodHandles.cpp @@ -1168,8 +1168,8 @@ JVM_ENTRY(void, MHN_setCallSiteTargetNormal(JNIEnv* env, jobject igcls, jobject // Walk all nmethods depending on this call site. MutexLocker mu(Compile_lock, thread); Universe::flush_dependents_on(call_site, target); + java_lang_invoke_CallSite::set_target(call_site(), target()); } - java_lang_invoke_CallSite::set_target(call_site(), target()); } JVM_END @@ -1180,8 +1180,8 @@ JVM_ENTRY(void, MHN_setCallSiteTargetVolatile(JNIEnv* env, jobject igcls, jobjec // Walk all nmethods depending on this call site. MutexLocker mu(Compile_lock, thread); Universe::flush_dependents_on(call_site, target); + java_lang_invoke_CallSite::set_target_volatile(call_site(), target()); } - java_lang_invoke_CallSite::set_target_volatile(call_site(), target()); } JVM_END diff --git a/hotspot/src/share/vm/prims/unsafe.cpp b/hotspot/src/share/vm/prims/unsafe.cpp index cb7f0fcf3df..e56277b65d7 100644 --- a/hotspot/src/share/vm/prims/unsafe.cpp +++ b/hotspot/src/share/vm/prims/unsafe.cpp @@ -468,6 +468,21 @@ UNSAFE_ENTRY(void, Unsafe_SetOrderedLong(JNIEnv *env, jobject unsafe, jobject ob #endif UNSAFE_END +UNSAFE_ENTRY(void, Unsafe_LoadFence(JNIEnv *env, jobject unsafe)) + UnsafeWrapper("Unsafe_LoadFence"); + OrderAccess::acquire(); +UNSAFE_END + +UNSAFE_ENTRY(void, Unsafe_StoreFence(JNIEnv *env, jobject unsafe)) + UnsafeWrapper("Unsafe_StoreFence"); + OrderAccess::release(); +UNSAFE_END + +UNSAFE_ENTRY(void, Unsafe_FullFence(JNIEnv *env, jobject unsafe)) + UnsafeWrapper("Unsafe_FullFence"); + OrderAccess::fence(); +UNSAFE_END + ////// Data in the C heap. // Note: These do not throw NullPointerException for bad pointers. @@ -1550,6 +1565,9 @@ static JNINativeMethod methods[] = { {CC"putOrderedObject", CC"("OBJ"J"OBJ")V", FN_PTR(Unsafe_SetOrderedObject)}, {CC"putOrderedInt", CC"("OBJ"JI)V", FN_PTR(Unsafe_SetOrderedInt)}, {CC"putOrderedLong", CC"("OBJ"JJ)V", FN_PTR(Unsafe_SetOrderedLong)}, + {CC"loadFence", CC"()V", FN_PTR(Unsafe_LoadFence)}, + {CC"storeFence", CC"()V", FN_PTR(Unsafe_StoreFence)}, + {CC"fullFence", CC"()V", FN_PTR(Unsafe_FullFence)}, {CC"park", CC"(ZJ)V", FN_PTR(Unsafe_Park)}, {CC"unpark", CC"("OBJ")V", FN_PTR(Unsafe_Unpark)} diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp index f850e05cbab..21e5cce7b18 100644 --- a/hotspot/src/share/vm/runtime/arguments.cpp +++ b/hotspot/src/share/vm/runtime/arguments.cpp @@ -1499,13 +1499,12 @@ void Arguments::set_g1_gc_flags() { Abstract_VM_Version::parallel_worker_threads()); } - if (FLAG_IS_DEFAULT(MarkStackSize)) { - FLAG_SET_DEFAULT(MarkStackSize, 128 * TASKQUEUE_SIZE); - } - if (PrintGCDetails && Verbose) { - tty->print_cr("MarkStackSize: %uk MarkStackSizeMax: %uk", - MarkStackSize / K, MarkStackSizeMax / K); - tty->print_cr("ConcGCThreads: %u", ConcGCThreads); + // MarkStackSize will be set (if it hasn't been set by the user) + // when concurrent marking is initialized. + // Its value will be based upon the number of parallel marking threads. + // But we do set the maximum mark stack size here. + if (FLAG_IS_DEFAULT(MarkStackSizeMax)) { + FLAG_SET_DEFAULT(MarkStackSizeMax, 128 * TASKQUEUE_SIZE); } if (FLAG_IS_DEFAULT(GCTimeRatio) || GCTimeRatio == 0) { @@ -1517,6 +1516,12 @@ void Arguments::set_g1_gc_flags() { // is allocation). We might consider increase it further. FLAG_SET_DEFAULT(GCTimeRatio, 9); } + + if (PrintGCDetails && Verbose) { + tty->print_cr("MarkStackSize: %uk MarkStackSizeMax: %uk", + MarkStackSize / K, MarkStackSizeMax / K); + tty->print_cr("ConcGCThreads: %u", ConcGCThreads); + } } void Arguments::set_heap_size() { @@ -1980,6 +1985,9 @@ bool Arguments::check_vm_args_consistency() { status = status && verify_min_value(ClassMetaspaceSize, 1*M, "ClassMetaspaceSize"); + status = status && verify_interval(MarkStackSizeMax, + 1, (max_jint - 1), "MarkStackSizeMax"); + #ifdef SPARC if (UseConcMarkSweepGC || UseG1GC) { // Issue a stern warning if the user has explicitly set diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index 7743835dcac..dd3750cafb6 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -922,6 +922,9 @@ class CommandLineFlags { develop(bool, PrintExceptionHandlers, false, \ "Print exception handler tables for all nmethods when generated") \ \ + develop(bool, StressCompiledExceptionHandlers, false, \ + "Exercise compiled exception handlers") \ + \ develop(bool, InterceptOSException, false, \ "Starts debugger when an implicit OS (e.g., NULL) " \ "exception happens") \ diff --git a/hotspot/src/share/vm/runtime/os.hpp b/hotspot/src/share/vm/runtime/os.hpp index ad43ddf83f0..235005f9890 100644 --- a/hotspot/src/share/vm/runtime/os.hpp +++ b/hotspot/src/share/vm/runtime/os.hpp @@ -255,6 +255,7 @@ class os: AllStatic { static int vm_allocation_granularity(); static char* reserve_memory(size_t bytes, char* addr = 0, size_t alignment_hint = 0); + static char* reserve_memory_aligned(size_t size, size_t alignment); static char* attempt_reserve_memory_at(size_t bytes, char* addr); static void split_reserved_memory(char *base, size_t size, size_t split, bool realloc); diff --git a/hotspot/src/share/vm/runtime/os_ext.hpp b/hotspot/src/share/vm/runtime/os_ext.hpp index 6b610528e05..0e8618d1c38 100644 --- a/hotspot/src/share/vm/runtime/os_ext.hpp +++ b/hotspot/src/share/vm/runtime/os_ext.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp index 9ca52bec2cf..db3cace3d64 100644 --- a/hotspot/src/share/vm/runtime/thread.cpp +++ b/hotspot/src/share/vm/runtime/thread.cpp @@ -2190,7 +2190,7 @@ void JavaThread::send_thread_stop(oop java_throwable) { // BiasedLocking needs an updated RegisterMap for the revoke monitors pass RegisterMap reg_map(this, UseBiasedLocking); frame compiled_frame = f.sender(®_map); - if (compiled_frame.can_be_deoptimized()) { + if (!StressCompiledExceptionHandlers && compiled_frame.can_be_deoptimized()) { Deoptimization::deoptimize(this, compiled_frame, ®_map); } } @@ -3527,11 +3527,12 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) { java_lang_Thread::set_thread_status(thread_object, java_lang_Thread::RUNNABLE); - // The VM preresolve methods to these classes. Make sure that get initialized - initialize_class(vmSymbols::java_lang_reflect_Method(), CHECK_0); - initialize_class(vmSymbols::java_lang_ref_Finalizer(), CHECK_0); // The VM creates & returns objects of this class. Make sure it's initialized. initialize_class(vmSymbols::java_lang_Class(), CHECK_0); + + // The VM preresolves methods to these classes. Make sure that they get initialized + initialize_class(vmSymbols::java_lang_reflect_Method(), CHECK_0); + initialize_class(vmSymbols::java_lang_ref_Finalizer(), CHECK_0); call_initializeSystemClass(CHECK_0); // get the Java runtime name after java.lang.System is initialized diff --git a/hotspot/src/share/vm/runtime/virtualspace.cpp b/hotspot/src/share/vm/runtime/virtualspace.cpp index 18c147a6ad3..f33c1995e34 100644 --- a/hotspot/src/share/vm/runtime/virtualspace.cpp +++ b/hotspot/src/share/vm/runtime/virtualspace.cpp @@ -329,20 +329,9 @@ void ReservedSpace::initialize(size_t size, size_t alignment, bool large, if ((((size_t)base + noaccess_prefix) & (alignment - 1)) != 0) { // Base not aligned, retry if (!os::release_memory(base, size)) fatal("os::release_memory failed"); - // Reserve size large enough to do manual alignment and - // increase size to a multiple of the desired alignment + // Make sure that size is aligned size = align_size_up(size, alignment); - size_t extra_size = size + alignment; - do { - char* extra_base = os::reserve_memory(extra_size, NULL, alignment); - if (extra_base == NULL) return; - // Do manual alignement - base = (char*) align_size_up((uintptr_t) extra_base, alignment); - assert(base >= extra_base, "just checking"); - // Re-reserve the region at the aligned base address. - os::release_memory(extra_base, extra_size); - base = os::reserve_memory(size, base); - } while (base == NULL); + base = os::reserve_memory_aligned(size, alignment); if (requested_address != 0 && failed_to_reserve_as_requested(base, requested_address, size, false)) { diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp index 9346d6c72a7..9ac10e26d4c 100644 --- a/hotspot/src/share/vm/runtime/vmStructs.cpp +++ b/hotspot/src/share/vm/runtime/vmStructs.cpp @@ -355,8 +355,6 @@ typedef BinaryTreeDictionary MetablockTreeDictionary; nonstatic_field(Method, _access_flags, AccessFlags) \ nonstatic_field(Method, _vtable_index, int) \ nonstatic_field(Method, _method_size, u2) \ - nonstatic_field(Method, _max_locals, u2) \ - nonstatic_field(Method, _size_of_parameters, u2) \ nonstatic_field(Method, _interpreter_throwout_count, u2) \ nonstatic_field(Method, _number_of_breakpoints, u2) \ nonstatic_field(Method, _invocation_counter, InvocationCounter) \ @@ -378,6 +376,8 @@ typedef BinaryTreeDictionary MetablockTreeDictionary; nonstatic_field(ConstMethod, _signature_index, u2) \ nonstatic_field(ConstMethod, _method_idnum, u2) \ nonstatic_field(ConstMethod, _max_stack, u2) \ + nonstatic_field(ConstMethod, _max_locals, u2) \ + nonstatic_field(ConstMethod, _size_of_parameters, u2) \ nonstatic_field(ObjArrayKlass, _element_klass, Klass*) \ nonstatic_field(ObjArrayKlass, _bottom_klass, Klass*) \ volatile_nonstatic_field(Symbol, _refcount, int) \ diff --git a/hotspot/src/share/vm/services/diagnosticArgument.cpp b/hotspot/src/share/vm/services/diagnosticArgument.cpp index 23267fae520..826b530bcb2 100644 --- a/hotspot/src/share/vm/services/diagnosticArgument.cpp +++ b/hotspot/src/share/vm/services/diagnosticArgument.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/hotspot/src/share/vm/services/diagnosticCommand_ext.hpp b/hotspot/src/share/vm/services/diagnosticCommand_ext.hpp index 7b7e94f2ccc..b571655380b 100644 --- a/hotspot/src/share/vm/services/diagnosticCommand_ext.hpp +++ b/hotspot/src/share/vm/services/diagnosticCommand_ext.hpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. DO - * NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as diff --git a/hotspot/src/share/vm/services/memBaseline.hpp b/hotspot/src/share/vm/services/memBaseline.hpp index 5f98e30d451..c409ec3face 100644 --- a/hotspot/src/share/vm/services/memBaseline.hpp +++ b/hotspot/src/share/vm/services/memBaseline.hpp @@ -334,7 +334,7 @@ class MemBaseline : public _ValueObj { // create a memory baseline MemBaseline(); - virtual ~MemBaseline(); + ~MemBaseline(); inline bool baselined() const { return _baselined; diff --git a/hotspot/src/share/vm/services/memReporter.cpp b/hotspot/src/share/vm/services/memReporter.cpp index 602ac1c08ed..fca2897d6fe 100644 --- a/hotspot/src/share/vm/services/memReporter.cpp +++ b/hotspot/src/share/vm/services/memReporter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/hotspot/src/share/vm/services/memReporter.hpp b/hotspot/src/share/vm/services/memReporter.hpp index 7a5372d49a0..38f1e60bd89 100644 --- a/hotspot/src/share/vm/services/memReporter.hpp +++ b/hotspot/src/share/vm/services/memReporter.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/hotspot/src/share/vm/services/nmtDCmd.cpp b/hotspot/src/share/vm/services/nmtDCmd.cpp index 47f460e6e97..83b7d7e4b8a 100644 --- a/hotspot/src/share/vm/services/nmtDCmd.cpp +++ b/hotspot/src/share/vm/services/nmtDCmd.cpp @@ -84,28 +84,31 @@ void NMTDCmd::execute(TRAPS) { } int nopt = 0; - if(_summary.is_set()) { ++nopt; } - if(_detail.is_set()) { ++nopt; } - if(_baseline.is_set()) { ++nopt; } - if(_summary_diff.is_set()) { ++nopt; } - if(_detail_diff.is_set()) { ++nopt; } - if(_shutdown.is_set()) { ++nopt; } + if(_summary.is_set() && _summary.value()) { ++nopt; } + if(_detail.is_set() && _detail.value()) { ++nopt; } + if(_baseline.is_set() && _baseline.value()) { ++nopt; } + if(_summary_diff.is_set() && _summary_diff.value()) { ++nopt; } + if(_detail_diff.is_set() && _detail_diff.value()) { ++nopt; } + if(_shutdown.is_set() && _shutdown.value()) { ++nopt; } #ifndef PRODUCT - if(_debug.is_set()) { ++nopt; } + if(_debug.is_set() && _debug.value()) { ++nopt; } #endif if(nopt > 1) { output()->print_cr("At most one of the following option can be specified: " \ "summary, detail, baseline, summary.diff, detail.diff, shutdown" #ifndef PRODUCT - " ,debug" + ", debug" #endif ); return; - } - - if(nopt == 0) { + } else if (nopt == 0) { + if (_summary.is_set()) { + output()->print_cr("No command to execute"); + return; + } else { _summary.set_value(true); + } } #ifndef PRODUCT diff --git a/hotspot/src/share/vm/utilities/workgroup.hpp b/hotspot/src/share/vm/utilities/workgroup.hpp index b82478eac1d..6a93536246b 100644 --- a/hotspot/src/share/vm/utilities/workgroup.hpp +++ b/hotspot/src/share/vm/utilities/workgroup.hpp @@ -90,7 +90,7 @@ protected: NOT_PRODUCT(_name = name); _counter = 0; } - virtual ~AbstractGangTask() { } + ~AbstractGangTask() { } public: }; diff --git a/hotspot/src/share/vm/utilities/yieldingWorkgroup.hpp b/hotspot/src/share/vm/utilities/yieldingWorkgroup.hpp index a39f8227f57..f9646f91f7f 100644 --- a/hotspot/src/share/vm/utilities/yieldingWorkgroup.hpp +++ b/hotspot/src/share/vm/utilities/yieldingWorkgroup.hpp @@ -106,7 +106,7 @@ protected: _status(INACTIVE), _gang(NULL) { } - virtual ~YieldingFlexibleGangTask() { } + ~YieldingFlexibleGangTask() { } friend class YieldingFlexibleWorkGang; friend class YieldingFlexibleGangWorker; diff --git a/hotspot/test/compiler/7184394/TestAESBase.java b/hotspot/test/compiler/7184394/TestAESBase.java index ad6c835cc84..511b97dc6c6 100644 --- a/hotspot/test/compiler/7184394/TestAESBase.java +++ b/hotspot/test/compiler/7184394/TestAESBase.java @@ -54,7 +54,6 @@ abstract public class TestAESBase { String paddingStr = "PKCS5Padding"; AlgorithmParameters algParams; SecretKey key; - int ivLen; static int numThreads = 0; int threadId; @@ -68,7 +67,7 @@ abstract public class TestAESBase { public void prepare() { try { - System.out.println("\nmsgSize=" + msgSize + ", key size=" + keySize + ", reInit=" + !noReinit + ", checkOutput=" + checkOutput); + System.out.println("\nalgorithm=" + algorithm + ", mode=" + mode + ", msgSize=" + msgSize + ", keySize=" + keySize + ", noReinit=" + noReinit + ", checkOutput=" + checkOutput); int keyLenBytes = (keySize == 0 ? 16 : keySize/8); byte keyBytes[] = new byte[keyLenBytes]; @@ -90,10 +89,14 @@ abstract public class TestAESBase { cipher = Cipher.getInstance(algorithm + "/" + mode + "/" + paddingStr, "SunJCE"); dCipher = Cipher.getInstance(algorithm + "/" + mode + "/" + paddingStr, "SunJCE"); - ivLen = (algorithm.equals("AES") ? 16 : algorithm.equals("DES") ? 8 : 0); - IvParameterSpec initVector = new IvParameterSpec(new byte[ivLen]); - - cipher.init(Cipher.ENCRYPT_MODE, key, initVector); + if (mode.equals("CBC")) { + int ivLen = (algorithm.equals("AES") ? 16 : algorithm.equals("DES") ? 8 : 0); + IvParameterSpec initVector = new IvParameterSpec(new byte[ivLen]); + cipher.init(Cipher.ENCRYPT_MODE, key, initVector); + } else { + algParams = cipher.getParameters(); + cipher.init(Cipher.ENCRYPT_MODE, key, algParams); + } algParams = cipher.getParameters(); dCipher.init(Cipher.DECRYPT_MODE, key, algParams); if (threadId == 0) { diff --git a/hotspot/test/compiler/7184394/TestAESMain.java b/hotspot/test/compiler/7184394/TestAESMain.java index ca2cb43dc86..48baf572b3e 100644 --- a/hotspot/test/compiler/7184394/TestAESMain.java +++ b/hotspot/test/compiler/7184394/TestAESMain.java @@ -27,7 +27,8 @@ * @bug 7184394 * @summary add intrinsics to use AES instructions * - * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true TestAESMain + * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC TestAESMain + * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB TestAESMain * * @author Tom Deneau */ diff --git a/hotspot/test/compiler/8004741/Test8004741.java b/hotspot/test/compiler/8004741/Test8004741.java new file mode 100644 index 00000000000..95e63b9c0c1 --- /dev/null +++ b/hotspot/test/compiler/8004741/Test8004741.java @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test Test8004741.java + * @bug 8004741 + * @summary Missing compiled exception handle table entry for multidimensional array allocation + * @run main/othervm -Xmx64m -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:+StressCompiledExceptionHandlers Test8004741 + * + */ + +import java.util.*; + +public class Test8004741 extends Thread { + + static int[][] test(int a, int b) throws Exception { + int[][] ar = null; + try { + ar = new int[a][b]; + } catch (Error e) { + System.out.println("test got Error"); + passed = true; + throw(e); + } catch (Exception e) { + System.out.println("test got Exception"); + throw(e); + } + return ar; + } + + static boolean passed = false; + + public void run() { + System.out.println("test started"); + try { + while(true) { + test(2,20000); + } + } catch (ThreadDeath e) { + System.out.println("test got ThreadDeath"); + passed = true; + } catch (Error e) { + e.printStackTrace(); + System.out.println("test got Error"); + } catch (Exception e) { + e.printStackTrace(); + System.out.println("test got Exception"); + } + } + + public static void main(String[] args) throws Exception { + for (int n = 0; n < 11000; n++) { + test(2, 20); + } + + // First test exception catch + Test8004741 t = new Test8004741(); + + passed = false; + t.start(); + Thread.sleep(1000); + t.stop(); + + Thread.sleep(5000); + t.join(); + if (passed) { + System.out.println("PASSED"); + } else { + System.out.println("FAILED"); + System.exit(97); + } + } + +}; diff --git a/hotspot/test/compiler/8005033/Test8005033.java b/hotspot/test/compiler/8005033/Test8005033.java new file mode 100644 index 00000000000..e6706390841 --- /dev/null +++ b/hotspot/test/compiler/8005033/Test8005033.java @@ -0,0 +1,50 @@ +/* + * Copyright 2012 SAP AG. All Rights Reserved. + * 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 8005033 + * @summary On sparcv9, C2's intrinsic for Integer.bitCount(OV) returns wrong result if OV is the result of an operation with int overflow. + * @run main/othervm -Xcomp -XX:CompileOnly=Test8005033::testBitCount Test8005033 + * @author Richard Reingruber richard DOT reingruber AT sap DOT com + */ + +public class Test8005033 { + public static int MINUS_ONE = -1; + + public static void main(String[] args) { + System.out.println("EXECUTING test."); + Integer.bitCount(1); // load class + int expectedBitCount = 0; + int calculatedBitCount = testBitCount(); + if (expectedBitCount != calculatedBitCount) { + throw new InternalError("got " + calculatedBitCount + " but expected " + expectedBitCount); + } + System.out.println("SUCCESSFULLY passed test."); + } + + // testBitCount will be compiled using the Integer.bitCount() intrinsic if possible + private static int testBitCount() { + return Integer.bitCount(MINUS_ONE+1); // -1 + 1 => int overflow + } +} diff --git a/hotspot/test/runtime/7158804/Test7158804.sh b/hotspot/test/runtime/7158804/Test7158804.sh index bce5197dfbe..e7f14238409 100644 --- a/hotspot/test/runtime/7158804/Test7158804.sh +++ b/hotspot/test/runtime/7158804/Test7158804.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # diff --git a/hotspot/test/sanity/ExecuteInternalVMTests.java b/hotspot/test/sanity/ExecuteInternalVMTests.java new file mode 100644 index 00000000000..b3e3724f287 --- /dev/null +++ b/hotspot/test/sanity/ExecuteInternalVMTests.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +/* @test ExecuteInternalVMTests + * @bug 8004691 + * @summary Add a jtreg test that exercises the ExecuteInternalVMTests flag + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+ExecuteInternalVMTests ExecuteInternalVMTests + */ +public class ExecuteInternalVMTests { + public static void main(String[] args) throws Exception { + // The tests that are run are the HotSpot internal tests which are + // executed only when the flag -XX:+ExecuteInternalVMTests is used. + + // The flag -XX:+ExecuteInternalVMTests can only be used for + // non-product builds of HotSpot. Therefore, the flag + // -XX:+IgnoreUnrecognizedVMOptions is also used, which means that this + // test will do nothing on a product build. + } +} diff --git a/jaxp/.hgtags b/jaxp/.hgtags index a375051d37e..a3961e5fd96 100644 --- a/jaxp/.hgtags +++ b/jaxp/.hgtags @@ -189,3 +189,6 @@ af9e8b0f1900b631a8a0fcccff9f1514fe58c808 jdk8-b59 5cf3c69a93d6d088a1cdfa28031d4f0f9438c0de jdk8-b65 e6af1ad464e3d9b1154b9f9ed9a5373b97d129fc jdk8-b66 83df3493ca3cf0be077f1d0dd90119456f266f54 jdk8-b67 +b854e70084214e9dcf1b37373f6e4b1a68760e03 jdk8-b68 +789a855de959f7e9600e57759c6c3dbb0b24d78b jdk8-b69 +6ec9edffc286c9c9ac96c9cd2050b01cb5d514a8 jdk8-b70 diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/XalanConstants.java b/jaxp/src/com/sun/org/apache/xalan/internal/XalanConstants.java index 5e21f40d854..6fdccc023c7 100644 --- a/jaxp/src/com/sun/org/apache/xalan/internal/XalanConstants.java +++ b/jaxp/src/com/sun/org/apache/xalan/internal/XalanConstants.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/utils/FactoryImpl.java b/jaxp/src/com/sun/org/apache/xalan/internal/utils/FactoryImpl.java index d62e0ab40cb..973a7fd97f2 100644 --- a/jaxp/src/com/sun/org/apache/xalan/internal/utils/FactoryImpl.java +++ b/jaxp/src/com/sun/org/apache/xalan/internal/utils/FactoryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xslt/EnvironmentCheck.java b/jaxp/src/com/sun/org/apache/xalan/internal/xslt/EnvironmentCheck.java index 8940d05823b..11d2cdcdc46 100644 --- a/jaxp/src/com/sun/org/apache/xalan/internal/xslt/EnvironmentCheck.java +++ b/jaxp/src/com/sun/org/apache/xalan/internal/xslt/EnvironmentCheck.java @@ -1005,7 +1005,7 @@ public class EnvironmentCheck { Class clazz = ObjectFactory.findProviderClass(DOM_CLASS, true); - Method method = clazz.getMethod(DOM_LEVEL3_METHOD, null); + Method method = clazz.getMethod(DOM_LEVEL3_METHOD, (Class[])null); // If we succeeded, we have loaded interfaces from a // level 3 DOM somewhere diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/Version.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/Version.java index 165a3349d8d..ac62db7dc26 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/Version.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/Version.java @@ -74,7 +74,7 @@ public class Version { /** Version string. * @deprecated getVersion() should be used instead. */ - public static String fVersion = "Xerces-J 2.7.1"; + public static final String fVersion = getVersion(); private static final String fImmutableVersion = "Xerces-J 2.7.1"; diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java index 8a2b5948c3f..abbd696bb03 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java @@ -193,9 +193,12 @@ public class XMLDocumentFragmentScannerImpl null, }; - protected static final char [] cdata = {'[','C','D','A','T','A','['}; - protected static final char [] xmlDecl = {'<','?','x','m','l'}; - protected static final char [] endTag = {'<','/'}; + private static final char [] cdata = {'[','C','D','A','T','A','['}; + private static final char [] endTag = {'<','/'}; + + //this variable is also used by XMLDocumentScannerImpl in the same package + static final char [] xmlDecl = {'<','?','x','m','l'}; + // debugging /** Debug scanner state. */ diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java index 48a1c88a6b3..4acc9c94bd5 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java @@ -71,7 +71,7 @@ public class XMLEntityScanner implements XMLLocator { /** Listeners which should know when load is being called */ private Vector listeners = new Vector(); - public static final boolean [] VALID_NAMES = new boolean[127]; + private static final boolean [] VALID_NAMES = new boolean[127]; /** * Debug printing of buffer. This debugging flag works best when you diff --git a/jaxp/src/javax/xml/transform/FactoryFinder.java b/jaxp/src/javax/xml/transform/FactoryFinder.java index b0c6d9a1e9b..9ded4fb61e4 100644 --- a/jaxp/src/javax/xml/transform/FactoryFinder.java +++ b/jaxp/src/javax/xml/transform/FactoryFinder.java @@ -210,7 +210,7 @@ class FactoryFinder { providerClass.getDeclaredMethod( "newTransformerFactoryNoServiceLoader" ); - return creationMethod.invoke(null, null); + return creationMethod.invoke(null, (Object[])null); } catch (NoSuchMethodException exc) { return null; } catch (Exception exc) { diff --git a/jaxp/src/javax/xml/validation/SchemaFactoryFinder.java b/jaxp/src/javax/xml/validation/SchemaFactoryFinder.java index 8157b6bd8dd..39c76ed428f 100644 --- a/jaxp/src/javax/xml/validation/SchemaFactoryFinder.java +++ b/jaxp/src/javax/xml/validation/SchemaFactoryFinder.java @@ -357,7 +357,7 @@ class SchemaFactoryFinder { providerClass.getDeclaredMethod( "newXMLSchemaFactoryNoServiceLoader" ); - return creationMethod.invoke(null, null); + return creationMethod.invoke(null, (Object[])null); } catch (NoSuchMethodException exc) { return null; } catch (Exception exc) { diff --git a/jaxp/src/javax/xml/xpath/XPathFactoryFinder.java b/jaxp/src/javax/xml/xpath/XPathFactoryFinder.java index 2833a58804b..6db1dae1794 100644 --- a/jaxp/src/javax/xml/xpath/XPathFactoryFinder.java +++ b/jaxp/src/javax/xml/xpath/XPathFactoryFinder.java @@ -333,7 +333,7 @@ class XPathFactoryFinder { providerClass.getDeclaredMethod( "newXPathFactoryNoServiceLoader" ); - return creationMethod.invoke(null, null); + return creationMethod.invoke(null, (Object[])null); } catch (NoSuchMethodException exc) { return null; } catch (Exception exc) { diff --git a/jaxws/.hgtags b/jaxws/.hgtags index 2fde96d9938..8ea30fd20d0 100644 --- a/jaxws/.hgtags +++ b/jaxws/.hgtags @@ -189,3 +189,6 @@ d265b9b4c0f55c23a1c9fda02a8052fd9df2eec5 jdk8-b62 fbe54291c9d337ea4dfef4d846f1d9a22f76249c jdk8-b65 3eb7f11cb4e000555c1b6f0f1a10fe2919633c8e jdk8-b66 eb06aa51dfc225614dba2d89ae7ca6cedddff982 jdk8-b67 +d3fe408f3a9ad250bc9a4e9365bdfc3f28c1d3f4 jdk8-b68 +756323c990115a9c0341d67b10f2d52c6370e35d jdk8-b69 +3b1c2733d47ee9f8c530925df4041c59f9ee5a31 jdk8-b70 diff --git a/jdk/.hgtags b/jdk/.hgtags index 7c1c3788449..c234e2c613b 100644 --- a/jdk/.hgtags +++ b/jdk/.hgtags @@ -189,3 +189,6 @@ f117a3e06f78a258074674ad17601f99bcb1ce0d jdk8-b63 130d3a54d28becaac0846137256c2684adb34c33 jdk8-b65 4d337fae2250135729ee9ed2bf8baf3c60da5d6d jdk8-b66 ce9b02a3a17edd1983201002cfa0f364e4ab7524 jdk8-b67 +53fb43e4d614c92310e1fb00ec41d1960fd9facf jdk8-b68 +a8012d8d7e9c5035de0bdd4887dc9f7c54008f21 jdk8-b69 +a996b57e554198f4592a5f3c30f2f9f4075e545d jdk8-b70 diff --git a/jdk/make/com/sun/security/Makefile b/jdk/make/com/sun/security/Makefile index 3a6ae4386e2..85a919b1824 100644 --- a/jdk/make/com/sun/security/Makefile +++ b/jdk/make/com/sun/security/Makefile @@ -35,7 +35,7 @@ SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true include $(BUILDDIR)/common/Defs.gmk SUBDIRS = auth -SUBDIRS_misc = jgss sasl auth/module +SUBDIRS_misc = jgss sasl auth/module ntlm include $(BUILDDIR)/common/Subdirs.gmk all build clean clobber:: diff --git a/jdk/make/jdk/asm/Makefile b/jdk/make/com/sun/security/ntlm/Makefile similarity index 82% rename from jdk/make/jdk/asm/Makefile rename to jdk/make/com/sun/security/ntlm/Makefile index 48b8f609644..547092b7a61 100644 --- a/jdk/make/jdk/asm/Makefile +++ b/jdk/make/com/sun/security/ntlm/Makefile @@ -1,5 +1,5 @@ # -# Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -23,16 +23,15 @@ # questions. # -BUILDDIR = ../.. -PACKAGE = jdk.internal.org.objectweb.asm -PRODUCT = jdk -JAVAC_LINT_OPTIONS=-Xlint:all +BUILDDIR = ../../../.. +PACKAGE = com.sun.security.ntlm +PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk # -# Files to compile +# Files # -AUTO_FILES_JAVA_DIRS = jdk/internal/org/objectweb/asm +AUTO_FILES_JAVA_DIRS = com/sun/security/ntlm # # Rules diff --git a/jdk/make/common/Release.gmk b/jdk/make/common/Release.gmk index 15aa7c96c6c..dc43ecf95ea 100644 --- a/jdk/make/common/Release.gmk +++ b/jdk/make/common/Release.gmk @@ -366,6 +366,7 @@ TOOLS = \ com/sun/source \ com/sun/tools/classfile \ com/sun/tools/doclets \ + com/sun/tools/doclint \ com/sun/tools/example/debug/expr \ com/sun/tools/example/debug/tty \ com/sun/tools/extcheck \ diff --git a/jdk/make/common/internal/Defs-langtools.gmk b/jdk/make/common/internal/Defs-langtools.gmk index e5649583fa5..eed44357db2 100644 --- a/jdk/make/common/internal/Defs-langtools.gmk +++ b/jdk/make/common/internal/Defs-langtools.gmk @@ -35,6 +35,7 @@ IMPORT_TOOLS_PACKAGES += \ com/sun/source \ com/sun/tools/classfile \ com/sun/tools/doclets \ + com/sun/tools/doclint \ com/sun/tools/javac \ com/sun/tools/javadoc \ com/sun/tools/javah \ diff --git a/jdk/make/docs/NON_CORE_PKGS.gmk b/jdk/make/docs/NON_CORE_PKGS.gmk index b68208b3370..b299938e844 100644 --- a/jdk/make/docs/NON_CORE_PKGS.gmk +++ b/jdk/make/docs/NON_CORE_PKGS.gmk @@ -76,7 +76,8 @@ ATTACH_PKGS = com.sun.tools.attach \ JCONSOLE_PKGS = com.sun.tools.jconsole -TREEAPI_PKGS = com.sun.source.tree \ +TREEAPI_PKGS = com.sunsource.doctree \ + com.sun.source.tree \ com.sun.source.util SMARTCARDIO_PKGS = javax.smartcardio diff --git a/jdk/make/java/java/FILES_java.gmk b/jdk/make/java/java/FILES_java.gmk index 33d35caeef5..f6affbf987b 100644 --- a/jdk/make/java/java/FILES_java.gmk +++ b/jdk/make/java/java/FILES_java.gmk @@ -294,6 +294,7 @@ JAVA_JAVA_java = \ java/util/IdentityHashMap.java \ java/util/EnumMap.java \ java/util/Arrays.java \ + java/util/ArraysParallelSortHelpers.java \ java/util/DualPivotQuicksort.java \ java/util/TimSort.java \ java/util/ComparableTimSort.java \ @@ -322,6 +323,7 @@ JAVA_JAVA_java = \ java/util/concurrent/CopyOnWriteArrayList.java \ java/util/concurrent/CopyOnWriteArraySet.java \ java/util/concurrent/CountDownLatch.java \ + java/util/concurrent/CountedCompleter.java \ java/util/concurrent/CyclicBarrier.java \ java/util/concurrent/DelayQueue.java \ java/util/concurrent/Delayed.java \ diff --git a/jdk/make/java/security/Makefile b/jdk/make/java/security/Makefile index d68d0a03510..bbb0ca4f757 100644 --- a/jdk/make/java/security/Makefile +++ b/jdk/make/java/security/Makefile @@ -40,7 +40,8 @@ AUTO_FILES_JAVA_DIRS = java/security # Directories # -PROPS_SRC = $(TOPDIR)/src/share/lib/security/java.security +# The default security properties file is for linux +PROPS_SRC = $(TOPDIR)/src/share/lib/security/java.security-linux ifeq ($(PLATFORM), solaris) PROPS_SRC = $(TOPDIR)/src/share/lib/security/java.security-solaris diff --git a/jdk/make/jdk/Makefile b/jdk/make/jdk/Makefile index b8ac7422749..686c94a5758 100644 --- a/jdk/make/jdk/Makefile +++ b/jdk/make/jdk/Makefile @@ -1,5 +1,5 @@ # -# Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -23,16 +23,18 @@ # questions. # -# -# Makefile for building all of java -# - BUILDDIR = .. +PACKAGE = jdk PRODUCT = jdk +JAVAC_LINT_OPTIONS=-Xlint:all include $(BUILDDIR)/common/Defs.gmk -SUBDIRS = asm -include $(BUILDDIR)/common/Subdirs.gmk +# +# Files to compile +# +AUTO_FILES_JAVA_DIRS = jdk -all build clean clobber:: - $(SUBDIRS-loop) +# +# Rules +# +include $(BUILDDIR)/common/Classes.gmk diff --git a/jdk/make/netbeans/jmx/build.properties b/jdk/make/netbeans/jmx/build.properties index e998e58a17f..0012f8ebbc8 100644 --- a/jdk/make/netbeans/jmx/build.properties +++ b/jdk/make/netbeans/jmx/build.properties @@ -38,6 +38,7 @@ excludes=\ com/sun/jmx/snmp/ jtreg.tests=\ + com/sun/jmx/ \ com/sun/management/ \ java/lang/management/ \ javax/management/ diff --git a/jdk/make/sun/security/Makefile b/jdk/make/sun/security/Makefile index 50720320121..9e9f8c50d36 100644 --- a/jdk/make/sun/security/Makefile +++ b/jdk/make/sun/security/Makefile @@ -38,10 +38,12 @@ SUBDIRS_MAKEFLAGS += JAVAC_MAX_WARNINGS=true SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true include $(BUILDDIR)/common/Defs.gmk -# build sun/security/jgss/wrapper on non-windows platform +# build sun/security/jgss/wrapper on non-windows non-macosx platforms JGSS_WRAPPER = ifneq ($(PLATFORM), windows) - JGSS_WRAPPER = jgss/wrapper + ifneq ($(PLATFORM), macosx) + JGSS_WRAPPER = jgss/wrapper + endif endif # Build PKCS#11 on all platforms diff --git a/jdk/make/tools/src/build/tools/cldrconverter/Bundle.java b/jdk/make/tools/src/build/tools/cldrconverter/Bundle.java index dc277ea684e..701ea4b057d 100644 --- a/jdk/make/tools/src/build/tools/cldrconverter/Bundle.java +++ b/jdk/make/tools/src/build/tools/cldrconverter/Bundle.java @@ -29,6 +29,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.EnumSet; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; @@ -86,7 +87,23 @@ class Bundle { private final static String[] ERA_KEYS = { "long.Eras", "Eras", - "short.Eras" + "narrow.Eras" + }; + + // Keys for individual time zone names + private final static String TZ_GEN_LONG_KEY = "timezone.displayname.generic.long"; + private final static String TZ_GEN_SHORT_KEY = "timezone.displayname.generic.short"; + private final static String TZ_STD_LONG_KEY = "timezone.displayname.standard.long"; + private final static String TZ_STD_SHORT_KEY = "timezone.displayname.standard.short"; + private final static String TZ_DST_LONG_KEY = "timezone.displayname.daylight.long"; + private final static String TZ_DST_SHORT_KEY = "timezone.displayname.daylight.short"; + private final static String[] ZONE_NAME_KEYS = { + TZ_STD_LONG_KEY, + TZ_STD_SHORT_KEY, + TZ_DST_LONG_KEY, + TZ_DST_SHORT_KEY, + TZ_GEN_LONG_KEY, + TZ_GEN_SHORT_KEY }; private final String id; @@ -98,6 +115,7 @@ class Bundle { return bundles.get(id); } + @SuppressWarnings("ConvertToStringSwitch") Bundle(String id, String cldrPath, String bundles, String currencies) { this.id = id; this.cldrPath = cldrPath; @@ -242,9 +260,12 @@ class Bundle { // handle multiple inheritance for month and day names handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "MonthNames"); handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "MonthAbbreviations"); + handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "MonthNarrows"); handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "DayNames"); handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "DayAbbreviations"); + handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "DayNarrows"); handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "AmPmMarkers"); + handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "narrow.AmPmMarkers"); adjustEraNames(myMap, calendarType); @@ -253,6 +274,99 @@ class Bundle { handleDateTimeFormatPatterns(DATETIME_PATTERN_KEYS, myMap, parentsMap, calendarType, "DateTimePatterns"); } + // if myMap has any empty timezone or metazone names, weed out them. + // Fill in any missing abbreviations if locale is "en". + for (Iterator it = myMap.keySet().iterator(); it.hasNext();) { + String key = it.next(); + if (key.startsWith(CLDRConverter.TIMEZONE_ID_PREFIX) + || key.startsWith(CLDRConverter.METAZONE_ID_PREFIX)) { + @SuppressWarnings("unchecked") + Map nameMap = (Map) myMap.get(key); + if (nameMap.isEmpty()) { + // Some zones have only exemplarCity, which become empty. + // Remove those from the map. + it.remove(); + continue; + } + + if (id.startsWith("en")) { + fillInAbbrs(key, nameMap); + } + } + } + for (Iterator it = myMap.keySet().iterator(); it.hasNext();) { + String key = it.next(); + if (key.startsWith(CLDRConverter.TIMEZONE_ID_PREFIX) + || key.startsWith(CLDRConverter.METAZONE_ID_PREFIX)) { + @SuppressWarnings("unchecked") + Map nameMap = (Map) myMap.get(key); + // Convert key/value pairs to an array. + String[] names = new String[ZONE_NAME_KEYS.length]; + int ix = 0; + for (String nameKey : ZONE_NAME_KEYS) { + String name = nameMap.get(nameKey); + if (name == null) { + @SuppressWarnings("unchecked") + Map parentNames = (Map) parentsMap.get(key); + if (parentNames != null) { + name = parentNames.get(nameKey); + } + } + names[ix++] = name; + } + if (hasNulls(names)) { + String metaKey = toMetaZoneKey(key); + if (metaKey != null) { + Object obj = myMap.get(metaKey); + if (obj instanceof String[]) { + String[] metaNames = (String[]) obj; + for (int i = 0; i < names.length; i++) { + if (names[i] == null) { + names[i] = metaNames[i]; + } + } + } else if (obj instanceof Map) { + @SuppressWarnings("unchecked") + Map m = (Map) obj; + for (int i = 0; i < names.length; i++) { + if (names[i] == null) { + names[i] = m.get(ZONE_NAME_KEYS[i]); + } + } + } + } + // If there are still any nulls, try filling in them from en data. + if (hasNulls(names) && !id.equals("en")) { + @SuppressWarnings("unchecked") + String[] enNames = (String[]) Bundle.getBundle("en").getTargetMap().get(key); + if (enNames == null) { + if (metaKey != null) { + @SuppressWarnings("unchecked") + String[] metaNames = (String[]) Bundle.getBundle("en").getTargetMap().get(metaKey); + enNames = metaNames; + } + } + if (enNames != null) { + for (int i = 0; i < names.length; i++) { + if (names[i] == null) { + names[i] = enNames[i]; + } + } + } + // If there are still nulls, give up names. + if (hasNulls(names)) { + names = null; + } + } + } + // replace the Map with the array + if (names != null) { + myMap.put(key, names); + } else { + it.remove(); + } + } + } return myMap; } @@ -352,20 +466,10 @@ class Bundle { realKeys[index] = realKey; eraNames[index++] = value; } - if (eraNames[0] != null) { - if (eraNames[1] != null) { - if (eraNames[2] == null) { - // Eras -> short.Eras - // long.Eras -> Eras - map.put(realKeys[2], map.get(realKeys[1])); - map.put(realKeys[1], map.get(realKeys[0])); - } - } else { - // long.Eras -> Eras - map.put(realKeys[1], map.get(realKeys[0])); + for (int i = 0; i < eraNames.length; i++) { + if (eraNames[i] == null) { + map.put(realKeys[i], null); } - // remove long.Eras - map.remove(realKeys[0]); } } @@ -473,6 +577,86 @@ class Bundle { return jrePattern.toString(); } + private String toMetaZoneKey(String tzKey) { + if (tzKey.startsWith(CLDRConverter.TIMEZONE_ID_PREFIX)) { + String tz = tzKey.substring(CLDRConverter.TIMEZONE_ID_PREFIX.length()); + String meta = CLDRConverter.handlerMetaZones.get(tz); + if (meta != null) { + return CLDRConverter.METAZONE_ID_PREFIX + meta; + } + } + return null; + } + + private void fillInAbbrs(String key, Map map) { + fillInAbbrs(TZ_STD_LONG_KEY, TZ_STD_SHORT_KEY, map); + fillInAbbrs(TZ_DST_LONG_KEY, TZ_DST_SHORT_KEY, map); + fillInAbbrs(TZ_GEN_LONG_KEY, TZ_GEN_SHORT_KEY, map); + + // If the standard std is "Standard Time" and daylight std is "Summer Time", + // replace the standard std with the generic std to avoid using + // the same abbrivation except for Australia time zone names. + String std = map.get(TZ_STD_SHORT_KEY); + String dst = map.get(TZ_DST_SHORT_KEY); + String gen = map.get(TZ_GEN_SHORT_KEY); + if (std != null) { + if (dst == null) { + // if dst is null, create long and short names from the standard + // std. ("Something Standard Time" to "Something Daylight Time", + // or "Something Time" to "Something Summer Time") + String name = map.get(TZ_STD_LONG_KEY); + if (name != null) { + if (name.contains("Standard Time")) { + name = name.replace("Standard Time", "Daylight Time"); + } else if (name.endsWith("Mean Time")) { + name = name.replace("Mean Time", "Summer Time"); + } else if (name.endsWith(" Time")) { + name = name.replace(" Time", " Summer Time"); + } + map.put(TZ_DST_LONG_KEY, name); + fillInAbbrs(TZ_DST_LONG_KEY, TZ_DST_SHORT_KEY, map); + } + } + if (gen == null) { + String name = map.get(TZ_STD_LONG_KEY); + if (name != null) { + if (name.endsWith("Standard Time")) { + name = name.replace("Standard Time", "Time"); + } else if (name.endsWith("Mean Time")) { + name = name.replace("Mean Time", "Time"); + } + map.put(TZ_GEN_LONG_KEY, name); + fillInAbbrs(TZ_GEN_LONG_KEY, TZ_GEN_SHORT_KEY, map); + } + } + } + } + + private void fillInAbbrs(String longKey, String shortKey, Map map) { + String abbr = map.get(shortKey); + if (abbr == null) { + String name = map.get(longKey); + if (name != null) { + abbr = toAbbr(name); + if (abbr != null) { + map.put(shortKey, abbr); + } + } + } + } + + private String toAbbr(String name) { + String[] substrs = name.split("\\s+"); + StringBuilder sb = new StringBuilder(); + for (String s : substrs) { + char c = s.charAt(0); + if (c >= 'A' && c <= 'Z') { + sb.append(c); + } + } + return sb.length() > 0 ? sb.toString() : null; + } + private void convert(CalendarType calendarType, char cldrLetter, int count, StringBuilder sb) { switch (cldrLetter) { case 'G': @@ -539,4 +723,13 @@ class Bundle { sb.append(c); } } + + private static boolean hasNulls(Object[] array) { + for (int i = 0; i < array.length; i++) { + if (array[i] == null) { + return true; + } + } + return false; + } } diff --git a/jdk/make/tools/src/build/tools/cldrconverter/BundleGenerator.java b/jdk/make/tools/src/build/tools/cldrconverter/BundleGenerator.java index f06a903a26e..14760bcbb4d 100644 --- a/jdk/make/tools/src/build/tools/cldrconverter/BundleGenerator.java +++ b/jdk/make/tools/src/build/tools/cldrconverter/BundleGenerator.java @@ -30,8 +30,27 @@ import java.util.Map; import java.util.SortedSet; public interface BundleGenerator { + static enum BundleType { + PLAIN("java.util.ListResourceBundle"), + OPEN("sun.util.resources.OpenListResourceBundle"), + TIMEZONE("sun.util.resources.TimeZoneNamesBundle"); + + private final String pathName, className; + private BundleType(String name) { + pathName = name; + int x = name.lastIndexOf('.'); + className = name.substring(x + 1); + } + String getPathName() { + return pathName; + } + String getClassName() { + return className; + } + }; + public void generateBundle(String packageName, String baseName, String localeID, - boolean useJava, Map map, boolean open) throws IOException; + boolean useJava, Map map, BundleType type) throws IOException; public void generateMetaInfo(Map> metaInfo) throws IOException; } diff --git a/jdk/make/tools/src/build/tools/cldrconverter/CLDRConverter.java b/jdk/make/tools/src/build/tools/cldrconverter/CLDRConverter.java index 106e3475a8e..1d5cd5e2d8f 100644 --- a/jdk/make/tools/src/build/tools/cldrconverter/CLDRConverter.java +++ b/jdk/make/tools/src/build/tools/cldrconverter/CLDRConverter.java @@ -25,6 +25,7 @@ package build.tools.cldrconverter; +import build.tools.cldrconverter.BundleGenerator.BundleType; import java.io.File; import java.nio.file.DirectoryStream; import java.nio.file.FileSystems; @@ -58,9 +59,8 @@ public class CLDRConverter { static final String CURRENCY_SYMBOL_PREFIX = "currency.symbol."; static final String CURRENCY_NAME_PREFIX = "currency.displayname."; static final String TIMEZONE_ID_PREFIX = "timezone.id."; - static final String TIMEZONE_NAME_PREFIX = "timezone.displayname."; + static final String ZONE_NAME_PREFIX = "timezone.displayname."; static final String METAZONE_ID_PREFIX = "metazone.id."; - static final String METAZONE_NAME_PREFIX = "metazone.displayname."; private static SupplementDataParseHandler handlerSuppl; static NumberingSystemsParseHandler handlerNumbering; @@ -236,7 +236,14 @@ public class CLDRConverter { if (sb.indexOf("root") == -1) { sb.append("root"); } - retList.add(new Bundle(id, sb.toString(), null, null)); + Bundle b = new Bundle(id, sb.toString(), null, null); + // Insert the bundle for en at the top so that it will get + // processed first. + if ("en".equals(id)) { + retList.add(0, b); + } else { + retList.add(b); + } } } } @@ -312,6 +319,7 @@ public class CLDRConverter { Map> metaInfo = new HashMap<>(); metaInfo.put("LocaleNames", new TreeSet()); metaInfo.put("CurrencyNames", new TreeSet()); + metaInfo.put("TimeZoneNames", new TreeSet()); metaInfo.put("CalendarData", new TreeSet()); metaInfo.put("FormatData", new TreeSet()); @@ -348,24 +356,28 @@ public class CLDRConverter { Map localeNamesMap = extractLocaleNames(targetMap, bundle.getID()); if (!localeNamesMap.isEmpty() || bundle.isRoot()) { metaInfo.get("LocaleNames").add(toLanguageTag(bundle.getID())); - bundleGenerator.generateBundle("util", "LocaleNames", bundle.getID(), true, localeNamesMap, true); + bundleGenerator.generateBundle("util", "LocaleNames", bundle.getID(), true, localeNamesMap, BundleType.OPEN); } } if (bundleTypes.contains(Bundle.Type.CURRENCYNAMES)) { Map currencyNamesMap = extractCurrencyNames(targetMap, bundle.getID(), bundle.getCurrencies()); if (!currencyNamesMap.isEmpty() || bundle.isRoot()) { metaInfo.get("CurrencyNames").add(toLanguageTag(bundle.getID())); - bundleGenerator.generateBundle("util", "CurrencyNames", bundle.getID(), true, currencyNamesMap, true); + bundleGenerator.generateBundle("util", "CurrencyNames", bundle.getID(), true, currencyNamesMap, BundleType.OPEN); } } if (bundleTypes.contains(Bundle.Type.TIMEZONENAMES)) { Map zoneNamesMap = extractZoneNames(targetMap, bundle.getID()); + if (!zoneNamesMap.isEmpty() || bundle.isRoot()) { + metaInfo.get("TimeZoneNames").add(toLanguageTag(bundle.getID())); + bundleGenerator.generateBundle("util", "TimeZoneNames", bundle.getID(), true, zoneNamesMap, BundleType.TIMEZONE); + } } if (bundleTypes.contains(Bundle.Type.CALENDARDATA)) { Map calendarDataMap = extractCalendarData(targetMap, bundle.getID()); if (!calendarDataMap.isEmpty() || bundle.isRoot()) { metaInfo.get("CalendarData").add(toLanguageTag(bundle.getID())); - bundleGenerator.generateBundle("util", "CalendarData", bundle.getID(), true, calendarDataMap, false); + bundleGenerator.generateBundle("util", "CalendarData", bundle.getID(), true, calendarDataMap, BundleType.PLAIN); } } if (bundleTypes.contains(Bundle.Type.FORMATDATA)) { @@ -373,9 +385,10 @@ public class CLDRConverter { // LocaleData.getAvailableLocales depends on having FormatData bundles around if (!formatDataMap.isEmpty() || bundle.isRoot()) { metaInfo.get("FormatData").add(toLanguageTag(bundle.getID())); - bundleGenerator.generateBundle("text", "FormatData", bundle.getID(), true, formatDataMap, false); + bundleGenerator.generateBundle("text", "FormatData", bundle.getID(), true, formatDataMap, BundleType.PLAIN); } } + // For testing SortedSet allLocales = new TreeSet<>(); allLocales.addAll(metaInfo.get("CurrencyNames")); @@ -431,6 +444,7 @@ public class CLDRConverter { private KeyComparator() { } + @Override public int compare(String o1, String o2) { int len1 = o1.length(); int len2 = o2.length(); @@ -476,7 +490,26 @@ public class CLDRConverter { } private static Map extractZoneNames(Map map, String id) { - return null; + Map names = new HashMap<>(); + for (String tzid : handlerMetaZones.keySet()) { + String tzKey = TIMEZONE_ID_PREFIX + tzid; + Object data = map.get(tzKey); + if (data instanceof String[]) { + names.put(tzid, data); + } else { + String meta = handlerMetaZones.get(tzid); + if (meta != null) { + String metaKey = METAZONE_ID_PREFIX + meta; + data = map.get(metaKey); + if (data instanceof String[]) { + // Keep the metazone prefix here. + names.put(metaKey, data); + names.put(tzid, meta); + } + } + } + } + return names; } private static Map extractCalendarData(Map map, String id) { @@ -494,11 +527,19 @@ public class CLDRConverter { copyIfPresent(map, prefix + "standalone.MonthNames", formatData); copyIfPresent(map, prefix + "MonthAbbreviations", formatData); copyIfPresent(map, prefix + "standalone.MonthAbbreviations", formatData); + copyIfPresent(map, prefix + "MonthNarrow", formatData); + copyIfPresent(map, prefix + "standalone.MonthNarrows", formatData); copyIfPresent(map, prefix + "DayNames", formatData); + copyIfPresent(map, prefix + "standalone.DayNames", formatData); copyIfPresent(map, prefix + "DayAbbreviations", formatData); + copyIfPresent(map, prefix + "standalone.DayAbbreviations", formatData); + copyIfPresent(map, prefix + "DayNarrows", formatData); + copyIfPresent(map, prefix + "standalone.DayNarrows", formatData); copyIfPresent(map, prefix + "AmPmMarkers", formatData); + copyIfPresent(map, prefix + "narrow.AmPmMarkers", formatData); + copyIfPresent(map, prefix + "long.Eras", formatData); copyIfPresent(map, prefix + "Eras", formatData); - copyIfPresent(map, prefix + "short.Eras", formatData); + copyIfPresent(map, prefix + "narrow.Eras", formatData); copyIfPresent(map, prefix + "TimePatterns", formatData); copyIfPresent(map, prefix + "DatePatterns", formatData); copyIfPresent(map, prefix + "DateTimePatterns", formatData); @@ -560,7 +601,6 @@ public class CLDRConverter { if (x == 0 || escapeSpace) { outBuffer.append('\\'); } - outBuffer.append(' '); break; case '\\': @@ -584,7 +624,7 @@ public class CLDRConverter { outBuffer.append('f'); break; default: - if (!USE_UTF8 && ((aChar < 0x0020) || (aChar > 0x007e))) { + if (aChar < 0x0020 || (!USE_UTF8 && aChar > 0x007e)) { formatter.format("\\u%04x", (int)aChar); } else { if (specialSaveChars.indexOf(aChar) != -1) { diff --git a/jdk/make/tools/src/build/tools/cldrconverter/LDMLParseHandler.java b/jdk/make/tools/src/build/tools/cldrconverter/LDMLParseHandler.java index 128eaf6ef57..812aab244fa 100644 --- a/jdk/make/tools/src/build/tools/cldrconverter/LDMLParseHandler.java +++ b/jdk/make/tools/src/build/tools/cldrconverter/LDMLParseHandler.java @@ -155,6 +155,9 @@ class LDMLParseHandler extends AbstractLDMLHandler { case "abbreviated": pushStringArrayEntry(qName, attributes, prefix + "MonthAbbreviations/" + getContainerKey(), 13); break; + case "narrow": + pushStringArrayEntry(qName, attributes, prefix + "MonthNarrows/" + getContainerKey(), 13); + break; default: pushIgnoredContainer(qName); break; @@ -191,6 +194,9 @@ class LDMLParseHandler extends AbstractLDMLHandler { case "abbreviated": pushStringArrayEntry(qName, attributes, prefix + "DayAbbreviations/" + getContainerKey(), 7); break; + case "narrow": + pushStringArrayEntry(qName, attributes, prefix + "DayNarrows/" + getContainerKey(), 7); + break; default: pushIgnoredContainer(qName); break; @@ -219,25 +225,36 @@ class LDMLParseHandler extends AbstractLDMLHandler { case "dayPeriodWidth": // for FormatData // create string array entry for am/pm. only keeping wide - if ("wide".equals(attributes.getValue("type"))) { + switch (attributes.getValue("type")) { + case "wide": pushStringArrayEntry(qName, attributes, "AmPmMarkers/" + getContainerKey(), 2); - } else { + break; + case "narrow": + pushStringArrayEntry(qName, attributes, "narrow.AmPmMarkers/" + getContainerKey(), 2); + break; + default: pushIgnoredContainer(qName); + break; } break; case "dayPeriod": // for FormatData // add to string array entry of AmPmMarkers element - switch (attributes.getValue("type")) { - case "am": - pushStringArrayElement(qName, attributes, 0); - break; - case "pm": - pushStringArrayElement(qName, attributes, 1); - break; - default: + if (attributes.getValue("alt") == null) { + switch (attributes.getValue("type")) { + case "am": + pushStringArrayElement(qName, attributes, 0); + break; + case "pm": + pushStringArrayElement(qName, attributes, 1); + break; + default: + pushIgnoredContainer(qName); + break; + } + } else { + // discard alt values pushIgnoredContainer(qName); - break; } break; case "eraNames": @@ -269,7 +286,7 @@ class LDMLParseHandler extends AbstractLDMLHandler { assert currentContainer instanceof IgnoredContainer; pushIgnoredContainer(qName); } else { - String key = currentCalendarType.keyElementName() + "short.Eras"; + String key = currentCalendarType.keyElementName() + "narrow.Eras"; pushStringArrayEntry(qName, attributes, key, currentCalendarType.getEraLength(qName)); } break; @@ -301,15 +318,15 @@ class LDMLParseHandler extends AbstractLDMLHandler { break; case "zone": { - String zone = attributes.getValue("type"); + String tzid = attributes.getValue("type"); // Olson tz id zonePrefix = CLDRConverter.TIMEZONE_ID_PREFIX; - put(zonePrefix + zone, new HashMap()); - pushKeyContainer(qName, attributes, zone); + put(zonePrefix + tzid, new HashMap()); + pushKeyContainer(qName, attributes, tzid); } break; case "metazone": { - String zone = attributes.getValue("type"); + String zone = attributes.getValue("type"); // LDML meta zone id zonePrefix = CLDRConverter.METAZONE_ID_PREFIX; put(zonePrefix + zone, new HashMap()); pushKeyContainer(qName, attributes, zone); @@ -323,16 +340,12 @@ class LDMLParseHandler extends AbstractLDMLHandler { zoneNameStyle = "short"; pushContainer(qName, attributes); break; - case "generic": // not used in JDK - pushIgnoredContainer(qName); + case "generic": // generic name + case "standard": // standard time name + case "daylight": // daylight saving (summer) time name + pushStringEntry(qName, attributes, CLDRConverter.ZONE_NAME_PREFIX + qName + "." + zoneNameStyle); break; - case "standard": // standard time - pushStringEntry(qName, attributes, CLDRConverter.TIMEZONE_NAME_PREFIX + "standard." + zoneNameStyle); - break; - case "daylight": - pushStringEntry(qName, attributes, CLDRConverter.TIMEZONE_NAME_PREFIX + "daylight." + zoneNameStyle); - break; - case "exemplarCity": + case "exemplarCity": // not used in JDK pushIgnoredContainer(qName); break; @@ -530,6 +543,7 @@ class LDMLParseHandler extends AbstractLDMLHandler { case "timeZoneNames": zonePrefix = null; break; + case "generic": case "standard": case "daylight": if (zonePrefix != null && (currentContainer instanceof Entry)) { diff --git a/jdk/make/tools/src/build/tools/cldrconverter/MetaZonesParseHandler.java b/jdk/make/tools/src/build/tools/cldrconverter/MetaZonesParseHandler.java index 5c6f50b4ae9..99be8cfd882 100644 --- a/jdk/make/tools/src/build/tools/cldrconverter/MetaZonesParseHandler.java +++ b/jdk/make/tools/src/build/tools/cldrconverter/MetaZonesParseHandler.java @@ -46,8 +46,9 @@ class MetaZonesParseHandler extends AbstractLDMLHandler { return null; } + // metaZone: ID -> metazone + // per locale: ID -> names, metazone -> names @Override - @SuppressWarnings("fallthrough") public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { switch (qName) { case "timezone": diff --git a/jdk/make/tools/src/build/tools/cldrconverter/ResourceBundleGenerator.java b/jdk/make/tools/src/build/tools/cldrconverter/ResourceBundleGenerator.java index 2d031fa8ba3..c7826a2519b 100644 --- a/jdk/make/tools/src/build/tools/cldrconverter/ResourceBundleGenerator.java +++ b/jdk/make/tools/src/build/tools/cldrconverter/ResourceBundleGenerator.java @@ -28,14 +28,16 @@ package build.tools.cldrconverter; import java.io.File; import java.io.IOException; import java.io.PrintWriter; +import java.util.Formatter; +import java.util.HashSet; import java.util.Map; +import java.util.Set; import java.util.SortedSet; class ResourceBundleGenerator implements BundleGenerator { - @Override public void generateBundle(String packageName, String baseName, String localeID, boolean useJava, - Map map, boolean open) throws IOException { + Map map, BundleType type) throws IOException { String suffix = useJava ? ".java" : ".properties"; String lang = CLDRConverter.getLanguageCode(localeID); String dirName = CLDRConverter.DESTINATION_DIR + File.separator + "sun" + File.separator @@ -67,6 +69,28 @@ class ResourceBundleGenerator implements BundleGenerator { encoding = "iso-8859-1"; } + Formatter fmt = null; + if (type == BundleType.TIMEZONE) { + fmt = new Formatter(); + Set metaKeys = new HashSet<>(); + for (String key : map.keySet()) { + if (key.startsWith(CLDRConverter.METAZONE_ID_PREFIX)) { + String meta = key.substring(CLDRConverter.METAZONE_ID_PREFIX.length()); + String[] value; + value = (String[]) map.get(key); + fmt.format(" final String[] %s = new String[] {\n", meta); + for (String s : value) { + fmt.format(" \"%s\",\n", CLDRConverter.saveConvert(s, useJava)); + } + fmt.format(" };\n"); + metaKeys.add(key); + } + } + for (String key : metaKeys) { + map.remove(key); + } + } + try (PrintWriter out = new PrintWriter(file, encoding)) { // Output copyright headers out.println(CopyrightHeaders.getOpenJDKCopyright()); @@ -74,16 +98,15 @@ class ResourceBundleGenerator implements BundleGenerator { if (useJava) { out.println("package sun." + packageName + ";\n"); - if (open) { - out.println("import sun.util.resources.OpenListResourceBundle;\n"); - out.println("public class " + baseName + ("root".equals(localeID) ? "" : "_" + localeID) + " extends OpenListResourceBundle {"); - } else { - out.println("import java.util.ListResourceBundle;\n"); - out.println("public class " + baseName + ("root".equals(localeID) ? "" : "_" + localeID) + " extends ListResourceBundle {"); - } + out.printf("import %s;\n\n", type.getPathName()); + out.printf("public class %s%s extends %s {\n", baseName, "root".equals(localeID) ? "" : "_" + localeID, type.getClassName()); + out.println(" @Override\n" + - " protected final Object[][] getContents() {\n" + - " final Object[][] data = new Object[][] {"); + " protected final Object[][] getContents() {"); + if (fmt != null) { + out.print(fmt.toString()); + } + out.println(" final Object[][] data = new Object[][] {"); } for (String key : map.keySet()) { if (useJava) { @@ -91,7 +114,11 @@ class ResourceBundleGenerator implements BundleGenerator { if (value == null) { CLDRConverter.warning("null value for " + key); } else if (value instanceof String) { - out.println(" { \"" + key + "\", \"" + CLDRConverter.saveConvert((String) value, useJava) + "\" },"); + if (type == BundleType.TIMEZONE) { + out.printf(" { \"%s\", %s },\n", key, CLDRConverter.saveConvert((String) value, useJava)); + } else { + out.printf(" { \"%s\", \"%s\" },\n", key, CLDRConverter.saveConvert((String) value, useJava)); + } } else if (value instanceof String[]) { String[] values = (String[]) value; out.println(" { \"" + key + "\",\n new String[] {"); diff --git a/jdk/makefiles/CompileNativeLibraries.gmk b/jdk/makefiles/CompileNativeLibraries.gmk index 1dd28f615c7..cb2aae5a8f0 100644 --- a/jdk/makefiles/CompileNativeLibraries.gmk +++ b/jdk/makefiles/CompileNativeLibraries.gmk @@ -90,14 +90,11 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBFDLIBM,\ ARFLAGS:=$(ARFLAGS),\ OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libfdlibm)) -BUILD_LIBRARIES += $(BUILD_LIBFDLIBM) - else -# -# On macosx they do partial (incremental) linking of fdlibm -# code it here...rather than add support to NativeCompilation -# as this is firt time I see it -$(eval $(call SetupNativeCompilation,BUILD_LIBFDLIBM,\ + +# On macosx the old build does partial (incremental) linking of fdlibm instead of +# a plain static library. +$(eval $(call SetupNativeCompilation,BUILD_LIBFDLIBM_MAC,\ LIBRARY:=fdlibm,\ OUTPUT_DIR:=$(JDK_OUTPUTDIR)/objs/libfdlibm,\ SRC:=$(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/src,\ @@ -107,11 +104,12 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBFDLIBM,\ LDFLAGS:=-nostdlib -r -arch x86_64,\ OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libfdlibm)) -$(JDK_OUTPUTDIR)/objs/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX) : $(BUILD_LIBFDLIBM) +BUILD_LIBFDLIBM := $(JDK_OUTPUTDIR)/objs/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX) +$(BUILD_LIBFDLIBM) : $(BUILD_LIBFDLIBM_MAC) $(CP) -a $< $@ -BUILD_LIBRARIES += $(JDK_OUTPUTDIR)/objs/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX) endif +BUILD_LIBRARIES += $(BUILD_LIBFDLIBM) ########################################################################################## @@ -2540,6 +2538,7 @@ BUILD_LIBRARIES += $(BUILD_LIBJ2PCSC) ########################################################################################## ifneq ($(OPENJDK_TARGET_OS), windows) +ifneq ($(OPENJDK_TARGET_OS), macosx) $(eval $(call SetupNativeCompilation,BUILD_LIBJ2GSS,\ LIBRARY:=j2gss,\ OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\ @@ -2559,6 +2558,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJ2GSS,\ BUILD_LIBRARIES += $(BUILD_LIBJ2GSS) endif +endif ########################################################################################## diff --git a/jdk/makefiles/CopyFiles.gmk b/jdk/makefiles/CopyFiles.gmk index e0c8d620f2d..be24ab22819 100644 --- a/jdk/makefiles/CopyFiles.gmk +++ b/jdk/makefiles/CopyFiles.gmk @@ -356,21 +356,9 @@ COPY_FILES += $(JVMCFG) ########################################################################################## -PROPS_SRC := $(JDK_TOPDIR)/src/share/lib/security/java.security +PROPS_SRC := $(JDK_TOPDIR)/src/share/lib/security/java.security-$(OPENJDK_TARGET_OS) PROPS_DST := $(JDK_OUTPUTDIR)/lib/security/java.security -ifeq ($(OPENJDK_TARGET_OS), solaris) - PROPS_SRC := $(JDK_TOPDIR)/src/share/lib/security/java.security-solaris -endif - -ifeq ($(OPENJDK_TARGET_OS), windows) - PROPS_SRC := $(JDK_TOPDIR)/src/share/lib/security/java.security-windows -endif - -ifeq ($(OPENJDK_TARGET_OS), macosx) - PROPS_SRC := $(JDK_TOPDIR)/src/share/lib/security/java.security-macosx -endif - $(PROPS_DST): $(PROPS_SRC) $(MKDIR) -p $(@D) $(RM) $@ diff --git a/jdk/makefiles/CreateJars.gmk b/jdk/makefiles/CreateJars.gmk index cd5ec1fd258..b22c8a656ae 100644 --- a/jdk/makefiles/CreateJars.gmk +++ b/jdk/makefiles/CreateJars.gmk @@ -729,6 +729,7 @@ TOOLS_JAR_INCLUDES := \ com/sun/source \ com/sun/tools/classfile \ com/sun/tools/doclets \ + com/sun/tools/doclint \ com/sun/tools/example/debug/expr \ com/sun/tools/example/debug/tty \ com/sun/tools/extcheck \ @@ -810,9 +811,8 @@ EXPORTED_PRIVATE_PKGS = com.sun.servicetag \ $(IMAGES_OUTPUTDIR)/symbols/_the.symbols: $(IMAGES_OUTPUTDIR)/lib/rt.jar $(RM) -r $(IMAGES_OUTPUTDIR)/symbols/META-INF/sym $(MKDIR) -p $(IMAGES_OUTPUTDIR)/symbols/META-INF/sym - $(JAVA) \ - -Xbootclasspath/a:$(JDK_OUTPUTDIR)/classes \ - $(JAVAC_JARS) \ + $(JAVA) $(JAVAC_JARS) \ + -bootclasspath $(JDK_OUTPUTDIR)/classes \ -XDprocess.packages -proc:only \ -processor com.sun.tools.javac.sym.CreateSymbols \ -Acom.sun.tools.javac.sym.Jar=$(IMAGES_OUTPUTDIR)/lib/rt.jar \ diff --git a/jdk/src/macosx/classes/sun/lwawt/LWToolkit.java b/jdk/src/macosx/classes/sun/lwawt/LWToolkit.java index cba6cec9c9f..57a8642b6d0 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWToolkit.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWToolkit.java @@ -210,9 +210,9 @@ public abstract class LWToolkit extends SunToolkit implements Runnable { * and DialogPeer interfaces. */ private LWWindowPeer createDelegatedPeer(Window target, PlatformComponent platformComponent, - PlatformWindow platformWindow) + PlatformWindow platformWindow, LWWindowPeer.PeerType peerType) { - LWWindowPeer peer = new LWWindowPeer(target, platformComponent, platformWindow); + LWWindowPeer peer = new LWWindowPeer(target, platformComponent, platformWindow, peerType); targetCreatedPeer(target, peer); peer.initialize(); return peer; @@ -222,22 +222,29 @@ public abstract class LWToolkit extends SunToolkit implements Runnable { public WindowPeer createWindow(Window target) { PlatformComponent platformComponent = createPlatformComponent(); PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.SIMPLEWINDOW); - return createDelegatedPeer(target, platformComponent, platformWindow); + return createDelegatedPeer(target, platformComponent, platformWindow, LWWindowPeer.PeerType.SIMPLEWINDOW); } @Override public FramePeer createFrame(Frame target) { PlatformComponent platformComponent = createPlatformComponent(); PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.FRAME); - return createDelegatedPeer(target, platformComponent, platformWindow); + return createDelegatedPeer(target, platformComponent, platformWindow, LWWindowPeer.PeerType.FRAME); } public LWWindowPeer createEmbeddedFrame(CEmbeddedFrame target) { PlatformComponent platformComponent = createPlatformComponent(); - PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.EMBEDDEDFRAME); - return createDelegatedPeer(target, platformComponent, platformWindow); + PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.EMBEDDED_FRAME); + return createDelegatedPeer(target, platformComponent, platformWindow, LWWindowPeer.PeerType.EMBEDDED_FRAME); } + public LWWindowPeer createEmbeddedFrame(CViewEmbeddedFrame target) { + PlatformComponent platformComponent = createPlatformComponent(); + PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.VIEW_EMBEDDED_FRAME); + return createDelegatedPeer(target, platformComponent, platformWindow, LWWindowPeer.PeerType.VIEW_EMBEDDED_FRAME); + } + + CPrinterDialogPeer createCPrinterDialog(CPrinterDialog target) { PlatformComponent platformComponent = createPlatformComponent(); PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.DIALOG); @@ -254,7 +261,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable { PlatformComponent platformComponent = createPlatformComponent(); PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.DIALOG); - return createDelegatedPeer(target, platformComponent, platformWindow); + return createDelegatedPeer(target, platformComponent, platformWindow, LWWindowPeer.PeerType.DIALOG); } @Override diff --git a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java index 02dcaaf0285..9d583e65749 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java @@ -47,7 +47,8 @@ public class LWWindowPeer SIMPLEWINDOW, FRAME, DIALOG, - EMBEDDEDFRAME + EMBEDDED_FRAME, + VIEW_EMBEDDED_FRAME } private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.lwawt.focus.LWWindowPeer"); @@ -108,6 +109,8 @@ public class LWWindowPeer private volatile boolean textured; + private final PeerType peerType; + /** * Current modal blocker or null. * @@ -116,10 +119,11 @@ public class LWWindowPeer private LWWindowPeer blocker; public LWWindowPeer(Window target, PlatformComponent platformComponent, - PlatformWindow platformWindow) + PlatformWindow platformWindow, PeerType peerType) { super(target, platformComponent); this.platformWindow = platformWindow; + this.peerType = peerType; Window owner = target.getOwner(); LWWindowPeer ownerPeer = (owner != null) ? (LWWindowPeer)owner.getPeer() : null; @@ -275,6 +279,11 @@ public class LWWindowPeer @Override public void setBounds(int x, int y, int w, int h, int op) { + + if((op & NO_EMBEDDED_CHECK) == 0 && getPeerType() == PeerType.VIEW_EMBEDDED_FRAME) { + return; + } + if ((op & SET_CLIENT_SIZE) != 0) { // SET_CLIENT_SIZE is only applicable to window peers, so handle it here // instead of pulling 'insets' field up to LWComponentPeer @@ -1210,6 +1219,10 @@ public class LWWindowPeer return this == grabbingWindow; } + public PeerType getPeerType() { + return peerType; + } + @Override public String toString() { return super.toString() + " [target is " + getTarget() + "]"; diff --git a/jdk/src/macosx/classes/sun/lwawt/PlatformWindow.java b/jdk/src/macosx/classes/sun/lwawt/PlatformWindow.java index 8b8e54de1b2..0527281814a 100644 --- a/jdk/src/macosx/classes/sun/lwawt/PlatformWindow.java +++ b/jdk/src/macosx/classes/sun/lwawt/PlatformWindow.java @@ -151,4 +151,6 @@ public interface PlatformWindow { public long getLayerPtr(); public LWWindowPeer getPeer(); + + public boolean isUnderMouse(); } diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java index 823beaedc4a..8fa95a7b01e 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java @@ -119,7 +119,9 @@ public class CEmbeddedFrame extends EmbeddedFrame { public void handleWindowFocusEvent(boolean parentWindowActive) { this.parentWindowActive = parentWindowActive; - if (focused) { + // ignore focus "lost" native request as it may mistakenly + // deactivate active window (see 8001161) + if (focused && parentWindowActive) { responder.handleWindowFocusEvent(parentWindowActive, null); } } diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CMouseInfoPeer.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CMouseInfoPeer.java index 8651aa3ac36..8ee580108dc 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CMouseInfoPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CMouseInfoPeer.java @@ -26,7 +26,6 @@ package sun.lwawt.macosx; import java.awt.Window; - import sun.lwawt.LWMouseInfoPeer; import sun.lwawt.LWWindowPeer; @@ -41,10 +40,6 @@ public class CMouseInfoPeer extends LWMouseInfoPeer return false; } - LWWindowPeer peer = (LWWindowPeer)w.getPeer(); - CPlatformWindow platformWindow = (CPlatformWindow)peer.getPlatformWindow(); - return nativeIsWindowUnderMouse(platformWindow.getNSWindowPtr()); + return ((LWWindowPeer)w.getPeer()).getPlatformWindow().isUnderMouse(); } - - private static native boolean nativeIsWindowUnderMouse(long ptr); } diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java index 6a26b50ae81..e06cc6f49aa 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java @@ -25,16 +25,13 @@ package sun.lwawt.macosx; -import sun.lwawt.PlatformWindow; -import sun.lwawt.LWWindowPeer; - -import sun.java2d.opengl.CGLLayer; -import sun.java2d.SurfaceData; - -import sun.awt.CausedFocusEvent; - import java.awt.*; - +import sun.awt.CausedFocusEvent; +import sun.java2d.SurfaceData; +import sun.java2d.opengl.CGLLayer; +import sun.lwawt.LWWindowPeer; +import sun.lwawt.LWWindowPeer.PeerType; +import sun.lwawt.PlatformWindow; import sun.util.logging.PlatformLogger; /* @@ -134,6 +131,7 @@ public class CPlatformEmbeddedFrame implements PlatformWindow { // This method should be properly implemented for applets. // It returns null just as a stub. + @Override public PlatformWindow getTopmostPlatformWindowUnderMouse() { return null; } @Override @@ -192,4 +190,13 @@ public class CPlatformEmbeddedFrame implements PlatformWindow { @Override public void setModalBlocked(boolean blocked) {} + + /* + * The method could not be implemented due to CALayer restrictions. + * The exeption enforce clients not to use it. + */ + @Override + public boolean isUnderMouse() { + throw new RuntimeException("Not implemented"); + } } diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java index a7cdfd37d43..4972301e780 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java @@ -26,8 +26,11 @@ package sun.lwawt.macosx; import java.awt.*; +import java.awt.geom.Rectangle2D; +import java.awt.image.VolatileImage; import sun.awt.CGraphicsConfig; +import sun.awt.CGraphicsEnvironment; import sun.lwawt.LWWindowPeer; import sun.lwawt.macosx.event.NSEvent; @@ -37,6 +40,10 @@ import sun.java2d.opengl.CGLSurfaceData; public class CPlatformView extends CFRetainedResource { private native long nativeCreateView(int x, int y, int width, int height, long windowLayerPtr); + private static native void nativeSetAutoResizable(long awtView, boolean toResize); + private static native int nativeGetNSViewDisplayID(long awtView); + private static native Rectangle2D nativeGetLocationOnScreen(long awtView); + private static native boolean nativeIsViewUnderMouse(long ptr); private LWWindowPeer peer; private SurfaceData surfaceData; @@ -59,7 +66,7 @@ public class CPlatformView extends CFRetainedResource { public long getAWTView() { return ptr; - } + } public boolean isOpaque() { return !peer.isTranslucent(); @@ -158,10 +165,46 @@ public class CPlatformView extends CFRetainedResource { } } + public void setAutoResizable(boolean toResize) { + nativeSetAutoResizable(this.getAWTView(), toResize); + } + + public boolean isUnderMouse() { + return nativeIsViewUnderMouse(getAWTView()); + } + + public GraphicsDevice getGraphicsDevice() { + GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); + CGraphicsEnvironment cge = (CGraphicsEnvironment)ge; + int displayID = nativeGetNSViewDisplayID(getAWTView()); + GraphicsDevice gd = cge.getScreenDevice(displayID); + if (gd == null) { + // this could possibly happen during device removal + // use the default screen device in this case + gd = ge.getDefaultScreenDevice(); + } + return gd; + } + + public Point getLocationOnScreen() { + Rectangle r = nativeGetLocationOnScreen(this.getAWTView()).getBounds(); + return new Point(r.x, r.y); + } + // ---------------------------------------------------------------------- // NATIVE CALLBACKS // ---------------------------------------------------------------------- + /* + * The callback is called only in the embedded case when the view is + * automatically resized by the superview. + * In normal mode this method is never called. + */ + private void deliverResize(int x, int y, int w, int h) { + peer.notifyReshape(x, y, w, h); + } + + private void deliverMouseEvent(NSEvent event) { int x = event.getX(); int y = getBounds().height - event.getY(); diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java index e6ab69635ec..b489eae96b6 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java @@ -64,8 +64,6 @@ public final class CPlatformWindow extends CFRetainedResource implements Platfor private static native void nativeDispose(long nsWindowPtr); private static native CPlatformWindow nativeGetTopmostPlatformWindowUnderMouse(); - private static native int nativeGetNSWindowDisplayID(long nsWindowPtr); - // Loger to report issues happened during execution but that do not affect functionality private static final PlatformLogger logger = PlatformLogger.getLogger("sun.lwawt.macosx.CPlatformWindow"); private static final PlatformLogger focusLogger = PlatformLogger.getLogger("sun.lwawt.macosx.focus.CPlatformWindow"); @@ -211,9 +209,8 @@ public final class CPlatformWindow extends CFRetainedResource implements Platfor private CPlatformResponder responder; private volatile boolean zoomed = false; // from native perspective - public CPlatformWindow(final PeerType peerType) { + public CPlatformWindow() { super(0, true); - assert (peerType == PeerType.SIMPLEWINDOW || peerType == PeerType.DIALOG || peerType == PeerType.FRAME); } /* @@ -429,16 +426,7 @@ public final class CPlatformWindow extends CFRetainedResource implements Platfor @Override public GraphicsDevice getGraphicsDevice() { - GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); - CGraphicsEnvironment cge = (CGraphicsEnvironment)ge; - int displayID = nativeGetNSWindowDisplayID(getNSWindowPtr()); - GraphicsDevice gd = cge.getScreenDevice(displayID); - if (gd == null) { - // this could possibly happen during device removal - // use the default screen device in this case - gd = ge.getDefaultScreenDevice(); - } - return gd; + return contentView.getGraphicsDevice(); } @Override // PlatformWindow @@ -833,6 +821,11 @@ public final class CPlatformWindow extends CFRetainedResource implements Platfor return peer; } + @Override + public boolean isUnderMouse() { + return contentView.isUnderMouse(); + } + public CPlatformView getContentView() { return contentView; } diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterDialogPeer.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterDialogPeer.java index f50f2869d9e..1ca65e7faae 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterDialogPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterDialogPeer.java @@ -41,7 +41,7 @@ public class CPrinterDialogPeer extends LWWindowPeer { public CPrinterDialogPeer(CPrinterDialog target, PlatformComponent platformComponent, PlatformWindow platformWindow) { - super(target, platformComponent, platformWindow); + super(target, platformComponent, platformWindow, LWWindowPeer.PeerType.DIALOG); //super(target); fTarget = target; super.initialize(); diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CViewEmbeddedFrame.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CViewEmbeddedFrame.java new file mode 100644 index 00000000000..306cfb1e12e --- /dev/null +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CViewEmbeddedFrame.java @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package sun.lwawt.macosx; + +import java.awt.AWTKeyStroke; +import java.awt.Toolkit; +import java.lang.reflect.InvocationTargetException; +import sun.awt.EmbeddedFrame; +import sun.lwawt.LWToolkit; +import sun.lwawt.LWWindowPeer; +/* + * The CViewEmbeddedFrame class is used in the SWT_AWT bridge. + * This is a part of public API and should not be renamed or moved + */ +public class CViewEmbeddedFrame extends EmbeddedFrame { + + private final long nsViewPtr; + + private boolean isActive = false; + + public CViewEmbeddedFrame(long nsViewPtr) { + this.nsViewPtr = nsViewPtr; + } + + @SuppressWarnings("deprecation") + @Override + public void addNotify() { + if (getPeer() == null) { + LWToolkit toolkit = (LWToolkit) Toolkit.getDefaultToolkit(); + setPeer(toolkit.createEmbeddedFrame(this)); + } + super.addNotify(); + } + + public long getEmbedderHandle() { + return nsViewPtr; + } + + @Override + public void registerAccelerator(AWTKeyStroke awtks) { + } + + @Override + public void unregisterAccelerator(AWTKeyStroke awtks) { + } + + public boolean isParentWindowActive() { + return isActive; + } + + /* + * Synthetic event delivery for focus management + */ + @Override + public void synthesizeWindowActivation(boolean activated) { + if (isActive != activated) { + isActive = activated; + ((LWWindowPeer)getPeer()).notifyActivation(activated, null); + } + } + + /* + * Initializes the embedded frame bounds and validates a component. + * Designed to be called from the main thread + * This method should be called once from the initialization of the SWT_AWT Bridge + */ + @SuppressWarnings("deprecation") + public void validateWithBounds(final int x, final int y, final int width, final int height) { + try { + LWCToolkit.invokeAndWait(new Runnable() { + @Override + public void run() { + ((LWWindowPeer) getPeer()).setBoundsPrivate(0, 0, width, height); + validate(); + setVisible(true); + } + }, null); + } catch (InterruptedException | InvocationTargetException ex) {} + } +} diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CViewPlatformEmbeddedFrame.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CViewPlatformEmbeddedFrame.java new file mode 100644 index 00000000000..adc3c034b74 --- /dev/null +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CViewPlatformEmbeddedFrame.java @@ -0,0 +1,211 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.lwawt.macosx; + +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.GraphicsDevice; +import java.awt.Insets; +import java.awt.MenuBar; +import java.awt.Point; +import java.awt.Window; +import sun.awt.CausedFocusEvent.Cause; +import sun.java2d.SurfaceData; +import sun.lwawt.LWWindowPeer; +import sun.lwawt.PlatformWindow; + +public class CViewPlatformEmbeddedFrame implements PlatformWindow { + + private CPlatformView view; + private LWWindowPeer peer; + private CViewEmbeddedFrame target; + private CPlatformResponder responder; + + @Override // PlatformWindow + public void initialize(Window target, final LWWindowPeer peer, PlatformWindow owner) { + this.peer = peer; + this.target = (CViewEmbeddedFrame) target; + responder = new CPlatformResponder(peer, false); + + view = new CPlatformView(); + view.initialize(peer, responder); + + CWrapper.NSView.addSubview(this.target.getEmbedderHandle(), view.getAWTView()); + view.setAutoResizable(true); + } + + public long getNSViewPtr() { + return view.getAWTView(); + } + + @Override + public long getLayerPtr() { + return view.getWindowLayerPtr(); + } + + @Override + public LWWindowPeer getPeer() { + return peer; + } + + @Override + public void dispose() { + CWrapper.NSView.removeFromSuperview(view.getAWTView()); + view.dispose(); + } + + @Override + public void setVisible(boolean visible) { + CWrapper.NSView.setHidden(view.getAWTView(), !visible); + } + + @Override + public void setTitle(String title) { + } + + @Override + public void setBounds(int x, int y, int w, int h) { + view.setBounds(x, y, w, h); + peer.notifyReshape(x, y, w, h); + } + + @Override + public GraphicsDevice getGraphicsDevice() { + return view.getGraphicsDevice(); + } + + @Override + public Point getLocationOnScreen() { + return view.getLocationOnScreen(); + } + + @Override + public Insets getInsets() { + return new Insets(0, 0, 0, 0); + } + + @Override + public FontMetrics getFontMetrics(Font f) { + throw new RuntimeException("Not implemented"); + } + + @Override + public SurfaceData getScreenSurface() { + return view.getSurfaceData(); + } + + @Override + public SurfaceData replaceSurfaceData() { + return view.replaceSurfaceData(); + } + + @Override + public void setModalBlocked(boolean blocked) { + } + + @Override + public void toFront() { + } + + @Override + public void toBack() { + } + + @Override + public void setMenuBar(MenuBar mb) { + } + + @Override + public void setAlwaysOnTop(boolean value) { + } + + @Override + public PlatformWindow getTopmostPlatformWindowUnderMouse() { + return null; + } + + @Override + public void updateFocusableWindowState() { + } + + @Override + public boolean rejectFocusRequest(Cause cause) { + return false; + } + + @Override + public boolean requestWindowFocus() { + return true; + } + + @Override + public boolean isActive() { + return target.isParentWindowActive(); + } + + @Override + public void setResizable(boolean resizable) { + } + + @Override + public void setSizeConstraints(int minW, int minH, int maxW, int maxH) { + } + + @Override + public Graphics transformGraphics(Graphics g) { + return g; + } + + @Override + public void updateIconImages() { + } + + @Override + public void setOpacity(float opacity) { + } + + @Override + public void setOpaque(boolean isOpaque) { + } + + @Override + public void enterFullScreenMode() { + } + + @Override + public void exitFullScreenMode() { + } + + @Override + public void setWindowState(int windowState) { + } + + @Override + public boolean isUnderMouse() { + return view.isUnderMouse(); + } +} diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CWrapper.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CWrapper.java index 385259e352e..52aa16ce829 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CWrapper.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CWrapper.java @@ -85,6 +85,8 @@ public final class CWrapper { public static native void enterFullScreenMode(long view); public static native void exitFullScreenMode(long view); + + public static native void setHidden(long view, boolean hidden); } public static final class NSObject { diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java b/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java index 29e4f7b0c2e..ae6a4f77662 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java @@ -156,10 +156,13 @@ public final class LWCToolkit extends LWToolkit { @Override protected PlatformWindow createPlatformWindow(PeerType peerType) { - if (peerType == PeerType.EMBEDDEDFRAME) { + if (peerType == PeerType.EMBEDDED_FRAME) { return new CPlatformEmbeddedFrame(); + } else if (peerType == PeerType.VIEW_EMBEDDED_FRAME) { + return new CViewPlatformEmbeddedFrame(); } else { - return new CPlatformWindow(peerType); + assert (peerType == PeerType.SIMPLEWINDOW || peerType == PeerType.DIALOG || peerType == PeerType.FRAME); + return new CPlatformWindow(); } } diff --git a/jdk/src/macosx/native/sun/awt/AWTSurfaceLayers.m b/jdk/src/macosx/native/sun/awt/AWTSurfaceLayers.m index 74b0855ffa2..c6fec1fc392 100644 --- a/jdk/src/macosx/native/sun/awt/AWTSurfaceLayers.m +++ b/jdk/src/macosx/native/sun/awt/AWTSurfaceLayers.m @@ -99,17 +99,16 @@ Java_sun_lwawt_macosx_CPlatformComponent_nativeCreateComponent __block AWTSurfaceLayers *surfaceLayers = nil; JNF_COCOA_ENTER(env); -AWT_ASSERT_NOT_APPKIT_THREAD; - [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){ - AWT_ASSERT_APPKIT_THREAD; - - CALayer *windowLayer = jlong_to_ptr(windowLayerPtr); - surfaceLayers = [[AWTSurfaceLayers alloc] initWithWindowLayer: windowLayer]; - CFRetain(surfaceLayers); - [surfaceLayers release]; + [ThreadUtilities performOnMainThreadWaiting:YES block:^(){ + AWT_ASSERT_APPKIT_THREAD; + + CALayer *windowLayer = jlong_to_ptr(windowLayerPtr); + surfaceLayers = [[AWTSurfaceLayers alloc] initWithWindowLayer: windowLayer]; + CFRetain(surfaceLayers); + [surfaceLayers release]; }]; - + JNF_COCOA_EXIT(env); return ptr_to_jlong(surfaceLayers); @@ -126,12 +125,13 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformComponent_nativeSetBounds JNF_COCOA_ENTER(env); AWTSurfaceLayers *surfaceLayers = OBJC(surfaceLayersPtr); - [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){ + + [ThreadUtilities performOnMainThreadWaiting:NO block:^(){ AWT_ASSERT_APPKIT_THREAD; CGRect rect = CGRectMake(x, y, width, height); [surfaceLayers setBounds: rect]; - }]; + }]; JNF_COCOA_EXIT(env); } diff --git a/jdk/src/macosx/native/sun/awt/AWTView.m b/jdk/src/macosx/native/sun/awt/AWTView.m index 0f896a44300..3770287a32a 100644 --- a/jdk/src/macosx/native/sun/awt/AWTView.m +++ b/jdk/src/macosx/native/sun/awt/AWTView.m @@ -83,6 +83,7 @@ AWT_ASSERT_APPKIT_THREAD; mouseIsOver = NO; [self resetTrackingArea]; + [self setAutoresizesSubviews:NO]; if (windowLayer != nil) { self.cglLayer = windowLayer; @@ -174,6 +175,11 @@ AWT_ASSERT_APPKIT_THREAD; * Automatically triggered functions. */ +- (void)resizeWithOldSuperviewSize:(NSSize)oldBoundsSize { + [super resizeWithOldSuperviewSize: oldBoundsSize]; + [self deliverResize: [self frame]]; +} + /* * MouseEvents support */ @@ -437,6 +443,18 @@ AWT_ASSERT_APPKIT_THREAD; } } +-(void) deliverResize: (NSRect) rect { + jint x = (jint) rect.origin.x; + jint y = (jint) rect.origin.y; + jint w = (jint) rect.size.width; + jint h = (jint) rect.size.height; + JNIEnv *env = [ThreadUtilities getJNIEnv]; + static JNF_CLASS_CACHE(jc_PlatformView, "sun/lwawt/macosx/CPlatformView"); + static JNF_MEMBER_CACHE(jm_deliverResize, jc_PlatformView, "deliverResize", "(IIII)V"); + JNFCallVoidMethod(env, m_cPlatformView, jm_deliverResize, x,y,w,h); +} + + - (void) drawRect:(NSRect)dirtyRect { AWT_ASSERT_APPKIT_THREAD; @@ -1220,21 +1238,19 @@ Java_sun_lwawt_macosx_CPlatformView_nativeCreateView __block AWTView *newView = nil; JNF_COCOA_ENTER(env); -AWT_ASSERT_NOT_APPKIT_THREAD; NSRect rect = NSMakeRect(originX, originY, width, height); jobject cPlatformView = (*env)->NewGlobalRef(env, obj); - [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){ + [ThreadUtilities performOnMainThreadWaiting:YES block:^(){ AWT_ASSERT_APPKIT_THREAD; - + CALayer *windowLayer = jlong_to_ptr(windowLayerPtr); AWTView *view = [[AWTView alloc] initWithRect:rect platformView:cPlatformView windowLayer:windowLayer]; CFRetain(view); [view release]; // GC - newView = view; }]; @@ -1242,3 +1258,125 @@ JNF_COCOA_EXIT(env); return ptr_to_jlong(newView); } + +/* + * Class: sun_lwawt_macosx_CPlatformView + * Method: nativeSetAutoResizable + * Signature: (JZ)V; + */ + +JNIEXPORT void JNICALL +Java_sun_lwawt_macosx_CPlatformView_nativeSetAutoResizable +(JNIEnv *env, jclass cls, jlong viewPtr, jboolean toResize) +{ +JNF_COCOA_ENTER(env); + + NSView *view = (NSView *)jlong_to_ptr(viewPtr); + + [ThreadUtilities performOnMainThreadWaiting:NO block:^(){ + AWT_ASSERT_APPKIT_THREAD; + + if (toResize) { + [view setAutoresizingMask: NSViewHeightSizable | NSViewWidthSizable]; + } else { + [view setAutoresizingMask: NSViewMinYMargin | NSViewMaxXMargin]; + } + + if ([view superview] != nil) { + [[view superview] setAutoresizesSubviews:(BOOL)toResize]; + } + + }]; +JNF_COCOA_EXIT(env); +} + +/* + * Class: sun_lwawt_macosx_CPlatformView + * Method: nativeGetNSViewDisplayID + * Signature: (J)I; + */ + +JNIEXPORT jint JNICALL +Java_sun_lwawt_macosx_CPlatformView_nativeGetNSViewDisplayID +(JNIEnv *env, jclass cls, jlong viewPtr) +{ + __block jint ret; //CGDirectDisplayID + +JNF_COCOA_ENTER(env); + + NSView *view = (NSView *)jlong_to_ptr(viewPtr); + NSWindow *window = [view window]; + + [ThreadUtilities performOnMainThreadWaiting:YES block:^(){ + AWT_ASSERT_APPKIT_THREAD; + + ret = (jint)[[AWTWindow getNSWindowDisplayID_AppKitThread: window] intValue]; + }]; + +JNF_COCOA_EXIT(env); + + return ret; +} + +/* + * Class: sun_lwawt_macosx_CPlatformView + * Method: nativeGetLocationOnScreen + * Signature: (J)Ljava/awt/Rectangle; + */ + +JNIEXPORT jobject JNICALL +Java_sun_lwawt_macosx_CPlatformView_nativeGetLocationOnScreen +(JNIEnv *env, jclass cls, jlong viewPtr) +{ + jobject jRect = NULL; + +JNF_COCOA_ENTER(env); + + __block NSRect rect = NSZeroRect; + + NSView *view = (NSView *)jlong_to_ptr(viewPtr); + [ThreadUtilities performOnMainThreadWaiting:YES block:^(){ + AWT_ASSERT_APPKIT_THREAD; + + NSRect viewBounds = [view bounds]; + NSRect frameInWindow = [view convertRect:viewBounds toView:nil]; + rect = [[view window] convertRectToScreen:frameInWindow]; + NSRect screenRect = [[NSScreen mainScreen] frame]; + //Convert coordinates to top-left corner origin + rect.origin.y = screenRect.size.height - rect.origin.y - viewBounds.size.height; + }]; + jRect = NSToJavaRect(env, rect); + +JNF_COCOA_EXIT(env); + + return jRect; +} + +/* + * Class: sun_lwawt_macosx_CPlatformView + * Method: nativeIsViewUnderMouse + * Signature: (J)Z; + */ + +JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_CPlatformView_nativeIsViewUnderMouse +(JNIEnv *env, jclass clazz, jlong viewPtr) +{ + __block jboolean underMouse = JNI_FALSE; + +JNF_COCOA_ENTER(env); + + NSView *nsView = OBJC(viewPtr); + [ThreadUtilities performOnMainThreadWaiting:YES block:^(){ + AWT_ASSERT_APPKIT_THREAD; + + NSPoint ptWindowCoords = [[nsView window] mouseLocationOutsideOfEventStream]; + NSPoint ptViewCoords = [nsView convertPoint:ptWindowCoords fromView:nil]; + underMouse = [nsView hitTest:ptViewCoords] != nil; + }]; + +JNF_COCOA_EXIT(env); + + return underMouse; +} + + diff --git a/jdk/src/macosx/native/sun/awt/AWTWindow.m b/jdk/src/macosx/native/sun/awt/AWTWindow.m index 4b526ee81a7..fa27a3bf761 100644 --- a/jdk/src/macosx/native/sun/awt/AWTWindow.m +++ b/jdk/src/macosx/native/sun/awt/AWTWindow.m @@ -1154,34 +1154,6 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSynthesizeMou JNF_COCOA_EXIT(env); } -/* - * Class: sun_lwawt_macosx_CPlatformWindow - * Method: nativeGetDisplayID_AppKitThread - * Signature: (J)I - */ -JNIEXPORT jint JNICALL -Java_sun_lwawt_macosx_CPlatformWindow_nativeGetNSWindowDisplayID -(JNIEnv *env, jclass clazz, jlong windowPtr) -{ - __block jint ret; // CGDirectDisplayID - -JNF_COCOA_ENTER(env); - - NSWindow *window = OBJC(windowPtr); - - if ([NSThread isMainThread]) { - ret = (jint)[[AWTWindow getNSWindowDisplayID_AppKitThread: window] intValue]; - } else { - [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){ - ret = (jint)[[AWTWindow getNSWindowDisplayID_AppKitThread: window] intValue]; - }]; - } - -JNF_COCOA_EXIT(env); - - return ret; -} - /* * Class: sun_lwawt_macosx_CPlatformWindow * Method: _toggleFullScreenMode @@ -1203,27 +1175,6 @@ JNF_COCOA_ENTER(env); JNF_COCOA_EXIT(env); } -JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_CMouseInfoPeer_nativeIsWindowUnderMouse -(JNIEnv *env, jclass clazz, jlong windowPtr) -{ - __block jboolean underMouse = JNI_FALSE; - -JNF_COCOA_ENTER(env); -AWT_ASSERT_NOT_APPKIT_THREAD; - - NSWindow *nsWindow = OBJC(windowPtr); - [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^() { - AWT_ASSERT_APPKIT_THREAD; - - NSPoint pt = [nsWindow mouseLocationOutsideOfEventStream]; - underMouse = [[nsWindow contentView] hitTest:pt] != nil; - }]; - -JNF_COCOA_EXIT(env); - - return underMouse; -} - JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSetEnabled (JNIEnv *env, jclass clazz, jlong windowPtr, jboolean isEnabled) { diff --git a/jdk/src/macosx/native/sun/awt/CCursorManager.m b/jdk/src/macosx/native/sun/awt/CCursorManager.m index e7378d3929a..601ea91e782 100644 --- a/jdk/src/macosx/native/sun/awt/CCursorManager.m +++ b/jdk/src/macosx/native/sun/awt/CCursorManager.m @@ -123,14 +123,15 @@ Java_sun_lwawt_macosx_CCursorManager_nativeGetCursorPosition jobject jpt = NULL; JNF_COCOA_ENTER(env); -AWT_ASSERT_NOT_APPKIT_THREAD; __block NSPoint pt = NSZeroPoint; - [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){ - AWT_ASSERT_APPKIT_THREAD; - - pt = ConvertNSScreenPoint(env, [NSEvent mouseLocation]); + + [ThreadUtilities performOnMainThreadWaiting:YES block:^(){ + AWT_ASSERT_APPKIT_THREAD; + + pt = ConvertNSScreenPoint(env, [NSEvent mouseLocation]); }]; + jpt = NSToJavaPoint(env, pt); JNF_COCOA_EXIT(env); diff --git a/jdk/src/macosx/native/sun/awt/CWrapper.m b/jdk/src/macosx/native/sun/awt/CWrapper.m index 139ea4bef71..eb047c5bc82 100644 --- a/jdk/src/macosx/native/sun/awt/CWrapper.m +++ b/jdk/src/macosx/native/sun/awt/CWrapper.m @@ -650,6 +650,26 @@ JNF_COCOA_EXIT(env); return windowPtr; } +/* + * Class: sun_lwawt_macosx_CWrapper$NSView + * Method: setHidden + * Signature: (JZ)V + */ +JNIEXPORT jlong JNICALL +Java_sun_lwawt_macosx_CWrapper_00024NSView_setHidden +(JNIEnv *env, jclass cls, jlong viewPtr, jboolean toHide) +{ + JNF_COCOA_ENTER(env); + + NSView *view = (NSView *)jlong_to_ptr(viewPtr); + [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){ + [view setHidden:(BOOL)toHide]; + }]; + + JNF_COCOA_EXIT(env); +} + + /* * Class: sun_lwawt_macosx_CWrapper$NSScreen * Method: frame diff --git a/jdk/src/macosx/native/sun/awt/awt.m b/jdk/src/macosx/native/sun/awt/awt.m index d183d1bc026..8ca56bd117c 100644 --- a/jdk/src/macosx/native/sun/awt/awt.m +++ b/jdk/src/macosx/native/sun/awt/awt.m @@ -95,7 +95,7 @@ AWT_ASSERT_APPKIT_THREAD; CFRelease(busyObserver); CFRelease(notBusyObserver); - + if (!headless) setBusy(YES); // Set the java name of the AppKit main thread appropriately. @@ -367,7 +367,8 @@ AWT_ASSERT_APPKIT_THREAD; CFRunLoopRef runLoop = [[NSRunLoop currentRunLoop] getCFRunLoop]; CFRunLoopRemoveObserver(runLoop, busyObserver, kCFRunLoopDefaultMode); CFRunLoopRemoveObserver(runLoop, notBusyObserver, kCFRunLoopDefaultMode); - + // We don't track if the runloop is busy, so set it free to let AWT finish when it needs + setBusy(NO); busyObserver = NULL; notBusyObserver = NULL; } else { diff --git a/jdk/src/macosx/native/sun/font/CCharToGlyphMapper.m b/jdk/src/macosx/native/sun/font/CCharToGlyphMapper.m index e0ceb0173a1..77eb3b88f79 100644 --- a/jdk/src/macosx/native/sun/font/CCharToGlyphMapper.m +++ b/jdk/src/macosx/native/sun/font/CCharToGlyphMapper.m @@ -1,5 +1,5 @@ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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 diff --git a/jdk/src/macosx/native/sun/java2d/opengl/CGLLayer.m b/jdk/src/macosx/native/sun/java2d/opengl/CGLLayer.m index 76d6820a9ab..66838984aba 100644 --- a/jdk/src/macosx/native/sun/java2d/opengl/CGLLayer.m +++ b/jdk/src/macosx/native/sun/java2d/opengl/CGLLayer.m @@ -151,16 +151,15 @@ Java_sun_java2d_opengl_CGLLayer_nativeCreateLayer __block CGLLayer *layer = nil; JNF_COCOA_ENTER(env); -AWT_ASSERT_NOT_APPKIT_THREAD; JNFJObjectWrapper *javaLayer = [JNFJObjectWrapper wrapperWithJObject:obj withEnv:env]; - [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){ - AWT_ASSERT_APPKIT_THREAD; - - layer = [[CGLLayer alloc] initWithJavaLayer: javaLayer]; + [ThreadUtilities performOnMainThreadWaiting:YES block:^(){ + AWT_ASSERT_APPKIT_THREAD; + + layer = [[CGLLayer alloc] initWithJavaLayer: javaLayer]; }]; - + JNF_COCOA_EXIT(env); return ptr_to_jlong(layer); diff --git a/jdk/src/macosx/native/sun/osxapp/ThreadUtilities.h b/jdk/src/macosx/native/sun/osxapp/ThreadUtilities.h index f213a163e0c..0acde2f9aa6 100644 --- a/jdk/src/macosx/native/sun/osxapp/ThreadUtilities.h +++ b/jdk/src/macosx/native/sun/osxapp/ThreadUtilities.h @@ -139,7 +139,7 @@ __attribute__((visibility("default"))) + (JNIEnv*)getJNIEnvUncached; + (void)performOnMainThread:(SEL)aSelector onObject:(id)target withObject:(id)arg waitUntilDone:(BOOL)wait awtMode:(BOOL)inAWT; - ++ (void)performOnMainThreadWaiting:(BOOL)wait block:(void (^)())block; @end void OSXAPP_SetJavaVM(JavaVM *vm); diff --git a/jdk/src/macosx/native/sun/osxapp/ThreadUtilities.m b/jdk/src/macosx/native/sun/osxapp/ThreadUtilities.m index 788a06dccd1..0e40fc1a52b 100644 --- a/jdk/src/macosx/native/sun/osxapp/ThreadUtilities.m +++ b/jdk/src/macosx/native/sun/osxapp/ThreadUtilities.m @@ -245,6 +245,14 @@ AWT_ASSERT_APPKIT_THREAD; } } ++ (void)performOnMainThreadWaiting:(BOOL)wait block:(void (^)())block { + if ([NSThread isMainThread] && wait == YES) { + block(); + } else { + [JNFRunLoop performOnMainThreadWaiting:wait withBlock:block]; + } +} + @end diff --git a/jdk/src/share/classes/com/sun/java/util/jar/pack/PropMap.java b/jdk/src/share/classes/com/sun/java/util/jar/pack/PropMap.java index e1a385546c9..6199c77b51d 100644 --- a/jdk/src/share/classes/com/sun/java/util/jar/pack/PropMap.java +++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/PropMap.java @@ -25,8 +25,6 @@ package com.sun.java.util.jar.pack; -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeEvent; import java.io.IOException; import java.io.InputStream; import java.io.PrintStream; @@ -42,40 +40,39 @@ import java.util.Set; import java.util.SortedMap; import java.util.TreeMap; import java.util.jar.Pack200; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + /** * Control block for publishing Pack200 options to the other classes. */ final class PropMap implements SortedMap { private final TreeMap theMap = new TreeMap<>();; - private final List listenerList = new ArrayList<>(1); - void addListener(PropertyChangeListener listener) { + // type is erased, elements are of type java.beans.PropertyChangeListener + private final List listenerList = new ArrayList<>(1); + + void addListener(Object listener) { + assert Beans.isPropertyChangeListener(listener); listenerList.add(listener); } - void removeListener(PropertyChangeListener listener) { + void removeListener(Object listener) { + assert Beans.isPropertyChangeListener(listener); listenerList.remove(listener); } - void addListeners(ArrayList listeners) { - listenerList.addAll(listeners); - } - - void removeListeners(ArrayList listeners) { - listenerList.removeAll(listeners); - } - // Override: public String put(String key, String value) { String oldValue = theMap.put(key, value); if (value != oldValue && !listenerList.isEmpty()) { + assert Beans.isBeansPresent(); // Post the property change event. - PropertyChangeEvent event = - new PropertyChangeEvent(this, key, - oldValue, value); - for (PropertyChangeListener listener : listenerList) { - listener.propertyChange(event); + Object event = Beans.newPropertyChangeEvent(this, key, oldValue, value); + for (Object listener : listenerList) { + Beans.invokePropertyChange(listener, event); } } return oldValue; @@ -339,4 +336,113 @@ final class PropMap implements SortedMap { public String lastKey() { return theMap.lastKey(); } + + /** + * A class that provides access to the java.beans.PropertyChangeListener + * and java.beans.PropertyChangeEvent without creating a static dependency + * on java.beans. This class can be removed once the addPropertyChangeListener + * and removePropertyChangeListener methods are removed from Packer and + * Unpacker. + */ + private static class Beans { + private static final Class propertyChangeListenerClass = + getClass("java.beans.PropertyChangeListener"); + + private static final Class propertyChangeEventClass = + getClass("java.beans.PropertyChangeEvent"); + + private static final Method propertyChangeMethod = + getMethod(propertyChangeListenerClass, + "propertyChange", + propertyChangeEventClass); + + private static final Constructor propertyEventCtor = + getConstructor(propertyChangeEventClass, + Object.class, + String.class, + Object.class, + Object.class); + + private static Class getClass(String name) { + try { + return Class.forName(name, true, Beans.class.getClassLoader()); + } catch (ClassNotFoundException e) { + return null; + } + } + private static Constructor getConstructor(Class c, Class... types) { + try { + return (c == null) ? null : c.getDeclaredConstructor(types); + } catch (NoSuchMethodException x) { + throw new AssertionError(x); + } + } + + private static Method getMethod(Class c, String name, Class... types) { + try { + return (c == null) ? null : c.getMethod(name, types); + } catch (NoSuchMethodException e) { + throw new AssertionError(e); + } + } + + /** + * Returns {@code true} if java.beans is present. + */ + static boolean isBeansPresent() { + return propertyChangeListenerClass != null && + propertyChangeEventClass != null; + } + + /** + * Returns {@code true} if the given object is a PropertyChangeListener + */ + static boolean isPropertyChangeListener(Object obj) { + if (propertyChangeListenerClass == null) { + return false; + } else { + return propertyChangeListenerClass.isInstance(obj); + } + } + + /** + * Returns a new PropertyChangeEvent with the given source, property + * name, old and new values. + */ + static Object newPropertyChangeEvent(Object source, String prop, + Object oldValue, Object newValue) + { + try { + return propertyEventCtor.newInstance(source, prop, oldValue, newValue); + } catch (InstantiationException | IllegalAccessException x) { + throw new AssertionError(x); + } catch (InvocationTargetException x) { + Throwable cause = x.getCause(); + if (cause instanceof Error) + throw (Error)cause; + if (cause instanceof RuntimeException) + throw (RuntimeException)cause; + throw new AssertionError(x); + } + } + + /** + * Invokes the given PropertyChangeListener's propertyChange method + * with the given event. + */ + static void invokePropertyChange(Object listener, Object ev) { + try { + propertyChangeMethod.invoke(listener, ev); + } catch (IllegalAccessException x) { + throw new AssertionError(x); + } catch (InvocationTargetException x) { + Throwable cause = x.getCause(); + if (cause instanceof Error) + throw (Error)cause; + if (cause instanceof RuntimeException) + throw (RuntimeException)cause; + throw new AssertionError(x); + } + } + } } diff --git a/jdk/src/share/classes/com/sun/jmx/remote/internal/ClientCommunicatorAdmin.java b/jdk/src/share/classes/com/sun/jmx/remote/internal/ClientCommunicatorAdmin.java index 67d6d4475d0..3bb91219f4f 100644 --- a/jdk/src/share/classes/com/sun/jmx/remote/internal/ClientCommunicatorAdmin.java +++ b/jdk/src/share/classes/com/sun/jmx/remote/internal/ClientCommunicatorAdmin.java @@ -115,6 +115,7 @@ public abstract class ClientCommunicatorAdmin { // restarted is failed by another thread throw ioe; } + return; } else { state = RE_CONNECTING; lock.notifyAll(); @@ -195,7 +196,7 @@ public abstract class ClientCommunicatorAdmin { if (e instanceof IOException && !(e instanceof InterruptedIOException)) { try { - restart((IOException)e); + gotIOException((IOException)e); } catch (Exception ee) { logger.warning("Checker-run", "Failed to check connection: "+ e); diff --git a/jdk/src/share/classes/com/sun/jmx/remote/internal/ClientNotifForwarder.java b/jdk/src/share/classes/com/sun/jmx/remote/internal/ClientNotifForwarder.java index dfdf6b238d5..ffe8edb1e29 100644 --- a/jdk/src/share/classes/com/sun/jmx/remote/internal/ClientNotifForwarder.java +++ b/jdk/src/share/classes/com/sun/jmx/remote/internal/ClientNotifForwarder.java @@ -51,6 +51,7 @@ import javax.management.remote.TargetedNotification; import com.sun.jmx.remote.util.ClassLogger; import com.sun.jmx.remote.util.EnvHelp; +import java.rmi.UnmarshalException; public abstract class ClientNotifForwarder { @@ -594,10 +595,7 @@ public abstract class ClientNotifForwarder { } return nr; - } catch (ClassNotFoundException e) { - logger.trace("NotifFetcher.fetchNotifs", e); - return fetchOneNotif(); - } catch (NotSerializableException e) { + } catch (ClassNotFoundException | NotSerializableException | UnmarshalException e) { logger.trace("NotifFetcher.fetchNotifs", e); return fetchOneNotif(); } catch (IOException ioe) { @@ -619,17 +617,18 @@ public abstract class ClientNotifForwarder { timeout. This allows us to skip sequence numbers for notifications that don't match our filters. Then we ask for one notification. If that produces a - ClassNotFoundException or a NotSerializableException, we - increase our sequence number and ask again. Eventually we - will either get a successful notification, or a return with - 0 notifications. In either case we can return a + ClassNotFoundException, NotSerializableException or + UnmarshalException, we increase our sequence number and ask again. + Eventually we will either get a successful notification, or a + return with 0 notifications. In either case we can return a NotificationResult. This algorithm works (albeit less well) even if the server implementation doesn't optimize a request for 0 notifications to skip sequence numbers for notifications that don't match our filters. - If we had at least one ClassNotFoundException, then we - must emit a JMXConnectionNotification.LOST_NOTIFS. + If we had at least one + ClassNotFoundException/NotSerializableException/UnmarshalException, + then we must emit a JMXConnectionNotification.LOST_NOTIFS. */ private NotificationResult fetchOneNotif() { ClientNotifForwarder cnf = ClientNotifForwarder.this; @@ -668,23 +667,20 @@ public abstract class ClientNotifForwarder { try { // 1 notif to skip possible missing class result = cnf.fetchNotifs(startSequenceNumber, 1, 0L); - } catch (Exception e) { - if (e instanceof ClassNotFoundException - || e instanceof NotSerializableException) { - logger.warning("NotifFetcher.fetchOneNotif", - "Failed to deserialize a notification: "+e.toString()); - if (logger.traceOn()) { - logger.trace("NotifFetcher.fetchOneNotif", - "Failed to deserialize a notification.", e); - } - - notFoundCount++; - startSequenceNumber++; - } else { - if (!shouldStop()) - logger.trace("NotifFetcher.fetchOneNotif", e); - return null; + } catch (ClassNotFoundException | NotSerializableException | UnmarshalException e) { + logger.warning("NotifFetcher.fetchOneNotif", + "Failed to deserialize a notification: "+e.toString()); + if (logger.traceOn()) { + logger.trace("NotifFetcher.fetchOneNotif", + "Failed to deserialize a notification.", e); } + + notFoundCount++; + startSequenceNumber++; + } catch (Exception e) { + if (!shouldStop()) + logger.trace("NotifFetcher.fetchOneNotif", e); + return null; } } @@ -692,7 +688,7 @@ public abstract class ClientNotifForwarder { final String msg = "Dropped " + notFoundCount + " notification" + (notFoundCount == 1 ? "" : "s") + - " because classes were missing locally"; + " because classes were missing locally or incompatible"; lostNotifs(msg, notFoundCount); // Even if result.getEarliestSequenceNumber() is now greater than // it was initially, meaning some notifs have been dropped diff --git a/jdk/src/share/classes/com/sun/jmx/remote/internal/IIOPHelper.java b/jdk/src/share/classes/com/sun/jmx/remote/internal/IIOPHelper.java index b598a9c4f3b..eabe73962c2 100644 --- a/jdk/src/share/classes/com/sun/jmx/remote/internal/IIOPHelper.java +++ b/jdk/src/share/classes/com/sun/jmx/remote/internal/IIOPHelper.java @@ -26,13 +26,8 @@ package com.sun.jmx.remote.internal; import java.util.Properties; +import java.io.IOException; import java.rmi.Remote; -import java.rmi.RemoteException; -import java.rmi.NoSuchObjectException; - -import java.util.Properties; -import java.rmi.Remote; -import java.rmi.RemoteException; import java.rmi.NoSuchObjectException; import java.security.AccessController; @@ -115,9 +110,10 @@ public final class IIOPHelper { * Connects the Stub to the given ORB. */ public static void connect(Object stub, Object orb) - throws RemoteException + throws IOException { - ensureAvailable(); + if (proxy == null) + throw new IOException("Connection to ORB failed, RMI/IIOP not available"); proxy.connect(stub, orb); } @@ -125,15 +121,17 @@ public final class IIOPHelper { * Returns true if the given object is an ORB. */ public static boolean isOrb(Object obj) { - ensureAvailable(); - return proxy.isOrb(obj); + return (proxy == null) ? false : proxy.isOrb(obj); } /** * Creates, and returns, a new ORB instance. */ - public static Object createOrb(String[] args, Properties props) { - ensureAvailable(); + public static Object createOrb(String[] args, Properties props) + throws IOException + { + if (proxy == null) + throw new IOException("ORB initialization failed, RMI/IIOP not available"); return proxy.createOrb(args, props); } @@ -166,24 +164,27 @@ public final class IIOPHelper { /** * Makes a server object ready to receive remote calls */ - public static void exportObject(Remote obj) throws RemoteException { - ensureAvailable(); + public static void exportObject(Remote obj) throws IOException { + if (proxy == null) + throw new IOException("RMI object cannot be exported, RMI/IIOP not available"); proxy.exportObject(obj); } /** * Deregisters a server object from the runtime. */ - public static void unexportObject(Remote obj) throws NoSuchObjectException { - ensureAvailable(); + public static void unexportObject(Remote obj) throws IOException { + if (proxy == null) + throw new NoSuchObjectException("Object not exported"); proxy.unexportObject(obj); } /** * Returns a stub for the given server object. */ - public static Remote toStub(Remote obj) throws NoSuchObjectException { - ensureAvailable(); + public static Remote toStub(Remote obj) throws IOException { + if (proxy == null) + throw new NoSuchObjectException("Object not exported"); return proxy.toStub(obj); } } diff --git a/jdk/src/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java b/jdk/src/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java index 4490830a007..1ea01765a5d 100644 --- a/jdk/src/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java +++ b/jdk/src/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java @@ -25,16 +25,15 @@ package com.sun.jmx.remote.internal; -import com.sun.jmx.mbeanserver.Util; import com.sun.jmx.remote.security.NotificationAccessController; import com.sun.jmx.remote.util.ClassLogger; import com.sun.jmx.remote.util.EnvHelp; import java.io.IOException; import java.security.AccessControlContext; import java.security.AccessController; -import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; +import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; @@ -291,13 +290,18 @@ public class ServerNotifForwarder { // so that we can know too, and remove the corresponding entry from the listenerMap. // See 6957378. private void snoopOnUnregister(NotificationResult nr) { - Set delegateSet = listenerMap.get(MBeanServerDelegate.DELEGATE_NAME); - if (delegateSet == null || delegateSet.isEmpty()) { - return; + List copy = null; + synchronized (listenerMap) { + Set delegateSet = listenerMap.get(MBeanServerDelegate.DELEGATE_NAME); + if (delegateSet == null || delegateSet.isEmpty()) { + return; + } + copy = new ArrayList<>(delegateSet); } + for (TargetedNotification tn : nr.getTargetedNotifications()) { Integer id = tn.getListenerID(); - for (IdAndFilter idaf : delegateSet) { + for (IdAndFilter idaf : copy) { if (idaf.id == id) { // This is a notification from the MBeanServerDelegate. Notification n = tn.getNotification(); diff --git a/jdk/src/share/classes/com/sun/net/ssl/KeyManagerFactory.java b/jdk/src/share/classes/com/sun/net/ssl/KeyManagerFactory.java index 36041d804d1..30e941a89d5 100644 --- a/jdk/src/share/classes/com/sun/net/ssl/KeyManagerFactory.java +++ b/jdk/src/share/classes/com/sun/net/ssl/KeyManagerFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -53,12 +53,13 @@ public class KeyManagerFactory { /** *

The default KeyManager can be changed by setting the value of the - * "sun.ssl.keymanager.type" security property (in the Java security - * properties file) to the desired name. + * {@code sun.ssl.keymanager.type} security property to the desired name. * - * @return the default type as specified in the - * Java security properties file, or an implementation-specific default - * if no such property exists. + * @return the default type as specified by the + * {@code sun.ssl.keymanager.type} security property, or an + * implementation-specific default if no such property exists. + * + * @see java.security.Security security properties */ public final static String getDefaultAlgorithm() { String type; diff --git a/jdk/src/share/classes/com/sun/net/ssl/TrustManagerFactory.java b/jdk/src/share/classes/com/sun/net/ssl/TrustManagerFactory.java index e3e9b64b6b5..b9ef566a0e7 100644 --- a/jdk/src/share/classes/com/sun/net/ssl/TrustManagerFactory.java +++ b/jdk/src/share/classes/com/sun/net/ssl/TrustManagerFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -53,12 +53,13 @@ public class TrustManagerFactory { /** *

The default TrustManager can be changed by setting the value of the - * "sun.ssl.trustmanager.type" security property - * (in the Java security properties file) to the desired name. + * {@code sun.ssl.trustmanager.type} security property to the desired name. * - * @return the default type as specified in the - * Java security properties file, or an implementation-specific default - * if no such property exists. + * @return the default type as specified by the + * {@code sun.ssl.trustmanager.type} security property, or an + * implementation-specific default if no such property exists. + * + * @see java.security.Security security properties */ public final static String getDefaultAlgorithm() { String type; diff --git a/jdk/src/share/classes/com/sun/rowset/internal/CachedRowSetWriter.java b/jdk/src/share/classes/com/sun/rowset/internal/CachedRowSetWriter.java index 8824f8c0f0a..db14e424b29 100644 --- a/jdk/src/share/classes/com/sun/rowset/internal/CachedRowSetWriter.java +++ b/jdk/src/share/classes/com/sun/rowset/internal/CachedRowSetWriter.java @@ -264,7 +264,7 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable { * false otherwise */ public boolean writeData(RowSetInternal caller) throws SQLException { - boolean conflict = false; + long conflicts = 0; boolean showDel = false; PreparedStatement pstmtIns = null; iChangedValsInDbAndCRS = 0; @@ -337,8 +337,9 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable { while (crs.next()) { if (crs.rowDeleted()) { // The row has been deleted. - if (conflict = (deleteOriginalRow(crs, this.crsResolve)) == true) { + if (deleteOriginalRow(crs, this.crsResolve)) { status.add(rows, SyncResolver.DELETE_ROW_CONFLICT); + conflicts++; } else { // delete happened without any occurrence of conflicts // so update status accordingly @@ -349,8 +350,9 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable { // The row has been inserted. pstmtIns = con.prepareStatement(insertCmd); - if ( (conflict = insertNewRow(crs, pstmtIns, this.crsResolve)) == true) { + if (insertNewRow(crs, pstmtIns, this.crsResolve)) { status.add(rows, SyncResolver.INSERT_ROW_CONFLICT); + conflicts++; } else { // insert happened without any occurrence of conflicts // so update status accordingly @@ -358,8 +360,9 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable { } } else if (crs.rowUpdated()) { // The row has been updated. - if ( conflict = (updateOriginalRow(crs)) == true) { + if (updateOriginalRow(crs)) { status.add(rows, SyncResolver.UPDATE_ROW_CONFLICT); + conflicts++; } else { // update happened without any occurrence of conflicts // so update status accordingly @@ -395,21 +398,12 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable { // reset crs.setShowDeleted(showDel); - boolean boolConf = false; - for (int j=1;j *

  • - * Loop through the java.security.Security properties, + * Loop through the security properties, * auth.policy.url.1, auth.policy.url.2, ..., - * auth.policy.url.X". These properties are set - * in the Java security properties file, which is located in the file named - * <JAVA_HOME>/lib/security/java.security. - * <JAVA_HOME> refers to the value of the java.home system property, - * and specifies the directory where the JRE is installed. + * auth.policy.url.X". * Each property value specifies a URL pointing to a * policy file to be loaded. Read in and load each policy. * @@ -235,6 +231,7 @@ import sun.security.util.PropertyExpander; * @see java.security.CodeSource * @see java.security.Permissions * @see java.security.ProtectionDomain + * @see java.security.Security security properties */ @Deprecated public class PolicyFile extends javax.security.auth.Policy { diff --git a/jdk/src/share/classes/com/sun/security/auth/login/ConfigFile.java b/jdk/src/share/classes/com/sun/security/auth/login/ConfigFile.java index c4b3acdc834..22a1ffbe21b 100644 --- a/jdk/src/share/classes/com/sun/security/auth/login/ConfigFile.java +++ b/jdk/src/share/classes/com/sun/security/auth/login/ConfigFile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,45 +25,39 @@ package com.sun.security.auth.login; -import javax.security.auth.AuthPermission; import javax.security.auth.login.AppConfigurationEntry; -import java.io.*; -import java.util.*; +import javax.security.auth.login.Configuration; import java.net.URI; -import java.net.URL; -import java.net.MalformedURLException; -import java.text.MessageFormat; -import sun.security.util.Debug; -import sun.security.util.ResourcesMgr; -import sun.security.util.PropertyExpander; + +// NOTE: As of JDK 8, this class instantiates +// sun.security.provider.ConfigSpiFile and forwards all methods to that +// implementation. All implementation fixes and enhancements should be made to +// sun.security.provider.ConfigSpiFile and not this class. +// See JDK-8005117 for more information. /** * This class represents a default implementation for - * javax.security.auth.login.Configuration. + * {@code javax.security.auth.login.Configuration}. * *

    This object stores the runtime login configuration representation, * and is the amalgamation of multiple static login * configurations that resides in files. * The algorithm for locating the login configuration file(s) and reading their - * information into this Configuration object is: + * information into this {@code Configuration} object is: * *

      *
    1. - * Loop through the java.security.Security properties, + * Loop through the security properties, * login.config.url.1, login.config.url.2, ..., - * login.config.url.X. These properties are set - * in the Java security properties file, which is located in the file named - * <JAVA_HOME>/lib/security/java.security. - * <JAVA_HOME> refers to the value of the java.home system property, - * and specifies the directory where the JRE is installed. - * Each property value specifies a URL pointing to a + * login.config.url.X. + * Each property value specifies a {@code URL} pointing to a * login configuration file to be loaded. Read in and load * each configuration. * *
    2. - * The java.lang.System property + * The {@code java.lang.System} property * java.security.auth.login.config - * may also be set to a URL pointing to another + * may also be set to a {@code URL} pointing to another * login configuration file * (which is the case when a user uses the -D switch at runtime). * If this property is defined, and its use is allowed by the @@ -84,592 +78,63 @@ import sun.security.util.PropertyExpander; * *

      The configuration syntax supported by this implementation * is exactly that syntax specified in the - * javax.security.auth.login.Configuration class. + * {@code javax.security.auth.login.Configuration} class. * * @see javax.security.auth.login.LoginContext + * @see java.security.Security security properties */ -public class ConfigFile extends javax.security.auth.login.Configuration { +public class ConfigFile extends Configuration { - private StreamTokenizer st; - private int lookahead; - private int linenum; - private HashMap> configuration; - private boolean expandProp = true; - private URL url; - - private static Debug debugConfig = Debug.getInstance("configfile"); - private static Debug debugParser = Debug.getInstance("configparser"); + private sun.security.provider.ConfigSpiFile configFile; /** - * Create a new Configuration object. + * Create a new {@code Configuration} object. + * + * @throws SecurityException if the {@code Configuration} can not be + * initialized */ public ConfigFile() { - try { - init(url); - } catch (IOException ioe) { - throw (SecurityException) - new SecurityException(ioe.getMessage()).initCause(ioe); - } + configFile = new sun.security.provider.ConfigSpiFile(); } /** - * Create a new Configuration object from the specified URI. + * Create a new {@code Configuration} object from the specified {@code URI}. * - * @param uri Create a new Configuration object from this URI. + * @param uri the {@code URI} + * @throws SecurityException if the {@code Configuration} can not be + * initialized + * @throws NullPointerException if {@code uri} is null */ public ConfigFile(URI uri) { - // only load config from the specified URI - try { - url = uri.toURL(); - init(url); - } catch (MalformedURLException mue) { - throw (SecurityException) - new SecurityException(mue.getMessage()).initCause(mue); - } catch (IOException ioe) { - throw (SecurityException) - new SecurityException(ioe.getMessage()).initCause(ioe); - } + configFile = new sun.security.provider.ConfigSpiFile(uri); } /** - * Read and initialize the entire login Configuration. + * Retrieve an entry from the {@code Configuration} using an application + * name as an index. * - *

      - * - * @exception IOException if the Configuration can not be initialized.

      - * @exception SecurityException if the caller does not have permission - * to initialize the Configuration. - */ - private void init(URL url) throws IOException { - - boolean initialized = false; - FileReader fr = null; - String sep = File.separator; - - if ("false".equals(System.getProperty("policy.expandProperties"))) { - expandProp = false; - } - - // new configuration - HashMap> newConfig = - new HashMap<>(); - - if (url != null) { - - /** - * If the caller specified a URI via Configuration.getInstance, - * we only read from that URI - */ - if (debugConfig != null) { - debugConfig.println("reading " + url); - } - init(url, newConfig); - configuration = newConfig; - return; - } - - /** - * Caller did not specify URI via Configuration.getInstance. - * Read from URLs listed in the java.security properties file. - */ - - String allowSys = java.security.Security.getProperty - ("policy.allowSystemProperty"); - - if ("true".equalsIgnoreCase(allowSys)) { - String extra_config = System.getProperty - ("java.security.auth.login.config"); - if (extra_config != null) { - boolean overrideAll = false; - if (extra_config.startsWith("=")) { - overrideAll = true; - extra_config = extra_config.substring(1); - } - try { - extra_config = PropertyExpander.expand(extra_config); - } catch (PropertyExpander.ExpandException peee) { - MessageFormat form = new MessageFormat - (ResourcesMgr.getString - ("Unable.to.properly.expand.config", - "sun.security.util.AuthResources")); - Object[] source = {extra_config}; - throw new IOException(form.format(source)); - } - - URL configURL = null; - try { - configURL = new URL(extra_config); - } catch (java.net.MalformedURLException mue) { - File configFile = new File(extra_config); - if (configFile.exists()) { - configURL = configFile.toURI().toURL(); - } else { - MessageFormat form = new MessageFormat - (ResourcesMgr.getString - ("extra.config.No.such.file.or.directory.", - "sun.security.util.AuthResources")); - Object[] source = {extra_config}; - throw new IOException(form.format(source)); - } - } - - if (debugConfig != null) { - debugConfig.println("reading "+configURL); - } - init(configURL, newConfig); - initialized = true; - if (overrideAll) { - if (debugConfig != null) { - debugConfig.println("overriding other policies!"); - } - configuration = newConfig; - return; - } - } - } - - int n = 1; - String config_url; - while ((config_url = java.security.Security.getProperty - ("login.config.url."+n)) != null) { - try { - config_url = PropertyExpander.expand - (config_url).replace(File.separatorChar, '/'); - if (debugConfig != null) { - debugConfig.println("\tReading config: " + config_url); - } - init(new URL(config_url), newConfig); - initialized = true; - } catch (PropertyExpander.ExpandException peee) { - MessageFormat form = new MessageFormat - (ResourcesMgr.getString - ("Unable.to.properly.expand.config", - "sun.security.util.AuthResources")); - Object[] source = {config_url}; - throw new IOException(form.format(source)); - } - n++; - } - - if (initialized == false && n == 1 && config_url == null) { - - // get the config from the user's home directory - if (debugConfig != null) { - debugConfig.println("\tReading Policy " + - "from ~/.java.login.config"); - } - config_url = System.getProperty("user.home"); - String userConfigFile = config_url + - File.separatorChar + ".java.login.config"; - - // No longer throws an exception when there's no config file - // at all. Returns an empty Configuration instead. - if (new File(userConfigFile).exists()) { - init(new File(userConfigFile).toURI().toURL(), - newConfig); - } - } - - configuration = newConfig; - } - - private void init(URL config, - HashMap> newConfig) - throws IOException { - - InputStreamReader isr = null; - try { - isr = new InputStreamReader(getInputStream(config), "UTF-8"); - readConfig(isr, newConfig); - } catch (FileNotFoundException fnfe) { - if (debugConfig != null) { - debugConfig.println(fnfe.toString()); - } - throw new IOException(ResourcesMgr.getString - ("Configuration.Error.No.such.file.or.directory", - "sun.security.util.AuthResources")); - } finally { - if (isr != null) { - isr.close(); - } - } - } - - /** - * Retrieve an entry from the Configuration using an application name - * as an index. - * - *

      - * - * @param applicationName the name used to index the Configuration. - * @return an array of AppConfigurationEntries which correspond to - * the stacked configuration of LoginModules for this - * application, or null if this application has no configured - * LoginModules. + * @param applicationName the name used to index the {@code Configuration} + * @return an array of {@code AppConfigurationEntry} which correspond to + * the stacked configuration of {@code LoginModule}s for this + * application, or null if this application has no configured + * {@code LoginModule}s. */ + @Override public AppConfigurationEntry[] getAppConfigurationEntry - (String applicationName) { + (String applicationName) { - LinkedList list = null; - synchronized (configuration) { - list = configuration.get(applicationName); - } - - if (list == null || list.size() == 0) - return null; - - AppConfigurationEntry[] entries = - new AppConfigurationEntry[list.size()]; - Iterator iterator = list.iterator(); - for (int i = 0; iterator.hasNext(); i++) { - AppConfigurationEntry e = iterator.next(); - entries[i] = new AppConfigurationEntry(e.getLoginModuleName(), - e.getControlFlag(), - e.getOptions()); - } - return entries; + return configFile.engineGetAppConfigurationEntry(applicationName); } /** - * Refresh and reload the Configuration by re-reading all of the + * Refresh and reload the {@code Configuration} by re-reading all of the * login configurations. * - *

      - * - * @exception SecurityException if the caller does not have permission - * to refresh the Configuration. + * @throws SecurityException if the caller does not have permission + * to refresh the {@code Configuration} */ + @Override public synchronized void refresh() { - - java.lang.SecurityManager sm = System.getSecurityManager(); - if (sm != null) - sm.checkPermission(new AuthPermission("refreshLoginConfiguration")); - - java.security.AccessController.doPrivileged - (new java.security.PrivilegedAction() { - public Void run() { - try { - init(url); - } catch (java.io.IOException ioe) { - throw (SecurityException) new SecurityException - (ioe.getLocalizedMessage()).initCause(ioe); - } - return null; - } - }); - } - - private void readConfig(Reader reader, - HashMap> newConfig) - throws IOException { - - int linenum = 1; - - if (!(reader instanceof BufferedReader)) - reader = new BufferedReader(reader); - - st = new StreamTokenizer(reader); - st.quoteChar('"'); - st.wordChars('$', '$'); - st.wordChars('_', '_'); - st.wordChars('-', '-'); - st.lowerCaseMode(false); - st.slashSlashComments(true); - st.slashStarComments(true); - st.eolIsSignificant(true); - - lookahead = nextToken(); - while (lookahead != StreamTokenizer.TT_EOF) { - parseLoginEntry(newConfig); - } - } - - private void parseLoginEntry( - HashMap> newConfig) - throws IOException { - - String appName; - String moduleClass; - String sflag; - AppConfigurationEntry.LoginModuleControlFlag controlFlag; - LinkedList configEntries = new LinkedList<>(); - - // application name - appName = st.sval; - lookahead = nextToken(); - - if (debugParser != null) { - debugParser.println("\tReading next config entry: " + appName); - } - - match("{"); - - // get the modules - while (peek("}") == false) { - // get the module class name - moduleClass = match("module class name"); - - // controlFlag (required, optional, etc) - sflag = match("controlFlag"); - if (sflag.equalsIgnoreCase("REQUIRED")) - controlFlag = - AppConfigurationEntry.LoginModuleControlFlag.REQUIRED; - else if (sflag.equalsIgnoreCase("REQUISITE")) - controlFlag = - AppConfigurationEntry.LoginModuleControlFlag.REQUISITE; - else if (sflag.equalsIgnoreCase("SUFFICIENT")) - controlFlag = - AppConfigurationEntry.LoginModuleControlFlag.SUFFICIENT; - else if (sflag.equalsIgnoreCase("OPTIONAL")) - controlFlag = - AppConfigurationEntry.LoginModuleControlFlag.OPTIONAL; - else { - MessageFormat form = new MessageFormat(ResourcesMgr.getString - ("Configuration.Error.Invalid.control.flag.flag", - "sun.security.util.AuthResources")); - Object[] source = {sflag}; - throw new IOException(form.format(source)); - } - - // get the args - HashMap options = new HashMap<>(); - String key; - String value; - while (peek(";") == false) { - key = match("option key"); - match("="); - try { - value = expand(match("option value")); - } catch (PropertyExpander.ExpandException peee) { - throw new IOException(peee.getLocalizedMessage()); - } - options.put(key, value); - } - - lookahead = nextToken(); - - // create the new element - if (debugParser != null) { - debugParser.println("\t\t" + moduleClass + ", " + sflag); - java.util.Iterator i = options.keySet().iterator(); - while (i.hasNext()) { - key = i.next(); - debugParser.println("\t\t\t" + - key + - "=" + - options.get(key)); - } - } - AppConfigurationEntry entry = new AppConfigurationEntry - (moduleClass, - controlFlag, - options); - configEntries.add(entry); - } - - match("}"); - match(";"); - - // add this configuration entry - if (newConfig.containsKey(appName)) { - MessageFormat form = new MessageFormat(ResourcesMgr.getString - ("Configuration.Error.Can.not.specify.multiple.entries.for.appName", - "sun.security.util.AuthResources")); - Object[] source = {appName}; - throw new IOException(form.format(source)); - } - newConfig.put(appName, configEntries); - } - - private String match(String expect) throws IOException { - - String value = null; - - switch(lookahead) { - case StreamTokenizer.TT_EOF: - - MessageFormat form1 = new MessageFormat(ResourcesMgr.getString - ("Configuration.Error.expected.expect.read.end.of.file.", - "sun.security.util.AuthResources")); - Object[] source1 = {expect}; - throw new IOException(form1.format(source1)); - - case '"': - case StreamTokenizer.TT_WORD: - - if (expect.equalsIgnoreCase("module class name") || - expect.equalsIgnoreCase("controlFlag") || - expect.equalsIgnoreCase("option key") || - expect.equalsIgnoreCase("option value")) { - value = st.sval; - lookahead = nextToken(); - } else { - MessageFormat form = new MessageFormat(ResourcesMgr.getString - ("Configuration.Error.Line.line.expected.expect.found.value.", - "sun.security.util.AuthResources")); - Object[] source = {new Integer(linenum), expect, st.sval}; - throw new IOException(form.format(source)); - } - break; - - case '{': - - if (expect.equalsIgnoreCase("{")) { - lookahead = nextToken(); - } else { - MessageFormat form = new MessageFormat(ResourcesMgr.getString - ("Configuration.Error.Line.line.expected.expect.", - "sun.security.util.AuthResources")); - Object[] source = {new Integer(linenum), expect, st.sval}; - throw new IOException(form.format(source)); - } - break; - - case ';': - - if (expect.equalsIgnoreCase(";")) { - lookahead = nextToken(); - } else { - MessageFormat form = new MessageFormat(ResourcesMgr.getString - ("Configuration.Error.Line.line.expected.expect.", - "sun.security.util.AuthResources")); - Object[] source = {new Integer(linenum), expect, st.sval}; - throw new IOException(form.format(source)); - } - break; - - case '}': - - if (expect.equalsIgnoreCase("}")) { - lookahead = nextToken(); - } else { - MessageFormat form = new MessageFormat(ResourcesMgr.getString - ("Configuration.Error.Line.line.expected.expect.", - "sun.security.util.AuthResources")); - Object[] source = {new Integer(linenum), expect, st.sval}; - throw new IOException(form.format(source)); - } - break; - - case '=': - - if (expect.equalsIgnoreCase("=")) { - lookahead = nextToken(); - } else { - MessageFormat form = new MessageFormat(ResourcesMgr.getString - ("Configuration.Error.Line.line.expected.expect.", - "sun.security.util.AuthResources")); - Object[] source = {new Integer(linenum), expect, st.sval}; - throw new IOException(form.format(source)); - } - break; - - default: - MessageFormat form = new MessageFormat(ResourcesMgr.getString - ("Configuration.Error.Line.line.expected.expect.found.value.", - "sun.security.util.AuthResources")); - Object[] source = {new Integer(linenum), expect, st.sval}; - throw new IOException(form.format(source)); - } - return value; - } - - private boolean peek(String expect) { - boolean found = false; - - switch (lookahead) { - case ',': - if (expect.equalsIgnoreCase(",")) - found = true; - break; - case ';': - if (expect.equalsIgnoreCase(";")) - found = true; - break; - case '{': - if (expect.equalsIgnoreCase("{")) - found = true; - break; - case '}': - if (expect.equalsIgnoreCase("}")) - found = true; - break; - default: - } - return found; - } - - private int nextToken() throws IOException { - int tok; - while ((tok = st.nextToken()) == StreamTokenizer.TT_EOL) { - linenum++; - } - return tok; - } - - /* - * Fast path reading from file urls in order to avoid calling - * FileURLConnection.connect() which can be quite slow the first time - * it is called. We really should clean up FileURLConnection so that - * this is not a problem but in the meantime this fix helps reduce - * start up time noticeably for the new launcher. -- DAC - */ - private InputStream getInputStream(URL url) throws IOException { - if ("file".equalsIgnoreCase(url.getProtocol())) { - // Compatibility notes: - // - // Code changed from - // String path = url.getFile().replace('/', File.separatorChar); - // return new FileInputStream(path); - // - // The original implementation would search for "/tmp/a%20b" - // when url is "file:///tmp/a%20b". This is incorrect. The - // current codes fix this bug and searches for "/tmp/a b". - // For compatibility reasons, when the file "/tmp/a b" does - // not exist, the file named "/tmp/a%20b" will be tried. - // - // This also means that if both file exists, the behavior of - // this method is changed, and the current codes choose the - // correct one. - try { - return url.openStream(); - } catch (Exception e) { - String file = url.getPath(); - if (url.getHost().length() > 0) { // For Windows UNC - file = "//" + url.getHost() + file; - } - if (debugConfig != null) { - debugConfig.println("cannot read " + url + - ", try " + file); - } - return new FileInputStream(file); - } - } else { - return url.openStream(); - } - } - - private String expand(String value) - throws PropertyExpander.ExpandException, IOException { - - if ("".equals(value)) { - return value; - } - - if (expandProp) { - - String s = PropertyExpander.expand(value); - - if (s == null || s.length() == 0) { - MessageFormat form = new MessageFormat(ResourcesMgr.getString - ("Configuration.Error.Line.line.system.property.value.expanded.to.empty.value", - "sun.security.util.AuthResources")); - Object[] source = {new Integer(linenum), value}; - throw new IOException(form.format(source)); - } - return s; - } else { - return value; - } + configFile.engineRefresh(); } } diff --git a/jdk/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java b/jdk/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java index 5779da791e5..3d1744ba172 100644 --- a/jdk/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java +++ b/jdk/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java @@ -1067,10 +1067,6 @@ public class Krb5LoginModule implements LoginModule { if (ktab != null) { if (!privCredSet.contains(ktab)) { privCredSet.add(ktab); - // Compatibility; also add keys to privCredSet - for (KerberosKey key: ktab.getKeys(kerbClientPrinc)) { - privCredSet.add(new Krb5Util.KeysFromKeyTab(key)); - } } } else { succeeded = false; diff --git a/jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java b/jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java index db98785ca15..3c6c7c2a3d3 100644 --- a/jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java +++ b/jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,7 +58,8 @@ import sun.reflect.misc.*; */ public class DefaultPersistenceDelegate extends PersistenceDelegate { - private String[] constructor; + private static final String[] EMPTY = {}; + private final String[] constructor; private Boolean definesEquals; /** @@ -67,7 +68,7 @@ public class DefaultPersistenceDelegate extends PersistenceDelegate { * @see #DefaultPersistenceDelegate(java.lang.String[]) */ public DefaultPersistenceDelegate() { - this(new String[0]); + this.constructor = EMPTY; } /** @@ -92,7 +93,7 @@ public class DefaultPersistenceDelegate extends PersistenceDelegate { * @see #instantiate */ public DefaultPersistenceDelegate(String[] constructorPropertyNames) { - this.constructor = constructorPropertyNames; + this.constructor = (constructorPropertyNames == null) ? EMPTY : constructorPropertyNames.clone(); } private static boolean definesEquals(Class type) { diff --git a/jdk/src/share/classes/java/beans/EventSetDescriptor.java b/jdk/src/share/classes/java/beans/EventSetDescriptor.java index 46d4f54a0c9..78bc44d2978 100644 --- a/jdk/src/share/classes/java/beans/EventSetDescriptor.java +++ b/jdk/src/share/classes/java/beans/EventSetDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -277,7 +277,9 @@ public class EventSetDescriptor extends FeatureDescriptor { Method removeListenerMethod) throws IntrospectionException { setName(eventSetName); - this.listenerMethodDescriptors = listenerMethodDescriptors; + this.listenerMethodDescriptors = (listenerMethodDescriptors != null) + ? listenerMethodDescriptors.clone() + : null; setAddListenerMethod(addListenerMethod); setRemoveListenerMethod(removeListenerMethod); setListenerType(listenerType); @@ -347,7 +349,9 @@ public class EventSetDescriptor extends FeatureDescriptor { * events are fired. */ public synchronized MethodDescriptor[] getListenerMethodDescriptors() { - return listenerMethodDescriptors; + return (this.listenerMethodDescriptors != null) + ? this.listenerMethodDescriptors.clone() + : null; } /** diff --git a/jdk/src/share/classes/java/beans/MethodDescriptor.java b/jdk/src/share/classes/java/beans/MethodDescriptor.java index ae26fb211c7..db760c0e20a 100644 --- a/jdk/src/share/classes/java/beans/MethodDescriptor.java +++ b/jdk/src/share/classes/java/beans/MethodDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -70,7 +70,9 @@ public class MethodDescriptor extends FeatureDescriptor { ParameterDescriptor parameterDescriptors[]) { setName(method.getName()); setMethod(method); - this.parameterDescriptors = parameterDescriptors; + this.parameterDescriptors = (parameterDescriptors != null) + ? parameterDescriptors.clone() + : null; } /** @@ -161,7 +163,9 @@ public class MethodDescriptor extends FeatureDescriptor { * a null array if the parameter names aren't known. */ public ParameterDescriptor[] getParameterDescriptors() { - return parameterDescriptors; + return (this.parameterDescriptors != null) + ? this.parameterDescriptors.clone() + : null; } /* diff --git a/jdk/src/share/classes/java/beans/Statement.java b/jdk/src/share/classes/java/beans/Statement.java index 5ffccc3cff4..8eb88242a72 100644 --- a/jdk/src/share/classes/java/beans/Statement.java +++ b/jdk/src/share/classes/java/beans/Statement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -92,7 +92,7 @@ public class Statement { public Statement(Object target, String methodName, Object[] arguments) { this.target = target; this.methodName = methodName; - this.arguments = (arguments == null) ? emptyArray : arguments; + this.arguments = (arguments == null) ? emptyArray : arguments.clone(); } /** @@ -128,7 +128,7 @@ public class Statement { * @return the array of arguments */ public Object[] getArguments() { - return arguments; + return this.arguments.clone(); } /** diff --git a/jdk/src/share/classes/java/lang/Class.java b/jdk/src/share/classes/java/lang/Class.java index 17665ed7b28..e1ac4029985 100644 --- a/jdk/src/share/classes/java/lang/Class.java +++ b/jdk/src/share/classes/java/lang/Class.java @@ -506,6 +506,7 @@ public final * returns {@code false} otherwise. * @return {@code true} if and only if this class is a synthetic class as * defined by the Java Language Specification. + * @jls 13.1 The Form of a Binary * @since 1.5 */ public boolean isSynthetic() { diff --git a/jdk/src/share/classes/java/lang/ThreadLocal.java b/jdk/src/share/classes/java/lang/ThreadLocal.java index ac2254f88dc..b337fc5f2e6 100644 --- a/jdk/src/share/classes/java/lang/ThreadLocal.java +++ b/jdk/src/share/classes/java/lang/ThreadLocal.java @@ -25,19 +25,21 @@ package java.lang; import java.lang.ref.*; +import java.util.Objects; import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Supplier; /** * This class provides thread-local variables. These variables differ from * their normal counterparts in that each thread that accesses one (via its - * get or set method) has its own, independently initialized - * copy of the variable. ThreadLocal instances are typically private + * {@code get} or {@code set} method) has its own, independently initialized + * copy of the variable. {@code ThreadLocal} instances are typically private * static fields in classes that wish to associate state with a thread (e.g., * a user ID or Transaction ID). * *

      For example, the class below generates unique identifiers local to each * thread. - * A thread's id is assigned the first time it invokes ThreadId.get() + * A thread's id is assigned the first time it invokes {@code ThreadId.get()} * and remains unchanged on subsequent calls. *

        * import java.util.concurrent.atomic.AtomicInteger;
      @@ -61,7 +63,7 @@ import java.util.concurrent.atomic.AtomicInteger;
        * }
        * 
      *

      Each thread holds an implicit reference to its copy of a thread-local - * variable as long as the thread is alive and the ThreadLocal + * variable as long as the thread is alive and the {@code ThreadLocal} * instance is accessible; after a thread goes away, all of its copies of * thread-local instances are subject to garbage collection (unless other * references to these copies exist). @@ -108,14 +110,14 @@ public class ThreadLocal { * thread-local variable. This method will be invoked the first * time a thread accesses the variable with the {@link #get} * method, unless the thread previously invoked the {@link #set} - * method, in which case the initialValue method will not + * method, in which case the {@code initialValue} method will not * be invoked for the thread. Normally, this method is invoked at * most once per thread, but it may be invoked again in case of * subsequent invocations of {@link #remove} followed by {@link #get}. * - *

      This implementation simply returns null; if the + *

      This implementation simply returns {@code null}; if the * programmer desires thread-local variables to have an initial - * value other than null, ThreadLocal must be + * value other than {@code null}, {@code ThreadLocal} must be * subclassed, and this method overridden. Typically, an * anonymous inner class will be used. * @@ -125,8 +127,22 @@ public class ThreadLocal { return null; } + /** + * Creates a thread local variable. The initial value of the variable is + * determined by invoking the {@code get} method on the {@code Supplier}. + * + * @param supplier the supplier to be used to determine the initial value + * @return a new thread local variable + * @throws NullPointerException if the specified supplier is null + * @since 1.8 + */ + public static ThreadLocal withInitial(Supplier supplier) { + return new SuppliedThreadLocal<>(supplier); + } + /** * Creates a thread local variable. + * @see #withInitial(java.util.function.Supplier) */ public ThreadLocal() { } @@ -195,7 +211,7 @@ public class ThreadLocal { * reinitialized by invoking its {@link #initialValue} method, * unless its value is {@linkplain #set set} by the current thread * in the interim. This may result in multiple invocations of the - * initialValue method in the current thread. + * {@code initialValue} method in the current thread. * * @since 1.5 */ @@ -250,6 +266,24 @@ public class ThreadLocal { throw new UnsupportedOperationException(); } + /** + * An extension of ThreadLocal that obtains its initial value from + * the specified {@code Supplier}. + */ + static final class SuppliedThreadLocal extends ThreadLocal { + + private final Supplier supplier; + + SuppliedThreadLocal(Supplier supplier) { + this.supplier = Objects.requireNonNull(supplier); + } + + @Override + protected T initialValue() { + return supplier.get(); + } + } + /** * ThreadLocalMap is a customized hash map suitable only for * maintaining thread local values. No operations are exported @@ -599,9 +633,9 @@ public class ThreadLocal { * @param i a position known NOT to hold a stale entry. The * scan starts at the element after i. * - * @param n scan control: log2(n) cells are scanned, + * @param n scan control: {@code log2(n)} cells are scanned, * unless a stale entry is found, in which case - * log2(table.length)-1 additional cells are scanned. + * {@code log2(table.length)-1} additional cells are scanned. * When called from insertions, this parameter is the number * of elements, but when from replaceStaleEntry, it is the * table length. (Note: all this could be changed to be either diff --git a/jdk/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java b/jdk/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java index 9e786e8f5b9..13999001cdc 100644 --- a/jdk/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java +++ b/jdk/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java @@ -25,15 +25,15 @@ package java.lang.invoke; -import java.io.FileOutputStream; -import java.io.IOException; +import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.security.ProtectionDomain; import java.util.concurrent.atomic.AtomicInteger; -import sun.util.logging.PlatformLogger; import jdk.internal.org.objectweb.asm.*; import static jdk.internal.org.objectweb.asm.Opcodes.*; import sun.misc.Unsafe; +import java.security.AccessController; +import java.security.PrivilegedAction; /** * InnerClassLambdaMetafactory @@ -120,13 +120,34 @@ import sun.misc.Unsafe; * * @return a CallSite, which, when invoked, will return an instance of the * functional interface - * @throws ReflectiveOperationException + * @throws ReflectiveOperationException, LambdaConversionException */ @Override CallSite buildCallSite() throws ReflectiveOperationException, LambdaConversionException { final Class innerClass = spinInnerClass(); if (invokedType.parameterCount() == 0) { - return new ConstantCallSite(MethodHandles.constant(samBase, innerClass.newInstance())); + final Constructor[] ctrs = AccessController.doPrivileged( + new PrivilegedAction() { + @Override + public Constructor[] run() { + return innerClass.getDeclaredConstructors(); + } + }); + if (ctrs.length != 1) { + throw new ReflectiveOperationException("Expected one lambda constructor for " + + innerClass.getCanonicalName() + ", got " + ctrs.length); + } + // The lambda implementing inner class constructor is private, set + // it accessible (by us) before creating the constant sole instance + AccessController.doPrivileged(new PrivilegedAction() { + @Override + public Void run() { + ctrs[0].setAccessible(true); + return null; + } + }); + Object inst = ctrs[0].newInstance(); + return new ConstantCallSite(MethodHandles.constant(samBase, inst)); } else { return new ConstantCallSite( MethodHandles.Lookup.IMPL_LOOKUP @@ -144,7 +165,7 @@ import sun.misc.Unsafe; private Class spinInnerClass() throws LambdaConversionException { String samName = samBase.getName().replace('.', '/'); - cw.visit(CLASSFILE_VERSION, ACC_PUBLIC + ACC_SUPER, lambdaClassName, null, NAME_MAGIC_ACCESSOR_IMPL, + cw.visit(CLASSFILE_VERSION, ACC_SUPER, lambdaClassName, null, NAME_MAGIC_ACCESSOR_IMPL, isSerializable ? new String[]{samName, NAME_SERIALIZABLE} : new String[]{samName}); // Generate final fields to be filled in by constructor @@ -186,17 +207,27 @@ import sun.misc.Unsafe; final byte[] classBytes = cw.toByteArray(); - if (System.getProperty("debug.dump.generated") != null) { + /*** Uncomment to dump the generated file System.out.printf("Loaded: %s (%d bytes) %n", lambdaClassName, classBytes.length); try (FileOutputStream fos = new FileOutputStream(lambdaClassName.replace('/', '.') + ".class")) { fos.write(classBytes); } catch (IOException ex) { - PlatformLogger.getLogger(InnerClassLambdaMetafactory.class.getName()).severe(ex.getMessage(), ex); + Logger.getLogger(InnerClassLambdaMetafactory.class.getName()).log(Level.SEVERE, null, ex); } - } + ***/ ClassLoader loader = targetClass.getClassLoader(); - ProtectionDomain pd = (loader == null) ? null : targetClass.getProtectionDomain(); + ProtectionDomain pd = (loader == null) + ? null + : AccessController.doPrivileged( + new PrivilegedAction() { + @Override + public ProtectionDomain run() { + return targetClass.getProtectionDomain(); + } + } + ); + return (Class) Unsafe.getUnsafe().defineClass(lambdaClassName, classBytes, 0, classBytes.length, loader, pd); } @@ -205,7 +236,7 @@ import sun.misc.Unsafe; */ private void generateConstructor() { // Generate constructor - MethodVisitor ctor = cw.visitMethod(ACC_PUBLIC, NAME_CTOR, constructorDesc, null, null); + MethodVisitor ctor = cw.visitMethod(ACC_PRIVATE, NAME_CTOR, constructorDesc, null, null); ctor.visitCode(); ctor.visitVarInsn(ALOAD, 0); ctor.visitMethodInsn(INVOKESPECIAL, NAME_MAGIC_ACCESSOR_IMPL, NAME_CTOR, METHOD_DESCRIPTOR_VOID); diff --git a/jdk/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java b/jdk/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java index b669b6e2d95..3ddf5d4c1c5 100644 --- a/jdk/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java +++ b/jdk/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java @@ -295,9 +295,6 @@ class InvokerBytecodeGenerator { String invokerDesc = invokerType.toMethodDescriptorString(); mv = cw.visitMethod(Opcodes.ACC_STATIC, invokerName, invokerDesc, null, null); - - // Force inlining of this invoker method. - mv.visitAnnotation("Ljava/lang/invoke/ForceInline;", true); } /** @@ -524,6 +521,9 @@ class InvokerBytecodeGenerator { // Mark this method as a compiled LambdaForm mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Compiled;", true); + // Force inlining of this invoker method. + mv.visitAnnotation("Ljava/lang/invoke/ForceInline;", true); + // iterate over the form's names, generating bytecode instructions for each // start iterating at the first name following the arguments for (int i = lambdaForm.arity; i < lambdaForm.names.length; i++) { @@ -943,6 +943,9 @@ class InvokerBytecodeGenerator { // Suppress this method in backtraces displayed to the user. mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Hidden;", true); + // Don't inline the interpreter entry. + mv.visitAnnotation("Ljava/lang/invoke/DontInline;", true); + // create parameter array emitIconstInsn(invokerType.parameterCount()); mv.visitTypeInsn(Opcodes.ANEWARRAY, "java/lang/Object"); @@ -1005,6 +1008,9 @@ class InvokerBytecodeGenerator { // Suppress this method in backtraces displayed to the user. mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Hidden;", true); + // Force inlining of this invoker method. + mv.visitAnnotation("Ljava/lang/invoke/ForceInline;", true); + // Load receiver emitAloadInsn(0); diff --git a/jdk/src/share/classes/java/lang/invoke/LambdaForm.java b/jdk/src/share/classes/java/lang/invoke/LambdaForm.java index f1da24379c0..f5dcf40fd4d 100644 --- a/jdk/src/share/classes/java/lang/invoke/LambdaForm.java +++ b/jdk/src/share/classes/java/lang/invoke/LambdaForm.java @@ -592,6 +592,7 @@ class LambdaForm { private int invocationCounter = 0; @Hidden + @DontInline /** Interpretively invoke this form on the given arguments. */ Object interpretWithArguments(Object... argumentValues) throws Throwable { if (TRACE_INTERPRETER) @@ -606,6 +607,7 @@ class LambdaForm { } @Hidden + @DontInline /** Evaluate a single Name within this form, applying its function to its arguments. */ Object interpretName(Name name, Object[] values) throws Throwable { if (TRACE_INTERPRETER) diff --git a/jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java b/jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java index 3f58e6182eb..3cdd99cc4a1 100644 --- a/jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java +++ b/jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java @@ -310,9 +310,9 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP; } static class AsVarargsCollector extends MethodHandle { - MethodHandle target; - final Class arrayType; - MethodHandle cache; + private final MethodHandle target; + private final Class arrayType; + private MethodHandle cache; AsVarargsCollector(MethodHandle target, MethodType type, Class arrayType) { super(type, reinvokerForm(type)); diff --git a/jdk/src/share/classes/java/lang/reflect/Constructor.java b/jdk/src/share/classes/java/lang/reflect/Constructor.java index 49e9c5ef90b..73e4d271e17 100644 --- a/jdk/src/share/classes/java/lang/reflect/Constructor.java +++ b/jdk/src/share/classes/java/lang/reflect/Constructor.java @@ -66,6 +66,8 @@ public final class Constructor extends Executable { private transient ConstructorRepository genericInfo; private byte[] annotations; private byte[] parameterAnnotations; + // This is set by the vm at Constructor creation + private byte[] typeAnnotations; // Generics infrastructure // Accessor for factory @@ -138,6 +140,8 @@ public final class Constructor extends Executable { res.root = this; // Might as well eagerly propagate this if already present res.constructorAccessor = constructorAccessor; + + res.typeAnnotations = typeAnnotations; return res; } @@ -407,6 +411,7 @@ public final class Constructor extends Executable { /** * {@inheritDoc} + * @jls 13.1 The Form of a Binary * @since 1.5 */ @Override diff --git a/jdk/src/share/classes/java/lang/reflect/Executable.java b/jdk/src/share/classes/java/lang/reflect/Executable.java index 6948d96e8a0..724b4838fe7 100644 --- a/jdk/src/share/classes/java/lang/reflect/Executable.java +++ b/jdk/src/share/classes/java/lang/reflect/Executable.java @@ -324,6 +324,7 @@ public abstract class Executable extends AccessibleObject * @return true if and only if this executable is a synthetic * construct as defined by * The Java™ Language Specification. + * @jls 13.1 The Form of a Binary */ public boolean isSynthetic() { return Modifier.isSynthetic(getModifiers()); diff --git a/jdk/src/share/classes/java/lang/reflect/Field.java b/jdk/src/share/classes/java/lang/reflect/Field.java index ded3689c419..e5471459586 100644 --- a/jdk/src/share/classes/java/lang/reflect/Field.java +++ b/jdk/src/share/classes/java/lang/reflect/Field.java @@ -80,6 +80,8 @@ class Field extends AccessibleObject implements Member { // currently only two levels deep (i.e., one root Field and // potentially many Field objects pointing to it.) private Field root; + // This is set by the vm at Field creation + private byte[] typeAnnotations; // Generics infrastructure @@ -144,6 +146,8 @@ class Field extends AccessibleObject implements Member { // Might as well eagerly propagate this if already present res.fieldAccessor = fieldAccessor; res.overrideFieldAccessor = overrideFieldAccessor; + + res.typeAnnotations = typeAnnotations; return res; } diff --git a/jdk/src/share/classes/java/lang/reflect/Member.java b/jdk/src/share/classes/java/lang/reflect/Member.java index 7d51c183e11..5d3ab3dd8b3 100644 --- a/jdk/src/share/classes/java/lang/reflect/Member.java +++ b/jdk/src/share/classes/java/lang/reflect/Member.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -87,6 +87,7 @@ interface Member { * * @return true if and only if this member was introduced by * the compiler. + * @jls 13.1 The Form of a Binary * @since 1.5 */ public boolean isSynthetic(); diff --git a/jdk/src/share/classes/java/lang/reflect/Method.java b/jdk/src/share/classes/java/lang/reflect/Method.java index 42e09291e4a..f67ca224447 100644 --- a/jdk/src/share/classes/java/lang/reflect/Method.java +++ b/jdk/src/share/classes/java/lang/reflect/Method.java @@ -79,7 +79,8 @@ public final class Method extends Executable { // currently only two levels deep (i.e., one root Method and // potentially many Method objects pointing to it.) private Method root; - + // This is set by the vm at Method creation + private byte[] typeAnnotations; // Generics infrastructure private String getGenericSignature() {return signature;} @@ -150,6 +151,8 @@ public final class Method extends Executable { res.root = this; // Might as well eagerly propagate this if already present res.methodAccessor = methodAccessor; + + res.typeAnnotations = typeAnnotations; return res; } @@ -497,6 +500,7 @@ public final class Method extends Executable { /** * {@inheritDoc} + * @jls 13.1 The Form of a Binary * @since 1.5 */ @Override @@ -504,6 +508,22 @@ public final class Method extends Executable { return super.isSynthetic(); } + /** + * Returns {@code true} if this method is a default + * method; returns {@code false} otherwise. + * + * A default method is a non-abstract method, that is, a method + * with a body, declared in an interface type. + * + * @return true if and only if this method is a default + * method as defined by the Java Language Specification. + * @since 1.8 + */ + public boolean isDefault() { + return (getModifiers() & Modifier.ABSTRACT) == 0 && + getDeclaringClass().isInterface(); + } + // NOTE that there is no synchronization used here. It is correct // (though not efficient) to generate more than one MethodAccessor // for a given Method. However, avoiding synchronization will diff --git a/jdk/src/share/classes/java/net/HttpCookie.java b/jdk/src/share/classes/java/net/HttpCookie.java index fe4edc6ac12..d5a36df507f 100644 --- a/jdk/src/share/classes/java/net/HttpCookie.java +++ b/jdk/src/share/classes/java/net/HttpCookie.java @@ -30,6 +30,8 @@ import java.util.StringTokenizer; import java.util.NoSuchElementException; import java.text.SimpleDateFormat; import java.util.TimeZone; +import java.util.Calendar; +import java.util.GregorianCalendar; import java.util.Date; import java.util.Locale; import java.util.Objects; @@ -89,7 +91,10 @@ public final class HttpCookie implements Cloneable { private final static String[] COOKIE_DATE_FORMATS = { "EEE',' dd-MMM-yyyy HH:mm:ss 'GMT'", "EEE',' dd MMM yyyy HH:mm:ss 'GMT'", - "EEE MMM dd yyyy HH:mm:ss 'GMT'Z" + "EEE MMM dd yyyy HH:mm:ss 'GMT'Z", + "EEE',' dd-MMM-yy HH:mm:ss 'GMT'", + "EEE',' dd MMM yy HH:mm:ss 'GMT'", + "EEE MMM dd yy HH:mm:ss 'GMT'Z" }; // constant strings represent set-cookie header token @@ -1025,13 +1030,29 @@ public final class HttpCookie implements Cloneable { * specified by dateString */ private long expiryDate2DeltaSeconds(String dateString) { + Calendar cal = new GregorianCalendar(GMT); for (int i = 0; i < COOKIE_DATE_FORMATS.length; i++) { SimpleDateFormat df = new SimpleDateFormat(COOKIE_DATE_FORMATS[i], Locale.US); + cal.set(1970, 0, 1, 0, 0, 0); df.setTimeZone(GMT); + df.setLenient(false); + df.set2DigitYearStart(cal.getTime()); try { - Date date = df.parse(dateString); - return (date.getTime() - whenCreated) / 1000; + cal.setTime(df.parse(dateString)); + if (!COOKIE_DATE_FORMATS[i].contains("yyyy")) { + // 2-digit years following the standard set + // out it rfc 6265 + int year = cal.get(Calendar.YEAR); + year %= 100; + if (year < 70) { + year += 2000; + } else { + year += 1900; + } + cal.set(Calendar.YEAR, year); + } + return (cal.getTimeInMillis() - whenCreated) / 1000; } catch (Exception e) { // Ignore, try the next date format } diff --git a/jdk/src/share/classes/java/net/Inet6Address.java b/jdk/src/share/classes/java/net/Inet6Address.java index 77e7cf80314..7329b2de687 100644 --- a/jdk/src/share/classes/java/net/Inet6Address.java +++ b/jdk/src/share/classes/java/net/Inet6Address.java @@ -25,9 +25,9 @@ package java.net; -import java.io.ObjectInputStream; import java.io.IOException; import java.io.InvalidObjectException; +import java.io.ObjectInputStream; import java.util.Enumeration; /** @@ -116,7 +116,8 @@ import java.util.Enumeration; *

      Special IPv6 address

      * *
      - * + *
      IPv4-mapped address
      + * * *
      IPv4-mapped addressOf the form::ffff:w.x.y.z, this IPv6 address is used to * represent an IPv4 address. It allows the native program to * use the same address data structure and also the same @@ -130,35 +131,40 @@ import java.util.Enumeration; * address.
      *

      - *

      Textual representation of IPv6 scoped addresses

      - *

      - * The textual representation of IPv6 addresses as described above can be extended - * to specify IPv6 scoped addresses. This extension to the basic addressing architecture - * is described in [draft-ietf-ipngwg-scoping-arch-04.txt]. - *

      - * Because link-local and site-local addresses are non-global, it is possible that different hosts - * may have the same destination address and may be reachable through different interfaces on the - * same originating system. In this case, the originating system is said to be connected - * to multiple zones of the same scope. In order to disambiguate which is the intended destination - * zone, it is possible to append a zone identifier (or scope_id) to an IPv6 address. - *

      - * The general format for specifying the scope_id is the following: + *

      Textual representation of IPv6 scoped addresses

      + * + *

      The textual representation of IPv6 addresses as described above can be + * extended to specify IPv6 scoped addresses. This extension to the basic + * addressing architecture is described in [draft-ietf-ipngwg-scoping-arch-04.txt]. + * + *

      Because link-local and site-local addresses are non-global, it is possible + * that different hosts may have the same destination address and may be + * reachable through different interfaces on the same originating system. In + * this case, the originating system is said to be connected to multiple zones + * of the same scope. In order to disambiguate which is the intended destination + * zone, it is possible to append a zone identifier (or scope_id) to an + * IPv6 address. + * + *

      The general format for specifying the scope_id is the following: + * *

      IPv6-address%scope_id
      *

      The IPv6-address is a literal IPv6 address as described above. - * The scope_id refers to an interface on the local system, and it can be specified - * in two ways. - *

      1. As a numeric identifier. This must be a positive integer that identifies the - * particular interface and scope as understood by the system. Usually, the numeric - * values can be determined through administration tools on the system. Each interface may - * have multiple values, one for each scope. If the scope is unspecified, then the default value - * used is zero.
      2. - *

      3. As a string. This must be the exact string that is returned by - * {@link java.net.NetworkInterface#getName()} for the particular interface in question. - * When an Inet6Address is created in this way, the numeric scope-id is determined at the time - * the object is created by querying the relevant NetworkInterface.
      4. - *

      - * Note also, that the numeric scope_id can be retrieved from Inet6Address instances returned from the - * NetworkInterface class. This can be used to find out the current scope ids configured on the system. + * The scope_id refers to an interface on the local system, and it can be + * specified in two ways. + *

      1. As a numeric identifier. This must be a positive integer + * that identifies the particular interface and scope as understood by the + * system. Usually, the numeric values can be determined through administration + * tools on the system. Each interface may have multiple values, one for each + * scope. If the scope is unspecified, then the default value used is zero.
      2. + *

      3. As a string. This must be the exact string that is returned by + * {@link java.net.NetworkInterface#getName()} for the particular interface in + * question. When an Inet6Address is created in this way, the numeric scope-id + * is determined at the time the object is created by querying the relevant + * NetworkInterface.
      + * + *

      Note also, that the numeric scope_id can be retrieved from + * Inet6Address instances returned from the NetworkInterface class. This can be + * used to find out the current scope ids configured on the system. * @since 1.4 */ @@ -169,7 +175,7 @@ class Inet6Address extends InetAddress { /* * cached scope_id - for link-local address use only. */ - private transient int cached_scope_id = 0; + private transient int cached_scope_id; // 0 /** * Holds a 128-bit (16 bytes) IPv6 address. @@ -179,37 +185,28 @@ class Inet6Address extends InetAddress { byte[] ipaddress; /** - * scope_id. The scope specified when the object is created. If the object is created - * with an interface name, then the scope_id is not determined until the time it is needed. + * scope_id. The scope specified when the object is created. If the object + * is created with an interface name, then the scope_id is not determined + * until the time it is needed. */ - private int scope_id = 0; + private int scope_id; // 0 /** * This will be set to true when the scope_id field contains a valid * integer scope_id. */ - private boolean scope_id_set = false; + private boolean scope_id_set; // false /** * scoped interface. scope_id is derived from this as the scope_id of the first * address whose scope is the same as this address for the named interface. */ - private transient NetworkInterface scope_ifname = null; - - /** - * set if the object is constructed with a scoped interface instead of a - * numeric scope id. - */ - private boolean scope_ifname_set = false; + private transient NetworkInterface scope_ifname; // null private static final long serialVersionUID = 6880410070516793377L; - /* - * Perform initializations. - */ - static { - init(); - } + // Perform native initialization + static { init(); } Inet6Address() { super(); @@ -239,19 +236,24 @@ class Inet6Address extends InetAddress { } catch (UnknownHostException e) {} /* cant happen if ifname is null */ } - Inet6Address (String hostName, byte addr[], NetworkInterface nif) throws UnknownHostException { + Inet6Address (String hostName, byte addr[], NetworkInterface nif) + throws UnknownHostException + { initif (hostName, addr, nif); } - Inet6Address (String hostName, byte addr[], String ifname) throws UnknownHostException { + Inet6Address (String hostName, byte addr[], String ifname) + throws UnknownHostException + { initstr (hostName, addr, ifname); } /** - * Create an Inet6Address in the exact manner of {@link InetAddress#getByAddress(String,byte[])} - * except that the IPv6 scope_id is set to the value corresponding to the given interface - * for the address type specified in addr. - * The call will fail with an UnknownHostException if the given interface does not have a numeric + * Create an Inet6Address in the exact manner of {@link + * InetAddress#getByAddress(String,byte[])} except that the IPv6 scope_id is + * set to the value corresponding to the given interface for the address + * type specified in addr. The call will fail with an + * UnknownHostException if the given interface does not have a numeric * scope_id assigned for the given address type (eg. link-local or site-local). * See here for a description of IPv6 * scoped addresses. @@ -260,14 +262,16 @@ class Inet6Address extends InetAddress { * @param addr the raw IP address in network byte order * @param nif an interface this address must be associated with. * @return an Inet6Address object created from the raw IP address. - * @exception UnknownHostException if IP address is of illegal length, or if the interface - * does not have a numeric scope_id assigned for the given address type. + * @throws UnknownHostException + * if IP address is of illegal length, or if the interface does not + * have a numeric scope_id assigned for the given address type. * * @since 1.5 */ - - public static Inet6Address getByAddress(String host, byte[] addr, NetworkInterface nif) - throws UnknownHostException { + public static Inet6Address getByAddress(String host, byte[] addr, + NetworkInterface nif) + throws UnknownHostException + { if (host != null && host.length() > 0 && host.charAt(0) == '[') { if (host.charAt(host.length()-1) == ']') { host = host.substring(1, host.length() -1); @@ -282,9 +286,10 @@ class Inet6Address extends InetAddress { } /** - * Create an Inet6Address in the exact manner of {@link InetAddress#getByAddress(String,byte[])} - * except that the IPv6 scope_id is set to the given numeric value. - * The scope_id is not checked to determine if it corresponds to any interface on the system. + * Create an Inet6Address in the exact manner of {@link + * InetAddress#getByAddress(String,byte[])} except that the IPv6 scope_id is + * set to the given numeric value. The scope_id is not checked to determine + * if it corresponds to any interface on the system. * See here for a description of IPv6 * scoped addresses. * @@ -292,13 +297,14 @@ class Inet6Address extends InetAddress { * @param addr the raw IP address in network byte order * @param scope_id the numeric scope_id for the address. * @return an Inet6Address object created from the raw IP address. - * @exception UnknownHostException if IP address is of illegal length. + * @throws UnknownHostException if IP address is of illegal length. * * @since 1.5 */ - - public static Inet6Address getByAddress(String host, byte[] addr, int scope_id) - throws UnknownHostException { + public static Inet6Address getByAddress(String host, byte[] addr, + int scope_id) + throws UnknownHostException + { if (host != null && host.length() > 0 && host.charAt(0) == '[') { if (host.charAt(host.length()-1) == ']') { host = host.substring(1, host.length() -1); @@ -312,7 +318,9 @@ class Inet6Address extends InetAddress { throw new UnknownHostException("addr is of illegal length"); } - private void initstr (String hostName, byte addr[], String ifname) throws UnknownHostException { + private void initstr(String hostName, byte addr[], String ifname) + throws UnknownHostException + { try { NetworkInterface nif = NetworkInterface.getByName (ifname); if (nif == null) { @@ -324,16 +332,17 @@ class Inet6Address extends InetAddress { } } - private void initif(String hostName, byte addr[],NetworkInterface nif) throws UnknownHostException { + private void initif(String hostName, byte addr[],NetworkInterface nif) + throws UnknownHostException + { this.hostName = hostName; if (addr.length == INADDRSZ) { // normal IPv6 address family = IPv6; ipaddress = addr.clone(); } if (nif != null) { - this.scope_ifname = nif; - scope_ifname_set = true; - scope_id = deriveNumericScope (nif); + scope_ifname = nif; + scope_id = deriveNumericScope(nif); scope_id_set = true; } } @@ -344,17 +353,16 @@ class Inet6Address extends InetAddress { * return true otherwise. */ private boolean differentLocalAddressTypes(Inet6Address other) { - - if (isLinkLocalAddress() && !other.isLinkLocalAddress()) { + if (isLinkLocalAddress() && !other.isLinkLocalAddress()) return false; - } - if (isSiteLocalAddress() && !other.isSiteLocalAddress()) { + if (isSiteLocalAddress() && !other.isSiteLocalAddress()) return false; - } return true; } - private int deriveNumericScope (NetworkInterface ifc) throws UnknownHostException { + private int deriveNumericScope(NetworkInterface ifc) + throws UnknownHostException + { Enumeration addresses = ifc.getInetAddresses(); while (addresses.hasMoreElements()) { InetAddress addr = addresses.nextElement(); @@ -373,16 +381,17 @@ class Inet6Address extends InetAddress { throw new UnknownHostException ("no scope_id found"); } - private int deriveNumericScope (String ifname) throws UnknownHostException { + private int deriveNumericScope(String ifname) throws UnknownHostException { Enumeration en; try { en = NetworkInterface.getNetworkInterfaces(); } catch (SocketException e) { - throw new UnknownHostException ("could not enumerate local network interfaces"); + throw new UnknownHostException( + "could not enumerate local network interfaces"); } while (en.hasMoreElements()) { NetworkInterface ifc = en.nextElement(); - if (ifc.getName().equals (ifname)) { + if (ifc.getName().equals(ifname)) { Enumeration addresses = ifc.getInetAddresses(); while (addresses.hasMoreElements()) { InetAddress addr = addresses.nextElement(); @@ -400,7 +409,8 @@ class Inet6Address extends InetAddress { } } } - throw new UnknownHostException ("No matching address found for interface : " +ifname); + throw new UnknownHostException( + "No matching address found for interface : " +ifname); } /** @@ -410,22 +420,14 @@ class Inet6Address extends InetAddress { */ private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { - scope_ifname = null; - scope_ifname_set = false; s.defaultReadObject(); - if (ifname != null && !"".equals (ifname)) { + if (ifname != null && !ifname.equals("")) { try { scope_ifname = NetworkInterface.getByName(ifname); - if (scope_ifname == null) { - /* the interface does not exist on this system, so we clear - * the scope information completely */ - scope_id_set = false; - scope_ifname_set = false; - scope_id = 0; - } else { + if (scope_ifname != null) { try { - scope_id = deriveNumericScope (scope_ifname); + scope_id = deriveNumericScope(scope_ifname); } catch (UnknownHostException e) { // typically should not happen, but it may be that // the machine being used for deserialization has @@ -455,8 +457,9 @@ class Inet6Address extends InetAddress { * address. 11111111 at the start of the address identifies the * address as being a multicast address. * - * @return a boolean indicating if the InetAddress is - * an IP multicast address + * @return a {@code boolean} indicating if the InetAddress is an IP + * multicast address + * * @since JDK1.1 */ @Override @@ -466,8 +469,10 @@ class Inet6Address extends InetAddress { /** * Utility routine to check if the InetAddress in a wildcard address. - * @return a boolean indicating if the Inetaddress is + * + * @return a {@code boolean} indicating if the Inetaddress is * a wildcard address. + * * @since 1.4 */ @Override @@ -482,8 +487,9 @@ class Inet6Address extends InetAddress { /** * Utility routine to check if the InetAddress is a loopback address. * - * @return a boolean indicating if the InetAddress is - * a loopback address; or false otherwise. + * @return a {@code boolean} indicating if the InetAddress is a loopback + * address; or false otherwise. + * * @since 1.4 */ @Override @@ -498,8 +504,9 @@ class Inet6Address extends InetAddress { /** * Utility routine to check if the InetAddress is an link local address. * - * @return a boolean indicating if the InetAddress is - * a link local address; or false if address is not a link local unicast address. + * @return a {@code boolean} indicating if the InetAddress is a link local + * address; or false if address is not a link local unicast address. + * * @since 1.4 */ @Override @@ -511,8 +518,9 @@ class Inet6Address extends InetAddress { /** * Utility routine to check if the InetAddress is a site local address. * - * @return a boolean indicating if the InetAddress is - * a site local address; or false if address is not a site local unicast address. + * @return a {@code boolean} indicating if the InetAddress is a site local + * address; or false if address is not a site local unicast address. + * * @since 1.4 */ @Override @@ -524,9 +532,10 @@ class Inet6Address extends InetAddress { /** * Utility routine to check if the multicast address has global scope. * - * @return a boolean indicating if the address has - * is a multicast address of global scope, false if it is not - * of global scope or it is not a multicast address + * @return a {@code boolean} indicating if the address has is a multicast + * address of global scope, false if it is not of global scope or + * it is not a multicast address + * * @since 1.4 */ @Override @@ -538,9 +547,10 @@ class Inet6Address extends InetAddress { /** * Utility routine to check if the multicast address has node scope. * - * @return a boolean indicating if the address has - * is a multicast address of node-local scope, false if it is not - * of node-local scope or it is not a multicast address + * @return a {@code boolean} indicating if the address has is a multicast + * address of node-local scope, false if it is not of node-local + * scope or it is not a multicast address + * * @since 1.4 */ @Override @@ -552,9 +562,10 @@ class Inet6Address extends InetAddress { /** * Utility routine to check if the multicast address has link scope. * - * @return a boolean indicating if the address has - * is a multicast address of link-local scope, false if it is not - * of link-local scope or it is not a multicast address + * @return a {@code boolean} indicating if the address has is a multicast + * address of link-local scope, false if it is not of link-local + * scope or it is not a multicast address + * * @since 1.4 */ @Override @@ -566,9 +577,10 @@ class Inet6Address extends InetAddress { /** * Utility routine to check if the multicast address has site scope. * - * @return a boolean indicating if the address has - * is a multicast address of site-local scope, false if it is not - * of site-local scope or it is not a multicast address + * @return a {@code boolean} indicating if the address has is a multicast + * address of site-local scope, false if it is not of site-local + * scope or it is not a multicast address + * * @since 1.4 */ @Override @@ -580,10 +592,10 @@ class Inet6Address extends InetAddress { /** * Utility routine to check if the multicast address has organization scope. * - * @return a boolean indicating if the address has - * is a multicast address of organization-local scope, - * false if it is not of organization-local scope - * or it is not a multicast address + * @return a {@code boolean} indicating if the address has is a multicast + * address of organization-local scope, false if it is not of + * organization-local scope or it is not a multicast address + * * @since 1.4 */ @Override @@ -593,9 +605,9 @@ class Inet6Address extends InetAddress { } /** - * Returns the raw IP address of this InetAddress - * object. The result is in network byte order: the highest order - * byte of the address is in getAddress()[0]. + * Returns the raw IP address of this {@code InetAddress} object. The result + * is in network byte order: the highest order byte of the address is in + * {@code getAddress()[0]}. * * @return the raw IP address of this object. */ @@ -609,9 +621,10 @@ class Inet6Address extends InetAddress { * an interface. If no scoped_id is set, the returned value is zero. * * @return the scopeId, or zero if not set. + * * @since 1.5 */ - public int getScopeId () { + public int getScopeId() { return scope_id; } @@ -622,22 +635,23 @@ class Inet6Address extends InetAddress { * @return the scoped interface, or null if not set. * @since 1.5 */ - public NetworkInterface getScopedInterface () { + public NetworkInterface getScopedInterface() { return scope_ifname; } /** - * Returns the IP address string in textual presentation. If the instance was created - * specifying a scope identifier then the scope id is appended to the IP address preceded by - * a "%" (per-cent) character. This can be either a numeric value or a string, depending on which - * was used to createthe instance. + * Returns the IP address string in textual presentation. If the instance + * was created specifying a scope identifier then the scope id is appended + * to the IP address preceded by a "%" (per-cent) character. This can be + * either a numeric value or a string, depending on which was used to create + * the instance. * * @return the raw IP address in a string format. */ @Override public String getHostAddress() { String s = numericToTextFormat(ipaddress); - if (scope_ifname_set) { /* must check this first */ + if (scope_ifname != null) { /* must check this first */ s = s + "%" + scope_ifname.getName(); } else if (scope_id_set) { s = s + "%" + scope_id; @@ -674,29 +688,27 @@ class Inet6Address extends InetAddress { } /** - * Compares this object against the specified object. - * The result is true if and only if the argument is - * not null and it represents the same IP address as - * this object. - *

      - * Two instances of InetAddress represent the same IP - * address if the length of the byte arrays returned by - * getAddress is the same for both, and each of the - * array components is the same for the byte arrays. + * Compares this object against the specified object. The result is {@code + * true} if and only if the argument is not {@code null} and it represents + * the same IP address as this object. + * + *

      Two instances of {@code InetAddress} represent the same IP address + * if the length of the byte arrays returned by {@code getAddress} is the + * same for both, and each of the array components is the same for the byte + * arrays. * * @param obj the object to compare against. - * @return true if the objects are the same; - * false otherwise. + * + * @return {@code true} if the objects are the same; {@code false} otherwise. + * * @see java.net.InetAddress#getAddress() */ @Override public boolean equals(Object obj) { - if (obj == null || - !(obj instanceof Inet6Address)) + if (obj == null || !(obj instanceof Inet6Address)) return false; Inet6Address inetAddr = (Inet6Address)obj; - for (int i = 0; i < INADDRSZ; i++) { if (ipaddress[i] != inetAddr.ipaddress[i]) return false; @@ -709,8 +721,9 @@ class Inet6Address extends InetAddress { * Utility routine to check if the InetAddress is an * IPv4 compatible IPv6 address. * - * @return a boolean indicating if the InetAddress is - * an IPv4 compatible IPv6 address; or false if address is IPv4 address. + * @return a {@code boolean} indicating if the InetAddress is an IPv4 + * compatible IPv6 address; or false if address is IPv4 address. + * * @since 1.4 */ public boolean isIPv4CompatibleAddress() { @@ -727,6 +740,7 @@ class Inet6Address extends InetAddress { // Utilities private final static int INT16SZ = 2; + /* * Convert IPv6 binary address into presentation (printable) format. * @@ -735,9 +749,8 @@ class Inet6Address extends InetAddress { * textual representation format * @since 1.4 */ - static String numericToTextFormat(byte[] src) - { - StringBuffer sb = new StringBuffer(39); + static String numericToTextFormat(byte[] src) { + StringBuilder sb = new StringBuilder(39); for (int i = 0; i < (INADDRSZ / INT16SZ); i++) { sb.append(Integer.toHexString(((src[i<<1]<<8) & 0xff00) | (src[(i<<1)+1] & 0xff))); @@ -766,9 +779,8 @@ class Inet6Address extends InetAddress { private synchronized void writeObject(java.io.ObjectOutputStream s) throws IOException { - if (scope_ifname_set) { + if (scope_ifname != null) ifname = scope_ifname.getName(); - } s.defaultWriteObject(); } } diff --git a/jdk/src/share/classes/java/net/URLConnection.java b/jdk/src/share/classes/java/net/URLConnection.java index 72845082b96..f1c51880734 100644 --- a/jdk/src/share/classes/java/net/URLConnection.java +++ b/jdk/src/share/classes/java/net/URLConnection.java @@ -129,15 +129,6 @@ import sun.net.www.MessageHeader; * http://www.ietf.org/rfc/rfc2616.txt * * - * Note about fileNameMap: In versions prior to JDK 1.1.6, - * field fileNameMap of URLConnection was public. - * In JDK 1.1.6 and later, fileNameMap is private; accessor - * and mutator methods {@link #getFileNameMap() getFileNameMap} and - * {@link #setFileNameMap(java.net.FileNameMap) setFileNameMap} are added - * to access it. This change is also described on the - * Compatibility page. - * * Invoking the close() methods on the InputStream or OutputStream of an * URLConnection after a request may free network resources associated with this * instance, unless particular protocol specifications specify different behaviours @@ -305,8 +296,7 @@ public abstract class URLConnection { * Loads filename map (a mimetable) from a data file. It will * first try to load the user-specific table, defined * by "content.types.user.table" property. If that fails, - * it tries to load the default built-in table at - * lib/content-types.properties under java home. + * it tries to load the default built-in table. * * @return the FileNameMap * @since 1.2 diff --git a/jdk/src/share/classes/java/net/doc-files/net-properties.html b/jdk/src/share/classes/java/net/doc-files/net-properties.html index 37cbc930a12..5aac0c8e3bd 100644 --- a/jdk/src/share/classes/java/net/doc-files/net-properties.html +++ b/jdk/src/share/classes/java/net/doc-files/net-properties.html @@ -1,5 +1,5 @@ " + + "" + + "" + + "" + + "" + + ""; + /** + * Version number for the format of exported properties files. + */ + private static final String EXTERNAL_XML_VERSION = "1.0"; + private Properties properties; + + public void load(Properties props, InputStream in) + throws IOException, InvalidPropertiesFormatException, UnsupportedEncodingException + { + this.properties = props; + + try { + SAXParser parser = new SAXParserImpl(); + parser.parse(in, this); + } catch (SAXException saxe) { + throw new InvalidPropertiesFormatException(saxe); + } + + /** + * String xmlVersion = propertiesElement.getAttribute("version"); if + * (xmlVersion.compareTo(EXTERNAL_XML_VERSION) > 0) throw new + * InvalidPropertiesFormatException( "Exported Properties file format + * version " + xmlVersion + " is not supported. This java installation + * can read" + " versions " + EXTERNAL_XML_VERSION + " or older. You" + + * " may need to install a newer version of JDK."); + */ + } + + public void store(Properties props, OutputStream os, String comment, String encoding) + throws IOException + { + try { + XMLStreamWriter writer = new XMLStreamWriterImpl(os, encoding); + writer.writeStartDocument(); + writer.writeDTD(PROPS_DTD_DECL); + writer.writeStartElement(ELEMENT_ROOT); + if (comment != null && comment.length() > 0) { + writer.writeStartElement(ELEMENT_COMMENT); + writer.writeCharacters(comment); + writer.writeEndElement(); + } + + for (String key : props.stringPropertyNames()) { + String val = props.getProperty(key); + writer.writeStartElement(ELEMENT_ENTRY); + writer.writeAttribute(ATTR_KEY, key); + writer.writeCharacters(val); + writer.writeEndElement(); + } + + writer.writeEndElement(); + writer.writeEndDocument(); + writer.close(); + } catch (XMLStreamException e) { + if (e.getCause() instanceof UnsupportedEncodingException) { + throw (UnsupportedEncodingException) e.getCause(); + } + throw new IOException(e); + } + + } + //////////////////////////////////////////////////////////////////// + // Validate while parsing + //////////////////////////////////////////////////////////////////// + final static String ALLOWED_ELEMENTS = "properties, comment, entry"; + final static String ALLOWED_COMMENT = "comment"; + //////////////////////////////////////////////////////////////////// + // Handler methods + //////////////////////////////////////////////////////////////////// + StringBuffer buf = new StringBuffer(); + boolean sawComment = false; + boolean validEntry = false; + int rootElem = 0; + String key; + String rootElm; + + @Override + public void startElement(String uri, String localName, String qName, Attributes attributes) + throws SAXException + { + if (rootElem < 2) { + rootElem++; + } + + if (rootElm == null) { + fatalError(new SAXParseException("An XML properties document must contain" + + " the DOCTYPE declaration as defined by java.util.Properties.", null)); + } + + if (rootElem == 1 && !rootElm.equals(qName)) { + fatalError(new SAXParseException("Document root element \"" + qName + + "\", must match DOCTYPE root \"" + rootElm + "\"", null)); + } + if (!ALLOWED_ELEMENTS.contains(qName)) { + fatalError(new SAXParseException("Element type \"" + qName + "\" must be declared.", null)); + } + if (qName.equals(ELEMENT_ENTRY)) { + validEntry = true; + key = attributes.getValue(ATTR_KEY); + if (key == null) { + fatalError(new SAXParseException("Attribute \"key\" is required and must be specified for element type \"entry\"", null)); + } + } else if (qName.equals(ALLOWED_COMMENT)) { + if (sawComment) { + fatalError(new SAXParseException("Only one comment element may be allowed. " + + "The content of element type \"properties\" must match \"(comment?,entry*)\"", null)); + } + sawComment = true; + } + } + + @Override + public void characters(char[] ch, int start, int length) throws SAXException { + if (validEntry) { + buf.append(ch, start, length); + } + } + + @Override + public void endElement(String uri, String localName, String qName) throws SAXException { + if (!ALLOWED_ELEMENTS.contains(qName)) { + fatalError(new SAXParseException("Element: " + qName + " is invalid, must match \"(comment?,entry*)\".", null)); + } + + if (validEntry) { + properties.setProperty(key, buf.toString()); + buf.delete(0, buf.length()); + validEntry = false; + } + } + + @Override + public void notationDecl(String name, String publicId, String systemId) throws SAXException { + rootElm = name; + } + + @Override + public InputSource resolveEntity(String pubid, String sysid) + throws SAXException, IOException { + { + if (sysid.equals(PROPS_DTD_URI)) { + InputSource is; + is = new InputSource(new StringReader(PROPS_DTD)); + is.setSystemId(PROPS_DTD_URI); + return is; + } + throw new SAXException("Invalid system identifier: " + sysid); + } + } + + @Override + public void error(SAXParseException x) throws SAXException { + throw x; + } + + @Override + public void fatalError(SAXParseException x) throws SAXException { + throw x; + } + + @Override + public void warning(SAXParseException x) throws SAXException { + throw x; + } +} diff --git a/jdk/src/share/classes/jdk/internal/util/xml/SAXParser.java b/jdk/src/share/classes/jdk/internal/util/xml/SAXParser.java new file mode 100644 index 00000000000..dac2c18400b --- /dev/null +++ b/jdk/src/share/classes/jdk/internal/util/xml/SAXParser.java @@ -0,0 +1,246 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.util.xml; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import jdk.internal.org.xml.sax.InputSource; +import jdk.internal.org.xml.sax.SAXException; +import jdk.internal.org.xml.sax.XMLReader; +import jdk.internal.org.xml.sax.helpers.DefaultHandler; + + +/** + * Defines the API that wraps an {@link org.xml.sax.XMLReader} + * implementation class. In JAXP 1.0, this class wrapped the + * {@link org.xml.sax.Parser} interface, however this interface was + * replaced by the {@link org.xml.sax.XMLReader}. For ease + * of transition, this class continues to support the same name + * and interface as well as supporting new methods. + * + * An instance of this class can be obtained from the + * {@link javax.xml.parsers.SAXParserFactory#newSAXParser()} method. + * Once an instance of this class is obtained, XML can be parsed from + * a variety of input sources. These input sources are InputStreams, + * Files, URLs, and SAX InputSources.

      + * + * This static method creates a new factory instance based + * on a system property setting or uses the platform default + * if no property has been defined.

      + * + * The system property that controls which Factory implementation + * to create is named "javax.xml.parsers.SAXParserFactory". + * This property names a class that is a concrete subclass of this + * abstract class. If no property is defined, a platform default + * will be used.

      + * + * As the content is parsed by the underlying parser, methods of the + * given + * {@link org.xml.sax.helpers.DefaultHandler} are called.

      + * + * Implementors of this class which wrap an underlaying implementation + * can consider using the {@link org.xml.sax.helpers.ParserAdapter} + * class to initially adapt their SAX1 implementation to work under + * this revised class. + * + * @author Jeff Suttor + * @version $Revision: 1.8 $, $Date: 2010-11-01 04:36:09 $ + * + * @author Joe Wang + * This is a subset of that in JAXP, javax.xml.parsers.SAXParser + * + */ +public abstract class SAXParser { + + /** + *

      Protected constructor to prevent instantiation.

      + */ + protected SAXParser() { + } + + /** + * Parse the content of the given {@link java.io.InputStream} + * instance as XML using the specified + * {@link org.xml.sax.helpers.DefaultHandler}. + * + * @param is InputStream containing the content to be parsed. + * @param dh The SAX DefaultHandler to use. + * + * @throws IllegalArgumentException If the given InputStream is null. + * @throws IOException If any IO errors occur. + * @throws SAXException If any SAX errors occur during processing. + * + * @see org.xml.sax.DocumentHandler + */ + public void parse(InputStream is, DefaultHandler dh) + throws SAXException, IOException + { + if (is == null) { + throw new IllegalArgumentException("InputStream cannot be null"); + } + + InputSource input = new InputSource(is); + this.parse(input, dh); + } + + /** + * Parse the content described by the giving Uniform Resource + * Identifier (URI) as XML using the specified + * {@link org.xml.sax.helpers.DefaultHandler}. + * + * @param uri The location of the content to be parsed. + * @param dh The SAX DefaultHandler to use. + * + * @throws IllegalArgumentException If the uri is null. + * @throws IOException If any IO errors occur. + * @throws SAXException If any SAX errors occur during processing. + * + * @see org.xml.sax.DocumentHandler + */ + public void parse(String uri, DefaultHandler dh) + throws SAXException, IOException + { + if (uri == null) { + throw new IllegalArgumentException("uri cannot be null"); + } + + InputSource input = new InputSource(uri); + this.parse(input, dh); + } + + /** + * Parse the content of the file specified as XML using the + * specified {@link org.xml.sax.helpers.DefaultHandler}. + * + * @param f The file containing the XML to parse + * @param dh The SAX DefaultHandler to use. + * + * @throws IllegalArgumentException If the File object is null. + * @throws IOException If any IO errors occur. + * @throws SAXException If any SAX errors occur during processing. + * + * @see org.xml.sax.DocumentHandler + */ + public void parse(File f, DefaultHandler dh) + throws SAXException, IOException + { + if (f == null) { + throw new IllegalArgumentException("File cannot be null"); + } + + //convert file to appropriate URI, f.toURI().toASCIIString() + //converts the URI to string as per rule specified in + //RFC 2396, + InputSource input = new InputSource(f.toURI().toASCIIString()); + this.parse(input, dh); + } + + /** + * Parse the content given {@link org.xml.sax.InputSource} + * as XML using the specified + * {@link org.xml.sax.helpers.DefaultHandler}. + * + * @param is The InputSource containing the content to be parsed. + * @param dh The SAX DefaultHandler to use. + * + * @throws IllegalArgumentException If the InputSource object + * is null. + * @throws IOException If any IO errors occur. + * @throws SAXException If any SAX errors occur during processing. + * + * @see org.xml.sax.DocumentHandler + */ + public void parse(InputSource is, DefaultHandler dh) + throws SAXException, IOException + { + if (is == null) { + throw new IllegalArgumentException("InputSource cannot be null"); + } + + XMLReader reader = this.getXMLReader(); + if (dh != null) { + reader.setContentHandler(dh); + reader.setEntityResolver(dh); + reader.setErrorHandler(dh); + reader.setDTDHandler(dh); + } + reader.parse(is); + } + + /** + * Returns the {@link org.xml.sax.XMLReader} that is encapsulated by the + * implementation of this class. + * + * @return The XMLReader that is encapsulated by the + * implementation of this class. + * + * @throws SAXException If any SAX errors occur during processing. + */ + public abstract XMLReader getXMLReader() throws SAXException; + + /** + * Indicates whether or not this parser is configured to + * understand namespaces. + * + * @return true if this parser is configured to + * understand namespaces; false otherwise. + */ + public abstract boolean isNamespaceAware(); + + /** + * Indicates whether or not this parser is configured to + * validate XML documents. + * + * @return true if this parser is configured to + * validate XML documents; false otherwise. + */ + public abstract boolean isValidating(); + + /** + *

      Get the XInclude processing mode for this parser.

      + * + * @return + * the return value of + * the {@link SAXParserFactory#isXIncludeAware()} + * when this parser was created from factory. + * + * @throws UnsupportedOperationException When implementation does not + * override this method + * + * @since 1.5 + * + * @see SAXParserFactory#setXIncludeAware(boolean) + */ + public boolean isXIncludeAware() { + throw new UnsupportedOperationException( + "This parser does not support specification \"" + + this.getClass().getPackage().getSpecificationTitle() + + "\" version \"" + + this.getClass().getPackage().getSpecificationVersion() + + "\""); + } +} diff --git a/jdk/src/share/classes/jdk/internal/util/xml/XMLStreamException.java b/jdk/src/share/classes/jdk/internal/util/xml/XMLStreamException.java new file mode 100644 index 00000000000..d626c1adf8f --- /dev/null +++ b/jdk/src/share/classes/jdk/internal/util/xml/XMLStreamException.java @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.util.xml; + +/** + * A copy of the StAX XMLStreamException without Location support + * + * The base exception for unexpected processing errors. This Exception + * class is used to report well-formedness errors as well as unexpected + * processing conditions. + * @version 1.0 + * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved. + * @since 1.6 + */ + +public class XMLStreamException extends Exception { + private static final long serialVersionUID = 1L; + + + protected Throwable nested; + + /** + * Default constructor + */ + public XMLStreamException() { + super(); + } + + /** + * Construct an exception with the assocated message. + * + * @param msg the message to report + */ + public XMLStreamException(String msg) { + super(msg); + } + + /** + * Construct an exception with the assocated exception + * + * @param th a nested exception + */ + public XMLStreamException(Throwable th) { + super(th); + nested = th; + } + + /** + * Construct an exception with the assocated message and exception + * + * @param th a nested exception + * @param msg the message to report + */ + public XMLStreamException(String msg, Throwable th) { + super(msg, th); + nested = th; + } + + /** + * Gets the nested exception. + * + * @return Nested exception + */ + public Throwable getNestedException() { + return nested; + } +} diff --git a/jdk/src/share/classes/jdk/internal/util/xml/XMLStreamWriter.java b/jdk/src/share/classes/jdk/internal/util/xml/XMLStreamWriter.java new file mode 100644 index 00000000000..e67933b4d8d --- /dev/null +++ b/jdk/src/share/classes/jdk/internal/util/xml/XMLStreamWriter.java @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.util.xml; + +/** + * Basic XMLStreamWriter for writing simple XML files such as those + * defined in java.util.Properties + * + * This is a subset of javax.xml.stream.XMLStreamWriter + * + * @author Joe Wang + */ +public interface XMLStreamWriter { + + //Defaults the XML version to 1.0, and the encoding to utf-8 + public final static String DEFAULT_XML_VERSION = "1.0"; + public final static String DEFAULT_ENCODING = "UTF-8"; + + /** + * Writes a start tag to the output. All writeStartElement methods + * open a new scope in the internal namespace context. Writing the + * corresponding EndElement causes the scope to be closed. + * @param localName local name of the tag, may not be null + * @throws XMLStreamException + */ + public void writeStartElement(String localName) throws XMLStreamException; + + /** + * Writes an empty element tag to the output + * @param localName local name of the tag, may not be null + * @throws XMLStreamException + */ + public void writeEmptyElement(String localName) throws XMLStreamException; + + /** + * Writes an end tag to the output relying on the internal + * state of the writer to determine the prefix and local name + * of the event. + * @throws XMLStreamException + */ + public void writeEndElement() throws XMLStreamException; + + /** + * Closes any start tags and writes corresponding end tags. + * @throws XMLStreamException + */ + public void writeEndDocument() throws XMLStreamException; + + /** + * Close this writer and free any resources associated with the + * writer. This must not close the underlying output stream. + * @throws XMLStreamException + */ + public void close() throws XMLStreamException; + + /** + * Write any cached data to the underlying output mechanism. + * @throws XMLStreamException + */ + public void flush() throws XMLStreamException; + + /** + * Writes an attribute to the output stream without + * a prefix. + * @param localName the local name of the attribute + * @param value the value of the attribute + * @throws IllegalStateException if the current state does not allow Attribute writing + * @throws XMLStreamException + */ + public void writeAttribute(String localName, String value) + throws XMLStreamException; + + /** + * Writes a CData section + * @param data the data contained in the CData Section, may not be null + * @throws XMLStreamException + */ + public void writeCData(String data) throws XMLStreamException; + + /** + * Write a DTD section. This string represents the entire doctypedecl production + * from the XML 1.0 specification. + * + * @param dtd the DTD to be written + * @throws XMLStreamException + */ + public void writeDTD(String dtd) throws XMLStreamException; + + /** + * Write the XML Declaration. Defaults the XML version to 1.0, and the encoding to utf-8 + * @throws XMLStreamException + */ + public void writeStartDocument() throws XMLStreamException; + + /** + * Write the XML Declaration. Defaults the the encoding to utf-8 + * @param version version of the xml document + * @throws XMLStreamException + */ + public void writeStartDocument(String version) throws XMLStreamException; + + /** + * Write the XML Declaration. Note that the encoding parameter does + * not set the actual encoding of the underlying output. That must + * be set when the instance of the XMLStreamWriter is created using the + * XMLOutputFactory + * @param encoding encoding of the xml declaration + * @param version version of the xml document + * @throws XMLStreamException If given encoding does not match encoding + * of the underlying stream + */ + public void writeStartDocument(String encoding, String version) + throws XMLStreamException; + + /** + * Write text to the output + * @param text the value to write + * @throws XMLStreamException + */ + public void writeCharacters(String text) throws XMLStreamException; + + /** + * Write text to the output + * @param text the value to write + * @param start the starting position in the array + * @param len the number of characters to write + * @throws XMLStreamException + */ + public void writeCharacters(char[] text, int start, int len) + throws XMLStreamException; +} diff --git a/jdk/src/share/classes/jdk/internal/util/xml/impl/Attrs.java b/jdk/src/share/classes/jdk/internal/util/xml/impl/Attrs.java new file mode 100644 index 00000000000..c43a4de5f77 --- /dev/null +++ b/jdk/src/share/classes/jdk/internal/util/xml/impl/Attrs.java @@ -0,0 +1,430 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.util.xml.impl; + +import jdk.internal.org.xml.sax.Attributes; + +public class Attrs implements Attributes { + + /** + * Attributes string array. Each individual attribute is represented by four + * strings: namespace URL(+0), qname(+1), local name(+2), value(+3), + * type(+4), declared["d"] and default["D"](+5). In order to find attribute + * by the attrubute index, the attribute index MUST be multiplied by 8. The + * result will point to the attribute namespace URL. + */ + /* pkg */ String[] mItems; + /** + * Number of attributes in the attributes string array. + */ + private char mLength; + /** + * current index + */ + private char mAttrIdx = 0; + + /** + * Constructor. + */ + public Attrs() { + // The default number of attributies capacity is 8. + mItems = new String[(8 << 3)]; + } + + /** + * Sets up the number of attributes and ensure the capacity of the attribute + * string array. + * + * @param length The number of attributes in the object. + */ + public void setLength(char length) { + if (length > ((char) (mItems.length >> 3))) { + mItems = new String[length << 3]; + } + mLength = length; + } + + /** + * Return the number of attributes in the list. + * + *

      Once you know the number of attributes, you can iterate through the + * list.

      + * + * @return The number of attributes in the list. + * @see #getURI(int) + * @see #getLocalName(int) + * @see #getQName(int) + * @see #getType(int) + * @see #getValue(int) + */ + public int getLength() { + return mLength; + } + + /** + * Look up an attribute's Namespace URI by index. + * + * @param index The attribute index (zero-based). + * @return The Namespace URI, or the empty string if none is available, or + * null if the index is out of range. + * @see #getLength + */ + public String getURI(int index) { + return ((index >= 0) && (index < mLength)) + ? (mItems[index << 3]) + : null; + } + + /** + * Look up an attribute's local name by index. + * + * @param index The attribute index (zero-based). + * @return The local name, or the empty string if Namespace processing is + * not being performed, or null if the index is out of range. + * @see #getLength + */ + public String getLocalName(int index) { + return ((index >= 0) && (index < mLength)) + ? (mItems[(index << 3) + 2]) + : null; + } + + /** + * Look up an attribute's XML 1.0 qualified name by index. + * + * @param index The attribute index (zero-based). + * @return The XML 1.0 qualified name, or the empty string if none is + * available, or null if the index is out of range. + * @see #getLength + */ + public String getQName(int index) { + if ((index < 0) || (index >= mLength)) { + return null; + } + return mItems[(index << 3) + 1]; + } + + /** + * Look up an attribute's type by index. + * + *

      The attribute type is one of the strings "CDATA", "ID", "IDREF", + * "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", or "NOTATION" + * (always in upper case).

      + * + *

      If the parser has not read a declaration for the attribute, or if the + * parser does not report attribute types, then it must return the value + * "CDATA" as stated in the XML 1.0 Recommentation (clause 3.3.3, + * "Attribute-Value Normalization").

      + * + *

      For an enumerated attribute that is not a notation, the parser will + * report the type as "NMTOKEN".

      + * + * @param index The attribute index (zero-based). + * @return The attribute's type as a string, or null if the index is out of + * range. + * @see #getLength + */ + public String getType(int index) { + return ((index >= 0) && (index < (mItems.length >> 3))) + ? (mItems[(index << 3) + 4]) + : null; + } + + /** + * Look up an attribute's value by index. + * + *

      If the attribute value is a list of tokens (IDREFS, ENTITIES, or + * NMTOKENS), the tokens will be concatenated into a single string with each + * token separated by a single space.

      + * + * @param index The attribute index (zero-based). + * @return The attribute's value as a string, or null if the index is out of + * range. + * @see #getLength + */ + public String getValue(int index) { + return ((index >= 0) && (index < mLength)) + ? (mItems[(index << 3) + 3]) + : null; + } + + /** + * Look up the index of an attribute by Namespace name. + * + * @param uri The Namespace URI, or the empty string if the name has no + * Namespace URI. + * @param localName The attribute's local name. + * @return The index of the attribute, or -1 if it does not appear in the + * list. + */ + public int getIndex(String uri, String localName) { + char len = mLength; + for (char idx = 0; idx < len; idx++) { + if ((mItems[idx << 3]).equals(uri) + && mItems[(idx << 3) + 2].equals(localName)) { + return idx; + } + } + return -1; + } + + /** + * Look up the index of an attribute by Namespace name. + * + * @param uri The Namespace URI, or the empty string if the name has no + * Namespace URI. null value enforce the search by the local + * name only. + * @param localName The attribute's local name. + * @return The index of the attribute, or -1 if it does not appear in the + * list. + */ + /* pkg */ int getIndexNullNS(String uri, String localName) { + char len = mLength; + if (uri != null) { + for (char idx = 0; idx < len; idx++) { + if ((mItems[idx << 3]).equals(uri) + && mItems[(idx << 3) + 2].equals(localName)) { + return idx; + } + } + } else { + for (char idx = 0; idx < len; idx++) { + if (mItems[(idx << 3) + 2].equals(localName)) { + return idx; + } + } + } + return -1; + } + + /** + * Look up the index of an attribute by XML 1.0 qualified name. + * + * @param qName The qualified (prefixed) name. + * @return The index of the attribute, or -1 if it does not appear in the + * list. + */ + public int getIndex(String qName) { + char len = mLength; + for (char idx = 0; idx < len; idx++) { + if (mItems[(idx << 3) + 1].equals(qName)) { + return idx; + } + } + return -1; + } + + /** + * Look up an attribute's type by Namespace name. + * + *

      See {@link #getType(int) getType(int)} for a description of the + * possible types.

      + * + * @param uri The Namespace URI, or the empty String if the name has no + * Namespace URI. + * @param localName The local name of the attribute. + * @return The attribute type as a string, or null if the attribute is not + * in the list or if Namespace processing is not being performed. + */ + public String getType(String uri, String localName) { + int idx = getIndex(uri, localName); + return (idx >= 0) ? (mItems[(idx << 3) + 4]) : null; + } + + /** + * Look up an attribute's type by XML 1.0 qualified name. + * + *

      See {@link #getType(int) getType(int)} for a description of the + * possible types.

      + * + * @param qName The XML 1.0 qualified name. + * @return The attribute type as a string, or null if the attribute is not + * in the list or if qualified names are not available. + */ + public String getType(String qName) { + int idx = getIndex(qName); + return (idx >= 0) ? (mItems[(idx << 3) + 4]) : null; + } + + /** + * Look up an attribute's value by Namespace name. + * + *

      See {@link #getValue(int) getValue(int)} for a description of the + * possible values.

      + * + * @param uri The Namespace URI, or the empty String if the name has no + * Namespace URI. + * @param localName The local name of the attribute. + * @return The attribute value as a string, or null if the attribute is not + * in the list. + */ + public String getValue(String uri, String localName) { + int idx = getIndex(uri, localName); + return (idx >= 0) ? (mItems[(idx << 3) + 3]) : null; + } + + /** + * Look up an attribute's value by XML 1.0 qualified name. + * + *

      See {@link #getValue(int) getValue(int)} for a description of the + * possible values.

      + * + * @param qName The XML 1.0 qualified name. + * @return The attribute value as a string, or null if the attribute is not + * in the list or if qualified names are not available. + */ + public String getValue(String qName) { + int idx = getIndex(qName); + return (idx >= 0) ? (mItems[(idx << 3) + 3]) : null; + } + + /** + * Returns false unless the attribute was declared in the DTD. This helps + * distinguish two kinds of attributes that SAX reports as CDATA: ones that + * were declared (and hence are usually valid), and those that were not (and + * which are never valid). + * + * @param index The attribute index (zero-based). + * @return true if the attribute was declared in the DTD, false otherwise. + * @exception java.lang.ArrayIndexOutOfBoundsException When the supplied + * index does not identify an attribute. + */ + public boolean isDeclared(int index) { + if ((index < 0) || (index >= mLength)) { + throw new ArrayIndexOutOfBoundsException(""); + } + + return ((mItems[(index << 3) + 5]) != null); + } + + /** + * Returns false unless the attribute was declared in the DTD. This helps + * distinguish two kinds of attributes that SAX reports as CDATA: ones that + * were declared (and hence are usually valid), and those that were not (and + * which are never valid). + * + * @param qName The XML qualified (prefixed) name. + * @return true if the attribute was declared in the DTD, false otherwise. + * @exception java.lang.IllegalArgumentException When the supplied name does + * not identify an attribute. + */ + public boolean isDeclared(String qName) { + int idx = getIndex(qName); + if (idx < 0) { + throw new IllegalArgumentException(""); + } + + return ((mItems[(idx << 3) + 5]) != null); + } + + /** + * Returns false unless the attribute was declared in the DTD. This helps + * distinguish two kinds of attributes that SAX reports as CDATA: ones that + * were declared (and hence are usually valid), and those that were not (and + * which are never valid). + * + *

      Remember that since DTDs do not "understand" namespaces, the namespace + * URI associated with an attribute may not have come from the DTD. The + * declaration will have applied to the attribute's qName. + * + * @param uri The Namespace URI, or the empty string if the name has no + * Namespace URI. + * @param localName The attribute's local name. + * @return true if the attribute was declared in the DTD, false otherwise. + * @exception java.lang.IllegalArgumentException When the supplied names do + * not identify an attribute. + */ + public boolean isDeclared(String uri, String localName) { + int idx = getIndex(uri, localName); + if (idx < 0) { + throw new IllegalArgumentException(""); + } + + return ((mItems[(idx << 3) + 5]) != null); + } + + /** + * Returns true unless the attribute value was provided by DTD defaulting. + * + * @param index The attribute index (zero-based). + * @return true if the value was found in the XML text, false if the value + * was provided by DTD defaulting. + * @exception java.lang.ArrayIndexOutOfBoundsException When the supplied + * index does not identify an attribute. + */ + public boolean isSpecified(int index) { + if ((index < 0) || (index >= mLength)) { + throw new ArrayIndexOutOfBoundsException(""); + } + + String str = mItems[(index << 3) + 5]; + return ((str != null) ? (str.charAt(0) == 'd') : true); + } + + /** + * Returns true unless the attribute value was provided by DTD defaulting. + * + *

      Remember that since DTDs do not "understand" namespaces, the namespace + * URI associated with an attribute may not have come from the DTD. The + * declaration will have applied to the attribute's qName. + * + * @param uri The Namespace URI, or the empty string if the name has no + * Namespace URI. + * @param localName The attribute's local name. + * @return true if the value was found in the XML text, false if the value + * was provided by DTD defaulting. + * @exception java.lang.IllegalArgumentException When the supplied names do + * not identify an attribute. + */ + public boolean isSpecified(String uri, String localName) { + int idx = getIndex(uri, localName); + if (idx < 0) { + throw new IllegalArgumentException(""); + } + + String str = mItems[(idx << 3) + 5]; + return ((str != null) ? (str.charAt(0) == 'd') : true); + } + + /** + * Returns true unless the attribute value was provided by DTD defaulting. + * + * @param qName The XML qualified (prefixed) name. + * @return true if the value was found in the XML text, false if the value + * was provided by DTD defaulting. + * @exception java.lang.IllegalArgumentException When the supplied name does + * not identify an attribute. + */ + public boolean isSpecified(String qName) { + int idx = getIndex(qName); + if (idx < 0) { + throw new IllegalArgumentException(""); + } + + String str = mItems[(idx << 3) + 5]; + return ((str != null) ? (str.charAt(0) == 'd') : true); + } +} diff --git a/jdk/src/share/classes/jdk/internal/util/xml/impl/Input.java b/jdk/src/share/classes/jdk/internal/util/xml/impl/Input.java new file mode 100644 index 00000000000..229284d25a0 --- /dev/null +++ b/jdk/src/share/classes/jdk/internal/util/xml/impl/Input.java @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.util.xml.impl; + +import java.io.Reader; + +/** + * A parsed entity input state. + * + * This class represents a parsed entity input state. The parser uses + * an instance of this class to manage input. + */ + +public class Input { + + /** The entity public identifier or null. */ + public String pubid; + /** The entity systen identifier or null. */ + public String sysid; + /** The encoding from XML declaration or null */ + public String xmlenc; + /** The XML version from XML declaration or 0x0000 */ + public char xmlver; + /** The entity reader. */ + public Reader src; + /** The character buffer. */ + public char[] chars; + /** The length of the character buffer. */ + public int chLen; + /** The index of the next character to read. */ + public int chIdx; + /** The next input in a chain. */ + public Input next; + + /** + * Constructor. + * + * @param buffsize The input buffer size. + */ + public Input(int buffsize) { + chars = new char[buffsize]; + chLen = chars.length; + } + + /** + * Constructor. + * + * @param buff The input buffer. + */ + public Input(char[] buff) { + chars = buff; + chLen = chars.length; + } + + /** + * Constructor. + */ + public Input() { + } +} diff --git a/jdk/src/share/classes/jdk/internal/util/xml/impl/Pair.java b/jdk/src/share/classes/jdk/internal/util/xml/impl/Pair.java new file mode 100644 index 00000000000..1b99751fa94 --- /dev/null +++ b/jdk/src/share/classes/jdk/internal/util/xml/impl/Pair.java @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.util.xml.impl; + + +/** + * A name with value pair. + * + * This class keeps name with value pair with additional information and + * supports pair chaining. + */ +public class Pair { + + /** The pair name. */ + public String name; + /** The pair value. */ + public String value; + /** The pair numeric value. */ + public int num; + /** The characters of name. */ + public char[] chars; + /** The pair identifier. */ + public int id; + /** The list of associated pairs. */ + public Pair list; + /** The next pair in a chain. */ + public Pair next; + + /** + * Creates a qualified name string from qualified name. + * + * @return The qualified name string. + */ + public String qname() { + return new String(chars, 1, chars.length - 1); + } + + /** + * Creates a local name string from qualified name. + * + * @return The local name string. + */ + public String local() { + if (chars[0] != 0) { + return new String(chars, chars[0] + 1, chars.length - chars[0] - 1); + } + return new String(chars, 1, chars.length - 1); + } + + /** + * Creates a prefix string from qualified name. + * + * @return The prefix string. + */ + public String pref() { + if (chars[0] != 0) { + return new String(chars, 1, chars[0] - 1); + } + return ""; + } + + /** + * Compares two qualified name prefixes. + * + * @param qname A qualified name. + * @return true if prefixes are equal. + */ + public boolean eqpref(char[] qname) { + if (chars[0] == qname[0]) { + char len = chars[0]; + for (char i = 1; i < len; i += 1) { + if (chars[i] != qname[i]) { + return false; + } + } + return true; + } + return false; + } + + /** + * Compares two qualified names. + * + * @param qname A qualified name. + * @return true if qualified names are equal. + */ + public boolean eqname(char[] qname) { + char len = (char) chars.length; + if (len == qname.length) { + for (char i = 0; i < len; i += 1) { + if (chars[i] != qname[i]) { + return false; + } + } + return true; + } + return false; + } +} diff --git a/jdk/src/share/classes/jdk/internal/util/xml/impl/Parser.java b/jdk/src/share/classes/jdk/internal/util/xml/impl/Parser.java new file mode 100644 index 00000000000..e239adf0e20 --- /dev/null +++ b/jdk/src/share/classes/jdk/internal/util/xml/impl/Parser.java @@ -0,0 +1,3367 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.util.xml.impl; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.io.UnsupportedEncodingException; +import java.util.HashMap; +import java.util.Map; +import jdk.internal.org.xml.sax.InputSource; +import jdk.internal.org.xml.sax.SAXException; + +/** + * XML non-validating parser engine. + */ +public abstract class Parser { + + public final static String FAULT = ""; + protected final static int BUFFSIZE_READER = 512; + protected final static int BUFFSIZE_PARSER = 128; + /** + * The end of stream character. + */ + public final static char EOS = 0xffff; + private Pair mNoNS; // there is no namespace + private Pair mXml; // the xml namespace + private Map mEnt; // the entities look up table + private Map mPEnt; // the parmeter entities look up table + protected boolean mIsSAlone; // xml decl standalone flag + protected boolean mIsSAloneSet; // standalone is explicitely set + protected boolean mIsNSAware; // if true - namespace aware mode + protected int mPh; // current phase of document processing + protected final static int PH_BEFORE_DOC = -1; // before parsing + protected final static int PH_DOC_START = 0; // document start + protected final static int PH_MISC_DTD = 1; // misc before DTD + protected final static int PH_DTD = 2; // DTD + protected final static int PH_DTD_MISC = 3; // misc after DTD + protected final static int PH_DOCELM = 4; // document's element + protected final static int PH_DOCELM_MISC = 5; // misc after element + protected final static int PH_AFTER_DOC = 6; // after parsing + protected int mEvt; // current event type + protected final static int EV_NULL = 0; // unknown + protected final static int EV_ELM = 1; // empty element + protected final static int EV_ELMS = 2; // start element + protected final static int EV_ELME = 3; // end element + protected final static int EV_TEXT = 4; // textual content + protected final static int EV_WSPC = 5; // white space content + protected final static int EV_PI = 6; // processing instruction + protected final static int EV_CDAT = 7; // character data + protected final static int EV_COMM = 8; // comment + protected final static int EV_DTD = 9; // document type definition + protected final static int EV_ENT = 10; // skipped entity + private char mESt; // built-in entity recognizer state + // mESt values: + // 0x100 : the initial state + // > 0x100 : unrecognized name + // < 0x100 : replacement character + protected char[] mBuff; // parser buffer + protected int mBuffIdx; // index of the last char + protected Pair mPref; // stack of prefixes + protected Pair mElm; // stack of elements + // mAttL.chars - element qname + // mAttL.next - next element + // mAttL.list - list of attributes defined on this element + // mAttL.list.chars - attribute qname + // mAttL.list.id - a char representing attribute's type see below + // mAttL.list.next - next attribute defined on the element + // mAttL.list.list - devault value structure or null + // mAttL.list.list.chars - "name='value' " chars array for Input + // + // Attribute type character values: + // 'i' - "ID" + // 'r' - "IDREF" + // 'R' - "IDREFS" + // 'n' - "ENTITY" + // 'N' - "ENTITIES" + // 't' - "NMTOKEN" + // 'T' - "NMTOKENS" + // 'u' - enumeration type + // 'o' - "NOTATION" + // 'c' - "CDATA" + // see also: bkeyword() and atype() + // + protected Pair mAttL; // list of defined attrs by element name + protected Input mDoc; // document entity + protected Input mInp; // stack of entities + private char[] mChars; // reading buffer + private int mChLen; // current capacity + private int mChIdx; // index to the next char + protected Attrs mAttrs; // attributes of the curr. element + private String[] mItems; // attributes array of the curr. element + private char mAttrIdx; // attributes counter/index + private String mUnent; // unresolved entity name + private Pair mDltd; // deleted objects for reuse + /** + * Default prefixes + */ + private final static char NONS[]; + private final static char XML[]; + private final static char XMLNS[]; + + static { + NONS = new char[1]; + NONS[0] = (char) 0; + + XML = new char[4]; + XML[0] = (char) 4; + XML[1] = 'x'; + XML[2] = 'm'; + XML[3] = 'l'; + + XMLNS = new char[6]; + XMLNS[0] = (char) 6; + XMLNS[1] = 'x'; + XMLNS[2] = 'm'; + XMLNS[3] = 'l'; + XMLNS[4] = 'n'; + XMLNS[5] = 's'; + } + /** + * ASCII character type array. + * + * This array maps an ASCII (7 bit) character to the character type.
      + * Possible character type values are:
      - ' ' for any kind of white + * space character;
      - 'a' for any lower case alphabetical character + * value;
      - 'A' for any upper case alphabetical character value;
      + * - 'd' for any decimal digit character value;
      - 'z' for any + * character less then ' ' except '\t', '\n', '\r';
      An ASCII (7 bit) + * character which does not fall in any category listed above is mapped to + * it self. + */ + private static final byte asctyp[]; + /** + * NMTOKEN character type array. + * + * This array maps an ASCII (7 bit) character to the character type.
      + * Possible character type values are:
      - 0 for underscore ('_') or any + * lower and upper case alphabetical character value;
      - 1 for colon + * (':') character;
      - 2 for dash ('-') and dot ('.') or any decimal + * digit character value;
      - 3 for any kind of white space character
      An ASCII (7 bit) character which does not fall in any category listed + * above is mapped to 0xff. + */ + private static final byte nmttyp[]; + + /** + * Static constructor. + * + * Sets up the ASCII character type array which is used by + * {@link #asctyp asctyp} method and NMTOKEN character type array. + */ + static { + short i = 0; + + asctyp = new byte[0x80]; + while (i < ' ') { + asctyp[i++] = (byte) 'z'; + } + asctyp['\t'] = (byte) ' '; + asctyp['\r'] = (byte) ' '; + asctyp['\n'] = (byte) ' '; + while (i < '0') { + asctyp[i] = (byte) i++; + } + while (i <= '9') { + asctyp[i++] = (byte) 'd'; + } + while (i < 'A') { + asctyp[i] = (byte) i++; + } + while (i <= 'Z') { + asctyp[i++] = (byte) 'A'; + } + while (i < 'a') { + asctyp[i] = (byte) i++; + } + while (i <= 'z') { + asctyp[i++] = (byte) 'a'; + } + while (i < 0x80) { + asctyp[i] = (byte) i++; + } + + nmttyp = new byte[0x80]; + for (i = 0; i < '0'; i++) { + nmttyp[i] = (byte) 0xff; + } + while (i <= '9') { + nmttyp[i++] = (byte) 2; // digits + } + while (i < 'A') { + nmttyp[i++] = (byte) 0xff; + } + // skiped upper case alphabetical character are already 0 + for (i = '['; i < 'a'; i++) { + nmttyp[i] = (byte) 0xff; + } + // skiped lower case alphabetical character are already 0 + for (i = '{'; i < 0x80; i++) { + nmttyp[i] = (byte) 0xff; + } + nmttyp['_'] = 0; + nmttyp[':'] = 1; + nmttyp['.'] = 2; + nmttyp['-'] = 2; + nmttyp[' '] = 3; + nmttyp['\t'] = 3; + nmttyp['\r'] = 3; + nmttyp['\n'] = 3; + } + + /** + * Constructor. + */ + protected Parser() { + mPh = PH_BEFORE_DOC; // before parsing + + // Initialize the parser + mBuff = new char[BUFFSIZE_PARSER]; + mAttrs = new Attrs(); + + // Default namespace + mPref = pair(mPref); + mPref.name = ""; + mPref.value = ""; + mPref.chars = NONS; + mNoNS = mPref; // no namespace + // XML namespace + mPref = pair(mPref); + mPref.name = "xml"; + mPref.value = "http://www.w3.org/XML/1998/namespace"; + mPref.chars = XML; + mXml = mPref; // XML namespace + } + + /** + * Initializes parser's internals. Note, current input has to be set before + * this method is called. + */ + protected void init() { + mUnent = null; + mElm = null; + mPref = mXml; + mAttL = null; + mPEnt = new HashMap<>(); + mEnt = new HashMap<>(); + mDoc = mInp; // current input is document entity + mChars = mInp.chars; // use document entity buffer + mPh = PH_DOC_START; // the begining of the document + } + + /** + * Cleans up parser internal resources. + */ + protected void cleanup() { + // Default attributes + while (mAttL != null) { + while (mAttL.list != null) { + if (mAttL.list.list != null) { + del(mAttL.list.list); + } + mAttL.list = del(mAttL.list); + } + mAttL = del(mAttL); + } + // Element stack + while (mElm != null) { + mElm = del(mElm); + } + // Namespace prefixes + while (mPref != mXml) { + mPref = del(mPref); + } + // Inputs + while (mInp != null) { + pop(); + } + // Document reader + if ((mDoc != null) && (mDoc.src != null)) { + try { + mDoc.src.close(); + } catch (IOException ioe) { + } + } + mPEnt = null; + mEnt = null; + mDoc = null; + mPh = PH_AFTER_DOC; // before documnet processing + } + + /** + * Processes a portion of document. This method returns one of EV_* + * constants as an identifier of the portion of document have been read. + * + * @return Identifier of processed document portion. + * @exception Exception is parser specific exception form panic method. + * @exception IOException + */ + @SuppressWarnings("fallthrough") + protected int step() throws Exception { + mEvt = EV_NULL; + int st = 0; + while (mEvt == EV_NULL) { + char ch = (mChIdx < mChLen) ? mChars[mChIdx++] : getch(); + switch (st) { + case 0: // all sorts of markup (dispetcher) + if (ch != '<') { + bkch(); + mBuffIdx = -1; // clean parser buffer + st = 1; + break; + } + switch (getch()) { + case '/': // the end of the element content + mEvt = EV_ELME; + if (mElm == null) { + panic(FAULT); + } + // Check element's open/close tags balance + mBuffIdx = -1; // clean parser buffer + bname(mIsNSAware); + char[] chars = mElm.chars; + if (chars.length == (mBuffIdx + 1)) { + for (char i = 1; i <= mBuffIdx; i += 1) { + if (chars[i] != mBuff[i]) { + panic(FAULT); + } + } + } else { + panic(FAULT); + } + // Skip white spaces before '>' + if (wsskip() != '>') { + panic(FAULT); + } + getch(); // read '>' + break; + + case '!': // a comment or a CDATA + ch = getch(); + bkch(); + switch (ch) { + case '-': // must be a comment + mEvt = EV_COMM; + comm(); + break; + + case '[': // must be a CDATA section + mEvt = EV_CDAT; + cdat(); + break; + + default: // must be 'DOCTYPE' + mEvt = EV_DTD; + dtd(); + break; + } + break; + + case '?': // processing instruction + mEvt = EV_PI; + pi(); + break; + + default: // must be the first char of an xml name + bkch(); + // Read an element name and put it on top of the + // element stack + mElm = pair(mElm); // add new element to the stack + mElm.chars = qname(mIsNSAware); + mElm.name = mElm.local(); + mElm.id = (mElm.next != null) ? mElm.next.id : 0; // flags + mElm.num = 0; // namespace counter + // Find the list of defined attributs of the current + // element + Pair elm = find(mAttL, mElm.chars); + mElm.list = (elm != null) ? elm.list : null; + // Read attributes till the end of the element tag + mAttrIdx = 0; + Pair att = pair(null); + att.num = 0; // clear attribute's flags + attr(att); // get all attributes inc. defaults + del(att); + mElm.value = (mIsNSAware) ? rslv(mElm.chars) : null; + // Skip white spaces before '>' + switch (wsskip()) { + case '>': + getch(); // read '>' + mEvt = EV_ELMS; + break; + + case '/': + getch(); // read '/' + if (getch() != '>') // read '>' + { + panic(FAULT); + } + mEvt = EV_ELM; + break; + + default: + panic(FAULT); + } + break; + } + break; + + case 1: // read white space + switch (ch) { + case ' ': + case '\t': + case '\n': + bappend(ch); + break; + + case '\r': // EOL processing [#2.11] + if (getch() != '\n') { + bkch(); + } + bappend('\n'); + break; + + case '<': + mEvt = EV_WSPC; + bkch(); + bflash_ws(); + break; + + default: + bkch(); + st = 2; + break; + } + break; + + case 2: // read the text content of the element + switch (ch) { + case '&': + if (mUnent == null) { + // There was no unresolved entity on previous step. + if ((mUnent = ent('x')) != null) { + mEvt = EV_TEXT; + bkch(); // move back to ';' after entity name + setch('&'); // parser must be back on next step + bflash(); + } + } else { + // There was unresolved entity on previous step. + mEvt = EV_ENT; + skippedEnt(mUnent); + mUnent = null; + } + break; + + case '<': + mEvt = EV_TEXT; + bkch(); + bflash(); + break; + + case '\r': // EOL processing [#2.11] + if (getch() != '\n') { + bkch(); + } + bappend('\n'); + break; + + case EOS: + panic(FAULT); + + default: + bappend(ch); + break; + } + break; + + default: + panic(FAULT); + } + } + + return mEvt; + } + + /** + * Parses the document type declaration. + * + * @exception Exception is parser specific exception form panic method. + * @exception IOException + */ + private void dtd() throws Exception { + char ch; + String str = null; + String name = null; + Pair psid = null; + // read 'DOCTYPE' + if ("DOCTYPE".equals(name(false)) != true) { + panic(FAULT); + } + mPh = PH_DTD; // DTD + for (short st = 0; st >= 0;) { + ch = getch(); + switch (st) { + case 0: // read the document type name + if (chtyp(ch) != ' ') { + bkch(); + name = name(mIsNSAware); + wsskip(); + st = 1; // read 'PUPLIC' or 'SYSTEM' + } + break; + + case 1: // read 'PUPLIC' or 'SYSTEM' + switch (chtyp(ch)) { + case 'A': + bkch(); + psid = pubsys(' '); + st = 2; // skip spaces before internal subset + docType(name, psid.name, psid.value); + break; + + case '[': + bkch(); + st = 2; // skip spaces before internal subset + docType(name, null, null); + break; + + case '>': + bkch(); + st = 3; // skip spaces after internal subset + docType(name, null, null); + break; + + default: + panic(FAULT); + } + break; + + case 2: // skip spaces before internal subset + switch (chtyp(ch)) { + case '[': + // Process internal subset + dtdsub(); + st = 3; // skip spaces after internal subset + break; + + case '>': + // There is no internal subset + bkch(); + st = 3; // skip spaces after internal subset + break; + + case ' ': + // skip white spaces + break; + + default: + panic(FAULT); + } + break; + + case 3: // skip spaces after internal subset + switch (chtyp(ch)) { + case '>': + if (psid != null) { + // Report the DTD external subset + InputSource is = resolveEnt(name, psid.name, psid.value); + if (is != null) { + if (mIsSAlone == false) { + // Set the end of DTD external subset char + bkch(); + setch(']'); + // Set the DTD external subset InputSource + push(new Input(BUFFSIZE_READER)); + setinp(is); + mInp.pubid = psid.name; + mInp.sysid = psid.value; + // Parse the DTD external subset + dtdsub(); + } else { + // Unresolved DTD external subset + skippedEnt("[dtd]"); + // Release reader and stream + if (is.getCharacterStream() != null) { + try { + is.getCharacterStream().close(); + } catch (IOException ioe) { + } + } + if (is.getByteStream() != null) { + try { + is.getByteStream().close(); + } catch (IOException ioe) { + } + } + } + } else { + // Unresolved DTD external subset + skippedEnt("[dtd]"); + } + del(psid); + } + st = -1; // end of DTD + break; + + case ' ': + // skip white spaces + break; + + default: + panic(FAULT); + } + break; + + default: + panic(FAULT); + } + } + } + + /** + * Parses the document type declaration subset. + * + * @exception Exception is parser specific exception form panic method. + * @exception IOException + */ + private void dtdsub() throws Exception { + char ch; + for (short st = 0; st >= 0;) { + ch = getch(); + switch (st) { + case 0: // skip white spaces before a declaration + switch (chtyp(ch)) { + case '<': + ch = getch(); + switch (ch) { + case '?': + pi(); + break; + + case '!': + ch = getch(); + bkch(); + if (ch == '-') { + comm(); + break; + } + // A markup or an entity declaration + bntok(); + switch (bkeyword()) { + case 'n': + dtdent(); + break; + + case 'a': + dtdattl(); // parse attributes declaration + break; + + case 'e': + dtdelm(); // parse element declaration + break; + + case 'o': + dtdnot(); // parse notation declaration + break; + + default: + panic(FAULT); // unsupported markup declaration + break; + } + st = 1; // read the end of declaration + break; + + default: + panic(FAULT); + break; + } + break; + + case '%': + // A parameter entity reference + pent(' '); + break; + + case ']': + // End of DTD subset + st = -1; + break; + + case ' ': + // Skip white spaces + break; + + case 'Z': + // End of stream + if (getch() != ']') { + panic(FAULT); + } + st = -1; + break; + + default: + panic(FAULT); + } + break; + + case 1: // read the end of declaration + switch (ch) { + case '>': // there is no notation + st = 0; // skip white spaces before a declaration + break; + + case ' ': + case '\n': + case '\r': + case '\t': + // Skip white spaces + break; + + default: + panic(FAULT); + break; + } + break; + + default: + panic(FAULT); + } + } + } + + /** + * Parses an entity declaration. This method fills the general ( + * mEnt) and parameter + * ( + * mPEnt) entity look up table. + * + * @exception Exception is parser specific exception form panic method. + * @exception IOException + */ + @SuppressWarnings("fallthrough") + private void dtdent() throws Exception { + String str = null; + char[] val = null; + Input inp = null; + Pair ids = null; + char ch; + for (short st = 0; st >= 0;) { + ch = getch(); + switch (st) { + case 0: // skip white spaces before entity name + switch (chtyp(ch)) { + case ' ': + // Skip white spaces + break; + + case '%': + // Parameter entity or parameter entity declaration. + ch = getch(); + bkch(); + if (chtyp(ch) == ' ') { + // Parameter entity declaration. + wsskip(); + str = name(false); + switch (chtyp(wsskip())) { + case 'A': + // Read the external identifier + ids = pubsys(' '); + if (wsskip() == '>') { + // External parsed entity + if (mPEnt.containsKey(str) == false) { // [#4.2] + inp = new Input(); + inp.pubid = ids.name; + inp.sysid = ids.value; + mPEnt.put(str, inp); + } + } else { + panic(FAULT); + } + del(ids); + st = -1; // the end of declaration + break; + + case '\"': + case '\'': + // Read the parameter entity value + bqstr('d'); + // Create the parameter entity value + val = new char[mBuffIdx + 1]; + System.arraycopy(mBuff, 1, val, 1, val.length - 1); + // Add surrounding spaces [#4.4.8] + val[0] = ' '; + // Add the entity to the entity look up table + if (mPEnt.containsKey(str) == false) { // [#4.2] + inp = new Input(val); + inp.pubid = mInp.pubid; + inp.sysid = mInp.sysid; + inp.xmlenc = mInp.xmlenc; + inp.xmlver = mInp.xmlver; + mPEnt.put(str, inp); + } + st = -1; // the end of declaration + break; + + default: + panic(FAULT); + break; + } + } else { + // Parameter entity reference. + pent(' '); + } + break; + + default: + bkch(); + str = name(false); + st = 1; // read entity declaration value + break; + } + break; + + case 1: // read entity declaration value + switch (chtyp(ch)) { + case '\"': // internal entity + case '\'': + bkch(); + bqstr('d'); // read a string into the buffer + if (mEnt.get(str) == null) { + // Create general entity value + val = new char[mBuffIdx]; + System.arraycopy(mBuff, 1, val, 0, val.length); + // Add the entity to the entity look up table + if (mEnt.containsKey(str) == false) { // [#4.2] + inp = new Input(val); + inp.pubid = mInp.pubid; + inp.sysid = mInp.sysid; + inp.xmlenc = mInp.xmlenc; + inp.xmlver = mInp.xmlver; + mEnt.put(str, inp); + } + } + st = -1; // the end of declaration + break; + + case 'A': // external entity + bkch(); + ids = pubsys(' '); + switch (wsskip()) { + case '>': // external parsed entity + if (mEnt.containsKey(str) == false) { // [#4.2] + inp = new Input(); + inp.pubid = ids.name; + inp.sysid = ids.value; + mEnt.put(str, inp); + } + break; + + case 'N': // external general unparsed entity + if ("NDATA".equals(name(false)) == true) { + wsskip(); + unparsedEntDecl(str, ids.name, ids.value, name(false)); + break; + } + default: + panic(FAULT); + break; + } + del(ids); + st = -1; // the end of declaration + break; + + case ' ': + // Skip white spaces + break; + + default: + panic(FAULT); + break; + } + break; + + default: + panic(FAULT); + } + } + } + + /** + * Parses an element declaration. + * + * This method parses the declaration up to the closing angle bracket. + * + * @exception Exception is parser specific exception form panic method. + * @exception IOException + */ + @SuppressWarnings("fallthrough") + private void dtdelm() throws Exception { + // This is stub implementation which skips an element + // declaration. + wsskip(); + name(mIsNSAware); + + char ch; + while (true) { + ch = getch(); + switch (ch) { + case '>': + bkch(); + return; + + case EOS: + panic(FAULT); + + default: + break; + } + } + } + + /** + * Parses an attribute list declaration. + * + * This method parses the declaration up to the closing angle bracket. + * + * @exception Exception is parser specific exception form panic method. + * @exception IOException + */ + private void dtdattl() throws Exception { + char elmqn[] = null; + Pair elm = null; + char ch; + for (short st = 0; st >= 0;) { + ch = getch(); + switch (st) { + case 0: // read the element name + switch (chtyp(ch)) { + case 'a': + case 'A': + case '_': + case 'X': + case ':': + bkch(); + // Get the element from the list or add a new one. + elmqn = qname(mIsNSAware); + elm = find(mAttL, elmqn); + if (elm == null) { + elm = pair(mAttL); + elm.chars = elmqn; + mAttL = elm; + } + st = 1; // read an attribute declaration + break; + + case ' ': + break; + + case '%': + pent(' '); + break; + + default: + panic(FAULT); + break; + } + break; + + case 1: // read an attribute declaration + switch (chtyp(ch)) { + case 'a': + case 'A': + case '_': + case 'X': + case ':': + bkch(); + dtdatt(elm); + if (wsskip() == '>') { + return; + } + break; + + case ' ': + break; + + case '%': + pent(' '); + break; + + default: + panic(FAULT); + break; + } + break; + + default: + panic(FAULT); + break; + } + } + } + + /** + * Parses an attribute declaration. + * + * The attribute uses the following fields of Pair object: chars - characters + * of qualified name id - the type identifier of the attribute list - a pair + * which holds the default value (chars field) + * + * @param elm An object which represents all defined attributes on an + * element. + * @exception Exception is parser specific exception form panic method. + * @exception IOException + */ + @SuppressWarnings("fallthrough") + private void dtdatt(Pair elm) throws Exception { + char attqn[] = null; + Pair att = null; + char ch; + for (short st = 0; st >= 0;) { + ch = getch(); + switch (st) { + case 0: // the attribute name + switch (chtyp(ch)) { + case 'a': + case 'A': + case '_': + case 'X': + case ':': + bkch(); + // Get the attribut from the list or add a new one. + attqn = qname(mIsNSAware); + att = find(elm.list, attqn); + if (att == null) { + // New attribute declaration + att = pair(elm.list); + att.chars = attqn; + elm.list = att; + } else { + // Do not override the attribute declaration [#3.3] + att = pair(null); + att.chars = attqn; + att.id = 'c'; + } + wsskip(); + st = 1; + break; + + case '%': + pent(' '); + break; + + case ' ': + break; + + default: + panic(FAULT); + break; + } + break; + + case 1: // the attribute type + switch (chtyp(ch)) { + case '(': + att.id = 'u'; // enumeration type + st = 2; // read the first element of the list + break; + + case '%': + pent(' '); + break; + + case ' ': + break; + + default: + bkch(); + bntok(); // read type id + att.id = bkeyword(); + switch (att.id) { + case 'o': // NOTATION + if (wsskip() != '(') { + panic(FAULT); + } + ch = getch(); + st = 2; // read the first element of the list + break; + + case 'i': // ID + case 'r': // IDREF + case 'R': // IDREFS + case 'n': // ENTITY + case 'N': // ENTITIES + case 't': // NMTOKEN + case 'T': // NMTOKENS + case 'c': // CDATA + wsskip(); + st = 4; // read default declaration + break; + + default: + panic(FAULT); + break; + } + break; + } + break; + + case 2: // read the first element of the list + switch (chtyp(ch)) { + case 'a': + case 'A': + case 'd': + case '.': + case ':': + case '-': + case '_': + case 'X': + bkch(); + switch (att.id) { + case 'u': // enumeration type + bntok(); + break; + + case 'o': // NOTATION + mBuffIdx = -1; + bname(false); + break; + + default: + panic(FAULT); + break; + } + wsskip(); + st = 3; // read next element of the list + break; + + case '%': + pent(' '); + break; + + case ' ': + break; + + default: + panic(FAULT); + break; + } + break; + + case 3: // read next element of the list + switch (ch) { + case ')': + wsskip(); + st = 4; // read default declaration + break; + + case '|': + wsskip(); + switch (att.id) { + case 'u': // enumeration type + bntok(); + break; + + case 'o': // NOTATION + mBuffIdx = -1; + bname(false); + break; + + default: + panic(FAULT); + break; + } + wsskip(); + break; + + case '%': + pent(' '); + break; + + default: + panic(FAULT); + break; + } + break; + + case 4: // read default declaration + switch (ch) { + case '#': + bntok(); + switch (bkeyword()) { + case 'F': // FIXED + switch (wsskip()) { + case '\"': + case '\'': + st = 5; // read the default value + break; + + case EOS: + panic(FAULT); + + default: + st = -1; + break; + } + break; + + case 'Q': // REQUIRED + case 'I': // IMPLIED + st = -1; + break; + + default: + panic(FAULT); + break; + } + break; + + case '\"': + case '\'': + bkch(); + st = 5; // read the default value + break; + + case ' ': + case '\n': + case '\r': + case '\t': + break; + + case '%': + pent(' '); + break; + + default: + bkch(); + st = -1; + break; + } + break; + + case 5: // read the default value + switch (ch) { + case '\"': + case '\'': + bkch(); + bqstr('d'); // the value in the mBuff now + att.list = pair(null); + // Create a string like "attqname='value' " + att.list.chars = new char[att.chars.length + mBuffIdx + 3]; + System.arraycopy( + att.chars, 1, att.list.chars, 0, att.chars.length - 1); + att.list.chars[att.chars.length - 1] = '='; + att.list.chars[att.chars.length] = ch; + System.arraycopy( + mBuff, 1, att.list.chars, att.chars.length + 1, mBuffIdx); + att.list.chars[att.chars.length + mBuffIdx + 1] = ch; + att.list.chars[att.chars.length + mBuffIdx + 2] = ' '; + st = -1; + break; + + default: + panic(FAULT); + break; + } + break; + + default: + panic(FAULT); + break; + } + } + } + + /** + * Parses a notation declaration. + * + * This method parses the declaration up to the closing angle bracket. + * + * @exception Exception is parser specific exception form panic method. + * @exception IOException + */ + private void dtdnot() throws Exception { + wsskip(); + String name = name(false); + wsskip(); + Pair ids = pubsys('N'); + notDecl(name, ids.name, ids.value); + del(ids); + } + + /** + * Parses an attribute. + * + * This recursive method is responsible for prefix addition + * ( + * mPref) on the way down. The element's start tag end triggers + * the return process. The method then on it's way back resolves prefixes + * and accumulates attributes. + * + *

      att.num carries attribute flags where: 0x1 - attribute is + * declared in DTD (attribute decalration had been read); 0x2 - attribute's + * default value is used.

      + * + * @param att An object which reprecents current attribute. + * @exception Exception is parser specific exception form panic method. + * @exception IOException + */ + @SuppressWarnings("fallthrough") + private void attr(Pair att) throws Exception { + switch (wsskip()) { + case '/': + case '>': + if ((att.num & 0x2) == 0) { // all attributes have been read + att.num |= 0x2; // set default attribute flag + Input inp = mInp; + // Go through all attributes defined on current element. + for (Pair def = mElm.list; def != null; def = def.next) { + if (def.list == null) // no default value + { + continue; + } + // Go through all attributes defined on current + // element and add defaults. + Pair act = find(att.next, def.chars); + if (act == null) { + push(new Input(def.list.chars)); + } + } + if (mInp != inp) { // defaults have been added + attr(att); + return; + } + } + // Ensure the attribute string array capacity + mAttrs.setLength(mAttrIdx); + mItems = mAttrs.mItems; + return; + + case EOS: + panic(FAULT); + + default: + // Read the attribute name and value + att.chars = qname(mIsNSAware); + att.name = att.local(); + String type = atype(att); // sets attribute's type on att.id + wsskip(); + if (getch() != '=') { + panic(FAULT); + } + bqstr((char) att.id); // read the value with normalization. + String val = new String(mBuff, 1, mBuffIdx); + Pair next = pair(att); + next.num = (att.num & ~0x1); // inherit attribute flags + // Put a namespace declaration on top of the prefix stack + if ((mIsNSAware == false) || (isdecl(att, val) == false)) { + // An ordinary attribute + mAttrIdx++; + attr(next); // recursive call to parse the next attribute + mAttrIdx--; + // Add the attribute to the attributes string array + char idx = (char) (mAttrIdx << 3); + mItems[idx + 1] = att.qname(); // attr qname + mItems[idx + 2] = (mIsNSAware) ? att.name : ""; // attr local name + mItems[idx + 3] = val; // attr value + mItems[idx + 4] = type; // attr type + switch (att.num & 0x3) { + case 0x0: + mItems[idx + 5] = null; + break; + + case 0x1: // declared attribute + mItems[idx + 5] = "d"; + break; + + default: // 0x2, 0x3 - default attribute always declared + mItems[idx + 5] = "D"; + break; + } + // Resolve the prefix if any and report the attribute + // NOTE: The attribute does not accept the default namespace. + mItems[idx + 0] = (att.chars[0] != 0) ? rslv(att.chars) : ""; + } else { + // A namespace declaration. mPref.name contains prefix and + // mPref.value contains namespace URI set by isdecl method. + // Report a start of the new mapping + newPrefix(); + // Recursive call to parse the next attribute + attr(next); + // NOTE: The namespace declaration is not reported. + } + del(next); + break; + } + } + + /** + * Retrieves attribute type. + * + * This method sets the type of normalization in the attribute + * id field and returns the name of attribute type. + * + * @param att An object which represents current attribute. + * @return The name of the attribute type. + * @exception Exception is parser specific exception form panic method. + */ + private String atype(Pair att) + throws Exception { + Pair attr; + + // CDATA-type normalization by default [#3.3.3] + att.id = 'c'; + if (mElm.list == null || (attr = find(mElm.list, att.chars)) == null) { + return "CDATA"; + } + + att.num |= 0x1; // attribute is declared + + // Non-CDATA normalization except when the attribute type is CDATA. + att.id = 'i'; + switch (attr.id) { + case 'i': + return "ID"; + + case 'r': + return "IDREF"; + + case 'R': + return "IDREFS"; + + case 'n': + return "ENTITY"; + + case 'N': + return "ENTITIES"; + + case 't': + return "NMTOKEN"; + + case 'T': + return "NMTOKENS"; + + case 'u': + return "NMTOKEN"; + + case 'o': + return "NOTATION"; + + case 'c': + att.id = 'c'; + return "CDATA"; + + default: + panic(FAULT); + } + return null; + } + + /** + * Parses a comment. + * + * The '<!' part is read in dispatcher so the method starts + * with first '-' after '<!'. + * + * @exception Exception is parser specific exception form panic method. + */ + @SuppressWarnings("fallthrough") + private void comm() throws Exception { + if (mPh == PH_DOC_START) { + mPh = PH_MISC_DTD; // misc before DTD + } // '= 0;) { + ch = (mChIdx < mChLen) ? mChars[mChIdx++] : getch(); + if (ch == EOS) { + panic(FAULT); + } + switch (st) { + case 0: // first '-' of the comment open + if (ch == '-') { + st = 1; + } else { + panic(FAULT); + } + break; + + case 1: // secind '-' of the comment open + if (ch == '-') { + st = 2; + } else { + panic(FAULT); + } + break; + + case 2: // skip the comment body + switch (ch) { + case '-': + st = 3; + break; + + default: + bappend(ch); + break; + } + break; + + case 3: // second '-' of the comment close + switch (ch) { + case '-': + st = 4; + break; + + default: + bappend('-'); + bappend(ch); + st = 2; + break; + } + break; + + case 4: // '>' of the comment close + if (ch == '>') { + comm(mBuff, mBuffIdx + 1); + st = -1; + break; + } + // else - panic [#2.5 compatibility note] + + default: + panic(FAULT); + } + } + } + + /** + * Parses a processing instruction. + * + * The '<?' is read in dispatcher so the method starts with + * first character of PI target name after '<?'. + * + * @exception Exception is parser specific exception form panic method. + * @exception IOException + */ + private void pi() throws Exception { + // '= 0;) { + ch = getch(); + if (ch == EOS) { + panic(FAULT); + } + switch (st) { + case 0: // read the PI target name + switch (chtyp(ch)) { + case 'a': + case 'A': + case '_': + case ':': + case 'X': + bkch(); + str = name(false); + // PI target name may not be empty string [#2.6] + // PI target name 'XML' is reserved [#2.6] + if ((str.length() == 0) + || (mXml.name.equals(str.toLowerCase()) == true)) { + panic(FAULT); + } + // This is processing instruction + if (mPh == PH_DOC_START) // the begining of the document + { + mPh = PH_MISC_DTD; // misc before DTD + } + wsskip(); // skip spaces after the PI target name + st = 1; // accumulate the PI body + mBuffIdx = -1; + break; + + default: + panic(FAULT); + } + break; + + case 1: // accumulate the PI body + switch (ch) { + case '?': + st = 2; // end of the PI body + break; + + default: + bappend(ch); + break; + } + break; + + case 2: // end of the PI body + switch (ch) { + case '>': + // PI has been read. + pi(str, new String(mBuff, 0, mBuffIdx + 1)); + st = -1; + break; + + case '?': + bappend('?'); + break; + + default: + bappend('?'); + bappend(ch); + st = 1; // accumulate the PI body + break; + } + break; + + default: + panic(FAULT); + } + } + } + + /** + * Parses a character data. + * + * The '<!' part is read in dispatcher so the method starts + * with first '[' after '<!'. + * + * @exception Exception is parser specific exception form panic method. + * @exception IOException + */ + private void cdat() + throws Exception { + // '= 0;) { + ch = getch(); + switch (st) { + case 0: // the first '[' of the CDATA open + if (ch == '[') { + st = 1; + } else { + panic(FAULT); + } + break; + + case 1: // read "CDATA" + if (chtyp(ch) == 'A') { + bappend(ch); + } else { + if ("CDATA".equals( + new String(mBuff, 0, mBuffIdx + 1)) != true) { + panic(FAULT); + } + bkch(); + st = 2; + } + break; + + case 2: // the second '[' of the CDATA open + if (ch != '[') { + panic(FAULT); + } + mBuffIdx = -1; + st = 3; + break; + + case 3: // read data before the first ']' + if (ch != ']') { + bappend(ch); + } else { + st = 4; + } + break; + + case 4: // read the second ']' or continue to read the data + if (ch != ']') { + bappend(']'); + bappend(ch); + st = 3; + } else { + st = 5; + } + break; + + case 5: // read '>' or continue to read the data + switch (ch) { + case ']': + bappend(']'); + break; + + case '>': + bflash(); + st = -1; + break; + + default: + bappend(']'); + bappend(']'); + bappend(ch); + st = 3; + break; + } + break; + + default: + panic(FAULT); + } + } + } + + /** + * Reads a xml name. + * + * The xml name must conform "Namespaces in XML" specification. Therefore + * the ':' character is not allowed in the name. This method should be used + * for PI and entity names which may not have a namespace according to the + * specification mentioned above. + * + * @param ns The true value turns namespace conformance on. + * @return The name has been read. + * @exception Exception When incorrect character appear in the name. + * @exception IOException + */ + protected String name(boolean ns) + throws Exception { + mBuffIdx = -1; + bname(ns); + return new String(mBuff, 1, mBuffIdx); + } + + /** + * Reads a qualified xml name. + * + * The characters of a qualified name is an array of characters. The first + * (chars[0]) character is the index of the colon character which separates + * the prefix from the local name. If the index is zero, the name does not + * contain separator or the parser works in the namespace unaware mode. The + * length of qualified name is the length of the array minus one. + * + * @param ns The true value turns namespace conformance on. + * @return The characters of a qualified name. + * @exception Exception When incorrect character appear in the name. + * @exception IOException + */ + protected char[] qname(boolean ns) + throws Exception { + mBuffIdx = -1; + bname(ns); + char chars[] = new char[mBuffIdx + 1]; + System.arraycopy(mBuff, 0, chars, 0, mBuffIdx + 1); + return chars; + } + + /** + * Reads the public or/and system identifiers. + * + * @param inp The input object. + * @exception Exception is parser specific exception form panic method. + * @exception IOException + */ + private void pubsys(Input inp) + throws Exception { + Pair pair = pubsys(' '); + inp.pubid = pair.name; + inp.sysid = pair.value; + del(pair); + } + + /** + * Reads the public or/and system identifiers. + * + * @param flag The 'N' allows public id be without system id. + * @return The public or/and system identifiers pair. + * @exception Exception is parser specific exception form panic method. + * @exception IOException + */ + @SuppressWarnings("fallthrough") + private Pair pubsys(char flag) throws Exception { + Pair ids = pair(null); + String str = name(false); + if ("PUBLIC".equals(str) == true) { + bqstr('i'); // non-CDATA normalization [#4.2.2] + ids.name = new String(mBuff, 1, mBuffIdx); + switch (wsskip()) { + case '\"': + case '\'': + bqstr(' '); + ids.value = new String(mBuff, 1, mBuffIdx); + break; + + case EOS: + panic(FAULT); + + default: + if (flag != 'N') // [#4.7] + { + panic(FAULT); + } + ids.value = null; + break; + } + return ids; + } else if ("SYSTEM".equals(str) == true) { + ids.name = null; + bqstr(' '); + ids.value = new String(mBuff, 1, mBuffIdx); + return ids; + } + panic(FAULT); + return null; + } + + /** + * Reads an attribute value. + * + * The grammar which this method can read is:
      + * eqstr := S "=" qstr
      + * qstr := S ("'" string "'") | + * ('"' string '"')
      This method resolves entities + * inside a string unless the parser parses DTD. + * + * @param flag The '=' character forces the method to accept the '=' + * character before quoted string and read the following string as not an + * attribute ('-'), 'c' - CDATA, 'i' - non CDATA, ' ' - no normalization; + * '-' - not an attribute value; 'd' - in DTD context. + * @return The content of the quoted strign as a string. + * @exception Exception is parser specific exception form panic method. + * @exception IOException + */ + protected String eqstr(char flag) throws Exception { + if (flag == '=') { + wsskip(); + if (getch() != '=') { + panic(FAULT); + } + } + bqstr((flag == '=') ? '-' : flag); + return new String(mBuff, 1, mBuffIdx); + } + + /** + * Resoves an entity. + * + * This method resolves built-in and character entity references. It is also + * reports external entities to the application. + * + * @param flag The 'x' character forces the method to report a skipped + * entity; 'i' character - indicates non-CDATA normalization. + * @return Name of unresolved entity or null if entity had been + * resolved successfully. + * @exception Exception is parser specific exception form panic method. + * @exception IOException + */ + @SuppressWarnings("fallthrough") + private String ent(char flag) throws Exception { + char ch; + int idx = mBuffIdx + 1; + Input inp = null; + String str = null; + mESt = 0x100; // reset the built-in entity recognizer + bappend('&'); + for (short st = 0; st >= 0;) { + ch = (mChIdx < mChLen) ? mChars[mChIdx++] : getch(); + switch (st) { + case 0: // the first character of the entity name + case 1: // read built-in entity name + switch (chtyp(ch)) { + case 'd': + case '.': + case '-': + if (st != 1) { + panic(FAULT); + } + case 'a': + case 'A': + case '_': + case 'X': + bappend(ch); + eappend(ch); + st = 1; + break; + + case ':': + if (mIsNSAware != false) { + panic(FAULT); + } + bappend(ch); + eappend(ch); + st = 1; + break; + + case ';': + if (mESt < 0x100) { + // The entity is a built-in entity + mBuffIdx = idx - 1; + bappend(mESt); + st = -1; + break; + } else if (mPh == PH_DTD) { + // In DTD entity declaration has to resolve character + // entities and include "as is" others. [#4.4.7] + bappend(';'); + st = -1; + break; + } + // Convert an entity name to a string + str = new String(mBuff, idx + 1, mBuffIdx - idx); + inp = mEnt.get(str); + // Restore the buffer offset + mBuffIdx = idx - 1; + if (inp != null) { + if (inp.chars == null) { + // External entity + InputSource is = resolveEnt(str, inp.pubid, inp.sysid); + if (is != null) { + push(new Input(BUFFSIZE_READER)); + setinp(is); + mInp.pubid = inp.pubid; + mInp.sysid = inp.sysid; + str = null; // the entity is resolved + } else { + // Unresolved external entity + if (flag != 'x') { + panic(FAULT); // unknown entity within marckup + } // str is name of unresolved entity + } + } else { + // Internal entity + push(inp); + str = null; // the entity is resolved + } + } else { + // Unknown or general unparsed entity + if (flag != 'x') { + panic(FAULT); // unknown entity within marckup + } // str is name of unresolved entity + } + st = -1; + break; + + case '#': + if (st != 0) { + panic(FAULT); + } + st = 2; + break; + + default: + panic(FAULT); + } + break; + + case 2: // read character entity + switch (chtyp(ch)) { + case 'd': + bappend(ch); + break; + + case ';': + // Convert the character entity to a character + try { + int i = Integer.parseInt( + new String(mBuff, idx + 1, mBuffIdx - idx), 10); + if (i >= 0xffff) { + panic(FAULT); + } + ch = (char) i; + } catch (NumberFormatException nfe) { + panic(FAULT); + } + // Restore the buffer offset + mBuffIdx = idx - 1; + if (ch == ' ' || mInp.next != null) { + bappend(ch, flag); + } else { + bappend(ch); + } + st = -1; + break; + + case 'a': + // If the entity buffer is empty and ch == 'x' + if ((mBuffIdx == idx) && (ch == 'x')) { + st = 3; + break; + } + default: + panic(FAULT); + } + break; + + case 3: // read hex character entity + switch (chtyp(ch)) { + case 'A': + case 'a': + case 'd': + bappend(ch); + break; + + case ';': + // Convert the character entity to a character + try { + int i = Integer.parseInt( + new String(mBuff, idx + 1, mBuffIdx - idx), 16); + if (i >= 0xffff) { + panic(FAULT); + } + ch = (char) i; + } catch (NumberFormatException nfe) { + panic(FAULT); + } + // Restore the buffer offset + mBuffIdx = idx - 1; + if (ch == ' ' || mInp.next != null) { + bappend(ch, flag); + } else { + bappend(ch); + } + st = -1; + break; + + default: + panic(FAULT); + } + break; + + default: + panic(FAULT); + } + } + + return str; + } + + /** + * Resoves a parameter entity. + * + * This method resolves a parameter entity references. It is also reports + * external entities to the application. + * + * @param flag The '-' instruct the method to do not set up surrounding + * spaces [#4.4.8]. + * @exception Exception is parser specific exception form panic method. + * @exception IOException + */ + @SuppressWarnings("fallthrough") + private void pent(char flag) throws Exception { + char ch; + int idx = mBuffIdx + 1; + Input inp = null; + String str = null; + bappend('%'); + if (mPh != PH_DTD) // the DTD internal subset + { + return; // Not Recognized [#4.4.1] + } // Read entity name + bname(false); + str = new String(mBuff, idx + 2, mBuffIdx - idx - 1); + if (getch() != ';') { + panic(FAULT); + } + inp = mPEnt.get(str); + // Restore the buffer offset + mBuffIdx = idx - 1; + if (inp != null) { + if (inp.chars == null) { + // External parameter entity + InputSource is = resolveEnt(str, inp.pubid, inp.sysid); + if (is != null) { + if (flag != '-') { + bappend(' '); // tail space + } + push(new Input(BUFFSIZE_READER)); + // BUG: there is no leading space! [#4.4.8] + setinp(is); + mInp.pubid = inp.pubid; + mInp.sysid = inp.sysid; + } else { + // Unresolved external parameter entity + skippedEnt("%" + str); + } + } else { + // Internal parameter entity + if (flag == '-') { + // No surrounding spaces + inp.chIdx = 1; + } else { + // Insert surrounding spaces + bappend(' '); // tail space + inp.chIdx = 0; + } + push(inp); + } + } else { + // Unknown parameter entity + skippedEnt("%" + str); + } + } + + /** + * Recognizes and handles a namespace declaration. + * + * This method identifies a type of namespace declaration if any and puts + * new mapping on top of prefix stack. + * + * @param name The attribute qualified name (name.value is a + * String object which represents the attribute prefix). + * @param value The attribute value. + * @return true if a namespace declaration is recognized. + */ + private boolean isdecl(Pair name, String value) { + if (name.chars[0] == 0) { + if ("xmlns".equals(name.name) == true) { + // New default namespace declaration + mPref = pair(mPref); + mPref.list = mElm; // prefix owner element + mPref.value = value; + mPref.name = ""; + mPref.chars = NONS; + mElm.num++; // namespace counter + return true; + } + } else { + if (name.eqpref(XMLNS) == true) { + // New prefix declaration + int len = name.name.length(); + mPref = pair(mPref); + mPref.list = mElm; // prefix owner element + mPref.value = value; + mPref.name = name.name; + mPref.chars = new char[len + 1]; + mPref.chars[0] = (char) (len + 1); + name.name.getChars(0, len, mPref.chars, 1); + mElm.num++; // namespace counter + return true; + } + } + return false; + } + + /** + * Resolves a prefix. + * + * @return The namespace assigned to the prefix. + * @exception Exception When mapping for specified prefix is not found. + */ + private String rslv(char[] qname) + throws Exception { + for (Pair pref = mPref; pref != null; pref = pref.next) { + if (pref.eqpref(qname) == true) { + return pref.value; + } + } + if (qname[0] == 1) { // QNames like ':local' + for (Pair pref = mPref; pref != null; pref = pref.next) { + if (pref.chars[0] == 0) { + return pref.value; + } + } + } + panic(FAULT); + return null; + } + + /** + * Skips xml white space characters. + * + * This method skips white space characters (' ', '\t', '\n', '\r') and + * looks ahead not white space character. + * + * @return The first not white space look ahead character. + * @exception IOException + */ + protected char wsskip() + throws IOException { + char ch; + while (true) { + // Read next character + ch = (mChIdx < mChLen) ? mChars[mChIdx++] : getch(); + if (ch < 0x80) { + if (nmttyp[ch] != 3) // [ \t\n\r] + { + break; + } + } else { + break; + } + } + mChIdx--; // bkch(); + return ch; + } + + /** + * Reports document type. + * + * @param name The name of the entity. + * @param pubid The public identifier of the entity or null. + * @param sysid The system identifier of the entity or null. + */ + protected abstract void docType(String name, String pubid, String sysid) + throws SAXException; + + /** + * Reports a comment. + * + * @param text The comment text starting from first charcater. + * @param length The number of characters in comment. + */ + protected abstract void comm(char[] text, int length); + + /** + * Reports a processing instruction. + * + * @param target The processing instruction target name. + * @param body The processing instruction body text. + */ + protected abstract void pi(String target, String body) + throws Exception; + + /** + * Reports new namespace prefix. The Namespace prefix ( + * mPref.name) being declared and the Namespace URI ( + * mPref.value) the prefix is mapped to. An empty string is + * used for the default element namespace, which has no prefix. + */ + protected abstract void newPrefix() + throws Exception; + + /** + * Reports skipped entity name. + * + * @param name The entity name. + */ + protected abstract void skippedEnt(String name) + throws Exception; + + /** + * Returns an + * InputSource for specified entity or + * null. + * + * @param name The name of the entity. + * @param pubid The public identifier of the entity. + * @param sysid The system identifier of the entity. + */ + protected abstract InputSource resolveEnt( + String name, String pubid, String sysid) + throws Exception; + + /** + * Reports notation declaration. + * + * @param name The notation's name. + * @param pubid The notation's public identifier, or null if none was given. + * @param sysid The notation's system identifier, or null if none was given. + */ + protected abstract void notDecl(String name, String pubid, String sysid) + throws Exception; + + /** + * Reports unparsed entity name. + * + * @param name The unparsed entity's name. + * @param pubid The entity's public identifier, or null if none was given. + * @param sysid The entity's system identifier. + * @param notation The name of the associated notation. + */ + protected abstract void unparsedEntDecl( + String name, String pubid, String sysid, String notation) + throws Exception; + + /** + * Notifies the handler about fatal parsing error. + * + * @param msg The problem description message. + */ + protected abstract void panic(String msg) + throws Exception; + + /** + * Reads a qualified xml name. + * + * This is low level routine which leaves a qName in the buffer. The + * characters of a qualified name is an array of characters. The first + * (chars[0]) character is the index of the colon character which separates + * the prefix from the local name. If the index is zero, the name does not + * contain separator or the parser works in the namespace unaware mode. The + * length of qualified name is the length of the array minus one. + * + * @param ns The true value turns namespace conformance on. + * @exception Exception is parser specific exception form panic method. + * @exception IOException + */ + private void bname(boolean ns) + throws Exception { + char ch; + char type; + mBuffIdx++; // allocate a char for colon offset + int bqname = mBuffIdx; + int bcolon = bqname; + int bchidx = bqname + 1; + int bstart = bchidx; + int cstart = mChIdx; + short st = (short) ((ns == true) ? 0 : 2); + while (true) { + // Read next character + if (mChIdx >= mChLen) { + bcopy(cstart, bstart); + getch(); + mChIdx--; // bkch(); + cstart = mChIdx; + bstart = bchidx; + } + ch = mChars[mChIdx++]; + type = (char) 0; // [X] + if (ch < 0x80) { + type = (char) nmttyp[ch]; + } else if (ch == EOS) { + panic(FAULT); + } + // Parse QName + switch (st) { + case 0: // read the first char of the prefix + case 2: // read the first char of the suffix + switch (type) { + case 0: // [aA_X] + bchidx++; // append char to the buffer + st++; // (st == 0)? 1: 3; + break; + + case 1: // [:] + mChIdx--; // bkch(); + st++; // (st == 0)? 1: 3; + break; + + default: + panic(FAULT); + } + break; + + case 1: // read the prefix + case 3: // read the suffix + switch (type) { + case 0: // [aA_X] + case 2: // [.-d] + bchidx++; // append char to the buffer + break; + + case 1: // [:] + bchidx++; // append char to the buffer + if (ns == true) { + if (bcolon != bqname) { + panic(FAULT); // it must be only one colon + } + bcolon = bchidx - 1; + if (st == 1) { + st = 2; + } + } + break; + + default: + mChIdx--; // bkch(); + bcopy(cstart, bstart); + mBuff[bqname] = (char) (bcolon - bqname); + return; + } + break; + + default: + panic(FAULT); + } + } + } + + /** + * Reads a nmtoken. + * + * This is low level routine which leaves a nmtoken in the buffer. + * + * @exception Exception is parser specific exception form panic method. + * @exception IOException + */ + @SuppressWarnings("fallthrough") + private void bntok() throws Exception { + char ch; + mBuffIdx = -1; + bappend((char) 0); // default offset to the colon char + while (true) { + ch = getch(); + switch (chtyp(ch)) { + case 'a': + case 'A': + case 'd': + case '.': + case ':': + case '-': + case '_': + case 'X': + bappend(ch); + break; + + case 'Z': + panic(FAULT); + + default: + bkch(); + return; + } + } + } + + /** + * Recognizes a keyword. + * + * This is low level routine which recognizes one of keywords in the buffer. + * Keyword Id ID - i IDREF - r IDREFS - R ENTITY - n ENTITIES - N NMTOKEN - + * t NMTOKENS - T ELEMENT - e ATTLIST - a NOTATION - o CDATA - c REQUIRED - + * Q IMPLIED - I FIXED - F + * + * @return an id of a keyword or '?'. + * @exception Exception is parser specific exception form panic method. + * @exception IOException + */ + private char bkeyword() + throws Exception { + String str = new String(mBuff, 1, mBuffIdx); + switch (str.length()) { + case 2: // ID + return ("ID".equals(str) == true) ? 'i' : '?'; + + case 5: // IDREF, CDATA, FIXED + switch (mBuff[1]) { + case 'I': + return ("IDREF".equals(str) == true) ? 'r' : '?'; + case 'C': + return ("CDATA".equals(str) == true) ? 'c' : '?'; + case 'F': + return ("FIXED".equals(str) == true) ? 'F' : '?'; + default: + break; + } + break; + + case 6: // IDREFS, ENTITY + switch (mBuff[1]) { + case 'I': + return ("IDREFS".equals(str) == true) ? 'R' : '?'; + case 'E': + return ("ENTITY".equals(str) == true) ? 'n' : '?'; + default: + break; + } + break; + + case 7: // NMTOKEN, IMPLIED, ATTLIST, ELEMENT + switch (mBuff[1]) { + case 'I': + return ("IMPLIED".equals(str) == true) ? 'I' : '?'; + case 'N': + return ("NMTOKEN".equals(str) == true) ? 't' : '?'; + case 'A': + return ("ATTLIST".equals(str) == true) ? 'a' : '?'; + case 'E': + return ("ELEMENT".equals(str) == true) ? 'e' : '?'; + default: + break; + } + break; + + case 8: // ENTITIES, NMTOKENS, NOTATION, REQUIRED + switch (mBuff[2]) { + case 'N': + return ("ENTITIES".equals(str) == true) ? 'N' : '?'; + case 'M': + return ("NMTOKENS".equals(str) == true) ? 'T' : '?'; + case 'O': + return ("NOTATION".equals(str) == true) ? 'o' : '?'; + case 'E': + return ("REQUIRED".equals(str) == true) ? 'Q' : '?'; + default: + break; + } + break; + + default: + break; + } + return '?'; + } + + /** + * Reads a single or double quotted string in to the buffer. + * + * This method resolves entities inside a string unless the parser parses + * DTD. + * + * @param flag 'c' - CDATA, 'i' - non CDATA, ' ' - no normalization; '-' - + * not an attribute value; 'd' - in DTD context. + * @exception Exception is parser specific exception form panic method. + * @exception IOException + */ + @SuppressWarnings("fallthrough") + private void bqstr(char flag) throws Exception { + Input inp = mInp; // remember the original input + mBuffIdx = -1; + bappend((char) 0); // default offset to the colon char + char ch; + for (short st = 0; st >= 0;) { + ch = (mChIdx < mChLen) ? mChars[mChIdx++] : getch(); + switch (st) { + case 0: // read a single or double quote + switch (ch) { + case ' ': + case '\n': + case '\r': + case '\t': + break; + + case '\'': + st = 2; // read a single quoted string + break; + + case '\"': + st = 3; // read a double quoted string + break; + + default: + panic(FAULT); + break; + } + break; + + case 2: // read a single quoted string + case 3: // read a double quoted string + switch (ch) { + case '\'': + if ((st == 2) && (mInp == inp)) { + st = -1; + } else { + bappend(ch); + } + break; + + case '\"': + if ((st == 3) && (mInp == inp)) { + st = -1; + } else { + bappend(ch); + } + break; + + case '&': + if (flag != 'd') { + ent(flag); + } else { + bappend(ch); + } + break; + + case '%': + if (flag == 'd') { + pent('-'); + } else { + bappend(ch); + } + break; + + case '<': + if ((flag == '-') || (flag == 'd')) { + bappend(ch); + } else { + panic(FAULT); + } + break; + + case EOS: // EOS before single/double quote + panic(FAULT); + + case '\r': // EOL processing [#2.11 & #3.3.3] + if (flag != ' ' && mInp.next == null) { + if (getch() != '\n') { + bkch(); + } + ch = '\n'; + } + default: + bappend(ch, flag); + break; + } + break; + + default: + panic(FAULT); + } + } + // There is maximum one space at the end of the string in + // i-mode (non CDATA normalization) and it has to be removed. + if ((flag == 'i') && (mBuff[mBuffIdx] == ' ')) { + mBuffIdx -= 1; + } + } + + /** + * Reports characters and empties the parser's buffer. This method is called + * only if parser is going to return control to the main loop. This means + * that this method may use parser buffer to report white space without + * copeing characters to temporary buffer. + */ + protected abstract void bflash() + throws Exception; + + /** + * Reports white space characters and empties the parser's buffer. This + * method is called only if parser is going to return control to the main + * loop. This means that this method may use parser buffer to report white + * space without copeing characters to temporary buffer. + */ + protected abstract void bflash_ws() + throws Exception; + + /** + * Appends a character to parser's buffer with normalization. + * + * @param ch The character to append to the buffer. + * @param mode The normalization mode. + */ + private void bappend(char ch, char mode) { + // This implements attribute value normalization as + // described in the XML specification [#3.3.3]. + switch (mode) { + case 'i': // non CDATA normalization + switch (ch) { + case ' ': + case '\n': + case '\r': + case '\t': + if ((mBuffIdx > 0) && (mBuff[mBuffIdx] != ' ')) { + bappend(' '); + } + return; + + default: + break; + } + break; + + case 'c': // CDATA normalization + switch (ch) { + case '\n': + case '\r': + case '\t': + ch = ' '; + break; + + default: + break; + } + break; + + default: // no normalization + break; + } + mBuffIdx++; + if (mBuffIdx < mBuff.length) { + mBuff[mBuffIdx] = ch; + } else { + mBuffIdx--; + bappend(ch); + } + } + + /** + * Appends a character to parser's buffer. + * + * @param ch The character to append to the buffer. + */ + private void bappend(char ch) { + try { + mBuff[++mBuffIdx] = ch; + } catch (Exception exp) { + // Double the buffer size + char buff[] = new char[mBuff.length << 1]; + System.arraycopy(mBuff, 0, buff, 0, mBuff.length); + mBuff = buff; + mBuff[mBuffIdx] = ch; + } + } + + /** + * Appends (mChIdx - cidx) characters from character buffer (mChars) to + * parser's buffer (mBuff). + * + * @param cidx The character buffer (mChars) start index. + * @param bidx The parser buffer (mBuff) start index. + */ + private void bcopy(int cidx, int bidx) { + int length = mChIdx - cidx; + if ((bidx + length + 1) >= mBuff.length) { + // Expand the buffer + char buff[] = new char[mBuff.length + length]; + System.arraycopy(mBuff, 0, buff, 0, mBuff.length); + mBuff = buff; + } + System.arraycopy(mChars, cidx, mBuff, bidx, length); + mBuffIdx += length; + } + + /** + * Recognizes the built-in entities lt, gt, amp, + * apos, quot. The initial state is 0x100. Any state belowe + * 0x100 is a built-in entity replacement character. + * + * @param ch the next character of an entity name. + */ + @SuppressWarnings("fallthrough") + private void eappend(char ch) { + switch (mESt) { + case 0x100: // "l" or "g" or "a" or "q" + switch (ch) { + case 'l': + mESt = 0x101; + break; + case 'g': + mESt = 0x102; + break; + case 'a': + mESt = 0x103; + break; + case 'q': + mESt = 0x107; + break; + default: + mESt = 0x200; + break; + } + break; + + case 0x101: // "lt" + mESt = (ch == 't') ? '<' : (char) 0x200; + break; + + case 0x102: // "gt" + mESt = (ch == 't') ? '>' : (char) 0x200; + break; + + case 0x103: // "am" or "ap" + switch (ch) { + case 'm': + mESt = 0x104; + break; + case 'p': + mESt = 0x105; + break; + default: + mESt = 0x200; + break; + } + break; + + case 0x104: // "amp" + mESt = (ch == 'p') ? '&' : (char) 0x200; + break; + + case 0x105: // "apo" + mESt = (ch == 'o') ? (char) 0x106 : (char) 0x200; + break; + + case 0x106: // "apos" + mESt = (ch == 's') ? '\'' : (char) 0x200; + break; + + case 0x107: // "qu" + mESt = (ch == 'u') ? (char) 0x108 : (char) 0x200; + break; + + case 0x108: // "quo" + mESt = (ch == 'o') ? (char) 0x109 : (char) 0x200; + break; + + case 0x109: // "quot" + mESt = (ch == 't') ? '\"' : (char) 0x200; + break; + + case '<': // "lt" + case '>': // "gt" + case '&': // "amp" + case '\'': // "apos" + case '\"': // "quot" + mESt = 0x200; + default: + break; + } + } + + /** + * Sets up a new input source on the top of the input stack. Note, the first + * byte returned by the entity's byte stream has to be the first byte in the + * entity. However, the parser does not expect the byte order mask in both + * cases when encoding is provided by the input source. + * + * @param is A new input source to set up. + * @exception IOException If any IO errors occur. + * @exception Exception is parser specific exception form panic method. + */ + protected void setinp(InputSource is) + throws Exception { + Reader reader = null; + mChIdx = 0; + mChLen = 0; + mChars = mInp.chars; + mInp.src = null; + if (mPh < PH_DOC_START) { + mIsSAlone = false; // default [#2.9] + } + mIsSAloneSet = false; + if (is.getCharacterStream() != null) { + // Ignore encoding in the xml text decl. + reader = is.getCharacterStream(); + xml(reader); + } else if (is.getByteStream() != null) { + String expenc; + if (is.getEncoding() != null) { + // Ignore encoding in the xml text decl. + expenc = is.getEncoding().toUpperCase(); + if (expenc.equals("UTF-16")) { + reader = bom(is.getByteStream(), 'U'); // UTF-16 [#4.3.3] + } else { + reader = enc(expenc, is.getByteStream()); + } + xml(reader); + } else { + // Get encoding from BOM or the xml text decl. + reader = bom(is.getByteStream(), ' '); + if (reader == null) { + // Encoding is defined by the xml text decl. + reader = enc("UTF-8", is.getByteStream()); + expenc = xml(reader); + if (expenc.startsWith("UTF-16")) { + panic(FAULT); // UTF-16 must have BOM [#4.3.3] + } + reader = enc(expenc, is.getByteStream()); + } else { + // Encoding is defined by the BOM. + xml(reader); + } + } + } else { + // There is no support for public/system identifiers. + panic(FAULT); + } + mInp.src = reader; + mInp.pubid = is.getPublicId(); + mInp.sysid = is.getSystemId(); + } + + /** + * Determines the entity encoding. + * + * This method gets encoding from Byte Order Mask [#4.3.3] if any. Note, the + * first byte returned by the entity's byte stream has to be the first byte + * in the entity. Also, there is no support for UCS-4. + * + * @param is A byte stream of the entity. + * @param hint An encoding hint, character U means UTF-16. + * @return a reader constructed from the BOM or UTF-8 by default. + * @exception Exception is parser specific exception form panic method. + * @exception IOException + */ + private Reader bom(InputStream is, char hint) + throws Exception { + int val = is.read(); + switch (val) { + case 0xef: // UTF-8 + if (hint == 'U') // must be UTF-16 + { + panic(FAULT); + } + if (is.read() != 0xbb) { + panic(FAULT); + } + if (is.read() != 0xbf) { + panic(FAULT); + } + return new ReaderUTF8(is); + + case 0xfe: // UTF-16, big-endian + if (is.read() != 0xff) { + panic(FAULT); + } + return new ReaderUTF16(is, 'b'); + + case 0xff: // UTF-16, little-endian + if (is.read() != 0xfe) { + panic(FAULT); + } + return new ReaderUTF16(is, 'l'); + + case -1: + mChars[mChIdx++] = EOS; + return new ReaderUTF8(is); + + default: + if (hint == 'U') // must be UTF-16 + { + panic(FAULT); + } + // Read the rest of UTF-8 character + switch (val & 0xf0) { + case 0xc0: + case 0xd0: + mChars[mChIdx++] = (char) (((val & 0x1f) << 6) | (is.read() & 0x3f)); + break; + + case 0xe0: + mChars[mChIdx++] = (char) (((val & 0x0f) << 12) + | ((is.read() & 0x3f) << 6) | (is.read() & 0x3f)); + break; + + case 0xf0: // UCS-4 character + throw new UnsupportedEncodingException(); + + default: + mChars[mChIdx++] = (char) val; + break; + } + return null; + } + } + + /** + * Parses the xml text declaration. + * + * This method gets encoding from the xml text declaration [#4.3.1] if any. + * The method assumes the buffer (mChars) is big enough to accomodate whole + * xml text declaration. + * + * @param reader is entity reader. + * @return The xml text declaration encoding or default UTF-8 encoding. + * @exception Exception is parser specific exception form panic method. + * @exception IOException + */ + private String xml(Reader reader) + throws Exception { + String str = null; + String enc = "UTF-8"; + char ch; + int val; + short st; + // Read the xml text declaration into the buffer + if (mChIdx != 0) { + // The bom method have read ONE char into the buffer. + st = (short) ((mChars[0] == '<') ? 1 : -1); + } else { + st = 0; + } + while (st >= 0 && mChIdx < mChars.length) { + ch = ((val = reader.read()) >= 0) ? (char) val : EOS; + mChars[mChIdx++] = ch; + switch (st) { + case 0: // read '<' of xml declaration + switch (ch) { + case '<': + st = 1; + break; + + case 0xfeff: // the byte order mask + ch = ((val = reader.read()) >= 0) ? (char) val : EOS; + mChars[mChIdx - 1] = ch; + st = (short) ((ch == '<') ? 1 : -1); + break; + + default: + st = -1; + break; + } + break; + + case 1: // read '?' of xml declaration [#4.3.1] + st = (short) ((ch == '?') ? 2 : -1); + break; + + case 2: // read 'x' of xml declaration [#4.3.1] + st = (short) ((ch == 'x') ? 3 : -1); + break; + + case 3: // read 'm' of xml declaration [#4.3.1] + st = (short) ((ch == 'm') ? 4 : -1); + break; + + case 4: // read 'l' of xml declaration [#4.3.1] + st = (short) ((ch == 'l') ? 5 : -1); + break; + + case 5: // read white space after 'xml' + switch (ch) { + case ' ': + case '\t': + case '\r': + case '\n': + st = 6; + break; + + default: + st = -1; + break; + } + break; + + case 6: // read content of xml declaration + switch (ch) { + case '?': + st = 7; + break; + + case EOS: + st = -2; + break; + + default: + break; + } + break; + + case 7: // read '>' after '?' of xml declaration + switch (ch) { + case '>': + case EOS: + st = -2; + break; + + default: + st = 6; + break; + } + break; + + default: + panic(FAULT); + break; + } + } + mChLen = mChIdx; + mChIdx = 0; + // If there is no xml text declaration, the encoding is default. + if (st == -1) { + return enc; + } + mChIdx = 5; // the first white space after "= 0;) { + ch = getch(); + switch (st) { + case 0: // skip spaces after the xml declaration name + if (chtyp(ch) != ' ') { + bkch(); + st = 1; + } + break; + + case 1: // read xml declaration version + case 2: // read xml declaration encoding or standalone + case 3: // read xml declaration standalone + switch (chtyp(ch)) { + case 'a': + case 'A': + case '_': + bkch(); + str = name(false).toLowerCase(); + if ("version".equals(str) == true) { + if (st != 1) { + panic(FAULT); + } + if ("1.0".equals(eqstr('=')) != true) { + panic(FAULT); + } + mInp.xmlver = 0x0100; + st = 2; + } else if ("encoding".equals(str) == true) { + if (st != 2) { + panic(FAULT); + } + mInp.xmlenc = eqstr('=').toUpperCase(); + enc = mInp.xmlenc; + st = 3; + } else if ("standalone".equals(str) == true) { + if ((st == 1) || (mPh >= PH_DOC_START)) // [#4.3.1] + { + panic(FAULT); + } + str = eqstr('=').toLowerCase(); + // Check the 'standalone' value and use it [#5.1] + if (str.equals("yes") == true) { + mIsSAlone = true; + } else if (str.equals("no") == true) { + mIsSAlone = false; + } else { + panic(FAULT); + } + mIsSAloneSet = true; + st = 4; + } else { + panic(FAULT); + } + break; + + case ' ': + break; + + case '?': + if (st == 1) { + panic(FAULT); + } + bkch(); + st = 4; + break; + + default: + panic(FAULT); + } + break; + + case 4: // end of xml declaration + switch (chtyp(ch)) { + case '?': + if (getch() != '>') { + panic(FAULT); + } + if (mPh <= PH_DOC_START) { + mPh = PH_MISC_DTD; // misc before DTD + } + st = -1; + break; + + case ' ': + break; + + default: + panic(FAULT); + } + break; + + default: + panic(FAULT); + } + } + return enc; + } + + /** + * Sets up the document reader. + * + * @param name an encoding name. + * @param is the document byte input stream. + * @return a reader constructed from encoding name and input stream. + * @exception UnsupportedEncodingException + */ + private Reader enc(String name, InputStream is) + throws UnsupportedEncodingException { + // DO NOT CLOSE current reader if any! + if (name.equals("UTF-8")) { + return new ReaderUTF8(is); + } else if (name.equals("UTF-16LE")) { + return new ReaderUTF16(is, 'l'); + } else if (name.equals("UTF-16BE")) { + return new ReaderUTF16(is, 'b'); + } else { + return new InputStreamReader(is, name); + } + } + + /** + * Sets up current input on the top of the input stack. + * + * @param inp A new input to set up. + */ + protected void push(Input inp) { + mInp.chLen = mChLen; + mInp.chIdx = mChIdx; + inp.next = mInp; + mInp = inp; + mChars = inp.chars; + mChLen = inp.chLen; + mChIdx = inp.chIdx; + } + + /** + * Restores previous input on the top of the input stack. + */ + protected void pop() { + if (mInp.src != null) { + try { + mInp.src.close(); + } catch (IOException ioe) { + } + mInp.src = null; + } + mInp = mInp.next; + if (mInp != null) { + mChars = mInp.chars; + mChLen = mInp.chLen; + mChIdx = mInp.chIdx; + } else { + mChars = null; + mChLen = 0; + mChIdx = 0; + } + } + + /** + * Maps a character to it's type. + * + * Possible character type values are:
      - ' ' for any kind of white + * space character;
      - 'a' for any lower case alphabetical character + * value;
      - 'A' for any upper case alphabetical character value;
      + * - 'd' for any decimal digit character value;
      - 'z' for any + * character less then ' ' except '\t', '\n', '\r';
      - 'X' for any not + * ASCII character;
      - 'Z' for EOS character.
      An ASCII (7 bit) + * character which does not fall in any category listed above is mapped to + * it self. + * + * @param ch The character to map. + * @return The type of character. + */ + protected char chtyp(char ch) { + if (ch < 0x80) { + return (char) asctyp[ch]; + } + return (ch != EOS) ? 'X' : 'Z'; + } + + /** + * Retrives the next character in the document. + * + * @return The next character in the document. + */ + protected char getch() + throws IOException { + if (mChIdx >= mChLen) { + if (mInp.src == null) { + pop(); // remove internal entity + return getch(); + } + // Read new portion of the document characters + int Num = mInp.src.read(mChars, 0, mChars.length); + if (Num < 0) { + if (mInp != mDoc) { + pop(); // restore the previous input + return getch(); + } else { + mChars[0] = EOS; + mChLen = 1; + } + } else { + mChLen = Num; + } + mChIdx = 0; + } + return mChars[mChIdx++]; + } + + /** + * Puts back the last read character. + * + * This method MUST NOT be called more then once after each + * call of {@link #getch getch} method. + */ + protected void bkch() + throws Exception { + if (mChIdx <= 0) { + panic(FAULT); + } + mChIdx--; + } + + /** + * Sets the current character. + * + * @param ch The character to set. + */ + protected void setch(char ch) { + mChars[mChIdx] = ch; + } + + /** + * Finds a pair in the pair chain by a qualified name. + * + * @param chain The first element of the chain of pairs. + * @param qname The qualified name. + * @return A pair with the specified qualified name or null. + */ + protected Pair find(Pair chain, char[] qname) { + for (Pair pair = chain; pair != null; pair = pair.next) { + if (pair.eqname(qname) == true) { + return pair; + } + } + return null; + } + + /** + * Provedes an instance of a pair. + * + * @param next The reference to a next pair. + * @return An instance of a pair. + */ + protected Pair pair(Pair next) { + Pair pair; + + if (mDltd != null) { + pair = mDltd; + mDltd = pair.next; + } else { + pair = new Pair(); + } + pair.next = next; + + return pair; + } + + /** + * Deletes an instance of a pair. + * + * @param pair The pair to delete. + * @return A reference to the next pair in a chain. + */ + protected Pair del(Pair pair) { + Pair next = pair.next; + + pair.name = null; + pair.value = null; + pair.chars = null; + pair.list = null; + pair.next = mDltd; + mDltd = pair; + + return next; + } +} diff --git a/jdk/src/share/classes/jdk/internal/util/xml/impl/ParserSAX.java b/jdk/src/share/classes/jdk/internal/util/xml/impl/ParserSAX.java new file mode 100644 index 00000000000..da921dc4936 --- /dev/null +++ b/jdk/src/share/classes/jdk/internal/util/xml/impl/ParserSAX.java @@ -0,0 +1,695 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.util.xml.impl; + +import java.io.IOException; +import java.io.InputStream; +import jdk.internal.org.xml.sax.ContentHandler; +import jdk.internal.org.xml.sax.DTDHandler; +import jdk.internal.org.xml.sax.EntityResolver; +import jdk.internal.org.xml.sax.ErrorHandler; +import jdk.internal.org.xml.sax.InputSource; +import jdk.internal.org.xml.sax.Locator; +import jdk.internal.org.xml.sax.SAXException; +import jdk.internal.org.xml.sax.SAXParseException; +import jdk.internal.org.xml.sax.XMLReader; +import jdk.internal.org.xml.sax.helpers.DefaultHandler; + +/** + * XML non-validating push parser. + * + * This non-validating parser conforms to Extensible Markup Language (XML) 1.0 and "Namespaces in XML" + * specifications. The API supported by the parser are CLDC + * 1.0 and JSR-280, a + * JavaME subset of JAXP + * and SAX2. + * + * @see org.xml.sax.XMLReader + */ + +final class ParserSAX + extends Parser implements XMLReader, Locator +{ + public final static String FEATURE_NS = + "http://xml.org/sax/features/namespaces"; + public final static String FEATURE_PREF = + "http://xml.org/sax/features/namespace-prefixes"; + // SAX feature flags + private boolean mFNamespaces; + private boolean mFPrefixes; + // SAX handlers + private DefaultHandler mHand; // the default handler + private ContentHandler mHandCont; // the content handler + private DTDHandler mHandDtd; // the DTD handler + private ErrorHandler mHandErr; // the error handler + private EntityResolver mHandEnt; // the entity resolver + + /** + * Constructor. + */ + public ParserSAX() { + super(); + + // SAX feature defaut values + mFNamespaces = true; + mFPrefixes = false; + + // Default handler which will be used in case the application + // do not set one of handlers. + mHand = new DefaultHandler(); + mHandCont = mHand; + mHandDtd = mHand; + mHandErr = mHand; + mHandEnt = mHand; + } + + /** + * Return the current content handler. + * + * @return The current content handler, or null if none has been registered. + * @see #setContentHandler + */ + public ContentHandler getContentHandler() { + return (mHandCont != mHand) ? mHandCont : null; + } + + /** + * Allow an application to register a content event handler. + * + *

      If the application does not register a content handler, all content + * events reported by the SAX parser will be silently ignored.

      + * + *

      Applications may register a new or different handler in the middle of + * a parse, and the SAX parser must begin using the new handler + * immediately.

      + * + * @param handler The content handler. + * @exception java.lang.NullPointerException If the handler argument is + * null. + * @see #getContentHandler + */ + public void setContentHandler(ContentHandler handler) { + if (handler == null) { + throw new NullPointerException(); + } + mHandCont = handler; + } + + /** + * Return the current DTD handler. + * + * @return The current DTD handler, or null if none has been registered. + * @see #setDTDHandler + */ + public DTDHandler getDTDHandler() { + return (mHandDtd != mHand) ? mHandDtd : null; + } + + /** + * Allow an application to register a DTD event handler. + * + *

      If the application does not register a DTD handler, all DTD events + * reported by the SAX parser will be silently ignored.

      + * + *

      Applications may register a new or different handler in the middle of + * a parse, and the SAX parser must begin using the new handler + * immediately.

      + * + * @param handler The DTD handler. + * @exception java.lang.NullPointerException If the handler argument is + * null. + * @see #getDTDHandler + */ + public void setDTDHandler(DTDHandler handler) { + if (handler == null) { + throw new NullPointerException(); + } + mHandDtd = handler; + } + + /** + * Return the current error handler. + * + * @return The current error handler, or null if none has been registered. + * @see #setErrorHandler + */ + public ErrorHandler getErrorHandler() { + return (mHandErr != mHand) ? mHandErr : null; + } + + /** + * Allow an application to register an error event handler. + * + *

      If the application does not register an error handler, all error + * events reported by the SAX parser will be silently ignored; however, + * normal processing may not continue. It is highly recommended that all SAX + * applications implement an error handler to avoid unexpected bugs.

      + * + *

      Applications may register a new or different handler in the middle of + * a parse, and the SAX parser must begin using the new handler + * immediately.

      + * + * @param handler The error handler. + * @exception java.lang.NullPointerException If the handler argument is + * null. + * @see #getErrorHandler + */ + public void setErrorHandler(ErrorHandler handler) { + if (handler == null) { + throw new NullPointerException(); + } + mHandErr = handler; + } + + /** + * Return the current entity resolver. + * + * @return The current entity resolver, or null if none has been registered. + * @see #setEntityResolver + */ + public EntityResolver getEntityResolver() { + return (mHandEnt != mHand) ? mHandEnt : null; + } + + /** + * Allow an application to register an entity resolver. + * + *

      If the application does not register an entity resolver, the XMLReader + * will perform its own default resolution.

      + * + *

      Applications may register a new or different resolver in the middle of + * a parse, and the SAX parser must begin using the new resolver + * immediately.

      + * + * @param resolver The entity resolver. + * @exception java.lang.NullPointerException If the resolver argument is + * null. + * @see #getEntityResolver + */ + public void setEntityResolver(EntityResolver resolver) { + if (resolver == null) { + throw new NullPointerException(); + } + mHandEnt = resolver; + } + + /** + * Return the public identifier for the current document event. + * + *

      The return value is the public identifier of the document entity or of + * the external parsed entity in which the markup triggering the event + * appears.

      + * + * @return A string containing the public identifier, or null if none is + * available. + * + * @see #getSystemId + */ + public String getPublicId() { + return (mInp != null) ? mInp.pubid : null; + } + + /** + * Return the system identifier for the current document event. + * + *

      The return value is the system identifier of the document entity or of + * the external parsed entity in which the markup triggering the event + * appears.

      + * + *

      If the system identifier is a URL, the parser must resolve it fully + * before passing it to the application.

      + * + * @return A string containing the system identifier, or null if none is + * available. + * + * @see #getPublicId + */ + public String getSystemId() { + return (mInp != null) ? mInp.sysid : null; + } + + /** + * Return the line number where the current document event ends. + * + * @return Always returns -1 indicating the line number is not available. + * + * @see #getColumnNumber + */ + public int getLineNumber() { + return -1; + } + + /** + * Return the column number where the current document event ends. + * + * @return Always returns -1 indicating the column number is not available. + * + * @see #getLineNumber + */ + public int getColumnNumber() { + return -1; + } + + /** + * Parse an XML document from a system identifier (URI). + * + *

      This method is a shortcut for the common case of reading a document + * from a system identifier. It is the exact equivalent of the + * following:

      + * + *
      +     * parse(new InputSource(systemId));
      +     * 
      + * + *

      If the system identifier is a URL, it must be fully resolved by the + * application before it is passed to the parser.

      + * + * @param systemId The system identifier (URI). + * @exception org.xml.sax.SAXException Any SAX exception, possibly wrapping + * another exception. + * @exception java.io.IOException An IO exception from the parser, possibly + * from a byte stream or character stream supplied by the application. + * @see #parse(org.xml.sax.InputSource) + */ + public void parse(String systemId) throws IOException, SAXException { + parse(new InputSource(systemId)); + } + + /** + * Parse an XML document. + * + *

      The application can use this method to instruct the XML reader to + * begin parsing an XML document from any valid input source (a character + * stream, a byte stream, or a URI).

      + * + *

      Applications may not invoke this method while a parse is in progress + * (they should create a new XMLReader instead for each nested XML + * document). Once a parse is complete, an application may reuse the same + * XMLReader object, possibly with a different input source.

      + * + *

      During the parse, the XMLReader will provide information about the XML + * document through the registered event handlers.

      + * + *

      This method is synchronous: it will not return until parsing has + * ended. If a client application wants to terminate parsing early, it + * should throw an exception.

      + * + * @param is The input source for the top-level of the XML document. + * @exception org.xml.sax.SAXException Any SAX exception, possibly wrapping + * another exception. + * @exception java.io.IOException An IO exception from the parser, possibly + * from a byte stream or character stream supplied by the application. + * @see org.xml.sax.InputSource + * @see #parse(java.lang.String) + * @see #setEntityResolver + * @see #setDTDHandler + * @see #setContentHandler + * @see #setErrorHandler + */ + public void parse(InputSource is) throws IOException, SAXException { + if (is == null) { + throw new IllegalArgumentException(""); + } + // Set up the document + mInp = new Input(BUFFSIZE_READER); + mPh = PH_BEFORE_DOC; // before parsing + try { + setinp(is); + } catch (SAXException saxe) { + throw saxe; + } catch (IOException ioe) { + throw ioe; + } catch (RuntimeException rte) { + throw rte; + } catch (Exception e) { + panic(e.toString()); + } + parse(); + } + + /** + * Parse the content of the given {@link java.io.InputStream} instance as + * XML using the specified {@link org.xml.sax.helpers.DefaultHandler}. + * + * @param src InputStream containing the content to be parsed. + * @param handler The SAX DefaultHandler to use. + * @exception IOException If any IO errors occur. + * @exception IllegalArgumentException If the given InputStream or handler + * is null. + * @exception SAXException If the underlying parser throws a SAXException + * while parsing. + * @see org.xml.sax.helpers.DefaultHandler + */ + public void parse(InputStream src, DefaultHandler handler) + throws SAXException, IOException { + if ((src == null) || (handler == null)) { + throw new IllegalArgumentException(""); + } + parse(new InputSource(src), handler); + } + + /** + * Parse the content given {@link org.xml.sax.InputSource} as XML using the + * specified {@link org.xml.sax.helpers.DefaultHandler}. + * + * @param is The InputSource containing the content to be parsed. + * @param handler The SAX DefaultHandler to use. + * @exception IOException If any IO errors occur. + * @exception IllegalArgumentException If the InputSource or handler is + * null. + * @exception SAXException If the underlying parser throws a SAXException + * while parsing. + * @see org.xml.sax.helpers.DefaultHandler + */ + public void parse(InputSource is, DefaultHandler handler) + throws SAXException, IOException + { + if ((is == null) || (handler == null)) { + throw new IllegalArgumentException(""); + } + // Set up the handler + mHandCont = handler; + mHandDtd = handler; + mHandErr = handler; + mHandEnt = handler; + // Set up the document + mInp = new Input(BUFFSIZE_READER); + mPh = PH_BEFORE_DOC; // before parsing + try { + setinp(is); + } catch (SAXException | IOException | RuntimeException saxe) { + throw saxe; + } catch (Exception e) { + panic(e.toString()); + } + parse(); + } + + /** + * Parse the XML document content using specified handlers and an input + * source. + * + * @exception IOException If any IO errors occur. + * @exception SAXException If the underlying parser throws a SAXException + * while parsing. + */ + @SuppressWarnings("fallthrough") + private void parse() throws SAXException, IOException { + init(); + try { + mHandCont.setDocumentLocator(this); + mHandCont.startDocument(); + + if (mPh != PH_MISC_DTD) { + mPh = PH_MISC_DTD; // misc before DTD + } + int evt = EV_NULL; + // XML document prolog + do { + wsskip(); + switch (evt = step()) { + case EV_ELM: + case EV_ELMS: + mPh = PH_DOCELM; + break; + + case EV_COMM: + case EV_PI: + break; + + case EV_DTD: + if (mPh >= PH_DTD_MISC) { + panic(FAULT); + } + mPh = PH_DTD_MISC; // misc after DTD + break; + + default: + panic(FAULT); + } + } while (mPh < PH_DOCELM); // misc before DTD + // XML document starting with document's element + do { + switch (evt) { + case EV_ELM: + case EV_ELMS: + // Report the element + if (mIsNSAware == true) { + mHandCont.startElement( + mElm.value, + mElm.name, + "", + mAttrs); + } else { + mHandCont.startElement( + "", + "", + mElm.name, + mAttrs); + } + if (evt == EV_ELMS) { + evt = step(); + break; + } + + case EV_ELME: + // Report the end of element + if (mIsNSAware == true) { + mHandCont.endElement(mElm.value, mElm.name, ""); + } else { + mHandCont.endElement("", "", mElm.name); + } + // Restore the top of the prefix stack + while (mPref.list == mElm) { + mHandCont.endPrefixMapping(mPref.name); + mPref = del(mPref); + } + // Remove the top element tag + mElm = del(mElm); + if (mElm == null) { + mPh = PH_DOCELM_MISC; + } else { + evt = step(); + } + break; + + case EV_TEXT: + case EV_WSPC: + case EV_CDAT: + case EV_COMM: + case EV_PI: + case EV_ENT: + evt = step(); + break; + + default: + panic(FAULT); + } + } while (mPh == PH_DOCELM); + // Misc after document's element + do { + if (wsskip() == EOS) { + break; + } + + switch (step()) { + case EV_COMM: + case EV_PI: + break; + + default: + panic(FAULT); + } + } while (mPh == PH_DOCELM_MISC); + mPh = PH_AFTER_DOC; // parsing is completed + + } catch (SAXException saxe) { + throw saxe; + } catch (IOException ioe) { + throw ioe; + } catch (RuntimeException rte) { + throw rte; + } catch (Exception e) { + panic(e.toString()); + } finally { + mHandCont.endDocument(); + cleanup(); + } + } + + /** + * Reports document type. + * + * @param name The name of the entity. + * @param pubid The public identifier of the entity or null. + * @param sysid The system identifier of the entity or null. + */ + protected void docType(String name, String pubid, String sysid) throws SAXException { + mHandDtd.notationDecl(name, pubid, sysid); + } + + /** + * Reports a comment. + * + * @param text The comment text starting from first charcater. + * @param length The number of characters in comment. + */ + protected void comm(char[] text, int length) { + } + + /** + * Reports a processing instruction. + * + * @param target The processing instruction target name. + * @param body The processing instruction body text. + */ + protected void pi(String target, String body) throws SAXException { + mHandCont.processingInstruction(target, body); + } + + /** + * Reports new namespace prefix. The Namespace prefix ( + * mPref.name) being declared and the Namespace URI ( + * mPref.value) the prefix is mapped to. An empty string is + * used for the default element namespace, which has no prefix. + */ + protected void newPrefix() throws SAXException { + mHandCont.startPrefixMapping(mPref.name, mPref.value); + } + + /** + * Reports skipped entity name. + * + * @param name The entity name. + */ + protected void skippedEnt(String name) throws SAXException { + mHandCont.skippedEntity(name); + } + + /** + * Returns an + * InputSource for specified entity or + * null. + * + * @param name The name of the entity. + * @param pubid The public identifier of the entity. + * @param sysid The system identifier of the entity. + */ + protected InputSource resolveEnt(String name, String pubid, String sysid) + throws SAXException, IOException + { + return mHandEnt.resolveEntity(pubid, sysid); + } + + /** + * Reports notation declaration. + * + * @param name The notation's name. + * @param pubid The notation's public identifier, or null if none was given. + * @param sysid The notation's system identifier, or null if none was given. + */ + protected void notDecl(String name, String pubid, String sysid) + throws SAXException + { + mHandDtd.notationDecl(name, pubid, sysid); + } + + /** + * Reports unparsed entity name. + * + * @param name The unparsed entity's name. + * @param pubid The entity's public identifier, or null if none was given. + * @param sysid The entity's system identifier. + * @param notation The name of the associated notation. + */ + protected void unparsedEntDecl(String name, String pubid, String sysid, String notation) + throws SAXException + { + mHandDtd.unparsedEntityDecl(name, pubid, sysid, notation); + } + + /** + * Notifies the handler about fatal parsing error. + * + * @param msg The problem description message. + */ + protected void panic(String msg) throws SAXException { + SAXParseException spe = new SAXParseException(msg, this); + mHandErr.fatalError(spe); + throw spe; // [#1.2] fatal error definition + } + + /** + * Reports characters and empties the parser's buffer. This method is called + * only if parser is going to return control to the main loop. This means + * that this method may use parser buffer to report white space without + * copeing characters to temporary buffer. + */ + protected void bflash() throws SAXException { + if (mBuffIdx >= 0) { + // Textual data has been read + mHandCont.characters(mBuff, 0, (mBuffIdx + 1)); + mBuffIdx = -1; + } + } + + /** + * Reports white space characters and empties the parser's buffer. This + * method is called only if parser is going to return control to the main + * loop. This means that this method may use parser buffer to report white + * space without copeing characters to temporary buffer. + */ + protected void bflash_ws() throws SAXException { + if (mBuffIdx >= 0) { + // BUG: With additional info from DTD and xml:space attr [#2.10] + // the following call can be supported: + // mHandCont.ignorableWhitespace(mBuff, 0, (mBuffIdx + 1)); + + // Textual data has been read + mHandCont.characters(mBuff, 0, (mBuffIdx + 1)); + mBuffIdx = -1; + } + } + + public boolean getFeature(String name) { + throw new UnsupportedOperationException("Not supported yet."); + } + + public void setFeature(String name, boolean value) { + throw new UnsupportedOperationException("Not supported yet."); + } + + public Object getProperty(String name) { + throw new UnsupportedOperationException("Not supported yet."); + } + + public void setProperty(String name, Object value) { + throw new UnsupportedOperationException("Not supported yet."); + } +} diff --git a/jdk/src/share/classes/jdk/internal/util/xml/impl/ReaderUTF16.java b/jdk/src/share/classes/jdk/internal/util/xml/impl/ReaderUTF16.java new file mode 100644 index 00000000000..195b87db42e --- /dev/null +++ b/jdk/src/share/classes/jdk/internal/util/xml/impl/ReaderUTF16.java @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.util.xml.impl; + +import java.io.Reader; +import java.io.InputStream; +import java.io.IOException; + +/** + * UTF-16 encoded stream reader. + */ +public class ReaderUTF16 extends Reader { + + private InputStream is; + private char bo; + + /** + * Constructor. + * + * Byte order argument can be: 'l' for little-endian or 'b' for big-endian. + * + * @param is A byte input stream. + * @param bo A byte order in the input stream. + */ + public ReaderUTF16(InputStream is, char bo) { + switch (bo) { + case 'l': + break; + + case 'b': + break; + + default: + throw new IllegalArgumentException(""); + } + this.bo = bo; + this.is = is; + } + + /** + * Reads characters into a portion of an array. + * + * @param cbuf Destination buffer. + * @param off Offset at which to start storing characters. + * @param len Maximum number of characters to read. + * @exception IOException If any IO errors occur. + */ + public int read(char[] cbuf, int off, int len) throws IOException { + int num = 0; + int val; + if (bo == 'b') { + while (num < len) { + if ((val = is.read()) < 0) { + return (num != 0) ? num : -1; + } + cbuf[off++] = (char) ((val << 8) | (is.read() & 0xff)); + num++; + } + } else { + while (num < len) { + if ((val = is.read()) < 0) { + return (num != 0) ? num : -1; + } + cbuf[off++] = (char) ((is.read() << 8) | (val & 0xff)); + num++; + } + } + return num; + } + + /** + * Reads a single character. + * + * @return The character read, as an integer in the range 0 to 65535 + * (0x0000-0xffff), or -1 if the end of the stream has been reached. + * @exception IOException If any IO errors occur. + */ + public int read() throws IOException { + int val; + if ((val = is.read()) < 0) { + return -1; + } + if (bo == 'b') { + val = (char) ((val << 8) | (is.read() & 0xff)); + } else { + val = (char) ((is.read() << 8) | (val & 0xff)); + } + return val; + } + + /** + * Closes the stream. + * + * @exception IOException If any IO errors occur. + */ + public void close() throws IOException { + is.close(); + } +} diff --git a/jdk/src/share/classes/jdk/internal/util/xml/impl/ReaderUTF8.java b/jdk/src/share/classes/jdk/internal/util/xml/impl/ReaderUTF8.java new file mode 100644 index 00000000000..bd8e321312e --- /dev/null +++ b/jdk/src/share/classes/jdk/internal/util/xml/impl/ReaderUTF8.java @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.util.xml.impl; + +import java.io.Reader; +import java.io.InputStream; +import java.io.IOException; +import java.io.UnsupportedEncodingException; + +/** + * UTF-8 transformed UCS-2 character stream reader. + * + * This reader converts UTF-8 transformed UCS-2 characters to Java characters. + * The UCS-2 subset of UTF-8 transformation is described in RFC-2279 #2 + * "UTF-8 definition": + * 0000 0000-0000 007F 0xxxxxxx + * 0000 0080-0000 07FF 110xxxxx 10xxxxxx + * 0000 0800-0000 FFFF 1110xxxx 10xxxxxx 10xxxxxx + * + * This reader will return incorrect last character on broken UTF-8 stream. + */ +public class ReaderUTF8 extends Reader { + + private InputStream is; + + /** + * Constructor. + * + * @param is A byte input stream. + */ + public ReaderUTF8(InputStream is) { + this.is = is; + } + + /** + * Reads characters into a portion of an array. + * + * @param cbuf Destination buffer. + * @param off Offset at which to start storing characters. + * @param len Maximum number of characters to read. + * @exception IOException If any IO errors occur. + * @exception UnsupportedEncodingException If UCS-4 character occur in the stream. + */ + public int read(char[] cbuf, int off, int len) throws IOException { + int num = 0; + int val; + while (num < len) { + if ((val = is.read()) < 0) { + return (num != 0) ? num : -1; + } + switch (val & 0xf0) { + case 0xc0: + case 0xd0: + cbuf[off++] = (char) (((val & 0x1f) << 6) | (is.read() & 0x3f)); + break; + + case 0xe0: + cbuf[off++] = (char) (((val & 0x0f) << 12) + | ((is.read() & 0x3f) << 6) | (is.read() & 0x3f)); + break; + + case 0xf0: // UCS-4 character + throw new UnsupportedEncodingException("UTF-32 (or UCS-4) encoding not supported."); + + default: + cbuf[off++] = (char) val; + break; + } + num++; + } + return num; + } + + /** + * Reads a single character. + * + * @return The character read, as an integer in the range 0 to 65535 + * (0x00-0xffff), or -1 if the end of the stream has been reached. + * @exception IOException If any IO errors occur. + * @exception UnsupportedEncodingException If UCS-4 character occur in the stream. + */ + public int read() throws IOException { + int val; + if ((val = is.read()) < 0) { + return -1; + } + switch (val & 0xf0) { + case 0xc0: + case 0xd0: + val = ((val & 0x1f) << 6) | (is.read() & 0x3f); + break; + + case 0xe0: + val = ((val & 0x0f) << 12) + | ((is.read() & 0x3f) << 6) | (is.read() & 0x3f); + break; + + case 0xf0: // UCS-4 character + throw new UnsupportedEncodingException(); + + default: + break; + } + return val; + } + + /** + * Closes the stream. + * + * @exception IOException If any IO errors occur. + */ + public void close() throws IOException { + is.close(); + } +} diff --git a/jdk/src/share/classes/jdk/internal/util/xml/impl/SAXParserImpl.java b/jdk/src/share/classes/jdk/internal/util/xml/impl/SAXParserImpl.java new file mode 100644 index 00000000000..d73ca2a7868 --- /dev/null +++ b/jdk/src/share/classes/jdk/internal/util/xml/impl/SAXParserImpl.java @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.util.xml.impl; + +import java.io.IOException; +import java.io.InputStream; +import jdk.internal.org.xml.sax.InputSource; +import jdk.internal.org.xml.sax.SAXException; +import jdk.internal.org.xml.sax.XMLReader; +import jdk.internal.org.xml.sax.helpers.DefaultHandler; +import jdk.internal.util.xml.SAXParser; + +public class SAXParserImpl extends SAXParser { + + private ParserSAX parser; + + public SAXParserImpl() { + super(); + parser = new ParserSAX(); + } + + /** + * Returns the {@link org.xml.sax.XMLReader} that is encapsulated by the + * implementation of this class. + * + * @return The XMLReader that is encapsulated by the + * implementation of this class. + * + * @throws SAXException If any SAX errors occur during processing. + */ + public XMLReader getXMLReader() + throws SAXException { + return parser; + } + + /** + * Indicates whether or not this parser is configured to + * understand namespaces. + * + * @return true if this parser is configured to + * understand namespaces; false otherwise. + */ + public boolean isNamespaceAware() { + return parser.mIsNSAware; + } + + /** + * Indicates whether or not this parser is configured to validate + * XML documents. + * + * @return true if this parser is configured to validate XML + * documents; false otherwise. + */ + public boolean isValidating() { + return false; + } + + /** + * Parse the content of the given {@link java.io.InputStream} + * instance as XML using the specified + * {@link org.xml.sax.helpers.DefaultHandler}. + * + * @param src InputStream containing the content to be parsed. + * @param handler The SAX DefaultHandler to use. + * @exception IOException If any IO errors occur. + * @exception IllegalArgumentException If the given InputStream or handler is null. + * @exception SAXException If the underlying parser throws a + * SAXException while parsing. + * @see org.xml.sax.helpers.DefaultHandler + */ + public void parse(InputStream src, DefaultHandler handler) + throws SAXException, IOException + { + parser.parse(src, handler); + } + + /** + * Parse the content given {@link org.xml.sax.InputSource} + * as XML using the specified + * {@link org.xml.sax.helpers.DefaultHandler}. + * + * @param is The InputSource containing the content to be parsed. + * @param handler The SAX DefaultHandler to use. + * @exception IOException If any IO errors occur. + * @exception IllegalArgumentException If the InputSource or handler is null. + * @exception SAXException If the underlying parser throws a + * SAXException while parsing. + * @see org.xml.sax.helpers.DefaultHandler + */ + public void parse(InputSource is, DefaultHandler handler) + throws SAXException, IOException + { + parser.parse(is, handler); + } +} diff --git a/jdk/src/share/classes/jdk/internal/util/xml/impl/XMLStreamWriterImpl.java b/jdk/src/share/classes/jdk/internal/util/xml/impl/XMLStreamWriterImpl.java new file mode 100644 index 00000000000..1dc26905c12 --- /dev/null +++ b/jdk/src/share/classes/jdk/internal/util/xml/impl/XMLStreamWriterImpl.java @@ -0,0 +1,633 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.util.xml.impl; + +import java.io.OutputStream; +import java.io.UnsupportedEncodingException; +import java.nio.charset.Charset; +import java.nio.charset.IllegalCharsetNameException; +import java.nio.charset.UnsupportedCharsetException; +import jdk.internal.util.xml.XMLStreamException; +import jdk.internal.util.xml.XMLStreamWriter; + +/** + * Implementation of a reduced version of XMLStreamWriter + * + * @author Joe Wang + */ +public class XMLStreamWriterImpl implements XMLStreamWriter { + //Document state + + static final int STATE_XML_DECL = 1; + static final int STATE_PROLOG = 2; + static final int STATE_DTD_DECL = 3; + static final int STATE_ELEMENT = 4; + //Element state + static final int ELEMENT_STARTTAG_OPEN = 10; + static final int ELEMENT_STARTTAG_CLOSE = 11; + static final int ELEMENT_ENDTAG_OPEN = 12; + static final int ELEMENT_ENDTAG_CLOSE = 13; + public static final char CLOSE_START_TAG = '>'; + public static final char OPEN_START_TAG = '<'; + public static final String OPEN_END_TAG = "'; + public static final String START_CDATA = ""; + public static final String CLOSE_EMPTY_ELEMENT = "/>"; + public static final String ENCODING_PREFIX = "&#x"; + public static final char SPACE = ' '; + public static final char AMPERSAND = '&'; + public static final char DOUBLEQUOT = '"'; + public static final char SEMICOLON = ';'; + //current state + private int _state = 0; + private Element _currentEle; + private XMLWriter _writer; + private String _encoding; + /** + * This flag can be used to turn escaping off for content. It does + * not apply to attribute content. + */ + boolean _escapeCharacters = true; + //pretty print by default + private boolean _doIndent = true; + //The system line separator for writing out line breaks. + private char[] _lineSep = + System.getProperty("line.separator").toCharArray(); + + public XMLStreamWriterImpl(OutputStream os) throws XMLStreamException { + this(os, XMLStreamWriter.DEFAULT_ENCODING); + } + + public XMLStreamWriterImpl(OutputStream os, String encoding) + throws XMLStreamException + { + Charset cs = null; + if (encoding == null) { + _encoding = XMLStreamWriter.DEFAULT_ENCODING; + } else { + try { + cs = getCharset(encoding); + } catch (UnsupportedEncodingException e) { + throw new XMLStreamException(e); + } + + this._encoding = encoding; + } + + _writer = new XMLWriter(os, encoding, cs); + } + + /** + * Write the XML Declaration. Defaults the XML version to 1.0, and the + * encoding to utf-8. + * + * @throws XMLStreamException + */ + public void writeStartDocument() throws XMLStreamException { + writeStartDocument(_encoding, XMLStreamWriter.DEFAULT_XML_VERSION); + } + + /** + * Write the XML Declaration. Defaults the encoding to utf-8 + * + * @param version version of the xml document + * @throws XMLStreamException + */ + public void writeStartDocument(String version) throws XMLStreamException { + writeStartDocument(_encoding, version, null); + } + + /** + * Write the XML Declaration. Note that the encoding parameter does not set + * the actual encoding of the underlying output. That must be set when the + * instance of the XMLStreamWriter is created + * + * @param encoding encoding of the xml declaration + * @param version version of the xml document + * @throws XMLStreamException If given encoding does not match encoding of the + * underlying stream + */ + public void writeStartDocument(String encoding, String version) throws XMLStreamException { + writeStartDocument(encoding, version, null); + } + + /** + * Write the XML Declaration. Note that the encoding parameter does not set + * the actual encoding of the underlying output. That must be set when the + * instance of the XMLStreamWriter is created + * + * @param encoding encoding of the xml declaration + * @param version version of the xml document + * @param standalone indicate if the xml document is standalone + * @throws XMLStreamException If given encoding does not match encoding of the + * underlying stream + */ + public void writeStartDocument(String encoding, String version, String standalone) + throws XMLStreamException + { + if (_state > 0) { + throw new XMLStreamException("XML declaration must be as the first line in the XML document."); + } + _state = STATE_XML_DECL; + String enc = encoding; + if (enc == null) { + enc = _encoding; + } else { + //check if the encoding is supported + try { + getCharset(encoding); + } catch (UnsupportedEncodingException e) { + throw new XMLStreamException(e); + } + } + + if (version == null) { + version = XMLStreamWriter.DEFAULT_XML_VERSION; + } + + _writer.write(""); + writeLineSeparator(); + } + + /** + * Write a DTD section. This string represents the entire doctypedecl production + * from the XML 1.0 specification. + * + * @param dtd the DTD to be written + * @throws XMLStreamException + */ + public void writeDTD(String dtd) throws XMLStreamException { + if (_currentEle != null && _currentEle.getState() == ELEMENT_STARTTAG_OPEN) { + closeStartTag(); + } + _writer.write(dtd); + writeLineSeparator(); + } + + /** + * Writes a start tag to the output. + * @param localName local name of the tag, may not be null + * @throws XMLStreamException + */ + public void writeStartElement(String localName) throws XMLStreamException { + if (localName == null || localName.length() == 0) { + throw new XMLStreamException("Local Name cannot be null or empty"); + } + + _state = STATE_ELEMENT; + if (_currentEle != null && _currentEle.getState() == ELEMENT_STARTTAG_OPEN) { + closeStartTag(); + } + + _currentEle = new Element(_currentEle, localName, false); + openStartTag(); + + _writer.write(localName); + } + + /** + * Writes an empty element tag to the output + * @param localName local name of the tag, may not be null + * @throws XMLStreamException + */ + public void writeEmptyElement(String localName) throws XMLStreamException { + if (_currentEle != null && _currentEle.getState() == ELEMENT_STARTTAG_OPEN) { + closeStartTag(); + } + + _currentEle = new Element(_currentEle, localName, true); + + openStartTag(); + _writer.write(localName); + } + + /** + * Writes an attribute to the output stream without a prefix. + * @param localName the local name of the attribute + * @param value the value of the attribute + * @throws IllegalStateException if the current state does not allow Attribute writing + * @throws XMLStreamException + */ + public void writeAttribute(String localName, String value) throws XMLStreamException { + if (_currentEle.getState() != ELEMENT_STARTTAG_OPEN) { + throw new XMLStreamException( + "Attribute not associated with any element"); + } + + _writer.write(SPACE); + _writer.write(localName); + _writer.write("=\""); + writeXMLContent( + value, + true, // true = escapeChars + true); // true = escapeDoubleQuotes + _writer.write(DOUBLEQUOT); + } + + public void writeEndDocument() throws XMLStreamException { + if (_currentEle != null && _currentEle.getState() == ELEMENT_STARTTAG_OPEN) { + closeStartTag(); + } + + /** + * close unclosed elements if any + */ + while (_currentEle != null) { + + if (!_currentEle.isEmpty()) { + _writer.write(OPEN_END_TAG); + _writer.write(_currentEle.getLocalName()); + _writer.write(CLOSE_END_TAG); + } + + _currentEle = _currentEle.getParent(); + } + } + + public void writeEndElement() throws XMLStreamException { + if (_currentEle != null && _currentEle.getState() == ELEMENT_STARTTAG_OPEN) { + closeStartTag(); + } + + if (_currentEle == null) { + throw new XMLStreamException("No element was found to write"); + } + + if (_currentEle.isEmpty()) { + return; + } + + _writer.write(OPEN_END_TAG); + _writer.write(_currentEle.getLocalName()); + _writer.write(CLOSE_END_TAG); + writeLineSeparator(); + + _currentEle = _currentEle.getParent(); + } + + public void writeCData(String cdata) throws XMLStreamException { + if (cdata == null) { + throw new XMLStreamException("cdata cannot be null"); + } + + if (_currentEle != null && _currentEle.getState() == ELEMENT_STARTTAG_OPEN) { + closeStartTag(); + } + + _writer.write(START_CDATA); + _writer.write(cdata); + _writer.write(END_CDATA); + } + + public void writeCharacters(String data) throws XMLStreamException { + if (_currentEle != null && _currentEle.getState() == ELEMENT_STARTTAG_OPEN) { + closeStartTag(); + } + + writeXMLContent(data); + } + + public void writeCharacters(char[] data, int start, int len) + throws XMLStreamException { + if (_currentEle != null && _currentEle.getState() == ELEMENT_STARTTAG_OPEN) { + closeStartTag(); + } + + writeXMLContent(data, start, len, _escapeCharacters); + } + + /** + * Close this XMLStreamWriter by closing underlying writer. + */ + public void close() throws XMLStreamException { + if (_writer != null) { + _writer.close(); + } + _writer = null; + _currentEle = null; + _state = 0; + } + + /** + * Flush this XMLStreamWriter by flushing underlying writer. + */ + public void flush() throws XMLStreamException { + if (_writer != null) { + _writer.flush(); + } + } + + /** + * Set the flag to indicate if the writer should add line separator + * @param doIndent + */ + public void setDoIndent(boolean doIndent) { + _doIndent = doIndent; + } + + /** + * Writes XML content to underlying writer. Escapes characters unless + * escaping character feature is turned off. + */ + private void writeXMLContent(char[] content, int start, int length, boolean escapeChars) + throws XMLStreamException + { + if (!escapeChars) { + _writer.write(content, start, length); + return; + } + + // Index of the next char to be written + int startWritePos = start; + + final int end = start + length; + + for (int index = start; index < end; index++) { + char ch = content[index]; + + if (!_writer.canEncode(ch)) { + _writer.write(content, startWritePos, index - startWritePos); + + // Escape this char as underlying encoder cannot handle it + _writer.write(ENCODING_PREFIX); + _writer.write(Integer.toHexString(ch)); + _writer.write(SEMICOLON); + startWritePos = index + 1; + continue; + } + + switch (ch) { + case OPEN_START_TAG: + _writer.write(content, startWritePos, index - startWritePos); + _writer.write("<"); + startWritePos = index + 1; + + break; + + case AMPERSAND: + _writer.write(content, startWritePos, index - startWritePos); + _writer.write("&"); + startWritePos = index + 1; + + break; + + case CLOSE_START_TAG: + _writer.write(content, startWritePos, index - startWritePos); + _writer.write(">"); + startWritePos = index + 1; + + break; + } + } + + // Write any pending data + _writer.write(content, startWritePos, end - startWritePos); + } + + private void writeXMLContent(String content) throws XMLStreamException { + if ((content != null) && (content.length() > 0)) { + writeXMLContent(content, + _escapeCharacters, // boolean = escapeChars + false); // false = escapeDoubleQuotes + } + } + + /** + * Writes XML content to underlying writer. Escapes characters unless + * escaping character feature is turned off. + */ + private void writeXMLContent( + String content, + boolean escapeChars, + boolean escapeDoubleQuotes) + throws XMLStreamException + { + + if (!escapeChars) { + _writer.write(content); + + return; + } + + // Index of the next char to be written + int startWritePos = 0; + + final int end = content.length(); + + for (int index = 0; index < end; index++) { + char ch = content.charAt(index); + + if (!_writer.canEncode(ch)) { + _writer.write(content, startWritePos, index - startWritePos); + + // Escape this char as underlying encoder cannot handle it + _writer.write(ENCODING_PREFIX); + _writer.write(Integer.toHexString(ch)); + _writer.write(SEMICOLON); + startWritePos = index + 1; + continue; + } + + switch (ch) { + case OPEN_START_TAG: + _writer.write(content, startWritePos, index - startWritePos); + _writer.write("<"); + startWritePos = index + 1; + + break; + + case AMPERSAND: + _writer.write(content, startWritePos, index - startWritePos); + _writer.write("&"); + startWritePos = index + 1; + + break; + + case CLOSE_START_TAG: + _writer.write(content, startWritePos, index - startWritePos); + _writer.write(">"); + startWritePos = index + 1; + + break; + + case DOUBLEQUOT: + _writer.write(content, startWritePos, index - startWritePos); + if (escapeDoubleQuotes) { + _writer.write("""); + } else { + _writer.write(DOUBLEQUOT); + } + startWritePos = index + 1; + + break; + } + } + + // Write any pending data + _writer.write(content, startWritePos, end - startWritePos); + } + + /** + * marks open of start tag and writes the same into the writer. + */ + private void openStartTag() throws XMLStreamException { + _currentEle.setState(ELEMENT_STARTTAG_OPEN); + _writer.write(OPEN_START_TAG); + } + + /** + * marks close of start tag and writes the same into the writer. + */ + private void closeStartTag() throws XMLStreamException { + if (_currentEle.isEmpty()) { + _writer.write(CLOSE_EMPTY_ELEMENT); + } else { + _writer.write(CLOSE_START_TAG); + + } + + if (_currentEle.getParent() == null) { + writeLineSeparator(); + } + + _currentEle.setState(ELEMENT_STARTTAG_CLOSE); + + } + + /** + * Write a line separator + * @throws XMLStreamException + */ + private void writeLineSeparator() throws XMLStreamException { + if (_doIndent) { + _writer.write(_lineSep, 0, _lineSep.length); + } + } + + /** + * Returns a charset object for the specified encoding + * @param encoding + * @return a charset object + * @throws UnsupportedEncodingException if the encoding is not supported + */ + private Charset getCharset(String encoding) throws UnsupportedEncodingException { + if (encoding.equalsIgnoreCase("UTF-32")) { + throw new UnsupportedEncodingException("The basic XMLWriter does " + + "not support " + encoding); + } + + Charset cs; + try { + cs = Charset.forName(encoding); + } catch (IllegalCharsetNameException | UnsupportedCharsetException ex) { + throw new UnsupportedEncodingException(encoding); + } + return cs; + } + + /* + * Start of Internal classes. + * + */ + protected class Element { + + /** + * the parent element + */ + protected Element _parent; + /** + * The size of the stack. + */ + protected short _Depth; + /** + * indicate if an element is an empty one + */ + boolean _isEmptyElement = false; + String _localpart; + int _state; + + /** + * Default constructor. + */ + public Element() { + } + + /** + * @param parent the parent of the element + * @param localpart name of the element + * @param isEmpty indicate if the element is an empty one + */ + public Element(Element parent, String localpart, boolean isEmpty) { + _parent = parent; + _localpart = localpart; + _isEmptyElement = isEmpty; + } + + public Element getParent() { + return _parent; + } + + public String getLocalName() { + return _localpart; + } + + /** + * get the state of the element + */ + public int getState() { + return _state; + } + + /** + * Set the state of the element + * + * @param state the state of the element + */ + public void setState(int state) { + _state = state; + } + + public boolean isEmpty() { + return _isEmptyElement; + } + } +} diff --git a/jdk/src/share/classes/jdk/internal/util/xml/impl/XMLWriter.java b/jdk/src/share/classes/jdk/internal/util/xml/impl/XMLWriter.java new file mode 100644 index 00000000000..8483a7f713b --- /dev/null +++ b/jdk/src/share/classes/jdk/internal/util/xml/impl/XMLWriter.java @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.util.xml.impl; + +import java.io.BufferedOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.UnsupportedEncodingException; +import java.io.Writer; +import java.nio.charset.Charset; +import java.nio.charset.CharsetEncoder; +import jdk.internal.util.xml.XMLStreamException; + +/** + * + * @author huizwang + */ +public class XMLWriter { + + private Writer _writer; + /** + * In some cases, this charset encoder is used to determine if a char is + * encodable by underlying writer. For example, an 8-bit char from the + * extended ASCII set is not encodable by 7-bit ASCII encoder. Unencodable + * chars are escaped using XML numeric entities. + */ + private CharsetEncoder _encoder = null; + + public XMLWriter(OutputStream os, String encoding, Charset cs) throws XMLStreamException { + _encoder = cs.newEncoder(); + try { + _writer = getWriter(os, encoding, cs); + } catch (UnsupportedEncodingException ex) { + throw new XMLStreamException(ex); + } + + } + + public boolean canEncode(char ch) { + if (_encoder == null) { + return false; + } + return (_encoder.canEncode(ch)); + } + + public void write(String s) + throws XMLStreamException { + try { + _writer.write(s.toCharArray()); +// _writer.write(s.getBytes(Charset.forName(_encoding))); + } catch (IOException e) { + throw new XMLStreamException("I/O error", e); + } + } + + public void write(String str, int off, int len) + throws XMLStreamException { + try { + _writer.write(str, off, len); + } catch (IOException e) { + throw new XMLStreamException("I/O error", e); + } + + } + + public void write(char[] cbuf, int off, int len) + throws XMLStreamException { + try { + _writer.write(cbuf, off, len); + } catch (IOException e) { + throw new XMLStreamException("I/O error", e); + } + + } + + void write(int b) + throws XMLStreamException { + try { + _writer.write(b); + } catch (IOException e) { + throw new XMLStreamException("I/O error", e); + } + } + + void flush() throws XMLStreamException { + try { + _writer.flush(); + } catch (IOException ex) { + throw new XMLStreamException(ex); + } + } + + void close() throws XMLStreamException { + try { + _writer.close(); + } catch (IOException ex) { + throw new XMLStreamException(ex); + } + } + + private void nl() throws XMLStreamException { + String lineEnd = System.getProperty("line.separator"); + try { + _writer.write(lineEnd); + } catch (IOException e) { + throw new XMLStreamException("I/O error", e); + } + } + + /** + * Returns a writer for the specified encoding based on an output stream. + * + * @param output The output stream + * @param encoding The encoding + * @return A suitable writer + * @throws UnsupportedEncodingException There is no convertor to support + * this encoding + */ + private Writer getWriter(OutputStream output, String encoding, Charset cs) + throws XMLStreamException, UnsupportedEncodingException + { + if (cs != null) { + return (new OutputStreamWriter(new BufferedOutputStream(output), cs)); + } + + return new OutputStreamWriter(new BufferedOutputStream(output), encoding); + } +} diff --git a/jdk/src/share/classes/sun/invoke/util/ValueConversions.java b/jdk/src/share/classes/sun/invoke/util/ValueConversions.java index 0342080c661..912fab4d99e 100644 --- a/jdk/src/share/classes/sun/invoke/util/ValueConversions.java +++ b/jdk/src/share/classes/sun/invoke/util/ValueConversions.java @@ -449,8 +449,16 @@ public class ValueConversions { * @param x an arbitrary reference value * @return the same value x */ + @SuppressWarnings("unchecked") static T castReference(Class t, U x) { - return t.cast(x); + // inlined Class.cast because we can't ForceInline it + if (x != null && !t.isInstance(x)) + throw newClassCastException(t, x); + return (T) x; + } + + private static ClassCastException newClassCastException(Class t, Object obj) { + return new ClassCastException("Cannot cast " + obj.getClass().getName() + " to " + t.getName()); } private static final MethodHandle IDENTITY, CAST_REFERENCE, ZERO_OBJECT, IGNORE, EMPTY, diff --git a/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMS.java b/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMS.java index 4ce85425f8b..5cfda3cdb74 100644 --- a/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMS.java +++ b/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMS.java @@ -53,7 +53,9 @@ public class LCMS implements PCMM { public static native long getProfileID(ICC_Profile profile); public static native long createNativeTransform( - long[] profileIDs, int renderType, int inFormatter, int outFormatter, + long[] profileIDs, int renderType, + int inFormatter, boolean isInIntPacked, + int outFormatter, boolean isOutIntPacked, Object disposerRef); /** diff --git a/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java b/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java index c53f0def9a2..3695a163211 100644 --- a/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java +++ b/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java @@ -196,7 +196,8 @@ class LCMSImageLayout { case BufferedImage.TYPE_4BYTE_ABGR: byteRaster = (ByteComponentRaster)image.getRaster(); nextRowOffset = byteRaster.getScanlineStride(); - offset = byteRaster.getDataOffset(0); + int firstBand = image.getSampleModel().getNumBands() - 1; + offset = byteRaster.getDataOffset(firstBand); dataArray = byteRaster.getDataStorage(); dataType = DT_BYTE; break; diff --git a/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSTransform.java b/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSTransform.java index 07b5e4a3cce..aa9d0bf054f 100644 --- a/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSTransform.java +++ b/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSTransform.java @@ -55,8 +55,10 @@ import sun.java2d.cmm.lcms.*; public class LCMSTransform implements ColorTransform { long ID; - private int inFormatter; - private int outFormatter; + private int inFormatter = 0; + private boolean isInIntPacked = false; + private int outFormatter = 0; + private boolean isOutIntPacked = false; ICC_Profile[] profiles; long [] profileIDs; @@ -135,18 +137,23 @@ public class LCMSTransform implements ColorTransform { LCMSImageLayout out) { // update native transfrom if needed if (ID == 0L || - inFormatter != in.pixelType || - outFormatter != out.pixelType) { + inFormatter != in.pixelType || isInIntPacked != in.isIntPacked || + outFormatter != out.pixelType || isOutIntPacked != out.isIntPacked) + { if (ID != 0L) { // Disposer will destroy forgotten transform disposerReferent = new Object(); } inFormatter = in.pixelType; + isInIntPacked = in.isIntPacked; + outFormatter = out.pixelType; + isOutIntPacked = out.isIntPacked; ID = LCMS.createNativeTransform(profileIDs, renderType, - inFormatter, outFormatter, + inFormatter, isInIntPacked, + outFormatter, isOutIntPacked, disposerReferent); } diff --git a/jdk/src/share/classes/sun/java2d/pipe/ParallelogramPipe.java b/jdk/src/share/classes/sun/java2d/pipe/ParallelogramPipe.java index 57a9372ec13..3b6b9964776 100644 --- a/jdk/src/share/classes/sun/java2d/pipe/ParallelogramPipe.java +++ b/jdk/src/share/classes/sun/java2d/pipe/ParallelogramPipe.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2011 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/src/share/classes/sun/misc/Unsafe.java b/jdk/src/share/classes/sun/misc/Unsafe.java index 1a279079d6a..8f45c867de0 100644 --- a/jdk/src/share/classes/sun/misc/Unsafe.java +++ b/jdk/src/share/classes/sun/misc/Unsafe.java @@ -1008,4 +1008,125 @@ public final class Unsafe { * if the load average is unobtainable. */ public native int getLoadAverage(double[] loadavg, int nelems); + + // The following contain CAS-based Java implementations used on + // platforms not supporting native instructions + + /** + * Atomically adds the given value to the current value of a field + * or array element within the given object o + * at the given offset. + * + * @param o object/array to update the field/element in + * @param offset field/element offset + * @param delta the value to add + * @return the previous value + * @since 1.8 + */ + public final int getAndAddInt(Object o, long offset, int delta) { + int v; + do { + v = getIntVolatile(o, offset); + } while (!compareAndSwapInt(o, offset, v, v + delta)); + return v; + } + + /** + * Atomically adds the given value to the current value of a field + * or array element within the given object o + * at the given offset. + * + * @param o object/array to update the field/element in + * @param offset field/element offset + * @param delta the value to add + * @return the previous value + * @since 1.8 + */ + public final long getAndAddLong(Object o, long offset, long delta) { + long v; + do { + v = getLongVolatile(o, offset); + } while (!compareAndSwapLong(o, offset, v, v + delta)); + return v; + } + + /** + * Atomically exchanges the given value with the current value of + * a field or array element within the given object o + * at the given offset. + * + * @param o object/array to update the field/element in + * @param offset field/element offset + * @param newValue new value + * @return the previous value + * @since 1.8 + */ + public final int getAndSetInt(Object o, long offset, int newValue) { + int v; + do { + v = getIntVolatile(o, offset); + } while (!compareAndSwapInt(o, offset, v, newValue)); + return v; + } + + /** + * Atomically exchanges the given value with the current value of + * a field or array element within the given object o + * at the given offset. + * + * @param o object/array to update the field/element in + * @param offset field/element offset + * @param newValue new value + * @return the previous value + * @since 1.8 + */ + public final long getAndSetLong(Object o, long offset, long newValue) { + long v; + do { + v = getLongVolatile(o, offset); + } while (!compareAndSwapLong(o, offset, v, newValue)); + return v; + } + + /** + * Atomically exchanges the given reference value with the current + * reference value of a field or array element within the given + * object o at the given offset. + * + * @param o object/array to update the field/element in + * @param offset field/element offset + * @param newValue new value + * @return the previous value + * @since 1.8 + */ + public final Object getAndSetObject(Object o, long offset, Object newValue) { + Object v; + do { + v = getObjectVolatile(o, offset); + } while (!compareAndSwapObject(o, offset, v, newValue)); + return v; + } + + + /** + * Ensures lack of reordering of loads before the fence + * with loads or stores after the fence. + * @since 1.8 + */ + public native void loadFence(); + + /** + * Ensures lack of reordering of stores before the fence + * with loads or stores after the fence. + * @since 1.8 + */ + public native void storeFence(); + + /** + * Ensures lack of reordering of loads or stores before the fence + * with loads or stores after the fence. + * @since 1.8 + */ + public native void fullFence(); + } diff --git a/jdk/src/share/classes/sun/net/www/MessageHeader.java b/jdk/src/share/classes/sun/net/www/MessageHeader.java index dbb2cfc7c3a..3a46def13b3 100644 --- a/jdk/src/share/classes/sun/net/www/MessageHeader.java +++ b/jdk/src/share/classes/sun/net/www/MessageHeader.java @@ -137,6 +137,43 @@ class MessageHeader { return null; } + /** + * Removes bare Negotiate and Kerberos headers when an "NTLM ..." + * appears. All Performed on headers with key being k. + * @return true if there is a change + */ + public boolean filterNTLMResponses(String k) { + boolean found = false; + for (int i=0; i 5 + && values[i].substring(0, 5).equalsIgnoreCase("NTLM ")) { + found = true; + break; + } + } + if (found) { + int j = 0; + for (int i=0; i { int index = 0; int next = -1; diff --git a/jdk/src/share/classes/sun/net/www/http/KeepAliveStream.java b/jdk/src/share/classes/sun/net/www/http/KeepAliveStream.java index 5d694170f86..9155c4ae8c5 100644 --- a/jdk/src/share/classes/sun/net/www/http/KeepAliveStream.java +++ b/jdk/src/share/classes/sun/net/www/http/KeepAliveStream.java @@ -83,11 +83,8 @@ class KeepAliveStream extends MeteredStream implements Hurryable { if (expected > count) { long nskip = expected - count; if (nskip <= available()) { - long n = 0; - while (n < nskip) { - nskip = nskip - n; - n = skip(nskip); - } + do {} while ((nskip = (expected - count)) > 0L + && skip(Math.min(nskip, available())) > 0L); } else if (expected <= KeepAliveStreamCleaner.MAX_DATA_REMAINING && !hurried) { //put this KeepAliveStream on the queue so that the data remaining //on the socket can be cleanup asyncronously. diff --git a/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java b/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java index 87fdaa82bf2..8003b5a5433 100644 --- a/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java +++ b/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java @@ -1326,6 +1326,16 @@ public class HttpURLConnection extends java.net.HttpURLConnection { if (logger.isLoggable(PlatformLogger.FINE)) { logger.fine(responses.toString()); } + + boolean b1 = responses.filterNTLMResponses("WWW-Authenticate"); + boolean b2 = responses.filterNTLMResponses("Proxy-Authenticate"); + if (b1 || b2) { + if (logger.isLoggable(PlatformLogger.FINE)) { + logger.fine(">>>> Headers are filtered"); + logger.fine(responses.toString()); + } + } + inputStream = http.getInputStream(); respCode = getResponseCode(); @@ -1784,6 +1794,13 @@ public class HttpURLConnection extends java.net.HttpURLConnection { logger.fine(responses.toString()); } + if (responses.filterNTLMResponses("Proxy-Authenticate")) { + if (logger.isLoggable(PlatformLogger.FINE)) { + logger.fine(">>>> Headers are filtered"); + logger.fine(responses.toString()); + } + } + statusLine = responses.getValue(0); StringTokenizer st = new StringTokenizer(statusLine); st.nextToken(); diff --git a/jdk/src/share/classes/sun/security/jgss/krb5/Krb5Util.java b/jdk/src/share/classes/sun/security/jgss/krb5/Krb5Util.java index 97f1a12447c..ec5bc9ca43b 100644 --- a/jdk/src/share/classes/sun/security/jgss/krb5/Krb5Util.java +++ b/jdk/src/share/classes/sun/security/jgss/krb5/Krb5Util.java @@ -40,10 +40,7 @@ import sun.security.krb5.EncryptionKey; import sun.security.krb5.KrbException; import java.io.IOException; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; -import java.util.Objects; -import java.util.Set; import sun.security.krb5.KerberosSecrets; import sun.security.krb5.PrincipalName; /** @@ -189,18 +186,6 @@ public class Krb5Util { return subject; } - // A special KerberosKey, used as keys read from a KeyTab object. - // Each time new keys are read from KeyTab objects in the private - // credentials set, old ones are removed and new ones added. - public static class KeysFromKeyTab extends KerberosKey { - private static final long serialVersionUID = 8238092170252746927L; - - public KeysFromKeyTab(KerberosKey key) { - super(key.getPrincipal(), key.getEncoded(), - key.getKeyType(), key.getVersionNumber()); - } - } - /** * Credentials of a service, the private secret to authenticate its * identity, which can be: @@ -239,7 +224,7 @@ public class Krb5Util { // Compatibility with old behavior: even when there is no // KerberosPrincipal, we can find one from KerberosKeys List keys = SubjectComber.findMany( - subj, null, null, KerberosKey.class); + subj, serverPrincipal, null, KerberosKey.class); if (!keys.isEmpty()) { sc.kp = keys.get(0).getPrincipal(); serverPrincipal = sc.kp.getName(); @@ -255,9 +240,9 @@ public class Krb5Util { subj, null, null, KeyTab.class); sc.kk = SubjectComber.findMany( subj, serverPrincipal, null, KerberosKey.class); - sc.tgt = SubjectComber.find(subj, null, null, KerberosTicket.class); - - if (sc.ktabs.isEmpty() && sc.kk.isEmpty()) { + sc.tgt = SubjectComber.find( + subj, null, serverPrincipal, KerberosTicket.class); + if (sc.ktabs.isEmpty() && sc.kk.isEmpty() && sc.tgt == null) { return null; } return sc; @@ -268,37 +253,16 @@ public class Krb5Util { } public KerberosKey[] getKKeys() { - if (ktabs.isEmpty()) { - return kk.toArray(new KerberosKey[kk.size()]); - } else { - List keys = new ArrayList<>(); - for (KeyTab ktab: ktabs) { - for (KerberosKey k: ktab.getKeys(kp)) { - keys.add(k); - } - } - // Compatibility: also add keys to privCredSet. Remove old - // ones first, only remove those from keytab. - if (!subj.isReadOnly()) { - Set pcs = subj.getPrivateCredentials(); - synchronized (pcs) { - Iterator iterator = pcs.iterator(); - while (iterator.hasNext()) { - Object obj = iterator.next(); - if (obj instanceof KeysFromKeyTab) { - KerberosKey key = (KerberosKey)obj; - if (Objects.equals(key.getPrincipal(), kp)) { - iterator.remove(); - } - } - } - } - for (KerberosKey key: keys) { - subj.getPrivateCredentials().add(new KeysFromKeyTab(key)); - } - } - return keys.toArray(new KerberosKey[keys.size()]); + List keys = new ArrayList<>(); + for (KerberosKey k: kk) { + keys.add(k); } + for (KeyTab ktab: ktabs) { + for (KerberosKey k: ktab.getKeys(kp)) { + keys.add(k); + } + } + return keys.toArray(new KerberosKey[keys.size()]); } public EncryptionKey[] getEKeys() { diff --git a/jdk/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java b/jdk/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java index 1c869ade651..1cbc0406ada 100644 --- a/jdk/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java +++ b/jdk/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java @@ -90,10 +90,6 @@ public final class SunNativeProvider extends Provider { "libgssapi_krb5.so", "libgssapi_krb5.so.2", }; - } else if (osname.contains("OS X")) { - gssLibs = new String[]{ - "/usr/lib/sasl2/libgssapiv2.2.so", - }; } } else { gssLibs = new String[]{ defaultLib }; diff --git a/jdk/src/share/classes/sun/security/krb5/EncryptionKey.java b/jdk/src/share/classes/sun/security/krb5/EncryptionKey.java index ebf794e91cb..ba27220f66f 100644 --- a/jdk/src/share/classes/sun/security/krb5/EncryptionKey.java +++ b/jdk/src/share/classes/sun/security/krb5/EncryptionKey.java @@ -555,6 +555,12 @@ public class EncryptionKey int ktype; boolean etypeFound = false; + + // When no matched kvno is found, returns tke key of the same + // etype with the highest kvno + int kvno_found = 0; + EncryptionKey key_found = null; + for (int i = 0; i < keys.length; i++) { ktype = keys[i].getEType(); if (EType.isSupported(ktype)) { @@ -563,6 +569,10 @@ public class EncryptionKey etypeFound = true; if (versionMatches(kvno, kv)) { return keys[i]; + } else if (kv > kvno_found) { + // kv is not null + key_found = keys[i]; + kvno_found = kv; } } } @@ -580,12 +590,17 @@ public class EncryptionKey etypeFound = true; if (versionMatches(kvno, kv)) { return new EncryptionKey(etype, keys[i].getBytes()); + } else if (kv > kvno_found) { + key_found = new EncryptionKey(etype, keys[i].getBytes()); + kvno_found = kv; } } } } if (etypeFound) { - throw new KrbException(Krb5.KRB_AP_ERR_BADKEYVER); + return key_found; + // For compatibility, will not fail here. + //throw new KrbException(Krb5.KRB_AP_ERR_BADKEYVER); } return null; } diff --git a/jdk/src/share/classes/sun/security/provider/ConfigSpiFile.java b/jdk/src/share/classes/sun/security/provider/ConfigSpiFile.java index 998e2633311..3a9ca47677a 100644 --- a/jdk/src/share/classes/sun/security/provider/ConfigSpiFile.java +++ b/jdk/src/share/classes/sun/security/provider/ConfigSpiFile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,81 +25,668 @@ package sun.security.provider; +import java.io.*; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URL; import java.security.AccessController; import java.security.PrivilegedAction; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; +import java.security.Security; import java.security.URIParameter; - +import java.text.MessageFormat; +import java.util.*; +import javax.security.auth.AuthPermission; +import javax.security.auth.login.AppConfigurationEntry; import javax.security.auth.login.Configuration; import javax.security.auth.login.ConfigurationSpi; -import javax.security.auth.login.AppConfigurationEntry; - -import com.sun.security.auth.login.ConfigFile; +import sun.security.util.Debug; +import sun.security.util.PropertyExpander; +import sun.security.util.ResourcesMgr; /** - * This class wraps the ConfigFile subclass implementation of Configuration - * inside a ConfigurationSpi implementation that is available from the - * SUN provider via the Configuration.getInstance calls. + * This class represents a default implementation for + * {@code javax.security.auth.login.Configuration}. * + *

      This object stores the runtime login configuration representation, + * and is the amalgamation of multiple static login + * configurations that resides in files. + * The algorithm for locating the login configuration file(s) and reading their + * information into this {@code Configuration} object is: + * + *

        + *
      1. + * Loop through the security properties, + * login.config.url.1, login.config.url.2, ..., + * login.config.url.X. + * Each property value specifies a URL pointing to a + * login configuration file to be loaded. Read in and load + * each configuration. + * + *
      2. + * The {@code java.lang.System} property + * java.security.auth.login.config + * may also be set to a {@code URL} pointing to another + * login configuration file + * (which is the case when a user uses the -D switch at runtime). + * If this property is defined, and its use is allowed by the + * security property file (the Security property, + * policy.allowSystemProperty is set to true), + * also load that login configuration. + * + *
      3. + * If the java.security.auth.login.config property is defined using + * "==" (rather than "="), then ignore all other specified + * login configurations and only load this configuration. + * + *
      4. + * If no system or security properties were set, try to read from the file, + * ${user.home}/.java.login.config, where ${user.home} is the value + * represented by the "user.home" System property. + *
      + * + *

      The configuration syntax supported by this implementation + * is exactly that syntax specified in the + * {@code javax.security.auth.login.Configuration} class. + * + * @see javax.security.auth.login.LoginContext + * @see java.security.Security security properties */ public final class ConfigSpiFile extends ConfigurationSpi { - private ConfigFile cf; + private URL url; + private boolean expandProp = true; + private Map> configuration; + private int linenum; + private StreamTokenizer st; + private int lookahead; + + private static Debug debugConfig = Debug.getInstance("configfile"); + private static Debug debugParser = Debug.getInstance("configparser"); + + /** + * Create a new {@code Configuration} object. + * + * @throws SecurityException if the {@code Configuration} can not be + * initialized + */ + public ConfigSpiFile() { + try { + init(); + } catch (IOException ioe) { + throw new SecurityException(ioe); + } + } + + /** + * Create a new {@code Configuration} object from the specified {@code URI}. + * + * @param uri the {@code URI} + * @throws SecurityException if the {@code Configuration} can not be + * initialized + * @throws NullPointerException if {@code uri} is null + */ + public ConfigSpiFile(URI uri) { + // only load config from the specified URI + try { + url = uri.toURL(); + init(); + } catch (IOException ioe) { + throw new SecurityException(ioe); + } + } public ConfigSpiFile(final Configuration.Parameters params) - throws java.io.IOException { + throws IOException { // call in a doPrivileged // // we have already passed the Configuration.getInstance // security check. also this class is not freely accessible // (it is in the "sun" package). - // - // we can not put doPrivileged calls into - // ConfigFile because it is a public com.sun class try { - AccessController.doPrivileged(new PrivilegedAction() { - public Void run() { - if (params == null) { - cf = new ConfigFile(); - } else { - if (!(params instanceof URIParameter)) { - throw new IllegalArgumentException - ("Unrecognized parameter: " + params); + AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Void run() throws IOException { + if (params == null) { + init(); + } else { + if (!(params instanceof URIParameter)) { + throw new IllegalArgumentException + ("Unrecognized parameter: " + params); + } + URIParameter uriParam = (URIParameter)params; + url = uriParam.getURI().toURL(); + init(); } - URIParameter uriParam = (URIParameter)params; - - cf = new ConfigFile(uriParam.getURI()); + return null; } - return null; - } }); - } catch (SecurityException se) { - - // if ConfigFile threw a standalone SecurityException - // (no cause), re-throw it. - // - // ConfigFile chains checked IOExceptions to SecurityException. - - Throwable cause = se.getCause(); - if (cause != null && cause instanceof java.io.IOException) { - throw (java.io.IOException)cause; - } - - // unrecognized cause - throw se; + } catch (PrivilegedActionException pae) { + throw (IOException)pae.getException(); } - // if ConfigFile throws some other RuntimeException, + // if init() throws some other RuntimeException, // let it percolate up naturally. } - protected AppConfigurationEntry[] engineGetAppConfigurationEntry - (String name) { - return cf.getAppConfigurationEntry(name); + /** + * Read and initialize the entire login Configuration from the configured + * URL. + * + * @throws IOException if the Configuration can not be initialized + * @throws SecurityException if the caller does not have permission + * to initialize the Configuration + */ + private void init() throws IOException { + + boolean initialized = false; + + // For policy.expandProperties, check if either a security or system + // property is set to false (old code erroneously checked the system + // prop so we must check both to preserve compatibility). + String expand = Security.getProperty("policy.expandProperties"); + if (expand == null) { + expand = System.getProperty("policy.expandProperties"); + } + if ("false".equals(expand)) { + expandProp = false; + } + + // new configuration + Map> newConfig = new HashMap<>(); + + if (url != null) { + /** + * If the caller specified a URI via Configuration.getInstance, + * we only read from that URI + */ + if (debugConfig != null) { + debugConfig.println("reading " + url); + } + init(url, newConfig); + configuration = newConfig; + return; + } + + /** + * Caller did not specify URI via Configuration.getInstance. + * Read from URLs listed in the java.security properties file. + */ + String allowSys = Security.getProperty("policy.allowSystemProperty"); + + if ("true".equalsIgnoreCase(allowSys)) { + String extra_config = System.getProperty + ("java.security.auth.login.config"); + if (extra_config != null) { + boolean overrideAll = false; + if (extra_config.startsWith("=")) { + overrideAll = true; + extra_config = extra_config.substring(1); + } + try { + extra_config = PropertyExpander.expand(extra_config); + } catch (PropertyExpander.ExpandException peee) { + MessageFormat form = new MessageFormat + (ResourcesMgr.getString + ("Unable.to.properly.expand.config", + "sun.security.util.AuthResources")); + Object[] source = {extra_config}; + throw new IOException(form.format(source)); + } + + URL configURL = null; + try { + configURL = new URL(extra_config); + } catch (MalformedURLException mue) { + File configFile = new File(extra_config); + if (configFile.exists()) { + configURL = configFile.toURI().toURL(); + } else { + MessageFormat form = new MessageFormat + (ResourcesMgr.getString + ("extra.config.No.such.file.or.directory.", + "sun.security.util.AuthResources")); + Object[] source = {extra_config}; + throw new IOException(form.format(source)); + } + } + + if (debugConfig != null) { + debugConfig.println("reading "+configURL); + } + init(configURL, newConfig); + initialized = true; + if (overrideAll) { + if (debugConfig != null) { + debugConfig.println("overriding other policies!"); + } + configuration = newConfig; + return; + } + } + } + + int n = 1; + String config_url; + while ((config_url = Security.getProperty + ("login.config.url."+n)) != null) { + try { + config_url = PropertyExpander.expand + (config_url).replace(File.separatorChar, '/'); + if (debugConfig != null) { + debugConfig.println("\tReading config: " + config_url); + } + init(new URL(config_url), newConfig); + initialized = true; + } catch (PropertyExpander.ExpandException peee) { + MessageFormat form = new MessageFormat + (ResourcesMgr.getString + ("Unable.to.properly.expand.config", + "sun.security.util.AuthResources")); + Object[] source = {config_url}; + throw new IOException(form.format(source)); + } + n++; + } + + if (initialized == false && n == 1 && config_url == null) { + + // get the config from the user's home directory + if (debugConfig != null) { + debugConfig.println("\tReading Policy " + + "from ~/.java.login.config"); + } + config_url = System.getProperty("user.home"); + String userConfigFile = config_url + + File.separatorChar + ".java.login.config"; + + // No longer throws an exception when there's no config file + // at all. Returns an empty Configuration instead. + if (new File(userConfigFile).exists()) { + init(new File(userConfigFile).toURI().toURL(), + newConfig); + } + } + + configuration = newConfig; } - protected void engineRefresh() { - cf.refresh(); + private void init(URL config, + Map> newConfig) + throws IOException { + + try (InputStreamReader isr + = new InputStreamReader(getInputStream(config), "UTF-8")) { + readConfig(isr, newConfig); + } catch (FileNotFoundException fnfe) { + if (debugConfig != null) { + debugConfig.println(fnfe.toString()); + } + throw new IOException(ResourcesMgr.getString + ("Configuration.Error.No.such.file.or.directory", + "sun.security.util.AuthResources")); + } + } + + /** + * Retrieve an entry from the Configuration using an application name + * as an index. + * + * @param applicationName the name used to index the Configuration. + * @return an array of AppConfigurationEntries which correspond to + * the stacked configuration of LoginModules for this + * application, or null if this application has no configured + * LoginModules. + */ + @Override + public AppConfigurationEntry[] engineGetAppConfigurationEntry + (String applicationName) { + + List list = null; + synchronized (configuration) { + list = configuration.get(applicationName); + } + + if (list == null || list.size() == 0) + return null; + + AppConfigurationEntry[] entries = + new AppConfigurationEntry[list.size()]; + Iterator iterator = list.iterator(); + for (int i = 0; iterator.hasNext(); i++) { + AppConfigurationEntry e = iterator.next(); + entries[i] = new AppConfigurationEntry(e.getLoginModuleName(), + e.getControlFlag(), + e.getOptions()); + } + return entries; + } + + /** + * Refresh and reload the Configuration by re-reading all of the + * login configurations. + * + * @throws SecurityException if the caller does not have permission + * to refresh the Configuration. + */ + @Override + public synchronized void engineRefresh() { + + SecurityManager sm = System.getSecurityManager(); + if (sm != null) + sm.checkPermission(new AuthPermission("refreshLoginConfiguration")); + + AccessController.doPrivileged(new PrivilegedAction() { + public Void run() { + try { + init(); + } catch (IOException ioe) { + throw new SecurityException(ioe.getLocalizedMessage(), ioe); + } + return null; + } + }); + } + + private void readConfig(Reader reader, + Map> newConfig) + throws IOException { + + linenum = 1; + + if (!(reader instanceof BufferedReader)) + reader = new BufferedReader(reader); + + st = new StreamTokenizer(reader); + st.quoteChar('"'); + st.wordChars('$', '$'); + st.wordChars('_', '_'); + st.wordChars('-', '-'); + st.lowerCaseMode(false); + st.slashSlashComments(true); + st.slashStarComments(true); + st.eolIsSignificant(true); + + lookahead = nextToken(); + while (lookahead != StreamTokenizer.TT_EOF) { + parseLoginEntry(newConfig); + } + } + + private void parseLoginEntry( + Map> newConfig) + throws IOException { + + List configEntries = new LinkedList<>(); + + // application name + String appName = st.sval; + lookahead = nextToken(); + + if (debugParser != null) { + debugParser.println("\tReading next config entry: " + appName); + } + + match("{"); + + // get the modules + while (peek("}") == false) { + // get the module class name + String moduleClass = match("module class name"); + + // controlFlag (required, optional, etc) + AppConfigurationEntry.LoginModuleControlFlag controlFlag; + String sflag = match("controlFlag").toUpperCase(); + switch (sflag) { + case "REQUIRED": + controlFlag = + AppConfigurationEntry.LoginModuleControlFlag.REQUIRED; + break; + case "REQUISITE": + controlFlag = + AppConfigurationEntry.LoginModuleControlFlag.REQUISITE; + break; + case "SUFFICIENT": + controlFlag = + AppConfigurationEntry.LoginModuleControlFlag.SUFFICIENT; + break; + case "OPTIONAL": + controlFlag = + AppConfigurationEntry.LoginModuleControlFlag.OPTIONAL; + break; + default: + MessageFormat form = new MessageFormat( + ResourcesMgr.getString + ("Configuration.Error.Invalid.control.flag.flag", + "sun.security.util.AuthResources")); + Object[] source = {sflag}; + throw new IOException(form.format(source)); + } + + // get the args + Map options = new HashMap<>(); + while (peek(";") == false) { + String key = match("option key"); + match("="); + try { + options.put(key, expand(match("option value"))); + } catch (PropertyExpander.ExpandException peee) { + throw new IOException(peee.getLocalizedMessage()); + } + } + + lookahead = nextToken(); + + // create the new element + if (debugParser != null) { + debugParser.println("\t\t" + moduleClass + ", " + sflag); + for (String key : options.keySet()) { + debugParser.println("\t\t\t" + key + + "=" + options.get(key)); + } + } + configEntries.add(new AppConfigurationEntry(moduleClass, + controlFlag, options)); + } + + match("}"); + match(";"); + + // add this configuration entry + if (newConfig.containsKey(appName)) { + MessageFormat form = new MessageFormat(ResourcesMgr.getString + ("Configuration.Error.Can.not.specify.multiple.entries.for.appName", + "sun.security.util.AuthResources")); + Object[] source = {appName}; + throw new IOException(form.format(source)); + } + newConfig.put(appName, configEntries); + } + + private String match(String expect) throws IOException { + + String value = null; + + switch(lookahead) { + case StreamTokenizer.TT_EOF: + + MessageFormat form1 = new MessageFormat(ResourcesMgr.getString + ("Configuration.Error.expected.expect.read.end.of.file.", + "sun.security.util.AuthResources")); + Object[] source1 = {expect}; + throw new IOException(form1.format(source1)); + + case '"': + case StreamTokenizer.TT_WORD: + + if (expect.equalsIgnoreCase("module class name") || + expect.equalsIgnoreCase("controlFlag") || + expect.equalsIgnoreCase("option key") || + expect.equalsIgnoreCase("option value")) { + value = st.sval; + lookahead = nextToken(); + } else { + MessageFormat form = new MessageFormat(ResourcesMgr.getString + ("Configuration.Error.Line.line.expected.expect.found.value.", + "sun.security.util.AuthResources")); + Object[] source = {new Integer(linenum), expect, st.sval}; + throw new IOException(form.format(source)); + } + break; + + case '{': + + if (expect.equalsIgnoreCase("{")) { + lookahead = nextToken(); + } else { + MessageFormat form = new MessageFormat(ResourcesMgr.getString + ("Configuration.Error.Line.line.expected.expect.", + "sun.security.util.AuthResources")); + Object[] source = {new Integer(linenum), expect, st.sval}; + throw new IOException(form.format(source)); + } + break; + + case ';': + + if (expect.equalsIgnoreCase(";")) { + lookahead = nextToken(); + } else { + MessageFormat form = new MessageFormat(ResourcesMgr.getString + ("Configuration.Error.Line.line.expected.expect.", + "sun.security.util.AuthResources")); + Object[] source = {new Integer(linenum), expect, st.sval}; + throw new IOException(form.format(source)); + } + break; + + case '}': + + if (expect.equalsIgnoreCase("}")) { + lookahead = nextToken(); + } else { + MessageFormat form = new MessageFormat(ResourcesMgr.getString + ("Configuration.Error.Line.line.expected.expect.", + "sun.security.util.AuthResources")); + Object[] source = {new Integer(linenum), expect, st.sval}; + throw new IOException(form.format(source)); + } + break; + + case '=': + + if (expect.equalsIgnoreCase("=")) { + lookahead = nextToken(); + } else { + MessageFormat form = new MessageFormat(ResourcesMgr.getString + ("Configuration.Error.Line.line.expected.expect.", + "sun.security.util.AuthResources")); + Object[] source = {new Integer(linenum), expect, st.sval}; + throw new IOException(form.format(source)); + } + break; + + default: + MessageFormat form = new MessageFormat(ResourcesMgr.getString + ("Configuration.Error.Line.line.expected.expect.found.value.", + "sun.security.util.AuthResources")); + Object[] source = {new Integer(linenum), expect, st.sval}; + throw new IOException(form.format(source)); + } + return value; + } + + private boolean peek(String expect) { + boolean found = false; + + switch (lookahead) { + case ',': + if (expect.equalsIgnoreCase(",")) + found = true; + break; + case ';': + if (expect.equalsIgnoreCase(";")) + found = true; + break; + case '{': + if (expect.equalsIgnoreCase("{")) + found = true; + break; + case '}': + if (expect.equalsIgnoreCase("}")) + found = true; + break; + default: + } + return found; + } + + private int nextToken() throws IOException { + int tok; + while ((tok = st.nextToken()) == StreamTokenizer.TT_EOL) { + linenum++; + } + return tok; + } + + private InputStream getInputStream(URL url) throws IOException { + if ("file".equalsIgnoreCase(url.getProtocol())) { + // Compatibility notes: + // + // Code changed from + // String path = url.getFile().replace('/', File.separatorChar); + // return new FileInputStream(path); + // + // The original implementation would search for "/tmp/a%20b" + // when url is "file:///tmp/a%20b". This is incorrect. The + // current codes fix this bug and searches for "/tmp/a b". + // For compatibility reasons, when the file "/tmp/a b" does + // not exist, the file named "/tmp/a%20b" will be tried. + // + // This also means that if both file exists, the behavior of + // this method is changed, and the current codes choose the + // correct one. + try { + return url.openStream(); + } catch (Exception e) { + String file = url.getPath(); + if (url.getHost().length() > 0) { // For Windows UNC + file = "//" + url.getHost() + file; + } + if (debugConfig != null) { + debugConfig.println("cannot read " + url + + ", try " + file); + } + return new FileInputStream(file); + } + } else { + return url.openStream(); + } + } + + private String expand(String value) + throws PropertyExpander.ExpandException, IOException { + + if (value.isEmpty()) { + return value; + } + + if (expandProp) { + + String s = PropertyExpander.expand(value); + + if (s == null || s.length() == 0) { + MessageFormat form = new MessageFormat(ResourcesMgr.getString + ("Configuration.Error.Line.line.system.property.value.expanded.to.empty.value", + "sun.security.util.AuthResources")); + Object[] source = {new Integer(linenum), value}; + throw new IOException(form.format(source)); + } + return s; + } else { + return value; + } } } diff --git a/jdk/src/share/classes/sun/text/bidi/BidiBase.java b/jdk/src/share/classes/sun/text/bidi/BidiBase.java index a0a643b4d22..6dc4196d8a8 100644 --- a/jdk/src/share/classes/sun/text/bidi/BidiBase.java +++ b/jdk/src/share/classes/sun/text/bidi/BidiBase.java @@ -3251,10 +3251,9 @@ public class BidiBase { { verifyValidParaOrLine(); BidiLine.getRuns(this); - if (runCount == 1) { + if (run < 0 || run >= runCount) { return getParaLevel(); } - verifyIndex(run, 0, runCount); getLogicalToVisualRunsMap(); return runs[logicalToVisualRunsMap[run]].level; } diff --git a/jdk/src/share/classes/sun/text/resources/FormatData.java b/jdk/src/share/classes/sun/text/resources/FormatData.java index 2031cb42228..d6c306709a8 100644 --- a/jdk/src/share/classes/sun/text/resources/FormatData.java +++ b/jdk/src/share/classes/sun/text/resources/FormatData.java @@ -50,6 +50,20 @@ public class FormatData extends ListResourceBundle { * Overrides ListResourceBundle */ protected final Object[][] getContents() { + final String[] buddhistEras = new String[] { // Thai Buddhist calendar era strings + "BC", // BC + "B.E." // Buddhist Era + }; + + // Japanese imperial calendar era abbreviations + final String[] japaneseEraAbbrs = new String[] { + "", + "M", + "T", + "S", + "H", + }; + return new Object[][] { { "MonthNames", new String[] { @@ -107,29 +121,49 @@ public class FormatData extends ListResourceBundle { "Sat" // abb Saturday } }, + { "DayNarrows", + new String[] { + "S", + "M", + "T", + "W", + "T", + "F", + "S", + } + }, { "AmPmMarkers", new String[] { "AM", // am marker "PM" // pm marker } }, + { "narrow.AmPmMarkers", + new String[] { + "a", // am marker + "p" // pm marker + } + }, { "Eras", new String[] { // era strings for GregorianCalendar "BC", "AD" } }, - { "buddhist.Eras", - new String[] { // Thai Buddhist calendar era strings - "BC", // BC - "B.E." // Buddhist Era + { "narrow.Eras", + new String[] { + "B", + "A", } }, + { "buddhist.Eras", + buddhistEras + }, { "buddhist.short.Eras", - new String[] { // Thai Buddhist calendar era strings - "BC", // BC - "B.E." // Buddhist Era - } + buddhistEras + }, + { "buddhist.narrow.Eras", + buddhistEras }, { "japanese.Eras", new String[] { // Japanese imperial calendar era strings @@ -141,13 +175,10 @@ public class FormatData extends ListResourceBundle { } }, { "japanese.short.Eras", - new String[] { // Japanese imperial calendar era abbreviations - "", - "M", - "T", - "S", - "H", - } + japaneseEraAbbrs + }, + { "japanese.narrow.Eras", + japaneseEraAbbrs }, { "japanese.FirstYear", new String[] { // Japanese imperial calendar year name diff --git a/jdk/src/share/classes/sun/text/resources/ar/FormatData_ar.java b/jdk/src/share/classes/sun/text/resources/ar/FormatData_ar.java index 98b2e4e4e9e..a6593b0a45c 100644 --- a/jdk/src/share/classes/sun/text/resources/ar/FormatData_ar.java +++ b/jdk/src/share/classes/sun/text/resources/ar/FormatData_ar.java @@ -107,6 +107,17 @@ public class FormatData_ar extends ListResourceBundle { "\u0633" // abb Saturday } }, + { "DayNarrows", + new String[] { + "\u062d", + "\u0646", + "\u062b", + "\u0631", + "\u062e", + "\u062c", + "\u0633", + } + }, { "AmPmMarkers", new String[] { "\u0635", // am marker diff --git a/jdk/src/share/classes/sun/text/resources/be/FormatData_be.java b/jdk/src/share/classes/sun/text/resources/be/FormatData_be.java index 754532659ff..7bf6c012163 100644 --- a/jdk/src/share/classes/sun/text/resources/be/FormatData_be.java +++ b/jdk/src/share/classes/sun/text/resources/be/FormatData_be.java @@ -85,6 +85,23 @@ public class FormatData_be extends ListResourceBundle { "" // abb month 13 if applicable } }, + { "standalone.MonthNarrows", + new String[] { + "\u0441", + "\u043b", + "\u0441", + "\u043a", + "\u043c", + "\u0447", + "\u043b", + "\u0436", + "\u0432", + "\u043a", + "\u043b", + "\u0441", + "", + } + }, { "DayNames", new String[] { "\u043d\u044f\u0434\u0437\u0435\u043b\u044f", // Sunday @@ -107,6 +124,17 @@ public class FormatData_be extends ListResourceBundle { "\u0441\u0431" // abb Saturday } }, + { "DayNarrows", + new String[] { + "\u043d", + "\u043f", + "\u0430", + "\u0441", + "\u0447", + "\u043f", + "\u0441", + } + }, { "Eras", new String[] { // era strings "\u0434\u0430 \u043d.\u0435.", diff --git a/jdk/src/share/classes/sun/text/resources/bg/FormatData_bg.java b/jdk/src/share/classes/sun/text/resources/bg/FormatData_bg.java index 2fe39282e35..2b7285eefad 100644 --- a/jdk/src/share/classes/sun/text/resources/bg/FormatData_bg.java +++ b/jdk/src/share/classes/sun/text/resources/bg/FormatData_bg.java @@ -107,6 +107,17 @@ public class FormatData_bg extends ListResourceBundle { "\u0421\u0431" // abb Saturday } }, + { "DayNarrows", + new String[] { + "\u043d", + "\u043f", + "\u0432", + "\u0441", + "\u0447", + "\u043f", + "\u0441", + } + }, { "Eras", new String[] { // era strings "\u043f\u0440.\u043d.\u0435.", diff --git a/jdk/src/share/classes/sun/text/resources/ca/FormatData_ca.java b/jdk/src/share/classes/sun/text/resources/ca/FormatData_ca.java index 2f9cf3967d3..d6774dbacb6 100644 --- a/jdk/src/share/classes/sun/text/resources/ca/FormatData_ca.java +++ b/jdk/src/share/classes/sun/text/resources/ca/FormatData_ca.java @@ -119,6 +119,23 @@ public class FormatData_ca extends ListResourceBundle { "" // abb month 13 if applicable } }, + { "standalone.MonthNarrows", + new String[] { + "g", + "f", + "m", + "a", + "m", + "j", + "j", + "a", + "s", + "o", + "n", + "d", + "", + } + }, { "DayNames", new String[] { "diumenge", // Sunday @@ -141,6 +158,28 @@ public class FormatData_ca extends ListResourceBundle { "ds." // abb Saturday } }, + { "DayNarrows", + new String[] { + "G", + "L", // Note: contributed item in CDLR + "T", + "C", + "J", + "V", + "S", + } + }, + { "standalone.DayNarrows", + new String[] { + "g", + "l", + "t", + "c", + "j", + "v", + "s", + } + }, { "NumberElements", new String[] { ",", // decimal separator diff --git a/jdk/src/share/classes/sun/text/resources/cs/FormatData_cs.java b/jdk/src/share/classes/sun/text/resources/cs/FormatData_cs.java index 2bbc8c03bdf..e0d34098b09 100644 --- a/jdk/src/share/classes/sun/text/resources/cs/FormatData_cs.java +++ b/jdk/src/share/classes/sun/text/resources/cs/FormatData_cs.java @@ -141,6 +141,17 @@ public class FormatData_cs extends ListResourceBundle { "So" // abb Saturday } }, + { "DayNarrows", + new String[] { + "N", + "P", + "\u00da", + "S", + "\u010c", + "P", + "S", + } + }, { "AmPmMarkers", new String[] { "dop.", // am marker diff --git a/jdk/src/share/classes/sun/text/resources/da/FormatData_da.java b/jdk/src/share/classes/sun/text/resources/da/FormatData_da.java index d9535cf551e..2686877c0a3 100644 --- a/jdk/src/share/classes/sun/text/resources/da/FormatData_da.java +++ b/jdk/src/share/classes/sun/text/resources/da/FormatData_da.java @@ -124,6 +124,17 @@ public class FormatData_da extends ListResourceBundle { "l\u00f8" // abb Saturday } }, + { "DayNarrows", + new String[] { + "S", + "M", + "T", + "O", + "T", + "F", + "L", + } + }, { "NumberElements", new String[] { ",", // decimal separator diff --git a/jdk/src/share/classes/sun/text/resources/de/FormatData_de.java b/jdk/src/share/classes/sun/text/resources/de/FormatData_de.java index d2fe2f22190..3f55bb20ba6 100644 --- a/jdk/src/share/classes/sun/text/resources/de/FormatData_de.java +++ b/jdk/src/share/classes/sun/text/resources/de/FormatData_de.java @@ -124,6 +124,17 @@ public class FormatData_de extends ListResourceBundle { "Sa" // abb Saturday } }, + { "DayNarrows", + new String[] { + "S", + "M", + "D", + "M", + "D", + "F", + "S", + } + }, { "Eras", new String[] { // era strings "v. Chr.", diff --git a/jdk/src/share/classes/sun/text/resources/el/FormatData_el.java b/jdk/src/share/classes/sun/text/resources/el/FormatData_el.java index 49e0602f525..fd91ad2aea3 100644 --- a/jdk/src/share/classes/sun/text/resources/el/FormatData_el.java +++ b/jdk/src/share/classes/sun/text/resources/el/FormatData_el.java @@ -124,6 +124,17 @@ public class FormatData_el extends ListResourceBundle { "\u03a3\u03b1\u03b2" // abb Saturday } }, + { "DayNarrows", + new String[] { + "\u039a", + "\u0394", + "\u03a4", + "\u03a4", + "\u03a0", + "\u03a0", + "\u03a3", + } + }, { "AmPmMarkers", new String[] { "\u03c0\u03bc", // am marker diff --git a/jdk/src/share/classes/sun/text/resources/es/FormatData_es.java b/jdk/src/share/classes/sun/text/resources/es/FormatData_es.java index 3ee44ba042b..f19685dd83d 100644 --- a/jdk/src/share/classes/sun/text/resources/es/FormatData_es.java +++ b/jdk/src/share/classes/sun/text/resources/es/FormatData_es.java @@ -104,6 +104,17 @@ public class FormatData_es extends ListResourceBundle { "s\u00e1b" // abb Saturday } }, + { "DayNarrows", + new String[] { + "D", + "L", + "M", + "X", + "J", + "V", + "S", + } + }, { "NumberPatterns", new String[] { "#,##0.###;-#,##0.###", // decimal pattern diff --git a/jdk/src/share/classes/sun/text/resources/et/FormatData_et.java b/jdk/src/share/classes/sun/text/resources/et/FormatData_et.java index 90f4dcc7daa..844b8af4285 100644 --- a/jdk/src/share/classes/sun/text/resources/et/FormatData_et.java +++ b/jdk/src/share/classes/sun/text/resources/et/FormatData_et.java @@ -104,6 +104,17 @@ public class FormatData_et extends ListResourceBundle { "L" // abb Saturday } }, + { "DayNarrows", + new String[] { + "P", + "E", + "T", + "K", + "N", + "R", + "L", + } + }, { "Eras", new String[] { // era strings "e.m.a.", diff --git a/jdk/src/share/classes/sun/text/resources/fi/FormatData_fi.java b/jdk/src/share/classes/sun/text/resources/fi/FormatData_fi.java index d8a610d6056..91c5ea9a57a 100644 --- a/jdk/src/share/classes/sun/text/resources/fi/FormatData_fi.java +++ b/jdk/src/share/classes/sun/text/resources/fi/FormatData_fi.java @@ -116,6 +116,23 @@ public class FormatData_fi extends ListResourceBundle { "" // abb month 13 if applicable } }, + { "standalone.MonthNarrows", + new String[] { + "T", + "H", + "M", + "H", + "T", + "K", + "H", + "E", + "S", + "L", + "M", + "J", + "", + } + }, { "DayNames", new String[] { "sunnuntai", // Sunday @@ -138,6 +155,28 @@ public class FormatData_fi extends ListResourceBundle { "la" // abb Saturday } }, + { "DayNarrows", + new String[] { + "S", + "M", + "T", + "K", + "T", + "P", + "L", + } + }, + { "standalone.DayNarrows", + new String[] { + "S", + "M", + "T", + "K", + "T", + "P", + "L", + } + }, { "NumberElements", new String[] { ",", // decimal separator @@ -181,6 +220,12 @@ public class FormatData_fi extends ListResourceBundle { "ip." // pm marker } }, + { "narrow.AmPmMarkers", + new String[] { + "ap.", + "ip.", + } + }, }; } } diff --git a/jdk/src/share/classes/sun/text/resources/fr/FormatData_fr.java b/jdk/src/share/classes/sun/text/resources/fr/FormatData_fr.java index de857d7c879..f0354ec1066 100644 --- a/jdk/src/share/classes/sun/text/resources/fr/FormatData_fr.java +++ b/jdk/src/share/classes/sun/text/resources/fr/FormatData_fr.java @@ -104,6 +104,17 @@ public class FormatData_fr extends ListResourceBundle { "sam." // abb Saturday } }, + { "DayNarrows", + new String[] { + "D", + "L", + "M", + "M", + "J", + "V", + "S", + } + }, { "Eras", new String[] { // era strings "BC", diff --git a/jdk/src/share/classes/sun/text/resources/hi/FormatData_hi_IN.java b/jdk/src/share/classes/sun/text/resources/hi/FormatData_hi_IN.java index b6c1647275f..7f1deb81c3a 100644 --- a/jdk/src/share/classes/sun/text/resources/hi/FormatData_hi_IN.java +++ b/jdk/src/share/classes/sun/text/resources/hi/FormatData_hi_IN.java @@ -99,6 +99,17 @@ public class FormatData_hi_IN extends ListResourceBundle { "\u0936\u0928\u093f" // abb Saturday } }, + { "DayNarrows", + new String[] { + "\u0930", + "\u0938\u094b", + "\u092e\u0902", + "\u092c\u0941", + "\u0917\u0941", + "\u0936\u0941", + "\u0936", + } + }, { "AmPmMarkers", new String[] { "\u092a\u0942\u0930\u094d\u0935\u093e\u0939\u094d\u0928", // am marker diff --git a/jdk/src/share/classes/sun/text/resources/hr/FormatData_hr.java b/jdk/src/share/classes/sun/text/resources/hr/FormatData_hr.java index 635b3b97ff2..cec08671ca1 100644 --- a/jdk/src/share/classes/sun/text/resources/hr/FormatData_hr.java +++ b/jdk/src/share/classes/sun/text/resources/hr/FormatData_hr.java @@ -116,6 +116,23 @@ public class FormatData_hr extends ListResourceBundle { "" // abb month 13 if applicable } }, + { "standalone.MonthNarrows", + new String[] { + "1.", + "2.", + "3.", + "4.", + "5.", + "6.", + "7.", + "8.", + "9.", + "10.", + "11.", + "12.", + "", + } + }, { "DayNames", new String[] { "nedjelja", // Sunday @@ -138,6 +155,28 @@ public class FormatData_hr extends ListResourceBundle { "sub" // abb Saturday } }, + { "DayNarrows", + new String[] { + "N", + "P", + "U", + "S", + "\u010c", + "P", + "S", + } + }, + { "standalone.DayNarrows", + new String[] { + "n", + "p", + "u", + "s", + "\u010d", + "p", + "s", + } + }, { "NumberElements", new String[] { ",", // decimal separator diff --git a/jdk/src/share/classes/sun/text/resources/hu/FormatData_hu.java b/jdk/src/share/classes/sun/text/resources/hu/FormatData_hu.java index a1ab3906f44..0f00a40aa5f 100644 --- a/jdk/src/share/classes/sun/text/resources/hu/FormatData_hu.java +++ b/jdk/src/share/classes/sun/text/resources/hu/FormatData_hu.java @@ -104,6 +104,17 @@ public class FormatData_hu extends ListResourceBundle { "Szo" // abb Saturday } }, + { "DayNarrows", + new String[] { + "V", + "H", + "K", + "Sz", + "Cs", + "P", + "Sz", + } + }, { "AmPmMarkers", new String[] { "DE", // am marker diff --git a/jdk/src/share/classes/sun/text/resources/is/FormatData_is.java b/jdk/src/share/classes/sun/text/resources/is/FormatData_is.java index 9a3e0ff21cb..6b6d92c6421 100644 --- a/jdk/src/share/classes/sun/text/resources/is/FormatData_is.java +++ b/jdk/src/share/classes/sun/text/resources/is/FormatData_is.java @@ -82,6 +82,23 @@ public class FormatData_is extends ListResourceBundle { "" // abb month 13 if applicable } }, + { "standalone.MonthNarrows", + new String[] { + "j", + "f", + "m", + "a", + "m", + "j", + "j", + "\u00e1", + "s", + "o", + "n", + "d", + "", + } + }, { "DayNames", new String[] { "sunnudagur", // Sunday @@ -104,6 +121,28 @@ public class FormatData_is extends ListResourceBundle { "lau." // abb Saturday } }, + { "DayNarrows", + new String[] { + "S", + "M", + "\u00de", + "M", + "F", + "F", + "L", + } + }, + { "standalone.DayNarrows", + new String[] { + "s", + "m", + "\u00fe", + "m", + "f", + "f", + "l", + } + }, { "NumberElements", new String[] { ",", // decimal separator diff --git a/jdk/src/share/classes/sun/text/resources/it/FormatData_it.java b/jdk/src/share/classes/sun/text/resources/it/FormatData_it.java index a9843cca23d..5b3fa9ca82e 100644 --- a/jdk/src/share/classes/sun/text/resources/it/FormatData_it.java +++ b/jdk/src/share/classes/sun/text/resources/it/FormatData_it.java @@ -121,6 +121,17 @@ public class FormatData_it extends ListResourceBundle { "sab" // abb Saturday } }, + { "DayNarrows", + new String[] { + "D", + "L", + "M", + "M", + "G", + "V", + "S", + } + }, { "Eras", new String[] { // era strings "BC", diff --git a/jdk/src/share/classes/sun/text/resources/iw/FormatData_iw.java b/jdk/src/share/classes/sun/text/resources/iw/FormatData_iw.java index cfadcdfbf93..80fb1ac4b83 100644 --- a/jdk/src/share/classes/sun/text/resources/iw/FormatData_iw.java +++ b/jdk/src/share/classes/sun/text/resources/iw/FormatData_iw.java @@ -121,6 +121,28 @@ public class FormatData_iw extends ListResourceBundle { "\u05e9" // abb Saturday } }, + { "DayNarrows", + new String[] { + "\u05d0", + "\u05d1", + "\u05d2", + "\u05d3", + "\u05d4", + "\u05d5", + "\u05e9", + } + }, + { "standalone.DayNarrows", + new String[] { + "\u05d0", + "\u05d1", + "\u05d2", + "\u05d3", + "\u05d4", + "\u05d5", + "\u05e9", + } + }, { "Eras", new String[] { // era strings "\u05dc\u05e1\u05d4\"\u05e0", diff --git a/jdk/src/share/classes/sun/text/resources/ja/FormatData_ja.java b/jdk/src/share/classes/sun/text/resources/ja/FormatData_ja.java index 6217d5a4a16..a45992952ea 100644 --- a/jdk/src/share/classes/sun/text/resources/ja/FormatData_ja.java +++ b/jdk/src/share/classes/sun/text/resources/ja/FormatData_ja.java @@ -104,6 +104,17 @@ public class FormatData_ja extends ListResourceBundle { "\u571f" // abb Saturday } }, + { "DayNarrows", + new String[] { + "\u65e5", + "\u6708", + "\u706b", + "\u6c34", + "\u6728", + "\u91d1", + "\u571f", + } + }, { "AmPmMarkers", new String[] { "\u5348\u524d", // am marker diff --git a/jdk/src/share/classes/sun/text/resources/ko/FormatData_ko.java b/jdk/src/share/classes/sun/text/resources/ko/FormatData_ko.java index b574bfba890..fc8badb82bf 100644 --- a/jdk/src/share/classes/sun/text/resources/ko/FormatData_ko.java +++ b/jdk/src/share/classes/sun/text/resources/ko/FormatData_ko.java @@ -104,6 +104,17 @@ public class FormatData_ko extends ListResourceBundle { "\ud1a0" // abb Saturday } }, + { "DayNarrows", + new String[] { + "\uc77c", + "\uc6d4", + "\ud654", + "\uc218", + "\ubaa9", + "\uae08", + "\ud1a0", + } + }, { "AmPmMarkers", new String[] { "\uc624\uc804", // am marker diff --git a/jdk/src/share/classes/sun/text/resources/lt/FormatData_lt.java b/jdk/src/share/classes/sun/text/resources/lt/FormatData_lt.java index 6fdb6c10858..9e949ecf563 100644 --- a/jdk/src/share/classes/sun/text/resources/lt/FormatData_lt.java +++ b/jdk/src/share/classes/sun/text/resources/lt/FormatData_lt.java @@ -99,6 +99,23 @@ public class FormatData_lt extends ListResourceBundle { "" // abb month 13 if applicable } }, + { "standalone.MonthNarrows", + new String[] { + "S", + "V", + "K", + "B", + "G", + "B", + "L", + "R", + "R", + "S", + "L", + "G", + "", + } + }, { "DayNames", new String[] { "Sekmadienis", // Sunday @@ -121,6 +138,28 @@ public class FormatData_lt extends ListResourceBundle { "\u0160t" // abb Saturday } }, + { "DayNarrows", + new String[] { + "S", + "P", + "A", + "T", + "K", + "P", + "\u0160", + } + }, + { "standalone.DayNarrows", + new String[] { + "S", + "P", + "A", + "T", + "K", + "P", + "\u0160", + } + }, { "Eras", new String[] { // era strings "pr.Kr.", diff --git a/jdk/src/share/classes/sun/text/resources/lv/FormatData_lv.java b/jdk/src/share/classes/sun/text/resources/lv/FormatData_lv.java index e1aadceb01b..ff9eb470d4b 100644 --- a/jdk/src/share/classes/sun/text/resources/lv/FormatData_lv.java +++ b/jdk/src/share/classes/sun/text/resources/lv/FormatData_lv.java @@ -121,6 +121,17 @@ public class FormatData_lv extends ListResourceBundle { "S" // abb Saturday } }, + { "DayNarrows", + new String[] { + "S", + "P", + "O", + "T", + "C", + "P", + "S", + } + }, { "Eras", new String[] { // era strings "pm\u0113", diff --git a/jdk/src/share/classes/sun/text/resources/mk/FormatData_mk.java b/jdk/src/share/classes/sun/text/resources/mk/FormatData_mk.java index ba42eeb0ae9..cd09d3ef1ee 100644 --- a/jdk/src/share/classes/sun/text/resources/mk/FormatData_mk.java +++ b/jdk/src/share/classes/sun/text/resources/mk/FormatData_mk.java @@ -104,6 +104,17 @@ public class FormatData_mk extends ListResourceBundle { "\u0441\u0430\u0431." // abb Saturday } }, + { "DayNarrows", + new String[] { + "\u043d", + "\u043f", + "\u0432", + "\u0441", + "\u0447", + "\u043f", + "\u0441", + } + }, { "Eras", new String[] { // era strings "\u043f\u0440.\u043d.\u0435.", diff --git a/jdk/src/share/classes/sun/text/resources/ms/FormatData_ms.java b/jdk/src/share/classes/sun/text/resources/ms/FormatData_ms.java index e3936d86fe9..13a8d51dd1d 100644 --- a/jdk/src/share/classes/sun/text/resources/ms/FormatData_ms.java +++ b/jdk/src/share/classes/sun/text/resources/ms/FormatData_ms.java @@ -81,6 +81,23 @@ public class FormatData_ms extends ListResourceBundle { "", } }, + { "standalone.MonthNarrows", + new String[] { + "J", + "F", + "M", + "A", + "M", + "J", + "J", + "O", + "S", + "O", + "N", + "D", + "", + } + }, { "DayNames", new String[] { "Ahad", @@ -103,6 +120,28 @@ public class FormatData_ms extends ListResourceBundle { "Sab", } }, + { "DayNarrows", + new String[] { + "A", + "I", + "S", + "R", + "K", + "J", + "S", + } + }, + { "standalone.DayNarrows", + new String[] { + "A", + "I", + "S", + "R", + "K", + "J", + "S", + } + }, { "Eras", new String[] { "BCE", diff --git a/jdk/src/share/classes/sun/text/resources/mt/FormatData_mt.java b/jdk/src/share/classes/sun/text/resources/mt/FormatData_mt.java index 49751272506..4ef0957eba5 100644 --- a/jdk/src/share/classes/sun/text/resources/mt/FormatData_mt.java +++ b/jdk/src/share/classes/sun/text/resources/mt/FormatData_mt.java @@ -103,6 +103,17 @@ public class FormatData_mt extends ListResourceBundle { "Sib", } }, + { "DayNarrows", + new String[] { + "\u0126", + "T", + "T", + "E", + "\u0126", + "\u0120", + "S", + } + }, { "AmPmMarkers", new String[] { "QN", diff --git a/jdk/src/share/classes/sun/text/resources/nl/FormatData_nl.java b/jdk/src/share/classes/sun/text/resources/nl/FormatData_nl.java index 4d041dd46fd..78b937c2d64 100644 --- a/jdk/src/share/classes/sun/text/resources/nl/FormatData_nl.java +++ b/jdk/src/share/classes/sun/text/resources/nl/FormatData_nl.java @@ -104,6 +104,17 @@ public class FormatData_nl extends ListResourceBundle { "za" // abb Saturday } }, + { "DayNarrows", + new String[] { + "Z", + "M", + "D", + "W", + "D", + "V", + "Z", + } + }, { "Eras", new String[] { // era strings for GregorianCalendar "v. Chr.", diff --git a/jdk/src/share/classes/sun/text/resources/pl/FormatData_pl.java b/jdk/src/share/classes/sun/text/resources/pl/FormatData_pl.java index 3e52ed187da..824645ef0db 100644 --- a/jdk/src/share/classes/sun/text/resources/pl/FormatData_pl.java +++ b/jdk/src/share/classes/sun/text/resources/pl/FormatData_pl.java @@ -121,6 +121,17 @@ public class FormatData_pl extends ListResourceBundle { "So" // abb Saturday } }, + { "DayNarrows", + new String[] { + "N", + "P", + "W", + "\u015a", + "C", + "P", + "S", + } + }, { "Eras", new String[] { // era strings "p.n.e.", diff --git a/jdk/src/share/classes/sun/text/resources/pt/FormatData_pt.java b/jdk/src/share/classes/sun/text/resources/pt/FormatData_pt.java index e926701019a..4a0de29ad54 100644 --- a/jdk/src/share/classes/sun/text/resources/pt/FormatData_pt.java +++ b/jdk/src/share/classes/sun/text/resources/pt/FormatData_pt.java @@ -104,6 +104,17 @@ public class FormatData_pt extends ListResourceBundle { "S\u00e1b" // abb Saturday } }, + { "DayNarrows", + new String[] { + "D", + "S", + "T", + "Q", + "Q", + "S", + "S", + } + }, { "NumberElements", new String[] { ",", // decimal al separator diff --git a/jdk/src/share/classes/sun/text/resources/ro/FormatData_ro.java b/jdk/src/share/classes/sun/text/resources/ro/FormatData_ro.java index 49a0cb13e89..c28502c1072 100644 --- a/jdk/src/share/classes/sun/text/resources/ro/FormatData_ro.java +++ b/jdk/src/share/classes/sun/text/resources/ro/FormatData_ro.java @@ -82,6 +82,23 @@ public class FormatData_ro extends ListResourceBundle { "" // abb month 13 if applicable } }, + { "standalone.MonthNarrows", + new String[] { + "I", + "F", + "M", + "A", + "M", + "I", + "I", + "A", + "S", + "O", + "N", + "D", + "", + } + }, { "DayNames", new String[] { "duminic\u0103", // Sunday @@ -104,6 +121,29 @@ public class FormatData_ro extends ListResourceBundle { "S" // abb Saturday } }, + // commented out DayNarrows because most names are contributed. +// { "DayNarrows", +// new String[] { +// "D", +// "", +// "", +// "", +// "", +// "", +// "", +// } +// }, + { "standalone.DayNarrows", + new String[] { + "D", + "L", + "M", + "M", + "J", + "V", + "S", + } + }, { "Eras", new String[] { // era strings "d.C.", diff --git a/jdk/src/share/classes/sun/text/resources/ru/FormatData_ru.java b/jdk/src/share/classes/sun/text/resources/ru/FormatData_ru.java index 2eb144aee66..820bf53497f 100644 --- a/jdk/src/share/classes/sun/text/resources/ru/FormatData_ru.java +++ b/jdk/src/share/classes/sun/text/resources/ru/FormatData_ru.java @@ -138,6 +138,28 @@ public class FormatData_ru extends ListResourceBundle { "\u0421\u0431" // abb Saturday } }, + { "DayNarrows", + new String[] { + "\u0412", + "\u041f\u043d", + "\u0412\u0442", + "\u0421", + "\u0427", + "\u041f", + "\u0421", // contributed item in CLDR + } + }, + { "standalone.DayNarrows", + new String[] { + "\u0412", + "\u041f", + "\u0412", + "\u0421", + "\u0427", + "\u041f", + "\u0421", + } + }, { "Eras", new String[] { // era strings "\u0434\u043e \u043d.\u044d.", diff --git a/jdk/src/share/classes/sun/text/resources/sk/FormatData_sk.java b/jdk/src/share/classes/sun/text/resources/sk/FormatData_sk.java index 38787ad81b0..110985614a9 100644 --- a/jdk/src/share/classes/sun/text/resources/sk/FormatData_sk.java +++ b/jdk/src/share/classes/sun/text/resources/sk/FormatData_sk.java @@ -138,6 +138,17 @@ public class FormatData_sk extends ListResourceBundle { "So" // abb Saturday } }, + { "DayNarrows", + new String[] { + "N", + "P", + "U", + "S", + "\u0160", + "P", + "S", + } + }, { "Eras", new String[] { // era strings "pred n.l.", diff --git a/jdk/src/share/classes/sun/text/resources/sl/FormatData_sl.java b/jdk/src/share/classes/sun/text/resources/sl/FormatData_sl.java index 65be14ab2c6..34ce565af9c 100644 --- a/jdk/src/share/classes/sun/text/resources/sl/FormatData_sl.java +++ b/jdk/src/share/classes/sun/text/resources/sl/FormatData_sl.java @@ -121,6 +121,17 @@ public class FormatData_sl extends ListResourceBundle { "Sob" // abb Saturday } }, + { "DayNarrows", + new String[] { + "n", + "p", + "t", + "s", + "\u010d", + "p", + "s", + } + }, { "Eras", new String[] { // era strings "pr.n.\u0161.", diff --git a/jdk/src/share/classes/sun/text/resources/sq/FormatData_sq.java b/jdk/src/share/classes/sun/text/resources/sq/FormatData_sq.java index b7f4038cb9b..0984bb613b1 100644 --- a/jdk/src/share/classes/sun/text/resources/sq/FormatData_sq.java +++ b/jdk/src/share/classes/sun/text/resources/sq/FormatData_sq.java @@ -104,6 +104,17 @@ public class FormatData_sq extends ListResourceBundle { "Sht" // abb Saturday } }, + { "DayNarrows", + new String[] { + "D", + "H", + "M", + "M", + "E", + "P", + "S", + } + }, { "AmPmMarkers", new String[] { "PD", // am marker diff --git a/jdk/src/share/classes/sun/text/resources/sr/FormatData_sr.java b/jdk/src/share/classes/sun/text/resources/sr/FormatData_sr.java index fb96b66f60e..d331a8d9a3f 100644 --- a/jdk/src/share/classes/sun/text/resources/sr/FormatData_sr.java +++ b/jdk/src/share/classes/sun/text/resources/sr/FormatData_sr.java @@ -103,12 +103,35 @@ public class FormatData_sr extends ListResourceBundle { "\u0441\u0443\u0431", } }, + { "DayNarrows", + new String[] { + "\u043d", + "\u043f", + "\u0443", + "\u0441", + "\u0447", + "\u043f", + "\u0441", + } + }, { "Eras", new String[] { "\u043f. \u043d. \u0435.", "\u043d. \u0435", } }, + { "short.Eras", + new String[] { + "\u043f. \u043d. \u0435.", + "\u043d. \u0435.", + } + }, + { "narrow.Eras", + new String[] { + "\u043f.\u043d.\u0435.", + "\u043d.\u0435.", + } + }, { "NumberPatterns", new String[] { "#,##0.###", diff --git a/jdk/src/share/classes/sun/text/resources/sv/FormatData_sv.java b/jdk/src/share/classes/sun/text/resources/sv/FormatData_sv.java index a7aca447af8..7368a49c0ea 100644 --- a/jdk/src/share/classes/sun/text/resources/sv/FormatData_sv.java +++ b/jdk/src/share/classes/sun/text/resources/sv/FormatData_sv.java @@ -82,6 +82,23 @@ public class FormatData_sv extends ListResourceBundle { "" // abb month 13 if applicable } }, + { "standalone.MonthNarrows", + new String[] { + "J", + "F", + "M", + "A", + "M", + "J", + "J", + "A", + "S", + "O", + "N", + "D", + "", + } + }, { "DayNames", new String[] { "s\u00f6ndag", // Sunday @@ -104,12 +121,46 @@ public class FormatData_sv extends ListResourceBundle { "l\u00f6" // abb Saturday } }, + { "DayNarrows", + new String[] { + "S", + "M", + "T", + "O", + "T", + "F", + "L", + } + }, + { "standalone.DayNarrows", + new String[] { + "S", + "M", + "T", + "O", + "T", + "F", + "L", + } + }, + { "narrow.Eras", + new String[] { + "f.Kr.", + "e.Kr.", + } + }, { "AmPmMarkers", new String[] { "fm", // am marker "em" // pm marker } }, + { "narrow.AmPmMarkers", + new String[] { + "f", + "e", + } + }, { "NumberElements", new String[] { ",", // decimal separator diff --git a/jdk/src/share/classes/sun/text/resources/th/FormatData_th.java b/jdk/src/share/classes/sun/text/resources/th/FormatData_th.java index 4313b905fb1..bec15d10191 100644 --- a/jdk/src/share/classes/sun/text/resources/th/FormatData_th.java +++ b/jdk/src/share/classes/sun/text/resources/th/FormatData_th.java @@ -99,6 +99,23 @@ public class FormatData_th extends ListResourceBundle { "" // abb month 13 if applicable } }, + { "standalone.MonthNarrows", + new String[] { + "\u0e21.\u0e04.", + "\u0e01.\u0e1e.", + "\u0e21\u0e35.\u0e04.", + "\u0e40\u0e21.\u0e22.", + "\u0e1e.\u0e04.", + "\u0e21\u0e34.\u0e22.", + "\u0e01.\u0e04.", + "\u0e2a.\u0e04.", + "\u0e01.\u0e22.", + "\u0e15.\u0e04.", + "\u0e1e.\u0e22.", + "\u0e18.\u0e04.", + "", + } + }, { "DayNames", new String[] { "\u0e27\u0e31\u0e19\u0e2d\u0e32\u0e17\u0e34\u0e15\u0e22\u0e4c", // Sunday @@ -121,6 +138,17 @@ public class FormatData_th extends ListResourceBundle { "\u0e2a." // abb Saturday } }, + { "DayNarrows", + new String[] { + "\u0e2d", + "\u0e08", + "\u0e2d", + "\u0e1e", + "\u0e1e", + "\u0e28", + "\u0e2a", + } + }, { "AmPmMarkers", new String[] { "\u0e01\u0e48\u0e2d\u0e19\u0e40\u0e17\u0e35\u0e48\u0e22\u0e07", // am marker @@ -145,6 +173,12 @@ public class FormatData_th extends ListResourceBundle { "\u0e04.\u0e28." } }, + { "narrow.Eras", + new String[] { + "\u0e01\u0e48\u0e2d\u0e19 \u0e04.\u0e28.", + "\u0e04.\u0e28.", + } + }, { "buddhist.TimePatterns", timePatterns }, diff --git a/jdk/src/share/classes/sun/text/resources/tr/FormatData_tr.java b/jdk/src/share/classes/sun/text/resources/tr/FormatData_tr.java index 9df7ac1e578..2be1b12f588 100644 --- a/jdk/src/share/classes/sun/text/resources/tr/FormatData_tr.java +++ b/jdk/src/share/classes/sun/text/resources/tr/FormatData_tr.java @@ -82,6 +82,23 @@ public class FormatData_tr extends ListResourceBundle { "" // abb month 13 if applicable } }, + { "standalone.MonthNarrows", + new String[] { + "O", + "\u015e", + "M", + "N", + "M", + "H", + "T", + "A", + "E", + "E", + "K", + "A", + "", + } + }, { "DayNames", new String[] { "Pazar", // Sunday @@ -104,6 +121,17 @@ public class FormatData_tr extends ListResourceBundle { "Cmt" // abb Saturday } }, + { "DayNarrows", + new String[] { + "P", + "P", + "S", + "\u00c7", + "P", + "C", + "C", + } + }, { "NumberPatterns", new String[] { "#,##0.###;-#,##0.###", // decimal pattern diff --git a/jdk/src/share/classes/sun/text/resources/uk/FormatData_uk.java b/jdk/src/share/classes/sun/text/resources/uk/FormatData_uk.java index d9514e05137..7aa0e0c451b 100644 --- a/jdk/src/share/classes/sun/text/resources/uk/FormatData_uk.java +++ b/jdk/src/share/classes/sun/text/resources/uk/FormatData_uk.java @@ -138,6 +138,17 @@ public class FormatData_uk extends ListResourceBundle { "\u0441\u0431" // abb Saturday } }, + { "DayNarrows", + new String[] { + "\u041d", + "\u041f", + "\u0412", + "\u0421", + "\u0427", + "\u041f", + "\u0421", + } + }, { "Eras", new String[] { // era strings "\u0434\u043e \u043d.\u0435.", diff --git a/jdk/src/share/classes/sun/text/resources/vi/FormatData_vi.java b/jdk/src/share/classes/sun/text/resources/vi/FormatData_vi.java index c5e43eedea1..fd892d96606 100644 --- a/jdk/src/share/classes/sun/text/resources/vi/FormatData_vi.java +++ b/jdk/src/share/classes/sun/text/resources/vi/FormatData_vi.java @@ -106,6 +106,17 @@ public class FormatData_vi extends ListResourceBundle { "Th 7" // abb Saturday } }, + { "DayNarrows", + new String[] { + "CN", + "T2", + "T3", + "T4", + "T5", + "T6", + "T7", + } + }, { "AmPmMarkers", new String[] { "SA", // am marker diff --git a/jdk/src/share/classes/sun/text/resources/zh/FormatData_zh.java b/jdk/src/share/classes/sun/text/resources/zh/FormatData_zh.java index 57bf686d7f1..57dbe2a0c61 100644 --- a/jdk/src/share/classes/sun/text/resources/zh/FormatData_zh.java +++ b/jdk/src/share/classes/sun/text/resources/zh/FormatData_zh.java @@ -82,6 +82,23 @@ public class FormatData_zh extends ListResourceBundle { "" // abb month 13 if applicable } }, + { "standalone.MonthNarrows", + new String[] { + "1\u6708", + "2\u6708", + "3\u6708", + "4\u6708", + "5\u6708", + "6\u6708", + "7\u6708", + "8\u6708", + "9\u6708", + "10\u6708", + "11\u6708", + "12\u6708", + "", + } + }, { "DayNames", new String[] { "\u661f\u671f\u65e5", // Sunday @@ -104,6 +121,17 @@ public class FormatData_zh extends ListResourceBundle { "\u661f\u671f\u516d" // abb Saturday } }, + { "DayNarrows", + new String[] { + "\u65e5", + "\u4e00", + "\u4e8c", + "\u4e09", + "\u56db", + "\u4e94", + "\u516d", + } + }, { "AmPmMarkers", new String[] { "\u4e0a\u5348", // am marker diff --git a/jdk/src/share/classes/sun/tools/jcmd/JCmd.java b/jdk/src/share/classes/sun/tools/jcmd/JCmd.java index 4690a5bc4f6..8c5a2c50274 100644 --- a/jdk/src/share/classes/sun/tools/jcmd/JCmd.java +++ b/jdk/src/share/classes/sun/tools/jcmd/JCmd.java @@ -1,8 +1,7 @@ /* * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - *com.sun.tools.attach.AttachNotSupportedException - + * * 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 diff --git a/jdk/src/share/classes/sun/util/cldr/CLDRLocaleProviderAdapter.java b/jdk/src/share/classes/sun/util/cldr/CLDRLocaleProviderAdapter.java index e8411346394..77f7b843d64 100644 --- a/jdk/src/share/classes/sun/util/cldr/CLDRLocaleProviderAdapter.java +++ b/jdk/src/share/classes/sun/util/cldr/CLDRLocaleProviderAdapter.java @@ -88,11 +88,6 @@ public class CLDRLocaleProviderAdapter extends JRELocaleProviderAdapter { return null; } - @Override - public TimeZoneNameProvider getTimeZoneNameProvider() { - return null; - } - @Override public Locale[] getAvailableLocales() { Set all = createLanguageTagSet("All"); diff --git a/jdk/src/share/classes/sun/util/locale/provider/CalendarDataUtility.java b/jdk/src/share/classes/sun/util/locale/provider/CalendarDataUtility.java index e86e27234bd..f181c98d655 100644 --- a/jdk/src/share/classes/sun/util/locale/provider/CalendarDataUtility.java +++ b/jdk/src/share/classes/sun/util/locale/provider/CalendarDataUtility.java @@ -25,7 +25,6 @@ package sun.util.locale.provider; -import java.util.Calendar; import static java.util.Calendar.*; import java.util.Locale; import java.util.Map; diff --git a/jdk/src/share/classes/sun/util/locale/provider/CalendarNameProviderImpl.java b/jdk/src/share/classes/sun/util/locale/provider/CalendarNameProviderImpl.java index 1f262a8445a..20be38607f8 100644 --- a/jdk/src/share/classes/sun/util/locale/provider/CalendarNameProviderImpl.java +++ b/jdk/src/share/classes/sun/util/locale/provider/CalendarNameProviderImpl.java @@ -52,7 +52,7 @@ public class CalendarNameProviderImpl extends CalendarNameProvider implements Av @Override public String getDisplayName(String calendarType, int field, int value, int style, Locale locale) { String name = null; - String key = getKey(calendarType, field, style); + String key = getResourceKey(calendarType, field, style); if (key != null) { ResourceBundle rb = LocaleProviderAdapter.forType(type).getLocaleData().getDateFormatData(locale); if (rb.containsKey(key)) { @@ -64,9 +64,10 @@ public class CalendarNameProviderImpl extends CalendarNameProvider implements Av name = strings[value]; // If name is empty in standalone, try its `format' style. if (name.length() == 0 - && (style == SHORT_STANDALONE || style == LONG_STANDALONE)) { + && (style == SHORT_STANDALONE || style == LONG_STANDALONE + || style == NARROW_STANDALONE)) { name = getDisplayName(calendarType, field, value, - style == SHORT_STANDALONE ? SHORT_FORMAT : LONG_FORMAT, + getBaseStyle(style), locale); } } @@ -75,15 +76,17 @@ public class CalendarNameProviderImpl extends CalendarNameProvider implements Av return name; } + private static int[] REST_OF_STYLES = { + SHORT_STANDALONE, LONG_FORMAT, LONG_STANDALONE, + NARROW_FORMAT, NARROW_STANDALONE + }; @Override public Map getDisplayNames(String calendarType, int field, int style, Locale locale) { Map names; if (style == ALL_STYLES) { names = getDisplayNamesImpl(calendarType, field, SHORT_FORMAT, locale); - if (field != AM_PM) { - for (int st : new int[] { SHORT_STANDALONE, LONG_FORMAT, LONG_STANDALONE }) { - names.putAll(getDisplayNamesImpl(calendarType, field, st, locale)); - } + for (int st : REST_OF_STYLES) { + names.putAll(getDisplayNamesImpl(calendarType, field, st, locale)); } } else { // specific style @@ -94,26 +97,28 @@ public class CalendarNameProviderImpl extends CalendarNameProvider implements Av private Map getDisplayNamesImpl(String calendarType, int field, int style, Locale locale) { - String key = getKey(calendarType, field, style); + String key = getResourceKey(calendarType, field, style); Map map = new TreeMap<>(LengthBasedComparator.INSTANCE); if (key != null) { ResourceBundle rb = LocaleProviderAdapter.forType(type).getLocaleData().getDateFormatData(locale); if (rb.containsKey(key)) { String[] strings = rb.getStringArray(key); - if (field == YEAR) { - if (strings.length > 0) { - map.put(strings[0], 1); - } - } else { - int base = (field == DAY_OF_WEEK) ? 1 : 0; - for (int i = 0; i < strings.length; i++) { - String name = strings[i]; - // Ignore any empty string (some standalone month names - // are not defined) - if (name.length() == 0) { - continue; + if (!hasDuplicates(strings)) { + if (field == YEAR) { + if (strings.length > 0) { + map.put(strings[0], 1); + } + } else { + int base = (field == DAY_OF_WEEK) ? 1 : 0; + for (int i = 0; i < strings.length; i++) { + String name = strings[i]; + // Ignore any empty string (some standalone month names + // are not defined) + if (name.length() == 0) { + continue; + } + map.put(name, base + i); } - map.put(name, base + i); } } } @@ -121,6 +126,10 @@ public class CalendarNameProviderImpl extends CalendarNameProvider implements Av return map; } + private int getBaseStyle(int style) { + return style & ~(SHORT_STANDALONE - SHORT_FORMAT); + } + /** * Comparator implementation for TreeMap which iterates keys from longest * to shortest. @@ -180,55 +189,92 @@ public class CalendarNameProviderImpl extends CalendarNameProvider implements Av return langtags; } - private int getIntData(String key, Locale locale) { - ResourceBundle rb = LocaleProviderAdapter.forType(type).getLocaleData().getCalendarData(locale); - if (rb.containsKey(key)) { - String firstday = rb.getString(key); - return Integer.parseInt(firstday); + private boolean hasDuplicates(String[] strings) { + int len = strings.length; + for (int i = 0; i < len - 1; i++) { + String a = strings[i]; + if (a != null) { + for (int j = i + 1; j < len; j++) { + if (a.equals(strings[j])) { + return true; + } + } + } } - // Note that the base bundle of CLDR doesn't have the Calendar week parameters. - return 0; + return false; } - private String getKey(String type, int field, int style) { - boolean standalone = (style & 0x8000) != 0; - style &= ~0x8000; + private String getResourceKey(String type, int field, int style) { + int baseStyle = getBaseStyle(style); + boolean isStandalone = (style != baseStyle); if ("gregory".equals(type)) { type = null; } - + boolean isNarrow = (baseStyle == NARROW_FORMAT); StringBuilder key = new StringBuilder(); switch (field) { case ERA: if (type != null) { key.append(type).append('.'); } - if (style == SHORT) { - key.append("short."); + if (isNarrow) { + key.append("narrow."); + } else { + // JRE and CLDR use different resource key conventions + // due to historical reasons. (JRE DateFormatSymbols.getEras returns + // abbreviations while other getShort*() return abbreviations.) + if (this.type == LocaleProviderAdapter.Type.JRE) { + if (baseStyle == SHORT) { + key.append("short."); + } + } else { // CLDR + if (baseStyle == LONG) { + key.append("long."); + } + } } key.append("Eras"); break; case YEAR: - key.append(type).append(".FirstYear"); + if (!isNarrow) { + key.append(type).append(".FirstYear"); + } break; case MONTH: - if (standalone) { + if (isStandalone) { key.append("standalone."); } - key.append(style == SHORT ? "MonthAbbreviations" : "MonthNames"); + key.append("Month").append(toStyleName(baseStyle)); break; case DAY_OF_WEEK: - key.append(style == SHORT ? "DayAbbreviations" : "DayNames"); + // support standalone narrow day names + if (isStandalone && isNarrow) { + key.append("standalone."); + } + key.append("Day").append(toStyleName(baseStyle)); break; case AM_PM: + if (isNarrow) { + key.append("narrow."); + } key.append("AmPmMarkers"); break; } return key.length() > 0 ? key.toString() : null; } + + private String toStyleName(int baseStyle) { + switch (baseStyle) { + case SHORT: + return "Abbreviations"; + case NARROW_FORMAT: + return "Narrows"; + } + return "Names"; + } } diff --git a/jdk/src/share/classes/sun/util/locale/provider/LocaleResources.java b/jdk/src/share/classes/sun/util/locale/provider/LocaleResources.java index 16aae9ac423..ff389f61b35 100644 --- a/jdk/src/share/classes/sun/util/locale/provider/LocaleResources.java +++ b/jdk/src/share/classes/sun/util/locale/provider/LocaleResources.java @@ -46,7 +46,7 @@ import java.util.Locale; import java.util.ResourceBundle; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; -import sun.util.resources.OpenListResourceBundle; +import sun.util.resources.TimeZoneNamesBundle; /** * Central accessor to locale-dependent resources. @@ -67,13 +67,13 @@ public class LocaleResources { this.locale = locale; } - public OpenListResourceBundle getTimeZoneNames() { - OpenListResourceBundle tznames = (OpenListResourceBundle) cache.get("TimeZoneNames"); + public TimeZoneNamesBundle getTimeZoneNames() { + TimeZoneNamesBundle tznames = (TimeZoneNamesBundle) cache.get("TimeZoneNames"); if (tznames == null) { tznames = adapter.getLocaleData().getTimeZoneNames(locale); - OpenListResourceBundle olrb = (OpenListResourceBundle) cache.putIfAbsent("TimeZoneNames", tznames); - if (olrb != null) { - tznames = olrb; + TimeZoneNamesBundle tznb = (TimeZoneNamesBundle) cache.putIfAbsent("TimeZoneNames", tznames); + if (tznb != null) { + tznames = tznb; } } return tznames; diff --git a/jdk/src/share/classes/sun/util/locale/provider/SPILocaleProviderAdapter.java b/jdk/src/share/classes/sun/util/locale/provider/SPILocaleProviderAdapter.java index 15de9f52283..59de0e2a629 100644 --- a/jdk/src/share/classes/sun/util/locale/provider/SPILocaleProviderAdapter.java +++ b/jdk/src/share/classes/sun/util/locale/provider/SPILocaleProviderAdapter.java @@ -604,5 +604,12 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter { assert tznp != null; return tznp.getDisplayName(ID, daylight, style, locale); } + + @Override + public String getGenericDisplayName(String ID, int style, Locale locale) { + TimeZoneNameProvider tznp = getImpl(locale); + assert tznp != null; + return tznp.getGenericDisplayName(ID, style, locale); + } } } diff --git a/jdk/src/share/classes/sun/util/locale/provider/TimeZoneNameProviderImpl.java b/jdk/src/share/classes/sun/util/locale/provider/TimeZoneNameProviderImpl.java index ff092861824..28fd7af5a90 100644 --- a/jdk/src/share/classes/sun/util/locale/provider/TimeZoneNameProviderImpl.java +++ b/jdk/src/share/classes/sun/util/locale/provider/TimeZoneNameProviderImpl.java @@ -25,11 +25,14 @@ package sun.util.locale.provider; +import java.util.LinkedHashSet; import java.util.Locale; -import java.util.ResourceBundle; +import java.util.Map; import java.util.Set; import java.util.TimeZone; import java.util.spi.TimeZoneNameProvider; +import sun.util.calendar.ZoneInfo; +import sun.util.resources.TimeZoneNamesBundle; /** * Concrete implementation of the @@ -96,21 +99,67 @@ public class TimeZoneNameProviderImpl extends TimeZoneNameProvider { */ @Override public String getDisplayName(String id, boolean daylight, int style, Locale locale) { + String[] names = getDisplayNameArray(id, 5, locale); + if (names != null) { + int index = daylight ? 3 : 1; + if (style == TimeZone.SHORT) { + index++; + } + return names[index]; + } + return null; + } + + @Override + public String getGenericDisplayName(String id, int style, Locale locale) { + String[] names = getDisplayNameArray(id, 7, locale); + if (names != null && names.length >= 7) { + return names[(style == TimeZone.LONG) ? 5 : 6]; + } + return null; + } + + private String[] getDisplayNameArray(String id, int n, Locale locale) { if (id == null || locale == null) { throw new NullPointerException(); } - LocaleProviderAdapter adapter = LocaleProviderAdapter.forType(type); - ResourceBundle rb = adapter.getLocaleResources(locale).getTimeZoneNames(); - if (rb.containsKey(id)) { - String[] names = rb.getStringArray(id); - int index = daylight ? 3 : 1; - if (style == TimeZone.SHORT) { - index++; - } - return names[index]; - } + TimeZoneNamesBundle rb = adapter.getLocaleResources(locale).getTimeZoneNames(); + return rb.containsKey(id) ? rb.getStringArray(id, n) : null; + } - return null; + /** + * Returns a String[][] as the DateFormatSymbols.getZoneStrings() value for + * the given locale. This method is package private. + * + * @param locale a Locale for time zone names + * @return an array of time zone names arrays + */ + String[][] getZoneStrings(Locale locale) { + LocaleProviderAdapter adapter = LocaleProviderAdapter.forType(type); + TimeZoneNamesBundle rb = adapter.getLocaleResources(locale).getTimeZoneNames(); + Set keyset = rb.keySet(); + // Use a LinkedHashSet to preseve the order + Set value = new LinkedHashSet<>(); + for (String key : keyset) { + value.add(rb.getStringArray(key)); + } + + // Add aliases data for CLDR + if (type == LocaleProviderAdapter.Type.CLDR) { + // Note: TimeZoneNamesBundle creates a String[] on each getStringArray call. + Map aliases = ZoneInfo.getAliasTable(); + for (String alias : aliases.keySet()) { + if (!keyset.contains(alias)) { + String tzid = aliases.get(alias); + if (keyset.contains(tzid)) { + String[] val = rb.getStringArray(tzid); + val[0] = alias; + value.add(val); + } + } + } + } + return value.toArray(new String[0][]); } } diff --git a/jdk/src/share/classes/sun/util/locale/provider/TimeZoneNameUtility.java b/jdk/src/share/classes/sun/util/locale/provider/TimeZoneNameUtility.java index c28b0cb65c7..a8e09a0d6cf 100644 --- a/jdk/src/share/classes/sun/util/locale/provider/TimeZoneNameUtility.java +++ b/jdk/src/share/classes/sun/util/locale/provider/TimeZoneNameUtility.java @@ -26,28 +26,28 @@ package sun.util.locale.provider; import java.lang.ref.SoftReference; -import java.util.Enumeration; import java.util.LinkedList; import java.util.List; import java.util.Locale; import java.util.Map; -import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.spi.TimeZoneNameProvider; import sun.util.calendar.ZoneInfo; import sun.util.resources.OpenListResourceBundle; +import sun.util.resources.TimeZoneNamesBundle; /** * Utility class that deals with the localized time zone names * * @author Naoto Sato + * @author Masayoshi Okutsu */ public final class TimeZoneNameUtility { /** * cache to hold time zone resource bundles. Keyed by Locale */ - private static ConcurrentHashMap> cachedBundles = + private static ConcurrentHashMap> cachedBundles = new ConcurrentHashMap<>(); /** @@ -73,15 +73,19 @@ public final class TimeZoneNameUtility { } private static String[][] loadZoneStrings(Locale locale) { + // If the provider is a TimeZoneNameProviderImpl, call its getZoneStrings + // in order to avoid per-ID retrieval. + LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(TimeZoneNameProvider.class, locale); + TimeZoneNameProvider provider = adapter.getTimeZoneNameProvider(); + if (provider instanceof TimeZoneNameProviderImpl) { + return ((TimeZoneNameProviderImpl)provider).getZoneStrings(locale); + } + + // Performs per-ID retrieval. List zones = new LinkedList<>(); OpenListResourceBundle rb = getBundle(locale); - Enumeration keys = rb.getKeys(); - String[] names; - - while(keys.hasMoreElements()) { - String key = keys.nextElement(); - - names = retrieveDisplayNames(rb, key, locale); + for (String key : rb.keySet()) { + String[] names = retrieveDisplayNamesImpl(key, locale); if (names != null) { zones.add(names); } @@ -95,24 +99,50 @@ public final class TimeZoneNameUtility { * Retrieve display names for a time zone ID. */ public static String[] retrieveDisplayNames(String id, Locale locale) { - OpenListResourceBundle rb = getBundle(locale); - return retrieveDisplayNames(rb, id, locale); - } - - private static String[] retrieveDisplayNames(OpenListResourceBundle rb, - String id, Locale locale) { if (id == null || locale == null) { throw new NullPointerException(); } - - LocaleServiceProviderPool pool = - LocaleServiceProviderPool.getPool(TimeZoneNameProvider.class); - return pool.getLocalizedObject(TimeZoneNameGetter.INSTANCE, locale, id); + return retrieveDisplayNamesImpl(id, locale); } - private static OpenListResourceBundle getBundle(Locale locale) { - OpenListResourceBundle rb; - SoftReference data = cachedBundles.get(locale); + /** + * Retrieves a generic time zone display name for a time zone ID. + * + * @param id time zone ID + * @param style TimeZone.LONG or TimeZone.SHORT + * @param locale desired Locale + * @return the requested generic time zone display name, or null if not found. + */ + public static String retrieveGenericDisplayName(String id, int style, Locale locale) { + LocaleServiceProviderPool pool = + LocaleServiceProviderPool.getPool(TimeZoneNameProvider.class); + return pool.getLocalizedObject(TimeZoneNameGetter.INSTANCE, locale, "generic", style, id); + } + + /** + * Retrieves a standard or daylight-saving time name for the given time zone ID. + * + * @param id time zone ID + * @param daylight true for a daylight saving time name, or false for a standard time name + * @param style TimeZone.LONG or TimeZone.SHORT + * @param locale desired Locale + * @return the requested time zone name, or null if not found. + */ + public static String retrieveDisplayName(String id, boolean daylight, int style, Locale locale) { + LocaleServiceProviderPool pool = + LocaleServiceProviderPool.getPool(TimeZoneNameProvider.class); + return pool.getLocalizedObject(TimeZoneNameGetter.INSTANCE, locale, daylight ? "dst" : "std", style, id); + } + + private static String[] retrieveDisplayNamesImpl(String id, Locale locale) { + LocaleServiceProviderPool pool = + LocaleServiceProviderPool.getPool(TimeZoneNameProvider.class); + return pool.getLocalizedObject(TimeZoneNameArrayGetter.INSTANCE, locale, id); + } + + private static TimeZoneNamesBundle getBundle(Locale locale) { + TimeZoneNamesBundle rb; + SoftReference data = cachedBundles.get(locale); if (data == null || ((rb = data.get()) == null)) { rb = LocaleProviderAdapter.forJRE().getLocaleData().getTimeZoneNames(locale); @@ -127,19 +157,18 @@ public final class TimeZoneNameUtility { * Obtains a localized time zone strings from a TimeZoneNameProvider * implementation. */ - private static class TimeZoneNameGetter + private static class TimeZoneNameArrayGetter implements LocaleServiceProviderPool.LocalizedObjectGetter{ - private static final TimeZoneNameGetter INSTANCE = - new TimeZoneNameGetter(); + private static final TimeZoneNameArrayGetter INSTANCE = + new TimeZoneNameArrayGetter(); @Override public String[] getObject(TimeZoneNameProvider timeZoneNameProvider, - Locale locale, - String requestID, - Object... params) { + Locale locale, + String requestID, + Object... params) { assert params.length == 0; - String queryID = requestID; // First, try to get names with the request ID String[] names = buildZoneStrings(timeZoneNameProvider, locale, requestID); @@ -150,21 +179,15 @@ public final class TimeZoneNameUtility { if (aliases != null) { // Check whether this id is an alias, if so, // look for the standard id. - if (aliases.containsKey(queryID)) { - String prevID = queryID; - while ((queryID = aliases.get(queryID)) != null) { - prevID = queryID; - } - queryID = prevID; + String canonicalID = aliases.get(requestID); + if (canonicalID != null) { + names = buildZoneStrings(timeZoneNameProvider, locale, canonicalID); } - - names = buildZoneStrings(timeZoneNameProvider, locale, queryID); - if (names == null) { // There may be a case that a standard id has become an // alias. so, check the aliases backward. names = examineAliases(timeZoneNameProvider, locale, - queryID, aliases, aliases.entrySet()); + canonicalID == null ? requestID : canonicalID, aliases); } } } @@ -178,20 +201,18 @@ public final class TimeZoneNameUtility { private static String[] examineAliases(TimeZoneNameProvider tznp, Locale locale, String id, - Map aliases, - Set> aliasesSet) { + Map aliases) { if (aliases.containsValue(id)) { - for (Map.Entry entry : aliasesSet) { + for (Map.Entry entry : aliases.entrySet()) { if (entry.getValue().equals(id)) { String alias = entry.getKey(); String[] names = buildZoneStrings(tznp, locale, alias); if (names != null) { return names; - } else { - names = examineAliases(tznp, locale, alias, aliases, aliasesSet); - if (names != null) { - return names; - } + } + names = examineAliases(tznp, locale, alias, aliases); + if (names != null) { + return names; } } } @@ -201,7 +222,7 @@ public final class TimeZoneNameUtility { } private static String[] buildZoneStrings(TimeZoneNameProvider tznp, - Locale locale, String id) { + Locale locale, String id) { String[] names = new String[5]; for (int i = 1; i <= 4; i ++) { @@ -220,6 +241,77 @@ public final class TimeZoneNameUtility { } } + private static class TimeZoneNameGetter + implements LocaleServiceProviderPool.LocalizedObjectGetter { + private static final TimeZoneNameGetter INSTANCE = + new TimeZoneNameGetter(); + + @Override + public String getObject(TimeZoneNameProvider timeZoneNameProvider, + Locale locale, + String requestID, + Object... params) { + assert params.length == 2; + int style = (int) params[0]; + String tzid = (String) params[1]; + String value = getName(timeZoneNameProvider, locale, requestID, style, tzid); + if (value == null) { + Map aliases = ZoneInfo.getAliasTable(); + if (aliases != null) { + String canonicalID = aliases.get(tzid); + if (canonicalID != null) { + value = getName(timeZoneNameProvider, locale, requestID, style, canonicalID); + } + if (value == null) { + value = examineAliases(timeZoneNameProvider, locale, requestID, + canonicalID != null ? canonicalID : tzid, style, aliases); + } + } + } + + return value; + } + + private static String examineAliases(TimeZoneNameProvider tznp, Locale locale, + String requestID, String tzid, int style, + Map aliases) { + if (aliases.containsValue(tzid)) { + for (Map.Entry entry : aliases.entrySet()) { + if (entry.getValue().equals(tzid)) { + String alias = entry.getKey(); + String name = getName(tznp, locale, requestID, style, alias); + if (name != null) { + return name; + } + name = examineAliases(tznp, locale, requestID, alias, style, aliases); + if (name != null) { + return name; + } + } + } + } + return null; + } + + private static String getName(TimeZoneNameProvider timeZoneNameProvider, + Locale locale, String requestID, int style, String tzid) { + String value = null; + switch (requestID) { + case "std": + value = timeZoneNameProvider.getDisplayName(tzid, false, style, locale); + break; + case "dst": + value = timeZoneNameProvider.getDisplayName(tzid, true, style, locale); + break; + case "generic": + value = timeZoneNameProvider.getGenericDisplayName(tzid, style, locale); + break; + } + return value; + } + } + // No instantiation private TimeZoneNameUtility() { } diff --git a/jdk/src/share/classes/sun/util/resources/CurrencyNames.properties b/jdk/src/share/classes/sun/util/resources/CurrencyNames.properties index b8e80a208f4..55ecf42d704 100644 --- a/jdk/src/share/classes/sun/util/resources/CurrencyNames.properties +++ b/jdk/src/share/classes/sun/util/resources/CurrencyNames.properties @@ -278,6 +278,7 @@ YER=YER YUM=YUM ZAR=ZAR ZMK=ZMK +ZMW=ZMW ZWD=ZWD ZWL=ZWL ZWN=ZWN diff --git a/jdk/src/share/classes/sun/util/resources/LocaleData.java b/jdk/src/share/classes/sun/util/resources/LocaleData.java index 4570406f2a8..9a7a7c40119 100644 --- a/jdk/src/share/classes/sun/util/resources/LocaleData.java +++ b/jdk/src/share/classes/sun/util/resources/LocaleData.java @@ -46,9 +46,9 @@ import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.ResourceBundle; +import sun.util.locale.provider.LocaleDataMetaInfo; import sun.util.locale.provider.LocaleProviderAdapter; import static sun.util.locale.provider.LocaleProviderAdapter.Type.JRE; -import sun.util.locale.provider.LocaleDataMetaInfo; /** * Provides information about and access to resource bundles in the @@ -94,8 +94,8 @@ public class LocaleData { * Gets a time zone names resource bundle, using privileges * to allow accessing a sun.* package. */ - public OpenListResourceBundle getTimeZoneNames(Locale locale) { - return (OpenListResourceBundle) getBundle(type.getUtilResourcesPackage() + ".TimeZoneNames", locale); + public TimeZoneNamesBundle getTimeZoneNames(Locale locale) { + return (TimeZoneNamesBundle) getBundle(type.getUtilResourcesPackage() + ".TimeZoneNames", locale); } /** @@ -158,30 +158,33 @@ public class LocaleData { /* Get the locale string list from LocaleDataMetaInfo class. */ String localeString = LocaleDataMetaInfo.getSupportedLocaleString(baseName); - if (localeString == null || localeString.length() == 0) { - return candidates; - } - - for (Iterator l = candidates.iterator(); l.hasNext(); ) { - Locale loc = l.next(); - String lstr; - if (loc.getScript().length() > 0) { - lstr = loc.toLanguageTag().replace('-', '_'); - } else { - lstr = loc.toString(); - int idx = lstr.indexOf("_#"); - if (idx >= 0) { - lstr = lstr.substring(0, idx); + if (localeString != null && localeString.length() != 0) { + for (Iterator l = candidates.iterator(); l.hasNext();) { + Locale loc = l.next(); + String lstr; + if (loc.getScript().length() > 0) { + lstr = loc.toLanguageTag().replace('-', '_'); + } else { + lstr = loc.toString(); + int idx = lstr.indexOf("_#"); + if (idx >= 0) { + lstr = lstr.substring(0, idx); + } + } + /* Every locale string in the locale string list returned from + the above getSupportedLocaleString is enclosed + within two white spaces so that we could check some locale + such as "en". + */ + if (lstr.length() != 0 && localeString.indexOf(" " + lstr + " ") == -1) { + l.remove(); } } - /* Every locale string in the locale string list returned from - the above getSupportedLocaleString is enclosed - within two white spaces so that we could check some locale - such as "en". - */ - if (lstr.length() != 0 && localeString.indexOf(" " + lstr + " ") == -1) { - l.remove(); - } + } + // Force fallback to Locale.ENGLISH for CLDR time zone names support + if (locale.getLanguage() != "en" + && baseName.contains(CLDR) && baseName.endsWith("TimeZoneNames")) { + candidates.add(candidates.size() - 1, Locale.ENGLISH); } return candidates; } diff --git a/jdk/src/share/classes/sun/util/resources/OpenListResourceBundle.java b/jdk/src/share/classes/sun/util/resources/OpenListResourceBundle.java index e0551931d19..494e5c89c08 100644 --- a/jdk/src/share/classes/sun/util/resources/OpenListResourceBundle.java +++ b/jdk/src/share/classes/sun/util/resources/OpenListResourceBundle.java @@ -67,6 +67,7 @@ public abstract class OpenListResourceBundle extends ResourceBundle { } // Implements java.util.ResourceBundle.handleGetObject; inherits javadoc specification. + @Override public Object handleGetObject(String key) { if (key == null) { throw new NullPointerException(); @@ -79,6 +80,7 @@ public abstract class OpenListResourceBundle extends ResourceBundle { /** * Implementation of ResourceBundle.getKeys. */ + @Override public Enumeration getKeys() { ResourceBundle parent = this.parent; return new ResourceBundleEnumeration(handleGetKeys(), @@ -86,7 +88,8 @@ public abstract class OpenListResourceBundle extends ResourceBundle { } /** - * Returns a set of keys provided in this resource bundle + * Returns a set of keys provided in this resource bundle, + * including no parents. */ public Set handleGetKeys() { loadLookupTablesIfNecessary(); @@ -99,7 +102,7 @@ public abstract class OpenListResourceBundle extends ResourceBundle { if (keyset != null) { return keyset; } - Set ks = new HashSet<>(); + Set ks = createSet(); ks.addAll(handleGetKeys()); if (parent != null) { ks.addAll(parent.keySet()); @@ -112,13 +115,6 @@ public abstract class OpenListResourceBundle extends ResourceBundle { return keyset; } - /** - * Returns the parent bundle - */ - public OpenListResourceBundle getParent() { - return (OpenListResourceBundle)parent; - } - /** * See ListResourceBundle class description. */ @@ -160,10 +156,14 @@ public abstract class OpenListResourceBundle extends ResourceBundle { * Lets subclasses provide specialized Map implementations. * Default uses HashMap. */ - protected Map createMap(int size) { + protected Map createMap(int size) { return new HashMap<>(size); } + protected Set createSet() { + return new HashSet<>(); + } + private volatile Map lookup = null; private volatile Set keyset; } diff --git a/jdk/src/share/classes/sun/util/resources/TimeZoneNames.java b/jdk/src/share/classes/sun/util/resources/TimeZoneNames.java index 5b2931b7b62..59af1d215bf 100644 --- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames.java +++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames.java @@ -43,160 +43,238 @@ package sun.util.resources; public final class TimeZoneNames extends TimeZoneNamesBundle { protected final Object[][] getContents() { + // Note: generic names came from CLDR with some adjustments. String ACT[] = new String[] {"Acre Time", "ACT", - "Acre Summer Time", "ACST"}; + "Acre Summer Time", "ACST", + "Acre Time", "ACT"}; String ADELAIDE[] = new String[] {"Central Standard Time (South Australia)", "CST", - "Central Summer Time (South Australia)", "CST"}; + "Central Summer Time (South Australia)", "CST", + "Central Time (South Australia)", "CT"}; String AGT[] = new String[] {"Argentine Time", "ART", - "Argentine Summer Time", "ARST"}; + "Argentine Summer Time", "ARST", + "Argentine Time", "ART"}; String AKST[] = new String[] {"Alaska Standard Time", "AKST", - "Alaska Daylight Time", "AKDT"}; + "Alaska Daylight Time", "AKDT", + "Alaska Time", "AKT"}; String AMT[] = new String[] {"Amazon Time", "AMT", - "Amazon Summer Time", "AMST"}; + "Amazon Summer Time", "AMST", + "Amazon Time", "AMT"}; String ARAST[] = new String[] {"Arabia Standard Time", "AST", - "Arabia Daylight Time", "ADT"}; + "Arabia Daylight Time", "ADT", + "Arabia Time", "AT"}; String ARMT[] = new String[] {"Armenia Time", "AMT", - "Armenia Summer Time", "AMST"}; + "Armenia Summer Time", "AMST", + "Armenia Time", "AMT"}; String AST[] = new String[] {"Atlantic Standard Time", "AST", - "Atlantic Daylight Time", "ADT"}; + "Atlantic Daylight Time", "ADT", + "Atlantic Time", "AT"}; String BDT[] = new String[] {"Bangladesh Time", "BDT", - "Bangladesh Summer Time", "BDST"}; + "Bangladesh Summer Time", "BDST", + "Bangladesh Time", "BDT"}; String BRISBANE[] = new String[] {"Eastern Standard Time (Queensland)", "EST", - "Eastern Summer Time (Queensland)", "EST"}; + "Eastern Summer Time (Queensland)", "EST", + "Eastern Time (Queensland)", "ET"}; String BROKEN_HILL[] = new String[] {"Central Standard Time (South Australia/New South Wales)", "CST", - "Central Summer Time (South Australia/New South Wales)", "CST"}; + "Central Summer Time (South Australia/New South Wales)", "CST", + "Central Time (South Australia/New South Wales)", "CT"}; String BRT[] = new String[] {"Brasilia Time", "BRT", - "Brasilia Summer Time", "BRST"}; + "Brasilia Summer Time", "BRST", + "Brasilia Time", "BRT"}; String BTT[] = new String[] {"Bhutan Time", "BTT", - "Bhutan Summer Time", "BTST"}; + "Bhutan Summer Time", "BTST", + "Bhutan Time", "BTT"}; String CAT[] = new String[] {"Central African Time", "CAT", - "Central African Summer Time", "CAST"}; + "Central African Summer Time", "CAST", + "Central Africa Time", "CAT"}; String CET[] = new String[] {"Central European Time", "CET", - "Central European Summer Time", "CEST"}; + "Central European Summer Time", "CEST", + "Central European Time", "CET"}; String CHAST[] = new String[] {"Chatham Standard Time", "CHAST", - "Chatham Daylight Time", "CHADT"}; + "Chatham Daylight Time", "CHADT", + "Chatham Time", "CHAT"}; String CHUT[] = new String[] {"Chuuk Time", "CHUT", - "Chuuk Summer Time", "CHUST"}; + "Chuuk Summer Time", "CHUST", + "Chuuk Time", "CHUT"}; String CIT[] = new String[] {"Central Indonesia Time", "CIT", - "Central Indonesia Summer Time", "CIST"}; + "Central Indonesia Summer Time", "CIST", + "Central Indonesia Time", "CIT"}; String CLT[] = new String[] {"Chile Time", "CLT", - "Chile Summer Time", "CLST"}; + "Chile Summer Time", "CLST", + "Chile Time", "CLT"}; String CST[] = new String[] {"Central Standard Time", "CST", - "Central Daylight Time", "CDT"}; + "Central Daylight Time", "CDT", + "Central Time", "CT"}; String CTT[] = new String[] {"China Standard Time", "CST", - "China Daylight Time", "CDT"}; + "China Daylight Time", "CDT", + "China Time", "CT"}; String CUBA[] = new String[] {"Cuba Standard Time", "CST", - "Cuba Daylight Time", "CDT"}; + "Cuba Daylight Time", "CDT", + "Cuba Time", "CT"}; String DARWIN[] = new String[] {"Central Standard Time (Northern Territory)", "CST", - "Central Summer Time (Northern Territory)", "CST"}; + "Central Summer Time (Northern Territory)", "CST", + "Central Time (Northern Territory)", "CT"}; String DUBLIN[] = new String[] {"Greenwich Mean Time", "GMT", - "Irish Summer Time", "IST"}; + "Irish Summer Time", "IST", + "Irish Time", "IT"}; String EAT[] = new String[] {"Eastern African Time", "EAT", - "Eastern African Summer Time", "EAST"}; + "Eastern African Summer Time", "EAST", + "Eastern Africa Time", "EAT"}; String EASTER[] = new String[] {"Easter Is. Time", "EAST", - "Easter Is. Summer Time", "EASST"}; + "Easter Is. Summer Time", "EASST", + "Easter Is. Time", "EAST"}; String EET[] = new String[] {"Eastern European Time", "EET", - "Eastern European Summer Time", "EEST"}; + "Eastern European Summer Time", "EEST", + "Eastern European Time", "EET"}; String EGT[] = new String[] {"Eastern Greenland Time", "EGT", - "Eastern Greenland Summer Time", "EGST"}; + "Eastern Greenland Summer Time", "EGST", + "Eastern Greenland Time", "EGT"}; String EST[] = new String[] {"Eastern Standard Time", "EST", - "Eastern Daylight Time", "EDT"}; + "Eastern Daylight Time", "EDT", + "Eastern Time", "ET"}; String EST_NSW[] = new String[] {"Eastern Standard Time (New South Wales)", "EST", - "Eastern Summer Time (New South Wales)", "EST"}; + "Eastern Summer Time (New South Wales)", "EST", + "Eastern Time (New South Wales)", "ET"}; String FET[] = new String[] {"Further-eastern European Time", "FET", - "Further-eastern European Summer Time", "FEST"}; + "Further-eastern European Summer Time", "FEST", + "Further-eastern European Time", "FET"}; String GHMT[] = new String[] {"Ghana Mean Time", "GMT", - "Ghana Summer Time", "GHST"}; + "Ghana Summer Time", "GHST", + "Ghana Mean Time", "GMT"}; String GAMBIER[] = new String[] {"Gambier Time", "GAMT", - "Gambier Summer Time", "GAMST"}; + "Gambier Summer Time", "GAMST", + "Gambier Time", "GAMT"}; String GMT[] = new String[] {"Greenwich Mean Time", "GMT", + "Greenwich Mean Time", "GMT", "Greenwich Mean Time", "GMT"}; String GMTBST[] = new String[] {"Greenwich Mean Time", "GMT", - "British Summer Time", "BST"}; + "British Summer Time", "BST", + "British Time", "BT"}; String GST[] = new String[] {"Gulf Standard Time", "GST", - "Gulf Daylight Time", "GDT"}; + "Gulf Daylight Time", "GDT", + "Gulf Time", "GT"}; String HAST[] = new String[] {"Hawaii-Aleutian Standard Time", "HAST", - "Hawaii-Aleutian Daylight Time", "HADT"}; + "Hawaii-Aleutian Daylight Time", "HADT", + "Hawaii-Aleutian Time", "HAT"}; String HKT[] = new String[] {"Hong Kong Time", "HKT", - "Hong Kong Summer Time", "HKST"}; + "Hong Kong Summer Time", "HKST", + "Hong Kong Time", "HKT"}; String HST[] = new String[] {"Hawaii Standard Time", "HST", - "Hawaii Daylight Time", "HDT"}; + "Hawaii Daylight Time", "HDT", + "Hawaii Time", "HT"}; String ICT[] = new String[] {"Indochina Time", "ICT", - "Indochina Summer Time", "ICST"}; + "Indochina Summer Time", "ICST", + "Indochina Time", "ICT"}; String IRT[] = new String[] {"Iran Standard Time", "IRST", - "Iran Daylight Time", "IRDT"}; + "Iran Daylight Time", "IRDT", + "Iran Time", "IRT"}; String ISRAEL[] = new String[] {"Israel Standard Time", "IST", - "Israel Daylight Time", "IDT"}; + "Israel Daylight Time", "IDT", + "Israel Time", "IT"}; String IST[] = new String[] {"India Standard Time", "IST", - "India Daylight Time", "IDT"}; + "India Daylight Time", "IDT", + "India Time", "IT"}; String JST[] = new String[] {"Japan Standard Time", "JST", - "Japan Daylight Time", "JDT"}; + "Japan Daylight Time", "JDT", + "Japan Time", "JT"}; String KST[] = new String[] {"Korea Standard Time", "KST", - "Korea Daylight Time", "KDT"}; + "Korea Daylight Time", "KDT", + "Korea Time", "KT"}; String LORD_HOWE[] = new String[] {"Lord Howe Standard Time", "LHST", - "Lord Howe Summer Time", "LHST"}; + "Lord Howe Summer Time", "LHST", + "Lord Howe Time", "LHT"}; String MHT[] = new String[] {"Marshall Islands Time", "MHT", - "Marshall Islands Summer Time", "MHST"}; + "Marshall Islands Summer Time", "MHST", + "Marshall Islands Time", "MHT"}; String MSK[] = new String[] {"Moscow Standard Time", "MSK", - "Moscow Daylight Time", "MSD"}; + "Moscow Daylight Time", "MSD", + "Moscow Time", "MT"}; String MST[] = new String[] {"Mountain Standard Time", "MST", - "Mountain Daylight Time", "MDT"}; + "Mountain Daylight Time", "MDT", + "Mountain Time", "MT"}; String MYT[] = new String[] {"Malaysia Time", "MYT", - "Malaysia Summer Time", "MYST"}; + "Malaysia Summer Time", "MYST", + "Malaysia Time", "MYT"}; String NORONHA[] = new String[] {"Fernando de Noronha Time", "FNT", - "Fernando de Noronha Summer Time", "FNST"}; + "Fernando de Noronha Summer Time", "FNST", + "Fernando de Noronha Time", "FNT"}; String NOVT[] = new String[] {"Novosibirsk Time", "NOVT", - "Novosibirsk Summer Time", "NOVST"}; + "Novosibirsk Summer Time", "NOVST", + "Novosibirsk Time", "NOVT"}; String NPT[] = new String[] {"Nepal Time", "NPT", - "Nepal Summer Time", "NPST"}; + "Nepal Summer Time", "NPST", + "Nepal Time", "NPT"}; String NST[] = new String[] {"Newfoundland Standard Time", "NST", - "Newfoundland Daylight Time", "NDT"}; + "Newfoundland Daylight Time", "NDT", + "Newfoundland Time", "NT"}; String NZST[] = new String[] {"New Zealand Standard Time", "NZST", - "New Zealand Daylight Time", "NZDT"}; + "New Zealand Daylight Time", "NZDT", + "New Zealand Time", "NZT"}; String PITCAIRN[] = new String[] {"Pitcairn Standard Time", "PST", - "Pitcairn Daylight Time", "PDT"}; + "Pitcairn Daylight Time", "PDT", + "Pitcairn Time", "PT"}; String PKT[] = new String[] {"Pakistan Time", "PKT", - "Pakistan Summer Time", "PKST"}; + "Pakistan Summer Time", "PKST", + "Pakistan Time", "PKT"}; String PONT[] = new String[] {"Pohnpei Time", "PONT", - "Pohnpei Summer Time", "PONST"}; + "Pohnpei Summer Time", "PONST", + "Ponape Time", "PONT"}; String PST[] = new String[] {"Pacific Standard Time", "PST", - "Pacific Daylight Time", "PDT"}; + "Pacific Daylight Time", "PDT", + "Pacific Time", "PT"}; String SAST[] = new String[] {"South Africa Standard Time", "SAST", - "South Africa Summer Time", "SAST"}; + "South Africa Summer Time", "SAST", + "South Africa Time", "SAT"}; String SBT[] = new String[] {"Solomon Is. Time", "SBT", - "Solomon Is. Summer Time", "SBST"}; + "Solomon Is. Summer Time", "SBST", + "Solomon Is. Time", "SBT"}; String SGT[] = new String[] {"Singapore Time", "SGT", - "Singapore Summer Time", "SGST"}; + "Singapore Summer Time", "SGST", + "Singapore Time", "SGT"}; String SLST[] = new String[] {"Greenwich Mean Time", "GMT", - "Sierra Leone Summer Time", "SLST"}; + "Sierra Leone Summer Time", "SLST", + "Sierra Leone Time", "SLT"}; String TASMANIA[] = new String[] {"Eastern Standard Time (Tasmania)", "EST", - "Eastern Summer Time (Tasmania)", "EST"}; + "Eastern Summer Time (Tasmania)", "EST", + "Eastern Time (Tasmania)", "ET"}; String TMT[] = new String[] {"Turkmenistan Time", "TMT", - "Turkmenistan Summer Time", "TMST"}; + "Turkmenistan Summer Time", "TMST", + "Turkmenistan Time", "TMT"}; String ULAT[]= new String[] {"Ulaanbaatar Time", "ULAT", - "Ulaanbaatar Summer Time", "ULAST"}; + "Ulaanbaatar Summer Time", "ULAST", + "Ulaanbaatar Time", "ULAT"}; String WART[] = new String[] {"Western Argentine Time", "WART", - "Western Argentine Summer Time", "WARST"}; + "Western Argentine Summer Time", "WARST", + "Western Argentine Time", "WART"}; String WAT[] = new String[] {"Western African Time", "WAT", - "Western African Summer Time", "WAST"}; + "Western African Summer Time", "WAST", + "Western African Time", "WAT"}; String WET[] = new String[] {"Western European Time", "WET", - "Western European Summer Time", "WEST"}; + "Western European Summer Time", "WEST", + "Western European Time", "WET"}; String WIT[] = new String[] {"West Indonesia Time", "WIT", - "West Indonesia Summer Time", "WIST"}; + "West Indonesia Summer Time", "WIST", + "West Indonesia Time", "WIT"}; String WST_AUS[] = new String[] {"Western Standard Time (Australia)", "WST", - "Western Summer Time (Australia)", "WST"}; + "Western Summer Time (Australia)", "WST", + "Western Time (Australia)", "WT"}; String SAMOA[] = new String[] {"Samoa Standard Time", "SST", - "Samoa Daylight Time", "SDT"}; + "Samoa Daylight Time", "SDT", + "Samoa Time", "ST"}; String WST_SAMOA[] = new String[] {"West Samoa Time", "WST", - "West Samoa Daylight Time", "WSDT"}; + "West Samoa Daylight Time", "WSDT", + "West Samoa Time", "WST"}; String ChST[] = new String[] {"Chamorro Standard Time", "ChST", - "Chamorro Daylight Time", "ChDT"}; + "Chamorro Daylight Time", "ChDT", + "Chamorro Time", "ChT"}; String VICTORIA[] = new String[] {"Eastern Standard Time (Victoria)", "EST", - "Eastern Summer Time (Victoria)", "EST"}; + "Eastern Summer Time (Victoria)", "EST", + "Eastern Time (Victoria)", "ET"}; String UTC[] = new String[] {"Coordinated Universal Time", "UTC", + "Coordinated Universal Time", "UTC", "Coordinated Universal Time", "UTC"}; String UZT[] = new String[] {"Uzbekistan Time", "UZT", - "Uzbekistan Summer Time", "UZST"}; + "Uzbekistan Summer Time", "UZST", + "Uzbekistan Time", "UZT"}; return new Object[][] { {"America/Los_Angeles", PST}, @@ -309,7 +387,8 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { {"America/Argentina/Ushuaia", AGT}, {"America/Aruba", AST}, {"America/Asuncion", new String[] {"Paraguay Time", "PYT", - "Paraguay Summer Time", "PYST"}}, + "Paraguay Summer Time", "PYST", + "Paraguay Time", "PYT"}}, {"America/Atikokan", EST}, {"America/Atka", HAST}, {"America/Bahia", BRT}, @@ -320,17 +399,20 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { {"America/Blanc-Sablon", AST}, {"America/Boa_Vista", AMT}, {"America/Bogota", new String[] {"Colombia Time", "COT", - "Colombia Summer Time", "COST"}}, + "Colombia Summer Time", "COST", + "Colombia Time", "COT"}}, {"America/Boise", MST}, {"America/Buenos_Aires", AGT}, {"America/Cambridge_Bay", MST}, {"America/Campo_Grande", AMT}, {"America/Cancun", CST}, {"America/Caracas", new String[] {"Venezuela Time", "VET", - "Venezuela Summer Time", "VEST"}}, + "Venezuela Summer Time", "VEST", + "Venezuela Time", "VET"}}, {"America/Catamarca", AGT}, {"America/Cayenne", new String[] {"French Guiana Time", "GFT", - "French Guiana Summer Time", "GFST"}}, + "French Guiana Summer Time", "GFST", + "French Guiana Time", "GFT"}}, {"America/Cayman", EST}, {"America/Chihuahua", MST}, {"America/Creston", MST}, @@ -352,16 +434,19 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { {"America/Fortaleza", BRT}, {"America/Glace_Bay", AST}, {"America/Godthab", new String[] {"Western Greenland Time", "WGT", - "Western Greenland Summer Time", "WGST"}}, + "Western Greenland Summer Time", "WGST", + "Western Greenland Time", "WGT"}}, {"America/Goose_Bay", AST}, {"America/Grand_Turk", EST}, {"America/Grenada", AST}, {"America/Guadeloupe", AST}, {"America/Guatemala", CST}, {"America/Guayaquil", new String[] {"Ecuador Time", "ECT", - "Ecuador Summer Time", "ECST"}}, + "Ecuador Summer Time", "ECST", + "Ecuador Time", "ECT"}}, {"America/Guyana", new String[] {"Guyana Time", "GYT", - "Guyana Summer Time", "GYST"}}, + "Guyana Summer Time", "GYST", + "Guyana Time", "GYT"}}, {"America/Havana", CUBA}, {"America/Hermosillo", MST}, {"America/Indiana/Indianapolis", EST}, @@ -382,9 +467,11 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { {"America/Knox_IN", CST}, {"America/Kralendijk", AST}, {"America/La_Paz", new String[] {"Bolivia Time", "BOT", - "Bolivia Summer Time", "BOST"}}, + "Bolivia Summer Time", "BOST", + "Bolivia Time", "BOT"}}, {"America/Lima", new String[] {"Peru Time", "PET", - "Peru Summer Time", "PEST"}}, + "Peru Summer Time", "PEST", + "Peru Time", "PET"}}, {"America/Louisville", EST}, {"America/Lower_Princes", AST}, {"America/Maceio", BRT}, @@ -398,13 +485,16 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { {"America/Menominee", CST}, {"America/Merida", CST}, {"America/Metlakatla", new String[] {"Metlakatla Standard Time", "MeST", - "Metlakatla Daylight Time", "MeDT"}}, + "Metlakatla Daylight Time", "MeDT", + "Metlakatla Time", "MeT"}}, {"America/Mexico_City", CST}, {"America/Miquelon", new String[] {"Pierre & Miquelon Standard Time", "PMST", - "Pierre & Miquelon Daylight Time", "PMDT"}}, + "Pierre & Miquelon Daylight Time", "PMDT", + "Pierre & Miquelon Time", "PMT"}}, {"America/Moncton", AST}, {"America/Montevideo", new String[] {"Uruguay Time", "UYT", - "Uruguay Summer Time", "UYST"}}, + "Uruguay Summer Time", "UYST", + "Uruguay Time", "UYT"}}, {"America/Monterrey", CST}, {"America/Montreal", EST}, {"America/Montserrat", AST}, @@ -419,7 +509,8 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { {"America/Panama", EST}, {"America/Pangnirtung", EST}, {"America/Paramaribo", new String[] {"Suriname Time", "SRT", - "Suriname Summer Time", "SRST"}}, + "Suriname Summer Time", "SRST", + "Suriname Time", "SRT"}}, {"America/Port-au-Prince", EST}, {"America/Port_of_Spain", AST}, {"America/Porto_Acre", AMT}, @@ -459,113 +550,143 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { {"America/Yellowknife", MST}, {"Antarctica/Casey", WST_AUS}, {"Antarctica/Davis", new String[] {"Davis Time", "DAVT", - "Davis Summer Time", "DAVST"}}, + "Davis Summer Time", "DAVST", + "Davis Time", "DAVT"}}, {"Antarctica/DumontDUrville", new String[] {"Dumont-d'Urville Time", "DDUT", - "Dumont-d'Urville Summer Time", "DDUST"}}, + "Dumont-d'Urville Summer Time", "DDUST", + "Dumont-d'Urville Time", "DDUT"}}, {"Antarctica/Macquarie", new String[] {"Macquarie Island Time", "MIST", - "Macquarie Island Summer Time", "MIST"}}, + "Macquarie Island Summer Time", "MIST", + "Macquarie Island Time", "MIST"}}, {"Antarctica/Mawson", new String[] {"Mawson Time", "MAWT", - "Mawson Summer Time", "MAWST"}}, + "Mawson Summer Time", "MAWST", + "Mawson Time", "MAWT"}}, {"Antarctica/McMurdo", NZST}, {"Antarctica/Palmer", CLT}, {"Antarctica/Rothera", new String[] {"Rothera Time", "ROTT", - "Rothera Summer Time", "ROTST"}}, + "Rothera Summer Time", "ROTST", + "Rothera Time", "ROTT"}}, {"Antarctica/South_Pole", NZST}, {"Antarctica/Syowa", new String[] {"Syowa Time", "SYOT", - "Syowa Summer Time", "SYOST"}}, + "Syowa Summer Time", "SYOST", + "Syowa Time", "SYOT"}}, {"Antarctica/Vostok", new String[] {"Vostok Time", "VOST", - "Vostok Summer Time", "VOSST"}}, + "Vostok Summer Time", "VOSST", + "Vostok Time", "VOST"}}, {"Arctic/Longyearbyen", CET}, {"Asia/Aden", ARAST}, {"Asia/Almaty", new String[] {"Alma-Ata Time", "ALMT", - "Alma-Ata Summer Time", "ALMST"}}, + "Alma-Ata Summer Time", "ALMST", + "Alma-Ata Time", "ALMT"}}, {"Asia/Amman", EET}, {"Asia/Anadyr", new String[] {"Anadyr Time", "ANAT", - "Anadyr Summer Time", "ANAST"}}, + "Anadyr Summer Time", "ANAST", + "Anadyr Time", "ANAT"}}, {"Asia/Aqtau", new String[] {"Aqtau Time", "AQTT", - "Aqtau Summer Time", "AQTST"}}, + "Aqtau Summer Time", "AQTST", + "Aqtau Time", "AQTT"}}, {"Asia/Aqtobe", new String[] {"Aqtobe Time", "AQTT", - "Aqtobe Summer Time", "AQTST"}}, + "Aqtobe Summer Time", "AQTST", + "Aqtobe Time", "AQTT"}}, {"Asia/Ashgabat", TMT}, {"Asia/Ashkhabad", TMT}, {"Asia/Baghdad", ARAST}, {"Asia/Bahrain", ARAST}, {"Asia/Baku", new String[] {"Azerbaijan Time", "AZT", - "Azerbaijan Summer Time", "AZST"}}, + "Azerbaijan Summer Time", "AZST", + "Azerbaijan Time", "AZT"}}, {"Asia/Bangkok", ICT}, {"Asia/Beirut", EET}, {"Asia/Bishkek", new String[] {"Kirgizstan Time", "KGT", - "Kirgizstan Summer Time", "KGST"}}, + "Kirgizstan Summer Time", "KGST", + "Kirgizstan Time", "KGT"}}, {"Asia/Brunei", new String[] {"Brunei Time", "BNT", - "Brunei Summer Time", "BNST"}}, + "Brunei Summer Time", "BNST", + "Brunei Time", "BNT"}}, {"Asia/Calcutta", IST}, {"Asia/Choibalsan", new String[] {"Choibalsan Time", "CHOT", - "Choibalsan Summer Time", "CHOST"}}, + "Choibalsan Summer Time", "CHOST", + "Choibalsan Time", "CHOT"}}, {"Asia/Chongqing", CTT}, {"Asia/Chungking", CTT}, {"Asia/Colombo", IST}, {"Asia/Dacca", BDT}, {"Asia/Dhaka", BDT}, {"Asia/Dili", new String[] {"Timor-Leste Time", "TLT", - "Timor-Leste Summer Time", "TLST"}}, + "Timor-Leste Summer Time", "TLST", + "Timor-Leste Time", "TLT"}}, {"Asia/Damascus", EET}, {"Asia/Dubai", GST}, {"Asia/Dushanbe", new String[] {"Tajikistan Time", "TJT", - "Tajikistan Summer Time", "TJST"}}, + "Tajikistan Summer Time", "TJST", + "Tajikistan Time", "TJT"}}, {"Asia/Gaza", EET}, {"Asia/Harbin", CTT}, {"Asia/Hebron", EET}, {"Asia/Ho_Chi_Minh", ICT}, {"Asia/Hong_Kong", HKT}, {"Asia/Hovd", new String[] {"Hovd Time", "HOVT", - "Hovd Summer Time", "HOVST"}}, + "Hovd Summer Time", "HOVST", + "Hovd Time", "HOVT"}}, {"Asia/Irkutsk", new String[] {"Irkutsk Time", "IRKT", - "Irkutsk Summer Time", "IRKST"}}, + "Irkutsk Summer Time", "IRKST", + "Irkutsk Time", "IRKT"}}, {"Asia/Istanbul", EET}, {"Asia/Jakarta", WIT}, {"Asia/Jayapura", new String[] {"East Indonesia Time", "EIT", - "East Indonesia Summer Time", "EIST"}}, + "East Indonesia Summer Time", "EIST", + "East Indonesia Time", "EIT"}}, {"Asia/Kabul", new String[] {"Afghanistan Time", "AFT", - "Afghanistan Summer Time", "AFST"}}, + "Afghanistan Summer Time", "AFST", + "Afghanistan Time", "AFT"}}, {"Asia/Kamchatka", new String[] {"Petropavlovsk-Kamchatski Time", "PETT", - "Petropavlovsk-Kamchatski Summer Time", "PETST"}}, + "Petropavlovsk-Kamchatski Summer Time", "PETST", + "Petropavlovsk-Kamchatski Time", "PETT"}}, {"Asia/Karachi", PKT}, {"Asia/Kashgar", CTT}, {"Asia/Kathmandu", NPT}, {"Asia/Katmandu", NPT}, {"Asia/Kolkata", IST}, {"Asia/Krasnoyarsk", new String[] {"Krasnoyarsk Time", "KRAT", - "Krasnoyarsk Summer Time", "KRAST"}}, + "Krasnoyarsk Summer Time", "KRAST", + "Krasnoyarsk Time", "KRAT"}}, {"Asia/Kuala_Lumpur", MYT}, {"Asia/Kuching", MYT}, {"Asia/Kuwait", ARAST}, {"Asia/Macao", CTT}, {"Asia/Macau", CTT}, {"Asia/Magadan", new String[] {"Magadan Time", "MAGT", - "Magadan Summer Time", "MAGST"}}, + "Magadan Summer Time", "MAGST", + "Magadan Time", "MAGT"}}, {"Asia/Makassar", CIT}, {"Asia/Manila", new String[] {"Philippines Time", "PHT", - "Philippines Summer Time", "PHST"}}, + "Philippines Summer Time", "PHST", + "Philippines Time", "PHT"}}, {"Asia/Muscat", GST}, {"Asia/Nicosia", EET}, {"Asia/Novokuznetsk", NOVT}, {"Asia/Novosibirsk", NOVT}, {"Asia/Oral", new String[] {"Oral Time", "ORAT", - "Oral Summer Time", "ORAST"}}, + "Oral Summer Time", "ORAST", + "Oral Time", "ORAT"}}, {"Asia/Omsk", new String[] {"Omsk Time", "OMST", - "Omsk Summer Time", "OMSST"}}, + "Omsk Summer Time", "OMSST", + "Omsk Time", "OMST"}}, {"Asia/Phnom_Penh", ICT}, {"Asia/Pontianak", WIT}, {"Asia/Pyongyang", KST}, {"Asia/Qatar", ARAST}, {"Asia/Qyzylorda", new String[] {"Qyzylorda Time", "QYZT", - "Qyzylorda Summer Time", "QYZST"}}, + "Qyzylorda Summer Time", "QYZST", + "Qyzylorda Time", "QYZT"}}, {"Asia/Rangoon", new String[] {"Myanmar Time", "MMT", - "Myanmar Summer Time", "MMST"}}, + "Myanmar Summer Time", "MMST", + "Myanmar Time", "MMT"}}, {"Asia/Riyadh", ARAST}, {"Asia/Saigon", ICT}, {"Asia/Sakhalin", new String[] {"Sakhalin Time", "SAKT", - "Sakhalin Summer Time", "SAKST"}}, + "Sakhalin Summer Time", "SAKST", + "Sakhalin Time", "SAKT"}}, {"Asia/Samarkand", UZT}, {"Asia/Seoul", KST}, {"Asia/Singapore", SGT}, @@ -573,7 +694,8 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { {"Asia/Tel_Aviv", ISRAEL}, {"Asia/Tashkent", UZT}, {"Asia/Tbilisi", new String[] {"Georgia Time", "GET", - "Georgia Summer Time", "GEST"}}, + "Georgia Summer Time", "GEST", + "Georgia Time", "GET"}}, {"Asia/Tehran", IRT}, {"Asia/Thimbu", BTT}, {"Asia/Thimphu", BTT}, @@ -583,28 +705,35 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { {"Asia/Urumqi", CTT}, {"Asia/Vientiane", ICT}, {"Asia/Vladivostok", new String[] {"Vladivostok Time", "VLAT", - "Vladivostok Summer Time", "VLAST"}}, + "Vladivostok Summer Time", "VLAST", + "Vladivostok Time", "VLAT"}}, {"Asia/Yakutsk", new String[] {"Yakutsk Time", "YAKT", - "Yakutsk Summer Time", "YAKST"}}, + "Yakutsk Summer Time", "YAKST", + "Yakutsk Time", "YAKT"}}, {"Asia/Yekaterinburg", new String[] {"Yekaterinburg Time", "YEKT", - "Yekaterinburg Summer Time", "YEKST"}}, + "Yekaterinburg Summer Time", "YEKST", + "Yekaterinburg Time", "YEKT"}}, {"Asia/Yerevan", ARMT}, {"Atlantic/Azores", new String[] {"Azores Time", "AZOT", - "Azores Summer Time", "AZOST"}}, + "Azores Summer Time", "AZOST", + "Azores Time", "AZOT"}}, {"Atlantic/Bermuda", AST}, {"Atlantic/Canary", WET}, {"Atlantic/Cape_Verde", new String[] {"Cape Verde Time", "CVT", - "Cape Verde Summer Time", "CVST"}}, + "Cape Verde Summer Time", "CVST", + "Cape Verde Time", "CVT"}}, {"Atlantic/Faeroe", WET}, {"Atlantic/Faroe", WET}, {"Atlantic/Jan_Mayen", CET}, {"Atlantic/Madeira", WET}, {"Atlantic/Reykjavik", GMT}, {"Atlantic/South_Georgia", new String[] {"South Georgia Standard Time", "GST", - "South Georgia Daylight Time", "GDT"}}, + "South Georgia Daylight Time", "GDT", + "South Georgia Time", "GT"}}, {"Atlantic/St_Helena", GMT}, {"Atlantic/Stanley", new String[] {"Falkland Is. Time", "FKT", - "Falkland Is. Summer Time", "FKST"}}, + "Falkland Is. Summer Time", "FKST", + "Falkland Is. Time", "FKT"}}, {"Australia/ACT", EST_NSW}, {"Australia/Adelaide", ADELAIDE}, {"Australia/Brisbane", BRISBANE}, @@ -613,7 +742,8 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { {"Australia/Currie", EST_NSW}, {"Australia/Darwin", DARWIN}, {"Australia/Eucla", new String[] {"Central Western Standard Time (Australia)", "CWST", - "Central Western Summer Time (Australia)", "CWST"}}, + "Central Western Summer Time (Australia)", "CWST", + "Central Western Time (Australia)", "CWT"}}, {"Australia/Hobart", TASMANIA}, {"Australia/LHI", LORD_HOWE}, {"Australia/Lindeman", BRISBANE}, @@ -697,7 +827,8 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { {"Europe/Riga", EET}, {"Europe/Rome", CET}, {"Europe/Samara", new String[] {"Samara Time", "SAMT", - "Samara Summer Time", "SAMST"}}, + "Samara Summer Time", "SAMST", + "Samara Time", "SAMT"}}, {"Europe/San_Marino", CET}, {"Europe/Sarajevo", CET}, {"Europe/Simferopol", EET}, @@ -713,7 +844,8 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { {"Europe/Vienna", CET}, {"Europe/Vilnius", EET}, {"Europe/Volgograd", new String[] {"Volgograd Time", "VOLT", - "Volgograd Summer Time", "VOLST"}}, + "Volgograd Summer Time", "VOLST", + "Volgograd Time", "VOLT"}}, {"Europe/Warsaw", CET}, {"Europe/Zagreb", CET}, {"Europe/Zaporozhye", EET}, @@ -727,30 +859,39 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { {"IST", IST}, {"Indian/Antananarivo", EAT}, {"Indian/Chagos", new String[] {"Indian Ocean Territory Time", "IOT", - "Indian Ocean Territory Summer Time", "IOST"}}, + "Indian Ocean Territory Summer Time", "IOST", + "Indian Ocean Territory Time", "IOT"}}, {"Indian/Christmas", new String[] {"Christmas Island Time", "CXT", - "Christmas Island Summer Time", "CXST"}}, + "Christmas Island Summer Time", "CXST", + "Christmas Island Time", "CIT"}}, {"Indian/Cocos", new String[] {"Cocos Islands Time", "CCT", - "Cocos Islands Summer Time", "CCST"}}, + "Cocos Islands Summer Time", "CCST", + "Cocos Islands Time", "CCT"}}, {"Indian/Comoro", EAT}, {"Indian/Kerguelen", new String[] {"French Southern & Antarctic Lands Time", "TFT", - "French Southern & Antarctic Lands Summer Time", "TFST"}}, + "French Southern & Antarctic Lands Summer Time", "TFST", + "French Southern & Antarctic Lands Time", "TFT"}}, {"Indian/Mahe", new String[] {"Seychelles Time", "SCT", - "Seychelles Summer Time", "SCST"}}, + "Seychelles Summer Time", "SCST", + "Seychelles Time", "SCT"}}, {"Indian/Maldives", new String[] {"Maldives Time", "MVT", - "Maldives Summer Time", "MVST"}}, + "Maldives Summer Time", "MVST", + "Maldives Time", "MVT"}}, {"Indian/Mauritius", new String[] {"Mauritius Time", "MUT", - "Mauritius Summer Time", "MUST"}}, + "Mauritius Summer Time", "MUST", + "Mauritius Time", "MUT"}}, {"Indian/Mayotte", EAT}, {"Indian/Reunion", new String[] {"Reunion Time", "RET", - "Reunion Summer Time", "REST"}}, + "Reunion Summer Time", "REST", + "Reunion Time", "RET"}}, {"Israel", ISRAEL}, {"Jamaica", EST}, {"Japan", JST}, {"Kwajalein", MHT}, {"Libya", EET}, {"MET", new String[] {"Middle Europe Time", "MET", - "Middle Europe Summer Time", "MEST"}}, + "Middle Europe Summer Time", "MEST", + "Middle Europe Time", "MET"}}, {"Mexico/BajaNorte", PST}, {"Mexico/BajaSur", MST}, {"Mexico/General", CST}, @@ -770,61 +911,82 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { {"Pacific/Chuuk", CHUT}, {"Pacific/Easter", EASTER}, {"Pacific/Efate", new String[] {"Vanuatu Time", "VUT", - "Vanuatu Summer Time", "VUST"}}, + "Vanuatu Summer Time", "VUST", + "Vanuatu Time", "VUT"}}, {"Pacific/Enderbury", new String[] {"Phoenix Is. Time", "PHOT", - "Phoenix Is. Summer Time", "PHOST"}}, + "Phoenix Is. Summer Time", "PHOST", + "Phoenix Is. Time", "PHOT"}}, {"Pacific/Fakaofo", new String[] {"Tokelau Time", "TKT", - "Tokelau Summer Time", "TKST"}}, + "Tokelau Summer Time", "TKST", + "Tokelau Time", "TKT"}}, {"Pacific/Fiji", new String[] {"Fiji Time", "FJT", - "Fiji Summer Time", "FJST"}}, + "Fiji Summer Time", "FJST", + "Fiji Time", "FJT"}}, {"Pacific/Funafuti", new String[] {"Tuvalu Time", "TVT", - "Tuvalu Summer Time", "TVST"}}, + "Tuvalu Summer Time", "TVST", + "Tuvalu Time", "TVT"}}, {"Pacific/Galapagos", new String[] {"Galapagos Time", "GALT", - "Galapagos Summer Time", "GALST"}}, + "Galapagos Summer Time", "GALST", + "Galapagos Time", "GALT"}}, {"Pacific/Gambier", GAMBIER}, {"Pacific/Guadalcanal", SBT}, {"Pacific/Guam", ChST}, {"Pacific/Johnston", HST}, {"Pacific/Kiritimati", new String[] {"Line Is. Time", "LINT", - "Line Is. Summer Time", "LINST"}}, + "Line Is. Summer Time", "LINST", + "Line Is. Time", "LINT"}}, {"Pacific/Kosrae", new String[] {"Kosrae Time", "KOST", - "Kosrae Summer Time", "KOSST"}}, + "Kosrae Summer Time", "KOSST", + "Kosrae Time", "KOST"}}, {"Pacific/Kwajalein", MHT}, {"Pacific/Majuro", MHT}, {"Pacific/Marquesas", new String[] {"Marquesas Time", "MART", - "Marquesas Summer Time", "MARST"}}, + "Marquesas Summer Time", "MARST", + "Marquesas Time", "MART"}}, {"Pacific/Midway", SAMOA}, {"Pacific/Nauru", new String[] {"Nauru Time", "NRT", - "Nauru Summer Time", "NRST"}}, + "Nauru Summer Time", "NRST", + "Nauru Time", "NRT"}}, {"Pacific/Niue", new String[] {"Niue Time", "NUT", - "Niue Summer Time", "NUST"}}, + "Niue Summer Time", "NUST", + "Niue Time", "NUT"}}, {"Pacific/Norfolk", new String[] {"Norfolk Time", "NFT", - "Norfolk Summer Time", "NFST"}}, + "Norfolk Summer Time", "NFST", + "Norfolk Time", "NFT"}}, {"Pacific/Noumea", new String[] {"New Caledonia Time", "NCT", - "New Caledonia Summer Time", "NCST"}}, + "New Caledonia Summer Time", "NCST", + "New Caledonia Time", "NCT"}}, {"Pacific/Pago_Pago", SAMOA}, {"Pacific/Palau", new String[] {"Palau Time", "PWT", - "Palau Summer Time", "PWST"}}, + "Palau Summer Time", "PWST", + "Palau Time", "PWT"}}, {"Pacific/Pitcairn", PITCAIRN}, {"Pacific/Pohnpei", PONT}, {"Pacific/Ponape", PONT}, {"Pacific/Port_Moresby", new String[] {"Papua New Guinea Time", "PGT", - "Papua New Guinea Summer Time", "PGST"}}, + "Papua New Guinea Summer Time", "PGST", + "Papua New Guinea Time", "PGT"}}, {"Pacific/Rarotonga", new String[] {"Cook Is. Time", "CKT", - "Cook Is. Summer Time", "CKHST"}}, + "Cook Is. Summer Time", "CKHST", + "Cook Is. Time", "CKT"}}, {"Pacific/Saipan", ChST}, {"Pacific/Samoa", SAMOA}, {"Pacific/Tahiti", new String[] {"Tahiti Time", "TAHT", - "Tahiti Summer Time", "TAHST"}}, + "Tahiti Summer Time", "TAHST", + "Tahiti Time", "TAHT"}}, {"Pacific/Tarawa", new String[] {"Gilbert Is. Time", "GILT", - "Gilbert Is. Summer Time", "GILST"}}, + "Gilbert Is. Summer Time", "GILST", + "Gilbert Is. Time", "GILT"}}, {"Pacific/Tongatapu", new String[] {"Tonga Time", "TOT", - "Tonga Summer Time", "TOST"}}, + "Tonga Summer Time", "TOST", + "Tonga Time", "TOT"}}, {"Pacific/Truk", CHUT}, {"Pacific/Wake", new String[] {"Wake Time", "WAKT", - "Wake Summer Time", "WAKST"}}, + "Wake Summer Time", "WAKST", + "Wake Time", "WAKT"}}, {"Pacific/Wallis", new String[] {"Wallis & Futuna Time", "WFT", - "Wallis & Futuna Summer Time", "WFST"}}, + "Wallis & Futuna Summer Time", "WFST", + "Wallis & Futuna Time", "WFT"}}, {"Pacific/Yap", CHUT}, {"Poland", CET}, {"PRC", CTT}, diff --git a/jdk/src/share/classes/sun/util/resources/TimeZoneNamesBundle.java b/jdk/src/share/classes/sun/util/resources/TimeZoneNamesBundle.java index 3757ed121a5..e0e1a700a3d 100644 --- a/jdk/src/share/classes/sun/util/resources/TimeZoneNamesBundle.java +++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNamesBundle.java @@ -42,6 +42,9 @@ package sun.util.resources; import java.util.Map; import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.MissingResourceException; +import java.util.Set; /** * Subclass of ResourceBundle with special @@ -57,6 +60,26 @@ import java.util.LinkedHashMap; */ public abstract class TimeZoneNamesBundle extends OpenListResourceBundle { + /** + * Returns a String array containing time zone names. The String array has + * at most size elements. + * + * @param key the time zone ID for which names are obtained + * @param size the requested size of array for names + * @return a String array containing names + */ + public String[] getStringArray(String key, int size) { + String[] names = handleGetObject(key, size); + if ((names == null || names.length != size) && parent != null) { + names = ((TimeZoneNamesBundle)parent).getStringArray(key, size); + } + if (names == null) { + throw new MissingResourceException("no time zone names", getClass().getName(), key); + } + return names; + + } + /** * Maps time zone IDs to locale-specific names. * The value returned is an array of five strings: @@ -71,13 +94,17 @@ public abstract class TimeZoneNamesBundle extends OpenListResourceBundle { * getContents implementations, while the time zone * ID is inserted into the returned array by this method. */ + @Override public Object handleGetObject(String key) { + return handleGetObject(key, 5); + } + + private String[] handleGetObject(String key, int n) { String[] contents = (String[]) super.handleGetObject(key); if (contents == null) { return null; } - - int clen = contents.length; + int clen = Math.min(n - 1, contents.length); String[] tmpobj = new String[clen+1]; tmpobj[0] = key; System.arraycopy(contents, 0, tmpobj, 1, clen); @@ -85,13 +112,23 @@ public abstract class TimeZoneNamesBundle extends OpenListResourceBundle { } /** - * Use LinkedHashMap to preserve order of bundle entries. + * Use LinkedHashMap to preserve the order of bundle entries. */ @Override - protected Map createMap(int size) { + protected Map createMap(int size) { return new LinkedHashMap<>(size); } + /** + * Use LinkedHashSet to preserve the key order. + * @param the type of elements + * @return a Set + */ + @Override + protected Set createSet() { + return new LinkedHashSet<>(); + } + /** * Provides key/value mappings for a specific * resource bundle. Each entry of the array diff --git a/jdk/src/share/demo/java2d/J2DBench/build.xml b/jdk/src/share/demo/java2d/J2DBench/build.xml index 153c14140a1..a36aca8cec7 100644 --- a/jdk/src/share/demo/java2d/J2DBench/build.xml +++ b/jdk/src/share/demo/java2d/J2DBench/build.xml @@ -49,7 +49,7 @@ - + = 0); + } + } + + private static class ConvertRasterTest extends ColorConvertOpTests { + public ConvertRasterTest() { + super(opConvRoot, "op_rst", "op.filetr(Raster)"); + } + + public void runTest(Object octx, int numReps) { + final Context ctx = (Context)octx; + final ColorConvertOp op = ctx.op_rst; + + final Raster src = ctx.rsrc; + WritableRaster dst = ctx.rdst; + do { + try { + dst = op.filter(src, dst); + } catch (Exception e) { + e.printStackTrace(); + } + } while (--numReps >= 0); + } + } + + private static class DrawImageTest extends ColorConvertOpTests { + public DrawImageTest() { + super(opConvRoot, "op_draw", "drawImage(ColorConvertOp)"); + } + + public void runTest(Object octx, int numReps) { + final Context ctx = (Context)octx; + final ColorConvertOp op = ctx.op_img; + + final Graphics2D g = ctx.graphics; + + final BufferedImage src = ctx.src; + + do { + g.drawImage(src, op, 0, 0); + } while (--numReps >= 0); + } + } + + /************************************************************************** + ****** Helper routines + *************************************************************************/ + protected static BufferedImage createBufferedImage(int width, + int height, + ImageContent contentType, + int type) + { + BufferedImage image; + image = new BufferedImage(width, height, type); + boolean hasAlpha = image.getColorModel().hasAlpha(); + switch (contentType) { + case RANDOM: + for (int y = 0; y < height; y++) { + for (int x = 0; x < width; x++) { + int rgb = (int)(Math.random() * 0xffffff); + if (hasAlpha) { + rgb |= 0x7f000000; + } + image.setRGB(x, y, rgb); + } + } + break; + case VECTOR: + { + Graphics2D g = image.createGraphics(); + if (hasAlpha) { + // fill background with a translucent color + g.setComposite(AlphaComposite.getInstance( + AlphaComposite.SRC, 0.5f)); + } + g.setColor(Color.blue); + g.fillRect(0, 0, width, height); + g.setComposite(AlphaComposite.Src); + g.setColor(Color.yellow); + g.fillOval(2, 2, width-4, height-4); + g.setColor(Color.red); + g.fillOval(4, 4, width-8, height-8); + g.setColor(Color.green); + g.fillRect(8, 8, width-16, height-16); + g.setColor(Color.white); + g.drawLine(0, 0, width, height); + g.drawLine(0, height, width, 0); + g.dispose(); + break; + } + case PHOTO: + { + Image photo = null; + try { + photo = ImageIO.read( + IIOTests.class.getResourceAsStream("images/photo.jpg")); + } catch (Exception e) { + System.err.println("error loading photo"); + e.printStackTrace(); + } + Graphics2D g = image.createGraphics(); + if (hasAlpha) { + g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC, + 0.5f)); + } + g.drawImage(photo, 0, 0, width, height, null); + g.dispose(); + break; + } + default: + break; + } + + return image; + } +} diff --git a/jdk/src/share/demo/java2d/J2DBench/src/j2dbench/tests/cmm/DataConversionTests.java b/jdk/src/share/demo/java2d/J2DBench/src/j2dbench/tests/cmm/DataConversionTests.java new file mode 100644 index 00000000000..4dd8ff5a230 --- /dev/null +++ b/jdk/src/share/demo/java2d/J2DBench/src/j2dbench/tests/cmm/DataConversionTests.java @@ -0,0 +1,198 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of Oracle nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This source code is provided to illustrate the usage of a given feature + * or technique and has been deliberately simplified. Additional steps + * required for a production-quality application, such as security checks, + * input validation and proper error handling, might not be present in + * this sample code. + */ + +package j2dbench.tests.cmm; + +import j2dbench.Group; +import j2dbench.Result; +import j2dbench.TestEnvironment; +import java.awt.color.ColorSpace; + +public class DataConversionTests extends ColorConversionTests { + + protected static Group dataConvRoot; + + public static void init() { + dataConvRoot = new Group(colorConvRoot, "data", "Data Conversoion Tests"); + + new FromRGBTest(); + new ToRGBTest(); + new FromCIEXYZTest(); + new ToCIEXYZTest(); + } + + public DataConversionTests(Group parent, String nodeName, String description) { + super(parent, nodeName, description); + } + + protected static class Context { + + ColorSpace cs; + int numComponents; + float[] val; + float[] rgb; + float[] cie; + TestEnvironment env; + Result res; + + public Context(TestEnvironment env, Result result, ColorSpace cs) { + this.cs = cs; + this.env = env; + this.res = result; + + numComponents = cs.getNumComponents(); + + val = new float[numComponents]; + + for (int i = 0; i < numComponents; i++) { + float min = cs.getMinValue(i); + float max = cs.getMaxValue(i); + + val[i] = 0.5f * (max - min); + } + + rgb = new float[]{0.5f, 0.5f, 0.5f}; + cie = new float[]{0.5f, 0.5f, 0.5f}; + } + } + + @Override + public Object initTest(TestEnvironment env, Result result) { + ColorSpace cs = getColorSpace(env); + return new Context(env, result, cs); + } + + @Override + public void cleanupTest(TestEnvironment te, Object o) { + } + + private static class FromRGBTest extends DataConversionTests { + + public FromRGBTest() { + super(dataConvRoot, + "fromRGB", + "ColorSpace.fromRGB()"); + } + + public void runTest(Object ctx, int numReps) { + final Context ictx = (Context) ctx; + final ColorSpace cs = ictx.cs; + + final float[] rgb = ictx.rgb; + do { + try { + cs.fromRGB(rgb); + } catch (Exception e) { + e.printStackTrace(); + } + } while (--numReps >= 0); + } + } + + private static class FromCIEXYZTest extends DataConversionTests { + + public FromCIEXYZTest() { + super(dataConvRoot, + "fromCIEXYZ", + "ColorSpace.fromCIEXYZ()"); + } + + public void runTest(Object ctx, int numReps) { + final Context ictx = (Context) ctx; + final ColorSpace cs = ictx.cs; + + final float[] val = ictx.cie; + do { + try { + cs.fromCIEXYZ(val); + } catch (Exception e) { + e.printStackTrace(); + } + } while (--numReps >= 0); + } + } + + private static class ToCIEXYZTest extends DataConversionTests { + + public ToCIEXYZTest() { + super(dataConvRoot, + "toCIEXYZ", + "ColorSpace.toCIEXYZ()"); + } + + public void runTest(Object ctx, int numReps) { + final Context ictx = (Context) ctx; + final ColorSpace cs = ictx.cs; + + final float[] val = ictx.val; + + do { + try { + cs.toCIEXYZ(val); + } catch (Exception e) { + e.printStackTrace(); + } + } while (--numReps >= 0); + } + } + + private static class ToRGBTest extends DataConversionTests { + + public ToRGBTest() { + super(dataConvRoot, + "toRGB", + "ColorSpace.toRGB()"); + } + + public void runTest(Object ctx, int numReps) { + final Context ictx = (Context) ctx; + final ColorSpace cs = ictx.cs; + + final float[] val = ictx.val; + + do { + try { + cs.toRGB(val); + } catch (Exception e) { + e.printStackTrace(); + } + } while (--numReps >= 0); + } + } +} diff --git a/jdk/src/share/demo/java2d/J2DBench/src/j2dbench/tests/cmm/ProfileTests.java b/jdk/src/share/demo/java2d/J2DBench/src/j2dbench/tests/cmm/ProfileTests.java new file mode 100644 index 00000000000..56290528616 --- /dev/null +++ b/jdk/src/share/demo/java2d/J2DBench/src/j2dbench/tests/cmm/ProfileTests.java @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of Oracle nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This source code is provided to illustrate the usage of a given feature + * or technique and has been deliberately simplified. Additional steps + * required for a production-quality application, such as security checks, + * input validation and proper error handling, might not be present in + * this sample code. + */ +package j2dbench.tests.cmm; + +import j2dbench.Group; +import j2dbench.Result; +import j2dbench.TestEnvironment; +import java.awt.color.ColorSpace; +import java.awt.color.ICC_ColorSpace; +import java.awt.color.ICC_Profile; + +public class ProfileTests extends CMMTests { + + protected static Group profileRoot; + + public static void init() { + profileRoot = new Group(cmmRoot, "profiles", "Profile Handling Benchmarks"); + + new ReadHeaderTest(); + new GetNumComponentsTest(); + } + + protected ProfileTests(Group parent, String nodeName, String description) { + super(parent, nodeName, description); + } + + protected static class Context { + + ICC_Profile profile; + TestEnvironment env; + Result res; + + public Context(ICC_Profile profile, TestEnvironment env, Result res) { + this.profile = profile; + this.env = env; + this.res = res; + } + } + + @Override + public Object initTest(TestEnvironment env, Result res) { + ICC_ColorSpace cs = (ICC_ColorSpace) getColorSpace(env); + return new Context(cs.getProfile(), env, res); + } + + @Override + public void cleanupTest(TestEnvironment env, Object o) { + } + + private static class ReadHeaderTest extends ProfileTests { + + public ReadHeaderTest() { + super(profileRoot, + "getHeader", + "getData(icSigHead)"); + } + + @Override + public void runTest(Object ctx, int numReps) { + final Context ictx = (Context) ctx; + final ICC_Profile profile = ictx.profile; + + byte[] data = null; + do { + try { + data = profile.getData(ICC_Profile.icSigHead); + } catch (Exception e) { + e.printStackTrace(); + } + } while (--numReps >= 0); + } + } + + private static class GetNumComponentsTest extends ProfileTests { + + public GetNumComponentsTest() { + super(profileRoot, + "getNumComponents", + "getNumComponents"); + } + + @Override + public void runTest(Object ctx, int numReps) { + final Context ictx = (Context) ctx; + final ICC_Profile profile = ictx.profile; + + do { + try { + int num = profile.getNumComponents(); + } catch (Exception e) { + e.printStackTrace(); + } + } while (--numReps >= 0); + } + } +} diff --git a/jdk/src/share/javavm/export/classfile_constants.h b/jdk/src/share/javavm/export/classfile_constants.h index 2ee8a3c6d2e..1fa6e3c6d01 100644 --- a/jdk/src/share/javavm/export/classfile_constants.h +++ b/jdk/src/share/javavm/export/classfile_constants.h @@ -31,7 +31,7 @@ extern "C" { #endif /* Classfile version number for this information */ -#define JVM_CLASSFILE_MAJOR_VERSION 51 +#define JVM_CLASSFILE_MAJOR_VERSION 52 #define JVM_CLASSFILE_MINOR_VERSION 0 /* Flags */ diff --git a/jdk/src/share/lib/security/java.security b/jdk/src/share/lib/security/java.security-linux similarity index 99% rename from jdk/src/share/lib/security/java.security rename to jdk/src/share/lib/security/java.security-linux index 22103ad97a5..dd63fd4d1e2 100644 --- a/jdk/src/share/lib/security/java.security +++ b/jdk/src/share/lib/security/java.security-linux @@ -371,7 +371,7 @@ krb5.kdc.bad.policy = tryLast # jdk.certpath.disabledAlgorithms=MD2, DSA, RSA keySize < 2048 # # -jdk.certpath.disabledAlgorithms=MD2 +jdk.certpath.disabledAlgorithms=MD2, RSA keySize < 1024 # Algorithm restrictions for Secure Socket Layer/Transport Layer Security # (SSL/TLS) processing diff --git a/jdk/src/share/lib/security/java.security-macosx b/jdk/src/share/lib/security/java.security-macosx index 3db909b224d..00759d7b215 100644 --- a/jdk/src/share/lib/security/java.security-macosx +++ b/jdk/src/share/lib/security/java.security-macosx @@ -372,7 +372,7 @@ krb5.kdc.bad.policy = tryLast # jdk.certpath.disabledAlgorithms=MD2, DSA, RSA keySize < 2048 # # -jdk.certpath.disabledAlgorithms=MD2 +jdk.certpath.disabledAlgorithms=MD2, RSA keySize < 1024 # Algorithm restrictions for Secure Socket Layer/Transport Layer Security # (SSL/TLS) processing diff --git a/jdk/src/share/lib/security/java.security-solaris b/jdk/src/share/lib/security/java.security-solaris index cebe4e77cc1..241873676b7 100644 --- a/jdk/src/share/lib/security/java.security-solaris +++ b/jdk/src/share/lib/security/java.security-solaris @@ -373,7 +373,7 @@ krb5.kdc.bad.policy = tryLast # jdk.certpath.disabledAlgorithms=MD2, DSA, RSA keySize < 2048 # # -jdk.certpath.disabledAlgorithms=MD2 +jdk.certpath.disabledAlgorithms=MD2, RSA keySize < 1024 # Algorithm restrictions for Secure Socket Layer/Transport Layer Security # (SSL/TLS) processing diff --git a/jdk/src/share/lib/security/java.security-windows b/jdk/src/share/lib/security/java.security-windows index 737a6002f6a..62b8b51fee6 100644 --- a/jdk/src/share/lib/security/java.security-windows +++ b/jdk/src/share/lib/security/java.security-windows @@ -372,7 +372,7 @@ krb5.kdc.bad.policy = tryLast # jdk.certpath.disabledAlgorithms=MD2, DSA, RSA keySize < 2048 # # -jdk.certpath.disabledAlgorithms=MD2 +jdk.certpath.disabledAlgorithms=MD2, RSA keySize < 1024 # Algorithm restrictions for Secure Socket Layer/Transport Layer Security # (SSL/TLS) processing diff --git a/jdk/src/share/native/java/net/Inet6Address.c b/jdk/src/share/native/java/net/Inet6Address.c index 7b04c67726c..1817807d299 100644 --- a/jdk/src/share/native/java/net/Inet6Address.c +++ b/jdk/src/share/native/java/net/Inet6Address.c @@ -38,7 +38,6 @@ jfieldID ia6_scopeidID; jfieldID ia6_cachedscopeidID; jfieldID ia6_scopeidsetID; jfieldID ia6_scopeifnameID; -jfieldID ia6_scopeifnamesetID; jmethodID ia6_ctrID; /* @@ -62,8 +61,6 @@ Java_java_net_Inet6Address_init(JNIEnv *env, jclass cls) { CHECK_NULL(ia6_scopeidID); ia6_scopeifnameID = (*env)->GetFieldID(env, ia6_class, "scope_ifname", "Ljava/net/NetworkInterface;"); CHECK_NULL(ia6_scopeifnameID); - ia6_scopeifnamesetID = (*env)->GetFieldID(env, ia6_class, "scope_ifname_set", "Z"); - CHECK_NULL(ia6_scopeifnamesetID); ia6_ctrID = (*env)->GetMethodID(env, ia6_class, "", "()V"); CHECK_NULL(ia6_ctrID); } diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.5/gzlib.c b/jdk/src/share/native/java/util/zip/zlib-1.2.5/gzlib.c index d285126964b..9a3db2efe0c 100644 --- a/jdk/src/share/native/java/util/zip/zlib-1.2.5/gzlib.c +++ b/jdk/src/share/native/java/util/zip/zlib-1.2.5/gzlib.c @@ -1,4 +1,5 @@ -/* 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 * under the terms of the GNU General Public License version 2 only, as diff --git a/jdk/src/share/native/sun/java2d/cmm/lcms/LCMS.c b/jdk/src/share/native/sun/java2d/cmm/lcms/LCMS.c index 910969f95b2..7da0370baad 100644 --- a/jdk/src/share/native/sun/java2d/cmm/lcms/LCMS.c +++ b/jdk/src/share/native/sun/java2d/cmm/lcms/LCMS.c @@ -159,7 +159,8 @@ void LCMS_freeTransform(JNIEnv *env, jlong ID) */ JNIEXPORT jlong JNICALL Java_sun_java2d_cmm_lcms_LCMS_createNativeTransform (JNIEnv *env, jclass cls, jlongArray profileIDs, jint renderType, - jint inFormatter, jint outFormatter, jobject disposerRef) + jint inFormatter, jboolean isInIntPacked, + jint outFormatter, jboolean isOutIntPacked, jobject disposerRef) { cmsHPROFILE _iccArray[DF_ICC_BUF_SIZE]; cmsHPROFILE *iccArray = &_iccArray[0]; @@ -170,6 +171,16 @@ JNIEXPORT jlong JNICALL Java_sun_java2d_cmm_lcms_LCMS_createNativeTransform size = (*env)->GetArrayLength (env, profileIDs); ids = (*env)->GetPrimitiveArrayCritical(env, profileIDs, 0); +#ifdef _LITTLE_ENDIAN + /* Reversing data packed into int for LE archs */ + if (isInIntPacked) { + inFormatter ^= DOSWAP_SH(1); + } + if (isOutIntPacked) { + outFormatter ^= DOSWAP_SH(1); + } +#endif + if (DF_ICC_BUF_SIZE < size*2) { iccArray = (cmsHPROFILE*) malloc( size*2*sizeof(cmsHPROFILE)); @@ -567,7 +578,7 @@ JNIEXPORT void JNICALL Java_sun_java2d_cmm_lcms_LCMS_colorConvert (JNIEnv *env, jclass obj, jobject trans, jobject src, jobject dst) { storeID_t sTrans; - int inFmt, outFmt, srcDType, dstDType; + int srcDType, dstDType; int srcOffset, srcNextRowOffset, dstOffset, dstNextRowOffset; int width, height, i; void* inputBuffer; @@ -576,23 +587,13 @@ JNIEXPORT void JNICALL Java_sun_java2d_cmm_lcms_LCMS_colorConvert char* outputRow; jobject srcData, dstData; - inFmt = (*env)->GetIntField (env, src, IL_pixelType_fID); - outFmt = (*env)->GetIntField (env, dst, IL_pixelType_fID); srcOffset = (*env)->GetIntField (env, src, IL_offset_fID); srcNextRowOffset = (*env)->GetIntField (env, src, IL_nextRowOffset_fID); dstOffset = (*env)->GetIntField (env, dst, IL_offset_fID); dstNextRowOffset = (*env)->GetIntField (env, dst, IL_nextRowOffset_fID); width = (*env)->GetIntField (env, src, IL_width_fID); height = (*env)->GetIntField (env, src, IL_height_fID); -#ifdef _LITTLE_ENDIAN - /* Reversing data packed into int for LE archs */ - if ((*env)->GetBooleanField (env, src, IL_isIntPacked_fID) == JNI_TRUE) { - inFmt ^= DOSWAP_SH(1); - } - if ((*env)->GetBooleanField (env, dst, IL_isIntPacked_fID) == JNI_TRUE) { - outFmt ^= DOSWAP_SH(1); - } -#endif + sTrans.j = (*env)->GetLongField (env, trans, Trans_ID_fID); if (sTrans.xf == NULL) { diff --git a/jdk/src/solaris/classes/sun/awt/X11/XBaseWindow.java b/jdk/src/solaris/classes/sun/awt/X11/XBaseWindow.java index ba4ed50b961..72ca1b7aebe 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XBaseWindow.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XBaseWindow.java @@ -994,10 +994,7 @@ public class XBaseWindow { return; } int buttonState = 0; - final int buttonsNumber = ((SunToolkit)(Toolkit.getDefaultToolkit())).getNumberOfButtons(); - for (int i = 0; i buttonsNumber) { return buttonState == 0; } else { - return buttonState == XConstants.buttonsMask[button - 1]; + return buttonState == XlibUtil.getButtonMask(button); } } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XConstants.java b/jdk/src/solaris/classes/sun/awt/X11/XConstants.java index 725bf6afb1a..d72ff07273b 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XConstants.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XConstants.java @@ -130,6 +130,9 @@ final public class XConstants { public static final long ColormapChangeMask = (1L<<23) ; public static final long OwnerGrabButtonMask = (1L<<24) ; + public static final int MAX_BUTTONS = 5; + public static final int ALL_BUTTONS_MASK = (int) (Button1MotionMask | Button2MotionMask | Button3MotionMask | Button4MotionMask | Button5MotionMask); + /* Event names. Used in "type" field in XEvent structures. Not to be confused with event masks above. They start from 2 because 0 and 1 are reserved in the protocol for errors and replies. */ @@ -194,34 +197,6 @@ final public class XConstants { public static final int Mod4MapIndex = 6 ; public static final int Mod5MapIndex = 7 ; - - /* button masks. Used in same manner as Key masks above. Not to be confused - with button names below. */ - public static final int [] buttonsMask = new int []{ 1<<8, - 1<<9, - 1<<10, - 1<<11, - 1<<12, - 1<<13, - 1<<14, - 1<<15, - 1<<16, - 1<<17, - 1<<18, - 1<<19, - 1<<20, - 1<<21, - 1<<22, - 1<<23, - 1<<24, - 1<<25, - 1<<26, - 1<<27, - 1<<28, - 1<<29, - 1<<30, - 1<<31 }; - public static final int AnyModifier = (1<<15) ; /* used in GrabButton, GrabKey */ diff --git a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java index 4084ca4b24e..7c40e8260ef 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java @@ -1543,6 +1543,10 @@ public final class XToolkit extends UNIXToolkit implements Runnable { } } + static int getNumberOfButtonsForMask() { + return Math.min(XConstants.MAX_BUTTONS, ((SunToolkit) (Toolkit.getDefaultToolkit())).getNumberOfButtons()); + } + private final static String prefix = "DnD.Cursor."; private final static String postfix = ".32x32"; private static final String dndPrefix = "DnD."; diff --git a/jdk/src/solaris/classes/sun/awt/X11/XWindow.java b/jdk/src/solaris/classes/sun/awt/X11/XWindow.java index 0eebbd45c9a..e4d0ec6a68d 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XWindow.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XWindow.java @@ -596,12 +596,12 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { /* this is an attempt to refactor button IDs in : MouseEvent, InputEvent, XlibWrapper and XWindow.*/ //reflects a button number similar to MouseEvent.BUTTON1, 2, 3 etc. - for (int i = 0; i < XConstants.buttonsMask.length; i ++){ + for (int i = 0; i < XConstants.buttons.length; i ++){ //modifier should be added if : // 1) current button is now still in PRESSED state (means that user just pressed mouse but not released yet) or // 2) if Xsystem reports that "state" represents that button was just released. This only happens on RELEASE with 1,2,3 buttons. // ONLY one of these conditions should be TRUE to add that modifier. - if (((state & XConstants.buttonsMask[i]) != 0) != (button == XConstants.buttons[i])){ + if (((state & XlibUtil.getButtonMask(i + 1)) != 0) != (button == XConstants.buttons[i])){ //exclude wheel buttons from adding their numbers as modifiers if (!wheel_mouse) { modifiers |= InputEvent.getMaskForButton(i+1); @@ -689,7 +689,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { if (type == XConstants.ButtonPress) { //Allow this mouse button to generate CLICK event on next ButtonRelease - mouseButtonClickAllowed |= XConstants.buttonsMask[lbutton]; + mouseButtonClickAllowed |= XlibUtil.getButtonMask(lbutton); XWindow lastWindow = (lastWindowRef != null) ? ((XWindow)lastWindowRef.get()):(null); /* multiclick checking @@ -747,7 +747,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { postEventToEventQueue(me); if ((type == XConstants.ButtonRelease) && - ((mouseButtonClickAllowed & XConstants.buttonsMask[lbutton]) != 0) ) // No up-button in the drag-state + ((mouseButtonClickAllowed & XlibUtil.getButtonMask(lbutton)) != 0) ) // No up-button in the drag-state { postEventToEventQueue(me = new MouseEvent((Component)getEventSource(), MouseEvent.MOUSE_CLICKED, @@ -777,7 +777,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { /* Update the state variable AFTER the CLICKED event post. */ if (type == XConstants.ButtonRelease) { /* Exclude this mouse button from allowed list.*/ - mouseButtonClickAllowed &= ~XConstants.buttonsMask[lbutton]; + mouseButtonClickAllowed &= ~ XlibUtil.getButtonMask(lbutton); } } @@ -793,12 +793,12 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { //this doesn't work for extra buttons because Xsystem is sending state==0 for every extra button event. // we can't correct it in MouseEvent class as we done it with modifiers, because exact type (DRAG|MOVE) // should be passed from XWindow. - final int buttonsNumber = ((SunToolkit)(Toolkit.getDefaultToolkit())).getNumberOfButtons(); + final int buttonsNumber = XToolkit.getNumberOfButtonsForMask(); for (int i = 0; i < buttonsNumber; i++){ // TODO : here is the bug in WM: extra buttons doesn't have state!=0 as they should. if ((i != 4) && (i != 5)) { - mouseKeyState = mouseKeyState | (xme.get_state() & XConstants.buttonsMask[i]); + mouseKeyState = mouseKeyState | (xme.get_state() & XlibUtil.getButtonMask(i + 1)); } } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java index a6af2e776d2..4d867175597 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java @@ -2070,12 +2070,12 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, } if (isGrabbed()) { boolean dragging = false; - final int buttonsNumber = ((SunToolkit)(Toolkit.getDefaultToolkit())).getNumberOfButtons(); + final int buttonsNumber = XToolkit.getNumberOfButtonsForMask(); for (int i = 0; i < buttonsNumber; i++){ // here is the bug in WM: extra buttons doesn't have state!=0 as they should. if ((i != 4) && (i != 5)){ - dragging = dragging || ((xme.get_state() & XConstants.buttonsMask[i]) != 0); + dragging = dragging || ((xme.get_state() & XlibUtil.getButtonMask(i + 1)) != 0); } } // When window is grabbed, all events are dispatched to diff --git a/jdk/src/solaris/classes/sun/awt/X11/XlibUtil.java b/jdk/src/solaris/classes/sun/awt/X11/XlibUtil.java index b5cc9739a58..875ab16f642 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XlibUtil.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XlibUtil.java @@ -396,4 +396,14 @@ public class XlibUtil return isShapingSupported.booleanValue(); } + static int getButtonMask(int button) { + // Button indices start with 1. The first bit in the button mask is the 8th. + // The state mask does not support button indicies > 5, so we need to + // cut there. + if (button <= 0 || button > XConstants.MAX_BUTTONS) { + return 0; + } else { + return 1 << (7 + button); + } + } } diff --git a/jdk/src/solaris/classes/sun/print/UnixPrintJob.java b/jdk/src/solaris/classes/sun/print/UnixPrintJob.java index 620cf1cdd44..8c797ceb62d 100644 --- a/jdk/src/solaris/classes/sun/print/UnixPrintJob.java +++ b/jdk/src/solaris/classes/sun/print/UnixPrintJob.java @@ -939,7 +939,7 @@ public class UnixPrintJob implements CancelablePrintJob { * is not removed for some reason, request that it is * removed when the VM exits. */ - spoolFile = Files.createTempFile("javaprint", ".ps").toFile(); + spoolFile = Files.createTempFile("javaprint", "").toFile(); spoolFile.deleteOnExit(); } result = new FileOutputStream(spoolFile); diff --git a/jdk/src/solaris/native/common/jdk_util_md.h b/jdk/src/solaris/native/common/jdk_util_md.h index 6361fe01eba..b2472b3db7e 100644 --- a/jdk/src/solaris/native/common/jdk_util_md.h +++ b/jdk/src/solaris/native/common/jdk_util_md.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/src/solaris/native/sun/tools/attach/BsdVirtualMachine.c b/jdk/src/solaris/native/sun/tools/attach/BsdVirtualMachine.c index 9d46ad3fbbd..cf3ff20300f 100644 --- a/jdk/src/solaris/native/sun/tools/attach/BsdVirtualMachine.c +++ b/jdk/src/solaris/native/sun/tools/attach/BsdVirtualMachine.c @@ -1,12 +1,12 @@ /* - * Copyright 2005, 2012, Oracle and/or its affiliates. All Rights Reserved. + * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this + * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. + * 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 @@ -18,9 +18,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ #include "jni.h" diff --git a/jdk/src/windows/classes/java/net/DualStackPlainDatagramSocketImpl.java b/jdk/src/windows/classes/java/net/DualStackPlainDatagramSocketImpl.java index 57a12a8885a..089278b66c7 100644 --- a/jdk/src/windows/classes/java/net/DualStackPlainDatagramSocketImpl.java +++ b/jdk/src/windows/classes/java/net/DualStackPlainDatagramSocketImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007,2011 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/src/windows/classes/sun/nio/fs/WindowsFileAttributes.java b/jdk/src/windows/classes/sun/nio/fs/WindowsFileAttributes.java index dffa4f06e8d..208435dc97e 100644 --- a/jdk/src/windows/classes/sun/nio/fs/WindowsFileAttributes.java +++ b/jdk/src/windows/classes/sun/nio/fs/WindowsFileAttributes.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -383,20 +383,14 @@ class WindowsFileAttributes } int volSerialNumber() { - if (volSerialNumber == 0) - throw new AssertionError("Should not get here"); return volSerialNumber; } int fileIndexHigh() { - if (volSerialNumber == 0) - throw new AssertionError("Should not get here"); return fileIndexHigh; } int fileIndexLow() { - if (volSerialNumber == 0) - throw new AssertionError("Should not get here"); return fileIndexLow; } diff --git a/jdk/src/windows/native/common/jdk_util_md.h b/jdk/src/windows/native/common/jdk_util_md.h index 0bb9149354f..67c45a286cd 100644 --- a/jdk/src/windows/native/common/jdk_util_md.h +++ b/jdk/src/windows/native/common/jdk_util_md.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/src/windows/native/java/net/NetworkInterface.c b/jdk/src/windows/native/java/net/NetworkInterface.c index b0f9344db4a..6d144659235 100644 --- a/jdk/src/windows/native/java/net/NetworkInterface.c +++ b/jdk/src/windows/native/java/net/NetworkInterface.c @@ -178,7 +178,7 @@ int enumInterfaces(JNIEnv *env, netif **netifPP) int count; netif *netifP; DWORD i; - int lo=0, eth=0, tr=0, fddi=0, ppp=0, sl=0, wlan=0, net=0; + int lo=0, eth=0, tr=0, fddi=0, ppp=0, sl=0, wlan=0, net=0, wlen=0; /* * Ask the IP Helper library to enumerate the adapters @@ -260,8 +260,17 @@ int enumInterfaces(JNIEnv *env, netif **netifPP) */ curr = (netif *)calloc(1, sizeof(netif)); if (curr != NULL) { + wlen = MultiByteToWideChar(CP_OEMCP, 0, ifrowP->bDescr, + ifrowP->dwDescrLen, NULL, 0); + if(wlen == 0) { + // MultiByteToWideChar should not fail + // But in rare case it fails, we allow 'char' to be displayed + curr->displayName = (char *)malloc(ifrowP->dwDescrLen + 1); + } else { + curr->displayName = (wchar_t *)malloc(wlen*(sizeof(wchar_t))+1); + } + curr->name = (char *)malloc(strlen(dev_name) + 1); - curr->displayName = (char *)malloc(ifrowP->dwDescrLen + 1); if (curr->name == NULL || curr->displayName == NULL) { if (curr->name) free(curr->name); @@ -282,8 +291,29 @@ int enumInterfaces(JNIEnv *env, netif **netifPP) * 32-bit numbers as index values. */ strcpy(curr->name, dev_name); - strncpy(curr->displayName, ifrowP->bDescr, ifrowP->dwDescrLen); - curr->displayName[ifrowP->dwDescrLen] = '\0'; + if (wlen == 0) { + // display char type in case of MultiByteToWideChar failure + strncpy(curr->displayName, ifrowP->bDescr, ifrowP->dwDescrLen); + curr->displayName[ifrowP->dwDescrLen] = '\0'; + } else { + // call MultiByteToWideChar again to fill curr->displayName + // it should not fail, because we have called it once before + if (MultiByteToWideChar(CP_OEMCP, 0, ifrowP->bDescr, + ifrowP->dwDescrLen, curr->displayName, wlen) == 0) { + JNU_ThrowByName(env, "java/lang/Error", + "Cannot get multibyte char for interface display name"); + free_netif(netifP); + free(tableP); + free(curr->name); + free(curr->displayName); + free(curr); + return -1; + } else { + curr->displayName[wlen*(sizeof(wchar_t))] = '\0'; + curr->dNameIsUnicode = TRUE; + } + } + curr->dwIndex = ifrowP->dwIndex; curr->ifType = ifrowP->dwType; curr->index = GetFriendlyIfIndex(ifrowP->dwIndex); diff --git a/jdk/src/windows/native/sun/windows/awt_Debug.cpp b/jdk/src/windows/native/sun/windows/awt_Debug.cpp index 4be1b5d9165..8d4911dfaff 100644 --- a/jdk/src/windows/native/sun/windows/awt_Debug.cpp +++ b/jdk/src/windows/native/sun/windows/awt_Debug.cpp @@ -147,6 +147,24 @@ AwtDebugSupport::~AwtDebugSupport() { DTrace_Shutdown(); } +static jboolean isHeadless() { + jmethodID headlessFn; + JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); + jclass graphicsEnvClass = env->FindClass( + "java/awt/GraphicsEnvironment"); + + if (graphicsEnvClass != NULL) { + headlessFn = env->GetStaticMethodID( + graphicsEnvClass, "isHeadless", "()Z"); + if (headlessFn != NULL) { + return env->CallStaticBooleanMethod(graphicsEnvClass, + headlessFn); + } + } + return true; +} + + void AwtDebugSupport::AssertCallback(const char * expr, const char * file, int line) { static const int ASSERT_MSG_SIZE = 1024; static const char * AssertFmt = @@ -158,7 +176,8 @@ void AwtDebugSupport::AssertCallback(const char * expr, const char * file, int l static char assertMsg[ASSERT_MSG_SIZE+1]; DWORD lastError = GetLastError(); LPSTR msgBuffer = NULL; - int ret; + int ret = IDNO; + static jboolean headless = isHeadless(); FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | @@ -183,8 +202,11 @@ void AwtDebugSupport::AssertCallback(const char * expr, const char * file, int l fprintf(stderr, "*********************\n"); fprintf(stderr, "%s\n", assertMsg); fprintf(stderr, "*********************\n"); - ret = MessageBoxA(NULL, assertMsg, "AWT Assertion Failure", - MB_YESNO|MB_ICONSTOP|MB_TASKMODAL); + + if (!headless) { + ret = MessageBoxA(NULL, assertMsg, "AWT Assertion Failure", + MB_YESNO|MB_ICONSTOP|MB_TASKMODAL); + } // if clicked Yes, break into the debugger if ( ret == IDYES ) { diff --git a/jdk/test/Makefile b/jdk/test/Makefile index e42481fae39..871cc54dc2c 100644 --- a/jdk/test/Makefile +++ b/jdk/test/Makefile @@ -505,7 +505,7 @@ jdk_other: $(call TestDirs, \ demo/jvmti demo/zipfs sample \ javax/naming com/sun/jndi \ javax/script \ - javax/sql \ + java/sql javax/sql \ javax/smartcardio \ javax/xml/ws com/sun/internal/ws \ jdk/asm \ diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt index 2552ba0f017..ec698c7ef5d 100644 --- a/jdk/test/ProblemList.txt +++ b/jdk/test/ProblemList.txt @@ -141,9 +141,6 @@ java/lang/management/MemoryMXBean/LowMemoryTest2.sh generic-all # jdk_management -# 7158614 -sun/management/jmxremote/startstop/JMXStartStopTest.sh linux-all - ############################################################################ # jdk_jmx @@ -151,9 +148,6 @@ sun/management/jmxremote/startstop/JMXStartStopTest.sh linux-all # 6959636 javax/management/loading/LibraryLoader/LibraryLoaderTest.java windows-all -# 7120365 -javax/management/remote/mandatory/notif/DiffHBTest.java generic-all - ############################################################################ # jdk_math @@ -263,10 +257,6 @@ sun/rmi/transport/proxy/EagerHttpFallback.java generic-all # 7164518: no PortUnreachableException on Mac sun/security/krb5/auto/Unreachable.java macosx-all -# 7193792 -sun/security/pkcs11/ec/TestECDSA.java solaris-all -sun/security/pkcs11/ec/TestECDSA.java linux-all - # 7193793 sun/security/pkcs11/ec/TestECDH.java linux-all @@ -363,9 +353,6 @@ java/util/concurrent/ThreadPoolExecutor/CoreThreadTimeOut.java generic-all # Filed 6772009 java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java generic-all -# 8003596 -java/util/logging/CheckLockLocationTest.java windows-all - # 7041639, Solaris DSA keypair generation bug java/util/TimeZone/TimeZoneDatePermissionCheck.sh solaris-all diff --git a/jdk/test/com/oracle/net/sanity.sh b/jdk/test/com/oracle/net/sanity.sh index b54d866b4fa..e2c89cc507b 100644 --- a/jdk/test/com/oracle/net/sanity.sh +++ b/jdk/test/com/oracle/net/sanity.sh @@ -63,4 +63,4 @@ CLASSPATH=${TESTCLASSES}:${TESTSRC} export CLASSPATH # Run sanity test (IPv4-only for now) -$JAVA -Djava.net.preferIPv4Stack=true Sanity ${IB_LINKS} +$JAVA ${TESTVMOPTS} -Djava.net.preferIPv4Stack=true Sanity ${IB_LINKS} diff --git a/jdk/test/com/sun/corba/cachedSocket/7056731.sh b/jdk/test/com/sun/corba/cachedSocket/7056731.sh index afb2278d328..5244b9a70a5 100644 --- a/jdk/test/com/sun/corba/cachedSocket/7056731.sh +++ b/jdk/test/com/sun/corba/cachedSocket/7056731.sh @@ -64,12 +64,12 @@ ORB_PROC=$! sleep 2 #give orbd time to start echo "started orb" echo "starting server" -${TESTJAVA}${FS}bin${FS}java -cp . HelloServer -ORBInitialPort $PORT -ORBInitialHost localhost & +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -cp . HelloServer -ORBInitialPort $PORT -ORBInitialHost localhost & SERVER_PROC=$! sleep 2 #give server time to start echo "started server" echo "starting client (debug mode)" -${TESTJAVA}${FS}bin${FS}java -cp . -agentlib:jdwp=transport=dt_socket,server=y,address=8000 HelloClient -ORBInitialPort $PORT -ORBInitialHost localhost > client.$$ 2>&1 & +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -cp . -agentlib:jdwp=transport=dt_socket,server=y,address=8000 HelloClient -ORBInitialPort $PORT -ORBInitialHost localhost > client.$$ 2>&1 & JVM_PROC=$! sleep 2 #give jvm/debugger/client time to start diff --git a/jdk/test/com/sun/java/swing/plaf/windows/WindowsRadioButtonUI/7089914/bug7089914.java b/jdk/test/com/sun/java/swing/plaf/windows/WindowsRadioButtonUI/7089914/bug7089914.java index 3354f286fd2..c3f013c2989 100644 --- a/jdk/test/com/sun/java/swing/plaf/windows/WindowsRadioButtonUI/7089914/bug7089914.java +++ b/jdk/test/com/sun/java/swing/plaf/windows/WindowsRadioButtonUI/7089914/bug7089914.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/com/sun/jmx/remote/CCAdminReconnectTest.java b/jdk/test/com/sun/jmx/remote/CCAdminReconnectTest.java new file mode 100644 index 00000000000..a0ce27f0bf2 --- /dev/null +++ b/jdk/test/com/sun/jmx/remote/CCAdminReconnectTest.java @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7009998 + * @summary Tests the correct processing of concurrent ClientComunicatorAdmin reconnect requests. + * @author Jaroslav Bachorik + * @run clean CCAdminReconnectTest + * @run build CCAdminReconnectTest + * @run main CCAdminReconnectTest + */ + +import com.sun.jmx.remote.internal.ClientCommunicatorAdmin; +import java.io.*; +import java.util.Collection; +import java.util.LinkedList; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; + +public class CCAdminReconnectTest { + final private static int THREAD_COUNT = 3; + + public static void main(String ... args) throws Exception { + final ExecutorService e = Executors.newFixedThreadPool(THREAD_COUNT); + final AtomicBoolean beingReconnected = new AtomicBoolean(); + final Collection thrownExceptions = new LinkedList<>(); + + System.out.println(": Testing concurrent restart of ClientCommunicatorAdmin"); + + final ClientCommunicatorAdmin cca = new ClientCommunicatorAdmin(50) { + + @Override + protected void checkConnection() throws IOException { + // empty + } + + @Override + protected void doStart() throws IOException { + if (!beingReconnected.compareAndSet(false, true)) { + IOException e = new IOException("Detected overlayed reconnect requests"); + thrownExceptions.add(e); + throw e; + } + try { + Thread.sleep(800); // simulating a workload + beingReconnected.set(false); + } catch (InterruptedException e) { + } + } + + @Override + protected void doStop() { + // empty + } + }; + + Runnable r = new Runnable() { + final private IOException e = new IOException("Forced reconnect"); + @Override + public void run() { + try { + // forcing the reconnect request + cca.gotIOException(e); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + }; + + System.out.println(": Spawning " + THREAD_COUNT + " concurrent reconnect requests"); + + for(int i=0;i + */ +public class TestNotification extends Notification { + private ConfigKey key; + + public TestNotification(String type, Object source, long sequenceNumber) { + super(type, source, sequenceNumber); + key = ConfigKey.CONSTANT3; + } + + @Override + public String toString() { + return "TestNotification{" + "key=" + key + '}'; + } +} diff --git a/jdk/test/com/sun/jmx/remote/NotificationMarshalVersions/Server/ConfigKey.java b/jdk/test/com/sun/jmx/remote/NotificationMarshalVersions/Server/ConfigKey.java new file mode 100644 index 00000000000..c79fafbba4b --- /dev/null +++ b/jdk/test/com/sun/jmx/remote/NotificationMarshalVersions/Server/ConfigKey.java @@ -0,0 +1,3 @@ +public enum ConfigKey { + CONSTANT1, CONSTANT2; +} \ No newline at end of file diff --git a/jdk/test/com/sun/jmx/remote/NotificationMarshalVersions/Server/Server.java b/jdk/test/com/sun/jmx/remote/NotificationMarshalVersions/Server/Server.java new file mode 100644 index 00000000000..5500bfb4dcb --- /dev/null +++ b/jdk/test/com/sun/jmx/remote/NotificationMarshalVersions/Server/Server.java @@ -0,0 +1,46 @@ +import java.lang.management.ManagementFactory; +import java.net.BindException; +import java.nio.charset.Charset; +import java.nio.file.FileSystem; +import java.nio.file.FileSystems; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.StandardOpenOption; +import java.rmi.registry.LocateRegistry; +import java.rmi.server.ExportException; +import java.util.Random; +import javax.management.MBeanServer; +import javax.management.ObjectName; +import javax.management.remote.JMXConnectorServer; +import javax.management.remote.JMXConnectorServerFactory; +import javax.management.remote.JMXServiceURL; + +public class Server { + public static void main(String[] argv) throws Exception { + int serverPort = 12345; + ObjectName name = new ObjectName("test", "foo", "bar"); + MBeanServer jmxServer = ManagementFactory.getPlatformMBeanServer(); + SteMBean bean = new Ste(); + jmxServer.registerMBean(bean, name); + boolean exported = false; + Random rnd = new Random(System.currentTimeMillis()); + do { + try { + LocateRegistry.createRegistry(serverPort); + exported = true; + } catch (ExportException ee) { + if (ee.getCause() instanceof BindException) { + serverPort = rnd.nextInt(10000) + 4096; + } else { + throw ee; + } + } + + } while (!exported); + JMXServiceURL serverUrl = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:" + serverPort + "/test"); + JMXConnectorServer jmxConnector = JMXConnectorServerFactory.newJMXConnectorServer(serverUrl, null, jmxServer); + jmxConnector.start(); + System.out.println(serverUrl); + System.err.println("server listening on " + serverUrl); + } +} diff --git a/jdk/test/com/sun/jmx/remote/NotificationMarshalVersions/Server/Ste.java b/jdk/test/com/sun/jmx/remote/NotificationMarshalVersions/Server/Ste.java new file mode 100644 index 00000000000..91ecd00ae50 --- /dev/null +++ b/jdk/test/com/sun/jmx/remote/NotificationMarshalVersions/Server/Ste.java @@ -0,0 +1,10 @@ + +import javax.management.NotificationBroadcasterSupport; + +public class Ste extends NotificationBroadcasterSupport implements SteMBean { + private long count = 0; + + public void foo() { + sendNotification(new TestNotification("test", this, count++)); + } +} \ No newline at end of file diff --git a/jdk/test/com/sun/jmx/remote/NotificationMarshalVersions/Server/SteMBean.java b/jdk/test/com/sun/jmx/remote/NotificationMarshalVersions/Server/SteMBean.java new file mode 100644 index 00000000000..b106bc11da7 --- /dev/null +++ b/jdk/test/com/sun/jmx/remote/NotificationMarshalVersions/Server/SteMBean.java @@ -0,0 +1,3 @@ +public interface SteMBean { + public void foo(); +} \ No newline at end of file diff --git a/jdk/test/com/sun/jmx/remote/NotificationMarshalVersions/Server/TestNotification.java b/jdk/test/com/sun/jmx/remote/NotificationMarshalVersions/Server/TestNotification.java new file mode 100644 index 00000000000..6ffdb7f4421 --- /dev/null +++ b/jdk/test/com/sun/jmx/remote/NotificationMarshalVersions/Server/TestNotification.java @@ -0,0 +1,25 @@ + +import javax.management.Notification; + +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +/** + * + * @author Jaroslav Bachorik + */ +public class TestNotification extends Notification { + private ConfigKey key; + + public TestNotification(String type, Object source, long sequenceNumber) { + super(type, source, sequenceNumber); + key = ConfigKey.CONSTANT1; + } + + @Override + public String toString() { + return "TestNotification{" + "key=" + key + '}'; + } +} diff --git a/jdk/test/com/sun/jmx/remote/NotificationMarshalVersions/TestSerializationMismatch.sh b/jdk/test/com/sun/jmx/remote/NotificationMarshalVersions/TestSerializationMismatch.sh new file mode 100644 index 00000000000..1e69d979ed0 --- /dev/null +++ b/jdk/test/com/sun/jmx/remote/NotificationMarshalVersions/TestSerializationMismatch.sh @@ -0,0 +1,93 @@ +# +# Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# +# @test +# @summary Tests for the RMI unmarshalling errors not to cause silent failure. +# @author Jaroslav Bachorik +# @bug 6937053 +# +# @run shell TestSerializationMismatch.sh +# + +#set -x + +#Set appropriate jdk +# + +if [ ! -z "${TESTJAVA}" ] ; then + jdk="$TESTJAVA" +else + echo "--Error: TESTJAVA must be defined as the pathname of a jdk to test." + exit 1 +fi + +SERVER_TESTCLASSES=$TESTCLASSES/Server +CLIENT_TESTCLASSES=$TESTCLASSES/Client + +URL_PATH=$SERVER_TESTCLASSES/jmxurl + +rm $URL_PATH + +mkdir -p $SERVER_TESTCLASSES +mkdir -p $CLIENT_TESTCLASSES + +$TESTJAVA/bin/javac -d $CLIENT_TESTCLASSES $TESTSRC/Client/ConfigKey.java $TESTSRC/Client/TestNotification.java $TESTSRC/Client/Client.java +$TESTJAVA/bin/javac -d $SERVER_TESTCLASSES $TESTSRC/Server/ConfigKey.java $TESTSRC/Server/TestNotification.java $TESTSRC/Server/SteMBean.java $TESTSRC/Server/Ste.java $TESTSRC/Server/Server.java + +startServer() +{ + ($TESTJAVA/bin/java -classpath $SERVER_TESTCLASSES Server) 1>$URL_PATH & + SERVER_PID=$! +} + +runClient() +{ + while true + do + [ -f $URL_PATH ] && break + sleep 2 + done + read JMXURL < $URL_PATH + + HAS_ERRORS=`($TESTJAVA/bin/java -classpath $CLIENT_TESTCLASSES Client $JMXURL) 2>&1 | grep -i "SEVERE: Failed to fetch notification, stopping thread. Error is: java.rmi.UnmarshalException"` +} + +startServer + +runClient + +sleep 1 # wait for notifications to arrive + +kill "$SERVER_PID" + +if [ -z "$HAS_ERRORS" ] +then + echo "Test PASSED" + exit 0 +fi + +echo "Test FAILED" +echo $HAS_ERRORS 1>&2 +exit 1 + diff --git a/jdk/test/com/sun/management/OperatingSystemMXBean/TestTotalSwap.sh b/jdk/test/com/sun/management/OperatingSystemMXBean/TestTotalSwap.sh index 15faf704085..a4f3726a643 100644 --- a/jdk/test/com/sun/management/OperatingSystemMXBean/TestTotalSwap.sh +++ b/jdk/test/com/sun/management/OperatingSystemMXBean/TestTotalSwap.sh @@ -59,7 +59,7 @@ fi runOne() { echo "runOne $@" - $TESTJAVA/bin/java -classpath $TESTCLASSES $@ || exit 3 + $TESTJAVA/bin/java ${TESTVMOPTS} -classpath $TESTCLASSES $@ || exit 3 } solaris_swap_size() diff --git a/jdk/test/com/sun/management/UnixOperatingSystemMXBean/GetMaxFileDescriptorCount.sh b/jdk/test/com/sun/management/UnixOperatingSystemMXBean/GetMaxFileDescriptorCount.sh index e4e163eddc8..47110c0e752 100644 --- a/jdk/test/com/sun/management/UnixOperatingSystemMXBean/GetMaxFileDescriptorCount.sh +++ b/jdk/test/com/sun/management/UnixOperatingSystemMXBean/GetMaxFileDescriptorCount.sh @@ -43,7 +43,7 @@ runOne() { echo "runOne $@" $TESTJAVA/bin/javac -d $TESTCLASSES $TESTSRC/$@.java || exit 2 - $TESTJAVA/bin/java -classpath $TESTCLASSES $@ || exit 3 + $TESTJAVA/bin/java ${TESTVMOPTS} -classpath $TESTCLASSES $@ || exit 3 } # Test GetMaxFileDescriptorCount if we are running on Unix diff --git a/jdk/test/com/sun/management/UnixOperatingSystemMXBean/GetOpenFileDescriptorCount.sh b/jdk/test/com/sun/management/UnixOperatingSystemMXBean/GetOpenFileDescriptorCount.sh index 7cf6ae28299..bc3ef465fc3 100644 --- a/jdk/test/com/sun/management/UnixOperatingSystemMXBean/GetOpenFileDescriptorCount.sh +++ b/jdk/test/com/sun/management/UnixOperatingSystemMXBean/GetOpenFileDescriptorCount.sh @@ -43,7 +43,7 @@ runOne() { echo "runOne $@" $TESTJAVA/bin/javac -d $TESTCLASSES $TESTSRC/$@.java || exit 2 - $TESTJAVA/bin/java -classpath $TESTCLASSES $@ || exit 3 + $TESTJAVA/bin/java ${TESTVMOPTS} -classpath $TESTCLASSES $@ || exit 3 } # Test GetOpenFileDescriptorCount if we are running on Unix diff --git a/jdk/test/com/sun/tools/attach/ApplicationSetup.sh b/jdk/test/com/sun/tools/attach/ApplicationSetup.sh index 0537cb6e401..e8296df6300 100644 --- a/jdk/test/com/sun/tools/attach/ApplicationSetup.sh +++ b/jdk/test/com/sun/tools/attach/ApplicationSetup.sh @@ -41,7 +41,7 @@ rm -f ${OUTPUTFILE} startApplication() { # put all output from the app into ${OUTPUTFILE} - ${JAVA} $1 $2 $3 -jar "${TESTCLASSES}"/Application.jar > ${OUTPUTFILE} 2>&1 & + ${JAVA} ${TESTVMOPTS} $1 $2 $3 -jar "${TESTCLASSES}"/Application.jar > ${OUTPUTFILE} 2>&1 & pid="$!" # MKS creates an intermediate shell to launch ${JAVA} so @@ -78,6 +78,6 @@ startApplication() stopApplication() { - $JAVA -classpath "${TESTCLASSES}" Shutdown $1 + $JAVA ${TESTVMOPTS} -classpath "${TESTCLASSES}" Shutdown $1 } diff --git a/jdk/test/com/sun/tools/attach/BasicTests.sh b/jdk/test/com/sun/tools/attach/BasicTests.sh index b63d7528ff9..fc5a7fb245f 100644 --- a/jdk/test/com/sun/tools/attach/BasicTests.sh +++ b/jdk/test/com/sun/tools/attach/BasicTests.sh @@ -61,7 +61,7 @@ failures=0 echo "Running tests ..." -$JAVA -classpath "${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar" \ +$JAVA ${TESTVMOPTS} -classpath "${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar" \ BasicTests $pid $agent $badagent $redefineagent 2>&1 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi diff --git a/jdk/test/com/sun/tools/attach/PermissionTests.sh b/jdk/test/com/sun/tools/attach/PermissionTests.sh index 22828dcccea..d1cfb3cccaa 100644 --- a/jdk/test/com/sun/tools/attach/PermissionTests.sh +++ b/jdk/test/com/sun/tools/attach/PermissionTests.sh @@ -48,7 +48,7 @@ startApplication echo "Deny test" # deny -$JAVA -classpath "${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar" \ +$JAVA ${TESTVMOPTS} -classpath "${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar" \ -Djava.security.manager \ -Djava.security.policy=${TESTSRC}/java.policy.deny \ PermissionTest $pid true 2>&1 @@ -56,7 +56,7 @@ if [ $? != 0 ]; then failures=`expr $failures + 1`; fi # allow echo "Allow test" -$JAVA -classpath "${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar" \ +$JAVA ${TESTVMOPTS} -classpath "${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar" \ -Djava.security.manager \ -Djava.security.policy=${TESTSRC}/java.policy.allow \ PermissionTest $pid false 2>&1 diff --git a/jdk/test/com/sun/tools/attach/ProviderTests.sh b/jdk/test/com/sun/tools/attach/ProviderTests.sh index 2f9297f7831..f5d6411931f 100644 --- a/jdk/test/com/sun/tools/attach/ProviderTests.sh +++ b/jdk/test/com/sun/tools/attach/ProviderTests.sh @@ -45,7 +45,7 @@ $JAR -cf ${TESTCLASSES}/SimpleProvider.jar \ echo "Running test ..." -$JAVA -classpath \ +$JAVA ${TESTVMOPTS} -classpath \ "${TESTCLASSES}${PS}${TESTCLASSES}/SimpleProvider.jar${PS}${TESTJAVA}/lib/tools.jar" \ ProviderTest diff --git a/jdk/test/com/sun/tools/extcheck/TestExtcheckArgs.sh b/jdk/test/com/sun/tools/extcheck/TestExtcheckArgs.sh index d9bc0f5afa8..5adbcfc1326 100644 --- a/jdk/test/com/sun/tools/extcheck/TestExtcheckArgs.sh +++ b/jdk/test/com/sun/tools/extcheck/TestExtcheckArgs.sh @@ -39,7 +39,7 @@ if [ $rc != 0 ]; then exit $rc fi -${TESTJAVA}/bin/java -classpath ${TESTJAVA}/lib/tools.jar${PS}${TESTCLASSES} TestExtcheckArgs +${TESTJAVA}/bin/java ${TESTVMOPTS} -classpath ${TESTJAVA}/lib/tools.jar${PS}${TESTCLASSES} TestExtcheckArgs rc=$? if [ $rc != 0 ]; then echo Execution failure with exit status $rc diff --git a/jdk/test/demo/zipfs/basic.sh b/jdk/test/demo/zipfs/basic.sh index b222f87bd2e..40583d10042 100644 --- a/jdk/test/demo/zipfs/basic.sh +++ b/jdk/test/demo/zipfs/basic.sh @@ -53,7 +53,7 @@ failures=0 go() { echo "" - ${TESTJAVA}/bin/java $1 $2 $3 2>&1 + ${TESTJAVA}/bin/java ${TESTVMOPTS} $1 $2 $3 2>&1 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi } diff --git a/jdk/test/java/awt/Focus/6981400/Test1.java b/jdk/test/java/awt/Focus/6981400/Test1.java index 2be6e978883..67020639742 100644 --- a/jdk/test/java/awt/Focus/6981400/Test1.java +++ b/jdk/test/java/awt/Focus/6981400/Test1.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/awt/Focus/6981400/Test2.java b/jdk/test/java/awt/Focus/6981400/Test2.java index c41fbbd6b82..fc14db23370 100644 --- a/jdk/test/java/awt/Focus/6981400/Test2.java +++ b/jdk/test/java/awt/Focus/6981400/Test2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/awt/Focus/6981400/Test3.java b/jdk/test/java/awt/Focus/6981400/Test3.java index 268cbdf4dd6..a4a37b16be7 100644 --- a/jdk/test/java/awt/Focus/6981400/Test3.java +++ b/jdk/test/java/awt/Focus/6981400/Test3.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/awt/Frame/ResizeAfterSetFont/ResizeAfterSetFont.java b/jdk/test/java/awt/Frame/ResizeAfterSetFont/ResizeAfterSetFont.java index 32ed472aa40..56a931861ca 100644 --- a/jdk/test/java/awt/Frame/ResizeAfterSetFont/ResizeAfterSetFont.java +++ b/jdk/test/java/awt/Frame/ResizeAfterSetFont/ResizeAfterSetFont.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/awt/JAWT/JAWT.sh b/jdk/test/java/awt/JAWT/JAWT.sh index 607ab2fb6de..70ff02b8fe9 100644 --- a/jdk/test/java/awt/JAWT/JAWT.sh +++ b/jdk/test/java/awt/JAWT/JAWT.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/awt/JAWT/Makefile.cygwin b/jdk/test/java/awt/JAWT/Makefile.cygwin index 82cecfe2940..326d58179fb 100644 --- a/jdk/test/java/awt/JAWT/Makefile.cygwin +++ b/jdk/test/java/awt/JAWT/Makefile.cygwin @@ -1,4 +1,4 @@ -# Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/awt/JAWT/Makefile.unix b/jdk/test/java/awt/JAWT/Makefile.unix index b0dc136fc78..2b3f47cb60f 100644 --- a/jdk/test/java/awt/JAWT/Makefile.unix +++ b/jdk/test/java/awt/JAWT/Makefile.unix @@ -1,4 +1,4 @@ -# Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/awt/JAWT/Makefile.win b/jdk/test/java/awt/JAWT/Makefile.win index 82a0b0e8a9a..327fb250183 100644 --- a/jdk/test/java/awt/JAWT/Makefile.win +++ b/jdk/test/java/awt/JAWT/Makefile.win @@ -1,4 +1,4 @@ -# Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/awt/JAWT/MyCanvas.java b/jdk/test/java/awt/JAWT/MyCanvas.java index 359ade43999..4bf0741cb94 100644 --- a/jdk/test/java/awt/JAWT/MyCanvas.java +++ b/jdk/test/java/awt/JAWT/MyCanvas.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/awt/JAWT/myfile.c b/jdk/test/java/awt/JAWT/myfile.c index b6ef750d9c1..1a1028965b1 100644 --- a/jdk/test/java/awt/JAWT/myfile.c +++ b/jdk/test/java/awt/JAWT/myfile.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/awt/JAWT/myfile.cpp b/jdk/test/java/awt/JAWT/myfile.cpp index f5c3007ebcc..fc5b278abb4 100644 --- a/jdk/test/java/awt/JAWT/myfile.cpp +++ b/jdk/test/java/awt/JAWT/myfile.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/awt/TextArea/DisposeTest/TestDispose.java b/jdk/test/java/awt/TextArea/DisposeTest/TestDispose.java index eaa912db93a..91c795fbfee 100644 --- a/jdk/test/java/awt/TextArea/DisposeTest/TestDispose.java +++ b/jdk/test/java/awt/TextArea/DisposeTest/TestDispose.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/awt/TextArea/TextAreaCaretVisibilityTest/bug7129742.java b/jdk/test/java/awt/TextArea/TextAreaCaretVisibilityTest/bug7129742.java index 188cd3fde86..d3de4954591 100644 --- a/jdk/test/java/awt/TextArea/TextAreaCaretVisibilityTest/bug7129742.java +++ b/jdk/test/java/awt/TextArea/TextAreaCaretVisibilityTest/bug7129742.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/awt/TextField/DisposeTest/TestDispose.java b/jdk/test/java/awt/TextField/DisposeTest/TestDispose.java index a8a2fdaa9d7..6ef00cd215d 100644 --- a/jdk/test/java/awt/TextField/DisposeTest/TestDispose.java +++ b/jdk/test/java/awt/TextField/DisposeTest/TestDispose.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/beans/Introspector/Test8005065.java b/jdk/test/java/beans/Introspector/Test8005065.java new file mode 100644 index 00000000000..b9a7689945b --- /dev/null +++ b/jdk/test/java/beans/Introspector/Test8005065.java @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8005065 + * @summary Tests that all arrays in JavaBeans are guarded + * @author Sergey Malenkov + */ + +import java.beans.DefaultPersistenceDelegate; +import java.beans.Encoder; +import java.beans.EventSetDescriptor; +import java.beans.ExceptionListener; +import java.beans.Expression; +import java.beans.Statement; +import java.beans.MethodDescriptor; +import java.beans.ParameterDescriptor; + +public class Test8005065 { + + public static void main(String[] args) { + testDefaultPersistenceDelegate(); + testEventSetDescriptor(); + testMethodDescriptor(); + testStatement(); + } + + private static void testDefaultPersistenceDelegate() { + Encoder encoder = new Encoder(); + String[] array = { "array" }; + MyDPD dpd = new MyDPD(array); + dpd.instantiate(dpd, encoder); + array[0] = null; + dpd.instantiate(dpd, encoder); + } + + private static void testEventSetDescriptor() { + try { + MethodDescriptor[] array = { new MethodDescriptor(MyDPD.class.getMethod("getArray")) }; + EventSetDescriptor descriptor = new EventSetDescriptor(null, null, array, null, null); + test(descriptor.getListenerMethodDescriptors()); + array[0] = null; + test(descriptor.getListenerMethodDescriptors()); + descriptor.getListenerMethodDescriptors()[0] = null; + test(descriptor.getListenerMethodDescriptors()); + } + catch (Exception exception) { + throw new Error("unexpected error", exception); + } + } + + private static void testMethodDescriptor() { + try { + ParameterDescriptor[] array = { new ParameterDescriptor() }; + MethodDescriptor descriptor = new MethodDescriptor(MyDPD.class.getMethod("getArray"), array); + test(descriptor.getParameterDescriptors()); + array[0] = null; + test(descriptor.getParameterDescriptors()); + descriptor.getParameterDescriptors()[0] = null; + test(descriptor.getParameterDescriptors()); + } + catch (Exception exception) { + throw new Error("unexpected error", exception); + } + } + + private static void testStatement() { + Object[] array = { new Object() }; + Statement statement = new Statement(null, null, array); + test(statement.getArguments()); + array[0] = null; + test(statement.getArguments()); + statement.getArguments()[0] = null; + test(statement.getArguments()); + } + + private static void test(T[] array) { + if (array.length != 1) { + throw new Error("unexpected array length"); + } + if (array[0] == null) { + throw new Error("unexpected array content"); + } + } + + public static class MyDPD + extends DefaultPersistenceDelegate + implements ExceptionListener { + + private final String[] array; + + public MyDPD(String[] array) { + super(array); + this.array = array; + } + + public Expression instantiate(Object instance, Encoder encoder) { + encoder.setExceptionListener(this); + return super.instantiate(instance, encoder); + } + + public String[] getArray() { + return this.array; + } + + public void exceptionThrown(Exception exception) { + throw new Error("unexpected error", exception); + } + } +} diff --git a/jdk/test/java/io/File/GetXSpace.sh b/jdk/test/java/io/File/GetXSpace.sh index 67fae425c8d..a7e3a1c7d86 100644 --- a/jdk/test/java/io/File/GetXSpace.sh +++ b/jdk/test/java/io/File/GetXSpace.sh @@ -53,7 +53,7 @@ allow() { } runTest() { - ${TESTJAVA}/bin/java -cp ${TESTCLASSES} GetXSpace $* + ${TESTJAVA}/bin/java ${TESTVMOPTS} -cp ${TESTCLASSES} GetXSpace $* if [ $? -eq 0 ] then echo "Passed" else diff --git a/jdk/test/java/io/File/MacPathTest.sh b/jdk/test/java/io/File/MacPathTest.sh index ebba514afcd..ecaa5e08881 100644 --- a/jdk/test/java/io/File/MacPathTest.sh +++ b/jdk/test/java/io/File/MacPathTest.sh @@ -36,4 +36,4 @@ if [ "x$TESTJAVA" = x ]; then TESTCLASSES=. fi -export LC_ALL=en_US.UTF-8 ;${TESTJAVA}/bin/java -cp ${TESTCLASSES} MacPathTest +export LC_ALL=en_US.UTF-8 ;${TESTJAVA}/bin/java ${TESTVMOPTS} -cp ${TESTCLASSES} MacPathTest diff --git a/jdk/test/java/io/File/basic.sh b/jdk/test/java/io/File/basic.sh index 74a0f71b614..69abf3d2f29 100644 --- a/jdk/test/java/io/File/basic.sh +++ b/jdk/test/java/io/File/basic.sh @@ -44,7 +44,7 @@ case "$OS" in ;; esac mkdir x.Basic.dir -if $TESTJAVA/bin/java $* -classpath "$TESTCLASSES" Basic; then +if $TESTJAVA/bin/java ${TESTVMOPTS} $* -classpath "$TESTCLASSES" Basic; then [ -f x.Basic.rw ] && (echo "x.Basic.rw not deleted"; exit 1) ([ -d x.Basic.dir ] || [ \! -d x.Basic.dir2 ]) \ && (echo "x.Basic.dir not renamed"; exit 1) diff --git a/jdk/test/java/io/FileOutputStream/FileOpen.sh b/jdk/test/java/io/FileOutputStream/FileOpen.sh index a29d3f150dd..d79c262d441 100644 --- a/jdk/test/java/io/FileOutputStream/FileOpen.sh +++ b/jdk/test/java/io/FileOutputStream/FileOpen.sh @@ -50,20 +50,20 @@ case "$OS" in ${TESTJAVA}/bin/javac -d . ${TESTSRC}\\FileOpenNeg.java echo "Opening Writable Normal File.." - ${TESTJAVA}/bin/java FileOpenPos ${hfile} + ${TESTJAVA}/bin/java ${TESTVMOPTS} FileOpenPos ${hfile} echo "Opening Writable Hidden File.." ${ATTRIB} +h ${hfile} - ${TESTJAVA}/bin/java FileOpenNeg ${hfile} + ${TESTJAVA}/bin/java ${TESTVMOPTS} FileOpenNeg ${hfile} echo "Opening Read-Only Normal File.." ${ATTRIB} -h ${hfile} ${ATTRIB} +r ${hfile} - ${TESTJAVA}/bin/java FileOpenNeg ${hfile} + ${TESTJAVA}/bin/java ${TESTVMOPTS} FileOpenNeg ${hfile} echo "Opening Read-Only Hidden File.." ${ATTRIB} +h ${hfile} - ${TESTJAVA}/bin/java FileOpenNeg ${hfile} + ${TESTJAVA}/bin/java ${TESTVMOPTS} FileOpenNeg ${hfile} rm -f ${hfile} exit diff --git a/jdk/test/java/io/Serializable/class/run.sh b/jdk/test/java/io/Serializable/class/run.sh index 470efe19d29..26ad083908b 100644 --- a/jdk/test/java/io/Serializable/class/run.sh +++ b/jdk/test/java/io/Serializable/class/run.sh @@ -45,85 +45,85 @@ echo Write NonSerial1, Read NonSerial1 rm -f A.java cp ${TESTSRC}/NonSerialA_1.java A.java ${TESTJAVA}/bin/javac A.java -${TESTJAVA}/bin/java Test -s A -${TESTJAVA}/bin/java Test -d +${TESTJAVA}/bin/java ${TESTVMOPTS} Test -s A +${TESTJAVA}/bin/java ${TESTVMOPTS} Test -d echo echo Write NonSerial1, Read NonSerial2 rm -f A.java cp ${TESTSRC}/NonSerialA_1.java A.java ${TESTJAVA}/bin/javac A.java -${TESTJAVA}/bin/java Test -s A +${TESTJAVA}/bin/java ${TESTVMOPTS} Test -s A rm -f A.java cp ${TESTSRC}/NonSerialA_2.java A.java ${TESTJAVA}/bin/javac A.java -${TESTJAVA}/bin/java Test -d +${TESTJAVA}/bin/java ${TESTVMOPTS} Test -d echo echo Write NonSerial1, Read Serial1 rm -f A.java cp ${TESTSRC}/NonSerialA_1.java A.java ${TESTJAVA}/bin/javac A.java -${TESTJAVA}/bin/java Test -s A +${TESTJAVA}/bin/java ${TESTVMOPTS} Test -s A rm -f A.java cp ${TESTSRC}/SerialA_1.java A.java ${TESTJAVA}/bin/javac A.java -${TESTJAVA}/bin/java Test -d +${TESTJAVA}/bin/java ${TESTVMOPTS} Test -d echo echo Write Serial1, Read NonSerial1 rm -f A.java cp ${TESTSRC}/SerialA_1.java A.java ${TESTJAVA}/bin/javac A.java -${TESTJAVA}/bin/java Test -s A +${TESTJAVA}/bin/java ${TESTVMOPTS} Test -s A rm -f A.java cp ${TESTSRC}/NonSerialA_1.java A.java ${TESTJAVA}/bin/javac A.java -${TESTJAVA}/bin/java Test -doe +${TESTJAVA}/bin/java ${TESTVMOPTS} Test -doe echo echo Write Serial1, Read Serial2 rm -f A.java cp ${TESTSRC}/SerialA_1.java A.java ${TESTJAVA}/bin/javac A.java -${TESTJAVA}/bin/java Test -s A +${TESTJAVA}/bin/java ${TESTVMOPTS} Test -s A rm -f A.java cp ${TESTSRC}/SerialA_2.java A.java ${TESTJAVA}/bin/javac A.java -${TESTJAVA}/bin/java Test -d +${TESTJAVA}/bin/java ${TESTVMOPTS} Test -d echo echo Write Serial2, Read Serial1 rm -f A.java cp ${TESTSRC}/SerialA_2.java A.java ${TESTJAVA}/bin/javac A.java -${TESTJAVA}/bin/java Test -s A +${TESTJAVA}/bin/java ${TESTVMOPTS} Test -s A rm -f A.java cp ${TESTSRC}/SerialA_1.java A.java ${TESTJAVA}/bin/javac A.java -${TESTJAVA}/bin/java Test -d +${TESTJAVA}/bin/java ${TESTVMOPTS} Test -d echo echo Write Serial1, Read Serial3 rm -f A.java cp ${TESTSRC}/SerialA_1.java A.java ${TESTJAVA}/bin/javac A.java -${TESTJAVA}/bin/java Test -s A +${TESTJAVA}/bin/java ${TESTVMOPTS} Test -s A rm -f A.java cp ${TESTSRC}/SerialA_3.java A.java ${TESTJAVA}/bin/javac A.java -${TESTJAVA}/bin/java Test -de +${TESTJAVA}/bin/java ${TESTVMOPTS} Test -de echo echo Write Serial3, Read Serial1 rm -f A.java cp ${TESTSRC}/SerialA_3.java A.java ${TESTJAVA}/bin/javac A.java -${TESTJAVA}/bin/java Test -s A +${TESTJAVA}/bin/java ${TESTVMOPTS} Test -s A rm -f A.java cp ${TESTSRC}/SerialA_1.java A.java ${TESTJAVA}/bin/javac A.java -${TESTJAVA}/bin/java Test -de +${TESTJAVA}/bin/java ${TESTVMOPTS} Test -de echo echo Passed diff --git a/jdk/test/java/io/Serializable/evolution/AddedExternField/run.sh b/jdk/test/java/io/Serializable/evolution/AddedExternField/run.sh index bc5edb0dce6..6bb200331dc 100644 --- a/jdk/test/java/io/Serializable/evolution/AddedExternField/run.sh +++ b/jdk/test/java/io/Serializable/evolution/AddedExternField/run.sh @@ -27,7 +27,7 @@ rm *.class tmp.ser javac WriteAddedField.java -java WriteAddedField +java ${TESTVMOPTS} WriteAddedField rm *.class javac ReadAddedField.java -java ReadAddedField +java ${TESTVMOPTS} ReadAddedField diff --git a/jdk/test/java/io/Serializable/evolution/RenamePackage/run.sh b/jdk/test/java/io/Serializable/evolution/RenamePackage/run.sh index 13c4387f7a4..afa751a8474 100644 --- a/jdk/test/java/io/Serializable/evolution/RenamePackage/run.sh +++ b/jdk/test/java/io/Serializable/evolution/RenamePackage/run.sh @@ -86,13 +86,13 @@ ${JAVAC} -d ${TESTCLASSES}/nclasses ${TESTSRC}/install/SerialDriver.java # Run Case 1. Map test.SerialDriver within stream to install.SerialDriver. CLASSPATH="${TESTCLASSES}/oclasses${PS}${TESTCLASSES}/share"; export CLASSPATH; -${JAVA} test.SerialDriver -s +${JAVA} ${TESTVMOPTS} test.SerialDriver -s CLASSPATH="${TESTCLASSES}/nclasses${PS}${TESTCLASSES}/share"; export CLASSPATH; -${JAVA} install.SerialDriver -d +${JAVA} ${TESTVMOPTS} install.SerialDriver -d rm stream.ser # Run Case 2. Map install.SerialDriver within stream to test.SerialDriver. CLASSPATH="${TESTCLASSES}/nclasses${PS}${TESTCLASSES}/share"; export CLASSPATH; -${JAVA} install.SerialDriver -s +${JAVA} ${TESTVMOPTS} install.SerialDriver -s CLASSPATH="${TESTCLASSES}/oclasses${PS}${TESTCLASSES}/share"; export CLASSPATH; -${JAVA} test.SerialDriver -d +${JAVA} ${TESTVMOPTS} test.SerialDriver -d diff --git a/jdk/test/java/io/Serializable/maskSyntheticModifier/run.sh b/jdk/test/java/io/Serializable/maskSyntheticModifier/run.sh index 80ebb762780..075e0dfafb8 100644 --- a/jdk/test/java/io/Serializable/maskSyntheticModifier/run.sh +++ b/jdk/test/java/io/Serializable/maskSyntheticModifier/run.sh @@ -41,5 +41,5 @@ fi set -ex cp ${TESTSRC}/Foo.class . ${TESTJAVA}/bin/javac -d . ${TESTSRC}/Test.java -${TESTJAVA}/bin/java Test +${TESTJAVA}/bin/java ${TESTVMOPTS} Test rm -f *.class diff --git a/jdk/test/java/io/Serializable/packageAccess/run.sh b/jdk/test/java/io/Serializable/packageAccess/run.sh index ee4314164f0..3a7f0c148f7 100644 --- a/jdk/test/java/io/Serializable/packageAccess/run.sh +++ b/jdk/test/java/io/Serializable/packageAccess/run.sh @@ -45,5 +45,5 @@ ${TESTJAVA}/bin/javac -d . ${TESTSRC}/A.java ${TESTSRC}/B.java \ ${TESTJAVA}/bin/jar cf foo.jar B.class D.class rm -f B.class D.class -${TESTJAVA}/bin/java Test +${TESTJAVA}/bin/java ${TESTVMOPTS} Test rm -f *.class *.jar diff --git a/jdk/test/java/io/Serializable/resolveClass/consTest/run.sh b/jdk/test/java/io/Serializable/resolveClass/consTest/run.sh index da7cfe20272..62cc8ff759a 100644 --- a/jdk/test/java/io/Serializable/resolveClass/consTest/run.sh +++ b/jdk/test/java/io/Serializable/resolveClass/consTest/run.sh @@ -44,5 +44,5 @@ ${TESTJAVA}/bin/javac -d . ${TESTSRC}/Boot.java ${TESTJAVA}/bin/jar cf boot.jar *.class rm -f *.class ${TESTJAVA}/bin/javac -classpath boot.jar -d . ${TESTSRC}/Test.java -${TESTJAVA}/bin/java -Xbootclasspath/a:boot.jar Test +${TESTJAVA}/bin/java ${TESTVMOPTS} -Xbootclasspath/a:boot.jar Test rm -f *.class *.jar diff --git a/jdk/test/java/io/Serializable/resolveClass/deserializeButton/run.sh b/jdk/test/java/io/Serializable/resolveClass/deserializeButton/run.sh index 251ef60fd52..48208aec4b8 100644 --- a/jdk/test/java/io/Serializable/resolveClass/deserializeButton/run.sh +++ b/jdk/test/java/io/Serializable/resolveClass/deserializeButton/run.sh @@ -46,5 +46,5 @@ ${TESTJAVA}/bin/javac -d . ${TESTSRC}/Foo.java ${TESTJAVA}/bin/jar cf cb.jar *.class rm -f *.class ${TESTJAVA}/bin/javac -d . ${TESTSRC}/Test.java -${TESTJAVA}/bin/java Test +${TESTJAVA}/bin/java ${TESTVMOPTS} Test rm -f *.class *.jar diff --git a/jdk/test/java/io/Serializable/resolveProxyClass/NonPublicInterface.java b/jdk/test/java/io/Serializable/resolveProxyClass/NonPublicInterface.java index 0fa87787105..72d6a56709a 100644 --- a/jdk/test/java/io/Serializable/resolveProxyClass/NonPublicInterface.java +++ b/jdk/test/java/io/Serializable/resolveProxyClass/NonPublicInterface.java @@ -22,14 +22,17 @@ */ /* @test - * @bug 4413817 + * @bug 4413817 8004928 * @summary Verify that ObjectInputStream.resolveProxyClass can properly * resolve a dynamic proxy class which implements a non-public * interface not defined in the latest user defined class loader. */ import java.io.*; -import java.lang.reflect.*; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.lang.reflect.Proxy; public class NonPublicInterface { @@ -39,35 +42,19 @@ public class NonPublicInterface { } } + public static final String nonPublicIntrfaceName = "java.util.zip.ZipConstants"; + public static void main(String[] args) throws Exception { - Class nonPublic = null; - String[] nonPublicInterfaces = new String[] { - "java.awt.Conditional", - "java.util.zip.ZipConstants", - "javax.swing.GraphicsWrapper", - "javax.swing.JPopupMenu$Popup", - "javax.swing.JTable$Resizable2", - "javax.swing.JTable$Resizable3", - "javax.swing.ToolTipManager$Popup", - "sun.audio.Format", - "sun.audio.HaePlayable", - "sun.tools.agent.StepConstants", - }; - for (int i = 0; i < nonPublicInterfaces.length; i++) { - try { - nonPublic = Class.forName(nonPublicInterfaces[i]); - break; - } catch (ClassNotFoundException ex) { - } - } - if (nonPublic == null) { - throw new Error("couldn't find system non-public interface"); + Class nonPublic = Class.forName(nonPublicIntrfaceName); + if (Modifier.isPublic(nonPublic.getModifiers())) { + throw new Error("Interface " + nonPublicIntrfaceName + + " is public and need to be changed!"); } ByteArrayOutputStream bout = new ByteArrayOutputStream(); ObjectOutputStream oout = new ObjectOutputStream(bout); oout.writeObject(Proxy.newProxyInstance(nonPublic.getClassLoader(), - new Class[]{ nonPublic }, new Handler())); + new Class[]{ nonPublic }, new Handler())); oout.close(); ObjectInputStream oin = new ObjectInputStream( new ByteArrayInputStream(bout.toByteArray())); diff --git a/jdk/test/java/io/Serializable/subclass/run.sh b/jdk/test/java/io/Serializable/subclass/run.sh index 98643450037..d7f1d896401 100644 --- a/jdk/test/java/io/Serializable/subclass/run.sh +++ b/jdk/test/java/io/Serializable/subclass/run.sh @@ -25,6 +25,6 @@ # @bug 4100915 mkdir classes javac -d classes *.java -java -classpath classes -Djava.policy=Allow.policy Test +java ${TESTVMOPTS} -classpath classes -Djava.policy=Allow.policy Test # ENABLE next line when new method for invoking a main with a SecureClassLoader is known #java -classpath classes -Djava.policy=NotAllow.policy Test -expectSecurityException diff --git a/jdk/test/java/io/Serializable/superclassDataLoss/run.sh b/jdk/test/java/io/Serializable/superclassDataLoss/run.sh index c8d12842c56..44473748e3d 100644 --- a/jdk/test/java/io/Serializable/superclassDataLoss/run.sh +++ b/jdk/test/java/io/Serializable/superclassDataLoss/run.sh @@ -46,5 +46,5 @@ cp cb1.jar cb2.jar rm -f A.class B.class ${TESTJAVA}/bin/javac -d . ${TESTSRC}/Test.java -${TESTJAVA}/bin/java Test +${TESTJAVA}/bin/java ${TESTVMOPTS} Test rm -f *.class *.jar diff --git a/jdk/test/java/io/Serializable/unnamedPackageSwitch/run.sh b/jdk/test/java/io/Serializable/unnamedPackageSwitch/run.sh index 384495d8f2a..f31e5c11495 100644 --- a/jdk/test/java/io/Serializable/unnamedPackageSwitch/run.sh +++ b/jdk/test/java/io/Serializable/unnamedPackageSwitch/run.sh @@ -41,4 +41,4 @@ fi set -ex ${TESTJAVA}/bin/javac -d . ${TESTSRC}/A.java ${TESTSRC}/Test.java -${TESTJAVA}/bin/java Test +${TESTJAVA}/bin/java ${TESTVMOPTS} Test diff --git a/jdk/test/java/lang/Class/forName/NonJavaNames.sh b/jdk/test/java/lang/Class/forName/NonJavaNames.sh index b12f0459077..1465a3bf01d 100644 --- a/jdk/test/java/lang/Class/forName/NonJavaNames.sh +++ b/jdk/test/java/lang/Class/forName/NonJavaNames.sh @@ -94,7 +94,7 @@ $COPYPLUS COPYSEMICOLON="cp ${TESTSRC}/classes/semicolon.class ${TESTCLASSES}/;.class" $COPYSEMICOLON -JAVA="$TESTJAVA/bin/java -classpath ${TESTSRC}/classes${SEP}${TESTCLASSES}" +JAVA="$TESTJAVA/bin/java ${TESTVMOPTS} -classpath ${TESTSRC}/classes${SEP}${TESTCLASSES}" $JAVA NonJavaNames RESULT=$? diff --git a/jdk/test/java/lang/ClassLoader/Assert.sh b/jdk/test/java/lang/ClassLoader/Assert.sh index 8e6909f6599..9bc5e01067b 100644 --- a/jdk/test/java/lang/ClassLoader/Assert.sh +++ b/jdk/test/java/lang/ClassLoader/Assert.sh @@ -49,7 +49,7 @@ cp -R ${TESTSRC}/package2 . ${TESTJAVA}/bin/javac Assert.java -${TESTJAVA}/bin/java Assert +${TESTJAVA}/bin/java ${TESTVMOPTS} Assert result=$? if [ $result -eq 0 ] diff --git a/jdk/test/java/lang/ClassLoader/deadlock/TestCrossDelegate.sh b/jdk/test/java/lang/ClassLoader/deadlock/TestCrossDelegate.sh index 17940eabf31..930ba2fc202 100644 --- a/jdk/test/java/lang/ClassLoader/deadlock/TestCrossDelegate.sh +++ b/jdk/test/java/lang/ClassLoader/deadlock/TestCrossDelegate.sh @@ -98,6 +98,7 @@ done # run test ${TESTJAVA}${FS}bin${FS}java \ + ${TESTVMOPTS} \ -verbose:class -XX:+TraceClassLoading -cp . \ -Dtest.classes=${TESTCLASSES} \ Starter cross diff --git a/jdk/test/java/lang/ClassLoader/deadlock/TestOneWayDelegate.sh b/jdk/test/java/lang/ClassLoader/deadlock/TestOneWayDelegate.sh index 5c2f0172daf..311a27602e0 100644 --- a/jdk/test/java/lang/ClassLoader/deadlock/TestOneWayDelegate.sh +++ b/jdk/test/java/lang/ClassLoader/deadlock/TestOneWayDelegate.sh @@ -93,6 +93,7 @@ done # run test ${TESTJAVA}${FS}bin${FS}java \ + ${TESTVMOPTS} \ -verbose:class -XX:+TraceClassLoading -cp . \ -Dtest.classes=${TESTCLASSES} \ Starter one-way diff --git a/jdk/test/java/lang/ClassLoader/getdotresource.sh b/jdk/test/java/lang/ClassLoader/getdotresource.sh index 7cf63c6b5fa..a6a072335d1 100644 --- a/jdk/test/java/lang/ClassLoader/getdotresource.sh +++ b/jdk/test/java/lang/ClassLoader/getdotresource.sh @@ -33,5 +33,5 @@ if [ x"$TESTCLASSES" = x ]; then TESTCLASSES=.; fi if [ x"$TESTSRC" = x ]; then TESTSRC=.; fi # now start the test -${TESTJAVA}/bin/java -Djava.ext.dirs=$TESTSRC -cp $TESTCLASSES GetDotResource +${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.ext.dirs=$TESTSRC -cp $TESTCLASSES GetDotResource diff --git a/jdk/test/java/lang/Integer/Unsigned.java b/jdk/test/java/lang/Integer/Unsigned.java index c7b831d65fe..09be7bfddb6 100644 --- a/jdk/test/java/lang/Integer/Unsigned.java +++ b/jdk/test/java/lang/Integer/Unsigned.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. */ /* diff --git a/jdk/test/java/lang/Long/Unsigned.java b/jdk/test/java/lang/Long/Unsigned.java index 22e50e61dae..2ccbc8d509a 100644 --- a/jdk/test/java/lang/Long/Unsigned.java +++ b/jdk/test/java/lang/Long/Unsigned.java @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. */ /* diff --git a/jdk/test/java/lang/Math/CubeRootTests.java b/jdk/test/java/lang/Math/CubeRootTests.java index 9b180d11b43..abb221f1a91 100644 --- a/jdk/test/java/lang/Math/CubeRootTests.java +++ b/jdk/test/java/lang/Math/CubeRootTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/lang/Math/Expm1Tests.java b/jdk/test/java/lang/Math/Expm1Tests.java index b10934e4f1a..e575710c628 100644 --- a/jdk/test/java/lang/Math/Expm1Tests.java +++ b/jdk/test/java/lang/Math/Expm1Tests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/lang/Math/HyperbolicTests.java b/jdk/test/java/lang/Math/HyperbolicTests.java index 0899df89d5a..fb9abba9a28 100644 --- a/jdk/test/java/lang/Math/HyperbolicTests.java +++ b/jdk/test/java/lang/Math/HyperbolicTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/lang/Math/Log10Tests.java b/jdk/test/java/lang/Math/Log10Tests.java index a9f169a569a..c7ff242be1e 100644 --- a/jdk/test/java/lang/Math/Log10Tests.java +++ b/jdk/test/java/lang/Math/Log10Tests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/lang/Math/Log1pTests.java b/jdk/test/java/lang/Math/Log1pTests.java index f15a92b5887..56a80047aa9 100644 --- a/jdk/test/java/lang/Math/Log1pTests.java +++ b/jdk/test/java/lang/Math/Log1pTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/lang/Math/Tests.java b/jdk/test/java/lang/Math/Tests.java index 6b39c8a0160..7dd6d68075f 100644 --- a/jdk/test/java/lang/Math/Tests.java +++ b/jdk/test/java/lang/Math/Tests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/lang/Runtime/exec/setcwd.sh b/jdk/test/java/lang/Runtime/exec/setcwd.sh index 14cd010973b..7fe15591283 100644 --- a/jdk/test/java/lang/Runtime/exec/setcwd.sh +++ b/jdk/test/java/lang/Runtime/exec/setcwd.sh @@ -37,5 +37,5 @@ cp ${TESTCLASSES}/SetCwd.class . cp ${TESTCLASSES}/SetCwd.class foo # now start the test -${TESTJAVA}/bin/java SetCwd +${TESTJAVA}/bin/java ${TESTVMOPTS} SetCwd diff --git a/jdk/test/java/lang/StringBuffer/TestSynchronization.java b/jdk/test/java/lang/StringBuffer/TestSynchronization.java index 75b4b82f3d5..cde4a285de6 100644 --- a/jdk/test/java/lang/StringBuffer/TestSynchronization.java +++ b/jdk/test/java/lang/StringBuffer/TestSynchronization.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/lang/StringCoding/CheckEncodings.sh b/jdk/test/java/lang/StringCoding/CheckEncodings.sh index 6b5fc830d15..edc5f9a4e49 100644 --- a/jdk/test/java/lang/StringCoding/CheckEncodings.sh +++ b/jdk/test/java/lang/StringCoding/CheckEncodings.sh @@ -49,7 +49,7 @@ runTest() { echo "Testing:" ${1} set LC_ALL="${1}"; export LC_ALL locale - ${TESTJAVA}/bin/java -version 2>&1 + ${TESTJAVA}/bin/java ${TESTVMOPTS} -version 2>&1 expectPass $? } diff --git a/jdk/test/java/lang/System/finalization/FinExit.sh b/jdk/test/java/lang/System/finalization/FinExit.sh index 53bc6756171..e5eec432094 100644 --- a/jdk/test/java/lang/System/finalization/FinExit.sh +++ b/jdk/test/java/lang/System/finalization/FinExit.sh @@ -26,7 +26,7 @@ # # We only want the first character, Windows might add CRLF -x=`$TESTJAVA/bin/java -cp "$TESTCLASSES" FinExit | cut -c1` +x=`$TESTJAVA/bin/java ${TESTVMOPTS} -cp "$TESTCLASSES" FinExit | cut -c1` echo $x if [ "x$x" != "x1" ]; then echo On-exit finalizer invoked twice diff --git a/jdk/test/java/lang/ThreadLocal/ThreadLocalSupplierTest.java b/jdk/test/java/lang/ThreadLocal/ThreadLocalSupplierTest.java new file mode 100644 index 00000000000..5601ac50bc4 --- /dev/null +++ b/jdk/test/java/lang/ThreadLocal/ThreadLocalSupplierTest.java @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Supplier; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * @test + * @run testng ThreadLocalSupplierTest + * @summary tests ThreadLocal.withInitial(). + * Adapted from java.lang.Basic functional test of ThreadLocal + * + * @author Jim Gish + */ +@Test +public class ThreadLocalSupplierTest { + + static final class IntegerSupplier implements Supplier { + + private final AtomicInteger supply = new AtomicInteger(0); + + @Override + public Integer get() { + return supply.getAndIncrement(); + } + + public int numCalls() { + return supply.intValue(); + } + } + + static IntegerSupplier theSupply = new IntegerSupplier(); + + static final class MyThreadLocal extends ThreadLocal { + + private final ThreadLocal delegate; + + public volatile boolean everCalled; + + public MyThreadLocal(Supplier supplier) { + delegate = ThreadLocal.withInitial(supplier); + } + + @Override + public Integer get() { + return delegate.get(); + } + + @Override + protected synchronized Integer initialValue() { + // this should never be called since we are using the factory instead + everCalled = true; + return null; + } + } + + /** + * Our one and only ThreadLocal from which we get thread ids using a + * supplier which simply increments a counter on each call of get(). + */ + static MyThreadLocal threadLocal = new MyThreadLocal(theSupply); + + public void testMultiThread() throws Exception { + final int threadCount = 500; + final Thread th[] = new Thread[threadCount]; + final boolean visited[] = new boolean[threadCount]; + + // Create and start the threads + for (int i = 0; i < threadCount; i++) { + th[i] = new Thread() { + @Override + public void run() { + final int threadId = threadLocal.get(); + assertFalse(visited[threadId], "visited[" + threadId + "]=" + visited[threadId]); + visited[threadId] = true; + // check the get() again + final int secondCheckThreadId = threadLocal.get(); + assertEquals(secondCheckThreadId, threadId); + } + }; + th[i].start(); + } + + // Wait for the threads to finish + for (int i = 0; i < threadCount; i++) { + th[i].join(); + } + + assertEquals(theSupply.numCalls(), threadCount); + // make sure the provided initialValue() has not been called + assertFalse(threadLocal.everCalled); + // Check results + for (int i = 0; i < threadCount; i++) { + assertTrue(visited[i], "visited[" + i + "]=" + visited[i]); + } + } + + public void testSimple() { + final String expected = "OneWithEverything"; + final ThreadLocal threadLocal = ThreadLocal.withInitial(() -> expected); + assertEquals(expected, threadLocal.get()); + } +} diff --git a/jdk/test/java/lang/Throwable/LegacyChainedExceptionSerialization.java b/jdk/test/java/lang/Throwable/LegacyChainedExceptionSerialization.java index 7942699ae07..fbd3e5d2715 100644 --- a/jdk/test/java/lang/Throwable/LegacyChainedExceptionSerialization.java +++ b/jdk/test/java/lang/Throwable/LegacyChainedExceptionSerialization.java @@ -25,7 +25,7 @@ import java.io.*; /** * @test - * @bug 4385429 + * @bug 4385429 8004928 * @summary Certain legacy chained exceptions throw IllegalArgumentException * upon deserialization if "causative exception" is null. * @author Josh Bloch @@ -36,8 +36,7 @@ public class LegacyChainedExceptionSerialization { new ExceptionInInitializerError(), new java.lang.reflect.UndeclaredThrowableException(null), new java.lang.reflect.InvocationTargetException(null), - new java.security.PrivilegedActionException(null), - new java.awt.print.PrinterIOException(null) + new java.security.PrivilegedActionException(null) }; public static void main(String[] args) throws Exception { diff --git a/jdk/test/java/lang/annotation/loaderLeak/LoaderLeak.sh b/jdk/test/java/lang/annotation/loaderLeak/LoaderLeak.sh index c7315f5d146..bc72b936cc3 100644 --- a/jdk/test/java/lang/annotation/loaderLeak/LoaderLeak.sh +++ b/jdk/test/java/lang/annotation/loaderLeak/LoaderLeak.sh @@ -69,7 +69,7 @@ mkdir -p classes cp ${TESTSRC}${FS}*.java . ${TESTJAVA}${FS}bin${FS}javac -d classes A.java B.java C.java ${TESTJAVA}${FS}bin${FS}javac Main.java -${TESTJAVA}${FS}bin${FS}java Main +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} Main result=$? if [ $result -eq 0 ] then @@ -78,7 +78,7 @@ else echo "Failed 1 of 2" exit $result fi -${TESTJAVA}${FS}bin${FS}java Main foo +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} Main foo result=$? if [ $result -eq 0 ] then diff --git a/jdk/test/java/lang/invoke/lambda/LambdaAccessControlDoPrivilegedTest.java b/jdk/test/java/lang/invoke/lambda/LambdaAccessControlDoPrivilegedTest.java new file mode 100644 index 00000000000..8c3d1c5ed5b --- /dev/null +++ b/jdk/test/java/lang/invoke/lambda/LambdaAccessControlDoPrivilegedTest.java @@ -0,0 +1,226 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8003881 + * @summary tests DoPrivileged action (implemented as lambda expressions) by + * inserting them into the BootClassPath. + * @compile -XDignore.symbol.file LambdaAccessControlDoPrivilegedTest.java + * @run main/othervm LambdaAccessControlDoPrivilegedTest + */ +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.nio.charset.Charset; +import java.nio.file.Files; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class LambdaAccessControlDoPrivilegedTest extends LUtils { + public static void main(String... args) { + final List scratch = new ArrayList(); + scratch.clear(); + scratch.add("import java.security.*;"); + scratch.add("public class DoPriv {"); + scratch.add("public static void main(String... args) {"); + scratch.add("String prop = AccessController.doPrivileged((PrivilegedAction) () -> {"); + scratch.add("return System.getProperty(\"user.home\");"); + scratch.add("});"); + scratch.add("}"); + scratch.add("}"); + File doprivJava = new File("DoPriv.java"); + File doprivClass = getClassFile(doprivJava); + createFile(doprivJava, scratch); + + scratch.clear(); + scratch.add("public class Bar {"); + scratch.add("public static void main(String... args) {"); + scratch.add("System.out.println(\"sun.boot.class.path\" + \"=\" +"); + scratch.add(" System.getProperty(\"sun.boot.class.path\", \"\"));"); + scratch.add("System.setSecurityManager(new SecurityManager());"); + scratch.add("DoPriv.main();"); + scratch.add("}"); + scratch.add("}"); + + File barJava = new File("Bar.java"); + File barClass = getClassFile(barJava); + createFile(barJava, scratch); + + String[] javacArgs = {barJava.getName(), doprivJava.getName()}; + compile(javacArgs); + File jarFile = new File("foo.jar"); + String[] jargs = {"cvf", jarFile.getName(), doprivClass.getName()}; + jarTool.run(jargs); + doprivJava.delete(); + doprivClass.delete(); + TestResult tr = doExec(JAVA_CMD.getAbsolutePath(), + "-Xbootclasspath/p:foo.jar", + "-cp", ".", "Bar"); + tr.assertZero("testDoPrivileged fails"); + barJava.delete(); + barClass.delete(); + jarFile.delete(); + } +} + +/* + * support infrastructure to invoke a java class from the command line + */ +class LUtils { + static final sun.tools.jar.Main jarTool = + new sun.tools.jar.Main(System.out, System.err, "jar-tool"); + static final com.sun.tools.javac.Main javac = + new com.sun.tools.javac.Main(); + static final File cwd = new File(".").getAbsoluteFile(); + static final String JAVAHOME = System.getProperty("java.home"); + static final boolean isWindows = + System.getProperty("os.name", "unknown").startsWith("Windows"); + //static final boolean isSDK = JAVAHOME.endsWith("jre"); + static final File JAVA_BIN_FILE = new File(JAVAHOME, "bin"); + static final File JAVA_CMD = new File(JAVA_BIN_FILE, + isWindows ? "java.exe" : "java"); + + protected LUtils() { + } + + public static void compile(String... args) { + if (javac.compile(args) != 0) { + throw new RuntimeException("compilation fails"); + } + } + + static void createFile(File outFile, List content) { + try { + Files.write(outFile.getAbsoluteFile().toPath(), content, + Charset.defaultCharset()); + } catch (IOException ex) { + throw new RuntimeException(ex); + } + } + + static File getClassFile(File javaFile) { + return javaFile.getName().endsWith(".java") + ? new File(javaFile.getName().replace(".java", ".class")) + : null; + } + + static String getSimpleName(File inFile) { + String fname = inFile.getName(); + return fname.substring(0, fname.indexOf(".")); + } + + static TestResult doExec(String... cmds) { + return doExec(null, null, cmds); + } + + /* + * A method which executes a java cmd and returns the results in a container + */ + static TestResult doExec(Map envToSet, + java.util.Set envToRemove, String... cmds) { + String cmdStr = ""; + for (String x : cmds) { + cmdStr = cmdStr.concat(x + " "); + } + ProcessBuilder pb = new ProcessBuilder(cmds); + Map env = pb.environment(); + if (envToRemove != null) { + for (String key : envToRemove) { + env.remove(key); + } + } + if (envToSet != null) { + env.putAll(envToSet); + } + BufferedReader rdr = null; + try { + List outputList = new ArrayList<>(); + pb.redirectErrorStream(true); + Process p = pb.start(); + rdr = new BufferedReader(new InputStreamReader(p.getInputStream())); + String in = rdr.readLine(); + while (in != null) { + outputList.add(in); + in = rdr.readLine(); + } + p.waitFor(); + p.destroy(); + + return new TestResult(cmdStr, p.exitValue(), outputList, + env, new Throwable("current stack of the test")); + } catch (Exception ex) { + ex.printStackTrace(); + throw new RuntimeException(ex.getMessage()); + } + } + + static class TestResult { + String cmd; + int exitValue; + List testOutput; + Map env; + Throwable t; + + public TestResult(String str, int rv, List oList, + Map env, Throwable t) { + cmd = str; + exitValue = rv; + testOutput = oList; + this.env = env; + this.t = t; + } + + void assertZero(String message) { + if (exitValue != 0) { + System.err.println(this); + throw new RuntimeException(message); + } + } + + @Override + public String toString() { + StringWriter sw = new StringWriter(); + PrintWriter status = new PrintWriter(sw); + status.println("Cmd: " + cmd); + status.println("Return code: " + exitValue); + status.println("Environment variable:"); + for (String x : env.keySet()) { + status.println("\t" + x + "=" + env.get(x)); + } + status.println("Output:"); + for (String x : testOutput) { + status.println("\t" + x); + } + status.println("Exception:"); + status.println(t.getMessage()); + t.printStackTrace(status); + + return sw.getBuffer().toString(); + } + } +} diff --git a/jdk/test/java/lang/invoke/lambda/LambdaAccessControlTest.java b/jdk/test/java/lang/invoke/lambda/LambdaAccessControlTest.java new file mode 100644 index 00000000000..361a4cffcce --- /dev/null +++ b/jdk/test/java/lang/invoke/lambda/LambdaAccessControlTest.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8003881 + * @summary tests Lambda expression with a a security manager at top level + * @compile -XDignore.symbol.file LambdaAccessControlTest.java + * + * @run main/othervm LambdaAccessControlTest + */ + +public class LambdaAccessControlTest extends LUtils { + public static void main(String... args) { + System.setSecurityManager(new SecurityManager()); + JJ iii = (new CC())::impl; + System.out.printf(">>> %s\n", iii.foo(44)); + iii = DD::impl; + System.out.printf(">>> %s\n", iii.foo(44)); + return; + } +} +/* + * support classes for the test + */ +interface II { Object foo(T x); } +interface JJ extends II { } +class CC { String impl(int i) { return "impl:"+i; }} +class DD { static String impl(int i) { return "impl:"+i; }} diff --git a/jdk/test/java/lang/invoke/remote/RemoteExample.java b/jdk/test/java/lang/invoke/remote/RemoteExample.java index 0829a6525b8..801d9b72dee 100644 --- a/jdk/test/java/lang/invoke/remote/RemoteExample.java +++ b/jdk/test/java/lang/invoke/remote/RemoteExample.java @@ -1,12 +1,12 @@ /* - * Copyright 2009-2010 Sun Microsystems, Inc. All Rights Reserved. + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. * 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. Sun designates this + * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. + * 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 @@ -18,9 +18,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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 test.java.lang.invoke.remote; diff --git a/jdk/test/java/lang/management/CompilationMXBean/Basic.java b/jdk/test/java/lang/management/CompilationMXBean/Basic.java index 920fed94829..4b24bb5873c 100644 --- a/jdk/test/java/lang/management/CompilationMXBean/Basic.java +++ b/jdk/test/java/lang/management/CompilationMXBean/Basic.java @@ -23,10 +23,10 @@ /* * @test - * @bug 5011189 + * @bug 5011189 8004928 * @summary Unit test for java.lang.management.CompilationMXBean * - * @run main/othervm -Xcomp -Xbatch -Djava.awt.headless=true Basic + * @run main/othervm -Xcomp -Xbatch Basic */ import java.lang.management.*; @@ -65,8 +65,6 @@ public class Basic { java.util.Locale.getAvailableLocales(); java.security.Security.getProviders(); - java.awt.Toolkit.getDefaultToolkit(); - javax.swing.UIManager.getInstalledLookAndFeels(); java.nio.channels.spi.SelectorProvider.provider(); time = mb.getTotalCompilationTime(); diff --git a/jdk/test/java/lang/management/OperatingSystemMXBean/TestSystemLoadAvg.sh b/jdk/test/java/lang/management/OperatingSystemMXBean/TestSystemLoadAvg.sh index 1f8d823dcdb..571a3d931a3 100644 --- a/jdk/test/java/lang/management/OperatingSystemMXBean/TestSystemLoadAvg.sh +++ b/jdk/test/java/lang/management/OperatingSystemMXBean/TestSystemLoadAvg.sh @@ -52,7 +52,7 @@ fi runOne() { echo "$TESTJAVA/bin/java -classpath $TESTCLASSES $@" - $TESTJAVA/bin/java -classpath $TESTCLASSES $@ + $TESTJAVA/bin/java ${TESTVMOPTS} -classpath $TESTCLASSES $@ } # Retry 5 times to be more resilent to system load fluctation. diff --git a/jdk/test/java/lang/reflect/Generics/Probe.java b/jdk/test/java/lang/reflect/Generics/Probe.java index 15babb6c56c..1cdd5af3bdd 100644 --- a/jdk/test/java/lang/reflect/Generics/Probe.java +++ b/jdk/test/java/lang/reflect/Generics/Probe.java @@ -23,7 +23,7 @@ /* * @test - * @bug 5003916 6704655 6873951 6476261 + * @bug 5003916 6704655 6873951 6476261 8004928 * @summary Testing parsing of signatures attributes of nested classes * @author Joseph D. Darcy */ @@ -52,8 +52,7 @@ import static java.util.Arrays.*; "java.util.HashMap$ValueIterator", "java.util.LinkedHashMap$EntryIterator", "java.util.LinkedHashMap$KeyIterator", - "java.util.LinkedHashMap$ValueIterator", - "javax.swing.JComboBox$AccessibleJComboBox"}) + "java.util.LinkedHashMap$ValueIterator"}) public class Probe { public static void main (String... args) throws Throwable { Classes classesAnnotation = (Probe.class).getAnnotation(Classes.class); diff --git a/jdk/test/java/lang/reflect/Method/IsDefaultTest.java b/jdk/test/java/lang/reflect/Method/IsDefaultTest.java new file mode 100644 index 00000000000..64cb5c2df4a --- /dev/null +++ b/jdk/test/java/lang/reflect/Method/IsDefaultTest.java @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8005042 + * @summary Check behavior of Method.isDefault + * @author Joseph D. Darcy + */ + +import java.lang.reflect.*; +import java.lang.annotation.*; +import java.util.*; + +public class IsDefaultTest { + public static void main(String... argv) throws Exception { + int failures = 0; + int visitationCount = 0; + + List> classList = new ArrayList<>(); + classList.add(TestType1.class); + classList.add(TestType2.class); + classList.add(TestType3.class); + classList.add(TestType4.class); + + for(Class clazz: classList) { + for(Method method: clazz.getDeclaredMethods()) { + ExpectedIsDefault expectedIsDefault = method.getAnnotation(ExpectedIsDefault.class); + if (expectedIsDefault != null) { + visitationCount++; + boolean expected = expectedIsDefault.value(); + boolean actual = method.isDefault(); + + if (actual != expected) { + failures++; + System.err.printf("ERROR: On %s expected isDefault of ''%s''; got ''%s''.\n", + method.toString(), expected, actual); + } + } + } + } + + if (visitationCount == 0) { + System.err.println("Test failed because no methods checked."); + throw new RuntimeException(); + } + + if (failures > 0) { + System.err.println("Test failed."); + throw new RuntimeException(); + } + } +} + +interface TestType1 { + @ExpectedIsDefault(false) + void foo(); + + @ExpectedIsDefault(true) + default void bar() {}; // Default method +} + +class TestType2 { + @ExpectedIsDefault(false) + void bar() {}; +} + +class TestType3 implements TestType1 { + @ExpectedIsDefault(false) + public void foo(){} + + @ExpectedIsDefault(false) + @Override + public void bar() {}; +} + +@interface TestType4 { + @ExpectedIsDefault(false) + String value(); + + @ExpectedIsDefault(false) + String anotherValue() default ""; +} + +@Retention(RetentionPolicy.RUNTIME) +@interface ExpectedIsDefault { + boolean value(); +} diff --git a/jdk/test/java/lang/reflect/Proxy/ClassRestrictions.java b/jdk/test/java/lang/reflect/Proxy/ClassRestrictions.java index 1ed673db7a7..61dbea7f5dd 100644 --- a/jdk/test/java/lang/reflect/Proxy/ClassRestrictions.java +++ b/jdk/test/java/lang/reflect/Proxy/ClassRestrictions.java @@ -22,7 +22,7 @@ */ /* @test - * @bug 4227192 + * @bug 4227192 8004928 * @summary This is a test of the restrictions on the parameters that may * be passed to the Proxy.getProxyClass method. * @author Peter Jones @@ -31,6 +31,7 @@ * @run main ClassRestrictions */ +import java.lang.reflect.Modifier; import java.lang.reflect.Proxy; import java.net.URLClassLoader; @@ -48,6 +49,8 @@ public class ClassRestrictions { void foo(); } + public static final String nonPublicIntrfaceName = "java.util.zip.ZipConstants"; + public static void main(String[] args) { System.err.println( @@ -65,7 +68,7 @@ public class ClassRestrictions { try { interfaces = new Class[] { Object.class }; proxyClass = Proxy.getProxyClass(loader, interfaces); - throw new RuntimeException( + throw new Error( "proxy class created with java.lang.Object as interface"); } catch (IllegalArgumentException e) { e.printStackTrace(); @@ -75,7 +78,7 @@ public class ClassRestrictions { try { interfaces = new Class[] { Integer.TYPE }; proxyClass = Proxy.getProxyClass(loader, interfaces); - throw new RuntimeException( + throw new Error( "proxy class created with int.class as interface"); } catch (IllegalArgumentException e) { e.printStackTrace(); @@ -90,7 +93,7 @@ public class ClassRestrictions { try { interfaces = new Class[] { Bar.class, Bar.class }; proxyClass = Proxy.getProxyClass(loader, interfaces); - throw new RuntimeException( + throw new Error( "proxy class created with repeated interfaces"); } catch (IllegalArgumentException e) { e.printStackTrace(); @@ -109,7 +112,7 @@ public class ClassRestrictions { try { interfaces = new Class[] { altBarClass }; proxyClass = Proxy.getProxyClass(loader, interfaces); - throw new RuntimeException( + throw new Error( "proxy class created with interface " + "not visible to class loader"); } catch (IllegalArgumentException e) { @@ -122,34 +125,16 @@ public class ClassRestrictions { * All non-public interfaces must be in the same package. */ Class nonPublic1 = Bashful.class; - Class nonPublic2 = null; - String[] nonPublicInterfaces = new String[] { - "java.awt.Conditional", - "java.util.zip.ZipConstants", - "javax.swing.GraphicsWrapper", - "javax.swing.JPopupMenu$Popup", - "javax.swing.JTable$Resizable2", - "javax.swing.JTable$Resizable3", - "javax.swing.ToolTipManager$Popup", - "sun.audio.Format", - "sun.audio.HaePlayable", - "sun.tools.agent.StepConstants", - }; - for (int i = 0; i < nonPublicInterfaces.length; i++) { - try { - nonPublic2 = Class.forName(nonPublicInterfaces[i]); - break; - } catch (ClassNotFoundException e) { - } - } - if (nonPublic2 == null) { - throw new RuntimeException( - "no second non-public interface found for test"); + Class nonPublic2 = Class.forName(nonPublicIntrfaceName); + if (Modifier.isPublic(nonPublic2.getModifiers())) { + throw new Error( + "Interface " + nonPublicIntrfaceName + + " is public and need to be changed!"); } try { interfaces = new Class[] { nonPublic1, nonPublic2 }; proxyClass = Proxy.getProxyClass(loader, interfaces); - throw new RuntimeException( + throw new Error( "proxy class created with two non-public interfaces " + "in different packages"); } catch (IllegalArgumentException e) { @@ -165,7 +150,7 @@ public class ClassRestrictions { try { interfaces = new Class[] { Bar.class, Baz.class }; proxyClass = Proxy.getProxyClass(loader, interfaces); - throw new RuntimeException( + throw new Error( "proxy class created with conflicting methods"); } catch (IllegalArgumentException e) { e.printStackTrace(); @@ -178,10 +163,10 @@ public class ClassRestrictions { */ System.err.println("\nTEST PASSED"); - } catch (Exception e) { + } catch (Throwable e) { System.err.println("\nTEST FAILED:"); e.printStackTrace(); - throw new RuntimeException("TEST FAILED: " + e.toString()); + throw new Error("TEST FAILED: ", e); } } } diff --git a/jdk/test/java/math/BigDecimal/FloatDoubleValueTests.java b/jdk/test/java/math/BigDecimal/FloatDoubleValueTests.java index f8f3f9a7c55..c615b765164 100644 --- a/jdk/test/java/math/BigDecimal/FloatDoubleValueTests.java +++ b/jdk/test/java/math/BigDecimal/FloatDoubleValueTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/math/BigDecimal/StrippingZerosTest.java b/jdk/test/java/math/BigDecimal/StrippingZerosTest.java index c76d0ca99fa..d0b1753ab38 100644 --- a/jdk/test/java/math/BigDecimal/StrippingZerosTest.java +++ b/jdk/test/java/math/BigDecimal/StrippingZerosTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/net/Authenticator/B4933582.sh b/jdk/test/java/net/Authenticator/B4933582.sh index 66188364c09..1dfed10cb2a 100644 --- a/jdk/test/java/net/Authenticator/B4933582.sh +++ b/jdk/test/java/net/Authenticator/B4933582.sh @@ -45,5 +45,5 @@ case "$OS" in esac ${TESTJAVA}${FS}bin${FS}javac -d . -classpath "${TESTSRC}${FS}..${FS}..${FS}..${FS}sun${FS}net${FS}www${FS}httptest" ${TESTSRC}${FS}B4933582.java rm -f cache.ser auth.save -${TESTJAVA}${FS}bin${FS}java -classpath "${TESTSRC}${FS}..${FS}..${FS}..${FS}sun${FS}net${FS}www${FS}httptest${PS}." B4933582 first -${TESTJAVA}${FS}bin${FS}java -classpath "${TESTSRC}${FS}..${FS}..${FS}..${FS}sun${FS}net${FS}www${FS}httptest${PS}." B4933582 second +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath "${TESTSRC}${FS}..${FS}..${FS}..${FS}sun${FS}net${FS}www${FS}httptest${PS}." B4933582 first +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath "${TESTSRC}${FS}..${FS}..${FS}..${FS}sun${FS}net${FS}www${FS}httptest${PS}." B4933582 second diff --git a/jdk/test/java/net/CookieHandler/B6791927.java b/jdk/test/java/net/CookieHandler/B6791927.java index 65b60cb2d25..4b870158d58 100644 --- a/jdk/test/java/net/CookieHandler/B6791927.java +++ b/jdk/test/java/net/CookieHandler/B6791927.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,7 +37,7 @@ public class B6791927 { try { // Forces a non US locale Locale.setDefault(Locale.FRANCE); - List cookies = HttpCookie.parse("set-cookie: CUSTOMER=WILE_E_COYOTE; expires=Wednesday, 09-Nov-2019 23:12:40 GMT"); + List cookies = HttpCookie.parse("set-cookie: CUSTOMER=WILE_E_COYOTE; expires=Sat, 09-Nov-2019 23:12:40 GMT"); if (cookies == null || cookies.isEmpty()) { throw new RuntimeException("No cookie found"); } diff --git a/jdk/test/java/net/CookieHandler/CookieManagerTest.java b/jdk/test/java/net/CookieHandler/CookieManagerTest.java index ac51b42b0b5..f3d5b7a264f 100644 --- a/jdk/test/java/net/CookieHandler/CookieManagerTest.java +++ b/jdk/test/java/net/CookieHandler/CookieManagerTest.java @@ -126,7 +126,7 @@ class CookieHttpTransaction implements HttpCallback { testPolicies[count] = CookiePolicy.ACCEPT_ORIGINAL_SERVER; testCases[count++] = new CookieTestCase[]{ new CookieTestCase("Set-Cookie", - "CUSTOMER=WILE:BOB; path=/; expires=Wednesday, 09-Nov-2030 23:12:40 GMT;" + "domain=." + localHostAddr, + "CUSTOMER=WILE:BOB; path=/; expires=Sat, 09-Nov-2030 23:12:40 GMT;" + "domain=." + localHostAddr, "CUSTOMER=WILE:BOB", "/" ), diff --git a/jdk/test/java/net/DatagramSocket/SetDatagramSocketImplFactory/ADatagramSocket.sh b/jdk/test/java/net/DatagramSocket/SetDatagramSocketImplFactory/ADatagramSocket.sh index 372c04d9059..271b21d26f3 100644 --- a/jdk/test/java/net/DatagramSocket/SetDatagramSocketImplFactory/ADatagramSocket.sh +++ b/jdk/test/java/net/DatagramSocket/SetDatagramSocketImplFactory/ADatagramSocket.sh @@ -49,4 +49,4 @@ case "$OS" in ;; esac -${TESTJAVA}${FILESEP}bin${FILESEP}java -Xbootclasspath/p:${TESTCLASSES} ADatagramSocket true +${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} -Xbootclasspath/p:${TESTCLASSES} ADatagramSocket true diff --git a/jdk/test/java/net/HttpCookie/ExpiredCookieTest.java b/jdk/test/java/net/HttpCookie/ExpiredCookieTest.java new file mode 100644 index 00000000000..b43065ffacd --- /dev/null +++ b/jdk/test/java/net/HttpCookie/ExpiredCookieTest.java @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8000525 + */ + +import java.net.*; +import java.util.*; +import java.io.*; +import java.text.*; + +public class ExpiredCookieTest { + // lifted from HttpCookie.java + private final static String[] COOKIE_DATE_FORMATS = { + "EEE',' dd-MMM-yy HH:mm:ss 'GMT'", + "EEE',' dd MMM yy HH:mm:ss 'GMT'", + "EEE MMM dd yy HH:mm:ss 'GMT'Z", + "EEE',' dd-MMM-yyyy HH:mm:ss 'GMT'", + "EEE',' dd MMM yyyy HH:mm:ss 'GMT'", + "EEE MMM dd yyyy HH:mm:ss 'GMT'Z" + }; + static final TimeZone GMT = TimeZone.getTimeZone("GMT"); + + public static void main(String[] args) throws Exception { + Calendar cal = Calendar.getInstance(GMT); + + for (int i = 0; i < COOKIE_DATE_FORMATS.length; i++) { + SimpleDateFormat df = new SimpleDateFormat(COOKIE_DATE_FORMATS[i], + Locale.US); + cal.set(1970, 0, 1, 0, 0, 0); + df.setTimeZone(GMT); + df.setLenient(false); + df.set2DigitYearStart(cal.getTime()); + CookieManager cm = new CookieManager( + null, CookiePolicy.ACCEPT_ALL); + CookieHandler.setDefault(cm); + Map> header = new HashMap<>(); + List values = new ArrayList<>(); + + cal.set(1970, 6, 9, 10, 10, 1); + StringBuilder datestring = + new StringBuilder(df.format(cal.getTime())); + values.add( + "TEST1=TEST1; Path=/; Expires=" + datestring.toString()); + + cal.set(1969, 6, 9, 10, 10, 2); + datestring = new StringBuilder(df.format(cal.getTime())); + values.add( + "TEST2=TEST2; Path=/; Expires=" + datestring.toString()); + + cal.set(2070, 6, 9, 10, 10, 3); + datestring = new StringBuilder(df.format(cal.getTime())); + values.add( + "TEST3=TEST3; Path=/; Expires=" + datestring.toString()); + + cal.set(2069, 6, 9, 10, 10, 4); + datestring = new StringBuilder(df.format(cal.getTime())); + values.add( + "TEST4=TEST4; Path=/; Expires=" + datestring.toString()); + + header.put("Set-Cookie", values); + cm.put(new URI("http://127.0.0.1/"), header); + + CookieStore cookieJar = cm.getCookieStore(); + List cookies = cookieJar.getCookies(); + if (COOKIE_DATE_FORMATS[i].contains("yyyy")) { + if (cookies.size() != 2) + throw new RuntimeException( + "Incorrectly parsing a bad date"); + } else if (cookies.size() != 1) { + throw new RuntimeException( + "Incorrectly parsing a bad date"); + } + } + } +} diff --git a/jdk/test/java/net/Inet4Address/PingThis.java b/jdk/test/java/net/Inet4Address/PingThis.java index 515a873fc6e..d302df54b35 100644 --- a/jdk/test/java/net/Inet4Address/PingThis.java +++ b/jdk/test/java/net/Inet4Address/PingThis.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/net/Inet6Address/StringScope.java b/jdk/test/java/net/Inet6Address/StringScope.java new file mode 100644 index 00000000000..6b01ba8f862 --- /dev/null +++ b/jdk/test/java/net/Inet6Address/StringScope.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8004675 + * @summary Inet6Address.getHostAddress should use string scope + * identifier where available + */ + +import java.net.*; +import java.util.Enumeration; + +public class StringScope { + + public static void main(String args[]) throws Exception { + Enumeration e = NetworkInterface.getNetworkInterfaces(); + while (e.hasMoreElements()) { + NetworkInterface iface = e.nextElement(); + Enumeration iadrs = iface.getInetAddresses(); + while (iadrs.hasMoreElements()) { + InetAddress iadr = iadrs.nextElement(); + if (iadr instanceof Inet6Address) { + Inet6Address i6adr = (Inet6Address) iadr; + NetworkInterface nif = i6adr.getScopedInterface(); + if (nif == null) + continue; + + String nifName = nif.getName(); + String i6adrHostAddress = i6adr.getHostAddress(); + int index = i6adrHostAddress.indexOf('%'); + String i6adrScopeName = i6adrHostAddress.substring(index+1); + + if (!nifName.equals(i6adrScopeName)) + throw new RuntimeException("Expected nifName [" + + nifName + "], to equal i6adrScopeName [" + + i6adrScopeName + "] "); + } + } + } + } +} + diff --git a/jdk/test/java/net/InetAddress/ptr/lookup.sh b/jdk/test/java/net/InetAddress/ptr/lookup.sh index 2fd08315746..3ff73a31621 100644 --- a/jdk/test/java/net/InetAddress/ptr/lookup.sh +++ b/jdk/test/java/net/InetAddress/ptr/lookup.sh @@ -53,13 +53,13 @@ echo "$HOST --> $ADDR" # IPv4 reverse lookup echo '' -OUT1=`$JAVA -Djava.net.preferIPv4Stack=true Lookup -q=PTR $ADDR` +OUT1=`$JAVA ${TESTVMOPTS} -Djava.net.preferIPv4Stack=true Lookup -q=PTR $ADDR` echo "(IPv4) $ADDR --> $OUT1" # reverse lookup (default) echo '' -OUT2=`$JAVA Lookup -q=PTR $ADDR` +OUT2=`$JAVA ${TESTVMOPTS} Lookup -q=PTR $ADDR` echo "(default) $ADDR --> $OUT2" diff --git a/jdk/test/java/net/ProxySelector/MultiThreadedSystemProxies.java b/jdk/test/java/net/ProxySelector/MultiThreadedSystemProxies.java index 63a385cb09a..59d04d8bb68 100644 --- a/jdk/test/java/net/ProxySelector/MultiThreadedSystemProxies.java +++ b/jdk/test/java/net/ProxySelector/MultiThreadedSystemProxies.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/net/ServerSocket/AcceptCauseFileDescriptorLeak.sh b/jdk/test/java/net/ServerSocket/AcceptCauseFileDescriptorLeak.sh index 5b039487286..df85f49feb7 100644 --- a/jdk/test/java/net/ServerSocket/AcceptCauseFileDescriptorLeak.sh +++ b/jdk/test/java/net/ServerSocket/AcceptCauseFileDescriptorLeak.sh @@ -45,4 +45,4 @@ if [ "$NOFILES" = "unlimited" ] || [ $NOFILES -ge 1024 ]; then ulimit -n 1024 fi -${TESTJAVA}/bin/java AcceptCauseFileDescriptorLeak +${TESTJAVA}/bin/java ${TESTVMOPTS} AcceptCauseFileDescriptorLeak diff --git a/jdk/test/java/net/Socket/OldSocketImpl.sh b/jdk/test/java/net/Socket/OldSocketImpl.sh index 5f429d1e4ee..bbe055fa2ea 100644 --- a/jdk/test/java/net/Socket/OldSocketImpl.sh +++ b/jdk/test/java/net/Socket/OldSocketImpl.sh @@ -50,7 +50,7 @@ esac # with 1.3 and in OldStyleImpl.jar # run -${TESTJAVA}${FS}bin${FS}java -cp ${TESTSRC}${FS}OldSocketImpl.jar OldSocketImpl +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTSRC}${FS}OldSocketImpl.jar OldSocketImpl result=$? if [ "$result" -ne "0" ]; then exit 1 diff --git a/jdk/test/java/net/Socks/SocksV4Test.java b/jdk/test/java/net/Socks/SocksV4Test.java index 01546c17126..b61d658a78a 100644 --- a/jdk/test/java/net/Socks/SocksV4Test.java +++ b/jdk/test/java/net/Socks/SocksV4Test.java @@ -26,20 +26,26 @@ * @bug 4727547 * @summary SocksSocketImpl throws NullPointerException * @build SocksServer - * @run main SocksV4Test */ import java.net.*; public class SocksV4Test { + + // An unresolvable host + static final String HOSTNAME = "doesnot.exist.invalid"; + public static void main(String[] args) throws Exception { + // sanity before running the test + assertUnresolvableHost(HOSTNAME); + // Create a SOCKS V4 proxy SocksServer srvr = new SocksServer(0, true); srvr.start(); Proxy sp = new Proxy(Proxy.Type.SOCKS, new InetSocketAddress("localhost", srvr.getPort())); // Let's create an unresolved address - InetSocketAddress ad = new InetSocketAddress("doesnt.exist.name", 1234); + InetSocketAddress ad = new InetSocketAddress(HOSTNAME, 1234); try (Socket s = new Socket(sp)) { s.connect(ad, 10000); } catch (UnknownHostException ex) { @@ -51,4 +57,15 @@ public class SocksV4Test { srvr.terminate(); } } + + static void assertUnresolvableHost(String host) { + InetAddress addr = null; + try { + addr = InetAddress.getByName(host); + } catch (UnknownHostException x) { + // OK, expected + } + if (addr != null) + throw new RuntimeException("Test cannot run. resolvable address:" + addr); + } } diff --git a/jdk/test/java/net/URL/B5086147.sh b/jdk/test/java/net/URL/B5086147.sh index e92a8ee2892..e5830b9ecce 100644 --- a/jdk/test/java/net/URL/B5086147.sh +++ b/jdk/test/java/net/URL/B5086147.sh @@ -47,7 +47,7 @@ ${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}B5086147.java failures=0 echo '' -${TESTJAVA}${FS}bin${FS}java B5086147 +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} B5086147 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi if [ "$failures" != "0" ]; then diff --git a/jdk/test/java/net/URL/runconstructor.sh b/jdk/test/java/net/URL/runconstructor.sh index 340f1e91f56..5a8f09073d9 100644 --- a/jdk/test/java/net/URL/runconstructor.sh +++ b/jdk/test/java/net/URL/runconstructor.sh @@ -50,7 +50,7 @@ failures=0 go() { echo '' - ${TESTJAVA}${FS}bin${FS}java Constructor $1 + ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} Constructor $1 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi } diff --git a/jdk/test/java/net/URLClassLoader/B5077773.sh b/jdk/test/java/net/URLClassLoader/B5077773.sh index b489769ebba..725829e58e5 100644 --- a/jdk/test/java/net/URLClassLoader/B5077773.sh +++ b/jdk/test/java/net/URLClassLoader/B5077773.sh @@ -61,5 +61,5 @@ cp ${TESTSRC}${FS}foo.jar . ${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}B5077773.java WD=`pwd` -${TESTJAVA}${FS}bin${FS}java B5077773 +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} B5077773 diff --git a/jdk/test/java/net/URLClassLoader/getresourceasstream/test.sh b/jdk/test/java/net/URLClassLoader/getresourceasstream/test.sh index 11aa9bf5358..1654f314f88 100644 --- a/jdk/test/java/net/URLClassLoader/getresourceasstream/test.sh +++ b/jdk/test/java/net/URLClassLoader/getresourceasstream/test.sh @@ -46,11 +46,11 @@ checkExit () { ${TESTJAVA}/bin/javac -d . ${TESTSRC}/Test.java cp ${TESTSRC}/test.jar . -${TESTJAVA}/bin/java Test +${TESTJAVA}/bin/java ${TESTVMOPTS} Test checkExit # try with security manager -${TESTJAVA}/bin/java -Djava.security.policy=file:./policy -Djava.security.manager Test +${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.security.policy=file:./policy -Djava.security.manager Test checkExit exit 0 diff --git a/jdk/test/java/net/URLClassLoader/sealing/checksealed.sh b/jdk/test/java/net/URLClassLoader/sealing/checksealed.sh index c2a048aff59..b675eb2f1a2 100644 --- a/jdk/test/java/net/URLClassLoader/sealing/checksealed.sh +++ b/jdk/test/java/net/URLClassLoader/sealing/checksealed.sh @@ -56,7 +56,7 @@ if [ x"$TESTSRC" = x ]; then TESTSRC=.; fi CLASSPATH=".${PS}${TESTSRC}${FS}a${PS}${TESTSRC}${FS}b.jar" ${TESTJAVA}${FS}bin${FS}javac -classpath "${CLASSPATH}" -d . ${TESTSRC}${FS}CheckSealed.java -${TESTJAVA}${FS}bin${FS}java -cp "${CLASSPATH}" CheckSealed 1 +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -cp "${CLASSPATH}" CheckSealed 1 if [ $? != 0 ]; then exit 1; fi -${TESTJAVA}${FS}bin${FS}java -cp "${CLASSPATH}" CheckSealed 2 +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -cp "${CLASSPATH}" CheckSealed 2 if [ $? != 0 ]; then exit 1; fi diff --git a/jdk/test/java/net/URLConnection/6212146/test.sh b/jdk/test/java/net/URLConnection/6212146/test.sh index 56a628a427e..22c6473c77e 100644 --- a/jdk/test/java/net/URLConnection/6212146/test.sh +++ b/jdk/test/java/net/URLConnection/6212146/test.sh @@ -67,7 +67,7 @@ ${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}Test.java WD=`pwd` ulimit -H -n 300 -${TESTJAVA}${FS}bin${FS}java Test ${WD}/jars/ test.jar +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} Test ${WD}/jars/ test.jar result=$? rm -rf jars exit $? diff --git a/jdk/test/java/net/URLConnection/UNCTest.sh b/jdk/test/java/net/URLConnection/UNCTest.sh index 502403b506d..aa9f1842613 100644 --- a/jdk/test/java/net/URLConnection/UNCTest.sh +++ b/jdk/test/java/net/URLConnection/UNCTest.sh @@ -36,7 +36,7 @@ OS=`uname -s` case "$OS" in Windows_95 | Windows_98 | Windows_NT ) ${TESTJAVA}/bin/javac -d . ${TESTSRC}\\UNCTest.java - ${TESTJAVA}/bin/java UNCTest ${UNC} + ${TESTJAVA}/bin/java ${TESTVMOPTS} UNCTest ${UNC} exit ;; diff --git a/jdk/test/java/nio/Buffer/LimitDirectMemory.sh b/jdk/test/java/nio/Buffer/LimitDirectMemory.sh index 38e8c0c05fa..027d6279b49 100644 --- a/jdk/test/java/nio/Buffer/LimitDirectMemory.sh +++ b/jdk/test/java/nio/Buffer/LimitDirectMemory.sh @@ -34,7 +34,7 @@ TMP1=tmp_$$ runTest() { echo "Testing: $*" - ${TESTJAVA}/bin/java $* + ${TESTJAVA}/bin/java ${TESTVMOPTS} $* if [ $? -eq 0 ] then echo "--- passed as expected" else @@ -43,10 +43,11 @@ runTest() { fi } + launchFail() { echo "Testing: -XX:MaxDirectMemorySize=$* -cp ${TESTCLASSES} \ LimitDirectMemory true DEFAULT DEFAULT+1M" - ${TESTJAVA}/bin/java -XX:MaxDirectMemorySize=$* -cp ${TESTCLASSES} \ + ${TESTJAVA}/bin/java ${TESTVMOPTS} -XX:MaxDirectMemorySize=$* -cp ${TESTCLASSES} \ LimitDirectMemory true DEFAULT DEFAULT+1M > ${TMP1} 2>&1 cat ${TMP1} cat ${TMP1} | grep -s "Unrecognized VM option: \'MaxDirectMemorySize=" diff --git a/jdk/test/java/nio/channels/AsynchronousChannelGroup/run_any_task.sh b/jdk/test/java/nio/channels/AsynchronousChannelGroup/run_any_task.sh index 6849315e69a..8136634d205 100644 --- a/jdk/test/java/nio/channels/AsynchronousChannelGroup/run_any_task.sh +++ b/jdk/test/java/nio/channels/AsynchronousChannelGroup/run_any_task.sh @@ -46,7 +46,7 @@ $JAR -cf "${TESTCLASSES}/Privileged.jar" \ -C "${TESTCLASSES}" Attack.class echo "Running test ..." -$JAVA -XX:-UseVMInterruptibleIO \ - -Xbootclasspath/a:"${TESTCLASSES}/Privileged.jar" \ - -classpath "${TESTCLASSES}" \ - AsExecutor +$JAVA ${TESTVMOPTS} \ + -Xbootclasspath/a:"${TESTCLASSES}/Privileged.jar" \ + -classpath "${TESTCLASSES}" \ + AsExecutor diff --git a/jdk/test/java/nio/channels/spi/AsynchronousChannelProvider/custom_provider.sh b/jdk/test/java/nio/channels/spi/AsynchronousChannelProvider/custom_provider.sh index c334192a231..bf8246501e9 100644 --- a/jdk/test/java/nio/channels/spi/AsynchronousChannelProvider/custom_provider.sh +++ b/jdk/test/java/nio/channels/spi/AsynchronousChannelProvider/custom_provider.sh @@ -51,7 +51,7 @@ failures=0 go() { echo '' - $JAVA $1 $2 $3 2>&1 + $JAVA ${TESTVMOPTS} $1 $2 $3 2>&1 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi } diff --git a/jdk/test/java/nio/charset/Charset/default.sh b/jdk/test/java/nio/charset/Charset/default.sh index 5a91ea10c18..c93aa71bdef 100644 --- a/jdk/test/java/nio/charset/Charset/default.sh +++ b/jdk/test/java/nio/charset/Charset/default.sh @@ -64,7 +64,7 @@ go() { ecs="$1"; shift echo -n "$L: " - cs="`LC_ALL=$L $JAVA -cp $TESTCLASSES Default`" + cs="`LC_ALL=$L $JAVA ${TESTVMOPTS} -cp $TESTCLASSES Default`" if [ $? != 0 ]; then exit 1 elif [ "`tolower $cs`" != "`tolower $ecs`" ]; then diff --git a/jdk/test/java/nio/charset/coders/CheckSJISMappingProp.sh b/jdk/test/java/nio/charset/coders/CheckSJISMappingProp.sh index 49caa0dfebb..fd76d5a5031 100644 --- a/jdk/test/java/nio/charset/coders/CheckSJISMappingProp.sh +++ b/jdk/test/java/nio/charset/coders/CheckSJISMappingProp.sh @@ -51,7 +51,7 @@ expectPass() { } -JAVA="${TESTJAVA}/bin/java -cp ${TESTCLASSES}" +JAVA="${TESTJAVA}/bin/java ${TESTVMOPTS} -cp ${TESTCLASSES}" runTest() { echo "Testing:" ${1} LC_ALL="$1" ; export LC_ALL diff --git a/jdk/test/java/nio/charset/spi/basic.sh b/jdk/test/java/nio/charset/spi/basic.sh index c1bdd45dd02..e4f89c5823c 100644 --- a/jdk/test/java/nio/charset/spi/basic.sh +++ b/jdk/test/java/nio/charset/spi/basic.sh @@ -116,7 +116,7 @@ for where in ext app; do av="$av -Djava.security.manager -Djava.security.policy==$TESTSRC/charsetProvider.sp";; esac - if (set -x; $JAVA $av Test $css) 2>&1; then + if (set -x; $JAVA ${TESTVMOPTS} $av Test $css) 2>&1; then continue; else failures=`expr $failures + 1` diff --git a/jdk/test/java/nio/file/Files/delete_on_close.sh b/jdk/test/java/nio/file/Files/delete_on_close.sh index 7ffa009a817..f6a58683be6 100644 --- a/jdk/test/java/nio/file/Files/delete_on_close.sh +++ b/jdk/test/java/nio/file/Files/delete_on_close.sh @@ -51,7 +51,7 @@ export CLASSPATH TMPFILE="$$.tmp" touch $TMPFILE -$JAVA DeleteOnClose $TMPFILE 2>&1 +$JAVA ${TESTVMOPTS} DeleteOnClose $TMPFILE 2>&1 if [ $? != 0 ]; then exit 1; fi if [ -f $TMPFILE ]; then echo "$TMPFILE was not deleted" diff --git a/jdk/test/java/nio/file/Files/walkFileTree/walk_file_tree.sh b/jdk/test/java/nio/file/Files/walkFileTree/walk_file_tree.sh index dee0dd06f71..6c9d7dc89d3 100644 --- a/jdk/test/java/nio/file/Files/walkFileTree/walk_file_tree.sh +++ b/jdk/test/java/nio/file/Files/walkFileTree/walk_file_tree.sh @@ -56,7 +56,7 @@ if [ $? != 0 ]; then exit 1; fi failures=0 # print the file tree and compare output with find(1) -$JAVA PrintFileTree "$ROOT" > out1 +$JAVA ${TESTVMOPTS} PrintFileTree "$ROOT" > out1 find "$ROOT" > out2 diff out1 out2 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi @@ -66,26 +66,26 @@ if [ $? != 0 ]; then failures=`expr $failures + 1`; fi # not. For that reason we run PrintFileTree with the -printCycles # option when the output without this option differs to find(1). find "$ROOT" -follow > out1 -$JAVA PrintFileTree -follow "$ROOT" > out2 +$JAVA ${TESTVMOPTS} PrintFileTree -follow "$ROOT" > out2 diff out1 out2 if [ $? != 0 ]; then # re-run printing cycles to stdout - $JAVA PrintFileTree -follow -printCycles "$ROOT" > out2 + $JAVA ${TESTVMOPTS} PrintFileTree -follow -printCycles "$ROOT" > out2 diff out1 out2 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi fi # test SKIP_SIBLINGS -$JAVA SkipSiblings "$ROOT" +$JAVA ${TESTVMOPTS} SkipSiblings "$ROOT" if [ $? != 0 ]; then failures=`expr $failures + 1`; fi # test TERMINATE -$JAVA TerminateWalk "$ROOT" +$JAVA ${TESTVMOPTS} TerminateWalk "$ROOT" if [ $? != 0 ]; then failures=`expr $failures + 1`; fi # test maxDepth -$JAVA MaxDepth "$ROOT" +$JAVA ${TESTVMOPTS} MaxDepth "$ROOT" if [ $? != 0 ]; then failures=`expr $failures + 1`; fi # clean-up diff --git a/jdk/test/java/nio/file/Path/MacPathTest.sh b/jdk/test/java/nio/file/Path/MacPathTest.sh index e81c62ae906..e5d410bd112 100644 --- a/jdk/test/java/nio/file/Path/MacPathTest.sh +++ b/jdk/test/java/nio/file/Path/MacPathTest.sh @@ -36,4 +36,4 @@ if [ "x$TESTJAVA" = x ]; then TESTCLASSES=. fi -export LC_ALL=en_US.UTF-8; ${TESTJAVA}/bin/java -cp ${TESTCLASSES} MacPathTest +export LC_ALL=en_US.UTF-8; ${TESTJAVA}/bin/java ${TESTVMOPTS} -cp ${TESTCLASSES} MacPathTest diff --git a/jdk/test/java/rmi/MarshalledObject/compare/Compare.java b/jdk/test/java/rmi/MarshalledObject/compare/Compare.java index 96ea46f76db..20322646920 100644 --- a/jdk/test/java/rmi/MarshalledObject/compare/Compare.java +++ b/jdk/test/java/rmi/MarshalledObject/compare/Compare.java @@ -29,7 +29,6 @@ * not involved in location should be compared. * @author Ken Arnold * - * @build Compare * @run main Compare 11 annotatedRef */ diff --git a/jdk/test/java/rmi/MarshalledObject/compare/HashCode.java b/jdk/test/java/rmi/MarshalledObject/compare/HashCode.java index 6a0266b927b..768e418ae5b 100644 --- a/jdk/test/java/rmi/MarshalledObject/compare/HashCode.java +++ b/jdk/test/java/rmi/MarshalledObject/compare/HashCode.java @@ -27,7 +27,6 @@ * @summary MarshalledObject with null throws NullPointerException * @author Ken Arnold * - * @build HashCode * @run main HashCode 11 annotatedRef */ diff --git a/jdk/test/java/rmi/MarshalledObject/compare/NullReference.java b/jdk/test/java/rmi/MarshalledObject/compare/NullReference.java index f8ff9a1a4fa..5210e948b51 100644 --- a/jdk/test/java/rmi/MarshalledObject/compare/NullReference.java +++ b/jdk/test/java/rmi/MarshalledObject/compare/NullReference.java @@ -27,7 +27,6 @@ * @summary MarshalledObject with null throws NullPointerException * @author Ken Arnold * - * @build NullReference * @run main NullReference */ diff --git a/jdk/test/java/rmi/Naming/DefaultRegistryPort.java b/jdk/test/java/rmi/Naming/DefaultRegistryPort.java index 4290bf563be..a4c49792536 100644 --- a/jdk/test/java/rmi/Naming/DefaultRegistryPort.java +++ b/jdk/test/java/rmi/Naming/DefaultRegistryPort.java @@ -28,7 +28,6 @@ * @author Dana Burns * @library ../testlibrary * @build TestLibrary - * @build DefaultRegistryPort * @run main DefaultRegistryPort */ diff --git a/jdk/test/java/rmi/Naming/LookupIPv6.java b/jdk/test/java/rmi/Naming/LookupIPv6.java index ebdd9f3efae..da6c62cbc83 100644 --- a/jdk/test/java/rmi/Naming/LookupIPv6.java +++ b/jdk/test/java/rmi/Naming/LookupIPv6.java @@ -22,12 +22,11 @@ */ /* @test + * @summary Ensure that java.rmi.Naming.lookup can handle URLs containing + * IPv6 addresses. * @bug 4402708 * * @run main/othervm -Djava.net.preferIPv6Addresses=true LookupIPv6 - * - * @summary Ensure that java.rmi.Naming.lookup can handle URLs containing - * IPv6 addresses. */ import java.net.InetAddress; diff --git a/jdk/test/java/rmi/Naming/RmiIsNoScheme.java b/jdk/test/java/rmi/Naming/RmiIsNoScheme.java index 865a07c995d..fe6d1ab4031 100644 --- a/jdk/test/java/rmi/Naming/RmiIsNoScheme.java +++ b/jdk/test/java/rmi/Naming/RmiIsNoScheme.java @@ -30,7 +30,6 @@ * * @library ../testlibrary * @build TestLibrary - * @build RmiIsNoScheme * @run main/othervm RmiIsNoScheme */ diff --git a/jdk/test/java/rmi/Naming/UnderscoreHost.java b/jdk/test/java/rmi/Naming/UnderscoreHost.java index 0d7375693c4..b88ca628e9a 100644 --- a/jdk/test/java/rmi/Naming/UnderscoreHost.java +++ b/jdk/test/java/rmi/Naming/UnderscoreHost.java @@ -29,8 +29,7 @@ * @author Vinod Johnson * * @library ../testlibrary - * @build TestLibrary - * @build UnderscoreHost UnderscoreHost_Stub + * @build TestLibrary UnderscoreHost_Stub * @run main/othervm UnderscoreHost */ diff --git a/jdk/test/java/rmi/Naming/legalRegistryNames/LegalRegistryNames.java b/jdk/test/java/rmi/Naming/legalRegistryNames/LegalRegistryNames.java index 0d367974b2e..725d9ca6c7a 100644 --- a/jdk/test/java/rmi/Naming/legalRegistryNames/LegalRegistryNames.java +++ b/jdk/test/java/rmi/Naming/legalRegistryNames/LegalRegistryNames.java @@ -21,14 +21,13 @@ * questions. */ -/** +/* * @test * @bug 4254808 * @summary Naming assumes '/' is present in relative URL; change in URL causes regression * @author Dana Burns * @library ../../testlibrary - * @build TestLibrary - * @build Legal LegalRegistryNames LegalRegistryNames_Stub + * @build TestLibrary Legal LegalRegistryNames_Stub * @run main LegalRegistryNames */ diff --git a/jdk/test/java/rmi/RMISecurityManager/checkPackageAccess/CheckPackageAccess.java b/jdk/test/java/rmi/RMISecurityManager/checkPackageAccess/CheckPackageAccess.java index 648708869ad..32cbe5ff481 100644 --- a/jdk/test/java/rmi/RMISecurityManager/checkPackageAccess/CheckPackageAccess.java +++ b/jdk/test/java/rmi/RMISecurityManager/checkPackageAccess/CheckPackageAccess.java @@ -28,10 +28,9 @@ * as when the default java.lang.SecurityManager is set, which with the * default "java.security" file in the JDK means that access to packages in * the sun.* package hierarchy is denied (without explicit runtime permission - * "accessClassInPackge.*"). + * "accessClassInPackage.*"). * @author Peter Jones * - * @build CheckPackageAccess * @run main/othervm CheckPackageAccess */ diff --git a/jdk/test/java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.java b/jdk/test/java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.java index 9bd8475a44b..fce32f9f06a 100644 --- a/jdk/test/java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.java +++ b/jdk/test/java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.java @@ -36,8 +36,7 @@ * functionality is in place * * @library ../../../testlibrary - * @build TestLibrary RMID - * @build ActivateMe CheckActivateRef_Stub CheckActivateRef + * @build TestLibrary RMID ActivateMe CheckActivateRef_Stub * @run main/othervm/policy=security.policy/timeout=240 -Djava.rmi.server.ignoreStubClasses=true CheckActivateRef * @run main/othervm/policy=security.policy/timeout=240 -Djava.rmi.server.ignoreStubClasses=false CheckActivateRef */ diff --git a/jdk/test/java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations.java b/jdk/test/java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations.java index ae7b843b1a9..b6e4abd433c 100644 --- a/jdk/test/java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations.java +++ b/jdk/test/java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations.java @@ -28,10 +28,7 @@ * @author Laird Dornin; code borrowed from Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary RMID JavaVM StreamPipe - * @build MyRMI - * @build CheckAnnotations - * @build CheckAnnotations_Stub + * @build TestLibrary RMID MyRMI CheckAnnotations_Stub * @run main/othervm/policy=security.policy/timeout=480 CheckAnnotations */ diff --git a/jdk/test/java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java b/jdk/test/java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java index e3a1467ceee..3d0694107e9 100644 --- a/jdk/test/java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java +++ b/jdk/test/java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java @@ -24,14 +24,11 @@ /* @test * @bug 4289544 * @summary ActivationGroupImpl.newInstance does not set context classloader for impl - * * @author Laird Dornin; code borrowed from Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary RMID JavaVM StreamPipe - * @build MyRMI - * @build CheckImplClassLoader ActivatableImpl - * @build ActivatableImpl ActivatableImpl_Stub + * @build TestLibrary RMID + * MyRMI ActivatableImpl ActivatableImpl ActivatableImpl_Stub * @run main/othervm/policy=security.policy/timeout=150 CheckImplClassLoader */ diff --git a/jdk/test/java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog.java b/jdk/test/java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog.java index 59f5c99dc77..b46142f1a2a 100644 --- a/jdk/test/java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog.java +++ b/jdk/test/java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog.java @@ -27,8 +27,8 @@ * @author Ann Wollrath * * @library ../../../testlibrary - * @build RMID ActivationLibrary TestLibrary - * @build ActivateMe CheckRegisterInLog CheckRegisterInLog_Stub + * @build TestLibrary RMID ActivationLibrary + * ActivateMe CheckRegisterInLog_Stub * @run main/othervm/policy=security.policy/timeout=240 CheckRegisterInLog */ diff --git a/jdk/test/java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.java b/jdk/test/java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.java index 4d4d0736722..41a28868ecd 100644 --- a/jdk/test/java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.java +++ b/jdk/test/java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.java @@ -22,14 +22,12 @@ */ /* @test - * @author Laird Dornin * @bug 4164971 * @summary allow non-public activatable class and/or constructor + * @author Laird Dornin * * @library ../../../testlibrary - * @build TestLibrary RMID - * @build ActivateMe - * @build CreatePrivateActivatable + * @build TestLibrary RMID ActivateMe * @run main/othervm/policy=security.policy/timeout=240 CreatePrivateActivatable */ diff --git a/jdk/test/java/rmi/activation/Activatable/downloadParameterClass/DownloadParameterClass.java b/jdk/test/java/rmi/activation/Activatable/downloadParameterClass/DownloadParameterClass.java index 1bb909a79bf..42d309b34d9 100644 --- a/jdk/test/java/rmi/activation/Activatable/downloadParameterClass/DownloadParameterClass.java +++ b/jdk/test/java/rmi/activation/Activatable/downloadParameterClass/DownloadParameterClass.java @@ -32,11 +32,7 @@ * * @library ../../../testlibrary * @build TestLibrary RMID ActivationLibrary - * @build DownloadParameterClass - * @build Foo - * @build FooReceiverImpl - * @build FooReceiverImpl_Stub - * @build Bar + * Foo FooReceiverImpl FooReceiverImpl_Stub Bar * @run main/othervm/policy=security.policy/timeout=240 DownloadParameterClass */ diff --git a/jdk/test/java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod.java b/jdk/test/java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod.java index 3d82bfb86af..7ee451d7328 100644 --- a/jdk/test/java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod.java +++ b/jdk/test/java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod.java @@ -23,14 +23,11 @@ /* @test * @bug 4128620 - * * @summary synopsis: NoSuchMethodError should be elucidated - * * @author Laird Dornin * * @library ../../../testlibrary - * @build TestLibrary RMID - * @build ActivateMe ElucidateNoSuchMethod ElucidateNoSuchMethod_Stub + * @build TestLibrary RMID ActivateMe ElucidateNoSuchMethod_Stub * @run main/othervm/policy=security.policy/timeout=240 ElucidateNoSuchMethod */ diff --git a/jdk/test/java/rmi/activation/Activatable/extLoadedImpl/ext.sh b/jdk/test/java/rmi/activation/Activatable/extLoadedImpl/ext.sh index 7d15638cdb1..4f758b410c4 100644 --- a/jdk/test/java/rmi/activation/Activatable/extLoadedImpl/ext.sh +++ b/jdk/test/java/rmi/activation/Activatable/extLoadedImpl/ext.sh @@ -51,5 +51,5 @@ rm classes/ExtLoadedImpl.class classes/ExtLoadedImpl_Stub.class classes/CheckLoa mkdir -p ext $TESTJAVA/bin/jar cf ext/ext.jar -C $TESTCLASSES ExtLoadedImpl.class -C $TESTCLASSES ExtLoadedImpl_Stub.class -C $TESTCLASSES CheckLoader.class -$TESTJAVA/bin/java -cp classes -Dtest.src=$TESTSRC -Dtest.classes=$TESTCLASSES -Djava.security.policy=$TESTSRC/security.policy -Djava.ext.dirs=ext ExtLoadedImplTest +$TESTJAVA/bin/java ${TESTVMOPTS} -cp classes -Dtest.src=$TESTSRC -Dtest.classes=$TESTCLASSES -Djava.security.policy=$TESTSRC/security.policy -Djava.ext.dirs=ext ExtLoadedImplTest diff --git a/jdk/test/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot.java b/jdk/test/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot.java index 679114806ff..9af0bf31600 100644 --- a/jdk/test/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot.java +++ b/jdk/test/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot.java @@ -27,9 +27,8 @@ * @author Laird Dornin * * @library ../../../testlibrary - * @build ActivateMe - * @build ForceLogSnapshot - * @build ForceLogSnapshot_Stub + * @build TestLibrary RMID ActivationLibrary + * ActivateMe ForceLogSnapshot_Stub * @run main/othervm/policy=security.policy/timeout=640 ForceLogSnapshot */ diff --git a/jdk/test/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java b/jdk/test/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java index a1b02b1eab4..238d3473a9e 100644 --- a/jdk/test/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java +++ b/jdk/test/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java @@ -29,10 +29,7 @@ * @author Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary RMID ActivationLibrary - * @build ActivateMe - * @build InactiveGroup - * @build InactiveGroup_Stub + * @build TestLibrary RMID ActivationLibrary ActivateMe InactiveGroup_Stub * @run main/othervm/policy=security.policy/timeout=240 InactiveGroup */ diff --git a/jdk/test/java/rmi/activation/Activatable/lookupActivationSystem/LookupActivationSystem.java b/jdk/test/java/rmi/activation/Activatable/lookupActivationSystem/LookupActivationSystem.java index eee264f2985..ce154c4ca99 100644 --- a/jdk/test/java/rmi/activation/Activatable/lookupActivationSystem/LookupActivationSystem.java +++ b/jdk/test/java/rmi/activation/Activatable/lookupActivationSystem/LookupActivationSystem.java @@ -24,14 +24,12 @@ /* * @test * @bug 6245733 - * * @summary synopsis: rmid's registry's list operation doesn't include * activation system * @author Ann Wollrath * * @library ../../../testlibrary * @build TestLibrary RMID ActivationLibrary - * @build LookupActivationSystem * @run main/othervm/timeout=240 LookupActivationSystem */ diff --git a/jdk/test/java/rmi/activation/Activatable/nestedActivate/NestedActivate.java b/jdk/test/java/rmi/activation/Activatable/nestedActivate/NestedActivate.java index 9ad2d5482dc..2cd5a634534 100644 --- a/jdk/test/java/rmi/activation/Activatable/nestedActivate/NestedActivate.java +++ b/jdk/test/java/rmi/activation/Activatable/nestedActivate/NestedActivate.java @@ -23,15 +23,11 @@ /* @test * @bug 4138056 - * * @summary synopsis: Activating objects from an Activatable constructor causes deadlock * @author Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary RMID ActivationLibrary - * @build ActivateMe - * @build NestedActivate - * @build NestedActivate_Stub + * @build TestLibrary RMID ActivationLibrary ActivateMe NestedActivate_Stub * @run main/othervm/policy=security.policy/timeout=240 NestedActivate */ diff --git a/jdk/test/java/rmi/activation/Activatable/nonExistentActivatable/NonExistentActivatable.java b/jdk/test/java/rmi/activation/Activatable/nonExistentActivatable/NonExistentActivatable.java index 76d68e9970a..625661ba432 100644 --- a/jdk/test/java/rmi/activation/Activatable/nonExistentActivatable/NonExistentActivatable.java +++ b/jdk/test/java/rmi/activation/Activatable/nonExistentActivatable/NonExistentActivatable.java @@ -23,16 +23,13 @@ /* @test * @bug 4115296 - * * @summary synopsis: NoSuchObjectException not thrown for non-existent * activatable objects * @author Ann Wollrath * * @library ../../../testlibrary * @build TestLibrary RMID ActivationLibrary - * @build ActivateMe - * @build NonExistentActivatable - * @build NonExistentActivatable_Stub + * ActivateMe NonExistentActivatable_Stub * @run main/othervm/policy=security.policy/timeout=240 NonExistentActivatable */ diff --git a/jdk/test/java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService.java b/jdk/test/java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService.java index 164a84209bb..b403c28441b 100644 --- a/jdk/test/java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService.java +++ b/jdk/test/java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService.java @@ -28,10 +28,7 @@ * @author Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary RMID JavaVM StreamPipe - * @build ActivateMe - * @build RestartCrashedService - * @build RestartCrashedService_Stub + * @build TestLibrary RMID ActivateMe RestartCrashedService_Stub * @run main/othervm/policy=security.policy/timeout=240 RestartCrashedService */ diff --git a/jdk/test/java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer.java b/jdk/test/java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer.java index 31750985e6d..c53053e7315 100644 --- a/jdk/test/java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer.java +++ b/jdk/test/java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer.java @@ -28,8 +28,7 @@ * * @library ../../../testlibrary * @build TestLibrary RMID ActivationLibrary - * @build RestartLatecomer - * @build RestartLatecomer_Stub + * RestartLatecomer RestartLatecomer_Stub * @run main/othervm/policy=security.policy/timeout=240 RestartLatecomer */ diff --git a/jdk/test/java/rmi/activation/Activatable/restartService/RestartService.java b/jdk/test/java/rmi/activation/Activatable/restartService/RestartService.java index a98ce832a2b..973916f083e 100644 --- a/jdk/test/java/rmi/activation/Activatable/restartService/RestartService.java +++ b/jdk/test/java/rmi/activation/Activatable/restartService/RestartService.java @@ -23,15 +23,11 @@ /* @test * @bug 4095165 4321151 - * @summary synopsis: activator should restart daemon services * @author Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary RMID ActivationLibrary - * @build ActivateMe - * @build RestartService - * @build RestartService_Stub + * @build TestLibrary RMID ActivationLibrary ActivateMe RestartService_Stub * @run main/othervm/policy=security.policy/timeout=240 RestartService */ diff --git a/jdk/test/java/rmi/activation/Activatable/shutdownGracefully/ShutdownGracefully.java b/jdk/test/java/rmi/activation/Activatable/shutdownGracefully/ShutdownGracefully.java index 162eb3861e4..64233bfd6f1 100644 --- a/jdk/test/java/rmi/activation/Activatable/shutdownGracefully/ShutdownGracefully.java +++ b/jdk/test/java/rmi/activation/Activatable/shutdownGracefully/ShutdownGracefully.java @@ -28,11 +28,8 @@ * @author Laird Dornin; code borrowed from Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary RMID JavaVM StreamPipe - * @build TestSecurityManager - * @build RegisteringActivatable - * @build ShutdownGracefully - * @build ShutdownGracefully_Stub + * @build TestLibrary RMID + * TestSecurityManager RegisteringActivatable ShutdownGracefully_Stub * @run main/othervm/policy=security.policy/timeout=700 ShutdownGracefully */ diff --git a/jdk/test/java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive.java b/jdk/test/java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive.java index 5d8c50c5641..412901ea742 100644 --- a/jdk/test/java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive.java +++ b/jdk/test/java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive.java @@ -23,16 +23,12 @@ /* @test * @bug 4115331 - * @summary synopsis: activatable object fails to go inactive after * unregister/inactive sequence. * @author Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary RMID ActivationLibrary - * @build ActivateMe - * @build UnregisterInactive - * @build UnregisterInactive_Stub + * @build TestLibrary RMID ActivationLibrary ActivateMe UnregisterInactive_Stub * @run main/othervm/policy=security.policy/timeout=240 UnregisterInactive */ diff --git a/jdk/test/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails.java b/jdk/test/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails.java index a5a5b0d374d..a7d7643977b 100644 --- a/jdk/test/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails.java +++ b/jdk/test/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails.java @@ -31,11 +31,8 @@ * @author Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary RMID JavaVM StreamPipe - * @build ActivateMe - * @build ActivateFails - * @build ActivateFails_Stub - * @build ShutdownThread + * @build TestLibrary RMID ActivationLibrary + * ActivateMe ActivateFails_Stub ShutdownThread * @run main/othervm/policy=security.policy/timeout=240 ActivateFails */ diff --git a/jdk/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java b/jdk/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java index f7f8643333c..880f1e8a8a6 100644 --- a/jdk/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java +++ b/jdk/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java @@ -33,9 +33,7 @@ * * @library ../../../testlibrary * @build TestLibrary RMID ActivationLibrary - * @build MyActivationGroupImpl - * @build DownloadActivationGroup - * @build DownloadActivationGroup_Stub + * DownloadActivationGroup MyActivationGroupImpl DownloadActivationGroup_Stub * @run main/othervm/policy=security.policy/timeout=240 DownloadActivationGroup */ diff --git a/jdk/test/java/rmi/activation/ActivationGroupDesc/checkDefaultGroupName/CheckDefaultGroupName.java b/jdk/test/java/rmi/activation/ActivationGroupDesc/checkDefaultGroupName/CheckDefaultGroupName.java index bd475029687..f37cbaeb79f 100644 --- a/jdk/test/java/rmi/activation/ActivationGroupDesc/checkDefaultGroupName/CheckDefaultGroupName.java +++ b/jdk/test/java/rmi/activation/ActivationGroupDesc/checkDefaultGroupName/CheckDefaultGroupName.java @@ -21,16 +21,15 @@ * questions. */ -/** +/* * @test * @bug 4252236 * @summary ActivationGroupDesc should not do early binding of default classname - * @library ../../../testlibrary - * - * @build CheckDefaultGroupName - * - * @run main CheckDefaultGroupName * @author Laird Dornin + * + * @library ../../../testlibrary + * @build TestLibrary + * @run main CheckDefaultGroupName */ import java.rmi.activation.*; diff --git a/jdk/test/java/rmi/activation/ActivationSystem/activeGroup/IdempotentActiveGroup.java b/jdk/test/java/rmi/activation/ActivationSystem/activeGroup/IdempotentActiveGroup.java index 41670ee1eb2..391a86273b1 100644 --- a/jdk/test/java/rmi/activation/ActivationSystem/activeGroup/IdempotentActiveGroup.java +++ b/jdk/test/java/rmi/activation/ActivationSystem/activeGroup/IdempotentActiveGroup.java @@ -23,15 +23,13 @@ /* @test * @bug 4720528 - * * @summary synopsis: (spec) ActivationSystem.activeGroup spec should be * relaxed (duplicate call to activeGroup with same instantiator and * incarnation should not throw ActivationException; it should succeed) * @author Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary RMID - * @build IdempotentActiveGroup + * @build TestLibrary RMID ActivationLibrary * @run main/othervm/policy=security.policy/timeout=480 IdempotentActiveGroup */ diff --git a/jdk/test/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor.java b/jdk/test/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor.java index 4f3d51e4646..19034e511a6 100644 --- a/jdk/test/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor.java +++ b/jdk/test/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor.java @@ -29,9 +29,8 @@ * @author Ann Wollrath * * @library ../../../testlibrary - * @build ActivateMe - * @build ModifyDescriptor - * @build ModifyDescriptor_Stub + * @build TestLibrary RMID ActivationLibrary + * ActivateMe ModifyDescriptor_Stub * @run main/othervm/policy=security.policy/timeout=240 ModifyDescriptor */ diff --git a/jdk/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java b/jdk/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java index cc7810407eb..d987f93b238 100644 --- a/jdk/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java +++ b/jdk/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java @@ -24,14 +24,11 @@ /* @test * @bug 4179055 * @summary Some java apps need to have access to read "accessClassInPackage.sun.rmi.server" - * * @author Laird Dornin * * @library ../../../testlibrary - * @build TestLibrary RMID JavaVM StreamPipe ActivationLibrary - * @build CanCreateStubs - * @build StubClassesPermitted - * @build StubClassesPermitted_Stub + * @build TestLibrary RMID ActivationLibrary + * CanCreateStubs StubClassesPermitted_Stub * @run main/othervm/policy=security.policy/secure=java.lang.SecurityManager/timeout=240 StubClassesPermitted */ diff --git a/jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java b/jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java index a2b4076495a..59fee9da723 100644 --- a/jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java +++ b/jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java @@ -24,16 +24,12 @@ /* @test * @bug 4134233 * @bug 4213186 - * * @summary synopsis: ActivationSystem.unregisterGroup should unregister objects in group * @author Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary RMID JavaVM StreamPipe - * @build ActivateMe CallbackInterface - * @build UnregisterGroup - * @build UnregisterGroup_Stub - * @build Callback_Stub + * @build TestLibrary RMID ActivationLibrary + * ActivateMe CallbackInterface UnregisterGroup_Stub Callback_Stub * @run main/othervm/policy=security.policy/timeout=480 UnregisterGroup */ diff --git a/jdk/test/java/rmi/activation/CommandEnvironment/NullOptions.java b/jdk/test/java/rmi/activation/CommandEnvironment/NullOptions.java index 3ef97e8d77c..a1ec946c21b 100644 --- a/jdk/test/java/rmi/activation/CommandEnvironment/NullOptions.java +++ b/jdk/test/java/rmi/activation/CommandEnvironment/NullOptions.java @@ -27,7 +27,6 @@ * ActivationGroupDesc.CommandEnvironment * @author Ann Wollrath * - * @build NullOptions * @run main/othervm/timeout=240 NullOptions */ diff --git a/jdk/test/java/rmi/activation/CommandEnvironment/SetChildEnv.java b/jdk/test/java/rmi/activation/CommandEnvironment/SetChildEnv.java index d89450d6151..7b1a9688ad4 100644 --- a/jdk/test/java/rmi/activation/CommandEnvironment/SetChildEnv.java +++ b/jdk/test/java/rmi/activation/CommandEnvironment/SetChildEnv.java @@ -35,9 +35,10 @@ * @author Adrian Colley * * @library ../../testlibrary - * @build TestLibrary RMID JavaVM StreamPipe - * @build Eliza Retireable Doctor Doctor_Stub SetChildEnv - * @run main/othervm/timeout=240/policy=security.policy -Djava.compiler=NONE SetChildEnv + * @build TestLibrary RMID ActivationLibrary + * Eliza Retireable Doctor Doctor_Stub + * @run main/othervm/timeout=240/policy=security.policy + * -Djava.compiler=NONE SetChildEnv */ import java.rmi.*; import java.util.Properties; diff --git a/jdk/test/java/rmi/activation/checkusage/CheckUsage.java b/jdk/test/java/rmi/activation/checkusage/CheckUsage.java index 66ff7ad9445..2b514e1f370 100644 --- a/jdk/test/java/rmi/activation/checkusage/CheckUsage.java +++ b/jdk/test/java/rmi/activation/checkusage/CheckUsage.java @@ -25,7 +25,7 @@ * @bug 4259564 * * @library ../../testlibrary - * @build TestLibrary JavaVM CheckUsage + * @build TestLibrary JavaVM * @run main/othervm CheckUsage */ diff --git a/jdk/test/java/rmi/activation/log/LogTest.java b/jdk/test/java/rmi/activation/log/LogTest.java index 2e503b916a4..53efeb49ced 100644 --- a/jdk/test/java/rmi/activation/log/LogTest.java +++ b/jdk/test/java/rmi/activation/log/LogTest.java @@ -29,7 +29,6 @@ * boundaries * @author Ann Wollrath * - * @build LogTest * @run main/othervm/timeout=240 LogTest */ diff --git a/jdk/test/java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java b/jdk/test/java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java index 345aca33a60..4611a83bda5 100644 --- a/jdk/test/java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java +++ b/jdk/test/java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java @@ -29,8 +29,7 @@ * @author Peter Jones * * @library ../../testlibrary - * @build RMID ActivationLibrary - * @build InheritedChannelNotServerSocket + * @build TestLibrary RMID ActivationLibrary * @run main/othervm/timeout=240 InheritedChannelNotServerSocket */ diff --git a/jdk/test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java b/jdk/test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java index 008b391acc4..be9234d2fb9 100644 --- a/jdk/test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java +++ b/jdk/test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java @@ -27,9 +27,7 @@ * @author Ann Wollrath * * @library ../../testlibrary - * @build RMID ActivationLibrary - * @build RmidViaInheritedChannel - * @build TestLibrary + * @build TestLibrary RMID ActivationLibrary * @run main/othervm/timeout=240 RmidViaInheritedChannel */ diff --git a/jdk/test/java/rmi/dgc/VMID/CheckVMID.java b/jdk/test/java/rmi/dgc/VMID/CheckVMID.java index dcdc9fd2ccf..0b69ff4cc30 100644 --- a/jdk/test/java/rmi/dgc/VMID/CheckVMID.java +++ b/jdk/test/java/rmi/dgc/VMID/CheckVMID.java @@ -30,7 +30,7 @@ * @author Ann Wollrath * * @library ../../testlibrary - * @build CheckVMID + * @build TestLibrary * @run main/othervm/policy=security.policy CheckVMID */ diff --git a/jdk/test/java/rmi/dgc/dgcAckFailure/DGCAckFailure.java b/jdk/test/java/rmi/dgc/dgcAckFailure/DGCAckFailure.java index c416063113a..6a47245dec9 100644 --- a/jdk/test/java/rmi/dgc/dgcAckFailure/DGCAckFailure.java +++ b/jdk/test/java/rmi/dgc/dgcAckFailure/DGCAckFailure.java @@ -30,8 +30,7 @@ * rather than pinning it indefinitely. * @author Peter Jones * - * @build DGCAckFailure - * @build DGCAckFailure_Stub + * @build DGCAckFailure DGCAckFailure_Stub * @run main/othervm DGCAckFailure */ diff --git a/jdk/test/java/rmi/dgc/dgcImplInsulation/DGCImplInsulation.java b/jdk/test/java/rmi/dgc/dgcImplInsulation/DGCImplInsulation.java index 246c2b541a3..4043268838d 100644 --- a/jdk/test/java/rmi/dgc/dgcImplInsulation/DGCImplInsulation.java +++ b/jdk/test/java/rmi/dgc/dgcImplInsulation/DGCImplInsulation.java @@ -31,9 +31,7 @@ * @author Peter Jones * * @library ../../testlibrary - * @build TestLibrary - * @build DGCImplInsulation - * @build DGCImplInsulation_Stub + * @build TestLibrary DGCImplInsulation_Stub * @run main/othervm/policy=security.policy DGCImplInsulation */ diff --git a/jdk/test/java/rmi/dgc/retryDirtyCalls/RetryDirtyCalls.java b/jdk/test/java/rmi/dgc/retryDirtyCalls/RetryDirtyCalls.java index 10cb15f30eb..b2f0af6506b 100644 --- a/jdk/test/java/rmi/dgc/retryDirtyCalls/RetryDirtyCalls.java +++ b/jdk/test/java/rmi/dgc/retryDirtyCalls/RetryDirtyCalls.java @@ -29,8 +29,7 @@ * renewing that lease at all after the first failure. * @author Peter Jones (inspired by Adrian Colley's test case in 4268258) * - * @build RetryDirtyCalls - * @build RetryDirtyCalls_Stub + * @build RetryDirtyCalls RetryDirtyCalls_Stub * @run main/othervm RetryDirtyCalls */ diff --git a/jdk/test/java/rmi/invalidName/InvalidName.java b/jdk/test/java/rmi/invalidName/InvalidName.java index 8d522f51592..74da1a5d53d 100644 --- a/jdk/test/java/rmi/invalidName/InvalidName.java +++ b/jdk/test/java/rmi/invalidName/InvalidName.java @@ -32,7 +32,7 @@ * @author Laird Dornin * * @library ../testlibrary - * @build InvalidName + * @build TestLibrary * @run main/othervm InvalidName */ diff --git a/jdk/test/java/rmi/registry/altSecurityManager/AltSecurityManager.java b/jdk/test/java/rmi/registry/altSecurityManager/AltSecurityManager.java index 15b98fc851b..08d030ec876 100644 --- a/jdk/test/java/rmi/registry/altSecurityManager/AltSecurityManager.java +++ b/jdk/test/java/rmi/registry/altSecurityManager/AltSecurityManager.java @@ -27,8 +27,7 @@ * @author Laird Dornin * * @library ../../testlibrary - * @build StreamPipe TestParams TestLibrary JavaVM RMID - * @build AltSecurityManager TestSecurityManager + * @build TestLibrary JavaVM RMID TestSecurityManager * @run main/othervm AltSecurityManager */ diff --git a/jdk/test/java/rmi/registry/checkusage/CheckUsage.java b/jdk/test/java/rmi/registry/checkusage/CheckUsage.java index 71deb55ad99..19dac5b600a 100644 --- a/jdk/test/java/rmi/registry/checkusage/CheckUsage.java +++ b/jdk/test/java/rmi/registry/checkusage/CheckUsage.java @@ -27,7 +27,7 @@ * @author Laird Dornin * * @library ../../testlibrary - * @build TestLibrary JavaVM CheckUsage + * @build TestLibrary JavaVM * @run main/othervm CheckUsage */ diff --git a/jdk/test/java/rmi/registry/classPathCodebase/ClassPathCodebase.java b/jdk/test/java/rmi/registry/classPathCodebase/ClassPathCodebase.java index 9e8cbba8bf6..99ac5f091a6 100644 --- a/jdk/test/java/rmi/registry/classPathCodebase/ClassPathCodebase.java +++ b/jdk/test/java/rmi/registry/classPathCodebase/ClassPathCodebase.java @@ -30,7 +30,7 @@ * @author Peter Jones * * @library ../../testlibrary - * @build ClassPathCodebase Dummy TestLibrary + * @build TestLibrary Dummy * @run main/othervm/policy=security.policy ClassPathCodebase */ diff --git a/jdk/test/java/rmi/registry/interfaceHash/InterfaceHash.java b/jdk/test/java/rmi/registry/interfaceHash/InterfaceHash.java index 77824125719..2eba1d6ac1a 100644 --- a/jdk/test/java/rmi/registry/interfaceHash/InterfaceHash.java +++ b/jdk/test/java/rmi/registry/interfaceHash/InterfaceHash.java @@ -36,9 +36,7 @@ * * @author Peter Jones * @library ../../testlibrary - * @build InterfaceHash - * @build ReferenceRegistryStub - * @build TestLibrary + * @build TestLibrary ReferenceRegistryStub * @run main/othervm InterfaceHash */ diff --git a/jdk/test/java/rmi/registry/multipleRegistries/MultipleRegistries.java b/jdk/test/java/rmi/registry/multipleRegistries/MultipleRegistries.java index e75a60989d7..1945ebe8db3 100644 --- a/jdk/test/java/rmi/registry/multipleRegistries/MultipleRegistries.java +++ b/jdk/test/java/rmi/registry/multipleRegistries/MultipleRegistries.java @@ -28,7 +28,6 @@ * * @library ../../testlibrary * @build TestLibrary - * @build MultipleRegistries * @run main/othervm/timeout=240 MultipleRegistries */ diff --git a/jdk/test/java/rmi/registry/readTest/readTest.sh b/jdk/test/java/rmi/registry/readTest/readTest.sh index d7f1568f62c..5fda0a5a314 100644 --- a/jdk/test/java/rmi/registry/readTest/readTest.sh +++ b/jdk/test/java/rmi/registry/readTest/readTest.sh @@ -76,7 +76,7 @@ case "$OS" in ;; esac # trailing / after code base is important for rmi codebase property. -${TESTJAVA}${FS}bin${FS}java -cp $TEST_CLASSPATH -Djava.rmi.server.codebase=${FILEURL}$CODEBASE/ readTest > OUT.TXT 2>&1 & +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -cp $TEST_CLASSPATH -Djava.rmi.server.codebase=${FILEURL}$CODEBASE/ readTest > OUT.TXT 2>&1 & TEST_PID=$! #bulk of testcase - let it run for a while sleep 5 diff --git a/jdk/test/java/rmi/registry/reexport/Reexport.java b/jdk/test/java/rmi/registry/reexport/Reexport.java index 042088e65af..c209f7c55b8 100644 --- a/jdk/test/java/rmi/registry/reexport/Reexport.java +++ b/jdk/test/java/rmi/registry/reexport/Reexport.java @@ -25,9 +25,7 @@ * @bug 4120329 * @summary RMI registry creation is impossible if first attempt fails. * @library ../../testlibrary - * @build StreamPipe TestParams TestLibrary JavaVM - * @build RegistryRunner RegistryRunner_Stub - * @build Reexport + * @build TestLibrary JavaVM RegistryRunner RegistryRunner_Stub * @run main/othervm Reexport */ diff --git a/jdk/test/java/rmi/reliability/benchmark/runRmiBench.sh b/jdk/test/java/rmi/reliability/benchmark/runRmiBench.sh index cfa23f77811..98a31d1ddd1 100644 --- a/jdk/test/java/rmi/reliability/benchmark/runRmiBench.sh +++ b/jdk/test/java/rmi/reliability/benchmark/runRmiBench.sh @@ -27,20 +27,20 @@ # used to run the test under JTREG. # # @build bench.BenchInfo bench.HtmlReporter bench.Util bench.Benchmark -# @build bench.Reporter bench.XmlReporter bench.ConfigFormatException -# @build bench.Harness bench.TextReporter bench.rmi.BenchServer -# @build bench.rmi.DoubleArrayCalls bench.rmi.LongCalls bench.rmi.ShortCalls -# @build bench.rmi.BenchServerImpl bench.rmi.DoubleCalls -# @build bench.rmi.Main bench.rmi.SmallObjTreeCalls -# @build bench.rmi.BooleanArrayCalls bench.rmi.ExceptionCalls -# @build bench.rmi.NullCalls bench.rmi.BooleanCalls bench.rmi.ExportObjs -# @build bench.rmi.ObjArrayCalls bench.rmi.ByteArrayCalls -# @build bench.rmi.FloatArrayCalls bench.rmi.ObjTreeCalls -# @build bench.rmi.ByteCalls bench.rmi.FloatCalls bench.rmi.ProxyArrayCalls -# @build bench.rmi.CharArrayCalls bench.rmi.IntArrayCalls -# @build bench.rmi.RemoteObjArrayCalls bench.rmi.CharCalls bench.rmi.IntCalls -# @build bench.rmi.ClassLoading bench.rmi.LongArrayCalls -# @build bench.rmi.ShortArrayCalls bench.rmi.altroot.Node +# bench.Reporter bench.XmlReporter bench.ConfigFormatException +# bench.Harness bench.TextReporter bench.rmi.BenchServer +# bench.rmi.DoubleArrayCalls bench.rmi.LongCalls bench.rmi.ShortCalls +# bench.rmi.BenchServerImpl bench.rmi.DoubleCalls +# bench.rmi.Main bench.rmi.SmallObjTreeCalls +# bench.rmi.BooleanArrayCalls bench.rmi.ExceptionCalls +# bench.rmi.NullCalls bench.rmi.BooleanCalls bench.rmi.ExportObjs +# bench.rmi.ObjArrayCalls bench.rmi.ByteArrayCalls +# bench.rmi.FloatArrayCalls bench.rmi.ObjTreeCalls +# bench.rmi.ByteCalls bench.rmi.FloatCalls bench.rmi.ProxyArrayCalls +# bench.rmi.CharArrayCalls bench.rmi.IntArrayCalls +# bench.rmi.RemoteObjArrayCalls bench.rmi.CharCalls bench.rmi.IntCalls +# bench.rmi.ClassLoading bench.rmi.LongArrayCalls +# bench.rmi.ShortArrayCalls bench.rmi.altroot.Node # # @run shell/timeout=1800 runRmiBench.sh # diff --git a/jdk/test/java/rmi/reliability/benchmark/runSerialBench.sh b/jdk/test/java/rmi/reliability/benchmark/runSerialBench.sh index aac0d3ff768..82a2837bcff 100644 --- a/jdk/test/java/rmi/reliability/benchmark/runSerialBench.sh +++ b/jdk/test/java/rmi/reliability/benchmark/runSerialBench.sh @@ -51,7 +51,7 @@ echo "Starting serialization benchmark " $TESTJAVA/bin/java \ - -server \ + ${TESTVMOPTS} \ -cp $TESTCLASSES \ bench.serial.Main \ -c $TESTSRC/bench/serial/jtreg-config & diff --git a/jdk/test/java/rmi/reliability/juicer/AppleUserImpl.java b/jdk/test/java/rmi/reliability/juicer/AppleUserImpl.java index 2ed30c65ab8..70b187e25bc 100644 --- a/jdk/test/java/rmi/reliability/juicer/AppleUserImpl.java +++ b/jdk/test/java/rmi/reliability/juicer/AppleUserImpl.java @@ -55,11 +55,10 @@ * has been reached. * * @library ../../testlibrary - * - * @build Apple AppleEvent AppleImpl AppleUserImpl - * @build Orange OrangeEcho OrangeEchoImpl OrangeImpl - * @build ApplicationServer * @build TestLibrary + * Apple AppleEvent AppleImpl + * Orange OrangeEcho OrangeEchoImpl OrangeImpl + * ApplicationServer * * @run main/othervm/policy=security.policy AppleUserImpl -seconds 30 * diff --git a/jdk/test/java/rmi/server/ObjID/randomIDs/RandomIDs.java b/jdk/test/java/rmi/server/ObjID/randomIDs/RandomIDs.java index 9c20ab40dfb..ebe7192f382 100644 --- a/jdk/test/java/rmi/server/ObjID/randomIDs/RandomIDs.java +++ b/jdk/test/java/rmi/server/ObjID/randomIDs/RandomIDs.java @@ -30,7 +30,6 @@ * ObjID() should still generate sequential object numbers. * @author Peter Jones * - * @build RandomIDs * @run main/othervm RandomIDs random * @run main/othervm -Djava.rmi.server.randomIDs=true RandomIDs random * @run main/othervm -Djava.rmi.server.randomIDs=false RandomIDs sequential diff --git a/jdk/test/java/rmi/server/RMIClassLoader/delegateBeforePermissionCheck/DelegateBeforePermissionCheck.java b/jdk/test/java/rmi/server/RMIClassLoader/delegateBeforePermissionCheck/DelegateBeforePermissionCheck.java index fba4939a35c..6187f0cb17e 100644 --- a/jdk/test/java/rmi/server/RMIClassLoader/delegateBeforePermissionCheck/DelegateBeforePermissionCheck.java +++ b/jdk/test/java/rmi/server/RMIClassLoader/delegateBeforePermissionCheck/DelegateBeforePermissionCheck.java @@ -33,9 +33,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build TestLibrary - * @build DelegateBeforePermissionCheck - * @build Foo + * @build TestLibrary Foo * @run main/othervm DelegateBeforePermissionCheck */ diff --git a/jdk/test/java/rmi/server/RMIClassLoader/delegateToContextLoader/DelegateToContextLoader.java b/jdk/test/java/rmi/server/RMIClassLoader/delegateToContextLoader/DelegateToContextLoader.java index 51b5bd4f88f..7ae4c5ee9ba 100644 --- a/jdk/test/java/rmi/server/RMIClassLoader/delegateToContextLoader/DelegateToContextLoader.java +++ b/jdk/test/java/rmi/server/RMIClassLoader/delegateToContextLoader/DelegateToContextLoader.java @@ -29,7 +29,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build DelegateToContextLoader Dummy + * @build TestLibrary Dummy * @run main/othervm/policy=security.policy/timeout=120 DelegateToContextLoader */ diff --git a/jdk/test/java/rmi/server/RMIClassLoader/downloadArrayClass/DownloadArrayClass.java b/jdk/test/java/rmi/server/RMIClassLoader/downloadArrayClass/DownloadArrayClass.java index 34a21bd4651..9df187ab3a3 100644 --- a/jdk/test/java/rmi/server/RMIClassLoader/downloadArrayClass/DownloadArrayClass.java +++ b/jdk/test/java/rmi/server/RMIClassLoader/downloadArrayClass/DownloadArrayClass.java @@ -31,11 +31,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build TestLibrary - * @build Receiver - * @build DownloadArrayClass - * @build DownloadArrayClass_Stub - * @build Foo + * @build TestLibrary Receiver DownloadArrayClass_Stub Foo * @run main/othervm/policy=security.policy DownloadArrayClass */ diff --git a/jdk/test/java/rmi/server/RMIClassLoader/getClassAnnotation/NullClass.java b/jdk/test/java/rmi/server/RMIClassLoader/getClassAnnotation/NullClass.java index 0a0cfb70e67..5167fc40c2b 100644 --- a/jdk/test/java/rmi/server/RMIClassLoader/getClassAnnotation/NullClass.java +++ b/jdk/test/java/rmi/server/RMIClassLoader/getClassAnnotation/NullClass.java @@ -29,7 +29,6 @@ * * @library ../../../testlibrary * @build TestLibrary - * @build NullClass * @run main/othervm NullClass */ diff --git a/jdk/test/java/rmi/server/RMIClassLoader/getClassLoader/GetClassLoader.java b/jdk/test/java/rmi/server/RMIClassLoader/getClassLoader/GetClassLoader.java index f54a5cf0b9e..10a9cc9b4ac 100644 --- a/jdk/test/java/rmi/server/RMIClassLoader/getClassLoader/GetClassLoader.java +++ b/jdk/test/java/rmi/server/RMIClassLoader/getClassLoader/GetClassLoader.java @@ -29,9 +29,7 @@ * @author Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary - * @build GetClassLoader - * @build Foo + * @build TestLibrary Foo * @run main/othervm/policy=security.policy GetClassLoader */ diff --git a/jdk/test/java/rmi/server/RMIClassLoader/loadProxyClasses/LoadProxyClasses.java b/jdk/test/java/rmi/server/RMIClassLoader/loadProxyClasses/LoadProxyClasses.java index 4feed266e96..6d29cb2468f 100644 --- a/jdk/test/java/rmi/server/RMIClassLoader/loadProxyClasses/LoadProxyClasses.java +++ b/jdk/test/java/rmi/server/RMIClassLoader/loadProxyClasses/LoadProxyClasses.java @@ -30,8 +30,8 @@ * @author Laird Dornin * * @library ../../../testlibrary - * @build TestLibrary FnnClass FnnUnmarshal LoadProxyClasses NonpublicInterface - * @build NonpublicInterface1 PublicInterface PublicInterface1 + * @build TestLibrary FnnClass FnnUnmarshal NonpublicInterface + * NonpublicInterface1 PublicInterface PublicInterface1 * @run main/othervm/policy=security.policy LoadProxyClasses */ diff --git a/jdk/test/java/rmi/server/RMIClassLoader/noSecurityManager/NoSecurityManager.java b/jdk/test/java/rmi/server/RMIClassLoader/noSecurityManager/NoSecurityManager.java index 182db1c69cb..93a33b91dd2 100644 --- a/jdk/test/java/rmi/server/RMIClassLoader/noSecurityManager/NoSecurityManager.java +++ b/jdk/test/java/rmi/server/RMIClassLoader/noSecurityManager/NoSecurityManager.java @@ -30,7 +30,7 @@ * been used for the RMI class loader instance. * @author Peter Jones * - * @build NoSecurityManager Dummy LocalDummy + * @build Dummy LocalDummy * @run main/othervm/timeout=120 NoSecurityManager */ diff --git a/jdk/test/java/rmi/server/RMIClassLoader/spi/ContextInsulation.java b/jdk/test/java/rmi/server/RMIClassLoader/spi/ContextInsulation.java index 56cd08d2bc1..de3d79b60f6 100644 --- a/jdk/test/java/rmi/server/RMIClassLoader/spi/ContextInsulation.java +++ b/jdk/test/java/rmi/server/RMIClassLoader/spi/ContextInsulation.java @@ -30,11 +30,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build TestLibrary - * @build ContextInsulation - * @build ServiceConfiguration - * @build TestProvider - * @build TestProvider2 + * @build TestLibrary ServiceConfiguration TestProvider TestProvider2 * @run main/othervm/policy=security.policy ContextInsulation */ diff --git a/jdk/test/java/rmi/server/RMIClassLoader/spi/DefaultProperty.java b/jdk/test/java/rmi/server/RMIClassLoader/spi/DefaultProperty.java index 4cb8169ab8a..f91ef3d1893 100644 --- a/jdk/test/java/rmi/server/RMIClassLoader/spi/DefaultProperty.java +++ b/jdk/test/java/rmi/server/RMIClassLoader/spi/DefaultProperty.java @@ -29,10 +29,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build TestLibrary - * @build DefaultProperty - * @build ServiceConfiguration - * @build Foo + * @build TestLibrary ServiceConfiguration Foo * @run main/othervm/policy=security.policy DefaultProperty */ diff --git a/jdk/test/java/rmi/server/RMIClassLoader/spi/Installed.java b/jdk/test/java/rmi/server/RMIClassLoader/spi/Installed.java index 23ce956b334..d32a8af596d 100644 --- a/jdk/test/java/rmi/server/RMIClassLoader/spi/Installed.java +++ b/jdk/test/java/rmi/server/RMIClassLoader/spi/Installed.java @@ -29,11 +29,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build TestLibrary - * @build Installed - * @build ServiceConfiguration - * @build TestProvider - * @build TestProvider2 + * @build TestLibrary ServiceConfiguration TestProvider TestProvider2 * @run main/othervm/policy=security.policy Installed */ diff --git a/jdk/test/java/rmi/server/RMIClassLoader/spi/InvalidProperty.java b/jdk/test/java/rmi/server/RMIClassLoader/spi/InvalidProperty.java index e7b157c6480..d41cef1d924 100644 --- a/jdk/test/java/rmi/server/RMIClassLoader/spi/InvalidProperty.java +++ b/jdk/test/java/rmi/server/RMIClassLoader/spi/InvalidProperty.java @@ -29,9 +29,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build TestLibrary - * @build InvalidProperty - * @build ServiceConfiguration + * @build TestLibrary ServiceConfiguration * @run main/othervm/policy=security.policy InvalidProperty */ diff --git a/jdk/test/java/rmi/server/RMIClassLoader/spi/Property.java b/jdk/test/java/rmi/server/RMIClassLoader/spi/Property.java index 427e5a3160e..6113a6ecb7b 100644 --- a/jdk/test/java/rmi/server/RMIClassLoader/spi/Property.java +++ b/jdk/test/java/rmi/server/RMIClassLoader/spi/Property.java @@ -29,10 +29,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build TestLibrary - * @build Property - * @build ServiceConfiguration - * @build TestProvider + * @build TestLibrary ServiceConfiguration TestProvider * @run main/othervm/policy=security.policy Property */ diff --git a/jdk/test/java/rmi/server/RMIClassLoader/useCodebaseOnly/UseCodebaseOnly.java b/jdk/test/java/rmi/server/RMIClassLoader/useCodebaseOnly/UseCodebaseOnly.java index cd79782c46e..dc808370526 100644 --- a/jdk/test/java/rmi/server/RMIClassLoader/useCodebaseOnly/UseCodebaseOnly.java +++ b/jdk/test/java/rmi/server/RMIClassLoader/useCodebaseOnly/UseCodebaseOnly.java @@ -31,12 +31,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build TestLibrary - * @build Receiver - * @build UseCodebaseOnly - * @build UseCodebaseOnly_Stub - * @build Foo - * @build Bar + * @build TestLibrary Receiver UseCodebaseOnly_Stub Foo Bar * @run main/othervm/policy=security.policy UseCodebaseOnly */ diff --git a/jdk/test/java/rmi/server/RMIClassLoader/useGetURLs/UseGetURLs.java b/jdk/test/java/rmi/server/RMIClassLoader/useGetURLs/UseGetURLs.java index 295b9944a77..d80907e0a2b 100644 --- a/jdk/test/java/rmi/server/RMIClassLoader/useGetURLs/UseGetURLs.java +++ b/jdk/test/java/rmi/server/RMIClassLoader/useGetURLs/UseGetURLs.java @@ -30,8 +30,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build TestLibrary - * @build UseGetURLs Dummy + * @build TestLibrary Dummy * @run main/othervm/policy=security.policy/timeout=120 UseGetURLs */ diff --git a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java index 5868c583b28..5f032ec58cf 100644 --- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java +++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java @@ -28,11 +28,7 @@ * @author Ann Wollrath * * @library ../../../../testlibrary - * @build Echo - * @build EchoImpl - * @build EchoImpl_Stub - * @build UseCustomSocketFactory - * @build TestLibrary + * @build TestLibrary Echo EchoImpl EchoImpl_Stub * @run main/othervm/policy=security.policy/timeout=360 UseCustomSocketFactory */ diff --git a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/registry/UseCustomSocketFactory.java b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/registry/UseCustomSocketFactory.java index ba610688369..774e823e857 100644 --- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/registry/UseCustomSocketFactory.java +++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/registry/UseCustomSocketFactory.java @@ -29,12 +29,7 @@ * @author Laird Dornin; code borrowed from Ann Wollrath * * @library ../../../../testlibrary - * @build Hello - * @build HelloImpl - * @build HelloImpl_Stub - * @build TestLibrary - * @build UseCustomSocketFactory - * @build Compress + * @build TestLibrary Compress Hello HelloImpl HelloImpl_Stub * @run main/othervm/policy=security.policy/timeout=240 UseCustomSocketFactory */ diff --git a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/UseCustomSocketFactory.java b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/UseCustomSocketFactory.java index 13766abd848..06571df79c1 100644 --- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/UseCustomSocketFactory.java +++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/UseCustomSocketFactory.java @@ -29,11 +29,7 @@ * @author Ann Wollrath * * @library ../../../../testlibrary - * @build TestLibrary RMID JavaVM StreamPipe - * @build Echo - * @build EchoImpl - * @build EchoImpl_Stub - * @build UseCustomSocketFactory + * @build TestLibrary RMID JavaVM Echo EchoImpl EchoImpl_Stub * @run main/othervm/policy=security.policy/timeout=120 UseCustomSocketFactory */ diff --git a/jdk/test/java/rmi/server/RemoteObject/notExtending/NotExtending.java b/jdk/test/java/rmi/server/RemoteObject/notExtending/NotExtending.java index 0023fc5f0c1..ef524a4dd8a 100644 --- a/jdk/test/java/rmi/server/RemoteObject/notExtending/NotExtending.java +++ b/jdk/test/java/rmi/server/RemoteObject/notExtending/NotExtending.java @@ -29,9 +29,7 @@ * (specifically: stubs) that contain the instance's RemoteRef. * @author Peter Jones * - * @build NotExtending - * @build NotExtending_Stub - * @build NotExtending_Skel + * @build NotExtending_Stub NotExtending_Skel * @run main/othervm/timeout=240 NotExtending */ diff --git a/jdk/test/java/rmi/server/RemoteObject/verifyRemoteEquals/VerifyRemoteEquals.java b/jdk/test/java/rmi/server/RemoteObject/verifyRemoteEquals/VerifyRemoteEquals.java index 8b6bccab9a8..b89e3625e3d 100644 --- a/jdk/test/java/rmi/server/RemoteObject/verifyRemoteEquals/VerifyRemoteEquals.java +++ b/jdk/test/java/rmi/server/RemoteObject/verifyRemoteEquals/VerifyRemoteEquals.java @@ -21,16 +21,16 @@ * questions. */ -/** +/* * @test * @bug 4251010 * @summary equals does not works on stub objects created with * custom socket AndFactory - * @library ../../../testlibrary - * - * @build VerifyRemoteEquals - * @run main/othervm/timeout=40 VerifyRemoteEquals * @author Laird Dornin + * + * @library ../../../testlibrary + * @build TestLibrary + * @run main/othervm/timeout=40 VerifyRemoteEquals */ import java.io.*; diff --git a/jdk/test/java/rmi/server/RemoteServer/AddrInUse.java b/jdk/test/java/rmi/server/RemoteServer/AddrInUse.java index 9ab8e50d65b..34e343b6193 100644 --- a/jdk/test/java/rmi/server/RemoteServer/AddrInUse.java +++ b/jdk/test/java/rmi/server/RemoteServer/AddrInUse.java @@ -26,8 +26,6 @@ * @summary retryServerSocket should not retry on BindException * @author Ann Wollrath * - * @library ../../testlibrary - * @build AddrInUse * @run main/othervm AddrInUse */ diff --git a/jdk/test/java/rmi/server/UnicastRemoteObject/changeHostName/ChangeHostName.java b/jdk/test/java/rmi/server/UnicastRemoteObject/changeHostName/ChangeHostName.java index 0716c1a9b1e..523c3a08f4a 100644 --- a/jdk/test/java/rmi/server/UnicastRemoteObject/changeHostName/ChangeHostName.java +++ b/jdk/test/java/rmi/server/UnicastRemoteObject/changeHostName/ChangeHostName.java @@ -31,8 +31,7 @@ * * @author Ann Wollrath * - * @build ChangeHostName - * @build ChangeHostName_Stub + * @build ChangeHostName ChangeHostName_Stub * @run main/othervm ChangeHostName */ diff --git a/jdk/test/java/rmi/server/UnicastRemoteObject/exportObject/GcDuringExport.java b/jdk/test/java/rmi/server/UnicastRemoteObject/exportObject/GcDuringExport.java index 59663db7dea..def2806964d 100644 --- a/jdk/test/java/rmi/server/UnicastRemoteObject/exportObject/GcDuringExport.java +++ b/jdk/test/java/rmi/server/UnicastRemoteObject/exportObject/GcDuringExport.java @@ -30,6 +30,7 @@ * @bug 6597112 * @summary GC'ing objects whilst being exported to RMI should not cause exceptions * @author Neil Richards , + * @run main GcDuringExport */ import java.rmi.Remote; diff --git a/jdk/test/java/rmi/server/UnicastRemoteObject/keepAliveDuringCall/KeepAliveDuringCall.java b/jdk/test/java/rmi/server/UnicastRemoteObject/keepAliveDuringCall/KeepAliveDuringCall.java index dbe2ffe2157..780e7e5c7f1 100644 --- a/jdk/test/java/rmi/server/UnicastRemoteObject/keepAliveDuringCall/KeepAliveDuringCall.java +++ b/jdk/test/java/rmi/server/UnicastRemoteObject/keepAliveDuringCall/KeepAliveDuringCall.java @@ -32,14 +32,8 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build TestLibrary - * @build JavaVM - * @build KeepAliveDuringCall - * @build KeepAliveDuringCall_Stub - * @build ShutdownMonitor - * @build Shutdown - * @build ShutdownImpl - * @build ShutdownImpl_Stub + * @build TestLibrary JavaVM KeepAliveDuringCall_Stub + * ShutdownMonitor Shutdown ShutdownImpl ShutdownImpl_Stub * @run main/othervm KeepAliveDuringCall */ diff --git a/jdk/test/java/rmi/server/UnicastRemoteObject/marshalAfterUnexport/MarshalAfterUnexport.java b/jdk/test/java/rmi/server/UnicastRemoteObject/marshalAfterUnexport/MarshalAfterUnexport.java index 743d4611f5f..a165dd81783 100644 --- a/jdk/test/java/rmi/server/UnicastRemoteObject/marshalAfterUnexport/MarshalAfterUnexport.java +++ b/jdk/test/java/rmi/server/UnicastRemoteObject/marshalAfterUnexport/MarshalAfterUnexport.java @@ -31,8 +31,7 @@ * IOException (see fix for bugid 4017232). * @author Peter Jones * - * @build MarshalAfterUnexport - * @build MarshalAfterUnexport_Stub + * @build MarshalAfterUnexport MarshalAfterUnexport_Stub * @run main/othervm MarshalAfterUnexport */ diff --git a/jdk/test/java/rmi/server/UnicastRemoteObject/marshalAfterUnexport/MarshalAfterUnexport2.java b/jdk/test/java/rmi/server/UnicastRemoteObject/marshalAfterUnexport/MarshalAfterUnexport2.java index ea1e482fc39..b72efa456cf 100644 --- a/jdk/test/java/rmi/server/UnicastRemoteObject/marshalAfterUnexport/MarshalAfterUnexport2.java +++ b/jdk/test/java/rmi/server/UnicastRemoteObject/marshalAfterUnexport/MarshalAfterUnexport2.java @@ -33,8 +33,7 @@ * @author Peter Jones * @author Ann Wollrath * - * @build MarshalAfterUnexport2 - * @build MarshalAfterUnexport2_Stub + * @build MarshalAfterUnexport2 MarshalAfterUnexport2_Stub * @run main/othervm MarshalAfterUnexport2 */ diff --git a/jdk/test/java/rmi/server/UnicastRemoteObject/unexportObject/UnexportLeak.java b/jdk/test/java/rmi/server/UnicastRemoteObject/unexportObject/UnexportLeak.java index 60325dcaa1e..62804feb6e0 100644 --- a/jdk/test/java/rmi/server/UnicastRemoteObject/unexportObject/UnexportLeak.java +++ b/jdk/test/java/rmi/server/UnicastRemoteObject/unexportObject/UnexportLeak.java @@ -29,10 +29,7 @@ * @author Ann Wollrath * * @library ../../../testlibrary - * @build UnexportLeak - * @build UnexportLeak_Stub - * @build TestLibrary - * @build Ping + * @build TestLibrary UnexportLeak_Stub Ping * @run main/othervm UnexportLeak */ diff --git a/jdk/test/java/rmi/server/Unmarshal/PrimitiveClasses.java b/jdk/test/java/rmi/server/Unmarshal/PrimitiveClasses.java index 8d7b30dbf66..b9dfb0c300e 100644 --- a/jdk/test/java/rmi/server/Unmarshal/PrimitiveClasses.java +++ b/jdk/test/java/rmi/server/Unmarshal/PrimitiveClasses.java @@ -25,6 +25,7 @@ * @bug 4442373 * @summary Verify that RMI can successfully unmarshal Class objects for * primitive types. + * @run main PrimitiveClasses */ import java.rmi.MarshalledObject; diff --git a/jdk/test/java/rmi/server/Unmarshal/checkUnmarshalOnStopThread/CheckUnmarshall.java b/jdk/test/java/rmi/server/Unmarshal/checkUnmarshalOnStopThread/CheckUnmarshal.java similarity index 100% rename from jdk/test/java/rmi/server/Unmarshal/checkUnmarshalOnStopThread/CheckUnmarshall.java rename to jdk/test/java/rmi/server/Unmarshal/checkUnmarshalOnStopThread/CheckUnmarshal.java diff --git a/jdk/test/java/rmi/server/Unmarshal/checkUnmarshalOnStopThread/CheckUnmarshalOnStopThread.java b/jdk/test/java/rmi/server/Unmarshal/checkUnmarshalOnStopThread/CheckUnmarshalOnStopThread.java index 60dce669c51..95dee537d21 100644 --- a/jdk/test/java/rmi/server/Unmarshal/checkUnmarshalOnStopThread/CheckUnmarshalOnStopThread.java +++ b/jdk/test/java/rmi/server/Unmarshal/checkUnmarshalOnStopThread/CheckUnmarshalOnStopThread.java @@ -31,10 +31,8 @@ * @author Laird Dornin * * @library ../../../testlibrary - * @build TestLibrary RMID JavaVM StreamPipe - * @build CheckUnmarshall PoisonPill RuntimeExceptionParameter - * @build CheckUnmarshalOnStopThread - * @build CheckUnmarshalOnStopThread_Stub + * @build TestLibrary CheckUnmarshal CheckUnmarshalOnStopThread_Stub + * PoisonPill RuntimeExceptionParameter * @run main/othervm/timeout=480 CheckUnmarshalOnStopThread */ diff --git a/jdk/test/java/rmi/server/Unreferenced/finiteGCLatency/FiniteGCLatency.java b/jdk/test/java/rmi/server/Unreferenced/finiteGCLatency/FiniteGCLatency.java index 7b7317a8d9b..f15883ca806 100644 --- a/jdk/test/java/rmi/server/Unreferenced/finiteGCLatency/FiniteGCLatency.java +++ b/jdk/test/java/rmi/server/Unreferenced/finiteGCLatency/FiniteGCLatency.java @@ -35,9 +35,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build FiniteGCLatency - * @build FiniteGCLatency_Stub - * @build TestLibrary + * @build TestLibrary FiniteGCLatency_Stub * @run main/othervm/timeout=120 FiniteGCLatency */ diff --git a/jdk/test/java/rmi/server/Unreferenced/leaseCheckInterval/LeaseCheckInterval.java b/jdk/test/java/rmi/server/Unreferenced/leaseCheckInterval/LeaseCheckInterval.java index c1d5c579624..b488e762f9a 100644 --- a/jdk/test/java/rmi/server/Unreferenced/leaseCheckInterval/LeaseCheckInterval.java +++ b/jdk/test/java/rmi/server/Unreferenced/leaseCheckInterval/LeaseCheckInterval.java @@ -37,11 +37,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build TestLibrary - * @build JavaVM - * @build LeaseCheckInterval - * @build LeaseCheckInterval_Stub - * @build SelfTerminator + * @build TestLibrary JavaVM LeaseCheckInterval_Stub SelfTerminator * @run main/othervm LeaseCheckInterval */ diff --git a/jdk/test/java/rmi/server/Unreferenced/marshalledObjectGet/MarshalledObjectGet.java b/jdk/test/java/rmi/server/Unreferenced/marshalledObjectGet/MarshalledObjectGet.java index 8170168d9d8..0ae059b95b2 100644 --- a/jdk/test/java/rmi/server/Unreferenced/marshalledObjectGet/MarshalledObjectGet.java +++ b/jdk/test/java/rmi/server/Unreferenced/marshalledObjectGet/MarshalledObjectGet.java @@ -30,8 +30,6 @@ * invoked. * @author Peter Jones * - * @library ../../../testlibrary - * @build MarshalledObjectGet * @build MarshalledObjectGet_Stub * @run main/othervm/timeout=120 MarshalledObjectGet */ diff --git a/jdk/test/java/rmi/server/Unreferenced/unreferencedContext/UnreferencedContext.java b/jdk/test/java/rmi/server/Unreferenced/unreferencedContext/UnreferencedContext.java index eb9d1928773..05be7aed087 100644 --- a/jdk/test/java/rmi/server/Unreferenced/unreferencedContext/UnreferencedContext.java +++ b/jdk/test/java/rmi/server/Unreferenced/unreferencedContext/UnreferencedContext.java @@ -39,9 +39,7 @@ * @author Laird Dornin * * @library ../../../testlibrary - * @build UnreferencedContext - * @build UnreferencedContext_Stub - * @build TestLibrary + * @build TestLibrary UnreferencedContext_Stub * @run main/othervm/timeout=120 UnreferencedContext */ diff --git a/jdk/test/java/rmi/server/clientStackTrace/ClientStackTrace.java b/jdk/test/java/rmi/server/clientStackTrace/ClientStackTrace.java index 41a2103be30..d6855575942 100644 --- a/jdk/test/java/rmi/server/clientStackTrace/ClientStackTrace.java +++ b/jdk/test/java/rmi/server/clientStackTrace/ClientStackTrace.java @@ -28,7 +28,7 @@ * @author Laird Dornin * * @library ../../testlibrary - * @build ClientStackTrace MyRemoteObject_Stub TestLibrary TestParams + * @build TestLibrary ClientStackTrace MyRemoteObject_Stub * @run main/othervm/policy=security.policy/timeout=120 ClientStackTrace */ diff --git a/jdk/test/java/rmi/server/getRemoteClass/GetRemoteClass.java b/jdk/test/java/rmi/server/getRemoteClass/GetRemoteClass.java index 8fa471006cc..b6f21b46ef5 100644 --- a/jdk/test/java/rmi/server/getRemoteClass/GetRemoteClass.java +++ b/jdk/test/java/rmi/server/getRemoteClass/GetRemoteClass.java @@ -28,7 +28,7 @@ * @author Laird Dornin * * @library ../../testlibrary - * @build GetRemoteClass TestLibrary TestParams + * @build TestLibrary * @run main/othervm GetRemoteClass */ diff --git a/jdk/test/java/rmi/server/serverStackTrace/ServerStackTrace.java b/jdk/test/java/rmi/server/serverStackTrace/ServerStackTrace.java index 6cc9b2da119..43504affe28 100644 --- a/jdk/test/java/rmi/server/serverStackTrace/ServerStackTrace.java +++ b/jdk/test/java/rmi/server/serverStackTrace/ServerStackTrace.java @@ -29,8 +29,7 @@ * serialized with the Throwable from the server. * @author Peter Jones * - * @build ServerStackTrace - * @build ServerStackTrace_Stub + * @build ServerStackTrace ServerStackTrace_Stub * @run main/othervm ServerStackTrace */ diff --git a/jdk/test/java/rmi/server/serverStackTrace/SuppressStackTraces.java b/jdk/test/java/rmi/server/serverStackTrace/SuppressStackTraces.java index 243d3223f0a..9606d12f9d8 100644 --- a/jdk/test/java/rmi/server/serverStackTrace/SuppressStackTraces.java +++ b/jdk/test/java/rmi/server/serverStackTrace/SuppressStackTraces.java @@ -36,10 +36,7 @@ * for reasons of performance or confidentiality requirements. * @author Peter Jones * - * @build SuppressStackTraces - * @build Impl2_Stub - * @build Impl1_Stub - * @build Impl1_Skel + * @build SuppressStackTraces Impl2_Stub Impl1_Stub Impl1_Skel * @run main/othervm SuppressStackTraces */ diff --git a/jdk/test/java/rmi/server/useCustomRef/UseCustomRef.java b/jdk/test/java/rmi/server/useCustomRef/UseCustomRef.java index 059c9a849c3..23d784706ca 100644 --- a/jdk/test/java/rmi/server/useCustomRef/UseCustomRef.java +++ b/jdk/test/java/rmi/server/useCustomRef/UseCustomRef.java @@ -31,11 +31,7 @@ * 4180392 * * @library ../../testlibrary - * @build UseCustomRef - * @build Ping - * @build UseCustomRef_Stub - * @build UseCustomRef_Skel - * @build TestLibrary + * @build TestLibrary Ping UseCustomRef_Stub UseCustomRef_Skel * @run main/othervm/policy=security.policy/secure=java.rmi.RMISecurityManager/timeout=120 UseCustomRef * * This test was failing to run because the synthetic access diff --git a/jdk/test/java/rmi/testlibrary/JavaVM.java b/jdk/test/java/rmi/testlibrary/JavaVM.java index d0c3c38a16b..6ccae911a86 100644 --- a/jdk/test/java/rmi/testlibrary/JavaVM.java +++ b/jdk/test/java/rmi/testlibrary/JavaVM.java @@ -21,13 +21,10 @@ * questions. */ -/** - * - */ - -import java.io.*; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; import java.util.Arrays; -import java.util.Properties; import java.util.StringTokenizer; /** @@ -45,10 +42,6 @@ public class JavaVM { private OutputStream errorStream = System.err; private String policyFileName = null; - // This is used to shorten waiting time at startup. - private volatile boolean started = false; - private boolean forcesOutput = true; // default behavior - private static void mesg(Object mesg) { System.err.println("JAVAVM: " + mesg.toString()); } @@ -82,24 +75,6 @@ public class JavaVM { this.errorStream = err; } - /* This constructor will instantiate a JavaVM object for which caller - * can ask for forcing initial version output on child vm process - * (if forcesVersionOutput is true), or letting the started vm behave freely - * (when forcesVersionOutput is false). - */ - public JavaVM(String classname, - String options, String args, - OutputStream out, OutputStream err, - boolean forcesVersionOutput) { - this(classname, options, args, out, err); - this.forcesOutput = forcesVersionOutput; - } - - - public void setStarted() { - started = true; - } - // Prepends passed opts array to current options public void addOptions(String[] opts) { String newOpts = ""; @@ -139,7 +114,8 @@ public class JavaVM { */ public void start() throws IOException { - if (vm != null) return; + if (vm != null) + throw new IllegalStateException("JavaVM already started"); /* * If specified, add option for policy file @@ -151,18 +127,6 @@ public class JavaVM { addOptions(new String[] { getCodeCoverageOptions() }); - /* - * If forcesOutput is true : - * We force the new starting vm to output something so that we can know - * when it is effectively started by redirecting standard output through - * the next StreamPipe call (the vm is considered started when a first - * output has been streamed out). - * We do this by prepnding a "-showversion" option in the command line. - */ - if (forcesOutput) { - addOptions(new String[] {"-showversion"}); - } - StringTokenizer optionsTokenizer = new StringTokenizer(options); StringTokenizer argsTokenizer = new StringTokenizer(args); int optionsCount = optionsTokenizer.countTokens(); @@ -186,43 +150,8 @@ public class JavaVM { vm = Runtime.getRuntime().exec(javaCommand); /* output from the execed process may optionally be captured. */ - StreamPipe.plugTogether(this, vm.getInputStream(), this.outputStream); - StreamPipe.plugTogether(this, vm.getErrorStream(), this.errorStream); - - try { - if (forcesOutput) { - // Wait distant vm to start, by using waiting time slices of 100 ms. - // Wait at most for 2secs, after it considers the vm to be started. - final long vmStartSleepTime = 100; - final int maxTrials = 20; - int numTrials = 0; - while (!started && numTrials < maxTrials) { - numTrials++; - Thread.sleep(vmStartSleepTime); - } - - // Outputs running status of distant vm - String message = - "after " + (numTrials * vmStartSleepTime) + " milliseconds"; - if (started) { - mesg("distant vm process running, " + message); - } - else { - mesg("unknown running status of distant vm process, " + message); - } - } - else { - // Since we have no way to know if the distant vm is started, - // we just consider the vm to be started after a 2secs waiting time. - Thread.sleep(2000); - mesg("distant vm considered to be started after a waiting time of 2 secs"); - } - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - mesg("Thread interrupted while checking if distant vm is started. Giving up check."); - mesg("Distant vm state unknown"); - return; - } + StreamPipe.plugTogether(vm.getInputStream(), this.outputStream); + StreamPipe.plugTogether(vm.getErrorStream(), this.errorStream); } public void destroy() { diff --git a/jdk/test/java/rmi/testlibrary/StreamPipe.java b/jdk/test/java/rmi/testlibrary/StreamPipe.java index d2641abd465..5f5259b7ae8 100644 --- a/jdk/test/java/rmi/testlibrary/StreamPipe.java +++ b/jdk/test/java/rmi/testlibrary/StreamPipe.java @@ -21,11 +21,10 @@ * questions. */ -/** - * - */ - -import java.io.*; +import java.io.InputStream; +import java.io.InterruptedIOException; +import java.io.IOException; +import java.io.OutputStream; /** * Pipe output of one stream into input of another. @@ -34,84 +33,46 @@ public class StreamPipe extends Thread { private InputStream in; private OutputStream out; - private String preamble; - private JavaVM javaVM; - private static Object lock = new Object(); + + private static Object countLock = new Object(); private static int count = 0; - - /* StreamPipe constructor : should only be called by plugTogether() method !! - * If passed vm is not null : - * - This is StreamPipe usage when streams to pipe come from a given - * vm (JavaVM) process (the vm process must be started with a prefixed - * "-showversion" option to be able to determine as soon as possible when - * the vm process is started through the redirection of the streams). - * There must be a close connection between the StreamPipe instance and - * the JavaVM object on which a start() call has been done. - * run() method will flag distant JavaVM as started. - * If passed vm is null : - * - We don't have control on the process which we want to redirect the passed - * streams. - * run() method will ignore distant process. + /** + * StreamPipe constructor : should only be called by plugTogether() method. */ - private StreamPipe(JavaVM vm, InputStream in, OutputStream out, String name) { + private StreamPipe(InputStream in, OutputStream out, String name) { super(name); this.in = in; this.out = out; - this.preamble = "# "; - this.javaVM = vm; } - // Install redirection of passed InputStream and OutputStream from passed JavaVM - // to this vm standard output and input streams. - public static void plugTogether(JavaVM vm, InputStream in, OutputStream out) { - String name = null; + /** + * Creates a StreamPipe thread that copies in to out and returns + * the created instance. + */ + public static StreamPipe plugTogether(InputStream in, OutputStream out) { + String name; - synchronized (lock) { - name = "TestLibrary: StreamPipe-" + (count ++ ); + synchronized (countLock) { + name = "java.rmi.testlibrary.StreamPipe-" + (count++); } - Thread pipe = new StreamPipe(vm, in, out, name); + StreamPipe pipe = new StreamPipe(in, out, name); pipe.setDaemon(true); pipe.start(); - } - - /* Redirects the InputStream and OutputStream passed by caller to this - * vm standard output and input streams. - * (we just have to use fully parametered plugTogether() call with a null - * JavaVM input to do this). - */ - public static void plugTogether(InputStream in, OutputStream out) { - plugTogether(null, in, out); + return pipe; } // Starts redirection of streams. public void run() { - BufferedReader r = new BufferedReader(new InputStreamReader(in), 1); - BufferedWriter w = new BufferedWriter(new OutputStreamWriter(out)); - byte[] buf = new byte[256]; - try { - String line; + byte[] buf = new byte[1024]; - /* This is to check that the distant vm has started, - * if such a vm has been provided at construction : - * - As soon as we can read something from r BufferedReader, - * that means the distant vm is already started. - * Thus we signal associated JavaVM object that it is now started. - */ - if (((line = r.readLine()) != null) && - (javaVM != null)) { - javaVM.setStarted(); - } - - // Redirects r on w. - while (line != null) { - w.write(preamble); - w.write(line); - w.newLine(); - w.flush(); - line = r.readLine(); + while (true) { + int nr = in.read(buf); + if (nr == -1) + break; + out.write(buf, 0, nr); } } catch (InterruptedIOException iioe) { // Thread interrupted during IO operation. Terminate StreamPipe. @@ -121,5 +82,4 @@ public class StreamPipe extends Thread { e.printStackTrace(); } } - } diff --git a/jdk/test/java/rmi/testlibrary/TestLibrary.java b/jdk/test/java/rmi/testlibrary/TestLibrary.java index 734d8050918..07ed308355c 100644 --- a/jdk/test/java/rmi/testlibrary/TestLibrary.java +++ b/jdk/test/java/rmi/testlibrary/TestLibrary.java @@ -54,6 +54,7 @@ import java.rmi.server.RemoteRef; import java.rmi.server.UnicastRemoteObject; import java.util.Enumeration; import java.util.Properties; + import sun.rmi.registry.RegistryImpl; import sun.rmi.server.UnicastServerRef; import sun.rmi.transport.Endpoint; @@ -92,6 +93,7 @@ public class TestLibrary { public final static int INHERITEDCHANNELNOTSERVERSOCKET_ACTIVATION_PORT = 64003; public final static int INHERITEDCHANNELNOTSERVERSOCKET_REGISTRY_PORT = 64004; public final static int READTEST_REGISTRY_PORT = 64005; + private final static int MAX_SERVER_SOCKET_TRIES = 10; static void mesg(Object mesg) { System.err.println("TEST_LIBRARY: " + mesg.toString()); @@ -125,36 +127,15 @@ public class TestLibrary { bomb(null, e); } - /** - * Property accessors - */ - private static boolean getBoolean(String name) { - return (new Boolean(getProperty(name, "false")).booleanValue()); - } - private static Integer getInteger(String name) { - int val = 0; - Integer value = null; - - String propVal = getProperty(name, null); - if (propVal == null) { - return null; - } - - try { - value = new Integer(Integer.parseInt(propVal)); - } catch (NumberFormatException nfe) { - } - return value; - } public static String getProperty(String property, String defaultVal) { final String prop = property; final String def = defaultVal; - return ((String) java.security.AccessController.doPrivileged - (new java.security.PrivilegedAction() { - public Object run() { + return java.security.AccessController.doPrivileged( + new java.security.PrivilegedAction() { + public String run() { return System.getProperty(prop, def); } - })); + }); } /** @@ -169,9 +150,9 @@ public class TestLibrary { public static void setProperty(String property, String value) { final String prop = property; final String val = value; - java.security.AccessController.doPrivileged - (new java.security.PrivilegedAction() { - public Object run() { + java.security.AccessController.doPrivileged( + new java.security.PrivilegedAction() { + public Void run() { System.setProperty(prop, val); return null; } @@ -188,7 +169,7 @@ public class TestLibrary { out.println("-------------------Test environment----------" + "---------"); - for(Enumeration keys = System.getProperties().keys(); + for(Enumeration keys = System.getProperties().keys(); keys.hasMoreElements();) { String property = (String) keys.nextElement(); @@ -252,7 +233,7 @@ public class TestLibrary { /* * Obtain the URL for the codebase. */ - URL codebaseURL = dstDir.toURL(); + URL codebaseURL = dstDir.toURI().toURL(); /* * Specify where we will copy the class definition from, if @@ -407,26 +388,46 @@ public class TestLibrary { */ public static int getUnusedRandomPort() { int numTries = 0; - int unusedRandomPort = FIXED_PORT_MIN; - Exception ex = null; + IOException ex = null; - while (numTries++ < 10) { + while (numTries++ < MAX_SERVER_SOCKET_TRIES) { + int unusedRandomPort = -1; ex = null; //reset try (ServerSocket ss = new ServerSocket(0)) { unusedRandomPort = ss.getLocalPort(); - } catch (Exception e) { + } catch (IOException e) { ex = e; + // temporarily print stack trace here until we find out why + // tests are failing. + System.err.println("TestLibrary.getUnusedRandomPort() caught " + + "exception on iteration " + numTries + + (numTries==MAX_SERVER_SOCKET_TRIES ? " (the final try)." + : ".")); + ex.printStackTrace(); } - if (!isReservedPort(unusedRandomPort)) { - return unusedRandomPort; + if (unusedRandomPort >= 0) { + if (isReservedPort(unusedRandomPort)) { + System.out.println("INFO: On try # " + numTries + + (numTries==MAX_SERVER_SOCKET_TRIES ? ", the final try, ": ",") + + " ServerSocket(0) returned the reserved port " + + unusedRandomPort + + " in TestLibrary.getUnusedRandomPort() "); + } else { + return unusedRandomPort; + } } } // If we're here, then either an exception was thrown or the port is // a reserved port. - throw new RuntimeException("Error getting unused random port.", ex); + if (ex==null) { + throw new RuntimeException("Error getting unused random port. The" + +" last port returned by ServerSocket(0) was a reserved port"); + } else { + throw new RuntimeException("Error getting unused random port.", ex); + } } /** diff --git a/jdk/test/java/rmi/transport/acceptLoop/CloseServerSocketOnTermination.java b/jdk/test/java/rmi/transport/acceptLoop/CloseServerSocketOnTermination.java index a2361373644..b4d86c4ccd2 100644 --- a/jdk/test/java/rmi/transport/acceptLoop/CloseServerSocketOnTermination.java +++ b/jdk/test/java/rmi/transport/acceptLoop/CloseServerSocketOnTermination.java @@ -31,7 +31,6 @@ * exception for which it doesn't even consult the RMIFailureHandler. * @author Peter Jones * - * @build CloseServerSocketOnTermination * @run main/othervm CloseServerSocketOnTermination */ diff --git a/jdk/test/java/rmi/transport/checkFQDN/CheckFQDN.java b/jdk/test/java/rmi/transport/checkFQDN/CheckFQDN.java index 006de5b6c89..9660f532c39 100644 --- a/jdk/test/java/rmi/transport/checkFQDN/CheckFQDN.java +++ b/jdk/test/java/rmi/transport/checkFQDN/CheckFQDN.java @@ -33,8 +33,7 @@ * @author Laird Dornin * * @library ../../testlibrary - * @build CheckFQDN CheckFQDNClient CheckFQDN_Stub TellServerName - * @build TestLibrary + * @build TestLibrary CheckFQDNClient CheckFQDN_Stub TellServerName * @run main/othervm/timeout=120 CheckFQDN */ diff --git a/jdk/test/java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java b/jdk/test/java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java index 0ab00577dc8..52fd7df9295 100644 --- a/jdk/test/java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java +++ b/jdk/test/java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java @@ -28,8 +28,7 @@ * @author Laird Dornin * * @library ../../testlibrary - * @build CheckLeaseLeak CheckLeaseLeak_Stub LeaseLeakClient LeaseLeak - * @build TestLibrary + * @build TestLibrary CheckLeaseLeak_Stub LeaseLeakClient LeaseLeak * @run main/othervm/timeout=240 CheckLeaseLeak * */ diff --git a/jdk/test/java/rmi/transport/closeServerSocket/CloseServerSocket.java b/jdk/test/java/rmi/transport/closeServerSocket/CloseServerSocket.java index 69c51de8074..2b1f1eeba99 100644 --- a/jdk/test/java/rmi/transport/closeServerSocket/CloseServerSocket.java +++ b/jdk/test/java/rmi/transport/closeServerSocket/CloseServerSocket.java @@ -31,7 +31,7 @@ * @author Peter Jones * * @library ../../testlibrary - * @build CloseServerSocket TestLibrary + * @build TestLibrary * @run main/othervm CloseServerSocket */ diff --git a/jdk/test/java/rmi/transport/dgcDeadLock/DGCDeadLock.java b/jdk/test/java/rmi/transport/dgcDeadLock/DGCDeadLock.java index 97ad31dc99d..bcd58a0a6a5 100644 --- a/jdk/test/java/rmi/transport/dgcDeadLock/DGCDeadLock.java +++ b/jdk/test/java/rmi/transport/dgcDeadLock/DGCDeadLock.java @@ -28,11 +28,7 @@ * @author Laird Dornin * * @library ../../testlibrary - * @build DGCDeadLock - * @build Test - * @build TestImpl - * @build TestImpl_Stub - * @build TestLibrary + * @build TestLibrary Test TestImpl TestImpl_Stub * @run main/othervm/policy=security.policy/timeout=360 DGCDeadLock */ diff --git a/jdk/test/java/rmi/transport/handshakeFailure/HandshakeFailure.java b/jdk/test/java/rmi/transport/handshakeFailure/HandshakeFailure.java index df04070f138..ed1ba8e0715 100644 --- a/jdk/test/java/rmi/transport/handshakeFailure/HandshakeFailure.java +++ b/jdk/test/java/rmi/transport/handshakeFailure/HandshakeFailure.java @@ -31,7 +31,7 @@ * @author Peter Jones * * @library ../../testlibrary - * @build HandshakeFailure TestLibrary + * @build TestLibrary * @run main/othervm HandshakeFailure */ diff --git a/jdk/test/java/rmi/transport/handshakeTimeout/HandshakeTimeout.java b/jdk/test/java/rmi/transport/handshakeTimeout/HandshakeTimeout.java index 304c175772b..ba492f4194d 100644 --- a/jdk/test/java/rmi/transport/handshakeTimeout/HandshakeTimeout.java +++ b/jdk/test/java/rmi/transport/handshakeTimeout/HandshakeTimeout.java @@ -34,7 +34,7 @@ * @author Peter Jones * * @library ../../testlibrary - * @build HandshakeTimeout TestLibrary + * @build TestLibrary * @run main/othervm HandshakeTimeout */ diff --git a/jdk/test/java/rmi/transport/httpSocket/HttpSocketTest.java b/jdk/test/java/rmi/transport/httpSocket/HttpSocketTest.java index 1004bfb86ed..032c4cdc532 100644 --- a/jdk/test/java/rmi/transport/httpSocket/HttpSocketTest.java +++ b/jdk/test/java/rmi/transport/httpSocket/HttpSocketTest.java @@ -27,7 +27,7 @@ * @author Dana Burns * * @library ../../testlibrary - * @build HttpSocketTest HttpSocketTest_Stub TestLibrary + * @build TestLibrary HttpSocketTest HttpSocketTest_Stub * @run main/othervm/policy=security.policy HttpSocketTest */ diff --git a/jdk/test/java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java b/jdk/test/java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java index 5b21da8680a..4080bfa7e74 100644 --- a/jdk/test/java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java +++ b/jdk/test/java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java @@ -32,7 +32,7 @@ * @author Peter Jones * * @library ../../testlibrary - * @build TestLibrary RapidExportUnexport + * @build TestLibrary * @run main/othervm RapidExportUnexport */ diff --git a/jdk/test/java/rmi/transport/readTimeout/ReadTimeoutTest.java b/jdk/test/java/rmi/transport/readTimeout/ReadTimeoutTest.java index f72fea3164a..3a0bfa1cafa 100644 --- a/jdk/test/java/rmi/transport/readTimeout/ReadTimeoutTest.java +++ b/jdk/test/java/rmi/transport/readTimeout/ReadTimeoutTest.java @@ -27,12 +27,9 @@ * @summary Incoming connections should be subject to timeout * @author Adrian Colley * - * @library ../../testlibrary - * @build TestIface - * @build TestImpl - * @build TestImpl_Stub - * @build ReadTimeoutTest - * @run main/othervm/policy=security.policy/timeout=60 -Dsun.rmi.transport.tcp.readTimeout=5000 ReadTimeoutTest + * @build TestIface TestImpl TestImpl_Stub + * @run main/othervm/policy=security.policy/timeout=60 + * -Dsun.rmi.transport.tcp.readTimeout=5000 ReadTimeoutTest */ /* This test sets a very short read timeout, exports an object, and then diff --git a/jdk/test/java/rmi/transport/reuseDefaultPort/ReuseDefaultPort.java b/jdk/test/java/rmi/transport/reuseDefaultPort/ReuseDefaultPort.java index decec588d01..e5e7d80b49f 100644 --- a/jdk/test/java/rmi/transport/reuseDefaultPort/ReuseDefaultPort.java +++ b/jdk/test/java/rmi/transport/reuseDefaultPort/ReuseDefaultPort.java @@ -34,7 +34,7 @@ * @author Peter Jones * * @library ../../testlibrary - * @build ReuseDefaultPort TestLibrary + * @build TestLibrary * @run main/othervm ReuseDefaultPort */ diff --git a/jdk/test/java/rmi/transport/runtimeThreadInheritanceLeak/RuntimeThreadInheritanceLeak.java b/jdk/test/java/rmi/transport/runtimeThreadInheritanceLeak/RuntimeThreadInheritanceLeak.java index 04a931daf9b..ac480776229 100644 --- a/jdk/test/java/rmi/transport/runtimeThreadInheritanceLeak/RuntimeThreadInheritanceLeak.java +++ b/jdk/test/java/rmi/transport/runtimeThreadInheritanceLeak/RuntimeThreadInheritanceLeak.java @@ -38,7 +38,6 @@ * subsystems also not holding on to the loader in their daemon threads.] * @author Peter Jones * - * @build RuntimeThreadInheritanceLeak * @build RuntimeThreadInheritanceLeak_Stub * @run main/othervm RuntimeThreadInheritanceLeak */ diff --git a/jdk/test/java/security/Security/ClassLoaderDeadlock/ClassLoaderDeadlock.sh b/jdk/test/java/security/Security/ClassLoaderDeadlock/ClassLoaderDeadlock.sh index a503697dc73..a62cba4ec3a 100644 --- a/jdk/test/java/security/Security/ClassLoaderDeadlock/ClassLoaderDeadlock.sh +++ b/jdk/test/java/security/Security/ClassLoaderDeadlock/ClassLoaderDeadlock.sh @@ -87,7 +87,7 @@ ${TESTJAVA}${FILESEP}bin${FILESEP}javac \ ${TESTSRC}${FILESEP}provider${FILESEP}HashProvider.java # run the test -${TESTJAVA}${FILESEP}bin${FILESEP}java \ +${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} \ -classpath "${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}Deadlock.jar" \ -Djava.awt.headless=true \ ClassLoaderDeadlock diff --git a/jdk/test/java/security/Security/ClassLoaderDeadlock/Deadlock.sh b/jdk/test/java/security/Security/ClassLoaderDeadlock/Deadlock.sh index 53555ee26ff..e1ed14425fa 100644 --- a/jdk/test/java/security/Security/ClassLoaderDeadlock/Deadlock.sh +++ b/jdk/test/java/security/Security/ClassLoaderDeadlock/Deadlock.sh @@ -62,5 +62,5 @@ esac JAVA="${TESTJAVA}${FILESEP}bin${FILESEP}java" -${JAVA} -cp "${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}Deadlock.jar" Deadlock +${JAVA} ${TESTVMOPTS} -cp "${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}Deadlock.jar" Deadlock diff --git a/jdk/test/java/security/Security/ClassLoaderDeadlock/Deadlock2.sh b/jdk/test/java/security/Security/ClassLoaderDeadlock/Deadlock2.sh index 1109496c723..acf8ff21033 100644 --- a/jdk/test/java/security/Security/ClassLoaderDeadlock/Deadlock2.sh +++ b/jdk/test/java/security/Security/ClassLoaderDeadlock/Deadlock2.sh @@ -100,8 +100,8 @@ ${TESTJAVA}${FILESEP}bin${FILESEP}jar \ rm Deadlock2*.class # create serialized object and run the test -${TESTJAVA}${FILESEP}bin${FILESEP}java CreateSerialized -${TESTJAVA}${FILESEP}bin${FILESEP}java -Djava.ext.dirs=${TESTCLASSES}${FILESEP}testlib Deadlock2 +${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} CreateSerialized +${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} -Djava.ext.dirs=${TESTCLASSES}${FILESEP}testlib Deadlock2 STATUS=$? # clean up diff --git a/jdk/test/java/security/Security/signedfirst/Dyn.sh b/jdk/test/java/security/Security/signedfirst/Dyn.sh index d87e5ff0139..64d0dd3f775 100644 --- a/jdk/test/java/security/Security/signedfirst/Dyn.sh +++ b/jdk/test/java/security/Security/signedfirst/Dyn.sh @@ -83,7 +83,7 @@ ${TESTJAVA}${FILESEP}bin${FILESEP}javac \ ${TESTSRC}${FILESEP}DynSignedProvFirst.java # run the test -${TESTJAVA}${FILESEP}bin${FILESEP}java \ +${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} \ -classpath "${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}exp.jar" \ DynSignedProvFirst diff --git a/jdk/test/java/security/Security/signedfirst/Static.sh b/jdk/test/java/security/Security/signedfirst/Static.sh index 6b41adf31ad..544a3b1a3ff 100644 --- a/jdk/test/java/security/Security/signedfirst/Static.sh +++ b/jdk/test/java/security/Security/signedfirst/Static.sh @@ -84,7 +84,7 @@ ${TESTJAVA}${FILESEP}bin${FILESEP}javac \ # run the test cd ${TESTSRC}${FILESEP} -${TESTJAVA}${FILESEP}bin${FILESEP}java \ +${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} \ -classpath "${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}exp.jar" \ -Djava.security.properties=file:${TESTSRC}${FILESEP}Static.props \ StaticSignedProvFirst diff --git a/jdk/test/java/security/Signature/VerifyRangeCheckOverflow.java b/jdk/test/java/security/Signature/VerifyRangeCheckOverflow.java index 9077cc2c120..b68d8ca9be7 100644 --- a/jdk/test/java/security/Signature/VerifyRangeCheckOverflow.java +++ b/jdk/test/java/security/Signature/VerifyRangeCheckOverflow.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/security/cert/CertPathBuilder/targetConstraints/BuildEEBasicConstraints.java b/jdk/test/java/security/cert/CertPathBuilder/targetConstraints/BuildEEBasicConstraints.java index 6ab7cf25f1e..c590f685177 100644 --- a/jdk/test/java/security/cert/CertPathBuilder/targetConstraints/BuildEEBasicConstraints.java +++ b/jdk/test/java/security/cert/CertPathBuilder/targetConstraints/BuildEEBasicConstraints.java @@ -21,18 +21,22 @@ * questions. */ +// This test case relies on updated static security property, no way to re-use +// security property in samevm/agentvm mode. + /** * @test * @bug 6714842 * @library ../../../testlibrary * @build CertUtils - * @run main BuildEEBasicConstraints + * @run main/othervm BuildEEBasicConstraints * @summary make sure a PKIX CertPathBuilder builds a path to an * end entity certificate when the setBasicConstraints method of the * X509CertSelector of the targetConstraints PKIXBuilderParameters * parameter is set to -2. */ +import java.security.Security; import java.security.cert.Certificate; import java.security.cert.CertPath; import java.security.cert.CertStore; @@ -49,6 +53,9 @@ import java.util.List; public final class BuildEEBasicConstraints { public static void main(String[] args) throws Exception { + // reset the security property to make sure that the algorithms + // and keys used in this test are not disabled. + Security.setProperty("jdk.certpath.disabledAlgorithms", "MD2"); X509Certificate rootCert = CertUtils.getCertFromFile("anchor.cer"); TrustAnchor anchor = new TrustAnchor diff --git a/jdk/test/java/security/cert/CertificateFactory/slowstream.sh b/jdk/test/java/security/cert/CertificateFactory/slowstream.sh index fbca87e46a3..72d3fcf6c8c 100644 --- a/jdk/test/java/security/cert/CertificateFactory/slowstream.sh +++ b/jdk/test/java/security/cert/CertificateFactory/slowstream.sh @@ -46,5 +46,5 @@ case "$OS" in esac ${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}SlowStream.java -${TESTJAVA}${FS}bin${FS}java -Dtest.src=${TESTSRC} SlowStreamWriter | \ - ${TESTJAVA}${FS}bin${FS}java SlowStreamReader +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -Dtest.src=${TESTSRC} SlowStreamWriter | \ + ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} SlowStreamReader diff --git a/jdk/test/java/security/cert/pkix/policyChanges/TestPolicy.java b/jdk/test/java/security/cert/pkix/policyChanges/TestPolicy.java index ba56dab9e8c..567f551ccf5 100644 --- a/jdk/test/java/security/cert/pkix/policyChanges/TestPolicy.java +++ b/jdk/test/java/security/cert/pkix/policyChanges/TestPolicy.java @@ -21,16 +21,22 @@ * questions. */ +// This test case relies on updated static security property, no way to re-use +// security property in samevm/agentvm mode. + /** * @test * @bug 4684793 - * @summary verify that the RFC3280 policy processing changes are implemented correctly + * @summary verify that the RFC3280 policy processing changes are + * implemented correctly + * @run main/othervm TestPolicy * @author Andreas Sterbenz */ import java.io.*; import java.util.*; +import java.security.Security; import java.security.cert.*; public class TestPolicy { @@ -72,6 +78,10 @@ public class TestPolicy { }; public static void main(String[] args) throws Exception { + // reset the security property to make sure that the algorithms + // and keys used in this test are not disabled. + Security.setProperty("jdk.certpath.disabledAlgorithms", "MD2"); + factory = CertificateFactory.getInstance("X.509"); X509Certificate anchor = loadCertificate("anchor.cer"); diff --git a/jdk/test/java/text/Bidi/BidiConformance.java b/jdk/test/java/text/Bidi/BidiConformance.java index 75aea63d1d7..e6b5e5c6322 100644 --- a/jdk/test/java/text/Bidi/BidiConformance.java +++ b/jdk/test/java/text/Bidi/BidiConformance.java @@ -656,7 +656,6 @@ public class BidiConformance { baseIsLTR4Constructor1[textNo][testNo], isLTR_isRTL4Constructor1[textNo][0][testNo], isLTR_isRTL4Constructor1[textNo][1][testNo]); -System.out.println(bidi.toString()); } private void callTestEachMethod4Constructor2(int textNo, @@ -668,7 +667,6 @@ System.out.println(bidi.toString()); baseIsLTR4Constructor2[textNo][flagNo], isLTR_isRTL4Constructor2[textNo][0][flagNo], isLTR_isRTL4Constructor2[textNo][1][flagNo]); -System.out.println(bidi.toString()); } private void callTestEachMethod4Constructor3(int textNo, @@ -680,7 +678,6 @@ System.out.println(bidi.toString()); baseIsLTR4Constructor3[textNo][dataNo], isLTR_isRTL4Constructor3[textNo][0][dataNo], isLTR_isRTL4Constructor3[textNo][1][dataNo]); -System.out.println(bidi.toString()); } private StringBuilder sb = new StringBuilder(); @@ -934,59 +931,145 @@ System.out.println(bidi.toString()); System.out.println("*** Test getRunLevel()"); String str = "ABC 123"; - int length = str.length(); Bidi bidi = new Bidi(str, Bidi.DIRECTION_LEFT_TO_RIGHT); - try { - if (bidi.getRunLevel(-1) != 0 || // runCount - 2 + if (bidi.getRunLevel(-1) != 0 || // runCount - 2 (out of range) bidi.getRunLevel(0) != 0 || // runCount - 1 - bidi.getRunLevel(1) != 0 || // runCount - bidi.getRunLevel(2) != 0) { // runCount + 1 - errorHandling("getRunLevel() should return 0" + - " when getRunCount() is 1."); + bidi.getRunLevel(1) != 0 || // runCount (out of range) + bidi.getRunLevel(2) != 0) { // runCount + 1 (out of range) + errorHandling("Incorrect getRunLevel() value(s)."); } } catch (Exception e) { - errorHandling("getRunLevel() should not throw an exception " + - "when getRunCount() is 1."); + errorHandling("getRunLevel() should not throw an exception: " + e); } str = "ABC " + HebrewABC + " 123"; - length = str.length(); bidi = new Bidi(str, Bidi.DIRECTION_LEFT_TO_RIGHT); - try { - bidi.getRunLevel(-1); - errorHandling("getRunLevel() should throw an AIOoBE " + - "when run is -1(too small)."); - } - catch (ArrayIndexOutOfBoundsException e) { - } - catch (IllegalArgumentException e) { - errorHandling("getRunLevel() should not throw an IAE " + - "but an AIOoBE when run is -1(too small)."); - } - - try { - bidi.getRunLevel(0); - bidi.getRunLevel(1); - bidi.getRunLevel(2); + if (bidi.getRunLevel(-1) != 0 || // runCount - 4 (out of range) + bidi.getRunLevel(0) != 0 || // runCount - 3 + bidi.getRunLevel(1) != 1 || // runCount - 2 + bidi.getRunLevel(2) != 2 || // runCount - 1 + bidi.getRunLevel(3) != 0 || // runCount (out of range) + bidi.getRunLevel(4) != 0) { // runCount + 1 (out of range) + errorHandling("Incorrect getRunLevel() value(s)."); + } } catch (Exception e) { - errorHandling("getRunLevel() should not throw an exception" + - " when run is from 0 to 2(runCount-1)."); + errorHandling("getRunLevel() should not throw an exception: " + e); } + str = "ABC"; + bidi = new Bidi(str, Bidi.DIRECTION_LEFT_TO_RIGHT); try { - bidi.getRunLevel(3); - errorHandling("getRunLevel() should throw an AIOoBE" + - " when run is 3(same as runCount)."); + if (bidi.getRunLevel(-1) != 0 || // runCount - 2 (out of range) + bidi.getRunLevel(0) != 0 || // runCount - 1 + bidi.getRunLevel(1) != 0 || // runCount (out of range) + bidi.getRunLevel(2) != 0) { // runCount + 1 (out of range) + errorHandling("Incorrect getRunLevel() value(s)."); + } } - catch (ArrayIndexOutOfBoundsException e) { + catch (Exception e) { + errorHandling("getRunLevel() should not throw an exception: " + e); } - catch (IllegalArgumentException e) { - errorHandling("getRunLevel() should not throw an IAE " + - "but an AIOoBE when run is 3(same as runCount)."); + + str = "ABC"; + bidi = new Bidi(str, Bidi.DIRECTION_RIGHT_TO_LEFT); + try { + if (bidi.getRunLevel(-1) != 1 || // runCount - 2 (out of range) + bidi.getRunLevel(0) != 2 || // runCount - 1 + bidi.getRunLevel(1) != 1 || // runCount (out of range) + bidi.getRunLevel(2) != 1) { // runCount + 1 (out of range) + errorHandling("Incorrect getRunLevel() value(s)."); + } + } + catch (Exception e) { + errorHandling("getRunLevel() should not throw an exception: " + e); + } + + str = "ABC"; + bidi = new Bidi(str, Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT); + try { + if (bidi.getRunLevel(-1) != 0 || // runCount - 2 (out of range) + bidi.getRunLevel(0) != 0 || // runCount - 1 + bidi.getRunLevel(1) != 0 || // runCount (out of range) + bidi.getRunLevel(2) != 0) { // runCount + 1 (out of range) + errorHandling("Incorrect getRunLevel() value(s)."); + } + } + catch (Exception e) { + errorHandling("getRunLevel() should not throw an exception: " + e); + } + + str = "ABC"; + bidi = new Bidi(str, Bidi.DIRECTION_DEFAULT_RIGHT_TO_LEFT); + try { + if (bidi.getRunLevel(-1) != 0 || // runCount - 2 (out of range) + bidi.getRunLevel(0) != 0 || // runCount - 1 + bidi.getRunLevel(1) != 0 || // runCount (out of range) + bidi.getRunLevel(2) != 0) { // runCount + 1 (out of range) + errorHandling("Incorrect getRunLevel() value(s)."); + } + } + catch (Exception e) { + errorHandling("getRunLevel() should not throw an exception: " + e); + } + + str = HebrewABC; + bidi = new Bidi(str, Bidi.DIRECTION_LEFT_TO_RIGHT); + try { + if (bidi.getRunLevel(-1) != 0 || // runCount - 2 (out of range) + bidi.getRunLevel(0) != 1 || // runCount - 1 + bidi.getRunLevel(1) != 0 || // runCount (out of range) + bidi.getRunLevel(2) != 0) { // runCount + 1 (out of range) + errorHandling("Incorrect getRunLevel() value(s)."); + } + } + catch (Exception e) { + errorHandling("getRunLevel() should not throw an exception: " + e); + } + + str = HebrewABC; + bidi = new Bidi(str, Bidi.DIRECTION_RIGHT_TO_LEFT); + try { + if (bidi.getRunLevel(-1) != 1 || // runCount - 2 (out of range) + bidi.getRunLevel(0) != 1 || // runCount - 1 + bidi.getRunLevel(1) != 1 || // runCount (out of range) + bidi.getRunLevel(2) != 1) { // runCount + 1 (out of range) + errorHandling("Incorrect getRunLevel() value(s)."); + } + } + catch (Exception e) { + errorHandling("getRunLevel() should not throw an exception: " + e); + } + + str = HebrewABC; + bidi = new Bidi(str, Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT); + try { + if (bidi.getRunLevel(-1) != 1 || // runCount - 2 (out of range) + bidi.getRunLevel(0) != 1 || // runCount - 1 + bidi.getRunLevel(1) != 1 || // runCount (out of range) + bidi.getRunLevel(2) != 1) { // runCount + 1 (out of range) + errorHandling("Incorrect getRunLevel() value(s)."); + } + } + catch (Exception e) { + errorHandling("getRunLevel() should not throw an exception: " + e); + } + + str = HebrewABC; + bidi = new Bidi(str, Bidi.DIRECTION_DEFAULT_RIGHT_TO_LEFT); + try { + if (bidi.getRunLevel(-1) != 1 || // runCount - 2 (out of range) + bidi.getRunLevel(0) != 1 || // runCount - 1 + bidi.getRunLevel(1) != 1 || // runCount (out of range) + bidi.getRunLevel(2) != 1) { // runCount + 1 (out of range) + errorHandling("Incorrect getRunLevel() value(s)."); + } + } + catch (Exception e) { + errorHandling("getRunLevel() should not throw an exception: " + e); } } diff --git a/jdk/test/java/text/Bidi/Bug8005277.java b/jdk/test/java/text/Bidi/Bug8005277.java new file mode 100644 index 00000000000..0a843896ab2 --- /dev/null +++ b/jdk/test/java/text/Bidi/Bug8005277.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8005277 + * @summary verify that Bidi.getRunLevel() returns a corect level. + */ +import java.text.Bidi; + +public class Bug8005277 { + + public static void main(String[] args) { + boolean err = false; + String string = "\u05D0\u05D1\u05D2"; + Bidi bidi = new Bidi(string, Bidi.DIRECTION_LEFT_TO_RIGHT); + + int result = bidi.getRunCount(); + if (result != 1) { + System.err.println("Incorrect run count: " + result); + err = true; + } + + result = bidi.getRunStart(0); + if (result != 0) { + System.err.println("Incorrect run start: " + result); + err = true; + } + + result = bidi.getRunLimit(0); + if (result != 3) { + System.err.println("Incorrect run limit: " + result); + err = true; + } + + result = bidi.getRunLevel(0); + if (result != 1) { + System.err.println("Incorrect run level: " + result); + err = true; + } + + if (err) { + throw new RuntimeException("Failed."); + } + } + +} diff --git a/jdk/test/java/util/AbstractCollection/ToArrayTest.java b/jdk/test/java/util/AbstractCollection/ToArrayTest.java index 1cbf66fdf15..fd19f1672f6 100644 --- a/jdk/test/java/util/AbstractCollection/ToArrayTest.java +++ b/jdk/test/java/util/AbstractCollection/ToArrayTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/util/Arrays/ParallelSorting.java b/jdk/test/java/util/Arrays/ParallelSorting.java new file mode 100644 index 00000000000..4fc92199f82 --- /dev/null +++ b/jdk/test/java/util/Arrays/ParallelSorting.java @@ -0,0 +1,2067 @@ +/* + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* Adapted from test/java/util/Arrays/Sorting.java + * + * Where that test checks Arrays.sort against manual quicksort routines, + * this test checks parallelSort against either Arrays.sort or manual + * quicksort routines. + */ + +/* + * @test + * @bug 8003981 + * @run main ParallelSorting -shortrun + * @summary Exercise Arrays.parallelSort (adapted from test Sorting) + * + * @author Vladimir Yaroslavskiy + * @author Jon Bentley + * @author Josh Bloch + */ + +import java.util.Arrays; +import java.util.Random; +import java.io.PrintStream; +import java.util.Comparator; + +public class ParallelSorting { + private static final PrintStream out = System.out; + private static final PrintStream err = System.err; + + // Array lengths used in a long run (default) + private static final int[] LONG_RUN_LENGTHS = { + 1, 2, 3, 5, 8, 13, 21, 34, 55, 100, 1000, 10000, 100000, 1000000 }; + + // Array lengths used in a short run + private static final int[] SHORT_RUN_LENGTHS = { + 1, 2, 3, 21, 55, 1000, 10000 }; + + // Random initial values used in a long run (default) + private static final long[] LONG_RUN_RANDOMS = { 666, 0xC0FFEE, 999 }; + + // Random initial values used in a short run + private static final long[] SHORT_RUN_RANDOMS = { 666 }; + + public static void main(String[] args) { + boolean shortRun = args.length > 0 && args[0].equals("-shortrun"); + long start = System.currentTimeMillis(); + + if (shortRun) { + testAndCheck(SHORT_RUN_LENGTHS, SHORT_RUN_RANDOMS); + } else { + testAndCheck(LONG_RUN_LENGTHS, LONG_RUN_RANDOMS); + } + long end = System.currentTimeMillis(); + + out.format("PASSED in %d sec.\n", Math.round((end - start) / 1E3)); + } + + private static void testAndCheck(int[] lengths, long[] randoms) { + testEmptyAndNullIntArray(); + testEmptyAndNullLongArray(); + testEmptyAndNullShortArray(); + testEmptyAndNullCharArray(); + testEmptyAndNullByteArray(); + testEmptyAndNullFloatArray(); + testEmptyAndNullDoubleArray(); + + for (int length : lengths) { + testMergeSort(length); + testAndCheckRange(length); + testAndCheckSubArray(length); + } + for (long seed : randoms) { + for (int length : lengths) { + testAndCheckWithInsertionSort(length, new MyRandom(seed)); + testAndCheckWithCheckSum(length, new MyRandom(seed)); + testAndCheckWithScrambling(length, new MyRandom(seed)); + testAndCheckFloat(length, new MyRandom(seed)); + testAndCheckDouble(length, new MyRandom(seed)); + testStable(length, new MyRandom(seed)); + } + } + } + + private static void testEmptyAndNullIntArray() { + ourDescription = "Check empty and null array"; + Arrays.parallelSort(new int[]{}); + Arrays.parallelSort(new int[]{}, 0, 0); + + try { + Arrays.parallelSort((int[]) null); + } catch (NullPointerException expected) { + try { + Arrays.parallelSort((int[]) null, 0, 0); + } catch (NullPointerException expected2) { + return; + } + failed("Arrays.parallelSort(int[],fromIndex,toIndex) shouldn't " + + "catch null array"); + } + failed("Arrays.parallelSort(int[]) shouldn't catch null array"); + } + + private static void testEmptyAndNullLongArray() { + ourDescription = "Check empty and null array"; + Arrays.parallelSort(new long[]{}); + Arrays.parallelSort(new long[]{}, 0, 0); + + try { + Arrays.parallelSort((long[]) null); + } catch (NullPointerException expected) { + try { + Arrays.parallelSort((long[]) null, 0, 0); + } catch (NullPointerException expected2) { + return; + } + failed("Arrays.parallelSort(long[],fromIndex,toIndex) shouldn't " + + "catch null array"); + } + failed("Arrays.parallelSort(long[]) shouldn't catch null array"); + } + + private static void testEmptyAndNullShortArray() { + ourDescription = "Check empty and null array"; + Arrays.parallelSort(new short[]{}); + Arrays.parallelSort(new short[]{}, 0, 0); + + try { + Arrays.parallelSort((short[]) null); + } catch (NullPointerException expected) { + try { + Arrays.parallelSort((short[]) null, 0, 0); + } catch (NullPointerException expected2) { + return; + } + failed("Arrays.parallelSort(short[],fromIndex,toIndex) shouldn't " + + "catch null array"); + } + failed("Arrays.parallelSort(short[]) shouldn't catch null array"); + } + + private static void testEmptyAndNullCharArray() { + ourDescription = "Check empty and null array"; + Arrays.parallelSort(new char[]{}); + Arrays.parallelSort(new char[]{}, 0, 0); + + try { + Arrays.parallelSort((char[]) null); + } catch (NullPointerException expected) { + try { + Arrays.parallelSort((char[]) null, 0, 0); + } catch (NullPointerException expected2) { + return; + } + failed("Arrays.parallelSort(char[],fromIndex,toIndex) shouldn't " + + "catch null array"); + } + failed("Arrays.parallelSort(char[]) shouldn't catch null array"); + } + + private static void testEmptyAndNullByteArray() { + ourDescription = "Check empty and null array"; + Arrays.parallelSort(new byte[]{}); + Arrays.parallelSort(new byte[]{}, 0, 0); + + try { + Arrays.parallelSort((byte[]) null); + } catch (NullPointerException expected) { + try { + Arrays.parallelSort((byte[]) null, 0, 0); + } catch (NullPointerException expected2) { + return; + } + failed("Arrays.parallelSort(byte[],fromIndex,toIndex) shouldn't " + + "catch null array"); + } + failed("Arrays.parallelSort(byte[]) shouldn't catch null array"); + } + + private static void testEmptyAndNullFloatArray() { + ourDescription = "Check empty and null array"; + Arrays.parallelSort(new float[]{}); + Arrays.parallelSort(new float[]{}, 0, 0); + + try { + Arrays.parallelSort((float[]) null); + } catch (NullPointerException expected) { + try { + Arrays.parallelSort((float[]) null, 0, 0); + } catch (NullPointerException expected2) { + return; + } + failed("Arrays.parallelSort(float[],fromIndex,toIndex) shouldn't " + + "catch null array"); + } + failed("Arrays.parallelSort(float[]) shouldn't catch null array"); + } + + private static void testEmptyAndNullDoubleArray() { + ourDescription = "Check empty and null array"; + Arrays.parallelSort(new double[]{}); + Arrays.parallelSort(new double[]{}, 0, 0); + + try { + Arrays.parallelSort((double[]) null); + } catch (NullPointerException expected) { + try { + Arrays.parallelSort((double[]) null, 0, 0); + } catch (NullPointerException expected2) { + return; + } + failed("Arrays.parallelSort(double[],fromIndex,toIndex) shouldn't " + + "catch null array"); + } + failed("Arrays.parallelSort(double[]) shouldn't catch null array"); + } + + private static void testAndCheckSubArray(int length) { + ourDescription = "Check sorting of subarray"; + int[] golden = new int[length]; + boolean newLine = false; + + for (int m = 1; m < length / 2; m *= 2) { + newLine = true; + int fromIndex = m; + int toIndex = length - m; + + prepareSubArray(golden, fromIndex, toIndex, m); + int[] test = golden.clone(); + + for (TypeConverter converter : TypeConverter.values()) { + out.println("Test 'subarray': " + converter + + " length = " + length + ", m = " + m); + Object convertedGolden = converter.convert(golden); + Object convertedTest = converter.convert(test); + sortSubArray(convertedTest, fromIndex, toIndex); + checkSubArray(convertedTest, fromIndex, toIndex, m); + } + } + if (newLine) { + out.println(); + } + } + + private static void testAndCheckRange(int length) { + ourDescription = "Check range check"; + int[] golden = new int[length]; + + for (int m = 1; m < 2 * length; m *= 2) { + for (int i = 1; i <= length; i++) { + golden[i - 1] = i % m + m % i; + } + for (TypeConverter converter : TypeConverter.values()) { + out.println("Test 'range': " + converter + + ", length = " + length + ", m = " + m); + Object convertedGolden = converter.convert(golden); + checkRange(convertedGolden, m); + } + } + out.println(); + } + + private static void testStable(int length, MyRandom random) { + ourDescription = "Check if sorting is stable"; + Pair[] a = build(length, random); + + out.println("Test 'stable': " + "random = " + random.getSeed() + + ", length = " + length); + Arrays.parallelSort(a); + checkSorted(a); + checkStable(a); + out.println(); + + a = build(length, random); + + out.println("Test 'stable' comparator: " + "random = " + random.getSeed() + + ", length = " + length); + Arrays.parallelSort(a, pairCmp); + checkSorted(a); + checkStable(a); + out.println(); + + } + + private static void checkSorted(Pair[] a) { + for (int i = 0; i < a.length - 1; i++) { + if (a[i].getKey() > a[i + 1].getKey()) { + failedSort(i, "" + a[i].getKey(), "" + a[i + 1].getKey()); + } + } + } + + private static void checkStable(Pair[] a) { + for (int i = 0; i < a.length / 4; ) { + int key1 = a[i].getKey(); + int value1 = a[i++].getValue(); + int key2 = a[i].getKey(); + int value2 = a[i++].getValue(); + int key3 = a[i].getKey(); + int value3 = a[i++].getValue(); + int key4 = a[i].getKey(); + int value4 = a[i++].getValue(); + + if (!(key1 == key2 && key2 == key3 && key3 == key4)) { + failed("On position " + i + " keys are different " + + key1 + ", " + key2 + ", " + key3 + ", " + key4); + } + if (!(value1 < value2 && value2 < value3 && value3 < value4)) { + failed("Sorting is not stable at position " + i + + ". Second values have been changed: " + value1 + ", " + + value2 + ", " + value3 + ", " + value4); + } + } + } + + private static Pair[] build(int length, Random random) { + Pair[] a = new Pair[length * 4]; + + for (int i = 0; i < a.length; ) { + int key = random.nextInt(); + a[i++] = new Pair(key, 1); + a[i++] = new Pair(key, 2); + a[i++] = new Pair(key, 3); + a[i++] = new Pair(key, 4); + } + return a; + } + + private static Comparator pairCmp = new Comparator() { + public int compare(Pair p1, Pair p2) { + return p1.compareTo(p2); + } + }; + + private static final class Pair implements Comparable { + Pair(int key, int value) { + myKey = key; + myValue = value; + } + + int getKey() { + return myKey; + } + + int getValue() { + return myValue; + } + + public int compareTo(Pair pair) { + if (myKey < pair.myKey) { + return -1; + } + if (myKey > pair.myKey) { + return 1; + } + return 0; + } + + @Override + public String toString() { + return "(" + myKey + ", " + myValue + ")"; + } + + private int myKey; + private int myValue; + } + + + private static void testAndCheckWithInsertionSort(int length, MyRandom random) { + if (length > 1000) { + return; + } + ourDescription = "Check sorting with insertion sort"; + int[] golden = new int[length]; + + for (int m = 1; m < 2 * length; m *= 2) { + for (UnsortedBuilder builder : UnsortedBuilder.values()) { + builder.build(golden, m, random); + int[] test = golden.clone(); + + for (TypeConverter converter : TypeConverter.values()) { + out.println("Test 'insertion sort': " + converter + + " " + builder + "random = " + random.getSeed() + + ", length = " + length + ", m = " + m); + Object convertedGolden = converter.convert(golden); + Object convertedTest1 = converter.convert(test); + Object convertedTest2 = converter.convert(test); + sort(convertedTest1); + sortByInsertionSort(convertedTest2); + compare(convertedTest1, convertedTest2); + } + } + } + out.println(); + } + + private static void testMergeSort(int length) { + if (length < 1000) { + return; + } + ourDescription = "Check merge sorting"; + int[] golden = new int[length]; + int period = 67; // java.util.DualPivotQuicksort.MAX_RUN_COUNT + + for (int m = period - 2; m <= period + 2; m++) { + for (MergeBuilder builder : MergeBuilder.values()) { + builder.build(golden, m); + int[] test = golden.clone(); + + for (TypeConverter converter : TypeConverter.values()) { + out.println("Test 'merge sort': " + converter + " " + + builder + "length = " + length + ", m = " + m); + Object convertedGolden = converter.convert(golden); + sort(convertedGolden); + checkSorted(convertedGolden); + } + } + } + out.println(); + } + + private static void testAndCheckWithCheckSum(int length, MyRandom random) { + ourDescription = "Check sorting with check sum"; + int[] golden = new int[length]; + + for (int m = 1; m < 2 * length; m *= 2) { + for (UnsortedBuilder builder : UnsortedBuilder.values()) { + builder.build(golden, m, random); + int[] test = golden.clone(); + + for (TypeConverter converter : TypeConverter.values()) { + out.println("Test 'check sum': " + converter + + " " + builder + "random = " + random.getSeed() + + ", length = " + length + ", m = " + m); + Object convertedGolden = converter.convert(golden); + Object convertedTest = converter.convert(test); + sort(convertedTest); + checkWithCheckSum(convertedTest, convertedGolden); + } + } + } + out.println(); + } + + private static void testAndCheckWithScrambling(int length, MyRandom random) { + ourDescription = "Check sorting with scrambling"; + int[] golden = new int[length]; + + for (int m = 1; m <= 7; m++) { + if (m > length) { + break; + } + for (SortedBuilder builder : SortedBuilder.values()) { + builder.build(golden, m); + int[] test = golden.clone(); + scramble(test, random); + + for (TypeConverter converter : TypeConverter.values()) { + out.println("Test 'scrambling': " + converter + + " " + builder + "random = " + random.getSeed() + + ", length = " + length + ", m = " + m); + Object convertedGolden = converter.convert(golden); + Object convertedTest = converter.convert(test); + sort(convertedTest); + compare(convertedTest, convertedGolden); + } + } + } + out.println(); + } + + private static void testAndCheckFloat(int length, MyRandom random) { + ourDescription = "Check float sorting"; + float[] golden = new float[length]; + final int MAX = 10; + boolean newLine = false; + + for (int a = 0; a <= MAX; a++) { + for (int g = 0; g <= MAX; g++) { + for (int z = 0; z <= MAX; z++) { + for (int n = 0; n <= MAX; n++) { + for (int p = 0; p <= MAX; p++) { + if (a + g + z + n + p > length) { + continue; + } + if (a + g + z + n + p < length) { + continue; + } + for (FloatBuilder builder : FloatBuilder.values()) { + out.println("Test 'float': random = " + random.getSeed() + + ", length = " + length + ", a = " + a + ", g = " + + g + ", z = " + z + ", n = " + n + ", p = " + p); + builder.build(golden, a, g, z, n, p, random); + float[] test = golden.clone(); + scramble(test, random); + sort(test); + compare(test, golden, a, n, g); + } + newLine = true; + } + } + } + } + } + if (newLine) { + out.println(); + } + } + + private static void testAndCheckDouble(int length, MyRandom random) { + ourDescription = "Check double sorting"; + double[] golden = new double[length]; + final int MAX = 10; + boolean newLine = false; + + for (int a = 0; a <= MAX; a++) { + for (int g = 0; g <= MAX; g++) { + for (int z = 0; z <= MAX; z++) { + for (int n = 0; n <= MAX; n++) { + for (int p = 0; p <= MAX; p++) { + if (a + g + z + n + p > length) { + continue; + } + if (a + g + z + n + p < length) { + continue; + } + for (DoubleBuilder builder : DoubleBuilder.values()) { + out.println("Test 'double': random = " + random.getSeed() + + ", length = " + length + ", a = " + a + ", g = " + + g + ", z = " + z + ", n = " + n + ", p = " + p); + builder.build(golden, a, g, z, n, p, random); + double[] test = golden.clone(); + scramble(test, random); + sort(test); + compare(test, golden, a, n, g); + } + newLine = true; + } + } + } + } + } + if (newLine) { + out.println(); + } + } + + private static void prepareSubArray(int[] a, int fromIndex, int toIndex, int m) { + for (int i = 0; i < fromIndex; i++) { + a[i] = 0xDEDA; + } + int middle = (fromIndex + toIndex) >>> 1; + int k = 0; + + for (int i = fromIndex; i < middle; i++) { + a[i] = k++; + } + for (int i = middle; i < toIndex; i++) { + a[i] = k--; + } + for (int i = toIndex; i < a.length; i++) { + a[i] = 0xBABA; + } + } + + private static void scramble(int[] a, Random random) { + for (int i = 0; i < a.length * 7; i++) { + swap(a, random.nextInt(a.length), random.nextInt(a.length)); + } + } + + private static void scramble(float[] a, Random random) { + for (int i = 0; i < a.length * 7; i++) { + swap(a, random.nextInt(a.length), random.nextInt(a.length)); + } + } + + private static void scramble(double[] a, Random random) { + for (int i = 0; i < a.length * 7; i++) { + swap(a, random.nextInt(a.length), random.nextInt(a.length)); + } + } + + private static void swap(int[] a, int i, int j) { + int t = a[i]; + a[i] = a[j]; + a[j] = t; + } + + private static void swap(float[] a, int i, int j) { + float t = a[i]; + a[i] = a[j]; + a[j] = t; + } + + private static void swap(double[] a, int i, int j) { + double t = a[i]; + a[i] = a[j]; + a[j] = t; + } + + private static enum TypeConverter { + INT { + Object convert(int[] a) { + return a.clone(); + } + }, + LONG { + Object convert(int[] a) { + long[] b = new long[a.length]; + + for (int i = 0; i < a.length; i++) { + b[i] = (long) a[i]; + } + return b; + } + }, + BYTE { + Object convert(int[] a) { + byte[] b = new byte[a.length]; + + for (int i = 0; i < a.length; i++) { + b[i] = (byte) a[i]; + } + return b; + } + }, + SHORT { + Object convert(int[] a) { + short[] b = new short[a.length]; + + for (int i = 0; i < a.length; i++) { + b[i] = (short) a[i]; + } + return b; + } + }, + CHAR { + Object convert(int[] a) { + char[] b = new char[a.length]; + + for (int i = 0; i < a.length; i++) { + b[i] = (char) a[i]; + } + return b; + } + }, + FLOAT { + Object convert(int[] a) { + float[] b = new float[a.length]; + + for (int i = 0; i < a.length; i++) { + b[i] = (float) a[i]; + } + return b; + } + }, + DOUBLE { + Object convert(int[] a) { + double[] b = new double[a.length]; + + for (int i = 0; i < a.length; i++) { + b[i] = (double) a[i]; + } + return b; + } + }, + INTEGER { + Object convert(int[] a) { + Integer[] b = new Integer[a.length]; + + for (int i = 0; i < a.length; i++) { + b[i] = new Integer(a[i]); + } + return b; + } + }; + + abstract Object convert(int[] a); + + @Override public String toString() { + String name = name(); + + for (int i = name.length(); i < 9; i++) { + name += " "; + } + return name; + } + } + + private static enum FloatBuilder { + SIMPLE { + void build(float[] x, int a, int g, int z, int n, int p, Random random) { + int fromIndex = 0; + float negativeValue = -random.nextFloat(); + float positiveValue = random.nextFloat(); + + writeValue(x, negativeValue, fromIndex, n); + fromIndex += n; + + writeValue(x, -0.0f, fromIndex, g); + fromIndex += g; + + writeValue(x, 0.0f, fromIndex, z); + fromIndex += z; + + writeValue(x, positiveValue, fromIndex, p); + fromIndex += p; + + writeValue(x, Float.NaN, fromIndex, a); + } + }; + + abstract void build(float[] x, int a, int g, int z, int n, int p, Random random); + } + + private static enum DoubleBuilder { + SIMPLE { + void build(double[] x, int a, int g, int z, int n, int p, Random random) { + int fromIndex = 0; + double negativeValue = -random.nextFloat(); + double positiveValue = random.nextFloat(); + + writeValue(x, negativeValue, fromIndex, n); + fromIndex += n; + + writeValue(x, -0.0d, fromIndex, g); + fromIndex += g; + + writeValue(x, 0.0d, fromIndex, z); + fromIndex += z; + + writeValue(x, positiveValue, fromIndex, p); + fromIndex += p; + + writeValue(x, Double.NaN, fromIndex, a); + } + }; + + abstract void build(double[] x, int a, int g, int z, int n, int p, Random random); + } + + private static void writeValue(float[] a, float value, int fromIndex, int count) { + for (int i = fromIndex; i < fromIndex + count; i++) { + a[i] = value; + } + } + + private static void compare(float[] a, float[] b, int numNaN, int numNeg, int numNegZero) { + for (int i = a.length - numNaN; i < a.length; i++) { + if (a[i] == a[i]) { + failed("On position " + i + " must be NaN instead of " + a[i]); + } + } + final int NEGATIVE_ZERO = Float.floatToIntBits(-0.0f); + + for (int i = numNeg; i < numNeg + numNegZero; i++) { + if (NEGATIVE_ZERO != Float.floatToIntBits(a[i])) { + failed("On position " + i + " must be -0.0 instead of " + a[i]); + } + } + for (int i = 0; i < a.length - numNaN; i++) { + if (a[i] != b[i]) { + failedCompare(i, "" + a[i], "" + b[i]); + } + } + } + + private static void writeValue(double[] a, double value, int fromIndex, int count) { + for (int i = fromIndex; i < fromIndex + count; i++) { + a[i] = value; + } + } + + private static void compare(double[] a, double[] b, int numNaN, int numNeg, int numNegZero) { + for (int i = a.length - numNaN; i < a.length; i++) { + if (a[i] == a[i]) { + failed("On position " + i + " must be NaN instead of " + a[i]); + } + } + final long NEGATIVE_ZERO = Double.doubleToLongBits(-0.0d); + + for (int i = numNeg; i < numNeg + numNegZero; i++) { + if (NEGATIVE_ZERO != Double.doubleToLongBits(a[i])) { + failed("On position " + i + " must be -0.0 instead of " + a[i]); + } + } + for (int i = 0; i < a.length - numNaN; i++) { + if (a[i] != b[i]) { + failedCompare(i, "" + a[i], "" + b[i]); + } + } + } + + private static enum SortedBuilder { + REPEATED { + void build(int[] a, int m) { + int period = a.length / m; + int i = 0; + int k = 0; + + while (true) { + for (int t = 1; t <= period; t++) { + if (i >= a.length) { + return; + } + a[i++] = k; + } + if (i >= a.length) { + return; + } + k++; + } + } + }, + ORGAN_PIPES { + void build(int[] a, int m) { + int i = 0; + int k = m; + + while (true) { + for (int t = 1; t <= m; t++) { + if (i >= a.length) { + return; + } + a[i++] = k; + } + } + } + }; + + abstract void build(int[] a, int m); + + @Override public String toString() { + String name = name(); + + for (int i = name.length(); i < 12; i++) { + name += " "; + } + return name; + } + } + + private static enum MergeBuilder { + ASCENDING { + void build(int[] a, int m) { + int period = a.length / m; + int v = 1, i = 0; + + for (int k = 0; k < m; k++) { + v = 1; + for (int p = 0; p < period; p++) { + a[i++] = v++; + } + } + for (int j = i; j < a.length - 1; j++) { + a[j] = v++; + } + a[a.length - 1] = 0; + } + }, + DESCENDING { + void build(int[] a, int m) { + int period = a.length / m; + int v = -1, i = 0; + + for (int k = 0; k < m; k++) { + v = -1; + for (int p = 0; p < period; p++) { + a[i++] = v--; + } + } + for (int j = i; j < a.length - 1; j++) { + a[j] = v--; + } + a[a.length - 1] = 0; + } + }; + + abstract void build(int[] a, int m); + + @Override public String toString() { + String name = name(); + + for (int i = name.length(); i < 12; i++) { + name += " "; + } + return name; + } + } + + private static enum UnsortedBuilder { + RANDOM { + void build(int[] a, int m, Random random) { + for (int i = 0; i < a.length; i++) { + a[i] = random.nextInt(); + } + } + }, + ASCENDING { + void build(int[] a, int m, Random random) { + for (int i = 0; i < a.length; i++) { + a[i] = m + i; + } + } + }, + DESCENDING { + void build(int[] a, int m, Random random) { + for (int i = 0; i < a.length; i++) { + a[i] = a.length - m - i; + } + } + }, + ALL_EQUAL { + void build(int[] a, int m, Random random) { + for (int i = 0; i < a.length; i++) { + a[i] = m; + } + } + }, + SAW { + void build(int[] a, int m, Random random) { + int incCount = 1; + int decCount = a.length; + int i = 0; + int period = m--; + + while (true) { + for (int k = 1; k <= period; k++) { + if (i >= a.length) { + return; + } + a[i++] = incCount++; + } + period += m; + + for (int k = 1; k <= period; k++) { + if (i >= a.length) { + return; + } + a[i++] = decCount--; + } + period += m; + } + } + }, + REPEATED { + void build(int[] a, int m, Random random) { + for (int i = 0; i < a.length; i++) { + a[i] = i % m; + } + } + }, + DUPLICATED { + void build(int[] a, int m, Random random) { + for (int i = 0; i < a.length; i++) { + a[i] = random.nextInt(m); + } + } + }, + ORGAN_PIPES { + void build(int[] a, int m, Random random) { + int middle = a.length / (m + 1); + + for (int i = 0; i < middle; i++) { + a[i] = i; + } + for (int i = middle; i < a.length; i++) { + a[i] = a.length - i - 1; + } + } + }, + STAGGER { + void build(int[] a, int m, Random random) { + for (int i = 0; i < a.length; i++) { + a[i] = (i * m + i) % a.length; + } + } + }, + PLATEAU { + void build(int[] a, int m, Random random) { + for (int i = 0; i < a.length; i++) { + a[i] = Math.min(i, m); + } + } + }, + SHUFFLE { + void build(int[] a, int m, Random random) { + int x = 0, y = 0; + for (int i = 0; i < a.length; i++) { + a[i] = random.nextBoolean() ? (x += 2) : (y += 2); + } + } + }; + + abstract void build(int[] a, int m, Random random); + + @Override public String toString() { + String name = name(); + + for (int i = name.length(); i < 12; i++) { + name += " "; + } + return name; + } + } + + private static void checkWithCheckSum(Object test, Object golden) { + checkSorted(test); + checkCheckSum(test, golden); + } + + private static void failed(String message) { + err.format("\n*** TEST FAILED - %s.\n\n%s.\n\n", ourDescription, message); + throw new RuntimeException("Test failed - see log file for details"); + } + + private static void failedSort(int index, String value1, String value2) { + failed("Array is not sorted at " + index + "-th position: " + + value1 + " and " + value2); + } + + private static void failedCompare(int index, String value1, String value2) { + failed("On position " + index + " must be " + value2 + " instead of " + value1); + } + + private static void compare(Object test, Object golden) { + if (test instanceof int[]) { + compare((int[]) test, (int[]) golden); + } else if (test instanceof long[]) { + compare((long[]) test, (long[]) golden); + } else if (test instanceof short[]) { + compare((short[]) test, (short[]) golden); + } else if (test instanceof byte[]) { + compare((byte[]) test, (byte[]) golden); + } else if (test instanceof char[]) { + compare((char[]) test, (char[]) golden); + } else if (test instanceof float[]) { + compare((float[]) test, (float[]) golden); + } else if (test instanceof double[]) { + compare((double[]) test, (double[]) golden); + } else if (test instanceof Integer[]) { + compare((Integer[]) test, (Integer[]) golden); + } else { + failed("Unknow type of array: " + test + " of class " + + test.getClass().getName()); + } + } + + private static void compare(int[] a, int[] b) { + for (int i = 0; i < a.length; i++) { + if (a[i] != b[i]) { + failedCompare(i, "" + a[i], "" + b[i]); + } + } + } + + private static void compare(long[] a, long[] b) { + for (int i = 0; i < a.length; i++) { + if (a[i] != b[i]) { + failedCompare(i, "" + a[i], "" + b[i]); + } + } + } + + private static void compare(short[] a, short[] b) { + for (int i = 0; i < a.length; i++) { + if (a[i] != b[i]) { + failedCompare(i, "" + a[i], "" + b[i]); + } + } + } + + private static void compare(byte[] a, byte[] b) { + for (int i = 0; i < a.length; i++) { + if (a[i] != b[i]) { + failedCompare(i, "" + a[i], "" + b[i]); + } + } + } + + private static void compare(char[] a, char[] b) { + for (int i = 0; i < a.length; i++) { + if (a[i] != b[i]) { + failedCompare(i, "" + a[i], "" + b[i]); + } + } + } + + private static void compare(float[] a, float[] b) { + for (int i = 0; i < a.length; i++) { + if (a[i] != b[i]) { + failedCompare(i, "" + a[i], "" + b[i]); + } + } + } + + private static void compare(double[] a, double[] b) { + for (int i = 0; i < a.length; i++) { + if (a[i] != b[i]) { + failedCompare(i, "" + a[i], "" + b[i]); + } + } + } + + private static void compare(Integer[] a, Integer[] b) { + for (int i = 0; i < a.length; i++) { + if (a[i].compareTo(b[i]) != 0) { + failedCompare(i, "" + a[i], "" + b[i]); + } + } + } + + private static void checkSorted(Object object) { + if (object instanceof int[]) { + checkSorted((int[]) object); + } else if (object instanceof long[]) { + checkSorted((long[]) object); + } else if (object instanceof short[]) { + checkSorted((short[]) object); + } else if (object instanceof byte[]) { + checkSorted((byte[]) object); + } else if (object instanceof char[]) { + checkSorted((char[]) object); + } else if (object instanceof float[]) { + checkSorted((float[]) object); + } else if (object instanceof double[]) { + checkSorted((double[]) object); + } else if (object instanceof Integer[]) { + checkSorted((Integer[]) object); + } else { + failed("Unknow type of array: " + object + " of class " + + object.getClass().getName()); + } + } + + private static void checkSorted(int[] a) { + for (int i = 0; i < a.length - 1; i++) { + if (a[i] > a[i + 1]) { + failedSort(i, "" + a[i], "" + a[i + 1]); + } + } + } + + private static void checkSorted(long[] a) { + for (int i = 0; i < a.length - 1; i++) { + if (a[i] > a[i + 1]) { + failedSort(i, "" + a[i], "" + a[i + 1]); + } + } + } + + private static void checkSorted(short[] a) { + for (int i = 0; i < a.length - 1; i++) { + if (a[i] > a[i + 1]) { + failedSort(i, "" + a[i], "" + a[i + 1]); + } + } + } + + private static void checkSorted(byte[] a) { + for (int i = 0; i < a.length - 1; i++) { + if (a[i] > a[i + 1]) { + failedSort(i, "" + a[i], "" + a[i + 1]); + } + } + } + + private static void checkSorted(char[] a) { + for (int i = 0; i < a.length - 1; i++) { + if (a[i] > a[i + 1]) { + failedSort(i, "" + a[i], "" + a[i + 1]); + } + } + } + + private static void checkSorted(float[] a) { + for (int i = 0; i < a.length - 1; i++) { + if (a[i] > a[i + 1]) { + failedSort(i, "" + a[i], "" + a[i + 1]); + } + } + } + + private static void checkSorted(double[] a) { + for (int i = 0; i < a.length - 1; i++) { + if (a[i] > a[i + 1]) { + failedSort(i, "" + a[i], "" + a[i + 1]); + } + } + } + + private static void checkSorted(Integer[] a) { + for (int i = 0; i < a.length - 1; i++) { + if (a[i].intValue() > a[i + 1].intValue()) { + failedSort(i, "" + a[i], "" + a[i + 1]); + } + } + } + + private static void checkCheckSum(Object test, Object golden) { + if (checkSumXor(test) != checkSumXor(golden)) { + failed("Original and sorted arrays are not identical [xor]"); + } + if (checkSumPlus(test) != checkSumPlus(golden)) { + failed("Original and sorted arrays are not identical [plus]"); + } + } + + private static int checkSumXor(Object object) { + if (object instanceof int[]) { + return checkSumXor((int[]) object); + } else if (object instanceof long[]) { + return checkSumXor((long[]) object); + } else if (object instanceof short[]) { + return checkSumXor((short[]) object); + } else if (object instanceof byte[]) { + return checkSumXor((byte[]) object); + } else if (object instanceof char[]) { + return checkSumXor((char[]) object); + } else if (object instanceof float[]) { + return checkSumXor((float[]) object); + } else if (object instanceof double[]) { + return checkSumXor((double[]) object); + } else if (object instanceof Integer[]) { + return checkSumXor((Integer[]) object); + } else { + failed("Unknow type of array: " + object + " of class " + + object.getClass().getName()); + return -1; + } + } + + private static int checkSumXor(Integer[] a) { + int checkSum = 0; + + for (Integer e : a) { + checkSum ^= e.intValue(); + } + return checkSum; + } + + private static int checkSumXor(int[] a) { + int checkSum = 0; + + for (int e : a) { + checkSum ^= e; + } + return checkSum; + } + + private static int checkSumXor(long[] a) { + long checkSum = 0; + + for (long e : a) { + checkSum ^= e; + } + return (int) checkSum; + } + + private static int checkSumXor(short[] a) { + short checkSum = 0; + + for (short e : a) { + checkSum ^= e; + } + return (int) checkSum; + } + + private static int checkSumXor(byte[] a) { + byte checkSum = 0; + + for (byte e : a) { + checkSum ^= e; + } + return (int) checkSum; + } + + private static int checkSumXor(char[] a) { + char checkSum = 0; + + for (char e : a) { + checkSum ^= e; + } + return (int) checkSum; + } + + private static int checkSumXor(float[] a) { + int checkSum = 0; + + for (float e : a) { + checkSum ^= (int) e; + } + return checkSum; + } + + private static int checkSumXor(double[] a) { + int checkSum = 0; + + for (double e : a) { + checkSum ^= (int) e; + } + return checkSum; + } + + private static int checkSumPlus(Object object) { + if (object instanceof int[]) { + return checkSumPlus((int[]) object); + } else if (object instanceof long[]) { + return checkSumPlus((long[]) object); + } else if (object instanceof short[]) { + return checkSumPlus((short[]) object); + } else if (object instanceof byte[]) { + return checkSumPlus((byte[]) object); + } else if (object instanceof char[]) { + return checkSumPlus((char[]) object); + } else if (object instanceof float[]) { + return checkSumPlus((float[]) object); + } else if (object instanceof double[]) { + return checkSumPlus((double[]) object); + } else if (object instanceof Integer[]) { + return checkSumPlus((Integer[]) object); + } else { + failed("Unknow type of array: " + object + " of class " + + object.getClass().getName()); + return -1; + } + } + + private static int checkSumPlus(int[] a) { + int checkSum = 0; + + for (int e : a) { + checkSum += e; + } + return checkSum; + } + + private static int checkSumPlus(long[] a) { + long checkSum = 0; + + for (long e : a) { + checkSum += e; + } + return (int) checkSum; + } + + private static int checkSumPlus(short[] a) { + short checkSum = 0; + + for (short e : a) { + checkSum += e; + } + return (int) checkSum; + } + + private static int checkSumPlus(byte[] a) { + byte checkSum = 0; + + for (byte e : a) { + checkSum += e; + } + return (int) checkSum; + } + + private static int checkSumPlus(char[] a) { + char checkSum = 0; + + for (char e : a) { + checkSum += e; + } + return (int) checkSum; + } + + private static int checkSumPlus(float[] a) { + int checkSum = 0; + + for (float e : a) { + checkSum += (int) e; + } + return checkSum; + } + + private static int checkSumPlus(double[] a) { + int checkSum = 0; + + for (double e : a) { + checkSum += (int) e; + } + return checkSum; + } + + private static int checkSumPlus(Integer[] a) { + int checkSum = 0; + + for (Integer e : a) { + checkSum += e.intValue(); + } + return checkSum; + } + + private static void sortByInsertionSort(Object object) { + if (object instanceof int[]) { + sortByInsertionSort((int[]) object); + } else if (object instanceof long[]) { + sortByInsertionSort((long[]) object); + } else if (object instanceof short[]) { + sortByInsertionSort((short[]) object); + } else if (object instanceof byte[]) { + sortByInsertionSort((byte[]) object); + } else if (object instanceof char[]) { + sortByInsertionSort((char[]) object); + } else if (object instanceof float[]) { + sortByInsertionSort((float[]) object); + } else if (object instanceof double[]) { + sortByInsertionSort((double[]) object); + } else if (object instanceof Integer[]) { + sortByInsertionSort((Integer[]) object); + } else { + failed("Unknow type of array: " + object + " of class " + + object.getClass().getName()); + } + } + + private static void sortByInsertionSort(int[] a) { + for (int j, i = 1; i < a.length; i++) { + int ai = a[i]; + for (j = i - 1; j >= 0 && ai < a[j]; j--) { + a[j + 1] = a[j]; + } + a[j + 1] = ai; + } + } + + private static void sortByInsertionSort(long[] a) { + for (int j, i = 1; i < a.length; i++) { + long ai = a[i]; + for (j = i - 1; j >= 0 && ai < a[j]; j--) { + a[j + 1] = a[j]; + } + a[j + 1] = ai; + } + } + + private static void sortByInsertionSort(short[] a) { + for (int j, i = 1; i < a.length; i++) { + short ai = a[i]; + for (j = i - 1; j >= 0 && ai < a[j]; j--) { + a[j + 1] = a[j]; + } + a[j + 1] = ai; + } + } + + private static void sortByInsertionSort(byte[] a) { + for (int j, i = 1; i < a.length; i++) { + byte ai = a[i]; + for (j = i - 1; j >= 0 && ai < a[j]; j--) { + a[j + 1] = a[j]; + } + a[j + 1] = ai; + } + } + + private static void sortByInsertionSort(char[] a) { + for (int j, i = 1; i < a.length; i++) { + char ai = a[i]; + for (j = i - 1; j >= 0 && ai < a[j]; j--) { + a[j + 1] = a[j]; + } + a[j + 1] = ai; + } + } + + private static void sortByInsertionSort(float[] a) { + for (int j, i = 1; i < a.length; i++) { + float ai = a[i]; + for (j = i - 1; j >= 0 && ai < a[j]; j--) { + a[j + 1] = a[j]; + } + a[j + 1] = ai; + } + } + + private static void sortByInsertionSort(double[] a) { + for (int j, i = 1; i < a.length; i++) { + double ai = a[i]; + for (j = i - 1; j >= 0 && ai < a[j]; j--) { + a[j + 1] = a[j]; + } + a[j + 1] = ai; + } + } + + private static void sortByInsertionSort(Integer[] a) { + for (int j, i = 1; i < a.length; i++) { + Integer ai = a[i]; + for (j = i - 1; j >= 0 && ai < a[j]; j--) { + a[j + 1] = a[j]; + } + a[j + 1] = ai; + } + } + + private static void sort(Object object) { + if (object instanceof int[]) { + Arrays.parallelSort((int[]) object); + } else if (object instanceof long[]) { + Arrays.parallelSort((long[]) object); + } else if (object instanceof short[]) { + Arrays.parallelSort((short[]) object); + } else if (object instanceof byte[]) { + Arrays.parallelSort((byte[]) object); + } else if (object instanceof char[]) { + Arrays.parallelSort((char[]) object); + } else if (object instanceof float[]) { + Arrays.parallelSort((float[]) object); + } else if (object instanceof double[]) { + Arrays.parallelSort((double[]) object); + } else if (object instanceof Integer[]) { + Arrays.parallelSort((Integer[]) object); + } else { + failed("Unknow type of array: " + object + " of class " + + object.getClass().getName()); + } + } + + private static void sortSubArray(Object object, int fromIndex, int toIndex) { + if (object instanceof int[]) { + Arrays.parallelSort((int[]) object, fromIndex, toIndex); + } else if (object instanceof long[]) { + Arrays.parallelSort((long[]) object, fromIndex, toIndex); + } else if (object instanceof short[]) { + Arrays.parallelSort((short[]) object, fromIndex, toIndex); + } else if (object instanceof byte[]) { + Arrays.parallelSort((byte[]) object, fromIndex, toIndex); + } else if (object instanceof char[]) { + Arrays.parallelSort((char[]) object, fromIndex, toIndex); + } else if (object instanceof float[]) { + Arrays.parallelSort((float[]) object, fromIndex, toIndex); + } else if (object instanceof double[]) { + Arrays.parallelSort((double[]) object, fromIndex, toIndex); + } else if (object instanceof Integer[]) { + Arrays.parallelSort((Integer[]) object, fromIndex, toIndex); + } else { + failed("Unknow type of array: " + object + " of class " + + object.getClass().getName()); + } + } + + private static void checkSubArray(Object object, int fromIndex, int toIndex, int m) { + if (object instanceof int[]) { + checkSubArray((int[]) object, fromIndex, toIndex, m); + } else if (object instanceof long[]) { + checkSubArray((long[]) object, fromIndex, toIndex, m); + } else if (object instanceof short[]) { + checkSubArray((short[]) object, fromIndex, toIndex, m); + } else if (object instanceof byte[]) { + checkSubArray((byte[]) object, fromIndex, toIndex, m); + } else if (object instanceof char[]) { + checkSubArray((char[]) object, fromIndex, toIndex, m); + } else if (object instanceof float[]) { + checkSubArray((float[]) object, fromIndex, toIndex, m); + } else if (object instanceof double[]) { + checkSubArray((double[]) object, fromIndex, toIndex, m); + } else if (object instanceof Integer[]) { + checkSubArray((Integer[]) object, fromIndex, toIndex, m); + } else { + failed("Unknow type of array: " + object + " of class " + + object.getClass().getName()); + } + } + + private static void checkSubArray(Integer[] a, int fromIndex, int toIndex, int m) { + for (int i = 0; i < fromIndex; i++) { + if (a[i].intValue() != 0xDEDA) { + failed("Range sort changes left element on position " + i + + ": " + a[i] + ", must be " + 0xDEDA); + } + } + + for (int i = fromIndex; i < toIndex - 1; i++) { + if (a[i].intValue() > a[i + 1].intValue()) { + failedSort(i, "" + a[i], "" + a[i + 1]); + } + } + + for (int i = toIndex; i < a.length; i++) { + if (a[i].intValue() != 0xBABA) { + failed("Range sort changes right element on position " + i + + ": " + a[i] + ", must be " + 0xBABA); + } + } + } + + private static void checkSubArray(int[] a, int fromIndex, int toIndex, int m) { + for (int i = 0; i < fromIndex; i++) { + if (a[i] != 0xDEDA) { + failed("Range sort changes left element on position " + i + + ": " + a[i] + ", must be " + 0xDEDA); + } + } + + for (int i = fromIndex; i < toIndex - 1; i++) { + if (a[i] > a[i + 1]) { + failedSort(i, "" + a[i], "" + a[i + 1]); + } + } + + for (int i = toIndex; i < a.length; i++) { + if (a[i] != 0xBABA) { + failed("Range sort changes right element on position " + i + + ": " + a[i] + ", must be " + 0xBABA); + } + } + } + + private static void checkSubArray(byte[] a, int fromIndex, int toIndex, int m) { + for (int i = 0; i < fromIndex; i++) { + if (a[i] != (byte) 0xDEDA) { + failed("Range sort changes left element on position " + i + + ": " + a[i] + ", must be " + 0xDEDA); + } + } + + for (int i = fromIndex; i < toIndex - 1; i++) { + if (a[i] > a[i + 1]) { + failedSort(i, "" + a[i], "" + a[i + 1]); + } + } + + for (int i = toIndex; i < a.length; i++) { + if (a[i] != (byte) 0xBABA) { + failed("Range sort changes right element on position " + i + + ": " + a[i] + ", must be " + 0xBABA); + } + } + } + + private static void checkSubArray(long[] a, int fromIndex, int toIndex, int m) { + for (int i = 0; i < fromIndex; i++) { + if (a[i] != (long) 0xDEDA) { + failed("Range sort changes left element on position " + i + + ": " + a[i] + ", must be " + 0xDEDA); + } + } + + for (int i = fromIndex; i < toIndex - 1; i++) { + if (a[i] > a[i + 1]) { + failedSort(i, "" + a[i], "" + a[i + 1]); + } + } + + for (int i = toIndex; i < a.length; i++) { + if (a[i] != (long) 0xBABA) { + failed("Range sort changes right element on position " + i + + ": " + a[i] + ", must be " + 0xBABA); + } + } + } + + private static void checkSubArray(char[] a, int fromIndex, int toIndex, int m) { + for (int i = 0; i < fromIndex; i++) { + if (a[i] != (char) 0xDEDA) { + failed("Range sort changes left element on position " + i + + ": " + a[i] + ", must be " + 0xDEDA); + } + } + + for (int i = fromIndex; i < toIndex - 1; i++) { + if (a[i] > a[i + 1]) { + failedSort(i, "" + a[i], "" + a[i + 1]); + } + } + + for (int i = toIndex; i < a.length; i++) { + if (a[i] != (char) 0xBABA) { + failed("Range sort changes right element on position " + i + + ": " + a[i] + ", must be " + 0xBABA); + } + } + } + + private static void checkSubArray(short[] a, int fromIndex, int toIndex, int m) { + for (int i = 0; i < fromIndex; i++) { + if (a[i] != (short) 0xDEDA) { + failed("Range sort changes left element on position " + i + + ": " + a[i] + ", must be " + 0xDEDA); + } + } + + for (int i = fromIndex; i < toIndex - 1; i++) { + if (a[i] > a[i + 1]) { + failedSort(i, "" + a[i], "" + a[i + 1]); + } + } + + for (int i = toIndex; i < a.length; i++) { + if (a[i] != (short) 0xBABA) { + failed("Range sort changes right element on position " + i + + ": " + a[i] + ", must be " + 0xBABA); + } + } + } + + private static void checkSubArray(float[] a, int fromIndex, int toIndex, int m) { + for (int i = 0; i < fromIndex; i++) { + if (a[i] != (float) 0xDEDA) { + failed("Range sort changes left element on position " + i + + ": " + a[i] + ", must be " + 0xDEDA); + } + } + + for (int i = fromIndex; i < toIndex - 1; i++) { + if (a[i] > a[i + 1]) { + failedSort(i, "" + a[i], "" + a[i + 1]); + } + } + + for (int i = toIndex; i < a.length; i++) { + if (a[i] != (float) 0xBABA) { + failed("Range sort changes right element on position " + i + + ": " + a[i] + ", must be " + 0xBABA); + } + } + } + + private static void checkSubArray(double[] a, int fromIndex, int toIndex, int m) { + for (int i = 0; i < fromIndex; i++) { + if (a[i] != (double) 0xDEDA) { + failed("Range sort changes left element on position " + i + + ": " + a[i] + ", must be " + 0xDEDA); + } + } + + for (int i = fromIndex; i < toIndex - 1; i++) { + if (a[i] > a[i + 1]) { + failedSort(i, "" + a[i], "" + a[i + 1]); + } + } + + for (int i = toIndex; i < a.length; i++) { + if (a[i] != (double) 0xBABA) { + failed("Range sort changes right element on position " + i + + ": " + a[i] + ", must be " + 0xBABA); + } + } + } + + private static void checkRange(Object object, int m) { + if (object instanceof int[]) { + checkRange((int[]) object, m); + } else if (object instanceof long[]) { + checkRange((long[]) object, m); + } else if (object instanceof short[]) { + checkRange((short[]) object, m); + } else if (object instanceof byte[]) { + checkRange((byte[]) object, m); + } else if (object instanceof char[]) { + checkRange((char[]) object, m); + } else if (object instanceof float[]) { + checkRange((float[]) object, m); + } else if (object instanceof double[]) { + checkRange((double[]) object, m); + } else if (object instanceof Integer[]) { + checkRange((Integer[]) object, m); + } else { + failed("Unknow type of array: " + object + " of class " + + object.getClass().getName()); + } + } + + private static void checkRange(Integer[] a, int m) { + try { + Arrays.parallelSort(a, m + 1, m); + + failed("ParallelSort does not throw IllegalArgumentException " + + " as expected: fromIndex = " + (m + 1) + + " toIndex = " + m); + } + catch (IllegalArgumentException iae) { + try { + Arrays.parallelSort(a, -m, a.length); + + failed("ParallelSort does not throw ArrayIndexOutOfBoundsException " + + " as expected: fromIndex = " + (-m)); + } + catch (ArrayIndexOutOfBoundsException aoe) { + try { + Arrays.parallelSort(a, 0, a.length + m); + + failed("ParallelSort does not throw ArrayIndexOutOfBoundsException " + + " as expected: toIndex = " + (a.length + m)); + } + catch (ArrayIndexOutOfBoundsException aie) { + return; + } + } + } + } + + private static void checkRange(int[] a, int m) { + try { + Arrays.parallelSort(a, m + 1, m); + + failed("ParallelSort does not throw IllegalArgumentException " + + " as expected: fromIndex = " + (m + 1) + + " toIndex = " + m); + } + catch (IllegalArgumentException iae) { + try { + Arrays.parallelSort(a, -m, a.length); + + failed("ParallelSort does not throw ArrayIndexOutOfBoundsException " + + " as expected: fromIndex = " + (-m)); + } + catch (ArrayIndexOutOfBoundsException aoe) { + try { + Arrays.parallelSort(a, 0, a.length + m); + + failed("ParallelSort does not throw ArrayIndexOutOfBoundsException " + + " as expected: toIndex = " + (a.length + m)); + } + catch (ArrayIndexOutOfBoundsException aie) { + return; + } + } + } + } + + private static void checkRange(long[] a, int m) { + try { + Arrays.parallelSort(a, m + 1, m); + + failed("ParallelSort does not throw IllegalArgumentException " + + " as expected: fromIndex = " + (m + 1) + + " toIndex = " + m); + } + catch (IllegalArgumentException iae) { + try { + Arrays.parallelSort(a, -m, a.length); + + failed("ParallelSort does not throw ArrayIndexOutOfBoundsException " + + " as expected: fromIndex = " + (-m)); + } + catch (ArrayIndexOutOfBoundsException aoe) { + try { + Arrays.parallelSort(a, 0, a.length + m); + + failed("ParallelSort does not throw ArrayIndexOutOfBoundsException " + + " as expected: toIndex = " + (a.length + m)); + } + catch (ArrayIndexOutOfBoundsException aie) { + return; + } + } + } + } + + private static void checkRange(byte[] a, int m) { + try { + Arrays.parallelSort(a, m + 1, m); + + failed("ParallelSort does not throw IllegalArgumentException " + + " as expected: fromIndex = " + (m + 1) + + " toIndex = " + m); + } + catch (IllegalArgumentException iae) { + try { + Arrays.parallelSort(a, -m, a.length); + + failed("ParallelSort does not throw ArrayIndexOutOfBoundsException " + + " as expected: fromIndex = " + (-m)); + } + catch (ArrayIndexOutOfBoundsException aoe) { + try { + Arrays.parallelSort(a, 0, a.length + m); + + failed("ParallelSort does not throw ArrayIndexOutOfBoundsException " + + " as expected: toIndex = " + (a.length + m)); + } + catch (ArrayIndexOutOfBoundsException aie) { + return; + } + } + } + } + + private static void checkRange(short[] a, int m) { + try { + Arrays.parallelSort(a, m + 1, m); + + failed("ParallelSort does not throw IllegalArgumentException " + + " as expected: fromIndex = " + (m + 1) + + " toIndex = " + m); + } + catch (IllegalArgumentException iae) { + try { + Arrays.parallelSort(a, -m, a.length); + + failed("ParallelSort does not throw ArrayIndexOutOfBoundsException " + + " as expected: fromIndex = " + (-m)); + } + catch (ArrayIndexOutOfBoundsException aoe) { + try { + Arrays.parallelSort(a, 0, a.length + m); + + failed("ParallelSort does not throw ArrayIndexOutOfBoundsException " + + " as expected: toIndex = " + (a.length + m)); + } + catch (ArrayIndexOutOfBoundsException aie) { + return; + } + } + } + } + + private static void checkRange(char[] a, int m) { + try { + Arrays.parallelSort(a, m + 1, m); + + failed("ParallelSort does not throw IllegalArgumentException " + + " as expected: fromIndex = " + (m + 1) + + " toIndex = " + m); + } + catch (IllegalArgumentException iae) { + try { + Arrays.parallelSort(a, -m, a.length); + + failed("ParallelSort does not throw ArrayIndexOutOfBoundsException " + + " as expected: fromIndex = " + (-m)); + } + catch (ArrayIndexOutOfBoundsException aoe) { + try { + Arrays.parallelSort(a, 0, a.length + m); + + failed("ParallelSort does not throw ArrayIndexOutOfBoundsException " + + " as expected: toIndex = " + (a.length + m)); + } + catch (ArrayIndexOutOfBoundsException aie) { + return; + } + } + } + } + + private static void checkRange(float[] a, int m) { + try { + Arrays.parallelSort(a, m + 1, m); + + failed("ParallelSort does not throw IllegalArgumentException " + + " as expected: fromIndex = " + (m + 1) + + " toIndex = " + m); + } + catch (IllegalArgumentException iae) { + try { + Arrays.parallelSort(a, -m, a.length); + + failed("ParallelSort does not throw ArrayIndexOutOfBoundsException " + + " as expected: fromIndex = " + (-m)); + } + catch (ArrayIndexOutOfBoundsException aoe) { + try { + Arrays.parallelSort(a, 0, a.length + m); + + failed("ParallelSort does not throw ArrayIndexOutOfBoundsException " + + " as expected: toIndex = " + (a.length + m)); + } + catch (ArrayIndexOutOfBoundsException aie) { + return; + } + } + } + } + + private static void checkRange(double[] a, int m) { + try { + Arrays.parallelSort(a, m + 1, m); + + failed("ParallelSort does not throw IllegalArgumentException " + + " as expected: fromIndex = " + (m + 1) + + " toIndex = " + m); + } + catch (IllegalArgumentException iae) { + try { + Arrays.parallelSort(a, -m, a.length); + + failed("ParallelSort does not throw ArrayIndexOutOfBoundsException " + + " as expected: fromIndex = " + (-m)); + } + catch (ArrayIndexOutOfBoundsException aoe) { + try { + Arrays.parallelSort(a, 0, a.length + m); + + failed("ParallelSort does not throw ArrayIndexOutOfBoundsException " + + " as expected: toIndex = " + (a.length + m)); + } + catch (ArrayIndexOutOfBoundsException aie) { + return; + } + } + } + } + + private static void outArray(Object[] a) { + for (int i = 0; i < a.length; i++) { + out.print(a[i] + " "); + } + out.println(); + } + + private static void outArray(int[] a) { + for (int i = 0; i < a.length; i++) { + out.print(a[i] + " "); + } + out.println(); + } + + private static void outArray(float[] a) { + for (int i = 0; i < a.length; i++) { + out.print(a[i] + " "); + } + out.println(); + } + + private static void outArray(double[] a) { + for (int i = 0; i < a.length; i++) { + out.print(a[i] + " "); + } + out.println(); + } + + private static class MyRandom extends Random { + MyRandom(long seed) { + super(seed); + mySeed = seed; + } + + long getSeed() { + return mySeed; + } + + private long mySeed; + } + + private static String ourDescription; +} diff --git a/jdk/test/java/util/Calendar/GenericTimeZoneNamesTest.java b/jdk/test/java/util/Calendar/GenericTimeZoneNamesTest.java new file mode 100644 index 00000000000..f2dcbe5cfd5 --- /dev/null +++ b/jdk/test/java/util/Calendar/GenericTimeZoneNamesTest.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.util.*; +import sun.util.locale.provider.TimeZoneNameUtility; + +public class GenericTimeZoneNamesTest { + private static final String[] PT = { + "America/Los_Angeles", "US/Pacific", "PST" + }; + + private static int errors = 0; + + public static void main(String[] args) { + for (String tag : args) { + Locale locale = Locale.forLanguageTag(tag); + for (String tzid : PT) { + test(tzid, TimeZone.LONG, locale, "Pacific Time"); + test(tzid, TimeZone.SHORT, locale, "PT"); + } + } + + if (errors != 0) { + throw new RuntimeException("test failed"); + } + } + + private static void test(String tzid, int style, Locale locale, String expected) { + // No public API to get generic time zone names (JDK 8) + String got = TimeZoneNameUtility.retrieveGenericDisplayName(tzid, style, locale); + if (!expected.equals(got)) { + System.err.printf("test: tzid=%s, locale=%s, style=%d, got=\"%s\", expected=\"%s\"%n", + tzid, locale, style, got, expected); + errors++; + } + } +} diff --git a/jdk/test/java/util/Calendar/GenericTimeZoneNamesTest.sh b/jdk/test/java/util/Calendar/GenericTimeZoneNamesTest.sh new file mode 100644 index 00000000000..a5491891bbb --- /dev/null +++ b/jdk/test/java/util/Calendar/GenericTimeZoneNamesTest.sh @@ -0,0 +1,47 @@ +# +# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# @test +# @bug 8003267 +# @summary Unit test for generic time zone names support +# @compile -XDignore.symbol.file GenericTimeZoneNamesTest.java +# @run shell GenericTimeZoneNamesTest.sh + +# This test is locale data-dependent and assumes that both JRE and CLDR +# have the same geneic time zone names in English. + +STATUS=0 +echo "Locale providers: default" +# TODO: The purpose of ja-JP is to make sure the fallback for generic +# names works. Remove ja-JP when adding generic names to localized +# resources. +if ! ${TESTJAVA}/bin/java -esa -cp "${TESTCLASSES}" GenericTimeZoneNamesTest en-US ja-JP; then + STATUS=1 +fi + +echo "Locale providers: CLDR" +if ! ${TESTJAVA}/bin/java -esa -cp "${TESTCLASSES}" -Djava.locale.providers=CLDR GenericTimeZoneNamesTest en-US; then + STATUS=1 +fi +exit ${STATUS} + diff --git a/jdk/test/java/util/Calendar/NarrowNamesTest.java b/jdk/test/java/util/Calendar/NarrowNamesTest.java new file mode 100644 index 00000000000..7338792abd3 --- /dev/null +++ b/jdk/test/java/util/Calendar/NarrowNamesTest.java @@ -0,0 +1,172 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.util.*; +import static java.util.GregorianCalendar.*; + +public class NarrowNamesTest { + private static final Locale US = Locale.US; + private static final Locale JAJPJP = new Locale("ja", "JP", "JP"); + private static final Locale THTH = new Locale("th", "TH"); + + private static final String RESET_INDEX = "RESET_INDEX"; + + private static int errors = 0; + + // This test is locale data-dependent. + public static void main(String[] args) { + test(US, ERA, "B", + ERA, BC, YEAR, 1); + test(US, ERA, "A", + ERA, AD, YEAR, 2012); + test(US, DAY_OF_WEEK, "S", + YEAR, 2012, MONTH, DECEMBER, DAY_OF_MONTH, 23); + test(US, AM_PM, "a", + HOUR_OF_DAY, 10); + test(US, AM_PM, "p", + HOUR_OF_DAY, 23); + test(JAJPJP, DAY_OF_WEEK, "\u65e5", + YEAR, 24, MONTH, DECEMBER, DAY_OF_MONTH, 23); + test(THTH, MONTH, NARROW_STANDALONE, "\u0e18.\u0e04.", + YEAR, 2555, MONTH, DECEMBER, DAY_OF_MONTH, 5); + test(THTH, DAY_OF_WEEK, "\u0e1e", + YEAR, 2555, MONTH, DECEMBER, DAY_OF_MONTH, 5); + + testMap(US, DAY_OF_WEEK, ALL_STYLES, // shouldn't include any narrow names + "", // 1-based indexing for DAY_OF_WEEK + "Sunday", // Sunday + "Monday", // Monday + "Tuesday", // Tuesday + "Wednesday", // Wednesday + "Thursday", // Thursday + "Friday", // Friday + "Saturday", // Saturday + RESET_INDEX, + "", // 1-based indexing for DAY_OF_WEEK + "Sun", // abb Sunday + "Mon", // abb Monday + "Tue", // abb Tuesday + "Wed", // abb Wednesday + "Thu", // abb Thursday + "Fri", // abb Friday + "Sat" // abb Saturday + ); + testMap(US, DAY_OF_WEEK, NARROW_FORMAT); // expect null + testMap(US, AM_PM, ALL_STYLES, + "AM", "PM", + RESET_INDEX, + "a", "p"); + testMap(JAJPJP, DAY_OF_WEEK, NARROW_STANDALONE); // expect null + testMap(JAJPJP, DAY_OF_WEEK, NARROW_FORMAT, + "", // 1-based indexing for DAY_OF_WEEK + "\u65e5", + "\u6708", + "\u706b", + "\u6c34", + "\u6728", + "\u91d1", + "\u571f"); + testMap(THTH, MONTH, NARROW_FORMAT); // expect null + testMap(THTH, MONTH, NARROW_STANDALONE, + "\u0e21.\u0e04.", + "\u0e01.\u0e1e.", + "\u0e21\u0e35.\u0e04.", + "\u0e40\u0e21.\u0e22.", + "\u0e1e.\u0e04.", + "\u0e21\u0e34.\u0e22.", + "\u0e01.\u0e04.", + "\u0e2a.\u0e04.", + "\u0e01.\u0e22.", + "\u0e15.\u0e04.", + "\u0e1e.\u0e22.", + "\u0e18.\u0e04."); + + if (errors != 0) { + throw new RuntimeException("test failed"); + } + } + + private static void test(Locale locale, int field, String expected, int... data) { + test(locale, field, NARROW_FORMAT, expected, data); + } + + private static void test(Locale locale, int field, int style, String expected, int... fieldValuePairs) { + Calendar cal = Calendar.getInstance(locale); + cal.clear(); + for (int i = 0; i < fieldValuePairs.length;) { + int f = fieldValuePairs[i++]; + int v = fieldValuePairs[i++]; + cal.set(f, v); + } + String got = cal.getDisplayName(field, style, locale); + if (!expected.equals(got)) { + System.err.printf("test: locale=%s, field=%d, value=%d, style=%d, got=\"%s\", expected=\"%s\"%n", + locale, field, cal.get(field), style, got, expected); + errors++; + } + } + + private static void testMap(Locale locale, int field, int style, String... expected) { + Map expectedMap = null; + if (expected.length > 0) { + expectedMap = new TreeMap<>(LengthBasedComparator.INSTANCE); + int index = 0; + for (int i = 0; i < expected.length; i++) { + if (expected[i].isEmpty()) { + index++; + continue; + } + if (expected[i] == RESET_INDEX) { + index = 0; + continue; + } + expectedMap.put(expected[i], index++); + } + } + Calendar cal = Calendar.getInstance(locale); + Map got = cal.getDisplayNames(field, style, locale); + if (!(expectedMap == null && got == null) + && !expectedMap.equals(got)) { + System.err.printf("testMap: locale=%s, field=%d, style=%d, expected=%s, got=%s%n", + locale, field, style, expectedMap, got); + errors++; + } + } + + /** + * Comparator implementation for TreeMap which iterates keys from longest + * to shortest. + */ + private static class LengthBasedComparator implements Comparator { + private static final LengthBasedComparator INSTANCE = new LengthBasedComparator(); + + private LengthBasedComparator() { + } + + @Override + public int compare(String o1, String o2) { + int n = o2.length() - o1.length(); + return (n == 0) ? o1.compareTo(o2) : n; + } + } +} diff --git a/jdk/test/java/util/Calendar/NarrowNamesTest.sh b/jdk/test/java/util/Calendar/NarrowNamesTest.sh new file mode 100644 index 00000000000..742e35ac291 --- /dev/null +++ b/jdk/test/java/util/Calendar/NarrowNamesTest.sh @@ -0,0 +1,41 @@ +# +# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# @test +# @bug 8000983 +# @summary Unit test for narrow names support +# @build NarrowNamesTest +# @run shell NarrowNamesTest.sh + +# This test is locale data-dependent and assumes that both JRE and CLDR +# have the same narrow names. + +STATUS=0 +for P in "JRE,SPI" "CLDR" +do + echo "Locale providers: $P" + if ! ${TESTJAVA}/bin/java -esa -cp "${TESTCLASSES}" -Djava.locale.providers="${P}" NarrowNamesTest; then + STATUS=1 + fi +done +exit ${STATUS} diff --git a/jdk/test/java/util/Collections/EmptyIterator.java b/jdk/test/java/util/Collections/EmptyIterator.java index f7815d32d99..d10526f11f8 100644 --- a/jdk/test/java/util/Collections/EmptyIterator.java +++ b/jdk/test/java/util/Collections/EmptyIterator.java @@ -23,12 +23,12 @@ /* * @test - * @bug 5017904 6356890 + * @bug 5017904 6356890 8004928 * @summary Test empty iterators, enumerations, and collections */ -import java.util.*; import static java.util.Collections.*; +import java.util.*; public class EmptyIterator { @@ -45,10 +45,13 @@ public class EmptyIterator { testEmptyIterator(emptyTable.values().iterator()); testEmptyIterator(emptyTable.entrySet().iterator()); - testEmptyEnumeration(javax.swing.tree.DefaultMutableTreeNode - .EMPTY_ENUMERATION); - testEmptyEnumeration(javax.swing.text.SimpleAttributeSet - .EMPTY.getAttributeNames()); + final Enumeration finalEmptyTyped = + Collections.emptyEnumeration(); + testEmptyEnumeration(finalEmptyTyped); + + final Enumeration finalEmptyAbstract = + Collections.emptyEnumeration(); + testEmptyEnumeration(finalEmptyAbstract); @SuppressWarnings("unchecked") Iterator x = new sun.tools.java.MethodSet() diff --git a/jdk/test/java/util/Currency/PropertiesTest.sh b/jdk/test/java/util/Currency/PropertiesTest.sh index 874e7ac3018..6c16851062e 100644 --- a/jdk/test/java/util/Currency/PropertiesTest.sh +++ b/jdk/test/java/util/Currency/PropertiesTest.sh @@ -70,7 +70,7 @@ failures=0 run() { echo '' - sh -xc "${TESTJAVA}${FS}bin${FS}java -cp ${TESTCLASSES} $*" 2>&1 + sh -xc "${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTCLASSES} $*" 2>&1 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi } @@ -113,7 +113,7 @@ cp ${PROPS} $PROPLOCATION # run echo '' -sh -xc "${WRITABLEJDK}${FS}bin${FS}java -cp ${TESTCLASSES} PropertiesTest -d dump3" +sh -xc "${WRITABLEJDK}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTCLASSES} PropertiesTest -d dump3" if [ $? != 0 ]; then failures=`expr $failures + 1`; fi # Cleanup diff --git a/jdk/test/java/util/Currency/ValidateISO4217.java b/jdk/test/java/util/Currency/ValidateISO4217.java index 679acfa20a9..bf433a1c8ed 100644 --- a/jdk/test/java/util/Currency/ValidateISO4217.java +++ b/jdk/test/java/util/Currency/ValidateISO4217.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,7 @@ */ /* * @test - * @bug 4691089 4819436 4942982 5104960 6544471 6627549 7066203 + * @bug 4691089 4819436 4942982 5104960 6544471 6627549 7066203 7195759 * @summary Validate ISO 4217 data for Currency class. */ @@ -92,7 +92,7 @@ public class ValidateISO4217 { /* Codes that are obsolete, do not have related country */ static final String otherCodes = - "ADP-AFA-ATS-AYM-AZM-BEF-BGL-BOV-BYB-CLF-CUC-CYP-DEM-EEK-ESP-FIM-FRF-GHC-GRD-GWP-IEP-ITL-LUF-MGF-MTL-MXV-MZM-NLG-PTE-ROL-RUR-SDD-SIT-SKK-SRG-TMM-TPE-TRL-VEF-USN-USS-VEB-XAG-XAU-XBA-XBB-XBC-XBD-XDR-XFO-XFU-XPD-XPT-XSU-XTS-XUA-XXX-YUM-ZWD-ZWN-ZWR"; + "ADP-AFA-ATS-AYM-AZM-BEF-BGL-BOV-BYB-CLF-CUC-CYP-DEM-EEK-ESP-FIM-FRF-GHC-GRD-GWP-IEP-ITL-LUF-MGF-MTL-MXV-MZM-NLG-PTE-ROL-RUR-SDD-SIT-SKK-SRG-TMM-TPE-TRL-VEF-USN-USS-VEB-XAG-XAU-XBA-XBB-XBC-XBD-XDR-XFO-XFU-XPD-XPT-XSU-XTS-XUA-XXX-YUM-ZMK-ZWD-ZWN-ZWR"; static boolean err = false; diff --git a/jdk/test/java/util/Currency/tablea1.txt b/jdk/test/java/util/Currency/tablea1.txt index 55ad66291c7..ea142da7d33 100644 --- a/jdk/test/java/util/Currency/tablea1.txt +++ b/jdk/test/java/util/Currency/tablea1.txt @@ -1,12 +1,12 @@ # # -# Amendments up until ISO 4217 AMENDMENT NUMBER 153 -# (As of 12 January 2012) +# Amendments up until ISO 4217 AMENDMENT NUMBER 154 +# (As of 31 August 2012) # # Version FILEVERSION=1 -DATAVERSION=153 +DATAVERSION=154 # ISO 4217 currency data AF AFN 971 2 @@ -274,7 +274,7 @@ VI USD 840 2 WF XPF 953 0 EH MAD 504 2 YE YER 886 2 -ZM ZMK 894 2 +ZM ZMW 967 2 ZW ZWL 932 2 #XAU XAU 959 #XBA XBA 955 diff --git a/jdk/test/java/util/Locale/LocaleCategory.sh b/jdk/test/java/util/Locale/LocaleCategory.sh index 34becd35a98..84b6119ec3d 100644 --- a/jdk/test/java/util/Locale/LocaleCategory.sh +++ b/jdk/test/java/util/Locale/LocaleCategory.sh @@ -69,7 +69,7 @@ esac # test user.xxx.display user.xxx.format properties # run -RUNCMD="${TESTJAVA}${FS}bin${FS}java -classpath ${TESTCLASSES} -Duser.language.display=ja -Duser.language.format=zh LocaleCategory" +RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${TESTCLASSES} -Duser.language.display=ja -Duser.language.format=zh LocaleCategory" echo ${RUNCMD} ${RUNCMD} @@ -85,7 +85,7 @@ fi # test user.xxx properties overriding user.xxx.display/format # run -RUNCMD="${TESTJAVA}${FS}bin${FS}java -classpath ${TESTCLASSES} -Duser.language=en -Duser.language.display=ja -Duser.language.format=zh LocaleCategory" +RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${TESTCLASSES} -Duser.language=en -Duser.language.display=ja -Duser.language.format=zh LocaleCategory" echo ${RUNCMD} ${RUNCMD} diff --git a/jdk/test/java/util/Locale/LocaleProviders.sh b/jdk/test/java/util/Locale/LocaleProviders.sh index 59e43fcff76..3cf0d4e7c69 100644 --- a/jdk/test/java/util/Locale/LocaleProviders.sh +++ b/jdk/test/java/util/Locale/LocaleProviders.sh @@ -96,12 +96,12 @@ ${TESTJAVA}${FS}bin${FS}javac -d ${SPIDIR}${FS}dest ${SPIDIR}${FS}src${FS}tznp.j ${TESTJAVA}${FS}bin${FS}jar cvf ${SPIDIR}${FS}tznp.jar -C ${SPIDIR}${FS}dest . # get the platform default locales -PLATDEF=`${TESTJAVA}${FS}bin${FS}java -classpath ${TESTCLASSES} LocaleProviders getPlatformLocale display` +PLATDEF=`${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${TESTCLASSES} LocaleProviders getPlatformLocale display` DEFLANG=`echo ${PLATDEF} | sed -e "s/,.*//"` DEFCTRY=`echo ${PLATDEF} | sed -e "s/.*,//"` echo "DEFLANG=${DEFLANG}" echo "DEFCTRY=${DEFCTRY}" -PLATDEF=`${TESTJAVA}${FS}bin${FS}java -classpath ${TESTCLASSES} LocaleProviders getPlatformLocale format` +PLATDEF=`${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${TESTCLASSES} LocaleProviders getPlatformLocale format` DEFFMTLANG=`echo ${PLATDEF} | sed -e "s/,.*//"` DEFFMTCTRY=`echo ${PLATDEF} | sed -e "s/.*,//"` echo "DEFFMTLANG=${DEFFMTLANG}" @@ -109,7 +109,7 @@ echo "DEFFMTCTRY=${DEFFMTCTRY}" runTest() { - RUNCMD="${TESTJAVA}${FS}bin${FS}java -classpath ${TESTCLASSES} -Djava.locale.providers=$PREFLIST LocaleProviders $METHODNAME $PARAM1 $PARAM2 $PARAM3" + RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${TESTCLASSES} -Djava.locale.providers=$PREFLIST LocaleProviders $METHODNAME $PARAM1 $PARAM2 $PARAM3" echo ${RUNCMD} ${RUNCMD} result=$? diff --git a/jdk/test/java/util/Map/EntryHashCode.java b/jdk/test/java/util/Map/EntryHashCode.java index 98ef36500ec..d3efc8c7d56 100644 --- a/jdk/test/java/util/Map/EntryHashCode.java +++ b/jdk/test/java/util/Map/EntryHashCode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/util/PluggableLocale/ExecTest.sh b/jdk/test/java/util/PluggableLocale/ExecTest.sh index 18bd8d16f61..c01e9e82742 100644 --- a/jdk/test/java/util/PluggableLocale/ExecTest.sh +++ b/jdk/test/java/util/PluggableLocale/ExecTest.sh @@ -119,9 +119,9 @@ fi # run if [ "$3" = "true" ] then - RUNCMD="${TESTJAVA}${FS}bin${FS}java -Djava.ext.dirs=${EXTDIRS} $2 " + RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -Djava.ext.dirs=${EXTDIRS} $2 " else - RUNCMD="${TESTJAVA}${FS}bin${FS}java -classpath ${CLASSPATHARG} $2 " + RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${CLASSPATHARG} $2 " fi echo ${RUNCMD} diff --git a/jdk/test/java/util/PluggableLocale/GenericTest.java b/jdk/test/java/util/PluggableLocale/GenericTest.java index 8be74cdca91..eee0f95ff3a 100644 --- a/jdk/test/java/util/PluggableLocale/GenericTest.java +++ b/jdk/test/java/util/PluggableLocale/GenericTest.java @@ -41,6 +41,7 @@ public class GenericTest { com.bar.CurrencyNameProviderImpl2 currencyNP2 = new com.bar.CurrencyNameProviderImpl2(); com.bar.LocaleNameProviderImpl localeNP = new com.bar.LocaleNameProviderImpl(); com.bar.TimeZoneNameProviderImpl tzNP = new com.bar.TimeZoneNameProviderImpl(); + com.bar.GenericTimeZoneNameProviderImpl tzGenNP = new com.bar.GenericTimeZoneNameProviderImpl(); com.bar.CalendarDataProviderImpl calDataP = new com.bar.CalendarDataProviderImpl(); com.bar.CalendarNameProviderImpl calNameP = new com.bar.CalendarNameProviderImpl(); @@ -73,6 +74,7 @@ public class GenericTest { expected.addAll(Arrays.asList(currencyNP2.getAvailableLocales())); expected.addAll(Arrays.asList(localeNP.getAvailableLocales())); expected.addAll(Arrays.asList(tzNP.getAvailableLocales())); + expected.addAll(Arrays.asList(tzGenNP.getAvailableLocales())); expected.addAll(Arrays.asList(calDataP.getAvailableLocales())); expected.addAll(Arrays.asList(calNameP.getAvailableLocales())); if (!result.equals(expected)) { diff --git a/jdk/test/java/util/PluggableLocale/TimeZoneNameProviderTest.java b/jdk/test/java/util/PluggableLocale/TimeZoneNameProviderTest.java index cc71e6c6543..7ed2fc11429 100644 --- a/jdk/test/java/util/PluggableLocale/TimeZoneNameProviderTest.java +++ b/jdk/test/java/util/PluggableLocale/TimeZoneNameProviderTest.java @@ -40,6 +40,7 @@ public class TimeZoneNameProviderTest extends ProviderTest { TimeZoneNameProviderTest() { test1(); test2(); + test3(); aliasTest(); } @@ -92,6 +93,7 @@ public class TimeZoneNameProviderTest extends ProviderTest { final String pattern = "z"; final Locale OSAKA = new Locale("ja", "JP", "osaka"); final Locale KYOTO = new Locale("ja", "JP", "kyoto"); + final Locale GENERIC = new Locale("ja", "JP", "generic"); final String[] TIMEZONES = { "GMT", "America/Los_Angeles", "SystemV/PST8", @@ -157,6 +159,29 @@ public class TimeZoneNameProviderTest extends ProviderTest { } } + void test3() { + final String[] TZNAMES = { + LATIME, PST, PST8PDT, US_PACIFIC, + TOKYOTIME, JST, JAPAN, + }; + for (String tzname : TZNAMES) { + TimeZone tz = TimeZone.getTimeZone(tzname); + for (int style : new int[] { TimeZone.LONG, TimeZone.SHORT }) { + String osakaStd = tz.getDisplayName(false, style, OSAKA); + if (osakaStd != null) { + // No API for getting generic time zone names + String generic = TimeZoneNameUtility.retrieveGenericDisplayName(tzname, + style, GENERIC); + String expected = "Generic " + osakaStd; + if (!expected.equals(generic)) { + throw new RuntimeException("Wrong generic name: got=\"" + generic + + "\", expected=\"" + expected + "\""); + } + } + } + } + } + final String LATIME = "America/Los_Angeles"; final String PST = "PST"; final String PST8PDT = "PST8PDT"; diff --git a/jdk/test/java/util/PluggableLocale/TimeZoneNameProviderTest.sh b/jdk/test/java/util/PluggableLocale/TimeZoneNameProviderTest.sh index 76a08e6e83e..4e34ae09814 100644 --- a/jdk/test/java/util/PluggableLocale/TimeZoneNameProviderTest.sh +++ b/jdk/test/java/util/PluggableLocale/TimeZoneNameProviderTest.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -23,6 +23,6 @@ #!/bin/sh # # @test -# @bug 4052440 +# @bug 4052440 8003267 # @summary TimeZoneNameProvider tests # @run shell ExecTest.sh bar TimeZoneNameProviderTest true diff --git a/jdk/test/java/util/PluggableLocale/barprovider.jar b/jdk/test/java/util/PluggableLocale/barprovider.jar index deed5facccb..3a6f37a9458 100644 Binary files a/jdk/test/java/util/PluggableLocale/barprovider.jar and b/jdk/test/java/util/PluggableLocale/barprovider.jar differ diff --git a/jdk/test/java/util/PluggableLocale/providersrc/GenericTimeZoneNameProviderImpl.java b/jdk/test/java/util/PluggableLocale/providersrc/GenericTimeZoneNameProviderImpl.java new file mode 100644 index 00000000000..b005b1a8b15 --- /dev/null +++ b/jdk/test/java/util/PluggableLocale/providersrc/GenericTimeZoneNameProviderImpl.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * + */ + +package com.bar; + +import java.util.*; +import java.util.spi.*; + +import com.foobar.Utils; + +/** + * Implementation class for getGenericTimeZoneName which returns "Generic "+. + */ +public class GenericTimeZoneNameProviderImpl extends TimeZoneNameProviderImpl { + static final Locale jaJPGeneric = new Locale("ja", "JP", "generic"); + static final Locale OSAKA = new Locale("ja", "JP", "osaka"); + + static Locale[] avail = { + jaJPGeneric + }; + + @Override + public Locale[] getAvailableLocales() { + return avail; + } + + @Override + public String getGenericDisplayName(String id, int style, Locale locale) { + if (!jaJPGeneric.equals(locale)) { + return null; + } + String std = super.getDisplayName(id, false, style, OSAKA); + return (std != null) ? "Generic " + std : null; + } +} diff --git a/jdk/test/java/util/PluggableLocale/providersrc/Makefile b/jdk/test/java/util/PluggableLocale/providersrc/Makefile index 2af60665a36..916fed91e62 100644 --- a/jdk/test/java/util/PluggableLocale/providersrc/Makefile +++ b/jdk/test/java/util/PluggableLocale/providersrc/Makefile @@ -38,6 +38,7 @@ BARFILES_JAVA = \ CurrencyNameProviderImpl.java \ CurrencyNameProviderImpl2.java \ TimeZoneNameProviderImpl.java \ + GenericTimeZoneNameProviderImpl.java \ LocaleNameProviderImpl.java \ CalendarDataProviderImpl.java \ CalendarNameProviderImpl.java \ diff --git a/jdk/test/java/util/PluggableLocale/providersrc/java.util.spi.TimeZoneNameProvider b/jdk/test/java/util/PluggableLocale/providersrc/java.util.spi.TimeZoneNameProvider index c435e04e133..a72cb416c33 100644 --- a/jdk/test/java/util/PluggableLocale/providersrc/java.util.spi.TimeZoneNameProvider +++ b/jdk/test/java/util/PluggableLocale/providersrc/java.util.spi.TimeZoneNameProvider @@ -5,3 +5,4 @@ # implementation class # com.bar.TimeZoneNameProviderImpl +com.bar.GenericTimeZoneNameProviderImpl diff --git a/jdk/test/java/util/Properties/Compatibility.xml b/jdk/test/java/util/Properties/Compatibility.xml new file mode 100644 index 00000000000..b80d2d045f2 --- /dev/null +++ b/jdk/test/java/util/Properties/Compatibility.xml @@ -0,0 +1,10 @@ + + ]> + + +Property With Other Encoding +value1 +]]> +&intEnt; + diff --git a/jdk/test/java/util/Properties/CompatibilityTest.java b/jdk/test/java/util/Properties/CompatibilityTest.java new file mode 100644 index 00000000000..efd16c9bd59 --- /dev/null +++ b/jdk/test/java/util/Properties/CompatibilityTest.java @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8005280 8004371 + * @summary Compatibility test + * @run main CompatibilityTest + * @run main/othervm -Dsun.util.spi.XmlPropertiesProvider=jdk.internal.util.xml.BasicXmlPropertiesProvider CompatibilityTest + */ + +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; + +/** + * This is a behavior compatibility test. + * Although not defined by the properties.dtd, the constructs + * in Compatibility.xml are supported by the regular JDK XML + * Provider. + * + * @author: Joe Wang + */ +public class CompatibilityTest { + + public static void main(String[] args) { + testInternalDTD(); + } + + /* + * Not in the spec, but the constructs work with the current JDK + */ + static void testInternalDTD() { + String src = System.getProperty("test.src"); + if (src == null) { + src = "."; + } + loadPropertyFile(src + "/Compatibility.xml"); + } + + /* + * 'Store' the populated 'Property' with the specified 'Encoding Type' as an + * XML file. Retrieve the same XML file and 'load' onto a new 'Property' object. + */ + static void loadPropertyFile(String filename) { + try (InputStream in = new FileInputStream(filename)) { + Properties prop = new Properties(); + prop.loadFromXML(in); + verifyProperites(prop); + } catch (IOException ex) { + fail(ex.getMessage()); + } + } + + /* + * This method verifies the first key-value with the original string. + */ + static void verifyProperites(Properties prop) { + try { + for (String key : prop.stringPropertyNames()) { + String val = prop.getProperty(key); + if (key.equals("Key1")) { + if (!val.equals("value1")) { + fail("Key:" + key + "'s value: \nExpected: value1\nFound: " + val); + } + } else if (key.equals("Key2")) { + if (!val.equals("")) { + fail("Key:" + key + "'s value: \nExpected: \nFound: " + val); + } + } else if (key.equals("Key3")) { + if (!val.equals("value3")) { + fail("Key:" + key + "'s value: \nExpected: value3\nFound: " + val); + } + } + } + } catch (Exception e) { + fail(e.getMessage()); + } + + } + + static void fail(String err) { + throw new RuntimeException(err); + } + +} diff --git a/jdk/test/java/util/Properties/ConcurrentLoadAndStoreXML.java b/jdk/test/java/util/Properties/ConcurrentLoadAndStoreXML.java new file mode 100644 index 00000000000..1e439439a00 --- /dev/null +++ b/jdk/test/java/util/Properties/ConcurrentLoadAndStoreXML.java @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* @test + * @bug 8005281 + * @summary Test that the Properties storeToXML and loadFromXML methods are + * thread safe + * @run main ConcurrentLoadAndStoreXML + * @run main/othervm -Dsun.util.spi.XmlPropertiesProvider=jdk.internal.util.xml.BasicXmlPropertiesProvider ConcurrentLoadAndStoreXML + + */ + +import java.io.*; +import java.util.Properties; +import java.util.Random; +import java.util.concurrent.Callable; +import java.util.concurrent.Executors; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; + +public class ConcurrentLoadAndStoreXML { + + static final Random RAND = new Random(); + + static volatile boolean done; + + /** + * Simple task that bashes on storeToXML and loadFromXML until the "done" + * flag is set. + */ + static class Basher implements Callable { + final Properties props; + + Basher(Properties props) { + this.props = props; + } + + public Void call() throws IOException { + while (!done) { + + // store as XML format + ByteArrayOutputStream out = new ByteArrayOutputStream(); + props.storeToXML(out, null, "UTF-8"); + + // load from XML format + Properties p = new Properties(); + ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); + p.loadFromXML(in); + + // check that the properties are as expected + if (!p.equals(props)) + throw new RuntimeException("Properties not equal"); + } + return null; + } + } + + public static void main(String[] args) throws Exception { + final int NTASKS = 4 + RAND.nextInt(4); + + // create Bashers with Properties of random keys and values + Basher[] basher = new Basher[NTASKS]; + for (int i=0; i[] task = new Future[NTASKS]; + for (int i=0; i/lib/jaxp.properties"); ByteArrayOutputStream out = new ByteArrayOutputStream(); props.storeToXML(out, null, encoding); @@ -89,6 +97,8 @@ public class LoadAndStoreXML { * Test loadFromXML with a document that does not have an encoding declaration */ static void testLoadWithoutEncoding() throws IOException { + System.out.println("testLoadWithoutEncoding"); + Properties expected = new Properties(); expected.put("foo", "bar"); @@ -107,10 +117,11 @@ public class LoadAndStoreXML { } } - /** - * Test loadFromXML with unsupported encoding - */ - static void testLoadWithBadEncoding() throws IOException { + /** + * Test loadFromXML with unsupported encoding + */ + static void testLoadWithBadEncoding() throws IOException { + System.out.println("testLoadWithBadEncoding"); String s = "" + "" + "" + @@ -128,6 +139,7 @@ public class LoadAndStoreXML { * Test storeToXML with unsupported encoding */ static void testStoreWithBadEncoding() throws IOException { + System.out.println("testStoreWithBadEncoding"); Properties props = new Properties(); props.put("foo", "bar"); ByteArrayOutputStream out = new ByteArrayOutputStream(); @@ -137,6 +149,26 @@ public class LoadAndStoreXML { } catch (UnsupportedEncodingException expected) { } } + /** + * Test loadFromXML with malformed documents + */ + static void testLoadWithMalformedDoc(Path dir) throws IOException { + try (DirectoryStream stream = Files.newDirectoryStream(dir, "*.xml")) { + for (Path file: stream) { + System.out.println("testLoadWithMalformedDoc, file=" + file.getFileName()); + try (InputStream in = Files.newInputStream(file)) { + Properties props = new Properties(); + try { + props.loadFromXML(in); + throw new RuntimeException("InvalidPropertiesFormatException not thrown"); + } catch (InvalidPropertiesFormatException x) { + System.out.println(x); + } + } + } + } + } + public static void main(String[] args) throws IOException { testLoadAndStore("UTF-8"); @@ -145,6 +177,12 @@ public class LoadAndStoreXML { testLoadWithBadEncoding(); testStoreWithBadEncoding(); + // malformed documents + String src = System.getProperty("test.src"); + String subdir = "invalidxml"; + Path dir = (src == null) ? Paths.get(subdir) : Paths.get(src, subdir); + testLoadWithMalformedDoc(dir); + // re-run sanity test with security manager Policy orig = Policy.getPolicy(); Policy p = new SimplePolicy(new RuntimePermission("setSecurityManager"), diff --git a/jdk/test/java/util/Properties/invalidxml/BadCase.xml b/jdk/test/java/util/Properties/invalidxml/BadCase.xml new file mode 100644 index 00000000000..0995943df7d --- /dev/null +++ b/jdk/test/java/util/Properties/invalidxml/BadCase.xml @@ -0,0 +1,9 @@ + + + + + + +bar +baz + diff --git a/jdk/test/java/util/Properties/invalidxml/BadDocType.xml b/jdk/test/java/util/Properties/invalidxml/BadDocType.xml new file mode 100644 index 00000000000..7aea19ec558 --- /dev/null +++ b/jdk/test/java/util/Properties/invalidxml/BadDocType.xml @@ -0,0 +1,9 @@ + + + + + + +bar +baz + diff --git a/jdk/test/java/util/Properties/invalidxml/DTDRootNotMatch.xml b/jdk/test/java/util/Properties/invalidxml/DTDRootNotMatch.xml new file mode 100644 index 00000000000..757653a4f3a --- /dev/null +++ b/jdk/test/java/util/Properties/invalidxml/DTDRootNotMatch.xml @@ -0,0 +1,9 @@ + + + + + + +comment +value of the first key + diff --git a/jdk/test/java/util/Properties/invalidxml/IllegalComment.xml b/jdk/test/java/util/Properties/invalidxml/IllegalComment.xml new file mode 100644 index 00000000000..06350acce9c --- /dev/null +++ b/jdk/test/java/util/Properties/invalidxml/IllegalComment.xml @@ -0,0 +1,10 @@ + + + + + + +comment1 +comment2 +value of the first key + diff --git a/jdk/test/java/util/Properties/invalidxml/IllegalEntry.xml b/jdk/test/java/util/Properties/invalidxml/IllegalEntry.xml new file mode 100644 index 00000000000..76171893e84 --- /dev/null +++ b/jdk/test/java/util/Properties/invalidxml/IllegalEntry.xml @@ -0,0 +1,9 @@ + + + + + + +comment +value of the first key + diff --git a/jdk/test/java/util/Properties/invalidxml/IllegalEntry1.xml b/jdk/test/java/util/Properties/invalidxml/IllegalEntry1.xml new file mode 100644 index 00000000000..e51c2979168 --- /dev/null +++ b/jdk/test/java/util/Properties/invalidxml/IllegalEntry1.xml @@ -0,0 +1,11 @@ + + + + + + +comment1 + +value of the first key +value of the second key + diff --git a/jdk/test/java/util/Properties/invalidxml/IllegalKeyAttribute.xml b/jdk/test/java/util/Properties/invalidxml/IllegalKeyAttribute.xml new file mode 100644 index 00000000000..f8c59df5e24 --- /dev/null +++ b/jdk/test/java/util/Properties/invalidxml/IllegalKeyAttribute.xml @@ -0,0 +1,9 @@ + + + + + + +comment1 +value of the first key + diff --git a/jdk/test/java/util/Properties/invalidxml/NoClosingTag.xml b/jdk/test/java/util/Properties/invalidxml/NoClosingTag.xml new file mode 100644 index 00000000000..f3020fb26d1 --- /dev/null +++ b/jdk/test/java/util/Properties/invalidxml/NoClosingTag.xml @@ -0,0 +1,8 @@ + + + + + + +bar +baz diff --git a/jdk/test/java/util/Properties/invalidxml/NoDocType.xml b/jdk/test/java/util/Properties/invalidxml/NoDocType.xml new file mode 100644 index 00000000000..1adb54982f5 --- /dev/null +++ b/jdk/test/java/util/Properties/invalidxml/NoDocType.xml @@ -0,0 +1,8 @@ + + + + + +bar +baz + diff --git a/jdk/test/java/util/Properties/invalidxml/NoNamespaceSupport.xml b/jdk/test/java/util/Properties/invalidxml/NoNamespaceSupport.xml new file mode 100644 index 00000000000..176058d846f --- /dev/null +++ b/jdk/test/java/util/Properties/invalidxml/NoNamespaceSupport.xml @@ -0,0 +1,11 @@ + + + + + + +comment1 + +value of the first key +value of the second key + diff --git a/jdk/test/java/util/Properties/invalidxml/NoRoot.xml b/jdk/test/java/util/Properties/invalidxml/NoRoot.xml new file mode 100644 index 00000000000..dbd0f45131d --- /dev/null +++ b/jdk/test/java/util/Properties/invalidxml/NoRoot.xml @@ -0,0 +1,4 @@ + + + + diff --git a/jdk/test/java/util/Properties/invalidxml/NotQuoted.xml b/jdk/test/java/util/Properties/invalidxml/NotQuoted.xml new file mode 100644 index 00000000000..92448c87385 --- /dev/null +++ b/jdk/test/java/util/Properties/invalidxml/NotQuoted.xml @@ -0,0 +1,9 @@ + + + + + + +bar +baz + diff --git a/jdk/test/java/util/Properties/invalidxml/README.txt b/jdk/test/java/util/Properties/invalidxml/README.txt new file mode 100644 index 00000000000..6e2a7f83b64 --- /dev/null +++ b/jdk/test/java/util/Properties/invalidxml/README.txt @@ -0,0 +1,5 @@ + +This directory contains test cases for the LoadAndStoreXML test case. Each file +in this directory should be a malformed XML document that should cause the +java.util.Properties loadFromXML method to throw InvalidPropertiesFormatException. + diff --git a/jdk/test/java/util/ResourceBundle/Bug6299235Test.sh b/jdk/test/java/util/ResourceBundle/Bug6299235Test.sh index ef17b412172..8bcb74f102d 100644 --- a/jdk/test/java/util/ResourceBundle/Bug6299235Test.sh +++ b/jdk/test/java/util/ResourceBundle/Bug6299235Test.sh @@ -75,7 +75,7 @@ echo "NEW_EXT_DIR=${NEW_EXT_DIR}" cd ${TESTSRC} -${TESTJAVA}/bin/java -cp ${TESTCLASSES} -Djava.ext.dirs=${NEW_EXT_DIR} Bug6299235Test +${TESTJAVA}/bin/java ${TESTVMOPTS} -cp ${TESTCLASSES} -Djava.ext.dirs=${NEW_EXT_DIR} Bug6299235Test if [ $? -ne 0 ] then diff --git a/jdk/test/java/util/ResourceBundle/Control/MissingResourceCauseTest.sh b/jdk/test/java/util/ResourceBundle/Control/MissingResourceCauseTest.sh index 7bb77326a78..d23ada5c9b6 100644 --- a/jdk/test/java/util/ResourceBundle/Control/MissingResourceCauseTest.sh +++ b/jdk/test/java/util/ResourceBundle/Control/MissingResourceCauseTest.sh @@ -50,7 +50,7 @@ chmod 000 $UNREADABLE : ${TESTCLASS:=.} : ${TESTSRC:=.} -${TESTJAVA}/bin/java -esa -cp ${TESTCLASS}${DEL}${TESTSRC} MissingResourceCauseTest +${TESTJAVA}/bin/java ${TESTVMOPTS} -esa -cp ${TESTCLASS}${DEL}${TESTSRC} MissingResourceCauseTest STATUS=$? chmod 666 $UNREADABLE rm -f $UNREADABLE diff --git a/jdk/test/java/util/ServiceLoader/basic.sh b/jdk/test/java/util/ServiceLoader/basic.sh index 259b2e15636..72d68fab7ae 100644 --- a/jdk/test/java/util/ServiceLoader/basic.sh +++ b/jdk/test/java/util/ServiceLoader/basic.sh @@ -94,7 +94,7 @@ go() { cp="$1"; shift if [ -z "$cp" ]; then cp="$TESTCLASSES"; else cp="$TESTCLASSES$SEP$cp"; fi vmargs="$1"; shift - sh -xc "'$JAVA' -cp $cp $vmargs $T $*" 2>&1 + sh -xc "'$JAVA' ${TESTVMOPTS} -cp $cp $vmargs $T $*" 2>&1 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi } diff --git a/jdk/test/java/util/TimeZone/CLDRDisplayNamesTest.java b/jdk/test/java/util/TimeZone/CLDRDisplayNamesTest.java new file mode 100644 index 00000000000..100ae8da189 --- /dev/null +++ b/jdk/test/java/util/TimeZone/CLDRDisplayNamesTest.java @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8005471 + * @run main/othervm -Djava.locale.providers=CLDR CLDRDisplayNamesTest + * @summary Make sure that localized time zone names of CLDR are used + * if specified. + */ + +import java.util.*; +import static java.util.TimeZone.*; + +public class CLDRDisplayNamesTest { + /* + * The first element is a language tag. The rest are localized + * display names of America/Los_Angeles copied from the CLDR + * resources data. If data change in CLDR, test data below will + * need to be changed accordingly. + * + * Generic names are NOT tested (until they are supported by API). + */ + static final String[][] CLDR_DATA = { + { + "ja-JP", + "\u30a2\u30e1\u30ea\u30ab\u592a\u5e73\u6d0b\u6a19\u6e96\u6642", + "PST", + "\u30a2\u30e1\u30ea\u30ab\u592a\u5e73\u6d0b\u590f\u6642\u9593", + "PDT", + //"\u30a2\u30e1\u30ea\u30ab\u592a\u5e73\u6d0b\u6642\u9593", + //"PT" + }, + { + "zh-CN", + "\u592a\u5e73\u6d0b\u6807\u51c6\u65f6\u95f4", + "PST", + "\u592a\u5e73\u6d0b\u590f\u4ee4\u65f6\u95f4", + "PDT", + //"\u7f8e\u56fd\u592a\u5e73\u6d0b\u65f6\u95f4", + //"PT" + }, + { + "de-DE", + "Nordamerikanische Westk\u00fcsten-Winterzeit", + "PST", + "Nordamerikanische Westk\u00fcsten-Sommerzeit", + "PDT", + //"Nordamerikanische Westk\u00fcstenzeit", + //"PT" + }, + }; + + public static void main(String[] args) { + TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles"); + int errors = 0; + for (String[] data : CLDR_DATA) { + Locale locale = Locale.forLanguageTag(data[0]); + for (int i = 1; i < data.length; i++) { + int style = ((i % 2) == 1) ? LONG : SHORT; + boolean daylight = (i == 3 || i == 4); + String name = tz.getDisplayName(daylight, style, locale); + if (!data[i].equals(name)) { + System.err.printf("error: got '%s' expected '%s' (style=%d, daylight=%s, locale=%s)%n", + name, data[i], style, daylight, locale); + errors++; + } + } + } + if (errors > 0) { + throw new RuntimeException("test failed"); + } + } +} diff --git a/jdk/test/java/util/TimeZone/OldIDMappingTest.sh b/jdk/test/java/util/TimeZone/OldIDMappingTest.sh index 0f776e4e1fe..f7d67ba17e4 100644 --- a/jdk/test/java/util/TimeZone/OldIDMappingTest.sh +++ b/jdk/test/java/util/TimeZone/OldIDMappingTest.sh @@ -40,7 +40,7 @@ do if [ x"$I" != x ]; then D="-Dsun.timezone.ids.oldmapping=${I}" fi - if ! ${JAVA} ${D} -cp ${TESTCLASSES} OldIDMappingTest -new; then + if ! ${JAVA} ${D} ${TESTVMOPTS} -cp ${TESTCLASSES} OldIDMappingTest -new; then STATUS=1 fi done @@ -51,7 +51,7 @@ do if [ "x$I" != x ]; then D="-Dsun.timezone.ids.oldmapping=${I}" fi - if ! ${JAVA} ${D} -cp ${TESTCLASSES} OldIDMappingTest -old; then + if ! ${JAVA} ${D} ${TESTVMOPTS} -cp ${TESTCLASSES} OldIDMappingTest -old; then STATUS=1 fi done diff --git a/jdk/test/java/util/TimeZone/TimeZoneDatePermissionCheck.sh b/jdk/test/java/util/TimeZone/TimeZoneDatePermissionCheck.sh index 226228f1754..4a295ce532f 100644 --- a/jdk/test/java/util/TimeZone/TimeZoneDatePermissionCheck.sh +++ b/jdk/test/java/util/TimeZone/TimeZoneDatePermissionCheck.sh @@ -53,6 +53,6 @@ ${TESTJAVA}/bin/jarsigner \ # run it with the security manager on, plus accesscontroller debugging # will go into infinite recursion trying to get enough permissions for # printing Date of failing certificate unless fix is applied. -${TESTJAVA}/bin/java -Djava.security.manager \ +${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.security.manager \ -Djava.security.debug=access,failure,policy \ -cp ${TESTCLASSES}/timezonedatetest.jar TimeZoneDatePermissionCheck diff --git a/jdk/test/java/util/concurrent/FutureTask/DoneTimedGetLoops.java b/jdk/test/java/util/concurrent/FutureTask/DoneTimedGetLoops.java index c1b81c286af..c96c43b5bf0 100644 --- a/jdk/test/java/util/concurrent/FutureTask/DoneTimedGetLoops.java +++ b/jdk/test/java/util/concurrent/FutureTask/DoneTimedGetLoops.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/util/logging/CheckLockLocationTest.java b/jdk/test/java/util/logging/CheckLockLocationTest.java index 0eb98c0d4a0..956621ae6e4 100644 --- a/jdk/test/java/util/logging/CheckLockLocationTest.java +++ b/jdk/test/java/util/logging/CheckLockLocationTest.java @@ -30,7 +30,6 @@ * @run main/othervm CheckLockLocationTest */ import java.io.File; -import java.io.FileNotFoundException; import java.io.IOException; import java.nio.file.AccessDeniedException; import java.nio.file.FileSystemException; @@ -42,17 +41,22 @@ public class CheckLockLocationTest { private static final String NOT_A_DIR = "not-a-dir"; private static final String WRITABLE_DIR = "writable-dir"; private static final String NON_EXISTENT_DIR = "non-existent-dir"; + private static boolean runNonWritableDirTest; public static void main(String... args) throws IOException { // we'll base all file creation attempts on the system temp directory, // %t and also try specifying non-existent directories and plain files // that should be directories, and non-writable directories, // to exercise all code paths of checking the lock location + // Note that on platforms like Windows that don't support + // setWritable() on a directory, we'll skip the non-writable + // directory test if setWritable(false) returns false. + // File writableDir = setup(); // we now have three files/directories to work with: // writableDir // notAdir - // nonWritableDir + // nonWritableDir (may not be possible on some platforms) // nonExistentDir (which doesn't exist) runTests(writableDir); } @@ -79,15 +83,18 @@ public class CheckLockLocationTest { } // Test 2: creating FileHandler in non-writable directory should fail - try { - new FileHandler("%t/" + NON_WRITABLE_DIR + "/log.log"); - throw new RuntimeException("Test failed: should not have been able" - + " to create FileHandler for " + "%t/" + NON_WRITABLE_DIR - + "/log.log in non-writable directory."); - } catch (IOException ex) { - // check for the right exception - if (!(ex instanceof AccessDeniedException)) { - throw new RuntimeException("Test failed: Expected exception was not an AccessDeniedException", ex); + if (runNonWritableDirTest) { + try { + new FileHandler("%t/" + NON_WRITABLE_DIR + "/log.log"); + throw new RuntimeException("Test failed: should not have been able" + + " to create FileHandler for " + "%t/" + NON_WRITABLE_DIR + + "/log.log in non-writable directory."); + } catch (AccessDeniedException ex) { + // the right exception was thrown, so continue. + } catch (IOException ex) { + throw new RuntimeException( + "Test failed: Expected exception was not an " + + "AccessDeniedException", ex); } } @@ -97,11 +104,11 @@ public class CheckLockLocationTest { throw new RuntimeException("Test failed: should not have been able" + " to create FileHandler for " + "%t/" + NOT_A_DIR + "/log.log in non-directory."); + } catch (FileSystemException ex) { + // the right exception was thrown, so continue. } catch (IOException ex) { - // check for the right exception - if (!(ex instanceof FileSystemException && ex.getMessage().contains("Not a directory"))) { - throw new RuntimeException("Test failed: Expected exception was not a FileSystemException", ex); - } + throw new RuntimeException("Test failed: exception thrown was not a " + + "FileSystemException", ex); } // Test 4: make sure we can't create a FileHandler in a non-existent dir @@ -110,11 +117,11 @@ public class CheckLockLocationTest { throw new RuntimeException("Test failed: should not have been able" + " to create FileHandler for " + "%t/" + NON_EXISTENT_DIR + "/log.log in a non-existent directory."); + } catch (NoSuchFileException ex) { + // the right exception was thrown, so continue. } catch (IOException ex) { - // check for the right exception - if (!(ex instanceof NoSuchFileException)) { - throw new RuntimeException("Test failed: Expected exception was not a NoSuchFileException", ex); - } + throw new RuntimeException("Test failed: Expected exception " + + "was not a NoSuchFileException", ex); } } @@ -162,10 +169,14 @@ public class CheckLockLocationTest { nonWritableDir.deleteOnExit(); // make it non-writable - if (!nonWritableDir.setWritable(false)) { - throw new RuntimeException("Test setup failed: unable to make" + if (nonWritableDir.setWritable(false)) { + runNonWritableDirTest = true; + } else { + runNonWritableDirTest = false; + System.out.println( "Test Setup WARNING: unable to make" + " working directory " + nonWritableDir.getAbsolutePath() - + " non-writable."); + + " non-writable on platform " + System.getProperty("os.name")); + } // make sure non-existent directory really doesn't exist @@ -199,12 +210,14 @@ public class CheckLockLocationTest { /* * Recursively delete all files starting at specified file */ - private static void delete(File f) throws IOException { + private static void delete(File f) { if (f != null && f.isDirectory()) { for (File c : f.listFiles()) delete(c); } if (!f.delete()) - throw new FileNotFoundException("Failed to delete file: " + f); - } + System.err.println( + "WARNING: unable to delete/cleanup writable test directory: " + + f ); + } } diff --git a/jdk/test/java/util/logging/LoggerResourceBundleRace.java b/jdk/test/java/util/logging/LoggerResourceBundleRace.java index e159a2ddeb9..aabbc140f85 100644 --- a/jdk/test/java/util/logging/LoggerResourceBundleRace.java +++ b/jdk/test/java/util/logging/LoggerResourceBundleRace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/util/logging/LoggingDeadlock2.java b/jdk/test/java/util/logging/LoggingDeadlock2.java index 8c83ae90cee..de328e7681a 100644 --- a/jdk/test/java/util/logging/LoggingDeadlock2.java +++ b/jdk/test/java/util/logging/LoggingDeadlock2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/util/logging/LoggingDeadlock3.java b/jdk/test/java/util/logging/LoggingDeadlock3.java index 73162d58b6b..4bbb3d37704 100644 --- a/jdk/test/java/util/logging/LoggingDeadlock3.java +++ b/jdk/test/java/util/logging/LoggingDeadlock3.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/util/logging/LoggingDeadlock4.java b/jdk/test/java/util/logging/LoggingDeadlock4.java index 65846979fb9..63c51bf4b59 100644 --- a/jdk/test/java/util/logging/LoggingDeadlock4.java +++ b/jdk/test/java/util/logging/LoggingDeadlock4.java @@ -23,11 +23,11 @@ /* * @test - * @bug 6977677 + * @bug 6977677 8004928 * @summary Deadlock between LogManager. and Logger.getLogger() * @author Daniel D. Daugherty - * @build LoggingDeadlock4 - * @run main/othervm/timeout=15 -Djava.awt.headless=true LoggingDeadlock4 + * @compile -XDignore.symbol.file LoggingDeadlock4.java + * @run main/othervm/timeout=15 LoggingDeadlock4 */ import java.util.concurrent.CountDownLatch; @@ -39,21 +39,16 @@ public class LoggingDeadlock4 { private static CountDownLatch lmIsRunning = new CountDownLatch(1); private static CountDownLatch logIsRunning = new CountDownLatch(1); + // Create a sun.util.logging.PlatformLogger$JavaLogger object + // that has to be redirected when the LogManager class + // is initialized. This can cause a deadlock between + // LogManager. and Logger.getLogger(). + private static final sun.util.logging.PlatformLogger log = + sun.util.logging.PlatformLogger.getLogger("java.util.logging"); + public static void main(String[] args) { System.out.println("main: LoggingDeadlock4 is starting."); - // Loading the java.awt.Container class will create a - // sun.util.logging.PlatformLogger$JavaLogger object - // that has to be redirected when the LogManager class - // is initialized. This can cause a deadlock between - // LogManager. and Logger.getLogger(). - try { - Class.forName("java.awt.Container"); - } catch (ClassNotFoundException cnfe) { - throw new RuntimeException("Test failed: could not load" - + " java.awt.Container." + cnfe); - } - Thread lmThread = new Thread("LogManagerThread") { public void run() { // let main know LogManagerThread is running diff --git a/jdk/test/java/util/logging/SimpleFormatterFormat.java b/jdk/test/java/util/logging/SimpleFormatterFormat.java index 4fafba3b778..a041c0d3c61 100644 --- a/jdk/test/java/util/logging/SimpleFormatterFormat.java +++ b/jdk/test/java/util/logging/SimpleFormatterFormat.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/util/prefs/CheckUserPrefsStorage.sh b/jdk/test/java/util/prefs/CheckUserPrefsStorage.sh index 5314b120c0c..28210696b39 100644 --- a/jdk/test/java/util/prefs/CheckUserPrefsStorage.sh +++ b/jdk/test/java/util/prefs/CheckUserPrefsStorage.sh @@ -50,14 +50,14 @@ case "$OS" in esac # run CheckUserPrefFirst - creates and stores a user pref -${TESTJAVA}${FS}bin${FS}java -cp ${TESTCLASSES} -Djava.util.prefs.userRoot=. CheckUserPrefFirst +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTCLASSES} -Djava.util.prefs.userRoot=. CheckUserPrefFirst result=$? if [ "$result" -ne "0" ]; then exit 1 fi # run CheckUserPrefLater - Looks for the stored pref -${TESTJAVA}${FS}bin${FS}java -cp ${TESTCLASSES} -Djava.util.prefs.userRoot=. CheckUserPrefLater +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTCLASSES} -Djava.util.prefs.userRoot=. CheckUserPrefLater result=$? if [ "$result" -ne "0" ]; then exit 1 diff --git a/jdk/test/java/util/prefs/PrefsSpi.sh b/jdk/test/java/util/prefs/PrefsSpi.sh index b140b306260..f1ce4f834ac 100644 --- a/jdk/test/java/util/prefs/PrefsSpi.sh +++ b/jdk/test/java/util/prefs/PrefsSpi.sh @@ -87,17 +87,17 @@ Sys "$javac" -d jarDir StubPreferencesFactory.java StubPreferences.java case "`uname`" in Windows*|CYGWIN* ) CPS=';';; *) CPS=':';; esac -Sys "$java" "-cp" "$TESTCLASSES${CPS}extDir/PrefsSpi.jar" \ +Sys "$java" ${TESTVMOPTS} "-cp" "$TESTCLASSES${CPS}extDir/PrefsSpi.jar" \ -Djava.util.prefs.PreferencesFactory=StubPreferencesFactory \ -Djava.util.prefs.userRoot=. \ PrefsSpi "StubPreferences" -Sys "$java" "-cp" "$TESTCLASSES" \ +Sys "$java" ${TESTVMOPTS} "-cp" "$TESTCLASSES" \ -Djava.util.prefs.userRoot=. \ PrefsSpi "java.util.prefs.*" -Sys "$java" "-cp" "$TESTCLASSES${CPS}extDir/PrefsSpi.jar" \ +Sys "$java" ${TESTVMOPTS} "-cp" "$TESTCLASSES${CPS}extDir/PrefsSpi.jar" \ -Djava.util.prefs.userRoot=. \ PrefsSpi "StubPreferences" -Sys "$java" "-cp" "$TESTCLASSES" "-Djava.ext.dirs=extDir" \ +Sys "$java" ${TESTVMOPTS} "-cp" "$TESTCLASSES" "-Djava.ext.dirs=extDir" \ -Djava.util.prefs.userRoot=. \ PrefsSpi "StubPreferences" diff --git a/jdk/test/java/util/spi/ResourceBundleControlProvider/UserDefaultControlTest.sh b/jdk/test/java/util/spi/ResourceBundleControlProvider/UserDefaultControlTest.sh index c6b91235609..538142606a0 100644 --- a/jdk/test/java/util/spi/ResourceBundleControlProvider/UserDefaultControlTest.sh +++ b/jdk/test/java/util/spi/ResourceBundleControlProvider/UserDefaultControlTest.sh @@ -21,4 +21,5 @@ # questions. # -${TESTJAVA}/bin/java -Djava.ext.dirs=${TESTSRC} -cp ${TESTCLASSES} UserDefaultControlTest \ No newline at end of file +${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.ext.dirs=${TESTSRC} -cp ${TESTCLASSES} UserDefaultControlTest + diff --git a/jdk/test/java/util/spi/ResourceBundleControlProvider/providersrc/XmlRB.xml b/jdk/test/java/util/spi/ResourceBundleControlProvider/providersrc/XmlRB.xml index ef00b646698..689df75b896 100644 --- a/jdk/test/java/util/spi/ResourceBundleControlProvider/providersrc/XmlRB.xml +++ b/jdk/test/java/util/spi/ResourceBundleControlProvider/providersrc/XmlRB.xml @@ -5,13 +5,13 @@ 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 + 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 + 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). diff --git a/jdk/test/java/util/spi/ResourceBundleControlProvider/providersrc/XmlRB_ja.xml b/jdk/test/java/util/spi/ResourceBundleControlProvider/providersrc/XmlRB_ja.xml index 08b55b21bf0..fb273f53c2a 100644 --- a/jdk/test/java/util/spi/ResourceBundleControlProvider/providersrc/XmlRB_ja.xml +++ b/jdk/test/java/util/spi/ResourceBundleControlProvider/providersrc/XmlRB_ja.xml @@ -5,13 +5,13 @@ 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 + 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 + 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). diff --git a/jdk/test/java/util/zip/3GBZipFiles.sh b/jdk/test/java/util/zip/3GBZipFiles.sh index 9caf109000c..65db4e296ea 100644 --- a/jdk/test/java/util/zip/3GBZipFiles.sh +++ b/jdk/test/java/util/zip/3GBZipFiles.sh @@ -1,4 +1,3 @@ -# # Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # @@ -83,7 +82,7 @@ buildFile () huge-*) filesize_="$hugeSize" ;; tiny-*) filesize_="$tinySize" ;; esac - sys "$JAVA" "-cp" "$TESTCLASSES" "FileBuilder" \ + sys "$JAVA" ${TESTVMOPTS} "-cp" "$TESTCLASSES" "FileBuilder" \ "$filetype_" "$filename_" "$filesize_" } diff --git a/jdk/test/java/util/zip/ZipFile/deletetempjar.sh b/jdk/test/java/util/zip/ZipFile/deletetempjar.sh index afa47feb91d..bad1a0f1e4b 100644 --- a/jdk/test/java/util/zip/ZipFile/deletetempjar.sh +++ b/jdk/test/java/util/zip/ZipFile/deletetempjar.sh @@ -30,7 +30,7 @@ if [ "x$TESTJAVA" = x ]; then TESTCLASSES=. fi -tmpfile=`$TESTJAVA/bin/java -classpath $TESTCLASSES DeleteTempJar` +tmpfile=`$TESTJAVA/bin/java ${TESTVMOPTS} -classpath $TESTCLASSES DeleteTempJar` rc=$? if [ $rc != 0 ]; then echo Unexpected failure with exit status $rc diff --git a/jdk/test/javax/crypto/SecretKeyFactory/FailOverTest.sh b/jdk/test/javax/crypto/SecretKeyFactory/FailOverTest.sh index b23e2bd99a2..ab8bb0ed8c9 100644 --- a/jdk/test/javax/crypto/SecretKeyFactory/FailOverTest.sh +++ b/jdk/test/javax/crypto/SecretKeyFactory/FailOverTest.sh @@ -82,6 +82,7 @@ if [ $? -ne 0 ]; then fi ${TESTJAVA}${FS}bin${FS}java \ + ${TESTVMOPTS} \ -classpath "${TESTSRC}${FS}P1.jar${PS}${TESTSRC}${FS}P2.jar${PS}." \ FailOverTest result=$? diff --git a/jdk/test/javax/management/MBeanInfo/SerializationTest1.java b/jdk/test/javax/management/MBeanInfo/SerializationTest1.java new file mode 100644 index 00000000000..59ef18cc2be --- /dev/null +++ b/jdk/test/javax/management/MBeanInfo/SerializationTest1.java @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 6783290 + * @summary Test correct reading of an empty Descriptor. + * @author Jaroslav Bachorik + * @run clean SerializationTest1 + * @run build SerializationTest1 + * @run main SerializationTest1 + */ + +import java.io.*; +import javax.management.*; + +public class SerializationTest1 { + public static void main(String[] args) throws Exception { + MBeanInfo mi1 = new MBeanInfo("", + "", + new MBeanAttributeInfo[]{}, + new MBeanConstructorInfo[]{}, + new MBeanOperationInfo[]{}, + new MBeanNotificationInfo[]{}, + ImmutableDescriptor.EMPTY_DESCRIPTOR); + + test(mi1); + + MBeanFeatureInfo mfi2 = new MBeanFeatureInfo("", + "", + ImmutableDescriptor.EMPTY_DESCRIPTOR); + + test(mfi2); + } + + public static void test(Object obj) throws Exception { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(baos); + oos.writeObject(obj); + + final boolean[] failed = new boolean[]{false}; + ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); + final ObjectInputStream ois = new ObjectInputStream(bais) { + protected Class resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException { + System.out.println("*** " + desc.getName()); + if (desc.getName().equals("[Ljava.lang.Object;")) { // javax.management.Descriptor fields + Thread.dumpStack(); + for(StackTraceElement e : Thread.currentThread().getStackTrace()) { // checking for the deserialization location + if (e.getMethodName().equals("skipCustomData")) { // indicates the presence of unread values from the custom object serialization + failed[0] = true; + } + } + } + return super.resolveClass(desc); //To change body of generated methods, choose Tools | Templates. + } + }; + Object newObj = ois.readObject(); + + if (failed[0]) { + throw new RuntimeException("Zero-length descriptor not read back"); + } + } +} diff --git a/jdk/test/javax/management/remote/mandatory/connection/AddressableTest.java b/jdk/test/javax/management/remote/mandatory/connection/AddressableTest.java index dce8bb1d0c8..049fef08497 100644 --- a/jdk/test/javax/management/remote/mandatory/connection/AddressableTest.java +++ b/jdk/test/javax/management/remote/mandatory/connection/AddressableTest.java @@ -45,19 +45,36 @@ public class AddressableTest { private static final MBeanServer mbs = MBeanServerFactory.createMBeanServer(); + private static boolean isProtocolSupported(String protocol) { + if (protocol.equals("rmi")) + return true; + if (protocol.equals("iiop")) { + try { + Class.forName("javax.management.remote.rmi._RMIConnectionImpl_Tie"); + return true; + } catch (ClassNotFoundException x) { } + } + return false; + } + public static void main(String[] args) throws Exception { System.out.println(">>> test the new interface Addressable."); boolean ok = true; for (int i = 0; i < protocols.length; i++) { - try { - test(protocols[i], prefixes[i]); - - System.out.println(">>> Test successed for "+protocols[i]); - } catch (Exception e) { - System.out.println(">>> Test failed for "+protocols[i]); - e.printStackTrace(System.out); - ok = false; + String protocol = protocols[i]; + if (isProtocolSupported(protocol)) { + try { + test(protocol, prefixes[i]); + System.out.println(">>> Test successed for "+protocols[i]); + } catch (Exception e) { + System.out.println(">>> Test failed for "+protocols[i]); + e.printStackTrace(System.out); + ok = false; + } + } else { + System.out.format(">>> Test skipped for %s, protocol not supported%n", + protocol); } } @@ -65,7 +82,7 @@ public class AddressableTest { System.out.println(">>> All Test passed."); } else { System.out.println(">>> Some TESTs FAILED"); - System.exit(1); + throw new RuntimeException("See log for details"); } } diff --git a/jdk/test/javax/management/remote/mandatory/connection/CloseableTest.java b/jdk/test/javax/management/remote/mandatory/connection/CloseableTest.java index 93d1b92e8ca..00451da7e81 100644 --- a/jdk/test/javax/management/remote/mandatory/connection/CloseableTest.java +++ b/jdk/test/javax/management/remote/mandatory/connection/CloseableTest.java @@ -42,7 +42,6 @@ import javax.management.remote.rmi.RMIConnector; import javax.management.remote.rmi.RMIIIOPServerImpl; import javax.management.remote.rmi.RMIJRMPServerImpl; import javax.management.remote.rmi.RMIServerImpl; -import org.omg.stub.javax.management.remote.rmi._RMIConnection_Stub; public class CloseableTest { private static final Class closeArray[] = { @@ -51,26 +50,43 @@ public class CloseableTest { RMIConnection.class, RMIConnectionImpl.class, RMIConnectionImpl_Stub.class, - _RMIConnection_Stub.class, RMIServerImpl.class, RMIIIOPServerImpl.class, RMIJRMPServerImpl.class }; + + static int error; + + static void test(Class c) { + System.out.println("\nTest " + c); + if (Closeable.class.isAssignableFrom(c)) { + System.out.println("Test passed!"); + } else { + error++; + System.out.println("Test failed!"); + } + } + + static void test(String cn) { + try { + test(Class.forName(cn)); + } catch (ClassNotFoundException ignore) { + System.out.println("\n" + cn + " not tested."); + } + } + public static void main(String[] args) throws Exception { System.out.println("Test that all the JMX Remote API classes that " + "define\nthe method \"void close() throws " + "IOException;\" extend\nor implement the " + "java.io.Closeable interface."); - int error = 0; - for (Class c : closeArray) { - System.out.println("\nTest " + c); - if (Closeable.class.isAssignableFrom(c)) { - System.out.println("Test passed!"); - } else { - error++; - System.out.println("Test failed!"); - } + for (Class c : closeArray) { + test(c); } + + // Stub classes not present if RMI-IIOP not supported + test("org.omg.stub.javax.management.remote.rmi._RMIConnection_Stub"); + if (error > 0) { final String msg = "\nTest FAILED! Got " + error + " error(s)"; System.out.println(msg); diff --git a/jdk/test/javax/management/remote/mandatory/connection/ConnectionListenerNullTest.java b/jdk/test/javax/management/remote/mandatory/connection/ConnectionListenerNullTest.java index c7b0208c2a3..62027b4f844 100644 --- a/jdk/test/javax/management/remote/mandatory/connection/ConnectionListenerNullTest.java +++ b/jdk/test/javax/management/remote/mandatory/connection/ConnectionListenerNullTest.java @@ -39,33 +39,22 @@ import javax.management.NotificationListener; import java.util.Map; public class ConnectionListenerNullTest { - static final boolean optionalFlag; - static { - Class genericClass = null; + static boolean isPresent(String cn) { try { - genericClass = - Class.forName("javax.management.remote.generic.GenericConnector"); + Class.forName(cn); + return true; } catch (ClassNotFoundException x) { - // NO optional package + return false; } - optionalFlag = (genericClass != null); } - final static String[] mandatoryList = { - "service:jmx:rmi://", "service:jmx:iiop://" - }; - - final static String[] optionalList = { - "service:jmx:jmxmp://" - }; - - public static int test(String[] urls) { + public static int test(String... urls) { int errCount = 0; for (int i=0;i)null); final NotificationListener nl = null; final NotificationFilter nf = null; final Object h = null; @@ -121,12 +110,19 @@ public class ConnectionListenerNullTest { public static void main(String args[]) { int errCount = 0; - errCount += test(mandatoryList); - if (optionalFlag) errCount += test(optionalList); + + // mandatory + errCount += test("service:jmx:rmi://"); + + // optional + if (isPresent("javax.management.remote.rmi._RMIConnectionImpl_Tie")) + errCount += test("service:jmx:iiop://"); + if (isPresent("javax.management.remote.generic.GenericConnector")) + errCount += test("service:jmx:jmxmp://"); + if (errCount > 0) { - System.err.println("ConnectionListenerNullTest failed: " + - errCount + " error(s) reported."); - System.exit(1); + throw new RuntimeException("ConnectionListenerNullTest failed: " + + errCount + " error(s) reported."); } System.out.println("ConnectionListenerNullTest passed."); } diff --git a/jdk/test/javax/management/remote/mandatory/connection/IIOPURLTest.java b/jdk/test/javax/management/remote/mandatory/connection/IIOPURLTest.java index 0899a0c2709..bca8396e11c 100644 --- a/jdk/test/javax/management/remote/mandatory/connection/IIOPURLTest.java +++ b/jdk/test/javax/management/remote/mandatory/connection/IIOPURLTest.java @@ -49,17 +49,24 @@ public class IIOPURLTest { public static void main(String[] args) throws Exception { JMXServiceURL inputAddr = new JMXServiceURL("service:jmx:iiop://"); - JMXConnectorServer s = - JMXConnectorServerFactory.newJMXConnectorServer(inputAddr, null, - null); + JMXConnectorServer s; + try { + s = JMXConnectorServerFactory.newJMXConnectorServer(inputAddr, null, null); + } catch (java.net.MalformedURLException x) { + try { + Class.forName("javax.management.remote.rmi._RMIConnectionImpl_Tie"); + throw new RuntimeException("MalformedURLException thrown but iiop appears to be supported"); + } catch (ClassNotFoundException expected) { } + System.out.println("IIOP protocol not supported, test skipped"); + return; + } MBeanServer mbs = MBeanServerFactory.createMBeanServer(); mbs.registerMBean(s, new ObjectName("a:b=c")); s.start(); JMXServiceURL outputAddr = s.getAddress(); if (!outputAddr.getURLPath().startsWith("/ior/IOR:")) { - System.out.println("URL path should start with \"/ior/IOR:\": " + - outputAddr); - System.exit(1); + throw new RuntimeException("URL path should start with \"/ior/IOR:\": " + + outputAddr); } System.out.println("IIOP URL path looks OK: " + outputAddr); JMXConnector c = JMXConnectorFactory.connect(outputAddr); diff --git a/jdk/test/javax/management/remote/mandatory/connection/IdleTimeoutTest.java b/jdk/test/javax/management/remote/mandatory/connection/IdleTimeoutTest.java index b6599f5f7ac..854a211a7b0 100644 --- a/jdk/test/javax/management/remote/mandatory/connection/IdleTimeoutTest.java +++ b/jdk/test/javax/management/remote/mandatory/connection/IdleTimeoutTest.java @@ -52,21 +52,27 @@ import javax.management.remote.JMXServiceURL; import com.sun.jmx.remote.util.EnvHelp; public class IdleTimeoutTest { + + static boolean isPresent(String cn) { + try { + Class.forName(cn); + return true; + } catch (ClassNotFoundException x) { + return false; + } + } + public static void main(String[] args) throws Exception { boolean ok = true; List protos; if (args.length > 0) protos = Arrays.asList(args); else { - protos = - new ArrayList(Arrays.asList(new String[] {"rmi", "iiop"})); - try { - Class.forName("javax.management.remote.jmxmp." + - "JMXMPConnectorServer"); + protos = new ArrayList(Arrays.asList(new String[] {"rmi"})); + if (isPresent("javax.management.remote.rmi._RMIConnectionImpl_Tie")) + protos.add("iiop"); + if (isPresent("javax.management.remote.jmxmp.JMXMPConnectorServer")) protos.add("jmxmp"); - } catch (ClassNotFoundException e) { - // OK: Optional JMXMP support is not present - } } for (Iterator it = protos.iterator(); it.hasNext(); ) { String proto = (String) it.next(); @@ -81,13 +87,13 @@ public class IdleTimeoutTest { } } if (!ok) { - System.out.println("SOME TESTS FAILED"); - System.exit(1); + throw new RuntimeException("Some tests failed - see log for details"); } } private static long getIdleTimeout(MBeanServer mbs, JMXServiceURL url) - throws Exception { + throws Exception + { JMXConnectorServer server = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs); server.start(); diff --git a/jdk/test/javax/management/remote/mandatory/connection/MultiThreadDeadLockTest.java b/jdk/test/javax/management/remote/mandatory/connection/MultiThreadDeadLockTest.java index 0204afb1665..5f1584c032d 100644 --- a/jdk/test/javax/management/remote/mandatory/connection/MultiThreadDeadLockTest.java +++ b/jdk/test/javax/management/remote/mandatory/connection/MultiThreadDeadLockTest.java @@ -253,4 +253,3 @@ public class MultiThreadDeadLockTest { System.out.println("===Leave the method: " + m); } } - diff --git a/jdk/test/javax/management/remote/mandatory/connectorServer/SetMBeanServerForwarder.java b/jdk/test/javax/management/remote/mandatory/connectorServer/SetMBeanServerForwarder.java index 9f8779f1314..5075f392f34 100644 --- a/jdk/test/javax/management/remote/mandatory/connectorServer/SetMBeanServerForwarder.java +++ b/jdk/test/javax/management/remote/mandatory/connectorServer/SetMBeanServerForwarder.java @@ -40,27 +40,16 @@ import com.sun.jmx.remote.security.MBeanServerAccessController; public class SetMBeanServerForwarder { - static final boolean optionalFlag; - static { - Class genericClass = null; + static boolean isPresent(String cn) { try { - genericClass = - Class.forName("javax.management.remote.generic.GenericConnector"); + Class.forName(cn); + return true; } catch (ClassNotFoundException x) { - // NO optional package + return false; } - optionalFlag = (genericClass != null); } - final static String[] mandatoryList = { - "service:jmx:rmi://", "service:jmx:iiop://" - }; - - final static String[] optionalList = { - "service:jmx:jmxmp://" - }; - - public static int test(String[] urls) { + public static int test(String... urls) { int errorCount = 0; for (int i=0;i 0) { - System.err.println("SetMBeanServerForwarder failed: " + - errCount + " error(s) reported."); - System.exit(1); + throw new RuntimeException("SetMBeanServerForwarder failed: " + + errCount + " error(s) reported."); } System.out.println("SetMBeanServerForwarder passed."); } diff --git a/jdk/test/javax/management/remote/mandatory/loading/MissingClassTest.java b/jdk/test/javax/management/remote/mandatory/loading/MissingClassTest.java index b120c8654f7..e70d0adfe6e 100644 --- a/jdk/test/javax/management/remote/mandatory/loading/MissingClassTest.java +++ b/jdk/test/javax/management/remote/mandatory/loading/MissingClassTest.java @@ -70,7 +70,6 @@ import javax.management.remote.JMXConnectorServer; import javax.management.remote.JMXConnectorServerFactory; import javax.management.remote.JMXServiceURL; import javax.management.remote.rmi.RMIConnectorServer; -import org.omg.CORBA.MARSHAL; public class MissingClassTest { private static final int NNOTIFS = 50; @@ -84,6 +83,15 @@ public class MissingClassTest { private static final Object unserializableObject = Thread.currentThread(); + private static boolean isInstance(Object o, String cn) { + try { + Class c = Class.forName(cn); + return c.isInstance(o); + } catch (ClassNotFoundException x) { + return false; + } + } + public static void main(String[] args) throws Exception { System.out.println("Test that the client or server end of a " + "connection does not fail if sent an object " + @@ -118,8 +126,7 @@ public class MissingClassTest { if (ok) System.out.println("Test passed"); else { - System.out.println("TEST FAILED"); - System.exit(1); + throw new RuntimeException("TEST FAILED"); } } @@ -133,7 +140,7 @@ public class MissingClassTest { JMXConnectorServer cs; JMXServiceURL url = new JMXServiceURL(proto, null, 0); - Map serverMap = new HashMap(); + Map serverMap = new HashMap<>(); serverMap.put(JMXConnectorServerFactory.DEFAULT_CLASS_LOADER, serverLoader); @@ -151,7 +158,7 @@ public class MissingClassTest { } cs.start(); JMXServiceURL addr = cs.getAddress(); - Map clientMap = new HashMap(); + Map clientMap = new HashMap<>(); clientMap.put(JMXConnectorFactory.DEFAULT_CLASS_LOADER, clientLoader); @@ -174,7 +181,7 @@ public class MissingClassTest { ok = false; } catch (IOException e) { Throwable cause = e.getCause(); - if (cause instanceof MARSHAL) // see CR 4935098 + if (isInstance(cause, "org.omg.CORBA.MARSHAL")) // see CR 4935098 cause = cause.getCause(); if (cause instanceof ClassNotFoundException) { System.out.println("Success: got an IOException wrapping " + @@ -188,7 +195,7 @@ public class MissingClassTest { } System.out.println("Doing queryNames to ensure connection alive"); - Set names = mbsc.queryNames(null, null); + Set names = mbsc.queryNames(null, null); System.out.println("queryNames returned " + names); System.out.println("Provoke exception of unknown class"); @@ -198,7 +205,7 @@ public class MissingClassTest { ok = false; } catch (IOException e) { Throwable wrapped = e.getCause(); - if (wrapped instanceof MARSHAL) // see CR 4935098 + if (isInstance(wrapped, "org.omg.CORBA.MARSHAL")) // see CR 4935098 wrapped = wrapped.getCause(); if (wrapped instanceof ClassNotFoundException) { System.out.println("Success: got an IOException wrapping " + @@ -251,7 +258,7 @@ public class MissingClassTest { ok = false; } catch (IOException e) { Throwable cause = e.getCause(); - if (cause instanceof MARSHAL) // see CR 4935098 + if (isInstance(cause, "org.omg.CORBA.MARSHAL")) // see CR 4935098 cause = cause.getCause(); if (cause instanceof ClassNotFoundException) { System.out.println("Success: got an IOException " + @@ -584,15 +591,13 @@ public class MissingClassTest { try { new ObjectOutputStream(new ByteArrayOutputStream()) .writeObject(tricky); - System.out.println("TEST INCORRECT: tricky notif is " + - "serializable"); - System.exit(1); + throw new RuntimeException("TEST INCORRECT: tricky notif is " + + "serializable"); } catch (NotSerializableException e) { // OK: tricky notif is not serializable } catch (IOException e) { - System.out.println("TEST INCORRECT: tricky notif " + - "serialization check failed"); - System.exit(1); + throw new RuntimeException("TEST INCORRECT: tricky notif " + + "serialization check failed"); } /* Now shuffle an imaginary deck of cards where K, U, T, and @@ -629,12 +634,11 @@ public class MissingClassTest { } if (knownCount != 0 || unknownCount != 0 || trickyCount != 0 || boringCount != 0) { - System.out.println("TEST INCORRECT: Shuffle failed: " + + throw new RuntimeException("TEST INCORRECT: Shuffle failed: " + "known=" + knownCount +" unknown=" + unknownCount + " tricky=" + trickyCount + " boring=" + boringCount + " deal=" + notifList); - System.exit(1); } String notifs = notifList.toString(); System.out.println("Shuffle: " + notifs); @@ -646,10 +650,8 @@ public class MissingClassTest { case 't': n = tricky; break; case 'b': n = boring; break; default: - System.out.println("TEST INCORRECT: Bad shuffle char: " + - notifs.charAt(i)); - System.exit(1); - throw new Error(); + throw new RuntimeException("TEST INCORRECT: Bad shuffle char: " + + notifs.charAt(i)); } sendNotification(n); } diff --git a/jdk/test/javax/management/remote/mandatory/notif/ConcurrentModificationTest.java b/jdk/test/javax/management/remote/mandatory/notif/ConcurrentModificationTest.java new file mode 100644 index 00000000000..53f2cc1a278 --- /dev/null +++ b/jdk/test/javax/management/remote/mandatory/notif/ConcurrentModificationTest.java @@ -0,0 +1,167 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7120365 + * @summary test on Concurrent Modification + * @author Shanliang JIANG + * @run main ConcurrentModificationTest + */ + +import java.net.MalformedURLException; +import java.util.ConcurrentModificationException; +import javax.management.MBeanServer; +import javax.management.MBeanServerConnection; +import javax.management.MBeanServerFactory; +import javax.management.Notification; +import javax.management.NotificationListener; +import javax.management.ObjectName; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXConnectorServer; +import javax.management.remote.JMXConnectorServerFactory; +import javax.management.remote.JMXServiceURL; + +/** + * + */ +public class ConcurrentModificationTest { + private static final String[] protocols = {"rmi", "iiop", "jmxmp"}; + private static int number = 100; + + private static final MBeanServer mbs = MBeanServerFactory.createMBeanServer(); + private static ObjectName delegateName; + private static ObjectName[] timerNames = new ObjectName[number]; + private static NotificationListener[] listeners = new NotificationListener[number]; + + private static Throwable uncaughtException = null; + + public static void main(String[] args) throws Exception { + System.out.println(">>> test on Concurrent Modification."); + + Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { + @Override + public void uncaughtException(Thread t, Throwable e) { + e.printStackTrace(); + if (e instanceof ConcurrentModificationException) { + uncaughtException = e; + } + } + }); + + delegateName = new ObjectName("JMImplementation:type=MBeanServerDelegate"); + for (int i=0; i>> Test for protocol " + protocols[i]); + test(protocols[i]); + if (uncaughtException != null) { + if ("".equals(errors)) { + errors = "Failed to " + protocols[i] + ": "+uncaughtException; + } else { + errors = errors+", failed to " + protocols[i] + ": "+uncaughtException; + } + System.out.println(">>> FAILED for protocol " + protocols[i]); + } else { + System.out.println(">>> PASSED for protocol " + protocols[i]); + } + } + + if ("".equals(errors)) { + System.out.println("All Passed!"); + } else { + System.out.println("!!!!!! Failed."); + + throw new RuntimeException(errors); + } + } + + private static void test(String proto) throws Exception { + JMXServiceURL u = new JMXServiceURL(proto, null, 0); + JMXConnectorServer server; + JMXConnector client; + + try { + server = + JMXConnectorServerFactory.newJMXConnectorServer(u, null, mbs); + server.start(); + JMXServiceURL addr = server.getAddress(); + client = JMXConnectorFactory.connect(addr, null); + } catch (MalformedURLException e) { + System.out.println(">>> not support: " + proto); + return; + } + + final MBeanServerConnection mserver = client.getMBeanServerConnection(); + + int count = 0; + boolean adding = true; + while (uncaughtException == null && count++ < 10) { + for (int i = 0; i < number; i++) { + listenerOp(mserver, listeners[i], adding); + mbeanOp(mserver, timerNames[i], adding); + } + adding = !adding; + } + + if (uncaughtException != null) { // clean + for (int i = 0; i < number; i++) { + try { + mbeanOp(mserver, timerNames[i], false); + } catch (Exception e) { + } + } + } + client.close(); + server.stop(); + } + + private static void mbeanOp(MBeanServerConnection mserver, ObjectName name, boolean adding) + throws Exception { + if (adding) { + mserver.createMBean("javax.management.timer.Timer", name); + } else { + mserver.unregisterMBean(name); + } + } + + private static void listenerOp(MBeanServerConnection mserver, NotificationListener listener, boolean adding) + throws Exception { + if (adding) { + mserver.addNotificationListener(delegateName, listener, null, null); + } else { + mserver.removeNotificationListener(delegateName, listener); + } + } +} \ No newline at end of file diff --git a/jdk/test/javax/management/remote/mandatory/provider/ProviderTest.java b/jdk/test/javax/management/remote/mandatory/provider/ProviderTest.java index cfb3a2988b0..9c7c9f4eea4 100644 --- a/jdk/test/javax/management/remote/mandatory/provider/ProviderTest.java +++ b/jdk/test/javax/management/remote/mandatory/provider/ProviderTest.java @@ -49,13 +49,13 @@ import javax.management.MBeanServer; import provider.JMXConnectorProviderImpl; import provider.JMXConnectorServerProviderImpl; public class ProviderTest { + public static void main(String[] args) throws Exception { System.out.println("Starting ProviderTest"); MBeanServer mbs = MBeanServerFactory.newMBeanServer(); - //First do the test with a protocol handled by Service providers - JMXServiceURL url = - new JMXServiceURL("service:jmx:rmi://"); + // First do the test with a protocol handled by Service providers + JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://"); dotest(url, mbs); boolean clientCalled = provider.JMXConnectorProviderImpl.called(); @@ -66,16 +66,22 @@ public class ProviderTest { System.out.println("Client provider not called"); if (!serverCalled) System.out.println("Server provider not called"); - System.out.println("Test Failed"); - System.exit(1); + throw new RuntimeException("Test failed - see log for details"); } - //The Service Provider doesn't handle IIOP. Default providers MUST - //be called. - url = - new JMXServiceURL("service:jmx:iiop://"); - - dotest(url, mbs); + // The Service Provider doesn't handle IIOP. Default providers MUST + // be called, which may or may not support IIOP. + url = new JMXServiceURL("service:jmx:iiop://"); + try { + dotest(url, mbs); + } catch (MalformedURLException e) { + try { + Class.forName("javax.management.remote.rmi._RMIConnectionImpl_Tie"); + e.printStackTrace(System.out); + throw new RuntimeException("MalformedURLException throw but IIOP appears to be supported"); + } catch (ClassNotFoundException expected) { } + System.out.println("MalformedURLException thrown, IIOP transport not supported"); + } // Unsupported protocol. JMXConnectorServer server = null; @@ -87,31 +93,19 @@ public class ProviderTest { JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs); - System.out.println("Exception not thrown."); - System.exit(1); - }catch(MalformedURLException e) { + throw new RuntimeException("Exception not thrown."); + } catch (MalformedURLException e) { System.out.println("Expected MalformedURLException thrown."); } - catch(Exception e) { - e.printStackTrace(); - System.out.println("Exception thrown : " + e); - System.exit(1); - } try { client = JMXConnectorFactory.newJMXConnector(url, null); - System.out.println("Exception not thrown."); - System.exit(1); - }catch(MalformedURLException e) { + throw new RuntimeException("Exception not thrown."); + } catch (MalformedURLException e) { System.out.println("Expected MalformedURLException thrown."); } - catch(Exception e) { - e.printStackTrace(); - System.out.println("Exception thrown : " + e); - System.exit(1); - } //JMXConnectorProviderException url = @@ -121,60 +115,34 @@ public class ProviderTest { JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs); - System.out.println("Exception not thrown."); - System.exit(1); - }catch(JMXProviderException e) { + throw new RuntimeException("Exception not thrown."); + } catch(JMXProviderException e) { System.out.println("Expected JMXProviderException thrown."); } - catch(Exception e) { - e.printStackTrace(); - System.out.println("Exception thrown : " + e); - System.exit(1); - } try { client = JMXConnectorFactory.newJMXConnector(url, null); - System.out.println("Exception not thrown."); - System.exit(1); + throw new RuntimeException("Exception not thrown."); }catch(JMXProviderException e) { System.out.println("Expected JMXProviderException thrown."); } - catch(Exception e) { - e.printStackTrace(); - System.out.println("Exception thrown : " + e); - System.exit(1); - } System.out.println("Test OK"); - return; } private static void dotest(JMXServiceURL url, MBeanServer mbs) throws Exception { JMXConnectorServer server = null; JMXConnector client = null; - try { - server = - JMXConnectorServerFactory.newJMXConnectorServer(url, - null, - mbs); - }catch(IllegalArgumentException e) { - e.printStackTrace(); - System.exit(1); - } + + server = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs); server.start(); JMXServiceURL outputAddr = server.getAddress(); System.out.println("Server started ["+ outputAddr+ "]"); - try { - client = - JMXConnectorFactory.newJMXConnector(outputAddr, null); - }catch(IllegalArgumentException e) { - e.printStackTrace(); - System.exit(1); - } + client = JMXConnectorFactory.newJMXConnector(outputAddr, null); client.connect(); System.out.println("Client connected"); diff --git a/jdk/test/javax/management/remote/mandatory/serverError/JMXServerErrorTest.java b/jdk/test/javax/management/remote/mandatory/serverError/JMXServerErrorTest.java index 821f27f2537..c99361269b0 100644 --- a/jdk/test/javax/management/remote/mandatory/serverError/JMXServerErrorTest.java +++ b/jdk/test/javax/management/remote/mandatory/serverError/JMXServerErrorTest.java @@ -120,7 +120,7 @@ public class JMXServerErrorTest { try { cs=JMXConnectorServerFactory.newJMXConnectorServer(jurl,null,kbs); } catch (MalformedURLException m) { - if ("jmxmp".equals(jurl.getProtocol())) { + if ("jmxmp".equals(jurl.getProtocol()) || "iiop".equals(jurl.getProtocol())) { // OK, we may not have this in the classpath... System.out.println("WARNING: Skipping protocol: " + jurl); return; diff --git a/jdk/test/javax/print/applet/AppletPrintLookup.sh b/jdk/test/javax/print/applet/AppletPrintLookup.sh index c49b9f09c1f..06afe6ffd54 100644 --- a/jdk/test/javax/print/applet/AppletPrintLookup.sh +++ b/jdk/test/javax/print/applet/AppletPrintLookup.sh @@ -82,7 +82,7 @@ cp ${TESTSRC}${SEP}AppletPrintLookup.html ${TESTCLASSES} ${TESTJAVA}${SEP}bin${SEP}appletviewer ${TESTCLASSES}${SEP}AppletPrintLookup.html & cd ${TESTCLASSES} -${TESTJAVA}${SEP}bin${SEP}java YesNo +${TESTJAVA}${SEP}bin${SEP}java ${TESTVMOPTS} YesNo if [ $? -ne 0 ] then echo "Test fails!" diff --git a/jdk/test/javax/rmi/ssl/SocketFactoryTest.java b/jdk/test/javax/rmi/ssl/SocketFactoryTest.java index cf88fd746a0..76bf51a1c77 100644 --- a/jdk/test/javax/rmi/ssl/SocketFactoryTest.java +++ b/jdk/test/javax/rmi/ssl/SocketFactoryTest.java @@ -26,8 +26,7 @@ * @bug 4932837 6582235 * @summary Test SslRMI[Client|Server]SocketFactory equals() and hashCode(). * @author Daniel Fuchs - * @run clean SocketFactoryTest - * @run build SocketFactoryTest + * * @run main SocketFactoryTest */ diff --git a/jdk/test/javax/script/ProviderTest.sh b/jdk/test/javax/script/ProviderTest.sh index 5221d00d5fd..c39a9333914 100644 --- a/jdk/test/javax/script/ProviderTest.sh +++ b/jdk/test/javax/script/ProviderTest.sh @@ -45,6 +45,6 @@ $JAR -cf ${TESTCLASSES}/dummy.jar \ echo "Running test ..." -$JAVA -classpath \ +$JAVA ${TESTVMOPTS} -classpath \ "${TESTCLASSES}${PS}${TESTCLASSES}/dummy.jar" \ ProviderTest diff --git a/jdk/test/javax/security/auth/Subject/doAs/Test.sh b/jdk/test/javax/security/auth/Subject/doAs/Test.sh index cbf94e031f0..65ef4531e26 100644 --- a/jdk/test/javax/security/auth/Subject/doAs/Test.sh +++ b/jdk/test/javax/security/auth/Subject/doAs/Test.sh @@ -71,7 +71,7 @@ WD=`pwd` cd ${TESTSRC}${FS} cd $WD echo $WD -${TESTJAVA}${FS}bin${FS}java -classpath "${TESTCLASSES}${FS}" \ +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath "${TESTCLASSES}${FS}" \ -Djava.security.manager \ -Djava.security.policy=${TESTSRC}${FS}policy \ Test diff --git a/jdk/test/javax/swing/AncestorNotifier/7193219/bug7193219.java b/jdk/test/javax/swing/AncestorNotifier/7193219/bug7193219.java index 0db4839dc50..9fc6a7df619 100644 --- a/jdk/test/javax/swing/AncestorNotifier/7193219/bug7193219.java +++ b/jdk/test/javax/swing/AncestorNotifier/7193219/bug7193219.java @@ -30,6 +30,7 @@ import java.io.*; import javax.swing.*; +import javax.swing.plaf.metal.*; public class bug7193219 { private static byte[] serializeGUI() { @@ -73,6 +74,7 @@ public class bug7193219 { } public static void main(String[] args) throws Exception { + UIManager.setLookAndFeel(new MetalLookAndFeel()); SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { diff --git a/jdk/test/javax/swing/JComponent/7154030/bug7154030.java b/jdk/test/javax/swing/JComponent/7154030/bug7154030.java index 50007435b55..ade828061ff 100644 --- a/jdk/test/javax/swing/JComponent/7154030/bug7154030.java +++ b/jdk/test/javax/swing/JComponent/7154030/bug7154030.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/javax/swing/JFrame/4962534/bug4962534.html b/jdk/test/javax/swing/JFrame/4962534/bug4962534.html new file mode 100644 index 00000000000..b44fd7dffcf --- /dev/null +++ b/jdk/test/javax/swing/JFrame/4962534/bug4962534.html @@ -0,0 +1,43 @@ + + + + + + + + + +

      bug4962534
      Bug ID: 4962534

      + +

      This is an AUTOMATIC test, simply wait for completion

      + + + + diff --git a/jdk/test/javax/swing/JFrame/4962534/bug4962534.java b/jdk/test/javax/swing/JFrame/4962534/bug4962534.java new file mode 100644 index 00000000000..4b50a06e44d --- /dev/null +++ b/jdk/test/javax/swing/JFrame/4962534/bug4962534.java @@ -0,0 +1,235 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + test + @bug 4962534 7104594 + @summary JFrame dances very badly + @author dav@sparc.spb.su area= + @run applet bug4962534.html + */ +import java.applet.Applet; +import java.awt.*; +import java.awt.event.*; +import java.util.Random; +import javax.swing.*; +import sun.awt.SunToolkit; + +public class bug4962534 extends Applet { + + Robot robot; + volatile Point framePosition; + volatile Point newFrameLocation; + JFrame frame; + Rectangle gcBounds; + Component titleComponent; + JLayeredPane lPane; + volatile boolean titleFound = false; + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + public static Object LOCK = new Object(); + + @Override + public void init() { + try { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + createAndShowGUI(); + } + }); + } catch (Exception ex) { + throw new RuntimeException("Init failed. " + ex.getMessage()); + } + }//End init() + + @Override + public void start() { + validate(); + + try { + setJLayeredPaneEDT(); + setTitleComponentEDT(); + } catch (Exception ex) { + ex.printStackTrace(); + throw new RuntimeException("Test failed. " + ex.getMessage()); + } + + if (!titleFound) { + throw new RuntimeException("Test Failed. Unable to determine title's size."); + } + + Random r = new Random(); + + for (int iteration = 0; iteration < 10; iteration++) { + try { + setFramePosEDT(); + } catch (Exception ex) { + ex.printStackTrace(); + throw new RuntimeException("Test failed."); + } + try { + robot = new Robot(); + robot.setAutoDelay(70); + + toolkit.realSync(); + + robot.mouseMove(framePosition.x + getJFrameWidthEDT() / 2, + framePosition.y + titleComponent.getHeight() / 2); + robot.mousePress(InputEvent.BUTTON1_MASK); + + toolkit.realSync(); + + gcBounds = + GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()[0].getConfigurations()[0].getBounds(); + + robot.mouseMove(framePosition.x + getJFrameWidthEDT() / 2, + framePosition.y + titleComponent.getHeight() / 2); + + toolkit.realSync(); + + int multier = gcBounds.height / 2 - 10; //we will not go out the borders + for (int i = 0; i < 10; i++) { + robot.mouseMove(gcBounds.width / 2 - (int) (r.nextDouble() * multier), gcBounds.height / 2 - (int) (r.nextDouble() * multier)); + } + robot.mouseRelease(InputEvent.BUTTON1_MASK); + + toolkit.realSync(); + + } catch (AWTException e) { + throw new RuntimeException("Test Failed. AWTException thrown." + e.getMessage()); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("Test Failed."); + } + System.out.println("Mouse lies in " + MouseInfo.getPointerInfo().getLocation()); + boolean frameIsOutOfScreen = false; + try { + setNewFrameLocationEDT(); + System.out.println("Now Frame lies in " + newFrameLocation); + frameIsOutOfScreen = checkFrameIsOutOfScreenEDT(); + } catch (Exception ex) { + ex.printStackTrace(); + throw new RuntimeException("Test Failed."); + } + + if (frameIsOutOfScreen) { + throw new RuntimeException("Test failed. JFrame is out of screen."); + } + + } //for iteration + System.out.println("Test passed."); + }// start() + + private void createAndShowGUI() { + try { + UIManager.setLookAndFeel( + "javax.swing.plaf.metal.MetalLookAndFeel"); + } catch (Exception ex) { + throw new RuntimeException(ex.getMessage()); + } + JFrame.setDefaultLookAndFeelDecorated(true); + frame = new JFrame("JFrame Dance Test"); + frame.pack(); + frame.setSize(450, 260); + frame.setVisible(true); + } + + private void setJLayeredPaneEDT() throws Exception { + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + lPane = frame.getLayeredPane(); + System.out.println("JFrame's LayeredPane " + lPane); + } + }); + } + + private void setTitleComponentEDT() throws Exception { + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + for (int j = 0; j < lPane.getComponentsInLayer(JLayeredPane.FRAME_CONTENT_LAYER.intValue()).length; j++) { + titleComponent = lPane.getComponentsInLayer(JLayeredPane.FRAME_CONTENT_LAYER.intValue())[j]; + if (titleComponent.getClass().getName().equals("javax.swing.plaf.metal.MetalTitlePane")) { + titleFound = true; + break; + } + } + } + }); + } + + private void setFramePosEDT() throws Exception { + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + framePosition = frame.getLocationOnScreen(); + } + }); + } + + private boolean checkFrameIsOutOfScreenEDT() throws Exception { + + final boolean[] result = new boolean[1]; + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + if (newFrameLocation.x > gcBounds.width || newFrameLocation.x < 0 + || newFrameLocation.y > gcBounds.height || newFrameLocation.y + < 0) { + result[0] = true; + } + } + }); + return result[0]; + } + + private void setNewFrameLocationEDT() throws Exception { + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + newFrameLocation = new Point(frame.getLocationOnScreen().x + + frame.getWidth() / 2, frame.getLocationOnScreen().y + titleComponent.getHeight() / 2); + } + }); + } + + private int getJFrameWidthEDT() throws Exception { + + final int[] result = new int[1]; + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + result[0] = frame.getWidth(); + } + }); + + return result[0]; + } +}// class diff --git a/jdk/test/javax/swing/JInternalFrame/5066752/bug5066752.java b/jdk/test/javax/swing/JInternalFrame/5066752/bug5066752.java new file mode 100644 index 00000000000..09a8a7bd28f --- /dev/null +++ b/jdk/test/javax/swing/JInternalFrame/5066752/bug5066752.java @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + @test + @bug 5066752 + @summary Transparent JDesktopPane impossible because isOpaque() returns true + @author mb50250: area=JDesktopPane + @library ../../regtesthelpers + @build Util + @run main bug5066752 +*/ + +import java.awt.*; +import javax.swing.*; +import sun.awt.*; + +public class bug5066752 +{ + private static JFrame frame; + + public static void main(String[] args) throws Exception { + SunToolkit tk = (SunToolkit)Toolkit.getDefaultToolkit(); + Robot r = new Robot(); + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + createAndShowGUI(); + } + }); + tk.realSync(); + + r.delay(600); + + Point p = Util.getCenterPoint(frame); + Color color = r.getPixelColor((int) p.getX(), (int) p.getY()); + if (!color.equals(Color.RED)) { + throw new Exception("Test failed: JDesktopPane isn't transparent. Expected color is (red color): " + Color.RED + ", actual color is: " + color); + } + } + + private static void createAndShowGUI() { + frame = new JFrame(); + + frame.setLayout(new BorderLayout()); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + JPanel panel = new JPanel(); + panel.setLayout(new BorderLayout()); + panel.setBackground(Color.RED); + frame.add(panel, BorderLayout.CENTER); + + JDesktopPane dp = new JDesktopPane(); + dp.setOpaque(false); + panel.add(dp, BorderLayout.CENTER); + + frame.setBounds(200, 200, 300, 200); + frame.setVisible(true); + } +} diff --git a/jdk/test/javax/swing/JTabbedPane/4310381/bug4310381.java b/jdk/test/javax/swing/JTabbedPane/4310381/bug4310381.java index aa570200170..ccc3bc094c2 100644 --- a/jdk/test/javax/swing/JTabbedPane/4310381/bug4310381.java +++ b/jdk/test/javax/swing/JTabbedPane/4310381/bug4310381.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/javax/swing/JTable/4235420/bug4235420.java b/jdk/test/javax/swing/JTable/4235420/bug4235420.java index 388bb076060..dafd5ca58d2 100644 --- a/jdk/test/javax/swing/JTable/4235420/bug4235420.java +++ b/jdk/test/javax/swing/JTable/4235420/bug4235420.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/javax/swing/JTable/6788484/bug6788484.java b/jdk/test/javax/swing/JTable/6788484/bug6788484.java index 392bc945042..cf7c65b6b17 100644 --- a/jdk/test/javax/swing/JTable/6788484/bug6788484.java +++ b/jdk/test/javax/swing/JTable/6788484/bug6788484.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2011 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/javax/swing/JTable/7055065/bug7055065.java b/jdk/test/javax/swing/JTable/7055065/bug7055065.java index 119d9a57654..0e611e42a56 100644 --- a/jdk/test/javax/swing/JTable/7055065/bug7055065.java +++ b/jdk/test/javax/swing/JTable/7055065/bug7055065.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/javax/swing/JTable/7188612/JTableAccessibleGetLocationOnScreen.java b/jdk/test/javax/swing/JTable/7188612/JTableAccessibleGetLocationOnScreen.java index 51ea97726e9..da9262f9582 100644 --- a/jdk/test/javax/swing/JTable/7188612/JTableAccessibleGetLocationOnScreen.java +++ b/jdk/test/javax/swing/JTable/7188612/JTableAccessibleGetLocationOnScreen.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/javax/swing/JTextArea/7049024/bug7049024.java b/jdk/test/javax/swing/JTextArea/7049024/bug7049024.java index e6398b2f07c..ce9797a42d2 100644 --- a/jdk/test/javax/swing/JTextArea/7049024/bug7049024.java +++ b/jdk/test/javax/swing/JTextArea/7049024/bug7049024.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/javax/swing/RepaintManager/IconifyTest/IconifyTest.java b/jdk/test/javax/swing/RepaintManager/IconifyTest/IconifyTest.java new file mode 100644 index 00000000000..cbe6d2230de --- /dev/null +++ b/jdk/test/javax/swing/RepaintManager/IconifyTest/IconifyTest.java @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * @test + * @bug 4665214 + * @summary Makes sure that RepaintManager doesn't attempt to repaint + * a frame when it is iconified. + * @author Scott Violet + * @run main IconifyTest + */ +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import sun.awt.*; + +public class IconifyTest { + private static volatile boolean windowIconifiedIsCalled = false; + private static volatile boolean frameIsRepainted = false; + static JFrame frame; + static JButton button; + + public static void main(String[] args) throws Throwable { + SunToolkit toolkit = (SunToolkit) SunToolkit.getDefaultToolkit(); + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame = new JFrame(); + button = new JButton("HI"); + frame.getContentPane().add(button); + frame.addWindowListener(new WindowAdapter() { + public void windowIconified(WindowEvent e) { + windowIconifiedIsCalled = true; + RepaintManager rm = RepaintManager.currentManager(null); + rm.paintDirtyRegions(); + button.repaint(); + if (!rm.getDirtyRegion(button).isEmpty()) { + frameIsRepainted = true; + } + } + }); + frame.pack(); + frame.setVisible(true); + } + }); + toolkit.realSync(); + + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame.setExtendedState(Frame.ICONIFIED); + } + }); + toolkit.realSync(); + + if (!windowIconifiedIsCalled) { + throw new Exception("Test failed: window was not iconified."); + } + if (frameIsRepainted) { + throw new Exception("Test failed: frame was repainted when window was iconified."); + } + } +} diff --git a/jdk/test/javax/swing/border/Test7022041.java b/jdk/test/javax/swing/border/Test7022041.java index cccd90ed1ec..1a8b12c7c7a 100644 --- a/jdk/test/javax/swing/border/Test7022041.java +++ b/jdk/test/javax/swing/border/Test7022041.java @@ -1,11 +1,12 @@ /* - * Copyright 2012 Red Hat, Inc. All Rights Reserved. * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. + * 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 @@ -16,6 +17,10 @@ * 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.awt.Color; diff --git a/jdk/test/javax/swing/text/DefaultCaret/6938583/bug6938583.java b/jdk/test/javax/swing/text/DefaultCaret/6938583/bug6938583.java index c5c48713946..d7dc176eab5 100644 --- a/jdk/test/javax/swing/text/DefaultCaret/6938583/bug6938583.java +++ b/jdk/test/javax/swing/text/DefaultCaret/6938583/bug6938583.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/lib/security/java.policy/Ext_AllPolicy.sh b/jdk/test/lib/security/java.policy/Ext_AllPolicy.sh index e4184062a5f..3efcce9b4e0 100644 --- a/jdk/test/lib/security/java.policy/Ext_AllPolicy.sh +++ b/jdk/test/lib/security/java.policy/Ext_AllPolicy.sh @@ -77,7 +77,7 @@ cd ${TESTCLASSES} ${TESTJAVA}${FS}bin${FS}jar -cvf Ext_AllPolicy.jar Ext_AllPolicy.class rm Ext_AllPolicy.class -${TESTJAVA}${FS}bin${FS}java \ +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \ -Djava.security.manager -Djava.ext.dirs="${TESTCLASSES}" Ext_AllPolicy exit $? diff --git a/jdk/test/sun/java2d/cmm/ColorConvertOp/GrayTest.java b/jdk/test/sun/java2d/cmm/ColorConvertOp/GrayTest.java new file mode 100644 index 00000000000..06d829e6081 --- /dev/null +++ b/jdk/test/sun/java2d/cmm/ColorConvertOp/GrayTest.java @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 7124245 + * @summary Test verifies that color conversion does not distort + * colors in destination image of standard type. + * + * @run main GrayTest + */ + +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.color.ColorSpace; +import java.awt.image.BufferedImage; +import java.awt.image.ColorConvertOp; + +public class GrayTest { + public static void main(String[] args) { + GrayTest t = new GrayTest(); + + t.doTest(BufferedImage.TYPE_INT_RGB); + t.doTest(BufferedImage.TYPE_INT_BGR); + t.doTest(BufferedImage.TYPE_INT_ARGB); + t.doTest(BufferedImage.TYPE_3BYTE_BGR); + t.doTest(BufferedImage.TYPE_4BYTE_ABGR); + System.out.println("Test passed."); + } + + private static final int w = 3; + private static final int h = 3; + + private BufferedImage src; + private BufferedImage dst; + + private ColorConvertOp op; + + public GrayTest() { + ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY); + op = new ColorConvertOp(cs, null); + } + + private void render(Graphics2D g) { + g.setColor(Color.red); + g.fillRect(0, 0, w, h); + } + + private BufferedImage initImage(int type) { + BufferedImage img = new BufferedImage(w, h, type); + Graphics2D g = img.createGraphics(); + + render(g); + + g.dispose(); + + return img; + } + + public void doTest(int type) { + System.out.println("Test for type: " + type); + src = initImage(type); + + dst = initImage(type); + + dst = op.filter(src, dst); + + int pixel = dst.getRGB(1, 1); + int r = 0xff & (pixel >> 16); + int g = 0xff & (pixel >> 8); + int b = 0xff & (pixel ); + + System.out.printf("dst: r:%02x, g: %02x, %02x\n", + r, g, b); + + if (r != g || r != b) { + String msg = String.format("Invalid pixel: %08x", pixel); + throw new RuntimeException(msg); + } + System.out.println("Done."); + } +} diff --git a/jdk/test/sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.sh b/jdk/test/sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.sh index c4b4756e4b3..558ac9cf109 100644 --- a/jdk/test/sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.sh +++ b/jdk/test/sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.sh @@ -41,4 +41,4 @@ verify_os JAVA="${TESTJAVA}/bin/java" CP=${TESTJAVA}${FS}lib${FS}tools.jar${PS}${TESTCLASSES} -${JAVA} -classpath ${CP} MonitorVmStartTerminate +${JAVA} ${TESTVMOPTS} -classpath ${CP} MonitorVmStartTerminate diff --git a/jdk/test/sun/management/AgentCMETest.java b/jdk/test/sun/management/AgentCMETest.java index f8bfd5355c2..fa47696305d 100644 --- a/jdk/test/sun/management/AgentCMETest.java +++ b/jdk/test/sun/management/AgentCMETest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.sh b/jdk/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.sh index 0cc4afade61..8622fba94a0 100644 --- a/jdk/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.sh +++ b/jdk/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.sh @@ -150,7 +150,7 @@ while true; do done # Start the manager - this should connect to VM -${TESTJAVA}/bin/java -classpath ${TESTCLASSES}:${TESTJAVA}/lib/tools.jar \ +${TESTJAVA}/bin/java ${TESTVMOPTS} -classpath ${TESTCLASSES}:${TESTJAVA}/lib/tools.jar \ TestManager $pid $port true if [ $? != 0 ]; then echo "Test failed" diff --git a/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.sh b/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.sh index 426e5d4ba76..7338cbe8600 100644 --- a/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.sh +++ b/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.sh @@ -43,8 +43,8 @@ doTest() rm -f ${outputfile} # Start VM with given options - echo "+ $JAVA $1 Test" - $JAVA $1 TestApplication > ${outputfile}& + echo "+ $JAVA ${TESTVMOPTS} $1 Test" + $JAVA ${TESTVMOPTS} $1 TestApplication > ${outputfile}& pid=$! # Wait for managed VM to startup @@ -64,7 +64,7 @@ doTest() done # Start the manager - this should connect to VM - sh -xc "$JAVA -classpath ${TESTCLASSES}:${TESTJAVA}/lib/tools.jar \ + sh -xc "$JAVA ${TESTVMOPTS} -classpath ${TESTCLASSES}:${TESTJAVA}/lib/tools.jar \ TestManager $pid $port" 2>&1 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi } @@ -112,7 +112,7 @@ doTest " " # Test 4 - sanity check arguments to management-agent.jar echo ' ' -sh -xc "${JAVA} -javaagent:${AGENT}=com.sun.management.jmxremote.port=7775,\ +sh -xc "${JAVA} ${TESTVMOPTS} -javaagent:${AGENT}=com.sun.management.jmxremote.port=7775,\ com.sun.management.jmxremote.authenticate=false,com.sun.management.jmxremote.ssl=false \ TestApplication -exit" 2>&1 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi diff --git a/jdk/test/sun/management/jmxremote/bootstrap/PasswordFilePermissionTest.sh b/jdk/test/sun/management/jmxremote/bootstrap/PasswordFilePermissionTest.sh index 700a2b188ed..dfc4a85ad5c 100644 --- a/jdk/test/sun/management/jmxremote/bootstrap/PasswordFilePermissionTest.sh +++ b/jdk/test/sun/management/jmxremote/bootstrap/PasswordFilePermissionTest.sh @@ -104,18 +104,18 @@ pp=-Dcom.sun.management.jmxremote.port=4888 go() { echo '' - sh -xc "$JAVA $1 $2 $3 $4 $5 $6 $7 $8" 2>&1 + sh -xc "$JAVA ${TESTVMOPTS} $1 $2 $3 $4 $5 $6 $7 $8" 2>&1 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi } # Test 1 - password file is secure - VM should start chmod 700 ${PASSWD} -sh -xc "$JAVA $mp $pp Null" 2>&1 +sh -xc "$JAVA ${TESTVMOPTS} $mp $pp Null" 2>&1 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi # Test 2 - password file is not secure - VM should fail to start chmod o+rx ${PASSWD} -sh -xc "$JAVA $mp $pp Null" 2>&1 +sh -xc "$JAVA ${TESTVMOPTS} $mp $pp Null" 2>&1 if [ $? = 0 ]; then failures=`expr $failures + 1`; fi # Reset the file permissions on the generated password file diff --git a/jdk/test/sun/management/jmxremote/bootstrap/SSLConfigFilePermissionTest.sh b/jdk/test/sun/management/jmxremote/bootstrap/SSLConfigFilePermissionTest.sh index 46927ec8335..0fa765409b6 100644 --- a/jdk/test/sun/management/jmxremote/bootstrap/SSLConfigFilePermissionTest.sh +++ b/jdk/test/sun/management/jmxremote/bootstrap/SSLConfigFilePermissionTest.sh @@ -101,18 +101,18 @@ pp=-Dcom.sun.management.jmxremote.port=4999 go() { echo '' - sh -xc "$JAVA $1 $2 $3 $4 $5 $6 $7 $8" 2>&1 + sh -xc "$JAVA ${TESTVMOPTS} $1 $2 $3 $4 $5 $6 $7 $8" 2>&1 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi } # Test 1 - SSL config file is secure - VM should start chmod 700 ${SSL} -sh -xc "$JAVA $mp $pp Dummy" 2>&1 +sh -xc "$JAVA ${TESTVMOPTS} $mp $pp Dummy" 2>&1 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi # Test 2 - SSL config file is not secure - VM should fail to start chmod o+rx ${SSL} -sh -xc "$JAVA $mp $pp Dummy" 2>&1 +sh -xc "$JAVA ${TESTVMOPTS} $mp $pp Dummy" 2>&1 if [ $? = 0 ]; then failures=`expr $failures + 1`; fi # Reset the file permissions on the generated SSL config file diff --git a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopDoSomething.java b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopDoSomething.java index a68d185b365..98b759ea79a 100644 --- a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopDoSomething.java +++ b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopDoSomething.java @@ -41,7 +41,7 @@ public class JMXStartStopDoSomething { System.err.println("Lock is too old. Aborting"); return; } - Thread.sleep(1); + Thread.sleep(500); } } catch (Throwable e) { diff --git a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.sh b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.sh index f52146b3bed..2021381c247 100644 --- a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.sh +++ b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -43,7 +43,7 @@ _lockFileName="JMXStartStop.lck" _compile(){ - if [ ! -e ${_testclasses} ] + if [ ! -d ${_testclasses} ] then mkdir -p ${_testclasses} fi @@ -53,7 +53,7 @@ _compile(){ # Compile testcase ${TESTJAVA}/bin/javac -d ${_testclasses} JMXStartStopDoSomething.java JMXStartStopTest.java - if [ ! -e ${_testclasses}/JMXStartStopTest.class ] + if [ ! -f ${_testclasses}/JMXStartStopTest.class ] then echo "ERROR: Can't compile" exit -1 @@ -61,17 +61,24 @@ _compile(){ } _app_start(){ - ${TESTJAVA}/bin/java -server $* -cp ${_testclasses} JMXStartStopDoSomething >> ${_logname} 2>&1 & + ${TESTJAVA}/bin/java ${TESTVMOPTS} $* -cp ${_testclasses} JMXStartStopDoSomething >> ${_logname} 2>&1 & - npid=`_get_pid` - if [ "${npid}" = "" ] - then - echo "ERROR: Test app not started" - if [ "${_jtreg}" = "yes" ] + x=0 + while [ ! -f ${_lockFileName} ] + do + if [ $x -gt 20 ] then - exit -1 - fi - fi + echo "ERROR: Test app not started" + if [ "${_jtreg}" = "yes" ] + then + exit -1 + fi + fi + + echo "Waiting JMXStartStopDoSomething to start: $x" + x=`expr $x + 1` + sleep 1 + done } _get_pid(){ @@ -103,7 +110,7 @@ _exit_on_jtreg(){ } _testme(){ - ${TESTJAVA}/bin/java -cp ${_testclasses} JMXStartStopTest $* + ${TESTJAVA}/bin/java ${TESTVMOPTS} -cp ${_testclasses} JMXStartStopTest $* } diff --git a/jdk/test/sun/misc/Cleaner/exitOnThrow.sh b/jdk/test/sun/misc/Cleaner/exitOnThrow.sh index f6090cd42ec..7506ce4403f 100644 --- a/jdk/test/sun/misc/Cleaner/exitOnThrow.sh +++ b/jdk/test/sun/misc/Cleaner/exitOnThrow.sh @@ -39,7 +39,7 @@ if [ -z "$TESTJAVA" ]; then TESTCLASSES=`pwd` fi -if $TESTJAVA/bin/java -cp $TESTCLASSES ExitOnThrow; then +if $TESTJAVA/bin/java ${TESTVMOPTS} -cp $TESTCLASSES ExitOnThrow; then echo Failed: VM exited normally exit 1 else diff --git a/jdk/test/sun/net/InetAddress/nameservice/dns/cname.sh b/jdk/test/sun/net/InetAddress/nameservice/dns/cname.sh index 9587d6af504..13c922aed4d 100644 --- a/jdk/test/sun/net/InetAddress/nameservice/dns/cname.sh +++ b/jdk/test/sun/net/InetAddress/nameservice/dns/cname.sh @@ -42,7 +42,7 @@ CLASSPATH=${TESTCLASSES} export CLASSPATH JAVA="${TESTJAVA}/bin/java" -sh -xc "$JAVA CanonicalName $HOST" 2>&1 +sh -xc "$JAVA ${TESTVMOPTS} CanonicalName $HOST" 2>&1 if [ $? != 0 ]; then echo "DNS not configured or host doesn't resolve to CNAME record" exit 0 @@ -52,7 +52,7 @@ failures=0 go() { echo '' - sh -xc "$JAVA $1 Lookup $2" 2>&1 + sh -xc "$JAVA ${TESTVMOPTS} $1 Lookup $2" 2>&1 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi } diff --git a/jdk/test/sun/net/sdp/sanity.sh b/jdk/test/sun/net/sdp/sanity.sh index 0de27095d1c..88d80e0163e 100644 --- a/jdk/test/sun/net/sdp/sanity.sh +++ b/jdk/test/sun/net/sdp/sanity.sh @@ -57,7 +57,7 @@ CLASSPATH=${TESTCLASSES}:${TESTSRC} export CLASSPATH # Probe for IP addresses plumbed to IB interfaces -$JAVA -Djava.net.preferIPv4Stack=true ProbeIB ${IB_LINKS} > ${IB_ADDRS} +$JAVA ${TESTVMOPTS} -Djava.net.preferIPv4Stack=true ProbeIB ${IB_LINKS} > ${IB_ADDRS} # Create sdp.conf SDPCONF=sdp.conf @@ -70,4 +70,4 @@ do done # Sanity check -$JAVA -Djava.net.preferIPv4Stack=true -Dcom.sun.sdp.conf=${SDPCONF} -Dcom.sun.sdp.debug Sanity +$JAVA ${TESTVMOPTS} -Djava.net.preferIPv4Stack=true -Dcom.sun.sdp.conf=${SDPCONF} -Dcom.sun.sdp.debug Sanity diff --git a/jdk/test/sun/net/www/MarkResetTest.sh b/jdk/test/sun/net/www/MarkResetTest.sh index c3eb53a56d5..542bfe4b179 100644 --- a/jdk/test/sun/net/www/MarkResetTest.sh +++ b/jdk/test/sun/net/www/MarkResetTest.sh @@ -52,4 +52,4 @@ ${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}MarkResetTest.java # in this directory cp ${TESTSRC}${FS}EncDec.doc . -${TESTJAVA}${FS}bin${FS}java MarkResetTest +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} MarkResetTest diff --git a/jdk/test/sun/net/www/MessageHeaderTest.java b/jdk/test/sun/net/www/MessageHeaderTest.java new file mode 100644 index 00000000000..aceb635cfae --- /dev/null +++ b/jdk/test/sun/net/www/MessageHeaderTest.java @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8003948 + * @run main MessageHeaderTest + */ +import java.io.*; +import sun.net.www.MessageHeader; + +public class MessageHeaderTest { + public static void main (String[] args) throws Exception { + for (int i=0; i<7; i++) { + ByteArrayInputStream bis = new ByteArrayInputStream(headers[i].getBytes()); + MessageHeader h = new MessageHeader(bis); + String before = h.toString(); + before = before.substring(before.indexOf('{')); + boolean result = h.filterNTLMResponses("WWW-Authenticate"); + String after = h.toString(); + after = after.substring(after.indexOf('{')); + if (!expected[i].equals(after)) { + throw new RuntimeException(Integer.toString(i) + " expected != after"); + } + if (result != expectedResult[i]) { + throw new RuntimeException(Integer.toString(i) + " result != expectedResult"); + } + } + } + + static String expected[] = { + "{null: HTTP/1.1 200 Ok}{Foo: bar}{Bar: foo}{WWW-Authenticate: NTLM sdsds}", + "{null: HTTP/1.1 200 Ok}{Foo: bar}{Bar: foo}{WWW-Authenticate: }", + "{null: HTTP/1.1 200 Ok}{Foo: bar}{Bar: foo}{WWW-Authenticate: NTLM sdsds}", + "{null: HTTP/1.1 200 Ok}{Foo: bar}{Bar: foo}{WWW-Authenticate: NTLM sdsds}", + "{null: HTTP/1.1 200 Ok}{Foo: bar}{Bar: foo}{WWW-Authenticate: NTLM sdsds}{Bar: foo}", + "{null: HTTP/1.1 200 Ok}{WWW-Authenticate: Negotiate}{Foo: bar}{Bar: foo}{WWW-Authenticate: NTLM}{Bar: foo}{WWW-Authenticate: Kerberos}", + "{null: HTTP/1.1 200 Ok}{Foo: foo}{Bar: }{WWW-Authenticate: NTLM blob}{Bar: foo blob}" + }; + + static boolean[] expectedResult = { + false, false, true, true, true, false, false + }; + + static String[] headers = { + "HTTP/1.1 200 Ok\r\nFoo: bar\r\nBar: foo\r\nWWW-Authenticate: NTLM sdsds", + "HTTP/1.1 200 Ok\r\nFoo: bar\r\nBar: foo\r\nWWW-Authenticate:", + "HTTP/1.1 200 Ok\r\nFoo: bar\r\nBar: foo\r\nWWW-Authenticate: NTLM sdsds\r\nWWW-Authenticate: Negotiate", + "HTTP/1.1 200 Ok\r\nFoo: bar\r\nBar: foo\r\nWWW-Authenticate: NTLM sdsds\r\nWWW-Authenticate: Negotiate\r\nWWW-Authenticate: Kerberos", + "HTTP/1.1 200 Ok\r\nWWW-Authenticate: Negotiate\r\nFoo: bar\r\nBar: foo\r\nWWW-Authenticate: NTLM sdsds\r\nBar: foo\r\nWWW-Authenticate: Kerberos", + "HTTP/1.1 200 Ok\r\nWWW-Authenticate: Negotiate\r\nFoo: bar\r\nBar: foo\r\nWWW-Authenticate: NTLM\r\nBar: foo\r\nWWW-Authenticate: Kerberos", + "HTTP/1.1 200 Ok\r\nFoo: foo\r\nBar:\r\nWWW-Authenticate: NTLM blob\r\nBar: foo blob" + }; +} diff --git a/jdk/test/sun/net/www/http/HttpClient/RetryPost.sh b/jdk/test/sun/net/www/http/HttpClient/RetryPost.sh index 314a007c64f..fc563c83b16 100644 --- a/jdk/test/sun/net/www/http/HttpClient/RetryPost.sh +++ b/jdk/test/sun/net/www/http/HttpClient/RetryPost.sh @@ -50,14 +50,14 @@ esac ${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}RetryPost.java # run with no option specified. Should retry POST request. -${TESTJAVA}${FS}bin${FS}java RetryPost +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} RetryPost result=$? if [ "$result" -ne "0" ]; then exit 1 fi # run with option specified. Should not retry POST request. -${TESTJAVA}${FS}bin${FS}java -Dsun.net.http.retryPost=false RetryPost noRetry +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -Dsun.net.http.retryPost=false RetryPost noRetry result=$? if [ "$result" -ne "0" ]; then exit 1 diff --git a/jdk/test/sun/net/www/http/KeepAliveStream/InfiniteLoop.java b/jdk/test/sun/net/www/http/KeepAliveStream/InfiniteLoop.java new file mode 100644 index 00000000000..c25c7fe2723 --- /dev/null +++ b/jdk/test/sun/net/www/http/KeepAliveStream/InfiniteLoop.java @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8004863 + * @summary Checks for proper close code in KeepAliveStream + */ + +import com.sun.net.httpserver.HttpExchange; +import com.sun.net.httpserver.HttpHandler; +import com.sun.net.httpserver.HttpServer; +import java.io.*; +import java.net.*; +import java.util.concurrent.Phaser; + +// Racey test, will not always fail, but if it does then we have a problem. + +public class InfiniteLoop { + + public static void main(String[] args) throws Exception { + HttpServer server = HttpServer.create(new InetSocketAddress(0), 0); + server.createContext("/test/InfiniteLoop", new RespHandler()); + server.start(); + try { + InetSocketAddress address = server.getAddress(); + URL url = new URL("http://localhost:" + address.getPort() + + "/test/InfiniteLoop"); + final Phaser phaser = new Phaser(2); + for (int i=0; i<10; i++) { + HttpURLConnection uc = (HttpURLConnection)url.openConnection(); + final InputStream is = uc.getInputStream(); + final Thread thread = new Thread() { + public void run() { + try { + phaser.arriveAndAwaitAdvance(); + while (is.read() != -1) + Thread.sleep(50); + } catch (Exception x) { x.printStackTrace(); } + }}; + thread.start(); + phaser.arriveAndAwaitAdvance(); + is.close(); + System.out.println("returned from close"); + thread.join(); + } + } finally { + server.stop(0); + } + } + + static class RespHandler implements HttpHandler { + static final int RESP_LENGTH = 32 * 1024; + @Override + public void handle(HttpExchange t) throws IOException { + InputStream is = t.getRequestBody(); + byte[] ba = new byte[8192]; + while(is.read(ba) != -1); + + t.sendResponseHeaders(200, RESP_LENGTH); + try (OutputStream os = t.getResponseBody()) { + os.write(new byte[RESP_LENGTH]); + } + t.close(); + } + } +} diff --git a/jdk/test/sun/net/www/protocol/file/DirPermissionDenied.sh b/jdk/test/sun/net/www/protocol/file/DirPermissionDenied.sh index a85f4d53a99..7606b3dd9ac 100644 --- a/jdk/test/sun/net/www/protocol/file/DirPermissionDenied.sh +++ b/jdk/test/sun/net/www/protocol/file/DirPermissionDenied.sh @@ -35,7 +35,7 @@ rm -rf ${TESTDIR} mkdir -p ${TESTDIR} chmod 333 ${TESTDIR} -$TESTJAVA/bin/java -classpath $TESTCLASSES DirPermissionDenied ${TESTDIR} +$TESTJAVA/bin/java ${TESTVMOPTS} -classpath $TESTCLASSES DirPermissionDenied ${TESTDIR} result=$? # Add back read access for user, otherwise not removable on some systems diff --git a/jdk/test/sun/net/www/protocol/jar/B5105410.sh b/jdk/test/sun/net/www/protocol/jar/B5105410.sh index 3dbce7f3f77..1fdbdd58ff8 100644 --- a/jdk/test/sun/net/www/protocol/jar/B5105410.sh +++ b/jdk/test/sun/net/www/protocol/jar/B5105410.sh @@ -51,5 +51,5 @@ esac cp ${TESTSRC}${FS}foo2.jar . ${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}B5105410.java -${TESTJAVA}${FS}bin${FS}java B5105410 +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} B5105410 diff --git a/jdk/test/sun/net/www/protocol/jar/getcontenttype.sh b/jdk/test/sun/net/www/protocol/jar/getcontenttype.sh index da3563db5c6..a3a1a2a1310 100644 --- a/jdk/test/sun/net/www/protocol/jar/getcontenttype.sh +++ b/jdk/test/sun/net/www/protocol/jar/getcontenttype.sh @@ -33,5 +33,5 @@ if [ x"$TESTCLASSES" = x ]; then TESTCLASSES=.; fi if [ x"$TESTSRC" = x ]; then TESTSRC=.; fi # now start the test -${TESTJAVA}/bin/java -Djava.ext.dirs=$TESTSRC -cp $TESTCLASSES GetContentType +${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.ext.dirs=$TESTSRC -cp $TESTCLASSES GetContentType diff --git a/jdk/test/sun/net/www/protocol/jar/jarbug/run.sh b/jdk/test/sun/net/www/protocol/jar/jarbug/run.sh index 31cfbe86158..72a11681d1c 100644 --- a/jdk/test/sun/net/www/protocol/jar/jarbug/run.sh +++ b/jdk/test/sun/net/www/protocol/jar/jarbug/run.sh @@ -71,7 +71,7 @@ mv jar1.jar .. # ${TESTJAVA}${FS}bin${FS}javac -d ${DEST} ${TESTSRC}${FS}src${FS}test${FS}*.java cd ${DEST} -${TESTJAVA}${FS}bin${FS}java RunAllTests +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} RunAllTests result=$? if [ "$result" -ne "0" ]; then exit 1 diff --git a/jdk/test/sun/nio/ch/SelProvider.java b/jdk/test/sun/nio/ch/SelProvider.java index 1674120b545..259a098cc67 100644 --- a/jdk/test/sun/nio/ch/SelProvider.java +++ b/jdk/test/sun/nio/ch/SelProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/sun/rmi/log/ReliableLog/LogAlignmentTest.java b/jdk/test/sun/rmi/log/ReliableLog/LogAlignmentTest.java index 04d2fd9fe03..012c0b8cab9 100644 --- a/jdk/test/sun/rmi/log/ReliableLog/LogAlignmentTest.java +++ b/jdk/test/sun/rmi/log/ReliableLog/LogAlignmentTest.java @@ -22,8 +22,10 @@ */ /* @test - @bug 4094889 - @summary rmid can have a corrupted log + * @bug 4094889 + * @summary rmid can have a corrupted log + * + * @run main LogAlignmentTest */ /* Fault: ReliableLog used RandomAccessFile.skipBytes() to seek past the end diff --git a/jdk/test/sun/rmi/log/ReliableLog/SnapshotSize.java b/jdk/test/sun/rmi/log/ReliableLog/SnapshotSize.java index f1febfc1fc2..592ef5eaba9 100644 --- a/jdk/test/sun/rmi/log/ReliableLog/SnapshotSize.java +++ b/jdk/test/sun/rmi/log/ReliableLog/SnapshotSize.java @@ -25,6 +25,8 @@ * @bug 4319866 * @summary Verify that ReliableLog.snapshotSize() returns correct snapshot * file size even if LogHandler doesn't flush. + * + * @run main SnapshotSize */ import java.io.ByteArrayOutputStream; diff --git a/jdk/test/sun/rmi/rmic/RMIGenerator/RmicDefault.java b/jdk/test/sun/rmi/rmic/RMIGenerator/RmicDefault.java index ad2484168ea..5f4587ecdfb 100644 --- a/jdk/test/sun/rmi/rmic/RMIGenerator/RmicDefault.java +++ b/jdk/test/sun/rmi/rmic/RMIGenerator/RmicDefault.java @@ -28,7 +28,6 @@ * @library ../../../../java/rmi/testlibrary * * @build StreamPipe - * @build RmicDefault * @run main RmicDefault */ diff --git a/jdk/test/sun/rmi/rmic/classpath/RMICClassPathTest.java b/jdk/test/sun/rmi/rmic/classpath/RMICClassPathTest.java index a79d21b8339..f4c64b75d33 100644 --- a/jdk/test/sun/rmi/rmic/classpath/RMICClassPathTest.java +++ b/jdk/test/sun/rmi/rmic/classpath/RMICClassPathTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/sun/rmi/rmic/manifestClassPath/run.sh b/jdk/test/sun/rmi/rmic/manifestClassPath/run.sh index 4faf141ff91..f20ab75527e 100644 --- a/jdk/test/sun/rmi/rmic/manifestClassPath/run.sh +++ b/jdk/test/sun/rmi/rmic/manifestClassPath/run.sh @@ -114,26 +114,26 @@ EOF Success "$javac" -classpath "jars/A.jar" Main.java MainI.java Success "$rmic" -classpath "jars/A.jar${PS}." Main -Success "$java" -classpath "jars/A.jar${PS}." Main +Success "$java" ${TESTVMOPTS} -classpath "jars/A.jar${PS}." Main Sys rm -f Main.class MainI.class Main_Stub.class Success "$javac" -classpath "jars/sub/B.zip" Main.java MainI.java Success "$rmic" -classpath "jars/sub/B.zip${PS}." Main -Success "$java" -classpath "jars/sub/B.zip${PS}." Main +Success "$java" ${TESTVMOPTS} -classpath "jars/sub/B.zip${PS}." Main #Sys rm -f Main.class MainI.class Main_Stub.class Sys rm -f Main_Stub.class # javac -extdirs workaround #Success "$javac" -extdirs "jars" -classpath None Main.java MainI.java Success "$rmic" -extdirs "jars" -classpath . Main -Success "$java" -Djava.ext.dirs="jars" -cp . Main +Success "$java" ${TESTVMOPTS} -Djava.ext.dirs="jars" -cp . Main Sys rm -f Main_Stub.class #Success "$javac" -extdirs "jars/sub" -classpath None Main.java MainI.java Success "$rmic" -extdirs "jars/sub" -classpath . Main -Success "$java" -Djava.ext.dirs="jars/sub" -cp . Main +Success "$java" ${TESTVMOPTS} -Djava.ext.dirs="jars/sub" -cp . Main Cleanup diff --git a/jdk/test/sun/rmi/rmic/minimizeWrapperInstances/run.sh b/jdk/test/sun/rmi/rmic/minimizeWrapperInstances/run.sh index 204947dcea6..3c8e831e311 100644 --- a/jdk/test/sun/rmi/rmic/minimizeWrapperInstances/run.sh +++ b/jdk/test/sun/rmi/rmic/minimizeWrapperInstances/run.sh @@ -41,13 +41,13 @@ fi set -ex ${TESTJAVA}/bin/rmic -classpath ${TESTCLASSES:-.} -d ${TESTCLASSES:-.} PImpl -${TESTJAVA}/bin/java -classpath ${TESTCLASSES:-.} Test +${TESTJAVA}/bin/java ${TESTVMOPTS} -classpath ${TESTCLASSES:-.} Test ${TESTJAVA}/bin/rmic -classpath ${TESTCLASSES:-.} -d ${TESTCLASSES:-.} -vcompat PImpl -${TESTJAVA}/bin/java -classpath ${TESTCLASSES:-.} Test +${TESTJAVA}/bin/java ${TESTVMOPTS} -classpath ${TESTCLASSES:-.} Test ${TESTJAVA}/bin/rmic -Xnew -classpath ${TESTCLASSES:-.} -d ${TESTCLASSES:-.} PImpl -${TESTJAVA}/bin/java -classpath ${TESTCLASSES:-.} Test +${TESTJAVA}/bin/java ${TESTVMOPTS} -classpath ${TESTCLASSES:-.} Test ${TESTJAVA}/bin/rmic -Xnew -classpath ${TESTCLASSES:-.} -d ${TESTCLASSES:-.} -vcompat PImpl -${TESTJAVA}/bin/java -classpath ${TESTCLASSES:-.} Test +${TESTJAVA}/bin/java ${TESTVMOPTS} -classpath ${TESTCLASSES:-.} Test diff --git a/jdk/test/sun/rmi/rmic/newrmic/equivalence/run.sh b/jdk/test/sun/rmi/rmic/newrmic/equivalence/run.sh index 8d4f419d346..27c86041414 100644 --- a/jdk/test/sun/rmi/rmic/newrmic/equivalence/run.sh +++ b/jdk/test/sun/rmi/rmic/newrmic/equivalence/run.sh @@ -26,22 +26,24 @@ # @summary This test verifies that the new implementation of rmic # generates equivalent classes as the old implementation, for a set # of sample input classes. -# @library ../../../../../java/rmi/testlibrary -# @build TestLibrary # @author Peter Jones # -# @build AgentServerImpl -# @build AppleImpl -# @build AppleUserImpl -# @build ComputeServerImpl -# @build CountServerImpl -# @build DayTimeServerImpl -# @build G1Impl -# @build MyObjectImpl -# @build NotActivatableServerImpl -# @build OrangeEchoImpl -# @build OrangeImpl -# @build ServerImpl +# @library ../../../../../java/rmi/testlibrary +# +# @build TestLibrary +# AgentServerImpl +# AppleImpl +# AppleUserImpl +# ComputeServerImpl +# CountServerImpl +# DayTimeServerImpl +# G1Impl +# MyObjectImpl +# NotActivatableServerImpl +# OrangeEchoImpl +# OrangeImpl +# ServerImpl +# # @run shell run.sh if [ "${TESTJAVA}" = "" ] diff --git a/jdk/test/sun/rmi/rmic/oldjavacRemoved/sunToolsJavacMain.sh b/jdk/test/sun/rmi/rmic/oldjavacRemoved/sunToolsJavacMain.sh index fbb55817582..11840fa5037 100644 --- a/jdk/test/sun/rmi/rmic/oldjavacRemoved/sunToolsJavacMain.sh +++ b/jdk/test/sun/rmi/rmic/oldjavacRemoved/sunToolsJavacMain.sh @@ -37,7 +37,7 @@ fi set -x -${TESTJAVA}/bin/java -classpath ${TESTJAVA}/lib/tools.jar sun.tools.javac.Main -d ${TESTCLASSES:-.} ${TESTSRC:-.}/Foo.java +${TESTJAVA}/bin/java ${TESTVMOPTS} -classpath ${TESTJAVA}/lib/tools.jar sun.tools.javac.Main -d ${TESTCLASSES:-.} ${TESTSRC:-.}/Foo.java result=$? if [ $result -eq 0 ] diff --git a/jdk/test/sun/rmi/runtime/Log/6409194/NoConsoleOutput.java b/jdk/test/sun/rmi/runtime/Log/6409194/NoConsoleOutput.java index e5e19fe12dd..a4104f2d268 100644 --- a/jdk/test/sun/rmi/runtime/Log/6409194/NoConsoleOutput.java +++ b/jdk/test/sun/rmi/runtime/Log/6409194/NoConsoleOutput.java @@ -31,8 +31,7 @@ * @author Peter Jones * * @library ../../../../../java/rmi/testlibrary - * @build JavaVM - * @build NoConsoleOutput + * @build TestLibrary JavaVM * @run main/othervm NoConsoleOutput */ @@ -65,7 +64,7 @@ public class NoConsoleOutput { // (neither on standard output, nor on standard err streams). JavaVM vm = new JavaVM(DoRMIStuff.class.getName(), "-Djava.util.logging.config.file=" + loggingPropertiesFile, - "", out, err, false); + "", out, err); vm.start(); vm.getVM().waitFor(); diff --git a/jdk/test/sun/rmi/runtime/Log/checkLogging/CheckLogStreams.java b/jdk/test/sun/rmi/runtime/Log/checkLogging/CheckLogStreams.java index 34cfc485d1e..1e959536c22 100644 --- a/jdk/test/sun/rmi/runtime/Log/checkLogging/CheckLogStreams.java +++ b/jdk/test/sun/rmi/runtime/Log/checkLogging/CheckLogStreams.java @@ -28,11 +28,7 @@ * @author Laird Dornin * * @library ../../../../../java/rmi/testlibrary - * @build TestLibrary - * @build TestParams - * @build TestFailedException - * @build CheckLogging - * @build CheckLogStreams + * @build TestLibrary CheckLogging * @run main/othervm -Dsun.rmi.log.useOld=true CheckLogStreams */ diff --git a/jdk/test/sun/rmi/runtime/Log/checkLogging/CheckLogging.java b/jdk/test/sun/rmi/runtime/Log/checkLogging/CheckLogging.java index 77c236d4371..347725a3d6d 100644 --- a/jdk/test/sun/rmi/runtime/Log/checkLogging/CheckLogging.java +++ b/jdk/test/sun/rmi/runtime/Log/checkLogging/CheckLogging.java @@ -29,9 +29,6 @@ * * @library ../../../../../java/rmi/testlibrary * @build TestLibrary - * @build TestParams - * @build TestFailedException - * @build CheckLogging * @run main/othervm CheckLogging */ diff --git a/jdk/test/sun/rmi/server/MarshalOutputStream/marshalForeignStub/MarshalForeignStub.java b/jdk/test/sun/rmi/server/MarshalOutputStream/marshalForeignStub/MarshalForeignStub.java index 165dfbe1cf9..bf1eb11372f 100644 --- a/jdk/test/sun/rmi/server/MarshalOutputStream/marshalForeignStub/MarshalForeignStub.java +++ b/jdk/test/sun/rmi/server/MarshalOutputStream/marshalForeignStub/MarshalForeignStub.java @@ -31,11 +31,7 @@ * @author Ann Wollrath * * @library ../../../../../java/rmi/testlibrary - * @build TestLibrary - * @build TestFailedException - * @build MarshalForeignStub - * @build Receiver - * @build MarshalForeignStub_Stub + * @build TestLibrary Receiver MarshalForeignStub_Stub * @run main/othervm/policy=security.policy MarshalForeignStub */ diff --git a/jdk/test/sun/rmi/transport/proxy/EagerHttpFallback.java b/jdk/test/sun/rmi/transport/proxy/EagerHttpFallback.java index 1f54e2cb845..3879c665d14 100644 --- a/jdk/test/sun/rmi/transport/proxy/EagerHttpFallback.java +++ b/jdk/test/sun/rmi/transport/proxy/EagerHttpFallback.java @@ -25,6 +25,7 @@ * @bug 4290727 * @summary Verify that ConnectException will trigger HTTP fallback if * sun.rmi.transport.proxy.eagerHttpFallback system property is set. + * * @library ../../../../java/rmi/testlibrary * @build TestLibrary * @run main/othervm EagerHttpFallback diff --git a/jdk/test/sun/rmi/transport/tcp/DeadCachedConnection.java b/jdk/test/sun/rmi/transport/tcp/DeadCachedConnection.java index 1372b03feab..7bcd5a71024 100644 --- a/jdk/test/sun/rmi/transport/tcp/DeadCachedConnection.java +++ b/jdk/test/sun/rmi/transport/tcp/DeadCachedConnection.java @@ -25,9 +25,7 @@ * @bug 4094891 * @summary unable to retry call if cached connection to server is used * @library ../../../../java/rmi/testlibrary - * @build DeadCachedConnection - * @build JavaVM - * @build TestLibrary + * @build TestLibrary JavaVM * @run main/othervm DeadCachedConnection */ diff --git a/jdk/test/sun/rmi/transport/tcp/blockAccept/BlockAcceptTest.java b/jdk/test/sun/rmi/transport/tcp/blockAccept/BlockAcceptTest.java index af41bf0a7af..1624f68ee8c 100644 --- a/jdk/test/sun/rmi/transport/tcp/blockAccept/BlockAcceptTest.java +++ b/jdk/test/sun/rmi/transport/tcp/blockAccept/BlockAcceptTest.java @@ -27,11 +27,8 @@ * @summary RMI blocks in HttpAwareServerSocket.accept() if you telnet to it * @author Adrian Colley * - * @library ../../../../../java/rmi/testlibrary/ - * @build TestIface - * @build TestImpl - * @build TestImpl_Stub - * @build BlockAcceptTest + * @library ../../../../../java/rmi/testlibrary + * @build TestIface TestImpl TestImpl_Stub * @run main/othervm/policy=security.policy/timeout=60 BlockAcceptTest */ diff --git a/jdk/test/sun/rmi/transport/tcp/disableMultiplexing/DisableMultiplexing.java b/jdk/test/sun/rmi/transport/tcp/disableMultiplexing/DisableMultiplexing.java index 51dbeec1060..805c798ae45 100644 --- a/jdk/test/sun/rmi/transport/tcp/disableMultiplexing/DisableMultiplexing.java +++ b/jdk/test/sun/rmi/transport/tcp/disableMultiplexing/DisableMultiplexing.java @@ -28,7 +28,6 @@ * on that port, rather than engage in the deprecated "multiplexing protocol". * @author Peter Jones * - * @build DisableMultiplexing * @build DisableMultiplexing_Stub * @run main/othervm DisableMultiplexing */ diff --git a/jdk/test/sun/security/krb5/auto/DynamicKeytab.java b/jdk/test/sun/security/krb5/auto/DynamicKeytab.java index 2565d61d47e..6525b8fb49f 100644 --- a/jdk/test/sun/security/krb5/auto/DynamicKeytab.java +++ b/jdk/test/sun/security/krb5/auto/DynamicKeytab.java @@ -110,11 +110,13 @@ public class DynamicKeytab { throw new Exception("Should not success"); } catch (GSSException gsse) { System.out.println(gsse); - KrbException ke = (KrbException)gsse.getCause(); - if (ke.returnCode() != Krb5.KRB_AP_ERR_BADKEYVER) { - throw new Exception("Not expected failure code: " + - ke.returnCode()); - } + // Since 7197159, different kvno is accepted, this return code + // will never be thrown out again. + //KrbException ke = (KrbException)gsse.getCause(); + //if (ke.returnCode() != Krb5.KRB_AP_ERR_BADKEYVER) { + // throw new Exception("Not expected failure code: " + + // ke.returnCode()); + //} } // Test 8: an empty KDC means revoke all diff --git a/jdk/test/sun/security/krb5/auto/KeyPermissions.java b/jdk/test/sun/security/krb5/auto/KeyPermissions.java new file mode 100644 index 00000000000..78f0eafc6c5 --- /dev/null +++ b/jdk/test/sun/security/krb5/auto/KeyPermissions.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8004488 + * @summary wrong permissions checked in krb5 + * @compile -XDignore.symbol.file KeyPermissions.java + * @run main/othervm KeyPermissions + */ + +import java.security.AccessControlException; +import java.security.Permission; +import javax.security.auth.PrivateCredentialPermission; +import sun.security.jgss.GSSUtil; + +public class KeyPermissions extends SecurityManager { + + @Override + public void checkPermission(Permission perm) { + if (perm instanceof PrivateCredentialPermission) { + if (!perm.getName().startsWith("javax.security.auth.kerberos.")) { + throw new AccessControlException( + "I don't like this", perm); + } + } + } + + public static void main(String[] args) throws Exception { + System.setSecurityManager(new KeyPermissions()); + new OneKDC(null).writeJAASConf(); + Context s = Context.fromJAAS("server"); + s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID); + } +} + diff --git a/jdk/test/sun/security/krb5/auto/KeyTabCompat.java b/jdk/test/sun/security/krb5/auto/KeyTabCompat.java index f6763510fd2..87a3e7e9c78 100644 --- a/jdk/test/sun/security/krb5/auto/KeyTabCompat.java +++ b/jdk/test/sun/security/krb5/auto/KeyTabCompat.java @@ -24,6 +24,7 @@ /* * @test * @bug 6894072 + * @bug 8004488 * @compile -XDignore.symbol.file KeyTabCompat.java * @run main/othervm KeyTabCompat * @summary always refresh keytab @@ -70,21 +71,8 @@ public class KeyTabCompat { s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID); s.status(); - if (s.s().getPrivateCredentials(KerberosKey.class).size() != 1) { - throw new Exception("There should be one KerberosKey"); + if (s.s().getPrivateCredentials(KerberosKey.class).size() != 0) { + throw new Exception("There should be no KerberosKey"); } - - Thread.sleep(2000); // make sure ktab timestamp is different - - kdc.addPrincipal(OneKDC.SERVER, "pass2".toCharArray()); - kdc.writeKtab(OneKDC.KTAB); - - Context.handshake(c, s); - s.status(); - - if (s.s().getPrivateCredentials(KerberosKey.class).size() != 1) { - throw new Exception("There should be only one KerberosKey"); - } - } } diff --git a/jdk/test/sun/security/krb5/auto/KvnoNA.java b/jdk/test/sun/security/krb5/auto/KvnoNA.java new file mode 100644 index 00000000000..2c645ecf357 --- /dev/null +++ b/jdk/test/sun/security/krb5/auto/KvnoNA.java @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7197159 + * @compile -XDignore.symbol.file KvnoNA.java + * @run main/othervm KvnoNA + * @summary accept different kvno if there no match + */ + +import org.ietf.jgss.GSSException; +import sun.security.jgss.GSSUtil; +import sun.security.krb5.KrbException; +import sun.security.krb5.PrincipalName; +import sun.security.krb5.internal.ktab.KeyTab; +import sun.security.krb5.internal.Krb5; + +public class KvnoNA { + + public static void main(String[] args) + throws Exception { + + OneKDC kdc = new OneKDC(null); + kdc.writeJAASConf(); + + // In KDC, it's 2 + char[] pass = "pass2".toCharArray(); + kdc.addPrincipal(OneKDC.SERVER, pass); + + // In ktab, kvno is 1 or 3, 3 has the same password + KeyTab ktab = KeyTab.create(OneKDC.KTAB); + PrincipalName p = new PrincipalName( + OneKDC.SERVER+"@"+OneKDC.REALM, PrincipalName.KRB_NT_SRV_HST); + ktab.addEntry(p, "pass1".toCharArray(), 1, true); + ktab.addEntry(p, "pass2".toCharArray(), 3, true); + ktab.save(); + + Context c, s; + + c = Context.fromUserPass("dummy", "bogus".toCharArray(), false); + s = Context.fromJAAS("server"); + + c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID); + s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID); + + Context.handshake(c, s); + + s.dispose(); + c.dispose(); + } +} diff --git a/jdk/test/sun/security/krb5/auto/MoreKvno.java b/jdk/test/sun/security/krb5/auto/MoreKvno.java index 20cac93d0a0..55389f0f185 100644 --- a/jdk/test/sun/security/krb5/auto/MoreKvno.java +++ b/jdk/test/sun/security/krb5/auto/MoreKvno.java @@ -23,8 +23,7 @@ /* * @test - * @bug 6893158 - * @bug 6907425 + * @bug 6893158 6907425 7197159 * @run main/othervm MoreKvno * @summary AP_REQ check should use key version number */ @@ -69,11 +68,13 @@ public class MoreKvno { go(OneKDC.SERVER, "com.sun.security.jgss.krb5.accept", pass); throw new Exception("This test should fail"); } catch (GSSException gsse) { - KrbException ke = (KrbException)gsse.getCause(); - if (ke.returnCode() != Krb5.KRB_AP_ERR_BADKEYVER) { - throw new Exception("Not expected failure code: " + - ke.returnCode()); - } + // Since 7197159, different kvno is accepted, this return code + // will never be thrown out again. + //KrbException ke = (KrbException)gsse.getCause(); + //if (ke.returnCode() != Krb5.KRB_AP_ERR_BADKEYVER) { + // throw new Exception("Not expected failure code: " + + // ke.returnCode()); + //} } } diff --git a/jdk/test/sun/security/krb5/auto/ReplayCache.java b/jdk/test/sun/security/krb5/auto/ReplayCache.java index 1f6411cfdad..c29219ad261 100644 --- a/jdk/test/sun/security/krb5/auto/ReplayCache.java +++ b/jdk/test/sun/security/krb5/auto/ReplayCache.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 Sun Microsystems, Inc. All Rights Reserved. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -16,9 +16,9 @@ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * 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. */ /* diff --git a/jdk/test/sun/security/krb5/runNameEquals.sh b/jdk/test/sun/security/krb5/runNameEquals.sh index 15096cc99de..1fea3620e19 100644 --- a/jdk/test/sun/security/krb5/runNameEquals.sh +++ b/jdk/test/sun/security/krb5/runNameEquals.sh @@ -81,7 +81,7 @@ EXIT_STATUS=0 if [ "${NATIVE}" = "true" ] ; then echo "Testing native provider" - ${TESTJAVA}${FILESEP}bin${FILESEP}java \ + ${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} \ -classpath ${TESTCLASSES} \ -Dsun.security.jgss.native=true \ ${TEST} @@ -92,7 +92,7 @@ if [ "${NATIVE}" = "true" ] ; then fi echo "Testing java provider" -${TESTJAVA}${FILESEP}bin${FILESEP}java \ +${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} \ -classpath ${TESTCLASSES} \ -Djava.security.krb5.realm=R \ -Djava.security.krb5.kdc=127.0.0.1 \ diff --git a/jdk/test/sun/security/krb5/tools/ktcheck.sh b/jdk/test/sun/security/krb5/tools/ktcheck.sh index 383de8fc4f9..b1b3743076d 100644 --- a/jdk/test/sun/security/krb5/tools/ktcheck.sh +++ b/jdk/test/sun/security/krb5/tools/ktcheck.sh @@ -58,7 +58,7 @@ ${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}KtabCheck.java EXTRA_OPTIONS="-Djava.security.krb5.conf=${TESTSRC}${FS}onlythree.conf" KTAB="${TESTJAVA}${FS}bin${FS}ktab -J${EXTRA_OPTIONS} -k $KEYTAB -f" -CHECK="${TESTJAVA}${FS}bin${FS}java ${EXTRA_OPTIONS} KtabCheck $KEYTAB" +CHECK="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} ${EXTRA_OPTIONS} KtabCheck $KEYTAB" echo ${EXTRA_OPTIONS} diff --git a/jdk/test/sun/security/mscapi/AccessKeyStore.sh b/jdk/test/sun/security/mscapi/AccessKeyStore.sh index 6706aa3ff39..0998de4821f 100644 --- a/jdk/test/sun/security/mscapi/AccessKeyStore.sh +++ b/jdk/test/sun/security/mscapi/AccessKeyStore.sh @@ -42,13 +42,13 @@ case "$OS" in ${TESTJAVA}/bin/javac -d . ${TESTSRC}\\AccessKeyStore.java echo "Using access.policy..." - ${TESTJAVA}/bin/java \ + ${TESTJAVA}/bin/java ${TESTVMOPTS} \ -Djava.security.manager \ -Djava.security.policy==${TESTSRC}\\access.policy \ AccessKeyStore echo "Using noaccess.policy..." - ${TESTJAVA}/bin/java \ + ${TESTJAVA}/bin/java ${TESTVMOPTS} \ -Djava.security.manager \ -Djava.security.policy==${TESTSRC}\\noaccess.policy \ AccessKeyStore -deny diff --git a/jdk/test/sun/security/mscapi/IsSunMSCAPIAvailable.sh b/jdk/test/sun/security/mscapi/IsSunMSCAPIAvailable.sh index 197ee37b134..77e258e4cda 100644 --- a/jdk/test/sun/security/mscapi/IsSunMSCAPIAvailable.sh +++ b/jdk/test/sun/security/mscapi/IsSunMSCAPIAvailable.sh @@ -40,7 +40,7 @@ case "$OS" in # execute test program - rely on it to exit if platform unsupported ${TESTJAVA}/bin/javac -d . ${TESTSRC}\\IsSunMSCAPIAvailable.java - ${TESTJAVA}/bin/java IsSunMSCAPIAvailable + ${TESTJAVA}/bin/java ${TESTVMOPTS} IsSunMSCAPIAvailable exit ;; diff --git a/jdk/test/sun/security/mscapi/KeyStoreCompatibilityMode.sh b/jdk/test/sun/security/mscapi/KeyStoreCompatibilityMode.sh index ee0c6c3609f..b6ca1395d76 100644 --- a/jdk/test/sun/security/mscapi/KeyStoreCompatibilityMode.sh +++ b/jdk/test/sun/security/mscapi/KeyStoreCompatibilityMode.sh @@ -43,15 +43,15 @@ case "$OS" in ${TESTJAVA}/bin/javac -d . ${TESTSRC}\\KeyStoreCompatibilityMode.java # mode implicitly enabled - ${TESTJAVA}/bin/java KeyStoreCompatibilityMode + ${TESTJAVA}/bin/java ${TESTVMOPTS} KeyStoreCompatibilityMode # mode explicitly enabled - ${TESTJAVA}/bin/java \ + ${TESTJAVA}/bin/java ${TESTVMOPTS} \ -Dsun.security.mscapi.keyStoreCompatibilityMode="true" \ KeyStoreCompatibilityMode # mode explicitly disabled - ${TESTJAVA}/bin/java \ + ${TESTJAVA}/bin/java ${TESTVMOPTS} \ -Dsun.security.mscapi.keyStoreCompatibilityMode="false" \ KeyStoreCompatibilityMode -disable diff --git a/jdk/test/sun/security/mscapi/PublicKeyInterop.sh b/jdk/test/sun/security/mscapi/PublicKeyInterop.sh index 1967e63d266..abdad4c6530 100644 --- a/jdk/test/sun/security/mscapi/PublicKeyInterop.sh +++ b/jdk/test/sun/security/mscapi/PublicKeyInterop.sh @@ -62,7 +62,7 @@ case "$OS" in echo echo "Running the test..." ${TESTJAVA}/bin/javac -d . ${TESTSRC}\\PublicKeyInterop.java - ${TESTJAVA}/bin/java PublicKeyInterop + ${TESTJAVA}/bin/java ${TESTVMOPTS} PublicKeyInterop rc=$? diff --git a/jdk/test/sun/security/mscapi/RSAEncryptDecrypt.sh b/jdk/test/sun/security/mscapi/RSAEncryptDecrypt.sh index 19add0a7356..ed17bd1159e 100644 --- a/jdk/test/sun/security/mscapi/RSAEncryptDecrypt.sh +++ b/jdk/test/sun/security/mscapi/RSAEncryptDecrypt.sh @@ -70,7 +70,7 @@ case "$OS" in # unsupported ${TESTJAVA}/bin/javac -d . ${TESTSRC}\\RSAEncryptDecrypt.java - ${TESTJAVA}/bin/java RSAEncryptDecrypt + ${TESTJAVA}/bin/java ${TESTVMOPTS} RSAEncryptDecrypt exit ;; diff --git a/jdk/test/sun/security/mscapi/ShortRSAKey1024.sh b/jdk/test/sun/security/mscapi/ShortRSAKey1024.sh index 1e01377ed29..05db70e1a3e 100644 --- a/jdk/test/sun/security/mscapi/ShortRSAKey1024.sh +++ b/jdk/test/sun/security/mscapi/ShortRSAKey1024.sh @@ -89,7 +89,7 @@ case "$OS" in echo "Running the test..." ${TESTJAVA}${FS}bin${FS}javac -d . \ ${TESTSRC}${FS}ShortRSAKeyWithinTLS.java - ${TESTJAVA}${FS}bin${FS}java ShortRSAKeyWithinTLS 7106773.$BITS $BITS \ + ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} ShortRSAKeyWithinTLS 7106773.$BITS $BITS \ TLSv1.2 TLS_DHE_RSA_WITH_AES_128_CBC_SHA rc=$? diff --git a/jdk/test/sun/security/mscapi/SignUsingNONEwithRSA.sh b/jdk/test/sun/security/mscapi/SignUsingNONEwithRSA.sh index c89a8687877..f794e298d18 100644 --- a/jdk/test/sun/security/mscapi/SignUsingNONEwithRSA.sh +++ b/jdk/test/sun/security/mscapi/SignUsingNONEwithRSA.sh @@ -61,7 +61,7 @@ case "$OS" in echo echo "Running the test..." ${TESTJAVA}/bin/javac -d . ${TESTSRC}\\SignUsingNONEwithRSA.java - ${TESTJAVA}/bin/java SignUsingNONEwithRSA + ${TESTJAVA}/bin/java ${TESTVMOPTS} SignUsingNONEwithRSA rc=$? diff --git a/jdk/test/sun/security/mscapi/SignUsingSHA2withRSA.sh b/jdk/test/sun/security/mscapi/SignUsingSHA2withRSA.sh index c939fb39e3f..2d433f108f0 100644 --- a/jdk/test/sun/security/mscapi/SignUsingSHA2withRSA.sh +++ b/jdk/test/sun/security/mscapi/SignUsingSHA2withRSA.sh @@ -61,7 +61,7 @@ case "$OS" in echo echo "Running the test..." ${TESTJAVA}/bin/javac -d . ${TESTSRC}\\SignUsingSHA2withRSA.java - ${TESTJAVA}/bin/java SignUsingSHA2withRSA + ${TESTJAVA}/bin/java ${TESTVMOPTS} SignUsingSHA2withRSA rc=$? diff --git a/jdk/test/sun/security/pkcs11/KeyStore/Basic.sh b/jdk/test/sun/security/pkcs11/KeyStore/Basic.sh index 54408bdfd99..452b6290e4a 100644 --- a/jdk/test/sun/security/pkcs11/KeyStore/Basic.sh +++ b/jdk/test/sun/security/pkcs11/KeyStore/Basic.sh @@ -171,7 +171,7 @@ fi # run test -${TESTJAVA}${FS}bin${FS}java \ +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \ -classpath ${TESTCLASSES}${PS}${TESTSRC}${FS}loader.jar \ -DDIR=${TESTSRC}${FS}BasicData \ -DCUSTOM_DB_DIR=${TESTCLASSES} \ diff --git a/jdk/test/sun/security/pkcs11/KeyStore/ClientAuth.sh b/jdk/test/sun/security/pkcs11/KeyStore/ClientAuth.sh index 0593ddf144c..d0996c1823a 100644 --- a/jdk/test/sun/security/pkcs11/KeyStore/ClientAuth.sh +++ b/jdk/test/sun/security/pkcs11/KeyStore/ClientAuth.sh @@ -128,7 +128,7 @@ ${TESTJAVA}${FS}bin${FS}javac \ # run test echo "Run ClientAuth ..." -${TESTJAVA}${FS}bin${FS}java \ +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \ -classpath ${TESTCLASSES}${PS}${TESTSRC}${FS}loader.jar \ -DDIR=${TESTSRC}${FS}ClientAuthData${FS} \ -DCUSTOM_DB_DIR=${TESTCLASSES} \ @@ -149,7 +149,7 @@ fi # run test with specified TLS protocol and cipher suite echo "Run ClientAuth TLSv1.2 TLS_DHE_RSA_WITH_AES_128_CBC_SHA" -${TESTJAVA}${FS}bin${FS}java \ +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \ -classpath ${TESTCLASSES}${PS}${TESTSRC}${FS}loader.jar \ -DDIR=${TESTSRC}${FS}ClientAuthData${FS} \ -DCUSTOM_DB_DIR=${TESTCLASSES} \ diff --git a/jdk/test/sun/security/pkcs11/KeyStore/SecretKeysBasic.sh b/jdk/test/sun/security/pkcs11/KeyStore/SecretKeysBasic.sh index 4041c0e093a..30334555302 100644 --- a/jdk/test/sun/security/pkcs11/KeyStore/SecretKeysBasic.sh +++ b/jdk/test/sun/security/pkcs11/KeyStore/SecretKeysBasic.sh @@ -141,7 +141,7 @@ fi # run test cd ${TESTSRC} -${TESTJAVA}${FS}bin${FS}java \ +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \ -DDIR=${TESTSRC}${FS}BasicData${FS} \ -classpath ${TESTCLASSES}${PS}${TESTSRC}${FS}loader.jar \ -DCUSTOM_DB_DIR=${TESTCLASSES} \ diff --git a/jdk/test/sun/security/pkcs11/KeyStore/Solaris.sh b/jdk/test/sun/security/pkcs11/KeyStore/Solaris.sh index 9da8ab9c069..5ec1ac2ec95 100644 --- a/jdk/test/sun/security/pkcs11/KeyStore/Solaris.sh +++ b/jdk/test/sun/security/pkcs11/KeyStore/Solaris.sh @@ -142,7 +142,7 @@ fi # run test cd ${TESTSRC} -${TESTJAVA}${FS}bin${FS}java \ +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \ -classpath ${TESTCLASSES}${PS}${TESTSRC}${FS}loader.jar \ -DDIR=${TESTSRC}${FS}BasicData${FS} \ -DCUSTOM_P11_CONFIG=${TESTSRC}${FS}BasicData${FS}p11-solaris.txt \ diff --git a/jdk/test/sun/security/pkcs11/Provider/ConfigQuotedString.sh b/jdk/test/sun/security/pkcs11/Provider/ConfigQuotedString.sh index ce5693f5968..1a749d89490 100644 --- a/jdk/test/sun/security/pkcs11/Provider/ConfigQuotedString.sh +++ b/jdk/test/sun/security/pkcs11/Provider/ConfigQuotedString.sh @@ -99,7 +99,7 @@ ${TESTJAVA}${FS}bin${FS}javac \ # run test -${TESTJAVA}${FS}bin${FS}java \ +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \ -classpath ${TESTCLASSES} \ -DCUSTOM_P11_CONFIG=${TESTSRC}${FS}ConfigQuotedString-nss.txt \ -Dtest.src=${TESTSRC} \ diff --git a/jdk/test/sun/security/pkcs11/Provider/Login.sh b/jdk/test/sun/security/pkcs11/Provider/Login.sh index 86d8f9e4f70..6b37ef837d2 100644 --- a/jdk/test/sun/security/pkcs11/Provider/Login.sh +++ b/jdk/test/sun/security/pkcs11/Provider/Login.sh @@ -108,7 +108,7 @@ ${TESTJAVA}${FS}bin${FS}javac \ # run test -${TESTJAVA}${FS}bin${FS}java \ +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \ -classpath ${TESTCLASSES} \ -DCUSTOM_DB_DIR=${TESTCLASSES} \ -DCUSTOM_P11_CONFIG=${TESTSRC}${FS}Login-nss.txt \ diff --git a/jdk/test/sun/security/pkcs11/ec/TestECDSA.java b/jdk/test/sun/security/pkcs11/ec/TestECDSA.java index a684d8aa8e1..92dac4c34b6 100644 --- a/jdk/test/sun/security/pkcs11/ec/TestECDSA.java +++ b/jdk/test/sun/security/pkcs11/ec/TestECDSA.java @@ -179,7 +179,6 @@ public class TestECDSA extends PKCS11Test { // SHA1withECDSA and NONEwithECDSA Signature s = Signature.getInstance("SHA1withECDSA", provider); s.initSign(privateKey); - s.initSign(privateKey); s.update(data); byte[] s1 = s.sign(); diff --git a/jdk/test/sun/security/provider/PolicyFile/GrantAllPermToExtWhenNoPolicy.sh b/jdk/test/sun/security/provider/PolicyFile/GrantAllPermToExtWhenNoPolicy.sh index ee4035cc6ec..b09d1564b7f 100644 --- a/jdk/test/sun/security/provider/PolicyFile/GrantAllPermToExtWhenNoPolicy.sh +++ b/jdk/test/sun/security/provider/PolicyFile/GrantAllPermToExtWhenNoPolicy.sh @@ -82,7 +82,7 @@ mv \ ${TESTJAVA}${FILESEP}jre${FILESEP}lib${FILESEP}security${FILESEP}tmp_pol # run the test program -${TESTJAVA}${FILESEP}bin${FILESEP}java -Djava.security.manager \ +${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} -Djava.security.manager \ GrantAllPermToExtWhenNoPolicy # save error status diff --git a/jdk/test/sun/security/provider/PolicyFile/getinstance/getinstance.sh b/jdk/test/sun/security/provider/PolicyFile/getinstance/getinstance.sh index b52db72b326..893bbb65bc5 100644 --- a/jdk/test/sun/security/provider/PolicyFile/getinstance/getinstance.sh +++ b/jdk/test/sun/security/provider/PolicyFile/getinstance/getinstance.sh @@ -92,7 +92,7 @@ ${TESTJAVA}${FS}bin${FS}javac -d ${TESTCLASSES}${FS}boot \ ${TESTJAVA}${FS}bin${FS}javac -d ${TESTCLASSES}${FS}app \ ${TESTSRC}${FS}GetInstance.java -${TESTJAVA}${FS}bin${FS}java \ +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \ -Xbootclasspath/a:"${TESTCLASSES}${FS}boot" \ -classpath "${TESTCLASSES}${FS}app" -Djava.security.manager \ -Djava.security.policy=GetInstance.policy \ @@ -106,7 +106,7 @@ if [ $status1 -ne 0 ]; then echo "Failed on first test" fi -${TESTJAVA}${FS}bin${FS}java \ +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \ -classpath "${TESTCLASSES}${FS}boot${PS}${TESTCLASSES}${FS}app" \ -Djava.security.manager \ -Djava.security.policy=GetInstance.policy \ diff --git a/jdk/test/sun/security/provider/certpath/DisabledAlgorithms/CPBuilder.java b/jdk/test/sun/security/provider/certpath/DisabledAlgorithms/CPBuilder.java index ebcfc70ec0b..2352bc07f97 100644 --- a/jdk/test/sun/security/provider/certpath/DisabledAlgorithms/CPBuilder.java +++ b/jdk/test/sun/security/provider/certpath/DisabledAlgorithms/CPBuilder.java @@ -21,6 +21,9 @@ * questions. */ +// This test case relies on updated static security property, no way to re-use +// security property in samevm/agentvm mode. + /** * @test * @@ -392,6 +395,9 @@ public class CPBuilder { } public static void main(String args[]) throws Exception { + // reset the security property to make sure that the algorithms + // and keys used in this test are not disabled. + Security.setProperty("jdk.certpath.disabledAlgorithms", "MD2"); CertPathBuilder builder = CertPathBuilder.getInstance("PKIX"); diff --git a/jdk/test/sun/security/provider/certpath/DisabledAlgorithms/CPValidatorEndEntity.java b/jdk/test/sun/security/provider/certpath/DisabledAlgorithms/CPValidatorEndEntity.java index 725ed6b5d99..283342baddb 100644 --- a/jdk/test/sun/security/provider/certpath/DisabledAlgorithms/CPValidatorEndEntity.java +++ b/jdk/test/sun/security/provider/certpath/DisabledAlgorithms/CPValidatorEndEntity.java @@ -21,6 +21,9 @@ * questions. */ +// This test case relies on updated static security property, no way to re-use +// security property in samevm/agentvm mode. + /** * @test * @@ -28,7 +31,7 @@ * @summary Disable MD2 support. * New CertPathValidatorException.BasicReason enum constant for * constrained algorithm. - * + * @run main/othervm CPValidatorEndEntity * @author Xuelei Fan */ @@ -313,6 +316,10 @@ public class CPValidatorEndEntity { } public static void main(String args[]) throws Exception { + // reset the security property to make sure that the algorithms + // and keys used in this test are not disabled. + Security.setProperty("jdk.certpath.disabledAlgorithms", "MD2"); + try { validate(endentiry_SHA1withRSA_1024_1024, intermediate_SHA1withRSA_1024_1024); diff --git a/jdk/test/sun/security/provider/certpath/DisabledAlgorithms/CPValidatorIntermediate.java b/jdk/test/sun/security/provider/certpath/DisabledAlgorithms/CPValidatorIntermediate.java index 6b4f3cdc126..1473577ff5e 100644 --- a/jdk/test/sun/security/provider/certpath/DisabledAlgorithms/CPValidatorIntermediate.java +++ b/jdk/test/sun/security/provider/certpath/DisabledAlgorithms/CPValidatorIntermediate.java @@ -21,6 +21,9 @@ * questions. */ +// This test case relies on updated static security property, no way to re-use +// security property in samevm/agentvm mode. + /** * @test * @@ -28,7 +31,7 @@ * @summary Disable MD2 support * new CertPathValidatorException.BasicReason enum constant for * constrained algorithm - * + * @run main/othervm CPValidatorIntermediate * @author Xuelei Fan */ @@ -212,6 +215,10 @@ public class CPValidatorIntermediate { } public static void main(String args[]) throws Exception { + // reset the security property to make sure that the algorithms + // and keys used in this test are not disabled. + Security.setProperty("jdk.certpath.disabledAlgorithms", "MD2"); + try { validate(intermediate_SHA1withRSA_1024_1024); validate(intermediate_SHA1withRSA_1024_512); diff --git a/jdk/test/sun/security/provider/certpath/DisabledAlgorithms/CPValidatorTrustAnchor.java b/jdk/test/sun/security/provider/certpath/DisabledAlgorithms/CPValidatorTrustAnchor.java index e1a70002073..0a0145df968 100644 --- a/jdk/test/sun/security/provider/certpath/DisabledAlgorithms/CPValidatorTrustAnchor.java +++ b/jdk/test/sun/security/provider/certpath/DisabledAlgorithms/CPValidatorTrustAnchor.java @@ -21,6 +21,9 @@ * questions. */ +// This test case relies on updated static security property, no way to re-use +// security property in samevm/agentvm mode. + /** * @test * @@ -28,7 +31,7 @@ * @summary Disable MD2 support * new CertPathValidatorException.BasicReason enum constant for * constrained algorithm - * + * @run main/othervm CPValidatorTrustAnchor * @author Xuelei Fan */ @@ -133,6 +136,10 @@ public class CPValidatorTrustAnchor { } public static void main(String args[]) throws Exception { + // reset the security property to make sure that the algorithms + // and keys used in this test are not disabled. + Security.setProperty("jdk.certpath.disabledAlgorithms", "MD2"); + try { validate(trustAnchor_SHA1withRSA_1024); validate(trustAnchor_SHA1withRSA_512); diff --git a/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/ClientHandshaker/RSAExport.java b/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/ClientHandshaker/RSAExport.java index d63fc8ea0d1..b8f22579b40 100644 --- a/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/ClientHandshaker/RSAExport.java +++ b/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/ClientHandshaker/RSAExport.java @@ -21,14 +21,14 @@ * questions. */ +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. + /* * @test * @bug 6690018 * @summary RSAClientKeyExchange NullPointerException * @run main/othervm RSAExport - * - * SunJSSE does not support dynamic system properties, no way to re-use - * system properties in samevm/agentvm mode. */ /* @@ -199,6 +199,7 @@ import java.io.*; import java.net.*; +import java.security.Security; import java.security.KeyStore; import java.security.KeyFactory; import java.security.cert.Certificate; @@ -415,6 +416,10 @@ public class RSAExport { volatile Exception clientException = null; public static void main(String[] args) throws Exception { + // reset the security property to make sure that the algorithms + // and keys used in this test are not disabled. + Security.setProperty("jdk.certpath.disabledAlgorithms", "MD2"); + if (debug) System.setProperty("javax.net.debug", "all"); diff --git a/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/EngineArgs/DebugReportsOneExtraByte.sh b/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/EngineArgs/DebugReportsOneExtraByte.sh index c2d14c75bd3..f29f6cedd94 100644 --- a/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/EngineArgs/DebugReportsOneExtraByte.sh +++ b/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/EngineArgs/DebugReportsOneExtraByte.sh @@ -59,7 +59,7 @@ echo "Examining debug output for the string:" echo "${STRING}" echo "=========" -${TESTJAVA}${FS}bin${FS}java -Djavax.net.debug=all \ +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -Djavax.net.debug=all \ -Dtest.src=${TESTSRC} \ DebugReportsOneExtraByte 2>&1 | \ grep "${STRING}" diff --git a/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/NotifyHandshakeTest.sh b/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/NotifyHandshakeTest.sh index fa5a410aa64..60a38468be5 100644 --- a/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/NotifyHandshakeTest.sh +++ b/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/NotifyHandshakeTest.sh @@ -82,7 +82,7 @@ rm -rf com edu # This is the only thing we really care about as far as # test status goes. # -${TESTJAVA}${FILESEP}bin${FILESEP}java \ +${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} \ -Dtest.src=${TESTSRC} \ -classpath "com.jar${PATHSEP}edu.jar" \ -Djava.security.manager \ diff --git a/jdk/test/sun/security/ssl/javax/net/ssl/TLSv12/DisabledShortRSAKeys.java b/jdk/test/sun/security/ssl/javax/net/ssl/TLSv12/DisabledShortRSAKeys.java new file mode 100644 index 00000000000..4a7130964b8 --- /dev/null +++ b/jdk/test/sun/security/ssl/javax/net/ssl/TLSv12/DisabledShortRSAKeys.java @@ -0,0 +1,433 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. + +/* + * @test + * @bug 7109274 + * @summary Consider disabling support for X.509 certificates with RSA keys + * less than 1024 bits + * + * @run main/othervm DisabledShortRSAKeys PKIX TLSv1.2 + * @run main/othervm DisabledShortRSAKeys SunX509 TLSv1.2 + * @run main/othervm DisabledShortRSAKeys PKIX TLSv1.1 + * @run main/othervm DisabledShortRSAKeys SunX509 TLSv1.1 + * @run main/othervm DisabledShortRSAKeys PKIX TLSv1 + * @run main/othervm DisabledShortRSAKeys SunX509 TLSv1 + * @run main/othervm DisabledShortRSAKeys PKIX SSLv3 + * @run main/othervm DisabledShortRSAKeys SunX509 SSLv3 + */ + +import java.net.*; +import java.util.*; +import java.io.*; +import javax.net.ssl.*; +import java.security.Security; +import java.security.KeyStore; +import java.security.KeyFactory; +import java.security.cert.Certificate; +import java.security.cert.CertificateFactory; +import java.security.spec.*; +import java.security.interfaces.*; +import sun.misc.BASE64Decoder; + + +public class DisabledShortRSAKeys { + + /* + * ============================================================= + * Set the various variables needed for the tests, then + * specify what tests to run on each side. + */ + + /* + * Should we run the client or server in a separate thread? + * Both sides can throw exceptions, but do you have a preference + * as to which side should be the main thread. + */ + static boolean separateServerThread = true; + + /* + * Where do we find the keystores? + */ + // Certificates and key used in the test. + static String trustedCertStr = + "-----BEGIN CERTIFICATE-----\n" + + "MIICkjCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADA7MQswCQYDVQQGEwJVUzEN\n" + + "MAsGA1UEChMESmF2YTEdMBsGA1UECxMUU3VuSlNTRSBUZXN0IFNlcml2Y2UwHhcN\n" + + "MTEwODE5MDE1MjE5WhcNMzIwNzI5MDE1MjE5WjA7MQswCQYDVQQGEwJVUzENMAsG\n" + + "A1UEChMESmF2YTEdMBsGA1UECxMUU3VuSlNTRSBUZXN0IFNlcml2Y2UwgZ8wDQYJ\n" + + "KoZIhvcNAQEBBQADgY0AMIGJAoGBAM8orG08DtF98TMSscjGsidd1ZoN4jiDpi8U\n" + + "ICz+9dMm1qM1d7O2T+KH3/mxyox7Rc2ZVSCaUD0a3CkhPMnlAx8V4u0H+E9sqso6\n" + + "iDW3JpOyzMExvZiRgRG/3nvp55RMIUV4vEHOZ1QbhuqG4ebN0Vz2DkRft7+flthf\n" + + "vDld6f5JAgMBAAGjgaUwgaIwHQYDVR0OBBYEFLl81dnfp0wDrv0OJ1sxlWzH83Xh\n" + + "MGMGA1UdIwRcMFqAFLl81dnfp0wDrv0OJ1sxlWzH83XhoT+kPTA7MQswCQYDVQQG\n" + + "EwJVUzENMAsGA1UEChMESmF2YTEdMBsGA1UECxMUU3VuSlNTRSBUZXN0IFNlcml2\n" + + "Y2WCAQAwDwYDVR0TAQH/BAUwAwEB/zALBgNVHQ8EBAMCAQYwDQYJKoZIhvcNAQEE\n" + + "BQADgYEALlgaH1gWtoBZ84EW8Hu6YtGLQ/L9zIFmHonUPZwn3Pr//icR9Sqhc3/l\n" + + "pVTxOINuFHLRz4BBtEylzRIOPzK3tg8XwuLb1zd0db90x3KBCiAL6E6cklGEPwLe\n" + + "XYMHDn9eDsaq861Tzn6ZwzMgw04zotPMoZN0mVd/3Qca8UJFucE=\n" + + "-----END CERTIFICATE-----"; + + static String targetCertStr = + "-----BEGIN CERTIFICATE-----\n" + + "MIICNDCCAZ2gAwIBAgIBDDANBgkqhkiG9w0BAQQFADA7MQswCQYDVQQGEwJVUzEN\n" + + "MAsGA1UEChMESmF2YTEdMBsGA1UECxMUU3VuSlNTRSBUZXN0IFNlcml2Y2UwHhcN\n" + + "MTExMTA3MTM1NTUyWhcNMzEwNzI1MTM1NTUyWjBPMQswCQYDVQQGEwJVUzENMAsG\n" + + "A1UEChMESmF2YTEdMBsGA1UECxMUU3VuSlNTRSBUZXN0IFNlcml2Y2UxEjAQBgNV\n" + + "BAMTCWxvY2FsaG9zdDBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQC3Pb49OSPfOD2G\n" + + "HSXFCFx1GJEZfqG9ZUf7xuIi/ra5dLjPGAaoY5QF2QOa8VnOriQCXDfyXHxsuRnE\n" + + "OomxL7EVAgMBAAGjeDB2MAsGA1UdDwQEAwID6DAdBgNVHQ4EFgQUXNCJK3/dtCIc\n" + + "xb+zlA/JINlvs/MwHwYDVR0jBBgwFoAUuXzV2d+nTAOu/Q4nWzGVbMfzdeEwJwYD\n" + + "VR0lBCAwHgYIKwYBBQUHAwEGCCsGAQUFBwMCBggrBgEFBQcDAzANBgkqhkiG9w0B\n" + + "AQQFAAOBgQB2qIDUxA2caMPpGtUACZAPRUtrGssCINIfItETXJZCx/cRuZ5sP4D9\n" + + "N1acoNDn0hCULe3lhXAeTC9NZ97680yJzregQMV5wATjo1FGsKY30Ma+sc/nfzQW\n" + + "+h/7RhYtoG0OTsiaDCvyhI6swkNJzSzrAccPY4+ZgU8HiDLzZTmM3Q==\n" + + "-----END CERTIFICATE-----"; + + // Private key in the format of PKCS#8, key size is 512 bits. + static String targetPrivateKey = + "MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAtz2+PTkj3zg9hh0l\n" + + "xQhcdRiRGX6hvWVH+8biIv62uXS4zxgGqGOUBdkDmvFZzq4kAlw38lx8bLkZxDqJ\n" + + "sS+xFQIDAQABAkByx/5Oo2hQ/w2q4L8z+NTRlJ3vdl8iIDtC/4XPnfYfnGptnpG6\n" + + "ZThQRvbMZiai0xHQPQMszvAHjZVme1eDl3EBAiEA3aKJHynPVCEJhpfCLWuMwX5J\n" + + "1LntwJO7NTOyU5m8rPECIQDTpzn5X44r2rzWBDna/Sx7HW9IWCxNgUD2Eyi2nA7W\n" + + "ZQIgJerEorw4aCAuzQPxiGu57PB6GRamAihEAtoRTBQlH0ECIQDN08FgTtnesgCU\n" + + "DFYLLcw1CiHvc7fZw4neBDHCrC8NtQIgA8TOUkGnpCZlQ0KaI8KfKWI+vxFcgFnH\n" + + "3fnqsTgaUs4="; + + static char passphrase[] = "passphrase".toCharArray(); + + /* + * Is the server ready to serve? + */ + volatile static boolean serverReady = false; + + /* + * Turn on SSL debugging? + */ + static boolean debug = false; + + /* + * Define the server side of the test. + * + * If the server prematurely exits, serverReady will be set to true + * to avoid infinite hangs. + */ + void doServerSide() throws Exception { + SSLContext context = generateSSLContext(null, targetCertStr, + targetPrivateKey); + SSLServerSocketFactory sslssf = context.getServerSocketFactory(); + SSLServerSocket sslServerSocket = + (SSLServerSocket)sslssf.createServerSocket(serverPort); + serverPort = sslServerSocket.getLocalPort(); + + /* + * Signal Client, we're ready for his connect. + */ + serverReady = true; + + try (SSLSocket sslSocket = (SSLSocket)sslServerSocket.accept()) { + InputStream sslIS = sslSocket.getInputStream(); + OutputStream sslOS = sslSocket.getOutputStream(); + + sslIS.read(); + sslOS.write('A'); + sslOS.flush(); + + throw new Exception( + "RSA keys shorter than 1024 bits should be disabled"); + } catch (SSLHandshakeException sslhe) { + // the expected exception, ignore + } + } + + /* + * Define the client side of the test. + * + * If the server prematurely exits, serverReady will be set to true + * to avoid infinite hangs. + */ + void doClientSide() throws Exception { + + /* + * Wait for server to get started. + */ + while (!serverReady) { + Thread.sleep(50); + } + + SSLContext context = generateSSLContext(trustedCertStr, null, null); + SSLSocketFactory sslsf = context.getSocketFactory(); + + try (SSLSocket sslSocket = + (SSLSocket)sslsf.createSocket("localhost", serverPort)) { + + // only enable the target protocol + sslSocket.setEnabledProtocols(new String[] {enabledProtocol}); + + // enable a block cipher + sslSocket.setEnabledCipherSuites( + new String[] {"TLS_DHE_RSA_WITH_AES_128_CBC_SHA"}); + + InputStream sslIS = sslSocket.getInputStream(); + OutputStream sslOS = sslSocket.getOutputStream(); + + sslOS.write('B'); + sslOS.flush(); + sslIS.read(); + + throw new Exception( + "RSA keys shorter than 1024 bits should be disabled"); + } catch (SSLHandshakeException sslhe) { + // the expected exception, ignore + } + } + + /* + * ============================================================= + * The remainder is just support stuff + */ + private static String tmAlgorithm; // trust manager + private static String enabledProtocol; // the target protocol + + private static void parseArguments(String[] args) { + tmAlgorithm = args[0]; + enabledProtocol = args[1]; + } + + private static SSLContext generateSSLContext(String trustedCertStr, + String keyCertStr, String keySpecStr) throws Exception { + + // generate certificate from cert string + CertificateFactory cf = CertificateFactory.getInstance("X.509"); + + // create a key store + KeyStore ks = KeyStore.getInstance("JKS"); + ks.load(null, null); + + // import the trused cert + Certificate trusedCert = null; + ByteArrayInputStream is = null; + if (trustedCertStr != null) { + is = new ByteArrayInputStream(trustedCertStr.getBytes()); + trusedCert = cf.generateCertificate(is); + is.close(); + + ks.setCertificateEntry("RSA Export Signer", trusedCert); + } + + if (keyCertStr != null) { + // generate the private key. + PKCS8EncodedKeySpec priKeySpec = new PKCS8EncodedKeySpec( + new BASE64Decoder().decodeBuffer(keySpecStr)); + KeyFactory kf = KeyFactory.getInstance("RSA"); + RSAPrivateKey priKey = + (RSAPrivateKey)kf.generatePrivate(priKeySpec); + + // generate certificate chain + is = new ByteArrayInputStream(keyCertStr.getBytes()); + Certificate keyCert = cf.generateCertificate(is); + is.close(); + + Certificate[] chain = null; + if (trusedCert != null) { + chain = new Certificate[2]; + chain[0] = keyCert; + chain[1] = trusedCert; + } else { + chain = new Certificate[1]; + chain[0] = keyCert; + } + + // import the key entry. + ks.setKeyEntry("Whatever", priKey, passphrase, chain); + } + + // create SSL context + TrustManagerFactory tmf = TrustManagerFactory.getInstance(tmAlgorithm); + tmf.init(ks); + + SSLContext ctx = SSLContext.getInstance("TLS"); + if (keyCertStr != null && !keyCertStr.isEmpty()) { + KeyManagerFactory kmf = KeyManagerFactory.getInstance("NewSunX509"); + kmf.init(ks, passphrase); + + ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null); + ks = null; + } else { + ctx.init(null, tmf.getTrustManagers(), null); + } + + return ctx; + } + + + // use any free port by default + volatile int serverPort = 0; + + volatile Exception serverException = null; + volatile Exception clientException = null; + + public static void main(String[] args) throws Exception { + if (debug) + System.setProperty("javax.net.debug", "all"); + + /* + * Get the customized arguments. + */ + parseArguments(args); + + /* + * Start the tests. + */ + new DisabledShortRSAKeys(); + } + + Thread clientThread = null; + Thread serverThread = null; + + /* + * Primary constructor, used to drive remainder of the test. + * + * Fork off the other side, then do your work. + */ + DisabledShortRSAKeys() throws Exception { + try { + if (separateServerThread) { + startServer(true); + startClient(false); + } else { + startClient(true); + startServer(false); + } + } catch (Exception e) { + // swallow for now. Show later + } + + /* + * Wait for other side to close down. + */ + if (separateServerThread) { + serverThread.join(); + } else { + clientThread.join(); + } + + /* + * When we get here, the test is pretty much over. + * Which side threw the error? + */ + Exception local; + Exception remote; + String whichRemote; + + if (separateServerThread) { + remote = serverException; + local = clientException; + whichRemote = "server"; + } else { + remote = clientException; + local = serverException; + whichRemote = "client"; + } + + /* + * If both failed, return the curthread's exception, but also + * print the remote side Exception + */ + if ((local != null) && (remote != null)) { + System.out.println(whichRemote + " also threw:"); + remote.printStackTrace(); + System.out.println(); + throw local; + } + + if (remote != null) { + throw remote; + } + + if (local != null) { + throw local; + } + } + + void startServer(boolean newThread) throws Exception { + if (newThread) { + serverThread = new Thread() { + public void run() { + try { + doServerSide(); + } catch (Exception e) { + /* + * Our server thread just died. + * + * Release the client, if not active already... + */ + System.err.println("Server died..."); + serverReady = true; + serverException = e; + } + } + }; + serverThread.start(); + } else { + try { + doServerSide(); + } catch (Exception e) { + serverException = e; + } finally { + serverReady = true; + } + } + } + + void startClient(boolean newThread) throws Exception { + if (newThread) { + clientThread = new Thread() { + public void run() { + try { + doClientSide(); + } catch (Exception e) { + /* + * Our client thread just died. + */ + System.err.println("Client died..."); + clientException = e; + } + } + }; + clientThread.start(); + } else { + try { + doClientSide(); + } catch (Exception e) { + clientException = e; + } + } + } +} diff --git a/jdk/test/sun/security/ssl/javax/net/ssl/TLSv12/ShortRSAKey512.java b/jdk/test/sun/security/ssl/javax/net/ssl/TLSv12/ShortRSAKey512.java index a3fb2b0cb15..c3c170205a4 100644 --- a/jdk/test/sun/security/ssl/javax/net/ssl/TLSv12/ShortRSAKey512.java +++ b/jdk/test/sun/security/ssl/javax/net/ssl/TLSv12/ShortRSAKey512.java @@ -23,6 +23,9 @@ * questions. */ +// This test case relies on updated static security property, no way to re-use +// security property in samevm/agentvm mode. + /* * @test * @bug 7106773 @@ -38,6 +41,7 @@ import java.net.*; import java.util.*; import java.io.*; import javax.net.ssl.*; +import java.security.Security; import java.security.KeyStore; import java.security.KeyFactory; import java.security.cert.Certificate; @@ -275,6 +279,10 @@ public class ShortRSAKey512 { volatile Exception clientException = null; public static void main(String[] args) throws Exception { + // reset the security property to make sure that the algorithms + // and keys used in this test are not disabled. + Security.setProperty("jdk.certpath.disabledAlgorithms", "MD2"); + if (debug) System.setProperty("javax.net.debug", "all"); diff --git a/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/HttpsProxyStackOverflow.java b/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/HttpsProxyStackOverflow.java index dc50bc9f2ba..360dfeeb385 100644 --- a/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/HttpsProxyStackOverflow.java +++ b/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/HttpsProxyStackOverflow.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.sh b/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.sh index 7696cbbd6b3..85e9c22c4af 100644 --- a/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.sh +++ b/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.sh @@ -52,5 +52,5 @@ esac ${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}OriginServer.java \ ${TESTSRC}${FS}ProxyTunnelServer.java ${TESTSRC}${FS}PostThruProxy.java -${TESTJAVA}${FS}bin${FS}java PostThruProxy ${HOSTNAME} ${TESTSRC} +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} PostThruProxy ${HOSTNAME} ${TESTSRC} exit diff --git a/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxyWithAuth.sh b/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxyWithAuth.sh index 9e2ed3c4bf0..96c0642480b 100644 --- a/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxyWithAuth.sh +++ b/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxyWithAuth.sh @@ -53,5 +53,5 @@ esac ${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}OriginServer.java \ ${TESTSRC}${FS}ProxyTunnelServer.java \ ${TESTSRC}${FS}PostThruProxyWithAuth.java -${TESTJAVA}${FS}bin${FS}java PostThruProxyWithAuth ${HOSTNAME} ${TESTSRC} +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} PostThruProxyWithAuth ${HOSTNAME} ${TESTSRC} exit diff --git a/jdk/test/sun/security/tools/jarsigner/concise_jarsigner.sh b/jdk/test/sun/security/tools/jarsigner/concise_jarsigner.sh index c3eec5819e1..5fbb7d0b9c4 100644 --- a/jdk/test/sun/security/tools/jarsigner/concise_jarsigner.sh +++ b/jdk/test/sun/security/tools/jarsigner/concise_jarsigner.sh @@ -44,10 +44,10 @@ case "$OS" in ;; esac -# Choose 512-bit RSA to make sure it runs fine and fast on all platforms. In fact, -# every keyalg/keysize combination is OK for this test. +# Choose 1024-bit RSA to make sure it runs fine and fast on all platforms. In +# fact, every keyalg/keysize combination is OK for this test. -KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit -keystore js.jks -keyalg rsa -keysize 512" +KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit -keystore js.jks -keyalg rsa -keysize 1024" JAR=$TESTJAVA${FS}bin${FS}jar JARSIGNER=$TESTJAVA${FS}bin${FS}jarsigner JAVAC=$TESTJAVA${FS}bin${FS}javac diff --git a/jdk/test/sun/security/tools/jarsigner/emptymanifest.sh b/jdk/test/sun/security/tools/jarsigner/emptymanifest.sh index 81c0937f436..cbb72413f1a 100644 --- a/jdk/test/sun/security/tools/jarsigner/emptymanifest.sh +++ b/jdk/test/sun/security/tools/jarsigner/emptymanifest.sh @@ -65,7 +65,7 @@ class CrLf { } EOF $JAVAC CrLf.java -$JAVA CrLf > META-INF${FS}MANIFEST.MF +$JAVA ${TESTVMOPTS} CrLf > META-INF${FS}MANIFEST.MF zip $JFILE META-INF${FS}MANIFEST.MF A B $KT -alias a -dname CN=a -keyalg rsa -genkey -validity 300 diff --git a/jdk/test/sun/security/tools/jarsigner/ts.sh b/jdk/test/sun/security/tools/jarsigner/ts.sh index 3293a7dfa71..43a3651f62a 100644 --- a/jdk/test/sun/security/tools/jarsigner/ts.sh +++ b/jdk/test/sun/security/tools/jarsigner/ts.sh @@ -87,5 +87,5 @@ $KT -alias tsbad3 -certreq | \ $KT -alias tsbad3 -importcert $JAVAC -d . ${TESTSRC}/TimestampCheck.java -$JAVA TimestampCheck +$JAVA ${TESTVMOPTS} TimestampCheck diff --git a/jdk/test/sun/security/tools/keytool/printssl.sh b/jdk/test/sun/security/tools/keytool/printssl.sh index b750ffe8d2d..46de2609b0b 100644 --- a/jdk/test/sun/security/tools/keytool/printssl.sh +++ b/jdk/test/sun/security/tools/keytool/printssl.sh @@ -53,7 +53,7 @@ case "$OS" in esac ${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}PrintSSL.java || exit 10 -${TESTJAVA}${FS}bin${FS}java -Dtest.src=$TESTSRC PrintSSL | ( read PORT; ${TESTJAVA}${FS}bin${FS}keytool -printcert -sslserver localhost:$PORT ) +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -Dtest.src=$TESTSRC PrintSSL | ( read PORT; ${TESTJAVA}${FS}bin${FS}keytool -printcert -sslserver localhost:$PORT ) status=$? rm PrintSSL*.class diff --git a/jdk/test/sun/security/tools/keytool/standard.sh b/jdk/test/sun/security/tools/keytool/standard.sh index 756d2fb1f1e..c75a7a49b46 100644 --- a/jdk/test/sun/security/tools/keytool/standard.sh +++ b/jdk/test/sun/security/tools/keytool/standard.sh @@ -58,7 +58,7 @@ esac ${TESTJAVA}${FS}bin${FS}javac -d . -XDignore.symbol.file ${TESTSRC}${FS}KeyToolTest.java || exit 10 -echo | ${TESTJAVA}${FS}bin${FS}java -Dfile KeyToolTest +echo | ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -Dfile KeyToolTest status=$? rm HumanInputStream*.class diff --git a/jdk/test/sun/security/validator/certreplace.sh b/jdk/test/sun/security/validator/certreplace.sh index 16470a3994a..b45a70edaa8 100644 --- a/jdk/test/sun/security/validator/certreplace.sh +++ b/jdk/test/sun/security/validator/certreplace.sh @@ -82,4 +82,4 @@ $KT -delete -alias user # 5. Build and run test $JAVAC -d . ${TESTSRC}${FS}CertReplace.java -$JAVA CertReplace certreplace.jks certreplace.certs +$JAVA ${TESTVMOPTS} CertReplace certreplace.jks certreplace.certs diff --git a/jdk/test/sun/security/validator/samedn.sh b/jdk/test/sun/security/validator/samedn.sh index 9d5afd40a8e..5d9b0455713 100644 --- a/jdk/test/sun/security/validator/samedn.sh +++ b/jdk/test/sun/security/validator/samedn.sh @@ -78,5 +78,5 @@ $KT -delete -alias user # Check both, one of them might be dropped out of map in old codes. $JAVAC -d . ${TESTSRC}${FS}CertReplace.java -$JAVA CertReplace samedn.jks samedn1.certs || exit 1 -$JAVA CertReplace samedn.jks samedn2.certs || exit 2 +$JAVA ${TESTVMOPTS} CertReplace samedn.jks samedn1.certs || exit 1 +$JAVA ${TESTVMOPTS} CertReplace samedn.jks samedn2.certs || exit 2 diff --git a/jdk/test/sun/text/resources/LocaleData b/jdk/test/sun/text/resources/LocaleData index 2e630767548..59dc0ebeffb 100644 --- a/jdk/test/sun/text/resources/LocaleData +++ b/jdk/test/sun/text/resources/LocaleData @@ -7074,3 +7074,589 @@ FormatData/sl/DatePatterns/1=dd. MMMM y # bug 7189611 CurrencyNames/es_VE/VEF=Bs.F. + +# rfe 8000983 (narrow names support) +FormatData//DayNarrows/0=S +FormatData//DayNarrows/1=M +FormatData//DayNarrows/2=T +FormatData//DayNarrows/3=W +FormatData//DayNarrows/4=T +FormatData//DayNarrows/5=F +FormatData//DayNarrows/6=S +FormatData//narrow.AmPmMarkers/0=a +FormatData//narrow.AmPmMarkers/1=p +FormatData//narrow.Eras/0=B +FormatData//narrow.Eras/1=A +FormatData//buddhist.narrow.Eras/0=BC +FormatData//buddhist.narrow.Eras/1=B.E. +FormatData//japanese.narrow.Eras/0= +FormatData//japanese.narrow.Eras/1=M +FormatData//japanese.narrow.Eras/2=T +FormatData//japanese.narrow.Eras/3=S +FormatData//japanese.narrow.Eras/4=H + +FormatData/ar/DayNarrows/0=\u062d +FormatData/ar/DayNarrows/1=\u0646 +FormatData/ar/DayNarrows/2=\u062b +FormatData/ar/DayNarrows/3=\u0631 +FormatData/ar/DayNarrows/4=\u062e +FormatData/ar/DayNarrows/5=\u062c +FormatData/ar/DayNarrows/6=\u0633 + +FormatData/be/standalone.MonthNarrows/0=\u0441 +FormatData/be/standalone.MonthNarrows/1=\u043b +FormatData/be/standalone.MonthNarrows/2=\u0441 +FormatData/be/standalone.MonthNarrows/3=\u043a +FormatData/be/standalone.MonthNarrows/4=\u043c +FormatData/be/standalone.MonthNarrows/5=\u0447 +FormatData/be/standalone.MonthNarrows/6=\u043b +FormatData/be/standalone.MonthNarrows/7=\u0436 +FormatData/be/standalone.MonthNarrows/8=\u0432 +FormatData/be/standalone.MonthNarrows/9=\u043a +FormatData/be/standalone.MonthNarrows/10=\u043b +FormatData/be/standalone.MonthNarrows/11=\u0441 +FormatData/be/standalone.MonthNarrows/12= +FormatData/be/DayNarrows/0=\u043d +FormatData/be/DayNarrows/1=\u043f +FormatData/be/DayNarrows/2=\u0430 +FormatData/be/DayNarrows/3=\u0441 +FormatData/be/DayNarrows/4=\u0447 +FormatData/be/DayNarrows/5=\u043f +FormatData/be/DayNarrows/6=\u0441 + +FormatData/bg/DayNarrows/0=\u043d +FormatData/bg/DayNarrows/1=\u043f +FormatData/bg/DayNarrows/2=\u0432 +FormatData/bg/DayNarrows/3=\u0441 +FormatData/bg/DayNarrows/4=\u0447 +FormatData/bg/DayNarrows/5=\u043f +FormatData/bg/DayNarrows/6=\u0441 + +FormatData/ca/standalone.MonthNarrows/0=g +FormatData/ca/standalone.MonthNarrows/1=f +FormatData/ca/standalone.MonthNarrows/2=m +FormatData/ca/standalone.MonthNarrows/3=a +FormatData/ca/standalone.MonthNarrows/4=m +FormatData/ca/standalone.MonthNarrows/5=j +FormatData/ca/standalone.MonthNarrows/6=j +FormatData/ca/standalone.MonthNarrows/7=a +FormatData/ca/standalone.MonthNarrows/8=s +FormatData/ca/standalone.MonthNarrows/9=o +FormatData/ca/standalone.MonthNarrows/10=n +FormatData/ca/standalone.MonthNarrows/11=d +FormatData/ca/standalone.MonthNarrows/12= +FormatData/ca/DayNarrows/0=G +# Note: "L" is a contribued item in CLDR +FormatData/ca/DayNarrows/1=L +FormatData/ca/DayNarrows/2=T +FormatData/ca/DayNarrows/3=C +FormatData/ca/DayNarrows/4=J +FormatData/ca/DayNarrows/5=V +FormatData/ca/DayNarrows/6=S +FormatData/ca/standalone.DayNarrows/0=g +FormatData/ca/standalone.DayNarrows/1=l +FormatData/ca/standalone.DayNarrows/2=t +FormatData/ca/standalone.DayNarrows/3=c +FormatData/ca/standalone.DayNarrows/4=j +FormatData/ca/standalone.DayNarrows/5=v +FormatData/ca/standalone.DayNarrows/6=s + +FormatData/cs/DayNarrows/0=N +FormatData/cs/DayNarrows/1=P +FormatData/cs/DayNarrows/2=\u00da +FormatData/cs/DayNarrows/3=S +FormatData/cs/DayNarrows/4=\u010c +FormatData/cs/DayNarrows/5=P +FormatData/cs/DayNarrows/6=S + +FormatData/da/DayNarrows/0=S +FormatData/da/DayNarrows/1=M +FormatData/da/DayNarrows/2=T +FormatData/da/DayNarrows/3=O +FormatData/da/DayNarrows/4=T +FormatData/da/DayNarrows/5=F +FormatData/da/DayNarrows/6=L + +FormatData/de/DayNarrows/0=S +FormatData/de/DayNarrows/1=M +FormatData/de/DayNarrows/2=D +FormatData/de/DayNarrows/3=M +FormatData/de/DayNarrows/4=D +FormatData/de/DayNarrows/5=F +FormatData/de/DayNarrows/6=S + +FormatData/el/DayNarrows/0=\u039a +FormatData/el/DayNarrows/1=\u0394 +FormatData/el/DayNarrows/2=\u03a4 +FormatData/el/DayNarrows/3=\u03a4 +FormatData/el/DayNarrows/4=\u03a0 +FormatData/el/DayNarrows/5=\u03a0 +FormatData/el/DayNarrows/6=\u03a3 + +FormatData/es/DayNarrows/0=D +FormatData/es/DayNarrows/1=L +FormatData/es/DayNarrows/2=M +FormatData/es/DayNarrows/3=X +FormatData/es/DayNarrows/4=J +FormatData/es/DayNarrows/5=V +FormatData/es/DayNarrows/6=S + +FormatData/et/DayNarrows/0=P +FormatData/et/DayNarrows/1=E +FormatData/et/DayNarrows/2=T +FormatData/et/DayNarrows/3=K +FormatData/et/DayNarrows/4=N +FormatData/et/DayNarrows/5=R +FormatData/et/DayNarrows/6=L + +FormatData/fi/standalone.MonthNarrows/0=T +FormatData/fi/standalone.MonthNarrows/1=H +FormatData/fi/standalone.MonthNarrows/2=M +FormatData/fi/standalone.MonthNarrows/3=H +FormatData/fi/standalone.MonthNarrows/4=T +FormatData/fi/standalone.MonthNarrows/5=K +FormatData/fi/standalone.MonthNarrows/6=H +FormatData/fi/standalone.MonthNarrows/7=E +FormatData/fi/standalone.MonthNarrows/8=S +FormatData/fi/standalone.MonthNarrows/9=L +FormatData/fi/standalone.MonthNarrows/10=M +FormatData/fi/standalone.MonthNarrows/11=J +FormatData/fi/standalone.MonthNarrows/12= +FormatData/fi/DayNarrows/0=S +FormatData/fi/DayNarrows/1=M +FormatData/fi/DayNarrows/2=T +FormatData/fi/DayNarrows/3=K +FormatData/fi/DayNarrows/4=T +FormatData/fi/DayNarrows/5=P +FormatData/fi/DayNarrows/6=L +FormatData/fi/standalone.DayNarrows/0=S +FormatData/fi/standalone.DayNarrows/1=M +FormatData/fi/standalone.DayNarrows/2=T +FormatData/fi/standalone.DayNarrows/3=K +FormatData/fi/standalone.DayNarrows/4=T +FormatData/fi/standalone.DayNarrows/5=P +FormatData/fi/standalone.DayNarrows/6=L +FormatData/fi/narrow.AmPmMarkers/0=ap. +FormatData/fi/narrow.AmPmMarkers/1=ip. + +FormatData/fr/DayNarrows/0=D +FormatData/fr/DayNarrows/1=L +FormatData/fr/DayNarrows/2=M +FormatData/fr/DayNarrows/3=M +FormatData/fr/DayNarrows/4=J +FormatData/fr/DayNarrows/5=V +FormatData/fr/DayNarrows/6=S + +FormatData/hi_IN/DayNarrows/0=\u0930 +FormatData/hi_IN/DayNarrows/1=\u0938\u094b +FormatData/hi_IN/DayNarrows/2=\u092e\u0902 +FormatData/hi_IN/DayNarrows/3=\u092c\u0941 +FormatData/hi_IN/DayNarrows/4=\u0917\u0941 +FormatData/hi_IN/DayNarrows/5=\u0936\u0941 +FormatData/hi_IN/DayNarrows/6=\u0936 + +FormatData/hr/standalone.MonthNarrows/0=1. +FormatData/hr/standalone.MonthNarrows/1=2. +FormatData/hr/standalone.MonthNarrows/2=3. +FormatData/hr/standalone.MonthNarrows/3=4. +FormatData/hr/standalone.MonthNarrows/4=5. +FormatData/hr/standalone.MonthNarrows/5=6. +FormatData/hr/standalone.MonthNarrows/6=7. +FormatData/hr/standalone.MonthNarrows/7=8. +FormatData/hr/standalone.MonthNarrows/8=9. +FormatData/hr/standalone.MonthNarrows/9=10. +FormatData/hr/standalone.MonthNarrows/10=11. +FormatData/hr/standalone.MonthNarrows/11=12. +FormatData/hr/standalone.MonthNarrows/12= +FormatData/hr/DayNarrows/0=N +FormatData/hr/DayNarrows/1=P +FormatData/hr/DayNarrows/2=U +FormatData/hr/DayNarrows/3=S +FormatData/hr/DayNarrows/4=\u010c +FormatData/hr/DayNarrows/5=P +FormatData/hr/DayNarrows/6=S +FormatData/hr/standalone.DayNarrows/0=n +FormatData/hr/standalone.DayNarrows/1=p +FormatData/hr/standalone.DayNarrows/2=u +FormatData/hr/standalone.DayNarrows/3=s +FormatData/hr/standalone.DayNarrows/4=\u010d +FormatData/hr/standalone.DayNarrows/5=p +FormatData/hr/standalone.DayNarrows/6=s + +FormatData/hu/DayNarrows/0=V +FormatData/hu/DayNarrows/1=H +FormatData/hu/DayNarrows/2=K +FormatData/hu/DayNarrows/3=Sz +FormatData/hu/DayNarrows/4=Cs +FormatData/hu/DayNarrows/5=P +FormatData/hu/DayNarrows/6=Sz + +FormatData/is/standalone.MonthNarrows/0=j +FormatData/is/standalone.MonthNarrows/1=f +FormatData/is/standalone.MonthNarrows/2=m +FormatData/is/standalone.MonthNarrows/3=a +FormatData/is/standalone.MonthNarrows/4=m +FormatData/is/standalone.MonthNarrows/5=j +FormatData/is/standalone.MonthNarrows/6=j +FormatData/is/standalone.MonthNarrows/7=\u00e1 +FormatData/is/standalone.MonthNarrows/8=s +FormatData/is/standalone.MonthNarrows/9=o +FormatData/is/standalone.MonthNarrows/10=n +FormatData/is/standalone.MonthNarrows/11=d +FormatData/is/standalone.MonthNarrows/12= +FormatData/is/DayNarrows/0=S +FormatData/is/DayNarrows/1=M +FormatData/is/DayNarrows/2=\u00de +FormatData/is/DayNarrows/3=M +FormatData/is/DayNarrows/4=F +FormatData/is/DayNarrows/5=F +FormatData/is/DayNarrows/6=L +FormatData/is/standalone.DayNarrows/0=s +FormatData/is/standalone.DayNarrows/1=m +FormatData/is/standalone.DayNarrows/2=\u00fe +FormatData/is/standalone.DayNarrows/3=m +FormatData/is/standalone.DayNarrows/4=f +FormatData/is/standalone.DayNarrows/5=f +FormatData/is/standalone.DayNarrows/6=l + +FormatData/it/DayNarrows/0=D +FormatData/it/DayNarrows/1=L +FormatData/it/DayNarrows/2=M +FormatData/it/DayNarrows/3=M +FormatData/it/DayNarrows/4=G +FormatData/it/DayNarrows/5=V +FormatData/it/DayNarrows/6=S + +FormatData/iw/DayNarrows/0=\u05d0 +FormatData/iw/DayNarrows/1=\u05d1 +FormatData/iw/DayNarrows/2=\u05d2 +FormatData/iw/DayNarrows/3=\u05d3 +FormatData/iw/DayNarrows/4=\u05d4 +FormatData/iw/DayNarrows/5=\u05d5 +FormatData/iw/DayNarrows/6=\u05e9 +FormatData/iw/standalone.DayNarrows/0=\u05d0 +FormatData/iw/standalone.DayNarrows/1=\u05d1 +FormatData/iw/standalone.DayNarrows/2=\u05d2 +FormatData/iw/standalone.DayNarrows/3=\u05d3 +FormatData/iw/standalone.DayNarrows/4=\u05d4 +FormatData/iw/standalone.DayNarrows/5=\u05d5 +FormatData/iw/standalone.DayNarrows/6=\u05e9 + +FormatData/ja/DayNarrows/0=\u65e5 +FormatData/ja/DayNarrows/1=\u6708 +FormatData/ja/DayNarrows/2=\u706b +FormatData/ja/DayNarrows/3=\u6c34 +FormatData/ja/DayNarrows/4=\u6728 +FormatData/ja/DayNarrows/5=\u91d1 +FormatData/ja/DayNarrows/6=\u571f + +FormatData/ko/DayNarrows/0=\uc77c +FormatData/ko/DayNarrows/1=\uc6d4 +FormatData/ko/DayNarrows/2=\ud654 +FormatData/ko/DayNarrows/3=\uc218 +FormatData/ko/DayNarrows/4=\ubaa9 +FormatData/ko/DayNarrows/5=\uae08 +FormatData/ko/DayNarrows/6=\ud1a0 + +FormatData/lt/standalone.MonthNarrows/0=S +FormatData/lt/standalone.MonthNarrows/1=V +FormatData/lt/standalone.MonthNarrows/2=K +FormatData/lt/standalone.MonthNarrows/3=B +FormatData/lt/standalone.MonthNarrows/4=G +FormatData/lt/standalone.MonthNarrows/5=B +FormatData/lt/standalone.MonthNarrows/6=L +FormatData/lt/standalone.MonthNarrows/7=R +FormatData/lt/standalone.MonthNarrows/8=R +FormatData/lt/standalone.MonthNarrows/9=S +FormatData/lt/standalone.MonthNarrows/10=L +FormatData/lt/standalone.MonthNarrows/11=G +FormatData/lt/standalone.MonthNarrows/12= + +FormatData/lt/DayNarrows/0=S +FormatData/lt/DayNarrows/1=P +FormatData/lt/DayNarrows/2=A +FormatData/lt/DayNarrows/3=T +FormatData/lt/DayNarrows/4=K +FormatData/lt/DayNarrows/5=P +FormatData/lt/DayNarrows/6=\u0160 +FormatData/lt/standalone.DayNarrows/0=S +FormatData/lt/standalone.DayNarrows/1=P +FormatData/lt/standalone.DayNarrows/2=A +FormatData/lt/standalone.DayNarrows/3=T +FormatData/lt/standalone.DayNarrows/4=K +FormatData/lt/standalone.DayNarrows/5=P +FormatData/lt/standalone.DayNarrows/6=\u0160 + +FormatData/lv/DayNarrows/0=S +FormatData/lv/DayNarrows/1=P +FormatData/lv/DayNarrows/2=O +FormatData/lv/DayNarrows/3=T +FormatData/lv/DayNarrows/4=C +FormatData/lv/DayNarrows/5=P +FormatData/lv/DayNarrows/6=S + +FormatData/mk/DayNarrows/0=\u043d +FormatData/mk/DayNarrows/1=\u043f +FormatData/mk/DayNarrows/2=\u0432 +FormatData/mk/DayNarrows/3=\u0441 +FormatData/mk/DayNarrows/4=\u0447 +FormatData/mk/DayNarrows/5=\u043f +FormatData/mk/DayNarrows/6=\u0441 + +FormatData/ms/standalone.MonthNarrows/0=J +FormatData/ms/standalone.MonthNarrows/1=F +FormatData/ms/standalone.MonthNarrows/2=M +FormatData/ms/standalone.MonthNarrows/3=A +FormatData/ms/standalone.MonthNarrows/4=M +FormatData/ms/standalone.MonthNarrows/5=J +FormatData/ms/standalone.MonthNarrows/6=J +FormatData/ms/standalone.MonthNarrows/7=O +FormatData/ms/standalone.MonthNarrows/8=S +FormatData/ms/standalone.MonthNarrows/9=O +FormatData/ms/standalone.MonthNarrows/10=N +FormatData/ms/standalone.MonthNarrows/11=D +FormatData/ms/standalone.MonthNarrows/12= +FormatData/ms/DayNarrows/0=A +FormatData/ms/DayNarrows/1=I +FormatData/ms/DayNarrows/2=S +FormatData/ms/DayNarrows/3=R +FormatData/ms/DayNarrows/4=K +FormatData/ms/DayNarrows/5=J +FormatData/ms/DayNarrows/6=S +FormatData/ms/standalone.DayNarrows/0=A +FormatData/ms/standalone.DayNarrows/1=I +FormatData/ms/standalone.DayNarrows/2=S +FormatData/ms/standalone.DayNarrows/3=R +FormatData/ms/standalone.DayNarrows/4=K +FormatData/ms/standalone.DayNarrows/5=J +FormatData/ms/standalone.DayNarrows/6=S + +FormatData/mt/DayNarrows/0=\u0126 +FormatData/mt/DayNarrows/1=T +FormatData/mt/DayNarrows/2=T +FormatData/mt/DayNarrows/3=E +FormatData/mt/DayNarrows/4=\u0126 +FormatData/mt/DayNarrows/5=\u0120 +FormatData/mt/DayNarrows/6=S + +FormatData/nl/DayNarrows/0=Z +FormatData/nl/DayNarrows/1=M +FormatData/nl/DayNarrows/2=D +FormatData/nl/DayNarrows/3=W +FormatData/nl/DayNarrows/4=D +FormatData/nl/DayNarrows/5=V +FormatData/nl/DayNarrows/6=Z + +FormatData/pl/DayNarrows/0=N +FormatData/pl/DayNarrows/1=P +FormatData/pl/DayNarrows/2=W +FormatData/pl/DayNarrows/3=\u015a +FormatData/pl/DayNarrows/4=C +FormatData/pl/DayNarrows/5=P +FormatData/pl/DayNarrows/6=S + +FormatData/pt/DayNarrows/0=D +FormatData/pt/DayNarrows/1=S +FormatData/pt/DayNarrows/2=T +FormatData/pt/DayNarrows/3=Q +FormatData/pt/DayNarrows/4=Q +FormatData/pt/DayNarrows/5=S +FormatData/pt/DayNarrows/6=S + +FormatData/ro/standalone.MonthNarrows/0=I +FormatData/ro/standalone.MonthNarrows/1=F +FormatData/ro/standalone.MonthNarrows/2=M +FormatData/ro/standalone.MonthNarrows/3=A +FormatData/ro/standalone.MonthNarrows/4=M +FormatData/ro/standalone.MonthNarrows/5=I +FormatData/ro/standalone.MonthNarrows/6=I +FormatData/ro/standalone.MonthNarrows/7=A +FormatData/ro/standalone.MonthNarrows/8=S +FormatData/ro/standalone.MonthNarrows/9=O +FormatData/ro/standalone.MonthNarrows/10=N +FormatData/ro/standalone.MonthNarrows/11=D +FormatData/ro/standalone.MonthNarrows/12= +# commented out DayNarrows due to mostly undefined +#FormatData/ro/DayNarrows/0=D +#FormatData/ro/DayNarrows/1= +#FormatData/ro/DayNarrows/2= +#FormatData/ro/DayNarrows/3= +#FormatData/ro/DayNarrows/4= +#FormatData/ro/DayNarrows/5= +#FormatData/ro/DayNarrows/6= +FormatData/ro/standalone.DayNarrows/0=D +FormatData/ro/standalone.DayNarrows/1=L +FormatData/ro/standalone.DayNarrows/2=M +FormatData/ro/standalone.DayNarrows/3=M +FormatData/ro/standalone.DayNarrows/4=J +FormatData/ro/standalone.DayNarrows/5=V +FormatData/ro/standalone.DayNarrows/6=S + +FormatData/ru/DayNarrows/0=\u0412 +FormatData/ru/DayNarrows/1=\u041f\u043d +FormatData/ru/DayNarrows/2=\u0412\u0442 +FormatData/ru/DayNarrows/3=\u0421 +FormatData/ru/DayNarrows/4=\u0427 +FormatData/ru/DayNarrows/5=\u041f +# Note: "sat" is an contributed item in CLDR. +FormatData/ru/DayNarrows/6=\u0421 + +FormatData/ru/standalone.DayNarrows/0=\u0412 +FormatData/ru/standalone.DayNarrows/1=\u041f +FormatData/ru/standalone.DayNarrows/2=\u0412 +FormatData/ru/standalone.DayNarrows/3=\u0421 +FormatData/ru/standalone.DayNarrows/4=\u0427 +FormatData/ru/standalone.DayNarrows/5=\u041f +FormatData/ru/standalone.DayNarrows/6=\u0421 + +FormatData/sk/DayNarrows/0=N +FormatData/sk/DayNarrows/1=P +FormatData/sk/DayNarrows/2=U +FormatData/sk/DayNarrows/3=S +FormatData/sk/DayNarrows/4=\u0160 +FormatData/sk/DayNarrows/5=P +FormatData/sk/DayNarrows/6=S + +FormatData/sl/DayNarrows/0=n +FormatData/sl/DayNarrows/1=p +FormatData/sl/DayNarrows/2=t +FormatData/sl/DayNarrows/3=s +FormatData/sl/DayNarrows/4=\u010d +FormatData/sl/DayNarrows/5=p +FormatData/sl/DayNarrows/6=s + +FormatData/sq/DayNarrows/0=D +FormatData/sq/DayNarrows/1=H +FormatData/sq/DayNarrows/2=M +FormatData/sq/DayNarrows/3=M +FormatData/sq/DayNarrows/4=E +FormatData/sq/DayNarrows/5=P +FormatData/sq/DayNarrows/6=S + +FormatData/sr/DayNarrows/0=\u043d +FormatData/sr/DayNarrows/1=\u043f +FormatData/sr/DayNarrows/2=\u0443 +FormatData/sr/DayNarrows/3=\u0441 +FormatData/sr/DayNarrows/4=\u0447 +FormatData/sr/DayNarrows/5=\u043f +FormatData/sr/DayNarrows/6=\u0441 +FormatData/sr/short.Eras/0=\u043f. \u043d. \u0435. +FormatData/sr/short.Eras/1=\u043d. \u0435. +FormatData/sr/narrow.Eras/0=\u043f.\u043d.\u0435. +FormatData/sr/narrow.Eras/1=\u043d.\u0435. + +FormatData/sv/standalone.MonthNarrows/0=J +FormatData/sv/standalone.MonthNarrows/1=F +FormatData/sv/standalone.MonthNarrows/2=M +FormatData/sv/standalone.MonthNarrows/3=A +FormatData/sv/standalone.MonthNarrows/4=M +FormatData/sv/standalone.MonthNarrows/5=J +FormatData/sv/standalone.MonthNarrows/6=J +FormatData/sv/standalone.MonthNarrows/7=A +FormatData/sv/standalone.MonthNarrows/8=S +FormatData/sv/standalone.MonthNarrows/9=O +FormatData/sv/standalone.MonthNarrows/10=N +FormatData/sv/standalone.MonthNarrows/11=D +FormatData/sv/standalone.MonthNarrows/12= +FormatData/sv/DayNarrows/0=S +FormatData/sv/DayNarrows/1=M +FormatData/sv/DayNarrows/2=T +FormatData/sv/DayNarrows/3=O +FormatData/sv/DayNarrows/4=T +FormatData/sv/DayNarrows/5=F +FormatData/sv/DayNarrows/6=L +FormatData/sv/standalone.DayNarrows/0=S +FormatData/sv/standalone.DayNarrows/1=M +FormatData/sv/standalone.DayNarrows/2=T +FormatData/sv/standalone.DayNarrows/3=O +FormatData/sv/standalone.DayNarrows/4=T +FormatData/sv/standalone.DayNarrows/5=F +FormatData/sv/standalone.DayNarrows/6=L +FormatData/sv/narrow.Eras/0=f.Kr. +FormatData/sv/narrow.Eras/1=e.Kr. +FormatData/sv/narrow.AmPmMarkers/0=f +FormatData/sv/narrow.AmPmMarkers/1=e + +FormatData/th/standalone.MonthNarrows/0=\u0e21.\u0e04. +FormatData/th/standalone.MonthNarrows/1=\u0e01.\u0e1e. +FormatData/th/standalone.MonthNarrows/2=\u0e21\u0e35.\u0e04. +FormatData/th/standalone.MonthNarrows/3=\u0e40\u0e21.\u0e22. +FormatData/th/standalone.MonthNarrows/4=\u0e1e.\u0e04. +FormatData/th/standalone.MonthNarrows/5=\u0e21\u0e34.\u0e22. +FormatData/th/standalone.MonthNarrows/6=\u0e01.\u0e04. +FormatData/th/standalone.MonthNarrows/7=\u0e2a.\u0e04. +FormatData/th/standalone.MonthNarrows/8=\u0e01.\u0e22. +FormatData/th/standalone.MonthNarrows/9=\u0e15.\u0e04. +FormatData/th/standalone.MonthNarrows/10=\u0e1e.\u0e22. +FormatData/th/standalone.MonthNarrows/11=\u0e18.\u0e04. +FormatData/th/standalone.MonthNarrows/12= +FormatData/th/DayNarrows/0=\u0e2d +FormatData/th/DayNarrows/1=\u0e08 +FormatData/th/DayNarrows/2=\u0e2d +FormatData/th/DayNarrows/3=\u0e1e +FormatData/th/DayNarrows/4=\u0e1e +FormatData/th/DayNarrows/5=\u0e28 +FormatData/th/DayNarrows/6=\u0e2a +FormatData/th/narrow.Eras/0=\u0e01\u0e48\u0e2d\u0e19 \u0e04.\u0e28. +FormatData/th/narrow.Eras/1=\u0e04.\u0e28. + +FormatData/tr/standalone.MonthNarrows/0=O +FormatData/tr/standalone.MonthNarrows/1=\u015e +FormatData/tr/standalone.MonthNarrows/2=M +FormatData/tr/standalone.MonthNarrows/3=N +FormatData/tr/standalone.MonthNarrows/4=M +FormatData/tr/standalone.MonthNarrows/5=H +FormatData/tr/standalone.MonthNarrows/6=T +FormatData/tr/standalone.MonthNarrows/7=A +FormatData/tr/standalone.MonthNarrows/8=E +FormatData/tr/standalone.MonthNarrows/9=E +FormatData/tr/standalone.MonthNarrows/10=K +FormatData/tr/standalone.MonthNarrows/11=A +FormatData/tr/standalone.MonthNarrows/12= +FormatData/tr/DayNarrows/0=P +FormatData/tr/DayNarrows/1=P +FormatData/tr/DayNarrows/2=S +FormatData/tr/DayNarrows/3=\u00c7 +FormatData/tr/DayNarrows/4=P +FormatData/tr/DayNarrows/5=C +FormatData/tr/DayNarrows/6=C + +FormatData/uk/DayNarrows/0=\u041d +FormatData/uk/DayNarrows/1=\u041f +FormatData/uk/DayNarrows/2=\u0412 +FormatData/uk/DayNarrows/3=\u0421 +FormatData/uk/DayNarrows/4=\u0427 +FormatData/uk/DayNarrows/5=\u041f +FormatData/uk/DayNarrows/6=\u0421 + +FormatData/vi/DayNarrows/0=CN +FormatData/vi/DayNarrows/1=T2 +FormatData/vi/DayNarrows/2=T3 +FormatData/vi/DayNarrows/3=T4 +FormatData/vi/DayNarrows/4=T5 +FormatData/vi/DayNarrows/5=T6 +FormatData/vi/DayNarrows/6=T7 + +FormatData/zh/standalone.MonthNarrows/0=1\u6708 +FormatData/zh/standalone.MonthNarrows/1=2\u6708 +FormatData/zh/standalone.MonthNarrows/2=3\u6708 +FormatData/zh/standalone.MonthNarrows/3=4\u6708 +FormatData/zh/standalone.MonthNarrows/4=5\u6708 +FormatData/zh/standalone.MonthNarrows/5=6\u6708 +FormatData/zh/standalone.MonthNarrows/6=7\u6708 +FormatData/zh/standalone.MonthNarrows/7=8\u6708 +FormatData/zh/standalone.MonthNarrows/8=9\u6708 +FormatData/zh/standalone.MonthNarrows/9=10\u6708 +FormatData/zh/standalone.MonthNarrows/10=11\u6708 +FormatData/zh/standalone.MonthNarrows/11=12\u6708 +FormatData/zh/standalone.MonthNarrows/12= +FormatData/zh/DayNarrows/0=\u65e5 +FormatData/zh/DayNarrows/1=\u4e00 +FormatData/zh/DayNarrows/2=\u4e8c +FormatData/zh/DayNarrows/3=\u4e09 +FormatData/zh/DayNarrows/4=\u56db +FormatData/zh/DayNarrows/5=\u4e94 +FormatData/zh/DayNarrows/6=\u516d + +# bug 7195759 +CurrencyNames//ZMW=ZMW diff --git a/jdk/test/sun/text/resources/LocaleDataTest.java b/jdk/test/sun/text/resources/LocaleDataTest.java index 51bf527bce1..bd1932209cf 100644 --- a/jdk/test/sun/text/resources/LocaleDataTest.java +++ b/jdk/test/sun/text/resources/LocaleDataTest.java @@ -34,7 +34,7 @@ * 6509039 6609737 6610748 6645271 6507067 6873931 6450945 6645268 6646611 * 6645405 6650730 6910489 6573250 6870908 6585666 6716626 6914413 6916787 * 6919624 6998391 7019267 7020960 7025837 7020583 7036905 7066203 7101495 - * 7003124 7085757 7028073 7171028 7189611 + * 7003124 7085757 7028073 7171028 7189611 8000983 7195759 * @summary Verify locale data * */ diff --git a/jdk/test/sun/tools/jps/jps-V_2.sh b/jdk/test/sun/tools/jps/jps-V_2.sh index fe0cc400c4e..2e670d2e6be 100644 --- a/jdk/test/sun/tools/jps/jps-V_2.sh +++ b/jdk/test/sun/tools/jps/jps-V_2.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011,Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/sun/tools/jrunscript/common.sh b/jdk/test/sun/tools/jrunscript/common.sh index a80157fd1c2..91cf78165e2 100644 --- a/jdk/test/sun/tools/jrunscript/common.sh +++ b/jdk/test/sun/tools/jrunscript/common.sh @@ -63,8 +63,4 @@ setup() { JRUNSCRIPT="${TESTJAVA}/bin/jrunscript" JAVAC="${TESTJAVA}/bin/javac" JAVA="${TESTJAVA}/bin/java" - # needed to get full headless behavior on Mac - if [ "$OS" = "Darwin" ]; then - export AWT_TOOLKIT=XToolkit - fi } diff --git a/jdk/test/tools/jar/JarBackSlash.java b/jdk/test/tools/jar/JarBackSlash.java index 40629131738..5975e4e5467 100644 --- a/jdk/test/tools/jar/JarBackSlash.java +++ b/jdk/test/tools/jar/JarBackSlash.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/tools/launcher/6842838/Test6842838.sh b/jdk/test/tools/launcher/6842838/Test6842838.sh index 6c6e9aa4ba7..b552152a9f3 100644 --- a/jdk/test/tools/launcher/6842838/Test6842838.sh +++ b/jdk/test/tools/launcher/6842838/Test6842838.sh @@ -68,8 +68,8 @@ if [ ! -x ${LIBUMEM} ]; then fi BADFILE=newbadjar.jar -${JAVA_EXE} -version -${JAVA_EXE} -cp ${TESTCLASSES} CreateBadJar ${BADFILE} "META-INF/MANIFEST.MF" +${JAVA_EXE} ${TESTVMOPTS} -version +${JAVA_EXE} ${TESTVMOPTS} -cp ${TESTCLASSES} CreateBadJar ${BADFILE} "META-INF/MANIFEST.MF" LD_PRELOAD=${LIBUMEM} ${JAVA_EXE} -jar ${BADFILE} > test.out 2>&1 grep "Invalid or corrupt jarfile" test.out diff --git a/jdk/test/tools/launcher/Arrrghs.java b/jdk/test/tools/launcher/Arrrghs.java index 364589f5ad0..9bf9f21b465 100644 --- a/jdk/test/tools/launcher/Arrrghs.java +++ b/jdk/test/tools/launcher/Arrrghs.java @@ -27,7 +27,7 @@ * 6894719 6968053 7151434 7146424 * @summary Argument parsing validation. * @compile -XDignore.symbol.file Arrrghs.java - * @run main Arrrghs + * @run main/othervm Arrrghs */ import java.io.BufferedReader; @@ -204,8 +204,7 @@ public class Arrrghs extends TestHelper { // exiting the process prematurely can terminate the stderr. scratchpad.add(javaCmd + " -version " + inArgs); File batFile = new File("atest.bat"); - java.nio.file.Files.deleteIfExists(batFile.toPath()); - createFile(batFile, scratchpad); + createAFile(batFile, scratchpad); TestResult tr = doExec(batFile.getName()); diff --git a/jdk/test/tools/launcher/MultipleJRE.sh b/jdk/test/tools/launcher/MultipleJRE.sh index 5c49d8bae7c..b1ef16f4062 100644 --- a/jdk/test/tools/launcher/MultipleJRE.sh +++ b/jdk/test/tools/launcher/MultipleJRE.sh @@ -49,8 +49,8 @@ then exit 1 fi -JAVAEXE="$TESTJAVA/bin/java" -JAVA="$TESTJAVA/bin/java -classpath $TESTCLASSES" +JAVAEXE="$TESTJAVA/bin/java ${TESTVMOPTS}" +JAVA="$TESTJAVA/bin/java ${TESTVMOPTS} -classpath $TESTCLASSES" JAR="$TESTJAVA/bin/jar" OS=`uname -s`; diff --git a/jdk/test/tools/launcher/TestHelper.java b/jdk/test/tools/launcher/TestHelper.java index e630dd5df54..0115f057142 100644 --- a/jdk/test/tools/launcher/TestHelper.java +++ b/jdk/test/tools/launcher/TestHelper.java @@ -358,6 +358,51 @@ public class TestHelper { Files.copy(src.toPath(), dst.toPath(), COPY_ATTRIBUTES, REPLACE_EXISTING); } + /** + * Attempt to create a file at the given location. If an IOException + * occurs then back off for a moment and try again. When a number of + * attempts fail, give up and throw an exception. + */ + void createAFile(File aFile, List contents) throws IOException { + IOException cause = null; + for (int attempts = 0; attempts < 10; attempts++) { + try { + Files.write(aFile.getAbsoluteFile().toPath(), contents, + Charset.defaultCharset(), CREATE, TRUNCATE_EXISTING, WRITE); + if (cause != null) { + /* + * report attempts and errors that were encountered + * for diagnostic purposes + */ + System.err.println("Created batch file " + + aFile + " in " + (attempts + 1) + + " attempts"); + System.err.println("Errors encountered: " + cause); + cause.printStackTrace(); + } + return; + } catch (IOException ioe) { + if (cause != null) { + // chain the exceptions so they all get reported for diagnostics + cause.addSuppressed(ioe); + } else { + cause = ioe; + } + } + + try { + Thread.sleep(500); + } catch (InterruptedException ie) { + if (cause != null) { + // cause should alway be non-null here + ie.addSuppressed(cause); + } + throw new RuntimeException("Interrupted while creating batch file", ie); + } + } + throw new RuntimeException("Unable to create batch file", cause); + } + static void createFile(File outFile, List content) throws IOException { Files.write(outFile.getAbsoluteFile().toPath(), content, Charset.defaultCharset(), CREATE_NEW); diff --git a/jdk/test/tools/launcher/UnicodeTest.java b/jdk/test/tools/launcher/UnicodeTest.java index d44582df18c..15213f16876 100644 --- a/jdk/test/tools/launcher/UnicodeTest.java +++ b/jdk/test/tools/launcher/UnicodeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2012, 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/langtools/.hgtags b/langtools/.hgtags index 079bb76d93b..ea5dc98ff77 100644 --- a/langtools/.hgtags +++ b/langtools/.hgtags @@ -189,3 +189,6 @@ e6ee43b3e2473798b17a556e9f11eebe25ab81d4 jdk8-b64 5f2faba89cac665e365c05074064ffc934a495eb jdk8-b65 20230f8b0eef92a57043735fc2ca00fea7e510a0 jdk8-b66 303b09787a69136cd2019f9edfed3f308572e9fc jdk8-b67 +014a6a11dfe5ddc23ec8c76bb42ac998dbf49acb jdk8-b68 +d7360bf35ee1f40ff78c2e83a22b5446ee464346 jdk8-b69 +47f71d7c124f24c2fe2dfc49865b332345b458ed jdk8-b70 diff --git a/langtools/make/Makefile-classic b/langtools/make/Makefile-classic index f73ba0bd8a1..f0693b7216b 100644 --- a/langtools/make/Makefile-classic +++ b/langtools/make/Makefile-classic @@ -1,5 +1,5 @@ # -# Copyright (c) 2007, 2012 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/langtools/make/build.properties b/langtools/make/build.properties index c1ab362490c..912342dcabc 100644 --- a/langtools/make/build.properties +++ b/langtools/make/build.properties @@ -68,7 +68,7 @@ javac.no.jdk.warnings = -XDignore.symbol.file=true # set the following to -version to verify the versions of javac being used javac.version.opt = # in time, there should be no exceptions to -Xlint:all -javac.lint.opts = -Xlint:all,-deprecation -Werror +javac.lint.opts = -Xlint:all -Werror # options for the task for javac #javadoc.jls3.url=http://java.sun.com/docs/books/jls/ @@ -117,7 +117,8 @@ javac.includes = \ javax/lang/model/ \ javax/tools/ \ com/sun/source/ \ - com/sun/tools/javac/ + com/sun/tools/javac/ \ + com/sun/tools/doclint/ javac.tests = \ tools/javac diff --git a/langtools/src/share/classes/com/sun/javadoc/ClassDoc.java b/langtools/src/share/classes/com/sun/javadoc/ClassDoc.java index 8eda69b4bdd..bf05b418ddd 100644 --- a/langtools/src/share/classes/com/sun/javadoc/ClassDoc.java +++ b/langtools/src/share/classes/com/sun/javadoc/ClassDoc.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -65,6 +65,12 @@ public interface ClassDoc extends ProgramElementDoc, Type { */ boolean isExternalizable(); + /** + * Return true if this class can be used as a target type of a lambda expression + * or method reference. + */ + boolean isFunctionalInterface(); + /** * Return the serialization methods for this class or * interface. diff --git a/langtools/src/share/classes/com/sun/javadoc/MethodDoc.java b/langtools/src/share/classes/com/sun/javadoc/MethodDoc.java index 16b678e3590..83bc03f1487 100644 --- a/langtools/src/share/classes/com/sun/javadoc/MethodDoc.java +++ b/langtools/src/share/classes/com/sun/javadoc/MethodDoc.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,6 +38,11 @@ public interface MethodDoc extends ExecutableMemberDoc { */ boolean isAbstract(); + /** + * Return true if this method is default + */ + boolean isDefault(); + /** * Get return type. * diff --git a/langtools/src/share/classes/com/sun/source/util/DocTrees.java b/langtools/src/share/classes/com/sun/source/util/DocTrees.java index 68abf3f5de3..a2f6635df75 100644 --- a/langtools/src/share/classes/com/sun/source/util/DocTrees.java +++ b/langtools/src/share/classes/com/sun/source/util/DocTrees.java @@ -45,9 +45,7 @@ public abstract class DocTrees extends Trees { * @throws IllegalArgumentException if the task does not support the Trees API. */ public static DocTrees instance(CompilationTask task) { - if (!task.getClass().getName().equals("com.sun.tools.javac.api.JavacTaskImpl")) - throw new IllegalArgumentException(); - return (DocTrees) getJavacTrees(CompilationTask.class, task); + return (DocTrees) Trees.instance(task); } /** diff --git a/langtools/src/share/classes/com/sun/source/util/JavacTask.java b/langtools/src/share/classes/com/sun/source/util/JavacTask.java index c1acc05b93b..7cd9a279dc5 100644 --- a/langtools/src/share/classes/com/sun/source/util/JavacTask.java +++ b/langtools/src/share/classes/com/sun/source/util/JavacTask.java @@ -139,6 +139,7 @@ public abstract class JavacTask implements CompilationTask { * @see com.sun.source.util.Trees#getTypeMirror */ public abstract TypeMirror getTypeMirror(Iterable path); + /** * Get a utility object for dealing with program elements. */ diff --git a/langtools/src/share/classes/com/sun/source/util/Plugin.java b/langtools/src/share/classes/com/sun/source/util/Plugin.java index 66886aa8dec..0b500f31c84 100644 --- a/langtools/src/share/classes/com/sun/source/util/Plugin.java +++ b/langtools/src/share/classes/com/sun/source/util/Plugin.java @@ -56,9 +56,9 @@ public interface Plugin { String getName(); /** - * Invoke the plug-in for a given compilation task. + * Initialize the plug-in for a given compilation task. * @param task The compilation task that has just been started * @param args Arguments, if any, for the plug-in */ - void call(JavacTask task, String... args); + void init(JavacTask task, String... args); } diff --git a/langtools/src/share/classes/com/sun/source/util/TreePath.java b/langtools/src/share/classes/com/sun/source/util/TreePath.java index eef400abc2e..a150e67e7c9 100644 --- a/langtools/src/share/classes/com/sun/source/util/TreePath.java +++ b/langtools/src/share/classes/com/sun/source/util/TreePath.java @@ -60,14 +60,20 @@ public class TreePath implements Iterable { this.path = path; } } + class PathFinder extends TreePathScanner { public TreePath scan(Tree tree, Tree target) { - if (tree == target) + if (tree == target) { throw new Result(new TreePath(getCurrentPath(), target)); + } return super.scan(tree, target); } } + if (path.getLeaf() == target) { + return path; + } + try { new PathFinder().scan(path, target); } catch (Result result) { diff --git a/langtools/src/share/classes/com/sun/tools/classfile/Opcode.java b/langtools/src/share/classes/com/sun/tools/classfile/Opcode.java index 7ecf4979228..f22bec8f003 100644 --- a/langtools/src/share/classes/com/sun/tools/classfile/Opcode.java +++ b/langtools/src/share/classes/com/sun/tools/classfile/Opcode.java @@ -448,10 +448,10 @@ public enum Opcode { } - private static Opcode[] stdOpcodes = new Opcode[256]; - private static Opcode[] wideOpcodes = new Opcode[256]; - private static Opcode[] nonPrivOpcodes = new Opcode[256]; - private static Opcode[] privOpcodes = new Opcode[256]; + private static final Opcode[] stdOpcodes = new Opcode[256]; + private static final Opcode[] wideOpcodes = new Opcode[256]; + private static final Opcode[] nonPrivOpcodes = new Opcode[256]; + private static final Opcode[] privOpcodes = new Opcode[256]; static { for (Opcode o: values()) getOpcodeBlock(o.opcode >> 8)[o.opcode & 0xff] = o; diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java index 3ea59576fb6..b11d255e565 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java @@ -239,7 +239,14 @@ public abstract class AbstractMemberWriter { if ((member.isField() || member.isMethod()) && writer instanceof ClassWriterImpl && ((ClassWriterImpl) writer).getClassDoc().isInterface()) { - mod = Util.replaceText(mod, "public", "").trim(); + // This check for isDefault() and the default modifier needs to be + // added for it to appear on the method details section. Once the + // default modifier is added to the Modifier list on DocEnv and once + // it is updated to use the javax.lang.model.element.Modifier, we + // will need to remove this. + mod = (member.isMethod() && ((MethodDoc)member).isDefault()) ? + Util.replaceText(mod, "public", "default").trim() : + Util.replaceText(mod, "public", "").trim(); } if(mod.length() > 0) { htmltree.addContent(mod); @@ -313,8 +320,18 @@ public abstract class AbstractMemberWriter { code.addContent(configuration.getText("doclet.Package_private")); code.addContent(" "); } - if (member.isMethod() && ((MethodDoc)member).isAbstract()) { - code.addContent("abstract "); + if (member.isMethod()) { + if (((MethodDoc)member).isAbstract()) { + code.addContent("abstract "); + } + // This check for isDefault() and the default modifier needs to be + // added for it to appear on the "Modifier and Type" column in the + // method summary section. Once the default modifier is added + // to the Modifier list on DocEnv and once it is updated to use the + // javax.lang.model.element.Modifier, we will need to remove this. + else if (((MethodDoc)member).isDefault()) { + code.addContent("default "); + } } if (member.isStatic()) { code.addContent("static "); @@ -547,6 +564,9 @@ public abstract class AbstractMemberWriter { methodType = (classdoc.isInterface() || ((MethodDoc)member).isAbstract()) ? methodType | MethodTypes.ABSTRACT.value() : methodType | MethodTypes.CONCRETE.value(); + if (((MethodDoc)member).isDefault()) { + methodType = methodType | MethodTypes.DEFAULT.value(); + } if (Util.isDeprecated(member) || Util.isDeprecated(classdoc)) { methodType = methodType | MethodTypes.DEPRECATED.value(); } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java index 06ac230dc27..809f00f8e59 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java @@ -513,6 +513,20 @@ public class ClassWriterImpl extends SubWriterHolderWriter } } + /** + * {@inheritDoc} + */ + public void addFunctionalInterfaceInfo (Content classInfoTree) { + if (classDoc.isFunctionalInterface()) { + Content dt = HtmlTree.DT(getResource("doclet.Functional_Interface")); + Content dl = HtmlTree.DL(dt); + Content dd = new HtmlTree(HtmlTag.DD); + dd.addContent(getResource("doclet.Functional_Interface_Message")); + dl.addContent(dd); + classInfoTree.addContent(dl); + } + } + /** * {@inheritDoc} */ diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties index 9dedf79fc52..7e6df8bc55c 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties @@ -90,6 +90,8 @@ doclet.in_interface=in interface doclet.Subclasses=Direct Known Subclasses: doclet.Subinterfaces=All Known Subinterfaces: doclet.Implementing_Classes=All Known Implementing Classes: +doclet.Functional_Interface=Functional Interface: +doclet.Functional_Interface_Message=This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference. doclet.also=also doclet.Frames=Frames doclet.No_Frames=No Frames diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/ClassWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/ClassWriter.java index f5904b3aef3..c0a991e2196 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/ClassWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/ClassWriter.java @@ -116,6 +116,13 @@ public interface ClassWriter { */ public void addInterfaceUsageInfo(Content classInfoTree); + /** + * If this is an functional interface, display appropriate message. + * + * @param classInfoTree content tree to which the documentation will be added + */ + public void addFunctionalInterfaceInfo(Content classInfoTree); + /** * If this is an inner class or interface, add the enclosing class or * interface. diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java index 1f2e82a10ad..efc9d563473 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java @@ -235,6 +235,16 @@ public class ClassBuilder extends AbstractBuilder { writer.addInterfaceUsageInfo(classInfoTree); } + /** + * If this is an functional interface, display appropriate message. + * + * @param node the XML element that specifies which components to document + * @param classInfoTree the content tree to which the documentation will be added + */ + public void buildFunctionalInterfaceInfo(XMLNode node, Content classInfoTree) { + writer.addFunctionalInterfaceInfo(classInfoTree); + } + /** * If this class is deprecated, build the appropriate information. * diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml index a39cea10843..ce4472e9624 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml @@ -85,6 +85,7 @@ + diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFileFactory.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFileFactory.java index dc5349c87bc..57db795ae16 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFileFactory.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFileFactory.java @@ -46,7 +46,7 @@ import com.sun.tools.doclets.internal.toolkit.Configuration; * @since 1.8 */ abstract class DocFileFactory { - private static Map factories = + private static final Map factories = new WeakHashMap(); /** diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MethodTypes.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MethodTypes.java index d1211fc1c91..7b31ad81f04 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MethodTypes.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MethodTypes.java @@ -36,7 +36,8 @@ public enum MethodTypes { INSTANCE(0x2, "Instance Methods", "t2", false), ABSTRACT(0x4, "Abstract Methods", "t3", false), CONCRETE(0x8, "Concrete Methods", "t4", false), - DEPRECATED(0x10, "Deprecated Methods", "t5", false); + DEFAULT(0x10, "Default Methods", "t5", false), + DEPRECATED(0x20, "Deprecated Methods", "t6", false); private final int value; private final String text; diff --git a/langtools/src/share/classes/com/sun/tools/doclint/Checker.java b/langtools/src/share/classes/com/sun/tools/doclint/Checker.java new file mode 100644 index 00000000000..26a9cf1904d --- /dev/null +++ b/langtools/src/share/classes/com/sun/tools/doclint/Checker.java @@ -0,0 +1,754 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.tools.doclint; + +import java.util.regex.Matcher; +import com.sun.source.doctree.LinkTree; +import java.net.URI; +import java.util.regex.Pattern; +import java.io.IOException; +import com.sun.tools.javac.tree.DocPretty; +import java.io.StringWriter; +import java.util.Deque; +import java.util.EnumSet; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Set; + +import javax.lang.model.element.Element; +import javax.lang.model.element.ElementKind; +import javax.lang.model.element.ExecutableElement; +import javax.lang.model.element.Name; +import javax.lang.model.element.TypeElement; +import javax.lang.model.type.TypeKind; +import javax.lang.model.type.TypeMirror; +import javax.tools.Diagnostic.Kind; + +import com.sun.source.doctree.AttributeTree; +import com.sun.source.doctree.AuthorTree; +import com.sun.source.doctree.DocCommentTree; +import com.sun.source.doctree.DocTree; +import com.sun.source.doctree.EndElementTree; +import com.sun.source.doctree.EntityTree; +import com.sun.source.doctree.ErroneousTree; +import com.sun.source.doctree.IdentifierTree; +import com.sun.source.doctree.InheritDocTree; +import com.sun.source.doctree.ParamTree; +import com.sun.source.doctree.ReferenceTree; +import com.sun.source.doctree.ReturnTree; +import com.sun.source.doctree.SerialDataTree; +import com.sun.source.doctree.SerialFieldTree; +import com.sun.source.doctree.SinceTree; +import com.sun.source.doctree.StartElementTree; +import com.sun.source.doctree.TextTree; +import com.sun.source.doctree.ThrowsTree; +import com.sun.source.doctree.VersionTree; +import com.sun.source.util.DocTreeScanner; +import com.sun.source.util.TreePath; +import com.sun.tools.doclint.HtmlTag.AttrKind; +import java.net.URISyntaxException; +import static com.sun.tools.doclint.Messages.Group.*; + + +/** + * Validate a doc comment. + * + *

      This is NOT part of any supported API. + * If you write code that depends on this, you do so at your own + * risk. This code and its internal interfaces are subject to change + * or deletion without notice.

      + */ +public class Checker extends DocTreeScanner { + final Env env; + + Set foundParams = new HashSet(); + Set foundThrows = new HashSet(); + Set foundAnchors = new HashSet(); + boolean foundInheritDoc = false; + boolean foundReturn = false; + + enum Flag { + TABLE_HAS_CAPTION, + HAS_ELEMENT, + HAS_TEXT + } + + static class TagStackItem { + final DocTree tree; // typically, but not always, StartElementTree + final HtmlTag tag; + final Set attrs; + final Set flags; + TagStackItem(DocTree tree, HtmlTag tag) { + this.tree = tree; + this.tag = tag; + attrs = EnumSet.noneOf(HtmlTag.Attr.class); + flags = EnumSet.noneOf(Flag.class); + } + @Override + public String toString() { + return String.valueOf(tag); + } + } + + private Deque tagStack; // TODO: maybe want to record starting tree as well + private HtmlTag currHeaderTag; + + // + + Checker(Env env) { + env.getClass(); + this.env = env; + tagStack = new LinkedList(); + } + + public Void scan(DocCommentTree tree, TreePath p) { + env.setCurrent(p, tree); + + boolean isOverridingMethod = !env.currOverriddenMethods.isEmpty(); + + if (tree == null) { + if (!isSynthetic() && !isOverridingMethod) + reportMissing("dc.missing.comment"); + return null; + } + + tagStack.clear(); + currHeaderTag = null; + + foundParams.clear(); + foundThrows.clear(); + foundInheritDoc = false; + foundReturn = false; + + scan(tree, (Void) null); + + if (!isOverridingMethod) { + switch (env.currElement.getKind()) { + case METHOD: + case CONSTRUCTOR: { + ExecutableElement ee = (ExecutableElement) env.currElement; + checkParamsDocumented(ee.getTypeParameters()); + checkParamsDocumented(ee.getParameters()); + switch (ee.getReturnType().getKind()) { + case VOID: + case NONE: + break; + default: + if (!foundReturn + && !foundInheritDoc + && !env.types.isSameType(ee.getReturnType(), env.java_lang_Void)) { + reportMissing("dc.missing.return"); + } + } + checkThrowsDocumented(ee.getThrownTypes()); + } + } + } + + return null; + } + + private void reportMissing(String code, Object... args) { + env.messages.report(MISSING, Kind.WARNING, env.currPath.getLeaf(), code, args); + } + + @Override + public Void visitDocComment(DocCommentTree tree, Void ignore) { + super.visitDocComment(tree, ignore); + for (TagStackItem tsi: tagStack) { + if (tsi.tree.getKind() == DocTree.Kind.START_ELEMENT + && tsi.tag.endKind == HtmlTag.EndKind.REQUIRED) { + StartElementTree t = (StartElementTree) tsi.tree; + env.messages.error(HTML, t, "dc.tag.not.closed", t.getName()); + } + } + return null; + } + // + + // + + @Override + public Void visitText(TextTree tree, Void ignore) { + if (!tree.getBody().trim().isEmpty()) { + markEnclosingTag(Flag.HAS_TEXT); + } + return null; + } + + @Override + public Void visitEntity(EntityTree tree, Void ignore) { + markEnclosingTag(Flag.HAS_TEXT); + String name = tree.getName().toString(); + if (name.startsWith("#")) { + int v = name.toLowerCase().startsWith("#x") + ? Integer.parseInt(name.substring(2), 16) + : Integer.parseInt(name.substring(1), 10); + if (!Entity.isValid(v)) { + env.messages.error(HTML, tree, "dc.entity.invalid", name); + } + } else if (!Entity.isValid(name)) { + env.messages.error(HTML, tree, "dc.entity.invalid", name); + } + return null; + } + + // + + // + + @Override + public Void visitStartElement(StartElementTree tree, Void ignore) { + markEnclosingTag(Flag.HAS_ELEMENT); + final Name treeName = tree.getName(); + final HtmlTag t = HtmlTag.get(treeName); + if (t == null) { + env.messages.error(HTML, tree, "dc.tag.unknown", treeName); + } else { + // tag specific checks + switch (t) { + // check for out of sequence headers, such as

      ...

      ...

      + case H1: case H2: case H3: case H4: case H5: case H6: + checkHeader(tree, t); + break; + //

      inside

      +                case P:
      +                    TagStackItem top = tagStack.peek();
      +                    if (top != null && top.tag == HtmlTag.PRE)
      +                        env.messages.warning(HTML, tree, "dc.tag.p.in.pre");
      +                    break;
      +            }
      +
      +            // check that only block tags and inline tags are used,
      +            // and that blocks tags are not used within inline tags
      +            switch (t.blockType) {
      +                case INLINE:
      +                    break;
      +                case BLOCK:
      +                    TagStackItem top = tagStack.peek();
      +                    if (top != null && top.tag != null && top.tag.blockType == HtmlTag.BlockType.INLINE) {
      +                        switch (top.tree.getKind()) {
      +                            case START_ELEMENT: {
      +                                Name name = ((StartElementTree) top.tree).getName();
      +                                env.messages.error(HTML, tree, "dc.tag.not.allowed.inline.element",
      +                                        treeName, name);
      +                                break;
      +                            }
      +                            case LINK:
      +                            case LINK_PLAIN: {
      +                                String name = top.tree.getKind().tagName;
      +                                env.messages.error(HTML, tree, "dc.tag.not.allowed.inline.tag",
      +                                        treeName, name);
      +                                break;
      +                            }
      +                            default:
      +                                env.messages.error(HTML, tree, "dc.tag.not.allowed.inline.other",
      +                                        treeName);
      +                        }
      +                    }
      +                    break;
      +                case OTHER:
      +                    env.messages.error(HTML, tree, "dc.tag.not.allowed", treeName);
      +                    break;
      +                default:
      +                    throw new AssertionError();
      +            }
      +
      +            if (t.flags.contains(HtmlTag.Flag.NO_NEST)) {
      +                for (TagStackItem i: tagStack) {
      +                    if (t == i.tag) {
      +                        env.messages.warning(HTML, tree, "dc.tag.nested.not.allowed", treeName);
      +                        break;
      +                    }
      +                }
      +            }
      +        }
      +
      +        // check for self closing tags, such as 
      +        if (tree.isSelfClosing()) {
      +            env.messages.error(HTML, tree, "dc.tag.self.closing", treeName);
      +        }
      +
      +        try {
      +            TagStackItem parent = tagStack.peek();
      +            TagStackItem top = new TagStackItem(tree, t);
      +            tagStack.push(top);
      +
      +            super.visitStartElement(tree, ignore);
      +
      +            // handle attributes that may or may not have been found in start element
      +            if (t != null) {
      +                switch (t) {
      +                    case CAPTION:
      +                        if (parent != null && parent.tag == HtmlTag.TABLE)
      +                            parent.flags.add(Flag.TABLE_HAS_CAPTION);
      +                        break;
      +
      +                    case IMG:
      +                        if (!top.attrs.contains(HtmlTag.Attr.ALT))
      +                            env.messages.error(ACCESSIBILITY, tree, "dc.no.alt.attr.for.image");
      +                        break;
      +                }
      +            }
      +
      +            return null;
      +        } finally {
      +
      +            if (t == null || t.endKind == HtmlTag.EndKind.NONE)
      +                tagStack.pop();
      +        }
      +    }
      +
      +    private void checkHeader(StartElementTree tree, HtmlTag tag) {
      +        // verify the new tag
      +        if (getHeaderLevel(tag) > getHeaderLevel(currHeaderTag) + 1) {
      +            if (currHeaderTag == null) {
      +                env.messages.error(ACCESSIBILITY, tree, "dc.tag.header.sequence.1", tag);
      +            } else {
      +                env.messages.error(ACCESSIBILITY, tree, "dc.tag.header.sequence.2",
      +                    tag, currHeaderTag);
      +            }
      +        }
      +
      +        currHeaderTag = tag;
      +    }
      +
      +    private int getHeaderLevel(HtmlTag tag) {
      +        if (tag == null)
      +            return 0;
      +        switch (tag) {
      +            case H1: return 1;
      +            case H2: return 2;
      +            case H3: return 3;
      +            case H4: return 4;
      +            case H5: return 5;
      +            case H6: return 6;
      +            default: throw new IllegalArgumentException();
      +        }
      +    }
      +
      +    @Override
      +    public Void visitEndElement(EndElementTree tree, Void ignore) {
      +        final Name treeName = tree.getName();
      +        final HtmlTag t = HtmlTag.get(treeName);
      +        if (t == null) {
      +            env.messages.error(HTML, tree, "dc.tag.unknown", treeName);
      +        } else if (t.endKind == HtmlTag.EndKind.NONE) {
      +            env.messages.error(HTML, tree, "dc.tag.end.not.permitted", treeName);
      +        } else if (tagStack.isEmpty()) {
      +            env.messages.error(HTML, tree, "dc.tag.end.unexpected", treeName);
      +        } else {
      +            while (!tagStack.isEmpty()) {
      +                TagStackItem top = tagStack.peek();
      +                if (t == top.tag) {
      +                    switch (t) {
      +                        case TABLE:
      +                            if (!top.attrs.contains(HtmlTag.Attr.SUMMARY)
      +                                    && !top.flags.contains(Flag.TABLE_HAS_CAPTION)) {
      +                                env.messages.error(ACCESSIBILITY, tree,
      +                                        "dc.no.summary.or.caption.for.table");
      +                            }
      +                    }
      +                    if (t.flags.contains(HtmlTag.Flag.EXPECT_CONTENT)
      +                            && !top.flags.contains(Flag.HAS_TEXT)
      +                            && !top.flags.contains(Flag.HAS_ELEMENT)) {
      +                        env.messages.warning(HTML, tree, "dc.tag.empty", treeName);
      +                    }
      +                    if (t.flags.contains(HtmlTag.Flag.NO_TEXT)
      +                            && top.flags.contains(Flag.HAS_TEXT)) {
      +                        env.messages.error(HTML, tree, "dc.text.not.allowed", treeName);
      +                    }
      +                    tagStack.pop();
      +                    break;
      +                } else if (top.tag == null || top.tag.endKind != HtmlTag.EndKind.REQUIRED) {
      +                    tagStack.pop();
      +                } else {
      +                    boolean found = false;
      +                    for (TagStackItem si: tagStack) {
      +                        if (si.tag == t) {
      +                            found = true;
      +                            break;
      +                        }
      +                    }
      +                    if (found && top.tree.getKind() == DocTree.Kind.START_ELEMENT) {
      +                        env.messages.error(HTML, top.tree, "dc.tag.start.unmatched",
      +                                ((StartElementTree) top.tree).getName());
      +                        tagStack.pop();
      +                    } else {
      +                        env.messages.error(HTML, tree, "dc.tag.end.unexpected", treeName);
      +                        break;
      +                    }
      +                }
      +            }
      +        }
      +
      +        return super.visitEndElement(tree, ignore);
      +    }
      +    // 
      +
      +    // 
      +
      +    @Override @SuppressWarnings("fallthrough")
      +    public Void visitAttribute(AttributeTree tree, Void ignore) {
      +        HtmlTag currTag = tagStack.peek().tag;
      +        if (currTag != null) {
      +            Name name = tree.getName();
      +            HtmlTag.Attr attr = currTag.getAttr(name);
      +            if (attr != null) {
      +                boolean first = tagStack.peek().attrs.add(attr);
      +                if (!first)
      +                    env.messages.error(HTML, tree, "dc.attr.repeated", name);
      +            }
      +            AttrKind k = currTag.getAttrKind(name);
      +            switch (k) {
      +                case OK:
      +                    break;
      +
      +                case INVALID:
      +                    env.messages.error(HTML, tree, "dc.attr.unknown", name);
      +                    break;
      +
      +                case OBSOLETE:
      +                    env.messages.warning(ACCESSIBILITY, tree, "dc.attr.obsolete", name);
      +                    break;
      +
      +                case USE_CSS:
      +                    env.messages.warning(ACCESSIBILITY, tree, "dc.attr.obsolete.use.css", name);
      +                    break;
      +            }
      +
      +            if (attr != null) {
      +                switch (attr) {
      +                    case NAME:
      +                        if (currTag != HtmlTag.A) {
      +                            break;
      +                        }
      +                    // fallthrough
      +                    case ID:
      +                        String value = getAttrValue(tree);
      +                        if (!validName.matcher(value).matches()) {
      +                            env.messages.error(HTML, tree, "dc.invalid.anchor", value);
      +                        }
      +                        if (!foundAnchors.add(value)) {
      +                            env.messages.error(HTML, tree, "dc.anchor.already.defined", value);
      +                        }
      +                        break;
      +
      +                    case HREF:
      +                        if (currTag == HtmlTag.A) {
      +                            String v = getAttrValue(tree);
      +                            if (v == null || v.isEmpty()) {
      +                                env.messages.error(HTML, tree, "dc.attr.lacks.value");
      +                            } else {
      +                                Matcher m = docRoot.matcher(v);
      +                                if (m.matches()) {
      +                                    String rest = m.group(2);
      +                                    if (!rest.isEmpty())
      +                                        checkURI(tree, rest);
      +                                } else {
      +                                    checkURI(tree, v);
      +                                }
      +                            }
      +                        }
      +                        break;
      +                }
      +            }
      +        }
      +
      +        // TODO: basic check on value
      +
      +        return super.visitAttribute(tree, ignore);
      +    }
      +
      +    // http://www.w3.org/TR/html401/types.html#type-name
      +    private static final Pattern validName = Pattern.compile("[A-Za-z][A-Za-z0-9-_:.]*");
      +
      +    // pattern to remove leading {@docRoot}/?
      +    private static final Pattern docRoot = Pattern.compile("(?i)(\\{@docRoot *\\}/?)?(.*)");
      +
      +    private String getAttrValue(AttributeTree tree) {
      +        if (tree.getValue() == null)
      +            return null;
      +
      +        StringWriter sw = new StringWriter();
      +        try {
      +            new DocPretty(sw).print(tree.getValue());
      +        } catch (IOException e) {
      +            // cannot happen
      +        }
      +        // ignore potential use of entities for now
      +        return sw.toString();
      +    }
      +
      +    private void checkURI(AttributeTree tree, String uri) {
      +        try {
      +            URI u = new URI(uri);
      +        } catch (URISyntaxException e) {
      +            env.messages.error(HTML, tree, "dc.invalid.uri", uri);
      +        }
      +    }
      +    // 
      +
      +    // 
      +
      +    @Override
      +    public Void visitAuthor(AuthorTree tree, Void ignore) {
      +        warnIfEmpty(tree, tree.getName());
      +        return super.visitAuthor(tree, ignore);
      +    }
      +
      +    @Override
      +    public Void visitInheritDoc(InheritDocTree tree, Void ignore) {
      +        // TODO: verify on overridden method
      +        foundInheritDoc = true;
      +        return super.visitInheritDoc(tree, ignore);
      +    }
      +
      +    @Override
      +    public Void visitLink(LinkTree tree, Void ignore) {
      +        // simulate inline context on tag stack
      +        HtmlTag t = (tree.getKind() == DocTree.Kind.LINK)
      +                ? HtmlTag.CODE : HtmlTag.SPAN;
      +        tagStack.push(new TagStackItem(tree, t));
      +        try {
      +            return super.visitLink(tree, ignore);
      +        } finally {
      +            tagStack.pop();
      +        }
      +    }
      +
      +    @Override
      +    public Void visitParam(ParamTree tree, Void ignore) {
      +        boolean typaram = tree.isTypeParameter();
      +        IdentifierTree nameTree = tree.getName();
      +        Element e = env.currElement;
      +        switch (e.getKind()) {
      +            case METHOD: case CONSTRUCTOR: {
      +                ExecutableElement ee = (ExecutableElement) e;
      +                checkParamDeclared(nameTree, typaram ? ee.getTypeParameters() : ee.getParameters());
      +                break;
      +            }
      +
      +            case CLASS: case INTERFACE: {
      +                TypeElement te = (TypeElement) e;
      +                if (typaram) {
      +                    checkParamDeclared(nameTree, te.getTypeParameters());
      +                } else {
      +                    env.messages.error(REFERENCE, tree, "dc.invalid.param");
      +                }
      +                break;
      +            }
      +
      +            default:
      +                env.messages.error(REFERENCE, tree, "dc.invalid.param");
      +                break;
      +        }
      +        warnIfEmpty(tree, tree.getDescription());
      +        return super.visitParam(tree, ignore);
      +    }
      +    // where
      +    private void checkParamDeclared(IdentifierTree nameTree, List list) {
      +        Name name = nameTree.getName();
      +        boolean found = false;
      +        for (Element e: list) {
      +            if (name.equals(e.getSimpleName())) {
      +                foundParams.add(e);
      +                found = true;
      +            }
      +        }
      +        if (!found)
      +            env.messages.error(REFERENCE, nameTree, "dc.param.name.not.found");
      +    }
      +
      +    private void checkParamsDocumented(List list) {
      +        if (foundInheritDoc)
      +            return;
      +
      +        for (Element e: list) {
      +            if (!foundParams.contains(e)) {
      +                CharSequence paramName = (e.getKind() == ElementKind.TYPE_PARAMETER)
      +                        ? "<" + e.getSimpleName() + ">"
      +                        : e.getSimpleName();
      +                reportMissing("dc.missing.param", paramName);
      +            }
      +        }
      +    }
      +
      +    @Override
      +    public Void visitReference(ReferenceTree tree, Void ignore) {
      +        Element e = env.trees.getElement(env.currPath, tree);
      +        if (e == null)
      +            env.messages.error(REFERENCE, tree, "dc.ref.not.found");
      +        return super.visitReference(tree, ignore);
      +    }
      +
      +    @Override
      +    public Void visitReturn(ReturnTree tree, Void ignore) {
      +        Element e = env.trees.getElement(env.currPath);
      +        if (e.getKind() != ElementKind.METHOD
      +                || ((ExecutableElement) e).getReturnType().getKind() == TypeKind.VOID)
      +            env.messages.error(REFERENCE, tree, "dc.invalid.return");
      +        foundReturn = true;
      +        warnIfEmpty(tree, tree.getDescription());
      +        return super.visitReturn(tree, ignore);
      +    }
      +
      +    @Override
      +    public Void visitSerialData(SerialDataTree tree, Void ignore) {
      +        warnIfEmpty(tree, tree.getDescription());
      +        return super.visitSerialData(tree, ignore);
      +    }
      +
      +    @Override
      +    public Void visitSerialField(SerialFieldTree tree, Void ignore) {
      +        warnIfEmpty(tree, tree.getDescription());
      +        return super.visitSerialField(tree, ignore);
      +    }
      +
      +    @Override
      +    public Void visitSince(SinceTree tree, Void ignore) {
      +        warnIfEmpty(tree, tree.getBody());
      +        return super.visitSince(tree, ignore);
      +    }
      +
      +    @Override
      +    public Void visitThrows(ThrowsTree tree, Void ignore) {
      +        ReferenceTree exName = tree.getExceptionName();
      +        Element ex = env.trees.getElement(env.currPath, exName);
      +        if (ex == null) {
      +            env.messages.error(REFERENCE, tree, "dc.ref.not.found");
      +        } else if (ex.asType().getKind() == TypeKind.DECLARED
      +                && env.types.isAssignable(ex.asType(), env.java_lang_Throwable)) {
      +            switch (env.currElement.getKind()) {
      +                case CONSTRUCTOR:
      +                case METHOD:
      +                    if (isCheckedException(ex.asType())) {
      +                        ExecutableElement ee = (ExecutableElement) env.currElement;
      +                        checkThrowsDeclared(exName, ex.asType(), ee.getThrownTypes());
      +                    }
      +                    break;
      +                default:
      +                    env.messages.error(REFERENCE, tree, "dc.invalid.throws");
      +            }
      +        } else {
      +            env.messages.error(REFERENCE, tree, "dc.invalid.throws");
      +        }
      +        warnIfEmpty(tree, tree.getDescription());
      +        return scan(tree.getDescription(), ignore);
      +    }
      +
      +    private void checkThrowsDeclared(ReferenceTree tree, TypeMirror t, List list) {
      +        boolean found = false;
      +        for (TypeMirror tl : list) {
      +            if (env.types.isAssignable(t, tl)) {
      +                foundThrows.add(tl);
      +                found = true;
      +            }
      +        }
      +        if (!found)
      +            env.messages.error(REFERENCE, tree, "dc.exception.not.thrown", t);
      +    }
      +
      +    private void checkThrowsDocumented(List list) {
      +        if (foundInheritDoc)
      +            return;
      +
      +        for (TypeMirror tl: list) {
      +            if (isCheckedException(tl) && !foundThrows.contains(tl))
      +                reportMissing("dc.missing.throws", tl);
      +        }
      +    }
      +
      +    @Override
      +    public Void visitVersion(VersionTree tree, Void ignore) {
      +        warnIfEmpty(tree, tree.getBody());
      +        return super.visitVersion(tree, ignore);
      +    }
      +
      +    @Override
      +    public Void visitErroneous(ErroneousTree tree, Void ignore) {
      +        env.messages.error(SYNTAX, tree, null, tree.getDiagnostic().getMessage(null));
      +        return null;
      +    }
      +    // 
      +
      +    // 
      +
      +    private boolean isCheckedException(TypeMirror t) {
      +        return !(env.types.isAssignable(t, env.java_lang_Error)
      +                || env.types.isAssignable(t, env.java_lang_RuntimeException));
      +    }
      +
      +    private boolean isSynthetic() {
      +        switch (env.currElement.getKind()) {
      +            case CONSTRUCTOR:
      +                // A synthetic default constructor has the same pos as the
      +                // enclosing class
      +                TreePath p = env.currPath;
      +                return env.getPos(p) == env.getPos(p.getParentPath());
      +        }
      +        return false;
      +    }
      +
      +    void markEnclosingTag(Flag flag) {
      +        TagStackItem top = tagStack.peek();
      +        if (top != null)
      +            top.flags.add(flag);
      +    }
      +
      +    String toString(TreePath p) {
      +        StringBuilder sb = new StringBuilder("TreePath[");
      +        toString(p, sb);
      +        sb.append("]");
      +        return sb.toString();
      +    }
      +
      +    void toString(TreePath p, StringBuilder sb) {
      +        TreePath parent = p.getParentPath();
      +        if (parent != null) {
      +            toString(parent, sb);
      +            sb.append(",");
      +        }
      +       sb.append(p.getLeaf().getKind()).append(":").append(env.getPos(p)).append(":S").append(env.getStartPos(p));
      +    }
      +
      +    void warnIfEmpty(DocTree tree, List list) {
      +        for (DocTree d: list) {
      +            switch (d.getKind()) {
      +                case TEXT:
      +                    if (!((TextTree) d).getBody().trim().isEmpty())
      +                        return;
      +                    break;
      +                default:
      +                    return;
      +            }
      +        }
      +        env.messages.warning(SYNTAX, tree, "dc.empty", tree.getKind().tagName);
      +    }
      +    // 
      +
      +}
      diff --git a/langtools/src/share/classes/com/sun/tools/doclint/DocLint.java b/langtools/src/share/classes/com/sun/tools/doclint/DocLint.java
      new file mode 100644
      index 00000000000..20813265bf8
      --- /dev/null
      +++ b/langtools/src/share/classes/com/sun/tools/doclint/DocLint.java
      @@ -0,0 +1,376 @@
      +/*
      + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
      + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      + *
      + * This code is free software; you can redistribute it and/or modify it
      + * under the terms of the GNU General Public License version 2 only, as
      + * published by the Free Software Foundation.  Oracle designates this
      + * particular file as subject to the "Classpath" exception as provided
      + * by Oracle in the LICENSE file that accompanied this code.
      + *
      + * This code is distributed in the hope that it will be useful, but WITHOUT
      + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
      + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      + * version 2 for more details (a copy is included in the LICENSE file that
      + * accompanied this code).
      + *
      + * You should have received a copy of the GNU General Public License version
      + * 2 along with this work; if not, write to the Free Software Foundation,
      + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
      + *
      + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
      + * or visit www.oracle.com if you need additional information or have any
      + * questions.
      + */
      +
      +package com.sun.tools.doclint;
      +
      +import java.io.File;
      +import java.io.IOException;
      +import java.io.PrintWriter;
      +import java.util.ArrayList;
      +import java.util.List;
      +
      +import javax.lang.model.element.Name;
      +import javax.tools.StandardLocation;
      +
      +import com.sun.source.doctree.DocCommentTree;
      +import com.sun.source.tree.ClassTree;
      +import com.sun.source.tree.CompilationUnitTree;
      +import com.sun.source.tree.MethodTree;
      +import com.sun.source.tree.Tree;
      +import com.sun.source.tree.VariableTree;
      +import com.sun.source.util.JavacTask;
      +import com.sun.source.util.Plugin;
      +import com.sun.source.util.TaskEvent;
      +import com.sun.source.util.TaskListener;
      +import com.sun.source.util.TreePath;
      +import com.sun.source.util.TreePathScanner;
      +import com.sun.tools.javac.api.JavacTaskImpl;
      +import com.sun.tools.javac.api.JavacTool;
      +import com.sun.tools.javac.file.JavacFileManager;
      +import com.sun.tools.javac.main.JavaCompiler;
      +import com.sun.tools.javac.util.Context;
      +
      +/**
      + * Multi-function entry point for the doc check utility.
      + *
      + * This class can be invoked in the following ways:
      + * 
        + *
      • From the command line + *
      • From javac, as a plugin + *
      • Directly, via a simple API + *
      + * + *

      This is NOT part of any supported API. + * If you write code that depends on this, you do so at your own + * risk. This code and its internal interfaces are subject to change + * or deletion without notice.

      + */ +public class DocLint implements Plugin { + + public static final String XMSGS_OPTION = "-Xmsgs"; + public static final String XMSGS_CUSTOM_PREFIX = "-Xmsgs:"; + private static final String STATS = "-stats"; + + // + public static void main(String... args) { + try { + new DocLint().run(args); + } catch (BadArgs e) { + System.err.println(e.getMessage()); + System.exit(1); + } catch (IOException e) { + System.err.println(e); + System.exit(2); + } + } + + // + + // + + public static class BadArgs extends Exception { + private static final long serialVersionUID = 0; + BadArgs(String code, Object... args) { + this.code = code; + this.args = args; + } + + final String code; + final Object[] args; + } + + /** + * Simple API entry point. + */ + public void run(String... args) throws BadArgs, IOException { + PrintWriter out = new PrintWriter(System.out); + try { + run(out, args); + } finally { + out.flush(); + } + } + + public void run(PrintWriter out, String... args) throws BadArgs, IOException { + env = new Env(); + processArgs(args); + + if (needHelp) + showHelp(out); + + if (javacFiles.isEmpty()) { + if (!needHelp) + System.out.println("no files given"); + } + + JavacTool tool = JavacTool.create(); + + JavacFileManager fm = new JavacFileManager(new Context(), false, null); + fm.setSymbolFileEnabled(false); + fm.setLocation(StandardLocation.PLATFORM_CLASS_PATH, javacBootClassPath); + fm.setLocation(StandardLocation.CLASS_PATH, javacClassPath); + fm.setLocation(StandardLocation.SOURCE_PATH, javacSourcePath); + + JavacTask task = tool.getTask(out, fm, null, javacOpts, null, + fm.getJavaFileObjectsFromFiles(javacFiles)); + Iterable units = task.parse(); + ((JavacTaskImpl) task).enter(); + + env.init(task); + checker = new Checker(env); + + DeclScanner ds = new DeclScanner() { + @Override + void visitDecl(Tree tree, Name name) { + TreePath p = getCurrentPath(); + DocCommentTree dc = env.trees.getDocCommentTree(p); + + checker.scan(dc, p); + } + }; + + ds.scan(units, null); + + reportStats(out); + + Context ctx = ((JavacTaskImpl) task).getContext(); + JavaCompiler c = JavaCompiler.instance(ctx); + c.printCount("error", c.errorCount()); + c.printCount("warn", c.warningCount()); + } + + void processArgs(String... args) throws BadArgs { + javacOpts = new ArrayList(); + javacFiles = new ArrayList(); + + if (args.length == 0) + needHelp = true; + + for (int i = 0; i < args.length; i++) { + String arg = args[i]; + if (arg.matches("-Xmax(errs|warns)") && i + 1 < args.length) { + if (args[++i].matches("[0-9]+")) { + javacOpts.add(arg); + javacOpts.add(args[i]); + } else { + throw new BadArgs("dc.bad.value.for.option", arg, args[i]); + } + } else if (arg.equals(STATS)) { + env.messages.setStatsEnabled(true); + } else if (arg.matches("-bootclasspath") && i + 1 < args.length) { + javacBootClassPath = splitPath(args[++i]); + } else if (arg.matches("-classpath") && i + 1 < args.length) { + javacClassPath = splitPath(args[++i]); + } else if (arg.matches("-sourcepath") && i + 1 < args.length) { + javacSourcePath = splitPath(args[++i]); + } else if (arg.equals(XMSGS_OPTION)) { + env.messages.setOptions(null); + } else if (arg.startsWith(XMSGS_CUSTOM_PREFIX)) { + env.messages.setOptions(arg.substring(arg.indexOf(":") + 1)); + } else if (arg.equals("-h") || arg.equals("-help") || arg.equals("--help") + || arg.equals("-?") || arg.equals("-usage")) { + needHelp = true; + } else if (arg.startsWith("-")) { + throw new BadArgs("dc.bad.option", arg); + } else { + while (i < args.length) + javacFiles.add(new File(args[i++])); + } + } + } + + void showHelp(PrintWriter out) { + out.println("Usage:"); + out.println(" doclint [options] source-files..."); + out.println(""); + out.println("Options:"); + out.println(" -Xmsgs "); + out.println(" Same as -Xmsgs:all"); + out.println(" -Xmsgs:values"); + out.println(" Specify categories of issues to be checked, where 'values'"); + out.println(" is a comma-separated list of any of the following:"); + out.println(" reference show places where comments contain incorrect"); + out.println(" references to Java source code elements"); + out.println(" syntax show basic syntax errors within comments"); + out.println(" html show issues with HTML tags and attributes"); + out.println(" accessibility show issues for accessibility"); + out.println(" missing show issues with missing documentation"); + out.println(" all all of the above"); + out.println(" Precede a value with '-' to negate it"); + out.println(" Categories may be qualified by one of:"); + out.println(" /public /protected /package /private"); + out.println(" For positive categories (not beginning with '-')"); + out.println(" the qualifier applies to that access level and above."); + out.println(" For negative categories (beginning with '-')"); + out.println(" the qualifier applies to that access level and below."); + out.println(" If a qualifier is missing, the category applies to"); + out.println(" all access levels."); + out.println(" For example, -Xmsgs:all,-syntax/private"); + out.println(" This will enable all messages, except syntax errors"); + out.println(" in the doc comments of private methods."); + out.println(" If no -Xmsgs options are provided, the default is"); + out.println(" equivalent to -Xmsgs:all/protected, meaning that"); + out.println(" all messages are reported for protected and public"); + out.println(" declarations only. "); + out.println(" -h -help --help -usage -?"); + out.println(" Show this message."); + out.println(""); + out.println("The following javac options are also supported"); + out.println(" -bootclasspath, -classpath, -sourcepath, -Xmaxerrs, -Xmaxwarns"); + out.println(""); + out.println("To run doclint on part of a project, put the compiled classes for your"); + out.println("project on the classpath (or bootclasspath), then specify the source files"); + out.println("to be checked on the command line."); + } + + List splitPath(String path) { + List files = new ArrayList(); + for (String f: path.split(File.separator)) { + if (f.length() > 0) + files.add(new File(f)); + } + return files; + } + + List javacBootClassPath; + List javacClassPath; + List javacSourcePath; + List javacOpts; + List javacFiles; + boolean needHelp = false; + + // + + // + + @Override + public String getName() { + return "doclint"; + } + + @Override + public void init(JavacTask task, String... args) { + init(task, args, true); + } + + // + + // + + public void init(JavacTask task, String[] args, boolean addTaskListener) { + env = new Env(); + for (int i = 0; i < args.length; i++) { + String arg = args[i]; + if (arg.equals(XMSGS_OPTION)) { + env.messages.setOptions(null); + } else if (arg.startsWith(XMSGS_CUSTOM_PREFIX)) { + env.messages.setOptions(arg.substring(arg.indexOf(":") + 1)); + } else + throw new IllegalArgumentException(arg); + } + env.init(task); + + checker = new Checker(env); + + if (addTaskListener) { + final DeclScanner ds = new DeclScanner() { + @Override + void visitDecl(Tree tree, Name name) { + TreePath p = getCurrentPath(); + DocCommentTree dc = env.trees.getDocCommentTree(p); + + checker.scan(dc, p); + } + }; + + TaskListener tl = new TaskListener() { + @Override + public void started(TaskEvent e) { + return; + } + + @Override + public void finished(TaskEvent e) { + switch (e.getKind()) { + case ENTER: + ds.scan(e.getCompilationUnit(), null); + } + } + }; + + task.addTaskListener(tl); + } + } + + public void scan(TreePath p) { + DocCommentTree dc = env.trees.getDocCommentTree(p); + checker.scan(dc, p); + } + + public void reportStats(PrintWriter out) { + env.messages.reportStats(out); + } + + // + + Env env; + Checker checker; + + public static boolean isValidOption(String opt) { + if (opt.equals(XMSGS_OPTION)) + return true; + if (opt.startsWith(XMSGS_CUSTOM_PREFIX)) + return Messages.Options.isValidOptions(opt.substring(XMSGS_CUSTOM_PREFIX.length())); + return false; + } + + // + + static abstract class DeclScanner extends TreePathScanner { + abstract void visitDecl(Tree tree, Name name); + + @Override + public Void visitClass(ClassTree tree, Void ignore) { + visitDecl(tree, tree.getSimpleName()); + return super.visitClass(tree, ignore); + } + + @Override + public Void visitMethod(MethodTree tree, Void ignore) { + visitDecl(tree, tree.getName()); + //return super.visitMethod(tree, ignore); + return null; + } + + @Override + public Void visitVariable(VariableTree tree, Void ignore) { + visitDecl(tree, tree.getName()); + return super.visitVariable(tree, ignore); + } + } + + // + +} diff --git a/langtools/src/share/classes/com/sun/tools/doclint/Entity.java b/langtools/src/share/classes/com/sun/tools/doclint/Entity.java new file mode 100644 index 00000000000..24c192e8a58 --- /dev/null +++ b/langtools/src/share/classes/com/sun/tools/doclint/Entity.java @@ -0,0 +1,326 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.tools.doclint; + +import java.util.HashMap; +import java.util.Map; + +/** + * Table of entities defined in HTML 4.01. + * + *

      Derived from + * Character entity references in HTML 4. + * + * The name of the member follows the name of the entity, + * except when it clashes with a keyword, in which case + * it is prefixed by '_'. + * + *

      This is NOT part of any supported API. + * If you write code that depends on this, you do so at your own + * risk. This code and its internal interfaces are subject to change + * or deletion without notice.

      + */ +enum Entity { + nbsp(160), + iexcl(161), + cent(162), + pound(163), + curren(164), + yen(165), + brvbar(166), + sect(167), + uml(168), + copy(169), + ordf(170), + laquo(171), + not(172), + shy(173), + reg(174), + macr(175), + deg(176), + plusmn(177), + sup2(178), + sup3(179), + acute(180), + micro(181), + para(182), + middot(183), + cedil(184), + sup1(185), + ordm(186), + raquo(187), + frac14(188), + frac12(189), + frac34(190), + iquest(191), + Agrave(192), + Aacute(193), + Acirc(194), + Atilde(195), + Auml(196), + Aring(197), + AElig(198), + Ccedil(199), + Egrave(200), + Eacute(201), + Ecirc(202), + Euml(203), + Igrave(204), + Iacute(205), + Icirc(206), + Iuml(207), + ETH(208), + Ntilde(209), + Ograve(210), + Oacute(211), + Ocirc(212), + Otilde(213), + Ouml(214), + times(215), + Oslash(216), + Ugrave(217), + Uacute(218), + Ucirc(219), + Uuml(220), + Yacute(221), + THORN(222), + szlig(223), + agrave(224), + aacute(225), + acirc(226), + atilde(227), + auml(228), + aring(229), + aelig(230), + ccedil(231), + egrave(232), + eacute(233), + ecirc(234), + euml(235), + igrave(236), + iacute(237), + icirc(238), + iuml(239), + eth(240), + ntilde(241), + ograve(242), + oacute(243), + ocirc(244), + otilde(245), + ouml(246), + divide(247), + oslash(248), + ugrave(249), + uacute(250), + ucirc(251), + uuml(252), + yacute(253), + thorn(254), + yuml(255), + fnof(402), + Alpha(913), + Beta(914), + Gamma(915), + Delta(916), + Epsilon(917), + Zeta(918), + Eta(919), + Theta(920), + Iota(921), + Kappa(922), + Lambda(923), + Mu(924), + Nu(925), + Xi(926), + Omicron(927), + Pi(928), + Rho(929), + Sigma(931), + Tau(932), + Upsilon(933), + Phi(934), + Chi(935), + Psi(936), + Omega(937), + alpha(945), + beta(946), + gamma(947), + delta(948), + epsilon(949), + zeta(950), + eta(951), + theta(952), + iota(953), + kappa(954), + lambda(955), + mu(956), + nu(957), + xi(958), + omicron(959), + pi(960), + rho(961), + sigmaf(962), + sigma(963), + tau(964), + upsilon(965), + phi(966), + chi(967), + psi(968), + omega(969), + thetasym(977), + upsih(978), + piv(982), + bull(8226), + hellip(8230), + prime(8242), + Prime(8243), + oline(8254), + frasl(8260), + weierp(8472), + image(8465), + real(8476), + trade(8482), + alefsym(8501), + larr(8592), + uarr(8593), + rarr(8594), + darr(8595), + harr(8596), + crarr(8629), + lArr(8656), + uArr(8657), + rArr(8658), + dArr(8659), + hArr(8660), + forall(8704), + part(8706), + exist(8707), + empty(8709), + nabla(8711), + isin(8712), + notin(8713), + ni(8715), + prod(8719), + sum(8721), + minus(8722), + lowast(8727), + radic(8730), + prop(8733), + infin(8734), + ang(8736), + and(8743), + or(8744), + cap(8745), + cup(8746), + _int(8747), + there4(8756), + sim(8764), + cong(8773), + asymp(8776), + ne(8800), + equiv(8801), + le(8804), + ge(8805), + sub(8834), + sup(8835), + nsub(8836), + sube(8838), + supe(8839), + oplus(8853), + otimes(8855), + perp(8869), + sdot(8901), + lceil(8968), + rceil(8969), + lfloor(8970), + rfloor(8971), + lang(9001), + rang(9002), + loz(9674), + spades(9824), + clubs(9827), + hearts(9829), + diams(9830), + quot(34), + amp(38), + lt(60), + gt(62), + OElig(338), + oelig(339), + Scaron(352), + scaron(353), + Yuml(376), + circ(710), + tilde(732), + ensp(8194), + emsp(8195), + thinsp(8201), + zwnj(8204), + zwj(8205), + lrm(8206), + rlm(8207), + ndash(8211), + mdash(8212), + lsquo(8216), + rsquo(8217), + sbquo(8218), + ldquo(8220), + rdquo(8221), + bdquo(8222), + dagger(8224), + Dagger(8225), + permil(8240), + lsaquo(8249), + rsaquo(8250), + euro(8364); + + int code; + + private Entity(int code) { + this.code = code; + } + + static boolean isValid(String name) { + return names.containsKey(name); + } + + static boolean isValid(int code) { + // allow numeric codes for standard ANSI characters + return codes.containsKey(code) || ( 32 <= code && code < 2127); + } + + private static final Map names = new HashMap(); + private static final Map codes = new HashMap(); + static { + for (Entity e: values()) { + String name = e.name(); + int code = e.code; + if (name.startsWith("_")) name = name.substring(1); + names.put(name, e); + codes.put(code, e); + } + } +} diff --git a/langtools/src/share/classes/com/sun/tools/doclint/Env.java b/langtools/src/share/classes/com/sun/tools/doclint/Env.java new file mode 100644 index 00000000000..12947f02b0e --- /dev/null +++ b/langtools/src/share/classes/com/sun/tools/doclint/Env.java @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.tools.doclint; + + +import java.util.Set; + +import javax.lang.model.element.Element; +import javax.lang.model.element.ExecutableElement; +import javax.lang.model.element.Modifier; +import javax.lang.model.type.TypeMirror; +import javax.lang.model.util.Elements; +import javax.lang.model.util.Types; + +import com.sun.source.doctree.DocCommentTree; +import com.sun.source.util.DocTrees; +import com.sun.source.util.JavacTask; +import com.sun.source.util.SourcePositions; +import com.sun.source.util.TreePath; +import com.sun.tools.javac.model.JavacTypes; +import com.sun.tools.javac.tree.JCTree; + +/** + * Utility container for current execution environment, + * providing the current declaration and its doc comment. + * + *

      This is NOT part of any supported API. + * If you write code that depends on this, you do so at your own + * risk. This code and its internal interfaces are subject to change + * or deletion without notice.

      + */ +public class Env { + /** + * Access kinds for declarations. + */ + public enum AccessKind { + PRIVATE, + PACKAGE, + PROTECTED, + PUBLIC; + + static boolean accepts(String opt) { + for (AccessKind g: values()) + if (opt.equals(g.name().toLowerCase())) return true; + return false; + } + + static AccessKind of(Set mods) { + if (mods.contains(Modifier.PUBLIC)) + return AccessKind.PUBLIC; + else if (mods.contains(Modifier.PROTECTED)) + return AccessKind.PROTECTED; + else if (mods.contains(Modifier.PRIVATE)) + return AccessKind.PRIVATE; + else + return AccessKind.PACKAGE; + } + }; + + /** Message handler. */ + final Messages messages; + + // Utility classes + DocTrees trees; + Elements elements; + Types types; + + // Types used when analysing doc comments. + TypeMirror java_lang_Error; + TypeMirror java_lang_RuntimeException; + TypeMirror java_lang_Throwable; + TypeMirror java_lang_Void; + + /** The path for the declaration containing the comment currently being analyzed. */ + TreePath currPath; + /** The element for the declaration containing the comment currently being analyzed. */ + Element currElement; + /** The comment current being analyzed. */ + DocCommentTree currDocComment; + /** + * The access kind of the declaration containing the comment currently being analyzed. + * This is the minimum (most restrictive) access kind of the declaration iteself + * and that of its containers. For example, a public method in a private class is + * noted as private. + */ + AccessKind currAccess; + /** The set of methods, if any, that the current declaration overrides. */ + Set currOverriddenMethods; + + Env() { + messages = new Messages(this); + } + + void init(JavacTask task) { + init(DocTrees.instance(task), task.getElements(), task.getTypes()); + } + + void init(DocTrees trees, Elements elements, Types types) { + this.trees = trees; + this.elements = elements; + this.types = types; + java_lang_Error = elements.getTypeElement("java.lang.Error").asType(); + java_lang_RuntimeException = elements.getTypeElement("java.lang.RuntimeException").asType(); + java_lang_Throwable = elements.getTypeElement("java.lang.Throwable").asType(); + java_lang_Void = elements.getTypeElement("java.lang.Void").asType(); + } + + /** Set the current declaration and its doc comment. */ + void setCurrent(TreePath path, DocCommentTree comment) { + currPath = path; + currDocComment = comment; + currElement = trees.getElement(currPath); + currOverriddenMethods = ((JavacTypes) types).getOverriddenMethods(currElement); + + AccessKind ak = null; + for (TreePath p = path; p != null; p = p.getParentPath()) { + Element e = trees.getElement(p); + if (e != null) { + ak = min(ak, AccessKind.of(e.getModifiers())); + } + } + currAccess = ak; + } + + AccessKind getAccessKind() { + return currAccess; + } + + long getPos(TreePath p) { + return ((JCTree) p.getLeaf()).pos; + } + + long getStartPos(TreePath p) { + SourcePositions sp = trees.getSourcePositions(); + return sp.getStartPosition(p.getCompilationUnit(), p.getLeaf()); + } + + private > T min(T item1, T item2) { + return (item1 == null) ? item2 + : (item2 == null) ? item1 + : item1.compareTo(item2) <= 0 ? item1 : item2; + } +} diff --git a/langtools/src/share/classes/com/sun/tools/doclint/HtmlTag.java b/langtools/src/share/classes/com/sun/tools/doclint/HtmlTag.java new file mode 100644 index 00000000000..e21d400f067 --- /dev/null +++ b/langtools/src/share/classes/com/sun/tools/doclint/HtmlTag.java @@ -0,0 +1,356 @@ +/* + * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.tools.doclint; + +import java.util.Set; +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +import javax.lang.model.element.Name; + +import static com.sun.tools.doclint.HtmlTag.Attr.*; + +/** + * Enum representing HTML tags. + * + * The intent of this class is to embody the semantics of W3C HTML 4.01 + * to the extent supported/used by javadoc. + * + * This is derivative of com.sun.tools.doclets.formats.html.markup.HtmlTag. + * Eventually, these two should be merged back together, and possibly made + * public. + * + * @see HTML 4.01 Specification + * @author Bhavesh Patel + * @author Jonathan Gibbons (revised) + */ +public enum HtmlTag { + A(BlockType.INLINE, EndKind.REQUIRED, + attrs(AttrKind.OK, HREF, TARGET, NAME)), + + B(BlockType.INLINE, EndKind.REQUIRED, + EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), + + BLOCKQUOTE, + + BODY(BlockType.OTHER, EndKind.REQUIRED), + + BR(BlockType.INLINE, EndKind.NONE, + attrs(AttrKind.USE_CSS, CLEAR)), + + CAPTION(EnumSet.of(Flag.EXPECT_CONTENT)), + + CENTER, + + CITE(BlockType.INLINE, EndKind.REQUIRED, + EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), + + CODE(BlockType.INLINE, EndKind.REQUIRED, + EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), + + DD(BlockType.BLOCK, EndKind.OPTIONAL, + EnumSet.of(Flag.EXPECT_CONTENT)), + + DIV, + + DL(BlockType.BLOCK, EndKind.REQUIRED, + EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_TEXT), + attrs(AttrKind.USE_CSS, COMPACT)), + + DT(BlockType.BLOCK, EndKind.OPTIONAL, + EnumSet.of(Flag.EXPECT_CONTENT)), + + EM(BlockType.INLINE, EndKind.REQUIRED, + EnumSet.of(Flag.NO_NEST)), + + FONT(BlockType.INLINE, EndKind.REQUIRED, // tag itself is deprecated + EnumSet.of(Flag.EXPECT_CONTENT), + attrs(AttrKind.USE_CSS, SIZE, COLOR, FACE)), + + FRAME(BlockType.OTHER, EndKind.NONE), + + FRAMESET(BlockType.OTHER, EndKind.REQUIRED), + + H1, + H2, + H3, + H4, + H5, + H6, + + HEAD(BlockType.OTHER, EndKind.REQUIRED), + + HR(BlockType.BLOCK, EndKind.NONE), + + HTML(BlockType.OTHER, EndKind.REQUIRED), + + I(BlockType.INLINE, EndKind.REQUIRED, + EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), + + IMG(BlockType.INLINE, EndKind.NONE, + attrs(AttrKind.OK, SRC, ALT, HEIGHT, WIDTH), + attrs(AttrKind.OBSOLETE, NAME), + attrs(AttrKind.USE_CSS, ALIGN, HSPACE, VSPACE, BORDER)), + + LI(BlockType.BLOCK, EndKind.OPTIONAL), + + LINK(BlockType.OTHER, EndKind.NONE), + + MENU, + + META(BlockType.OTHER, EndKind.NONE), + + NOFRAMES(BlockType.OTHER, EndKind.REQUIRED), + + NOSCRIPT(BlockType.OTHER, EndKind.REQUIRED), + + OL(BlockType.BLOCK, EndKind.REQUIRED, + EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_TEXT), + attrs(AttrKind.USE_CSS, START, TYPE)), + + P(BlockType.BLOCK, EndKind.OPTIONAL, + EnumSet.of(Flag.EXPECT_CONTENT), + attrs(AttrKind.USE_CSS, ALIGN)), + + PRE(EnumSet.of(Flag.EXPECT_CONTENT)), + + SCRIPT(BlockType.OTHER, EndKind.REQUIRED), + + SMALL(BlockType.INLINE, EndKind.REQUIRED), + + SPAN(BlockType.INLINE, EndKind.REQUIRED, + EnumSet.of(Flag.EXPECT_CONTENT)), + + STRONG(BlockType.INLINE, EndKind.REQUIRED, + EnumSet.of(Flag.EXPECT_CONTENT)), + + SUB(BlockType.INLINE, EndKind.REQUIRED, + EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), + + SUP(BlockType.INLINE, EndKind.REQUIRED, + EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), + + TABLE(BlockType.BLOCK, EndKind.REQUIRED, + EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_TEXT), + attrs(AttrKind.OK, SUMMARY, Attr.FRAME, RULES, BORDER, + CELLPADDING, CELLSPACING), + attrs(AttrKind.USE_CSS, ALIGN, WIDTH, BGCOLOR)), + + TBODY(BlockType.BLOCK, EndKind.REQUIRED, + EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_TEXT), + attrs(AttrKind.OK, ALIGN, CHAR, CHAROFF, VALIGN)), + + TD(BlockType.BLOCK, EndKind.OPTIONAL, + attrs(AttrKind.OK, COLSPAN, ROWSPAN, HEADERS, SCOPE, ABBR, AXIS, + ALIGN, CHAR, CHAROFF, VALIGN), + attrs(AttrKind.USE_CSS, WIDTH, BGCOLOR, HEIGHT, NOWRAP)), + + TFOOT(BlockType.BLOCK, EndKind.REQUIRED, + attrs(AttrKind.OK, ALIGN, CHAR, CHAROFF, VALIGN)), + + TH(BlockType.BLOCK, EndKind.OPTIONAL, + attrs(AttrKind.OK, COLSPAN, ROWSPAN, HEADERS, SCOPE, ABBR, AXIS, + ALIGN, CHAR, CHAROFF, VALIGN), + attrs(AttrKind.USE_CSS, WIDTH, BGCOLOR, HEIGHT, NOWRAP)), + + THEAD(BlockType.BLOCK, EndKind.REQUIRED, + attrs(AttrKind.OK, ALIGN, CHAR, CHAROFF, VALIGN)), + + TITLE(BlockType.OTHER, EndKind.REQUIRED), + + TR(BlockType.BLOCK, EndKind.OPTIONAL, + EnumSet.of(Flag.NO_TEXT), + attrs(AttrKind.OK, ALIGN, CHAR, CHAROFF, VALIGN), + attrs(AttrKind.USE_CSS, BGCOLOR)), + + TT(BlockType.INLINE, EndKind.REQUIRED, + EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), + + U(BlockType.INLINE, EndKind.REQUIRED, + EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), + + UL(BlockType.BLOCK, EndKind.REQUIRED, + EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_TEXT), + attrs(AttrKind.USE_CSS, COMPACT, TYPE)), + + VAR(BlockType.INLINE, EndKind.REQUIRED); + + /** + * Enum representing the type of HTML element. + */ + public static enum BlockType { + BLOCK, + INLINE, + OTHER; + } + + /** + * Enum representing HTML end tag requirement. + */ + public static enum EndKind { + NONE, + OPTIONAL, + REQUIRED; + } + + public static enum Flag { + EXPECT_CONTENT, + NO_NEST, + NO_TEXT + } + + public static enum Attr { + ABBR, + ALIGN, + ALT, + AXIS, + BGCOLOR, + BORDER, + CELLSPACING, + CELLPADDING, + CHAR, + CHAROFF, + CLEAR, + CLASS, + COLOR, + COLSPAN, + COMPACT, + FACE, + FRAME, + HEADERS, + HEIGHT, + HREF, + HSPACE, + ID, + NAME, + NOWRAP, + REVERSED, + ROWSPAN, + RULES, + SCOPE, + SIZE, + SPACE, + SRC, + START, + STYLE, + SUMMARY, + TARGET, + TYPE, + VALIGN, + VSPACE, + WIDTH; + + public String getText() { + return name().toLowerCase(); + } + + static final Map index = new HashMap(); + static { + for (Attr t: values()) { + index.put(t.name().toLowerCase(), t); + } + } + } + + public static enum AttrKind { + INVALID, + OBSOLETE, + USE_CSS, + OK + } + + // This class exists to avoid warnings from using parameterized vararg type + // Map in signature of HtmlTag constructor. + private static class AttrMap extends EnumMap { + private static final long serialVersionUID = 0; + AttrMap() { + super(Attr.class); + } + } + + + public final BlockType blockType; + public final EndKind endKind; + public final Set flags; + private final Map attrs; + + + HtmlTag() { + this(BlockType.BLOCK, EndKind.REQUIRED); + } + + HtmlTag(Set flags) { + this(BlockType.BLOCK, EndKind.REQUIRED, flags); + } + + HtmlTag(BlockType blockType, EndKind endKind, AttrMap... attrMaps) { + this(blockType, endKind, Collections.emptySet(), attrMaps); + } + + HtmlTag(BlockType blockType, EndKind endKind, Set flags, AttrMap... attrMaps) { + this.blockType = blockType; + this.endKind = endKind;this.flags = flags; + this.attrs = new EnumMap(Attr.class); + for (Map m: attrMaps) + this.attrs.putAll(m); + attrs.put(Attr.CLASS, AttrKind.OK); + attrs.put(Attr.ID, AttrKind.OK); + attrs.put(Attr.STYLE, AttrKind.OK); + } + + public String getText() { + return name().toLowerCase(); + } + + public Attr getAttr(Name attrName) { + return Attr.index.get(attrName.toString().toLowerCase()); + } + + public AttrKind getAttrKind(Name attrName) { + AttrKind k = attrs.get(getAttr(attrName)); // null-safe + return (k == null) ? AttrKind.INVALID : k; + } + + private static AttrMap attrs(AttrKind k, Attr... attrs) { + AttrMap map = new AttrMap(); + for (Attr a: attrs) map.put(a, k); + return map; + } + + private static final Map index = new HashMap(); + static { + for (HtmlTag t: values()) { + index.put(t.name().toLowerCase(), t); + } + } + + static HtmlTag get(Name tagName) { + return index.get(tagName.toString().toLowerCase()); + } +} diff --git a/langtools/src/share/classes/com/sun/tools/doclint/Messages.java b/langtools/src/share/classes/com/sun/tools/doclint/Messages.java new file mode 100644 index 00000000000..cfa397d349e --- /dev/null +++ b/langtools/src/share/classes/com/sun/tools/doclint/Messages.java @@ -0,0 +1,348 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.tools.doclint; + +import java.io.PrintWriter; +import java.text.MessageFormat; +import java.util.Comparator; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; +import java.util.MissingResourceException; +import java.util.ResourceBundle; +import java.util.Set; +import java.util.TreeMap; +import java.util.TreeSet; + +import javax.tools.Diagnostic; + +import com.sun.source.doctree.DocTree; +import com.sun.source.tree.Tree; +import com.sun.tools.doclint.Env.AccessKind; + +/** + * Message reporting for DocLint. + * + * Options are used to filter out messages based on group and access level. + * Support can be enabled for accumulating statistics of different kinds of + * messages. + * + *

      This is NOT part of any supported API. + * If you write code that depends on this, you do so at your own + * risk. This code and its internal interfaces are subject to change + * or deletion without notice.

      + */ +public class Messages { + /** + * Groups used to categorize messages, so that messages in each group + * can be enabled or disabled via options. + */ + public enum Group { + ACCESSIBILITY, + HTML, + MISSING, + SYNTAX, + REFERENCE; + + String optName() { return name().toLowerCase(); } + String notOptName() { return "-" + optName(); } + + static boolean accepts(String opt) { + for (Group g: values()) + if (opt.equals(g.optName())) return true; + return false; + } + }; + + private final Options options; + private final Stats stats; + + ResourceBundle bundle; + Env env; + + Messages(Env env) { + this.env = env; + String name = getClass().getPackage().getName() + ".resources.doclint"; + bundle = ResourceBundle.getBundle(name, Locale.ENGLISH); + + stats = new Stats(bundle); + options = new Options(stats); + } + + void error(Group group, DocTree tree, String code, Object... args) { + report(group, Diagnostic.Kind.ERROR, tree, code, args); + } + + void warning(Group group, DocTree tree, String code, Object... args) { + report(group, Diagnostic.Kind.WARNING, tree, code, args); + } + + void setOptions(String opts) { + options.setOptions(opts); + } + + void setStatsEnabled(boolean b) { + stats.setEnabled(b); + } + + void reportStats(PrintWriter out) { + stats.report(out); + } + + protected void report(Group group, Diagnostic.Kind dkind, DocTree tree, String code, Object... args) { + if (options.isEnabled(group, env.currAccess)) { + String msg = (code == null) ? (String) args[0] : localize(code, args); + env.trees.printMessage(dkind, msg, tree, + env.currDocComment, env.currPath.getCompilationUnit()); + + stats.record(group, dkind, code); + } + } + + protected void report(Group group, Diagnostic.Kind dkind, Tree tree, String code, Object... args) { + if (options.isEnabled(group, env.currAccess)) { + String msg = localize(code, args); + env.trees.printMessage(dkind, msg, tree, env.currPath.getCompilationUnit()); + + stats.record(group, dkind, code); + } + } + + String localize(String code, Object... args) { + String msg = bundle.getString(code); + if (msg == null) { + StringBuilder sb = new StringBuilder(); + sb.append("message file broken: code=").append(code); + if (args.length > 0) { + sb.append(" arguments={0}"); + for (int i = 1; i < args.length; i++) { + sb.append(", {").append(i).append("}"); + } + } + msg = sb.toString(); + } + return MessageFormat.format(msg, args); + } + + // + + /** + * Handler for (sub)options specific to message handling. + */ + static class Options { + Map map = new HashMap(); + private final Stats stats; + + static boolean isValidOptions(String opts) { + for (String opt: opts.split(",")) { + if (!isValidOption(opt.trim().toLowerCase())) + return false; + } + return true; + } + + private static boolean isValidOption(String opt) { + if (opt.equals("none") || opt.equals(Stats.OPT)) + return true; + + int begin = opt.startsWith("-") ? 1 : 0; + int sep = opt.indexOf("/"); + String grp = opt.substring(begin, (sep != -1) ? sep : opt.length()); + return ((begin == 0 && grp.equals("all")) || Group.accepts(grp)) + && ((sep == -1) || AccessKind.accepts(opt.substring(sep + 1))); + } + + Options(Stats stats) { + this.stats = stats; + } + + /** Determine if a message group is enabled for a particular access level. */ + boolean isEnabled(Group g, Env.AccessKind access) { + if (map.isEmpty()) + map.put("all", Env.AccessKind.PROTECTED); + + Env.AccessKind ak = map.get(g.optName()); + if (ak != null && access.compareTo(ak) >= 0) + return true; + + ak = map.get(ALL); + if (ak != null && access.compareTo(ak) >= 0) { + ak = map.get(g.notOptName()); + if (ak == null || access.compareTo(ak) > 0) // note >, not >= + return true; + } + + return false; + } + + void setOptions(String opts) { + if (opts == null) + setOption(ALL, Env.AccessKind.PRIVATE); + else { + for (String opt: opts.split(",")) + setOption(opt.trim().toLowerCase()); + } + } + + private void setOption(String arg) throws IllegalArgumentException { + if (arg.equals(Stats.OPT)) { + stats.setEnabled(true); + return; + } + + int sep = arg.indexOf("/"); + if (sep > 0) { + Env.AccessKind ak = Env.AccessKind.valueOf(arg.substring(sep + 1).toUpperCase()); + setOption(arg.substring(0, sep), ak); + } else { + setOption(arg, null); + } + } + + private void setOption(String opt, Env.AccessKind ak) { + map.put(opt, (ak != null) ? ak + : opt.startsWith("-") ? Env.AccessKind.PUBLIC : Env.AccessKind.PRIVATE); + } + + private static final String ALL = "all"; + } + + // + + // + + /** + * Optionally record statistics of different kinds of message. + */ + static class Stats { + public static final String OPT = "stats"; + public static final String NO_CODE = ""; + final ResourceBundle bundle; + + // tables only initialized if enabled + int[] groupCounts; + int[] dkindCounts; + Map codeCounts; + + Stats(ResourceBundle bundle) { + this.bundle = bundle; + } + + void setEnabled(boolean b) { + if (b) { + groupCounts = new int[Messages.Group.values().length]; + dkindCounts = new int[Diagnostic.Kind.values().length]; + codeCounts = new HashMap(); + } else { + groupCounts = null; + dkindCounts = null; + codeCounts = null; + } + } + + void record(Messages.Group g, Diagnostic.Kind dkind, String code) { + if (codeCounts == null) { + return; + } + groupCounts[g.ordinal()]++; + dkindCounts[dkind.ordinal()]++; + if (code == null) { + code = NO_CODE; + } + Integer i = codeCounts.get(code); + codeCounts.put(code, (i == null) ? 1 : i + 1); + } + + void report(PrintWriter out) { + if (codeCounts == null) { + return; + } + out.println("By group..."); + Table groupTable = new Table(); + for (Messages.Group g : Messages.Group.values()) { + groupTable.put(g.optName(), groupCounts[g.ordinal()]); + } + groupTable.print(out); + out.println(); + out.println("By diagnostic kind..."); + Table dkindTable = new Table(); + for (Diagnostic.Kind k : Diagnostic.Kind.values()) { + dkindTable.put(k.toString().toLowerCase(), dkindCounts[k.ordinal()]); + } + dkindTable.print(out); + out.println(); + out.println("By message kind..."); + Table codeTable = new Table(); + for (Map.Entry e : codeCounts.entrySet()) { + String code = e.getKey(); + String msg; + try { + msg = code.equals(NO_CODE) ? "OTHER" : bundle.getString(code); + } catch (MissingResourceException ex) { + msg = code; + } + codeTable.put(msg, e.getValue()); + } + codeTable.print(out); + } + + /** + * A table of (int, String) sorted by decreasing int. + */ + private static class Table { + + private static final Comparator DECREASING = new Comparator() { + + public int compare(Integer o1, Integer o2) { + return o2.compareTo(o1); + } + }; + private final TreeMap> map = new TreeMap>(DECREASING); + + void put(String label, int n) { + if (n == 0) { + return; + } + Set labels = map.get(n); + if (labels == null) { + map.put(n, labels = new TreeSet()); + } + labels.add(label); + } + + void print(PrintWriter out) { + for (Map.Entry> e : map.entrySet()) { + int count = e.getKey(); + Set labels = e.getValue(); + for (String label : labels) { + out.println(String.format("%6d: %s", count, label)); + } + } + } + } + } + // +} diff --git a/langtools/src/share/classes/com/sun/tools/doclint/resources/doclint.properties b/langtools/src/share/classes/com/sun/tools/doclint/resources/doclint.properties new file mode 100644 index 00000000000..e85afc92d7c --- /dev/null +++ b/langtools/src/share/classes/com/sun/tools/doclint/resources/doclint.properties @@ -0,0 +1,65 @@ +# +# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +dc.anchor.already.defined = anchor already defined: {0} +dc.attr.lacks.value = attribute lacks value +dc.attr.obsolete = attribute obsolete: {0} +dc.attr.obsolete.use.css = attribute obsolete, use CSS instead: {0} +dc.attr.repeated = repeated attribute: {0} +dc.attr.unknown = unknown attribute: {0} +dc.bad.option = bad option: {0} +dc.bad.value.for.option = bad value for option: {0} {1} +dc.empty = no description for @{0} +dc.entity.invalid = invalid entity &{0}; +dc.exception.not.thrown = exception not thrown: {0} +dc.invalid.anchor = invalid name for anchor: "{0}" +dc.invalid.param = invalid use of @param +dc.invalid.return = invalid use of @return +dc.invalid.throws = invalid use of @throws +dc.invalid.uri = invalid uri: "{0}" +dc.missing.comment = no comment +dc.missing.param = no @param for {0} +dc.missing.return = no @return +dc.missing.throws = no @throws for {0} +dc.no.alt.attr.for.image = no "alt" attribute for image +dc.no.summary.or.caption.for.table=no summary or caption for table +dc.param.name.not.found = @param name not found +dc.ref.not.found = reference not found +dc.tag.empty = empty <{0}> tag +dc.tag.end.not.permitted = invalid end tag: +dc.tag.end.unexpected = unexpected end tag: +dc.tag.header.sequence.1 = header used out of sequence: <{0}> +dc.tag.header.sequence.2 = header used out of sequence: <{0}> +dc.tag.nested.not.allowed=nested tag not allowed: <{0}> +dc.tag.not.allowed = element not allowed in documentation comments: <{0}> +dc.tag.not.allowed.inline.element = block element not allowed within inline element <{1}>: {0} +dc.tag.not.allowed.inline.tag = block element not allowed within @{1}: {0} +dc.tag.not.allowed.inline.other = block element not allowed here: {0} +dc.tag.not.closed= element not closed: {0} +dc.tag.p.in.pre= unexpected use of

      inside

       element
      +dc.tag.self.closing = self-closing element not allowed
      +dc.tag.start.unmatched = end tag missing: 
      +dc.tag.unknown = unknown tag: {0}
      +dc.text.not.allowed = text not allowed in <{0}> element
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/Server.java b/langtools/src/share/classes/com/sun/tools/javac/Server.java
      index fcb2127138c..6fb48a9cf8e 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/Server.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/Server.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
      + * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
        * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        *
        * This code is free software; you can redistribute it and/or modify it
      @@ -49,7 +49,7 @@ class Server implements Runnable {
           private final OutputStream out;
           private final boolean isSocket;
           private static final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
      -    private static Logger logger = Logger.getLogger("com.sun.tools.javac");
      +    private static final Logger logger = Logger.getLogger("com.sun.tools.javac");
           static class CwdFileManager extends ForwardingJavaFileManager {
               String cwd;
               CwdFileManager(JavaFileManager fileManager) {
      @@ -69,7 +69,7 @@ class Server implements Runnable {
       //      }
           }
           // static CwdFileManager fm = new CwdFileManager(tool.getStandardFileManager());
      -    static StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
      +    static final StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
           static {
               // Use the same file manager for all compilations.  This will
               // cache jar files in the standard file manager.  Use
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/api/BasicJavacTask.java b/langtools/src/share/classes/com/sun/tools/javac/api/BasicJavacTask.java
      index 38cff74c8ca..e44bca373fc 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/api/BasicJavacTask.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/api/BasicJavacTask.java
      @@ -57,6 +57,13 @@ public class BasicJavacTask extends JavacTask {
           protected Context context;
           private TaskListener taskListener;
       
      +    public static JavacTask instance(Context context) {
      +        JavacTask instance = context.get(JavacTask.class);
      +        if (instance == null)
      +            instance = new BasicJavacTask(context, true);
      +        return instance;
      +    }
      +
           public BasicJavacTask(Context c, boolean register) {
               context = c;
               if (register)
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java
      index 4cc7075f310..fa36e1f8da7 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java
      @@ -65,7 +65,6 @@ import com.sun.tools.javac.util.List;
        * @author Jonathan Gibbons
        */
       public class JavacTaskImpl extends BasicJavacTask {
      -    private ClientCodeWrapper ccw;
           private Main compilerMain;
           private JavaCompiler compiler;
           private Locale locale;
      @@ -85,7 +84,6 @@ public class JavacTaskImpl extends BasicJavacTask {
                       Context context,
                       List fileObjects) {
               super(null, false);
      -        this.ccw = ClientCodeWrapper.instance(context);
               this.compilerMain = compilerMain;
               this.args = args;
               this.classNames = classNames;
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTool.java b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTool.java
      index 0a7a4617250..d1ef9025120 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTool.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTool.java
      @@ -159,7 +159,7 @@ public final class JavacTool implements JavaCompiler {
               }
           }
       
      -    private static void processOptions(Context context,
      +    public static void processOptions(Context context,
                                              JavaFileManager fileManager,
                                              Iterable options)
           {
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java
      index 8a7db1f181c..490490178fb 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java
      @@ -84,6 +84,7 @@ import com.sun.tools.javac.tree.JCTree.*;
       import com.sun.tools.javac.tree.TreeCopier;
       import com.sun.tools.javac.tree.TreeInfo;
       import com.sun.tools.javac.tree.TreeMaker;
      +import com.sun.tools.javac.util.Abort;
       import com.sun.tools.javac.util.Assert;
       import com.sun.tools.javac.util.Context;
       import com.sun.tools.javac.util.JCDiagnostic;
      @@ -236,19 +237,26 @@ public class JavacTrees extends DocTrees {
           public Element getElement(TreePath path) {
               JCTree tree = (JCTree) path.getLeaf();
               Symbol sym = TreeInfo.symbolFor(tree);
      -        if (sym == null && TreeInfo.isDeclaration(tree)) {
      -            for (TreePath p = path; p != null; p = p.getParentPath()) {
      -                JCTree t = (JCTree) p.getLeaf();
      -                if (t.hasTag(JCTree.Tag.CLASSDEF)) {
      -                    JCClassDecl ct = (JCClassDecl) t;
      -                    if (ct.sym != null) {
      -                        if ((ct.sym.flags_field & Flags.UNATTRIBUTED) != 0) {
      -                            attr.attribClass(ct.pos(), ct.sym);
      -                            sym = TreeInfo.symbolFor(tree);
      +        if (sym == null) {
      +            if (TreeInfo.isDeclaration(tree)) {
      +                for (TreePath p = path; p != null; p = p.getParentPath()) {
      +                    JCTree t = (JCTree) p.getLeaf();
      +                    if (t.hasTag(JCTree.Tag.CLASSDEF)) {
      +                        JCClassDecl ct = (JCClassDecl) t;
      +                        if (ct.sym != null) {
      +                            if ((ct.sym.flags_field & Flags.UNATTRIBUTED) != 0) {
      +                                attr.attribClass(ct.pos(), ct.sym);
      +                                sym = TreeInfo.symbolFor(tree);
      +                            }
      +                            break;
                               }
      -                        break;
                           }
                       }
      +            } else if (tree.hasTag(Tag.TOPLEVEL)) {
      +                JCCompilationUnit cu = (JCCompilationUnit) tree;
      +                if (cu.sourcefile.isNameCompatible("package-info", JavaFileObject.Kind.SOURCE)) {
      +                    sym = cu.packge;
      +                }
                   }
               }
               return sym;
      @@ -332,6 +340,8 @@ public class JavacTrees extends DocTrees {
                   } else {
                       return msym;
                   }
      +        } catch (Abort e) { // may be thrown by Check.completionError in case of bad class file
      +            return null;
               } finally {
                   log.popDiagnosticHandler(deferredDiagnosticHandler);
               }
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Annotations.java b/langtools/src/share/classes/com/sun/tools/javac/code/Annotations.java
      index 84d9108b5d3..29c88c9d90e 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/code/Annotations.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Annotations.java
      @@ -74,12 +74,12 @@ public class Annotations {
            */
           private List attributes = NOT_STARTED;
           /*
      -     * The Symbol this Annotatios belong to
      +     * The Symbol this Annotations belong to
            */
      -    private final Symbol s;
      +    private final Symbol sym;
       
      -    public Annotations(Symbol s) {
      -        this.s = s;
      +    public Annotations(Symbol sym) {
      +        this.sym = sym;
           }
       
           public List getAttributes() {
      @@ -102,7 +102,7 @@ public class Annotations {
           }
       
           public void setAttributesWithCompletion(final Annotate.AnnotateRepeatedContext ctx) {
      -        Assert.check(pendingCompletion() || (!isStarted() && s.kind == PCK));
      +        Assert.check(pendingCompletion() || (!isStarted() && sym.kind == PCK));
       
               Map> annotated = ctx.annotated;
               boolean atLeastOneRepeated = false;
      @@ -111,7 +111,7 @@ public class Annotations {
                   if (lb.size() == 1) {
                       buf = buf.prepend(lb.first());
                   } else { // repeated
      -                buf = buf.prepend(new Placeholder(lb.toList(), s));
      +                buf = buf.prepend(new Placeholder(lb.toList(), sym));
                       atLeastOneRepeated = true;
                   }
               }
      @@ -141,7 +141,7 @@ public class Annotations {
       
                       @Override
                       public String toString() {
      -                    return "repeated annotation pass of: " + s + " in: " + s.owner;
      +                    return "repeated annotation pass of: " + sym + " in: " + sym.owner;
                       }
       
                       @Override
      @@ -253,7 +253,7 @@ public class Annotations {
       
               // Process repeated annotations
               Attribute.Compound validRepeated =
      -                ctx.processRepeatedAnnotations(placeholder.getPlaceholderFor());
      +            ctx.processRepeatedAnnotations(placeholder.getPlaceholderFor(), sym);
       
               if (validRepeated != null) {
                   // Check that the container isn't manually
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java b/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java
      index f827006a036..9ecb23d85ad 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java
      @@ -60,6 +60,9 @@ public abstract class Attribute implements AnnotationValue {
               throw new UnsupportedOperationException();
           }
       
      +    public boolean isSynthesized() {
      +        return false;
      +    }
       
           /** The value for an annotation element of primitive type or String. */
           public static class Constant extends Attribute {
      @@ -136,6 +139,18 @@ public abstract class Attribute implements AnnotationValue {
                *  access this attribute.
                */
               public final List> values;
      +
      +        private boolean synthesized = false;
      +
      +        @Override
      +        public boolean isSynthesized() {
      +            return synthesized;
      +        }
      +
      +        public void setSynthesized(boolean synthesized) {
      +            this.synthesized = synthesized;
      +        }
      +
               public Compound(Type type,
                               List> values) {
                   super(type);
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java b/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java
      index 36b669b6337..bbaba526807 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java
      @@ -307,7 +307,7 @@ public class Flags {
           }
       
           // Cache of modifier sets.
      -    private static Map> modifierSets =
      +    private static final Map> modifierSets =
               new java.util.concurrent.ConcurrentHashMap>(64);
       
           public static boolean isStatic(Symbol symbol) {
      @@ -356,7 +356,7 @@ public class Flags {
               VARARGS("varargs"),
               PACKAGE("package");
       
      -        String name;
      +        private final String name;
       
               Flag(String name) {
                   this.name = name;
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Kinds.java b/langtools/src/share/classes/com/sun/tools/javac/code/Kinds.java
      index 12d3703d1fd..08fbd1a57e4 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/code/Kinds.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Kinds.java
      @@ -110,7 +110,7 @@ public class Kinds {
               INSTANCE_INIT("kindname.instance.init"),
               PACKAGE("kindname.package");
       
      -        private String name;
      +        private final String name;
       
               KindName(String name) {
                   this.name = name;
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Lint.java b/langtools/src/share/classes/com/sun/tools/javac/code/Lint.java
      index 88573c593ca..552b4eeb1d4 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/code/Lint.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Lint.java
      @@ -28,11 +28,14 @@ package com.sun.tools.javac.code;
       import java.util.EnumSet;
       import java.util.HashMap;
       import java.util.Map;
      +import java.util.Set;
      +import javax.lang.model.element.Modifier;
       import com.sun.tools.javac.code.Symbol.*;
       import com.sun.tools.javac.util.Context;
       import com.sun.tools.javac.util.List;
       import com.sun.tools.javac.util.Options;
       import com.sun.tools.javac.util.Pair;
      +
       import static com.sun.tools.javac.code.Flags.*;
       
       
      @@ -95,7 +98,8 @@ public class Lint
           private final EnumSet values;
           private final EnumSet suppressedValues;
       
      -    private static Map map = new HashMap();
      +    private static final Map map =
      +            new java.util.concurrent.ConcurrentHashMap(20);
       
       
           protected Lint(Context context) {
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Source.java b/langtools/src/share/classes/com/sun/tools/javac/code/Source.java
      index 8066ea1be2c..18ebdfe1124 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/code/Source.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Source.java
      @@ -87,7 +87,7 @@ public enum Source {
       
           public final String name;
       
      -    private static Map tab = new HashMap();
      +    private static final Map tab = new HashMap();
           static {
               for (Source s : values()) {
                   tab.put(s.name, s);
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java
      index 2248f47e0e0..2f3f84ab054 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java
      @@ -83,13 +83,13 @@ public abstract class Symbol implements Element {
            *  Attributes of class symbols should be accessed through the accessor
            *  method to make sure that the class symbol is loaded.
            */
      -    public List getAnnotationMirrors() {
      -        return Assert.checkNonNull(annotations.getAttributes());
      +    public List getRawAttributes() {
      +        return annotations.getAttributes();
           }
       
           /** Fetch a particular annotation from a symbol. */
           public Attribute.Compound attribute(Symbol anno) {
      -        for (Attribute.Compound a : getAnnotationMirrors()) {
      +        for (Attribute.Compound a : getRawAttributes()) {
                   if (a.type.tsym == anno) return a;
               }
               return null;
      @@ -446,6 +446,14 @@ public abstract class Symbol implements Element {
               return name;
           }
       
      +    /**
      +     * This is the implementation for {@code
      +     * javax.lang.model.element.Element.getAnnotationMirrors()}.
      +     */
      +    public final List getAnnotationMirrors() {
      +        return getRawAttributes();
      +    }
      +
           /**
            * @deprecated this method should never be used by javac internally.
            */
      @@ -662,15 +670,21 @@ public abstract class Symbol implements Element {
                   return flags_field;
               }
       
      -        public List getAnnotationMirrors() {
      +        @Override
      +        public List getRawAttributes() {
                   if (completer != null) complete();
                   if (package_info != null && package_info.completer != null) {
                       package_info.complete();
      -                if (annotations.isEmpty()) {
      -                    annotations.setAttributes(package_info.annotations);
      +                mergeAttributes();
                   }
      +            return super.getRawAttributes();
      +        }
      +
      +        private void mergeAttributes() {
      +            if (annotations.isEmpty() &&
      +                !package_info.annotations.isEmpty()) {
      +                annotations.setAttributes(package_info.annotations);
                   }
      -            return Assert.checkNonNull(annotations.getAttributes());
               }
       
               /** A package "exists" if a type or package that exists has
      @@ -770,9 +784,10 @@ public abstract class Symbol implements Element {
                   return members_field;
               }
       
      -        public List getAnnotationMirrors() {
      +        @Override
      +        public List getRawAttributes() {
                   if (completer != null) complete();
      -            return Assert.checkNonNull(annotations.getAttributes());
      +            return super.getRawAttributes();
               }
       
               public Type erasure(Types types) {
      @@ -1353,7 +1368,7 @@ public abstract class Symbol implements Element {
                   return defaultValue;
               }
       
      -        public List getParameters() {
      +         public List getParameters() {
                   return params();
               }
       
      @@ -1361,6 +1376,10 @@ public abstract class Symbol implements Element {
                   return (flags() & VARARGS) != 0;
               }
       
      +        public boolean isDefault() {
      +            return (flags() & DEFAULT) != 0;
      +        }
      +
               public  R accept(ElementVisitor v, P p) {
                   return v.visitExecutable(this, p);
               }
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/TargetType.java b/langtools/src/share/classes/com/sun/tools/javac/code/TargetType.java
      index 573f6275ddd..45a90307f6e 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/code/TargetType.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/code/TargetType.java
      @@ -166,7 +166,7 @@ public enum TargetType {
           static final int MAXIMUM_TARGET_TYPE_VALUE = 0x22;
       
           private final int targetTypeValue;
      -    private Set flags;
      +    private final Set flags;
       
           TargetType(int targetTypeValue, TargetAttribute... attributes) {
               if (targetTypeValue < Byte.MIN_VALUE
      @@ -233,10 +233,10 @@ public enum TargetType {
               return this.targetTypeValue;
           }
       
      -    private static TargetType[] targets = null;
      +    private static final TargetType[] targets;
       
      -    private static TargetType[] buildTargets() {
      -        TargetType[] targets = new TargetType[MAXIMUM_TARGET_TYPE_VALUE + 1];
      +    static {
      +        targets = new TargetType[MAXIMUM_TARGET_TYPE_VALUE + 1];
               TargetType[] alltargets = values();
               for (TargetType target : alltargets) {
                   if (target.targetTypeValue >= 0)
      @@ -246,13 +246,9 @@ public enum TargetType {
                   if (targets[i] == null)
                       targets[i] = UNKNOWN;
               }
      -        return targets;
           }
       
           public static boolean isValidTargetTypeValue(int tag) {
      -        if (targets == null)
      -            targets = buildTargets();
      -
               if (((byte)tag) == ((byte)UNKNOWN.targetTypeValue))
                   return true;
       
      @@ -260,9 +256,6 @@ public enum TargetType {
           }
       
           public static TargetType fromTargetTypeValue(int tag) {
      -        if (targets == null)
      -            targets = buildTargets();
      -
               if (((byte)tag) == ((byte)UNKNOWN.targetTypeValue))
                   return UNKNOWN;
       
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Type.java b/langtools/src/share/classes/com/sun/tools/javac/code/Type.java
      index 80aabeeb9ba..db2685bcf07 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/code/Type.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Type.java
      @@ -302,10 +302,12 @@ public class Type implements PrimitiveType {
            * never complete classes. Where isSameType would complete a
            * class, equals assumes that the two types are different.
            */
      +    @Override
           public boolean equals(Object t) {
               return super.equals(t);
           }
       
      +    @Override
           public int hashCode() {
               return super.hashCode();
           }
      @@ -996,34 +998,6 @@ public class Type implements PrimitiveType {
                   return "(" + argtypes + ")" + restype;
               }
       
      -        public boolean equals(Object obj) {
      -            if (this == obj)
      -                return true;
      -            if (!(obj instanceof MethodType))
      -                return false;
      -            MethodType m = (MethodType)obj;
      -            List args1 = argtypes;
      -            List args2 = m.argtypes;
      -            while (!args1.isEmpty() && !args2.isEmpty()) {
      -                if (!args1.head.equals(args2.head))
      -                    return false;
      -                args1 = args1.tail;
      -                args2 = args2.tail;
      -            }
      -            if (!args1.isEmpty() || !args2.isEmpty())
      -                return false;
      -            return restype.equals(m.restype);
      -        }
      -
      -        public int hashCode() {
      -            int h = METHOD.ordinal();
      -            for (List thisargs = this.argtypes;
      -                 thisargs.tail != null; /*inlined: thisargs.nonEmpty()*/
      -                 thisargs = thisargs.tail)
      -                h = (h << 5) + thisargs.head.hashCode();
      -            return (h << 5) + this.restype.hashCode();
      -        }
      -
               public List        getParameterTypes() { return argtypes; }
               public Type              getReturnType()     { return restype; }
               public List        getThrownTypes()    { return thrown; }
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/TypeTag.java b/langtools/src/share/classes/com/sun/tools/javac/code/TypeTag.java
      index da6affeec42..d786621e918 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/code/TypeTag.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/code/TypeTag.java
      @@ -135,9 +135,11 @@ public enum TypeTag {
           /** This field will only be used for tags related with numeric types for
            *  optimization reasons.
            */
      -    private int order = 0;
      +    private final int order;
       
      -    private TypeTag() {}
      +    private TypeTag() {
      +        this(0);
      +    }
       
           private TypeTag(int order) {
               this.order = order;
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java
      index 342aeb986b3..a7378f8acfe 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java
      @@ -1007,11 +1007,11 @@ public class Types {
                           if (!visit(supertype(t), supertype(s)))
                               return false;
       
      -                    HashSet set = new HashSet();
      +                    HashSet set = new HashSet();
                           for (Type x : interfaces(t))
      -                        set.add(new SingletonType(x));
      +                        set.add(new UniqueType(x, Types.this));
                           for (Type x : interfaces(s)) {
      -                        if (!set.remove(new SingletonType(x)))
      +                        if (!set.remove(new UniqueType(x, Types.this)))
                                   return false;
                           }
                           return (set.isEmpty());
      @@ -2849,7 +2849,7 @@ public class Types {
               }
               return tvars1;
           }
      -    static private Mapping newInstanceFun = new Mapping("newInstanceFun") {
      +    private static final Mapping newInstanceFun = new Mapping("newInstanceFun") {
                   public Type apply(Type t) { return new TypeVar(t.tsym, t.getUpperBound(), t.getLowerBound()); }
               };
           // 
      @@ -3137,7 +3137,7 @@ public class Types {
                   }
                   @Override
                   public int hashCode() {
      -                return 127 * Types.hashCode(t1) + Types.hashCode(t2);
      +                return 127 * Types.this.hashCode(t1) + Types.this.hashCode(t2);
                   }
                   @Override
                   public boolean equals(Object obj) {
      @@ -3400,7 +3400,7 @@ public class Types {
           /**
            * Compute a hash code on a type.
            */
      -    public static int hashCode(Type t) {
      +    public int hashCode(Type t) {
               return hashCode.visit(t);
           }
           // where
      @@ -3422,6 +3422,16 @@ public class Types {
                       return result;
                   }
       
      +            @Override
      +            public Integer visitMethodType(MethodType t, Void ignored) {
      +                int h = METHOD.ordinal();
      +                for (List thisargs = t.argtypes;
      +                     thisargs.tail != null;
      +                     thisargs = thisargs.tail)
      +                    h = (h << 5) + visit(thisargs.head);
      +                return (h << 5) + visit(t.restype);
      +            }
      +
                   @Override
                   public Integer visitWildcardType(WildcardType t, Void ignored) {
                       int result = t.kind.hashCode();
      @@ -4082,21 +4092,28 @@ public class Types {
           /**
            * A wrapper for a type that allows use in sets.
            */
      -    class SingletonType {
      -        final Type t;
      -        SingletonType(Type t) {
      -            this.t = t;
      +    public static class UniqueType {
      +        public final Type type;
      +        final Types types;
      +
      +        public UniqueType(Type type, Types types) {
      +            this.type = type;
      +            this.types = types;
               }
      +
               public int hashCode() {
      -            return Types.hashCode(t);
      +            return types.hashCode(type);
               }
      +
               public boolean equals(Object obj) {
      -            return (obj instanceof SingletonType) &&
      -                isSameType(t, ((SingletonType)obj).t);
      +            return (obj instanceof UniqueType) &&
      +                types.isSameType(type, ((UniqueType)obj).type);
               }
      +
               public String toString() {
      -            return t.toString();
      +            return type.toString();
               }
      +
           }
           // 
       
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java
      index cc3ea1e2f96..b9807d9180c 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java
      @@ -26,7 +26,6 @@
       package com.sun.tools.javac.comp;
       
       import java.util.Map;
      -
       import com.sun.tools.javac.util.*;
       import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
       import com.sun.tools.javac.code.*;
      @@ -171,8 +170,8 @@ public class Annotate {
                * @param repeatingAnnotations a List of repeating annotations
                * @return a new Attribute.Compound that is the container for the repeatingAnnotations
                */
      -        public Attribute.Compound processRepeatedAnnotations(List repeatingAnnotations) {
      -            return Annotate.this.processRepeatedAnnotations(repeatingAnnotations, this);
      +        public Attribute.Compound processRepeatedAnnotations(List repeatingAnnotations, Symbol sym) {
      +            return Annotate.this.processRepeatedAnnotations(repeatingAnnotations, this, sym);
               }
       
               /**
      @@ -339,10 +338,11 @@ public class Annotate {
            * annotation are invalid.  This method reports errors/warnings.
            */
           private Attribute.Compound processRepeatedAnnotations(List annotations,
      -            AnnotateRepeatedContext ctx) {
      +                                                          AnnotateRepeatedContext ctx,
      +                                                          Symbol on) {
               Attribute.Compound firstOccurrence = annotations.head;
               List repeated = List.nil();
      -        Type origAnnoType;
      +        Type origAnnoType = null;
               Type arrayOfOrigAnnoType = null;
               Type targetContainerType = null;
               MethodSymbol containerValueSymbol = null;
      @@ -390,9 +390,17 @@ public class Annotate {
                                                             new Attribute.Array(arrayOfOrigAnnoType, repeated));
                   annoTree = m.Annotation(new Attribute.Compound(targetContainerType,
                           List.of(p)));
      +
      +            if (!chk.annotationApplicable(annoTree, on))
      +                log.error(annoTree.pos(), "invalid.containedby.annotation.incompatible.target", targetContainerType, origAnnoType);
      +
      +            if (!chk.validateAnnotationDeferErrors(annoTree))
      +                log.error(annoTree.pos(), "duplicate.annotation.invalid.repeated", origAnnoType);
      +
                   Attribute.Compound c = enterAnnotation(annoTree,
                                                          targetContainerType,
                                                          ctx.env);
      +            c.setSynthesized(true);
                   return c;
               } else {
                   return null; // errors should have been reported elsewhere
      @@ -410,7 +418,7 @@ public class Annotate {
               // annotation's declaration, or null if it has none
               Attribute.Compound ca = origAnnoDecl.attribute(syms.containedByType.tsym);
               if (ca == null) { // has no ContainedBy annotation
      -            log.error(pos, "duplicate.annotation.missing.container", origAnnoType);
      +            log.error(pos, "duplicate.annotation.missing.container", origAnnoType, syms.containedByType);
                   return null;
               }
       
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java
      index 23fe35ec421..da982534deb 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java
      @@ -1405,7 +1405,8 @@ public class Attr extends JCTree.Visitor {
               Type owntype = standaloneConditional ? condType(tree, truetype, falsetype) : pt();
               if (condtype.constValue() != null &&
                       truetype.constValue() != null &&
      -                falsetype.constValue() != null) {
      +                falsetype.constValue() != null &&
      +                !owntype.hasTag(NONE)) {
                   //constant folding
                   owntype = cfolder.coerce(condtype.isTrue() ? truetype : falsetype, owntype);
               }
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java
      index 78ba105984f..7db55b62c02 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java
      @@ -1833,13 +1833,15 @@ public class Check {
               for (Scope.Entry e1 = t1.tsym.members().elems; e1 != null; e1 = e1.sibling) {
                   Symbol s1 = e1.sym;
                   Type st1 = null;
      -            if (s1.kind != MTH || !s1.isInheritedIn(site.tsym, types)) continue;
      +            if (s1.kind != MTH || !s1.isInheritedIn(site.tsym, types) ||
      +                    (s1.flags() & SYNTHETIC) != 0) continue;
                   Symbol impl = ((MethodSymbol)s1).implementation(site.tsym, types, false);
                   if (impl != null && (impl.flags() & ABSTRACT) == 0) continue;
                   for (Scope.Entry e2 = t2.tsym.members().lookup(s1.name); e2.scope != null; e2 = e2.next()) {
                       Symbol s2 = e2.sym;
                       if (s1 == s2) continue;
      -                if (s2.kind != MTH || !s2.isInheritedIn(site.tsym, types)) continue;
      +                if (s2.kind != MTH || !s2.isInheritedIn(site.tsym, types) ||
      +                        (s2.flags() & SYNTHETIC) != 0) continue;
                       if (st1 == null) st1 = types.memberType(t1, s1);
                       Type st2 = types.memberType(t2, s2);
                       if (types.overrideEquivalent(st1, st2)) {
      @@ -2890,39 +2892,54 @@ public class Check {
           }
       
           /** Check an annotation value.
      +     *
      +     * @param a The annotation tree to check
      +     * @return true if this annotation tree is valid, otherwise false
            */
      -    public void validateAnnotation(JCAnnotation a) {
      -        // collect an inventory of the members (sorted alphabetically)
      -        Set members = new TreeSet(new Comparator() {
      -            public int compare(Symbol t, Symbol t1) {
      -                return t.name.compareTo(t1.name);
      -            }
      -        });
      +    public boolean validateAnnotationDeferErrors(JCAnnotation a) {
      +        boolean res = false;
      +        final Log.DiagnosticHandler diagHandler = new Log.DiscardDiagnosticHandler(log);
      +        try {
      +            res = validateAnnotation(a);
      +        } finally {
      +            log.popDiagnosticHandler(diagHandler);
      +        }
      +        return res;
      +    }
      +
      +    private boolean validateAnnotation(JCAnnotation a) {
      +        boolean isValid = true;
      +        // collect an inventory of the annotation elements
      +        Set members = new LinkedHashSet();
               for (Scope.Entry e = a.annotationType.type.tsym.members().elems;
                    e != null;
                    e = e.sibling)
                   if (e.sym.kind == MTH)
                       members.add((MethodSymbol) e.sym);
       
      -        // count them off as they're annotated
      +        // remove the ones that are assigned values
               for (JCTree arg : a.args) {
                   if (!arg.hasTag(ASSIGN)) continue; // recovery
                   JCAssign assign = (JCAssign) arg;
                   Symbol m = TreeInfo.symbol(assign.lhs);
                   if (m == null || m.type.isErroneous()) continue;
      -            if (!members.remove(m))
      +            if (!members.remove(m)) {
      +                isValid = false;
                       log.error(assign.lhs.pos(), "duplicate.annotation.member.value",
                                 m.name, a.type);
      +            }
               }
       
               // all the remaining ones better have default values
      -        ListBuffer missingDefaults = ListBuffer.lb();
      +        List missingDefaults = List.nil();
               for (MethodSymbol m : members) {
                   if (m.defaultValue == null && !m.type.isErroneous()) {
      -                missingDefaults.append(m.name);
      +                missingDefaults = missingDefaults.append(m.name);
                   }
               }
      +        missingDefaults = missingDefaults.reverse();
               if (missingDefaults.nonEmpty()) {
      +            isValid = false;
                   String key = (missingDefaults.size() > 1)
                           ? "annotation.missing.default.value.1"
                           : "annotation.missing.default.value";
      @@ -2933,21 +2950,23 @@ public class Check {
               // repeated values in its value member
               if (a.annotationType.type.tsym != syms.annotationTargetType.tsym ||
                   a.args.tail == null)
      -            return;
      +            return isValid;
       
      -        if (!a.args.head.hasTag(ASSIGN)) return; // error recovery
      +        if (!a.args.head.hasTag(ASSIGN)) return false; // error recovery
               JCAssign assign = (JCAssign) a.args.head;
               Symbol m = TreeInfo.symbol(assign.lhs);
      -        if (m.name != names.value) return;
      +        if (m.name != names.value) return false;
               JCTree rhs = assign.rhs;
      -        if (!rhs.hasTag(NEWARRAY)) return;
      +        if (!rhs.hasTag(NEWARRAY)) return false;
               JCNewArray na = (JCNewArray) rhs;
               Set targets = new HashSet();
               for (JCTree elem : na.elems) {
                   if (!targets.add(TreeInfo.symbol(elem))) {
      +                isValid = false;
                       log.error(elem.pos(), "repeated.annotation.target");
                   }
               }
      +        return isValid;
           }
       
           void checkDeprecatedAnnotation(DiagnosticPosition pos, Symbol s) {
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/ConstFold.java b/langtools/src/share/classes/com/sun/tools/javac/comp/ConstFold.java
      index a0f9ec1b04b..2b6003ff0c4 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/comp/ConstFold.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/ConstFold.java
      @@ -62,9 +62,9 @@ strictfp class ConstFold {
               syms = Symtab.instance(context);
           }
       
      -    static Integer minusOne = -1;
      -    static Integer zero     = 0;
      -    static Integer one      = 1;
      +    static final Integer minusOne = -1;
      +    static final Integer zero     = 0;
      +    static final Integer one      = 1;
       
          /** Convert boolean to integer (true = 1, false = 0).
           */
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java
      index d0afb484158..21863e7f075 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java
      @@ -246,8 +246,8 @@ public class Flow {
                */
               SPECULATIVE_LOOP("var.might.be.assigned.in.loop", true);
       
      -        String errKey;
      -        boolean isFinal;
      +        final String errKey;
      +        final boolean isFinal;
       
               FlowKind(String errKey, boolean isFinal) {
                   this.errKey = errKey;
      @@ -295,7 +295,7 @@ public class Flow {
                       }
                   };
       
      -            JCTree.Tag treeTag;
      +            final JCTree.Tag treeTag;
       
                   private JumpKind(Tag treeTag) {
                       this.treeTag = treeTag;
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java b/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
      index c737c2c36c7..6ad3da8ddae 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
      @@ -692,8 +692,9 @@ public class LambdaToMethod extends TreeTranslator {
               //determine the static bsm args
               Type mtype = makeFunctionalDescriptorType(targetType, true);
               List staticArgs = List.of(
      -                new Pool.MethodHandle(ClassFile.REF_invokeInterface, types.findDescriptorSymbol(targetType.tsym)),
      -                new Pool.MethodHandle(refKind, refSym),
      +                new Pool.MethodHandle(ClassFile.REF_invokeInterface,
      +                    types.findDescriptorSymbol(targetType.tsym), types),
      +                new Pool.MethodHandle(refKind, refSym, types),
                       new MethodType(mtype.getParameterTypes(),
                               mtype.getReturnType(),
                               mtype.getThrownTypes(),
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java
      index df783a26a69..423f4dc4a45 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java
      @@ -156,7 +156,7 @@ public class Resolve {
               OBJECT_INIT("object-init"),
               INTERNAL("internal");
       
      -        String opt;
      +        final String opt;
       
               private VerboseResolutionMode(String opt) {
                   this.opt = opt;
      @@ -1798,6 +1798,9 @@ public class Resolve {
       
               if ((kind & TYP) != 0) {
                   sym = findType(env, name);
      +            if (sym.kind==TYP) {
      +                 reportDependence(env.enclClass.sym, sym);
      +            }
                   if (sym.exists()) return sym;
                   else if (sym.kind < bestSoFar.kind) bestSoFar = sym;
               }
      @@ -1806,6 +1809,14 @@ public class Resolve {
               else return bestSoFar;
           }
       
      +    /** Report dependencies.
      +     * @param from The enclosing class sym
      +     * @param to   The found identifier that the class depends on.
      +     */
      +    public void reportDependence(Symbol from, Symbol to) {
      +        // Override if you want to collect the reported dependencies.
      +    }
      +
           /** Find an identifier in a package which matches a specified kind set.
            *  @param env       The current environment.
            *  @param name      The identifier's name.
      @@ -3064,16 +3075,20 @@ public class Resolve {
                   if (hasLocation) {
                       return diags.create(dkind, log.currentSource(), pos,
                               errKey, kindname, idname, //symbol kindname, name
      -                        typeargtypes, argtypes, //type parameters and arguments (if any)
      +                        typeargtypes, args(argtypes), //type parameters and arguments (if any)
                               getLocationDiag(location, site)); //location kindname, type
                   }
                   else {
                       return diags.create(dkind, log.currentSource(), pos,
                               errKey, kindname, idname, //symbol kindname, name
      -                        typeargtypes, argtypes); //type parameters and arguments (if any)
      +                        typeargtypes, args(argtypes)); //type parameters and arguments (if any)
                   }
               }
               //where
      +        private Object args(List args) {
      +            return args.isEmpty() ? args : methodArguments(args);
      +        }
      +
               private String getErrorKey(KindName kindname, boolean hasTypeArgs, boolean hasLocation) {
                   String key = "cant.resolve";
                   String suffix = hasLocation ? ".location" : "";
      @@ -3381,8 +3396,8 @@ public class Resolve {
                   }
               };
       
      -        boolean isBoxingRequired;
      -        boolean isVarargsRequired;
      +        final boolean isBoxingRequired;
      +        final boolean isVarargsRequired;
       
               MethodResolutionPhase(boolean isBoxingRequired, boolean isVarargsRequired) {
                  this.isBoxingRequired = isBoxingRequired;
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java b/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java
      index dbb9f68a91f..48f035d759f 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java
      @@ -83,7 +83,7 @@ public class ZipFileIndex {
           public final static long NOT_MODIFIED = Long.MIN_VALUE;
       
       
      -    private static boolean NON_BATCH_MODE = System.getProperty("nonBatchMode") != null;// TODO: Use -XD compiler switch for this.
      +    private static final boolean NON_BATCH_MODE = System.getProperty("nonBatchMode") != null;// TODO: Use -XD compiler switch for this.
       
           private Map directories =
                   Collections.emptyMap();
      @@ -548,17 +548,15 @@ public class ZipFileIndex {
                       }
       
                       if (i >= 0) {
      -                    zipDir = new byte[get4ByteLittleEndian(endbuf, i + 12) + 2];
      -                    zipDir[0] = endbuf[i + 10];
      -                    zipDir[1] = endbuf[i + 11];
      +                    zipDir = new byte[get4ByteLittleEndian(endbuf, i + 12)];
                           int sz = get4ByteLittleEndian(endbuf, i + 16);
                           // a negative offset or the entries field indicates a
                           // potential zip64 archive
      -                    if (sz < 0 || get2ByteLittleEndian(zipDir, 0) == 0xffff) {
      +                    if (sz < 0 || get2ByteLittleEndian(endbuf, i + 10) == 0xffff) {
                               throw new ZipFormatException("detected a zip64 archive");
                           }
                           zipRandomFile.seek(start + sz);
      -                    zipRandomFile.readFully(zipDir, 2, zipDir.length - 2);
      +                    zipRandomFile.readFully(zipDir, 0, zipDir.length);
                           return;
                       } else {
                           endbufend = endbufpos + 21;
      @@ -568,14 +566,13 @@ public class ZipFileIndex {
               }
       
               private void buildIndex() throws IOException {
      -            int entryCount = get2ByteLittleEndian(zipDir, 0);
      +            int len = zipDir.length;
       
                   // Add each of the files
      -            if (entryCount > 0) {
      +            if (len > 0) {
                       directories = new LinkedHashMap();
                       ArrayList entryList = new ArrayList();
      -                int pos = 2;
      -                for (int i = 0; i < entryCount; i++) {
      +                for (int pos = 0; pos < len; ) {
                           pos = readEntry(pos, entryList, directories);
                       }
       
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassFile.java b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassFile.java
      index 86307ab39c8..e1ff3ac274e 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassFile.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassFile.java
      @@ -26,6 +26,8 @@
       package com.sun.tools.javac.jvm;
       
       import com.sun.tools.javac.code.Type;
      +import com.sun.tools.javac.code.Types;
      +import com.sun.tools.javac.code.Types.UniqueType;
       import com.sun.tools.javac.util.Name;
       
       
      @@ -166,22 +168,29 @@ public class ClassFile {
            */
           public static class NameAndType {
               Name name;
      -        Type type;
      +        UniqueType uniqueType;
      +        Types types;
       
      -        NameAndType(Name name, Type type) {
      +        NameAndType(Name name, Type type, Types types) {
                   this.name = name;
      -            this.type = type;
      +            this.uniqueType = new UniqueType(type, types);
      +            this.types = types;
               }
       
      +        void setType(Type type) {
      +            this.uniqueType = new UniqueType(type, types);
      +        }
      +
      +        @Override
               public boolean equals(Object other) {
      -            return
      -                other instanceof NameAndType &&
      -                name == ((NameAndType) other).name &&
      -                type.equals(((NameAndType) other).type);
      +            return (other instanceof NameAndType &&
      +                    name == ((NameAndType) other).name &&
      +                        uniqueType.equals(((NameAndType) other).uniqueType));
               }
       
      +        @Override
               public int hashCode() {
      -            return name.hashCode() * type.hashCode();
      +            return name.hashCode() * uniqueType.hashCode();
               }
           }
       }
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java
      index 602d4226f9c..224045cc25d 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java
      @@ -488,20 +488,20 @@ public class ClassReader implements Completer {
               case CONSTANT_Fieldref: {
                   ClassSymbol owner = readClassSymbol(getChar(index + 1));
                   NameAndType nt = (NameAndType)readPool(getChar(index + 3));
      -            poolObj[i] = new VarSymbol(0, nt.name, nt.type, owner);
      +            poolObj[i] = new VarSymbol(0, nt.name, nt.uniqueType.type, owner);
                   break;
               }
               case CONSTANT_Methodref:
               case CONSTANT_InterfaceMethodref: {
                   ClassSymbol owner = readClassSymbol(getChar(index + 1));
                   NameAndType nt = (NameAndType)readPool(getChar(index + 3));
      -            poolObj[i] = new MethodSymbol(0, nt.name, nt.type, owner);
      +            poolObj[i] = new MethodSymbol(0, nt.name, nt.uniqueType.type, owner);
                   break;
               }
               case CONSTANT_NameandType:
                   poolObj[i] = new NameAndType(
                       readName(getChar(index + 1)),
      -                readType(getChar(index + 3)));
      +                readType(getChar(index + 3)), types);
                   break;
               case CONSTANT_Integer:
                   poolObj[i] = getInt(index + 1);
      @@ -1224,7 +1224,7 @@ public class ClassReader implements Completer {
               if (nt == null)
                   return null;
       
      -        MethodType type = nt.type.asMethodType();
      +        MethodType type = nt.uniqueType.type.asMethodType();
       
               for (Scope.Entry e = scope.lookup(nt.name); e.scope != null; e = e.next())
                   if (e.sym.kind == MTH && isSameBinaryType(e.sym.type.asMethodType(), type))
      @@ -1236,16 +1236,16 @@ public class ClassReader implements Completer {
               if ((flags & INTERFACE) != 0)
                   // no enclosing instance
                   return null;
      -        if (nt.type.getParameterTypes().isEmpty())
      +        if (nt.uniqueType.type.getParameterTypes().isEmpty())
                   // no parameters
                   return null;
       
               // A constructor of an inner class.
               // Remove the first argument (the enclosing instance)
      -        nt.type = new MethodType(nt.type.getParameterTypes().tail,
      -                                 nt.type.getReturnType(),
      -                                 nt.type.getThrownTypes(),
      -                                 syms.methodClass);
      +        nt.setType(new MethodType(nt.uniqueType.type.getParameterTypes().tail,
      +                                 nt.uniqueType.type.getReturnType(),
      +                                 nt.uniqueType.type.getThrownTypes(),
      +                                 syms.methodClass));
               // Try searching again
               return findMethod(nt, scope, flags);
           }
      @@ -1360,6 +1360,16 @@ public class ClassReader implements Completer {
           void attachAnnotationDefault(final Symbol sym) {
               final MethodSymbol meth = (MethodSymbol)sym; // only on methods
               final Attribute value = readAttributeValue();
      +
      +        // The default value is set later during annotation. It might
      +        // be the case that the Symbol sym is annotated _after_ the
      +        // repeating instances that depend on this default value,
      +        // because of this we set an interim value that tells us this
      +        // element (most likely) has a default.
      +        //
      +        // Set interim value for now, reset just before we do this
      +        // properly at annotate time.
      +        meth.defaultValue = value;
               annotate.normal(new AnnotationDefaultCompleter(meth, value));
           }
       
      @@ -1680,6 +1690,9 @@ public class ClassReader implements Completer {
               public void enterAnnotation() {
                   JavaFileObject previousClassFile = currentClassFile;
                   try {
      +                // Reset the interim value set earlier in
      +                // attachAnnotationDefault().
      +                sym.defaultValue = null;
                       currentClassFile = classFile;
                       sym.defaultValue = deproxy(sym.type.getReturnType(), value);
                   } finally {
      @@ -1946,7 +1959,7 @@ public class ClassReader implements Completer {
       
               if (readAllOfClassFile) {
                   for (int i = 1; i < poolObj.length; i++) readPool(i);
      -            c.pool = new Pool(poolObj.length, poolObj);
      +            c.pool = new Pool(poolObj.length, poolObj, types);
               }
       
               // reset and read rest of classinfo
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
      index 2353391c71e..f67e0d3b69a 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
      @@ -39,7 +39,12 @@ import com.sun.tools.javac.code.*;
       import com.sun.tools.javac.code.Attribute.RetentionPolicy;
       import com.sun.tools.javac.code.Symbol.*;
       import com.sun.tools.javac.code.Type.*;
      +import com.sun.tools.javac.code.Types.UniqueType;
       import com.sun.tools.javac.file.BaseFileObject;
      +import com.sun.tools.javac.jvm.Pool.DynamicMethod;
      +import com.sun.tools.javac.jvm.Pool.Method;
      +import com.sun.tools.javac.jvm.Pool.MethodHandle;
      +import com.sun.tools.javac.jvm.Pool.Variable;
       import com.sun.tools.javac.util.*;
       
       import static com.sun.tools.javac.code.BoundKind.*;
      @@ -142,7 +147,7 @@ public class ClassWriter extends ClassFile {
           /** The bootstrap methods to be written in the corresponding class attribute
            *  (one for each invokedynamic)
            */
      -    Map bootstrapMethods;
      +    Map bootstrapMethods;
       
           /** The log to use for verbose output.
            */
      @@ -477,10 +482,10 @@ public class ClassWriter extends ClassFile {
               while (i < pool.pp) {
                   Object value = pool.pool[i];
                   Assert.checkNonNull(value);
      -            if (value instanceof Pool.Method)
      -                value = ((Pool.Method)value).m;
      -            else if (value instanceof Pool.Variable)
      -                value = ((Pool.Variable)value).v;
      +            if (value instanceof Method)
      +                value = ((Method)value).m;
      +            else if (value instanceof Variable)
      +                value = ((Variable)value).v;
       
                   if (value instanceof MethodSymbol) {
                       MethodSymbol m = (MethodSymbol)value;
      @@ -493,8 +498,9 @@ public class ClassWriter extends ClassFile {
                       } else {
                           //invokedynamic
                           DynamicMethodSymbol dynSym = (DynamicMethodSymbol)m;
      -                    Pool.MethodHandle handle = new Pool.MethodHandle(dynSym.bsmKind, dynSym.bsm);
      -                    bootstrapMethods.put(dynSym, handle);
      +                    MethodHandle handle = new MethodHandle(dynSym.bsmKind, dynSym.bsm, types);
      +                    DynamicMethod dynMeth = new DynamicMethod(dynSym, types);
      +                    bootstrapMethods.put(dynMeth, handle);
                           //init cp entries
                           pool.put(names.BootstrapMethods);
                           pool.put(handle);
      @@ -531,7 +537,7 @@ public class ClassWriter extends ClassFile {
                       NameAndType nt = (NameAndType)value;
                       poolbuf.appendByte(CONSTANT_NameandType);
                       poolbuf.appendChar(pool.put(nt.name));
      -                poolbuf.appendChar(pool.put(typeSig(nt.type)));
      +                poolbuf.appendChar(pool.put(typeSig(nt.uniqueType.type)));
                   } else if (value instanceof Integer) {
                       poolbuf.appendByte(CONSTANT_Integer);
                       poolbuf.appendInt(((Integer)value).intValue());
      @@ -549,17 +555,18 @@ public class ClassWriter extends ClassFile {
                   } else if (value instanceof String) {
                       poolbuf.appendByte(CONSTANT_String);
                       poolbuf.appendChar(pool.put(names.fromString((String)value)));
      -            } else if (value instanceof MethodType) {
      -                MethodType mtype = (MethodType)value;
      -                poolbuf.appendByte(CONSTANT_MethodType);
      -                poolbuf.appendChar(pool.put(typeSig(mtype)));
      -            } else if (value instanceof Type) {
      -                Type type = (Type)value;
      -                if (type.hasTag(CLASS)) enterInner((ClassSymbol)type.tsym);
      -                poolbuf.appendByte(CONSTANT_Class);
      -                poolbuf.appendChar(pool.put(xClassName(type)));
      -            } else if (value instanceof Pool.MethodHandle) {
      -                Pool.MethodHandle ref = (Pool.MethodHandle)value;
      +            } else if (value instanceof UniqueType) {
      +                Type type = ((UniqueType)value).type;
      +                if (type instanceof MethodType) {
      +                    poolbuf.appendByte(CONSTANT_MethodType);
      +                    poolbuf.appendChar(pool.put(typeSig((MethodType)type)));
      +                } else {
      +                    if (type.hasTag(CLASS)) enterInner((ClassSymbol)type.tsym);
      +                    poolbuf.appendByte(CONSTANT_Class);
      +                    poolbuf.appendChar(pool.put(xClassName(type)));
      +                }
      +            } else if (value instanceof MethodHandle) {
      +                MethodHandle ref = (MethodHandle)value;
                       poolbuf.appendByte(CONSTANT_MethodHandle);
                       poolbuf.appendByte(ref.refKind);
                       poolbuf.appendChar(pool.put(ref.refSym));
      @@ -589,7 +596,7 @@ public class ClassWriter extends ClassFile {
               return new NameAndType(fieldName(sym),
                                      retrofit
                                      ? sym.erasure(types)
      -                               : sym.externalType(types));
      +                               : sym.externalType(types), types);
               // if we retrofit, then the NameAndType has been read in as is
               // and no change is necessary. If we compile normally, the
               // NameAndType is generated from a symbol reference, and the
      @@ -714,7 +721,7 @@ public class ClassWriter extends ClassFile {
                   endAttr(alenIdx);
                   acount++;
               }
      -        acount += writeJavaAnnotations(sym.getAnnotationMirrors());
      +        acount += writeJavaAnnotations(sym.getRawAttributes());
               return acount;
           }
       
      @@ -725,7 +732,7 @@ public class ClassWriter extends ClassFile {
               boolean hasVisible = false;
               boolean hasInvisible = false;
               if (m.params != null) for (VarSymbol s : m.params) {
      -            for (Attribute.Compound a : s.getAnnotationMirrors()) {
      +            for (Attribute.Compound a : s.getRawAttributes()) {
                       switch (types.getRetention(a)) {
                       case SOURCE: break;
                       case CLASS: hasInvisible = true; break;
      @@ -741,7 +748,7 @@ public class ClassWriter extends ClassFile {
                   databuf.appendByte(m.params.length());
                   for (VarSymbol s : m.params) {
                       ListBuffer buf = new ListBuffer();
      -                for (Attribute.Compound a : s.getAnnotationMirrors())
      +                for (Attribute.Compound a : s.getRawAttributes())
                           if (types.getRetention(a) == RetentionPolicy.RUNTIME)
                               buf.append(a);
                       databuf.appendChar(buf.length());
      @@ -756,7 +763,7 @@ public class ClassWriter extends ClassFile {
                   databuf.appendByte(m.params.length());
                   for (VarSymbol s : m.params) {
                       ListBuffer buf = new ListBuffer();
      -                for (Attribute.Compound a : s.getAnnotationMirrors())
      +                for (Attribute.Compound a : s.getRawAttributes())
                           if (types.getRetention(a) == RetentionPolicy.CLASS)
                               buf.append(a);
                       databuf.appendChar(buf.length());
      @@ -951,14 +958,16 @@ public class ClassWriter extends ClassFile {
           void writeBootstrapMethods() {
               int alenIdx = writeAttr(names.BootstrapMethods);
               databuf.appendChar(bootstrapMethods.size());
      -        for (Map.Entry entry : bootstrapMethods.entrySet()) {
      -            DynamicMethodSymbol dsym = (DynamicMethodSymbol)entry.getKey();
      +        for (Map.Entry entry : bootstrapMethods.entrySet()) {
      +            DynamicMethod dmeth = entry.getKey();
      +            DynamicMethodSymbol dsym = (DynamicMethodSymbol)dmeth.baseSymbol();
                   //write BSM handle
                   databuf.appendChar(pool.get(entry.getValue()));
                   //write static args length
                   databuf.appendChar(dsym.staticArgs.length);
                   //write static args array
      -            for (Object o : dsym.staticArgs) {
      +            Object[] uniqueArgs = dmeth.uniqueStaticArgs;
      +            for (Object o : uniqueArgs) {
                       databuf.appendChar(pool.get(o));
                   }
               }
      @@ -1534,7 +1543,7 @@ public class ClassWriter extends ClassFile {
               pool = c.pool;
               innerClasses = null;
               innerClassesQueue = null;
      -        bootstrapMethods = new LinkedHashMap();
      +        bootstrapMethods = new LinkedHashMap();
       
               Type supertype = types.supertype(c.type);
               List interfaces = types.interfaces(c.type);
      @@ -1627,7 +1636,7 @@ public class ClassWriter extends ClassFile {
               }
       
               acount += writeFlagAttrs(c.flags());
      -        acount += writeJavaAnnotations(c.getAnnotationMirrors());
      +        acount += writeJavaAnnotations(c.getRawAttributes());
               acount += writeEnclosingMethodAttribute(c);
               acount += writeExtraClassAttributes(c);
       
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java b/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java
      index 59788f2a1d5..87e1d6aea76 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java
      @@ -27,6 +27,7 @@ package com.sun.tools.javac.jvm;
       
       import com.sun.tools.javac.code.*;
       import com.sun.tools.javac.code.Symbol.*;
      +import com.sun.tools.javac.code.Types.UniqueType;
       import com.sun.tools.javac.util.*;
       import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
       
      @@ -901,6 +902,7 @@ public class Code {
               if (o instanceof ClassSymbol) return syms.classType;
               if (o instanceof Type.ArrayType) return syms.classType;
               if (o instanceof Type.MethodType) return syms.methodTypeType;
      +        if (o instanceof UniqueType) return typeForPool(((UniqueType)o).type);
               if (o instanceof Pool.MethodHandle) return syms.methodHandleType;
               throw new AssertionError(o);
           }
      @@ -1030,7 +1032,7 @@ public class Code {
                   Object o = pool.pool[od];
                   Type t = (o instanceof Symbol)
                       ? ((Symbol)o).erasure(types)
      -                : types.erasure(((Type)o));
      +                : types.erasure((((UniqueType)o).type));
                   state.push(t);
                   break; }
               case ldc2w:
      @@ -1545,10 +1547,10 @@ public class Code {
           public void compressCatchTable() {
               ListBuffer compressedCatchInfo = ListBuffer.lb();
               List handlerPcs = List.nil();
      -        for (char[] catchEntry : catchInfo.elems) {
      +        for (char[] catchEntry : catchInfo) {
                   handlerPcs = handlerPcs.prepend((int)catchEntry[2]);
               }
      -        for (char[] catchEntry : catchInfo.elems) {
      +        for (char[] catchEntry : catchInfo) {
                   int startpc = catchEntry[0];
                   int endpc = catchEntry[1];
                   if (startpc == endpc ||
      @@ -1825,7 +1827,7 @@ public class Code {
               }
           }
       
      -    static Type jsrReturnValue = new Type(INT, null);
      +    static final Type jsrReturnValue = new Type(INT, null);
       
       
       /* **************************************************************************
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java
      index d54208b5723..f99c48b258c 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java
      @@ -94,6 +94,10 @@ public class Gen extends JCTree.Visitor {
               return instance;
           }
       
      +    /* Constant pool, reset by genClass.
      +     */
      +    private Pool pool;
      +
           protected Gen(Context context) {
               context.put(genKey, this);
       
      @@ -126,6 +130,7 @@ public class Gen extends JCTree.Visitor {
               genCrt = options.isSet(XJCOV);
               debugCode = options.isSet("debugcode");
               allowInvokedynamic = target.hasInvokedynamic() || options.isSet("invokedynamic");
      +        pool = new Pool(types);
       
               generateIproxies =
                   target.requiresIproxy() ||
      @@ -174,10 +179,6 @@ public class Gen extends JCTree.Visitor {
            */
           private boolean useJsrLocally;
       
      -    /* Constant pool, reset by genClass.
      -     */
      -    private Pool pool = new Pool();
      -
           /** Code buffer, set by genMethod.
            */
           private Code code;
      @@ -705,7 +706,7 @@ public class Gen extends JCTree.Visitor {
               }
               int startpc = code.curPc();
               genStat(tree, env);
      -        if (tree.hasTag(BLOCK)) crtFlags |= CRT_BLOCK;
      +        if (tree.hasTag(Tag.BLOCK)) crtFlags |= CRT_BLOCK;
               code.crt.put(tree, crtFlags, startpc, code.curPc());
           }
       
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/jvm/Pool.java b/langtools/src/share/classes/com/sun/tools/javac/jvm/Pool.java
      index 8ac53f948f4..08a5d57d87f 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Pool.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Pool.java
      @@ -28,6 +28,9 @@ package com.sun.tools.javac.jvm;
       import com.sun.tools.javac.code.Kinds;
       import com.sun.tools.javac.code.Symbol;
       import com.sun.tools.javac.code.Symbol.*;
      +import com.sun.tools.javac.code.Type;
      +import com.sun.tools.javac.code.Types;
      +import com.sun.tools.javac.code.Types.UniqueType;
       
       import com.sun.tools.javac.util.ArrayUtils;
       import com.sun.tools.javac.util.Assert;
      @@ -60,11 +63,14 @@ public class Pool {
            */
           Map indices;
       
      +    Types types;
      +
           /** Construct a pool with given number of elements and element array.
            */
      -    public Pool(int pp, Object[] pool) {
      +    public Pool(int pp, Object[] pool, Types types) {
               this.pp = pp;
               this.pool = pool;
      +        this.types = types;
               this.indices = new HashMap(pool.length);
               for (int i = 1; i < pp; i++) {
                   if (pool[i] != null) indices.put(pool[i], i);
      @@ -73,8 +79,8 @@ public class Pool {
       
           /** Construct an empty pool.
            */
      -    public Pool() {
      -        this(1, new Object[64]);
      +    public Pool(Types types) {
      +        this(1, new Object[64], types);
           }
       
           /** Return the number of entries in the constant pool.
      @@ -114,11 +120,13 @@ public class Pool {
       
           Object makePoolValue(Object o) {
               if (o instanceof DynamicMethodSymbol) {
      -            return new DynamicMethod((DynamicMethodSymbol)o);
      +            return new DynamicMethod((DynamicMethodSymbol)o, types);
               } else if (o instanceof MethodSymbol) {
      -            return new Method((MethodSymbol)o);
      +            return new Method((MethodSymbol)o, types);
               } else if (o instanceof VarSymbol) {
      -            return new Variable((VarSymbol)o);
      +            return new Variable((VarSymbol)o, types);
      +        } else if (o instanceof Type) {
      +            return new UniqueType((Type)o, types);
               } else {
                   return o;
               }
      @@ -134,9 +142,11 @@ public class Pool {
       
           static class Method extends DelegatedSymbol {
               MethodSymbol m;
      -        Method(MethodSymbol m) {
      +        UniqueType uniqueType;
      +        Method(MethodSymbol m, Types types) {
                   super(m);
                   this.m = m;
      +            this.uniqueType = new UniqueType(m.type, types);
               }
               public boolean equals(Object other) {
                   if (!(other instanceof Method)) return false;
      @@ -144,20 +154,22 @@ public class Pool {
                   return
                       o.name == m.name &&
                       o.owner == m.owner &&
      -                o.type.equals(m.type);
      +                ((Method)other).uniqueType.equals(uniqueType);
               }
               public int hashCode() {
                   return
                       m.name.hashCode() * 33 +
                       m.owner.hashCode() * 9 +
      -                m.type.hashCode();
      +                uniqueType.hashCode();
               }
           }
       
           static class DynamicMethod extends Method {
      +        public Object[] uniqueStaticArgs;
       
      -        DynamicMethod(DynamicMethodSymbol m) {
      -            super(m);
      +        DynamicMethod(DynamicMethodSymbol m, Types types) {
      +            super(m, types);
      +            uniqueStaticArgs = getUniqueTypeArray(m.staticArgs, types);
               }
       
               @Override
      @@ -168,7 +180,8 @@ public class Pool {
                   DynamicMethodSymbol dm2 = (DynamicMethodSymbol)((DynamicMethod)other).m;
                   return dm1.bsm == dm2.bsm &&
                               dm1.bsmKind == dm2.bsmKind &&
      -                        Arrays.equals(dm1.staticArgs, dm2.staticArgs);
      +                        Arrays.equals(uniqueStaticArgs,
      +                            ((DynamicMethod)other).uniqueStaticArgs);
               }
       
               @Override
      @@ -178,17 +191,31 @@ public class Pool {
                   hash += dm.bsmKind * 7 +
                           dm.bsm.hashCode() * 11;
                   for (int i = 0; i < dm.staticArgs.length; i++) {
      -                hash += (dm.staticArgs[i].hashCode() * 23);
      +                hash += (uniqueStaticArgs[i].hashCode() * 23);
                   }
                   return hash;
               }
      +
      +        private Object[] getUniqueTypeArray(Object[] objects, Types types) {
      +            Object[] result = new Object[objects.length];
      +            for (int i = 0; i < objects.length; i++) {
      +                if (objects[i] instanceof Type) {
      +                    result[i] = new UniqueType((Type)objects[i], types);
      +                } else {
      +                    result[i] = objects[i];
      +                }
      +            }
      +            return result;
      +        }
           }
       
           static class Variable extends DelegatedSymbol {
               VarSymbol v;
      -        Variable(VarSymbol v) {
      +        UniqueType uniqueType;
      +        Variable(VarSymbol v, Types types) {
                   super(v);
                   this.v = v;
      +            this.uniqueType = new UniqueType(v.type, types);
               }
               public boolean equals(Object other) {
                   if (!(other instanceof Variable)) return false;
      @@ -196,13 +223,13 @@ public class Pool {
                   return
                       o.name == v.name &&
                       o.owner == v.owner &&
      -                o.type.equals(v.type);
      +                ((Variable)other).uniqueType.equals(uniqueType);
               }
               public int hashCode() {
                   return
                       v.name.hashCode() * 33 +
                       v.owner.hashCode() * 9 +
      -                v.type.hashCode();
      +                uniqueType.hashCode();
               }
           }
       
      @@ -214,9 +241,12 @@ public class Pool {
               /** Reference symbol */
               Symbol refSym;
       
      -        public MethodHandle(int refKind, Symbol refSym) {
      +        UniqueType uniqueType;
      +
      +        public MethodHandle(int refKind, Symbol refSym, Types types) {
                   this.refKind = refKind;
                   this.refSym = refSym;
      +            this.uniqueType = new UniqueType(this.refSym.type, types);
                   checkConsistent();
               }
               public boolean equals(Object other) {
      @@ -227,14 +257,14 @@ public class Pool {
                   return
                       o.name == refSym.name &&
                       o.owner == refSym.owner &&
      -                o.type.equals(refSym.type);
      +                ((MethodHandle)other).uniqueType.equals(uniqueType);
               }
               public int hashCode() {
                   return
                       refKind * 65 +
                       refSym.name.hashCode() * 33 +
                       refSym.owner.hashCode() * 9 +
      -                refSym.type.hashCode();
      +                uniqueType.hashCode();
               }
       
               /**
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/jvm/Target.java b/langtools/src/share/classes/com/sun/tools/javac/jvm/Target.java
      index f6432b864a0..8323a05deed 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Target.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Target.java
      @@ -86,17 +86,15 @@ public enum Target {
               return instance;
           }
       
      -    private static Target MIN;
      +    private static final Target MIN = values()[0];
           public static Target MIN() { return MIN; }
       
      -    private static Target MAX;
      +    private static final Target MAX = values()[values().length - 1];
           public static Target MAX() { return MAX; }
       
      -    private static Map tab = new HashMap();
      +    private static final Map tab = new HashMap();
           static {
               for (Target t : values()) {
      -            if (MIN == null) MIN = t;
      -            MAX = t;
                   tab.put(t.name, t);
               }
               tab.put("5", JDK1_5);
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java b/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java
      index 3181727e45a..40fbd22bd25 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java
      @@ -189,7 +189,7 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
               }
           }
       
      -    private static CompilePolicy DEFAULT_COMPILE_POLICY = CompilePolicy.BY_TODO;
      +    private static final CompilePolicy DEFAULT_COMPILE_POLICY = CompilePolicy.BY_TODO;
       
           protected static enum ImplicitSourcePolicy {
               /** Don't generate or process implicitly read source files. */
      @@ -543,7 +543,7 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
               public static CompileState max(CompileState a, CompileState b) {
                   return a.value > b.value ? a : b;
               }
      -        private int value;
      +        private final int value;
           };
           /** Partial map to record which compiler phases have been executed
            * for each compilation unit. Used for ATTR and FLOW phases.
      @@ -928,6 +928,16 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
               }
           }
       
      +    /**
      +     * Set needRootClasses to true, in JavaCompiler subclass constructor
      +     * that want to collect public apis of classes supplied on the command line.
      +     */
      +    protected boolean needRootClasses = false;
      +
      +    /**
      +     * The list of classes explicitly supplied on the command line for compilation.
      +     * Not always populated.
      +     */
           private List rootClasses;
       
           /**
      @@ -984,9 +994,10 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
                   }
               }
       
      -        //If generating source, remember the classes declared in
      -        //the original compilation units listed on the command line.
      -        if (sourceOutput || stubOutput) {
      +        // If generating source, or if tracking public apis,
      +        // then remember the classes declared in
      +        // the original compilation units listed on the command line.
      +        if (needRootClasses || sourceOutput || stubOutput) {
                   ListBuffer cdefs = lb();
                   for (JCCompilationUnit unit : roots) {
                       for (List defs = unit.defs;
      @@ -1247,6 +1258,12 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
                       attr.postAttr(env.tree);
                   }
                   compileStates.put(env, CompileState.ATTR);
      +            if (rootClasses != null && rootClasses.contains(env.enclClass)) {
      +                // This was a class that was explicitly supplied for compilation.
      +                // If we want to capture the public api of this class,
      +                // then now is a good time to do it.
      +                reportPublicApi(env.enclClass.sym);
      +            }
               }
               finally {
                   log.useSource(prev);
      @@ -1255,6 +1272,14 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
               return env;
           }
       
      +    /** Report the public api of a class that was supplied explicitly for compilation,
      +     *  for example on the command line to javac.
      +     * @param sym The symbol of the class.
      +     */
      +    public void reportPublicApi(ClassSymbol sym) {
      +       // Override to collect the reported public api.
      +    }
      +
           /**
            * Perform dataflow checks on attributed parse trees.
            * These include checks for definite assignment and unreachable statements.
      @@ -1675,7 +1700,7 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
       
           /** Print numbers of errors and warnings.
            */
      -    protected void printCount(String kind, int count) {
      +    public void printCount(String kind, int count) {
               if (count != 0) {
                   String key;
                   if (count == 1)
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/main/Main.java b/langtools/src/share/classes/com/sun/tools/javac/main/Main.java
      index f23b196f716..80bf5d26940 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/main/Main.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/main/Main.java
      @@ -44,6 +44,8 @@ import javax.tools.JavaFileObject;
       
       import com.sun.source.util.JavacTask;
       import com.sun.source.util.Plugin;
      +import com.sun.tools.doclint.DocLint;
      +import com.sun.tools.javac.api.BasicJavacTask;
       import com.sun.tools.javac.code.Source;
       import com.sun.tools.javac.file.CacheFSInfo;
       import com.sun.tools.javac.file.JavacFileManager;
      @@ -428,6 +430,7 @@ public class Main {
                   if (batchMode)
                       CacheFSInfo.preRegister(context);
       
      +            // FIXME: this code will not be invoked if using JavacTask.parse/analyze/generate
                   // invoke any available plugins
                   String plugins = options.get(PLUGIN);
                   if (plugins != null) {
      @@ -448,7 +451,7 @@ public class Main {
                                   try {
                                       if (task == null)
                                           task = JavacTask.instance(pEnv);
      -                                plugin.call(task, p.tail.toArray(new String[p.tail.size()]));
      +                                plugin.init(task, p.tail.toArray(new String[p.tail.size()]));
                                   } catch (Throwable ex) {
                                       if (apiMode)
                                           throw new RuntimeException(ex);
      @@ -464,10 +467,31 @@ public class Main {
                       }
                   }
       
      -            fileManager = context.get(JavaFileManager.class);
      -
                   comp = JavaCompiler.instance(context);
      -            if (comp == null) return Result.SYSERR;
      +
      +            // FIXME: this code will not be invoked if using JavacTask.parse/analyze/generate
      +            String xdoclint = options.get(XDOCLINT);
      +            String xdoclintCustom = options.get(XDOCLINT_CUSTOM);
      +            if (xdoclint != null || xdoclintCustom != null) {
      +                Set doclintOpts = new LinkedHashSet();
      +                if (xdoclint != null)
      +                    doclintOpts.add(DocLint.XMSGS_OPTION);
      +                if (xdoclintCustom != null) {
      +                    for (String s: xdoclintCustom.split("\\s+")) {
      +                        if (s.isEmpty())
      +                            continue;
      +                        doclintOpts.add(s.replace(XDOCLINT_CUSTOM.text, DocLint.XMSGS_CUSTOM_PREFIX));
      +                    }
      +                }
      +                if (!(doclintOpts.size() == 1
      +                        && doclintOpts.iterator().next().equals(DocLint.XMSGS_CUSTOM_PREFIX + "none"))) {
      +                    JavacTask t = BasicJavacTask.instance(context);
      +                    new DocLint().init(t, doclintOpts.toArray(new String[doclintOpts.size()]));
      +                    comp.keepComments = true;
      +                }
      +            }
      +
      +            fileManager = context.get(JavaFileManager.class);
       
                   if (!files.isEmpty()) {
                       // add filenames to fileObjects
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/main/Option.java b/langtools/src/share/classes/com/sun/tools/javac/main/Option.java
      index 8a44ac4345c..df4d657269f 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/main/Option.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/main/Option.java
      @@ -25,28 +25,30 @@
       
       package com.sun.tools.javac.main;
       
      -import java.util.Collections;
      -import com.sun.tools.javac.util.Log.PrefixKind;
      -import com.sun.tools.javac.util.Log.WriterKind;
      -import com.sun.tools.javac.util.Log;
      -import com.sun.tools.javac.code.Lint;
      -import com.sun.tools.javac.code.Source;
      -import com.sun.tools.javac.code.Type;
      -import com.sun.tools.javac.jvm.Target;
      -import com.sun.tools.javac.util.Options;
      -import com.sun.tools.javac.processing.JavacProcessingEnvironment;
       import java.io.File;
       import java.io.FileWriter;
       import java.io.PrintWriter;
      +import java.util.Collections;
       import java.util.EnumSet;
       import java.util.LinkedHashMap;
       import java.util.Map;
       import java.util.Set;
      +
       import javax.lang.model.SourceVersion;
       
      +import com.sun.tools.doclint.DocLint;
      +import com.sun.tools.javac.code.Lint;
      +import com.sun.tools.javac.code.Source;
      +import com.sun.tools.javac.code.Type;
      +import com.sun.tools.javac.jvm.Target;
      +import com.sun.tools.javac.processing.JavacProcessingEnvironment;
      +import com.sun.tools.javac.util.Log;
      +import com.sun.tools.javac.util.Log.PrefixKind;
      +import com.sun.tools.javac.util.Log.WriterKind;
      +import com.sun.tools.javac.util.Options;
       import static com.sun.tools.javac.main.Option.ChoiceKind.*;
      -import static com.sun.tools.javac.main.Option.OptionKind.*;
       import static com.sun.tools.javac.main.Option.OptionGroup.*;
      +import static com.sun.tools.javac.main.Option.OptionKind.*;
       
       /**
        * Options for javac. The specific Option to handle a command-line option
      @@ -79,6 +81,24 @@ public enum Option {
           XLINT_CUSTOM("-Xlint:", "opt.Xlint.suboptlist",
                   EXTENDED,   BASIC, ANYOF, getXLintChoices()),
       
      +    XDOCLINT("-Xdoclint", "opt.Xdoclint", EXTENDED, BASIC),
      +
      +    XDOCLINT_CUSTOM("-Xdoclint:", "opt.Xdoclint.subopts", "opt.Xdoclint.custom", EXTENDED, BASIC) {
      +        @Override
      +        public boolean matches(String option) {
      +            return DocLint.isValidOption(
      +                    option.replace(XDOCLINT_CUSTOM.text, DocLint.XMSGS_CUSTOM_PREFIX));
      +        }
      +
      +        @Override
      +        public boolean process(OptionHelper helper, String option) {
      +            String prev = helper.get(XDOCLINT_CUSTOM);
      +            String next = (prev == null) ? option : (prev + " " + option);
      +            helper.put(XDOCLINT_CUSTOM.text, next);
      +            return false;
      +        }
      +    },
      +
           // -nowarn is retained for command-line backward compatibility
           NOWARN("-nowarn", "opt.nowarn", STANDARD, BASIC) {
               @Override
      @@ -167,7 +187,6 @@ public enum Option {
           ENCODING("-encoding", "opt.arg.encoding", "opt.encoding", STANDARD, FILEMANAGER) {
               @Override
               public boolean process(OptionHelper helper, String option, String operand) {
      -//            System.err.println("process encoding " + operand);
                   return super.process(helper, option, operand);
               }
       
      @@ -246,9 +265,7 @@ public enum Option {
               }
           },
       
      -    A("-A", "opt.arg.key.equals.value", "opt.A", STANDARD, BASIC) {
      -        { hasSuffix = true; }
      -
      +    A("-A", "opt.arg.key.equals.value", "opt.A", STANDARD, BASIC, true) {
               @Override
               public boolean matches(String arg) {
                   return arg.startsWith("-A");
      @@ -293,8 +310,6 @@ public enum Option {
           // This option exists only for the purpose of documenting itself.
           // It's actually implemented by the launcher.
           J("-J", "opt.arg.flag", "opt.J", STANDARD, INFO) {
      -        { hasSuffix = true; }
      -
               @Override
               public boolean process(OptionHelper helper, String option) {
                   throw new AssertionError
      @@ -302,10 +317,6 @@ public enum Option {
               }
           },
       
      -    // stop after parsing and attributing.
      -    // new HiddenOption("-attrparseonly"),
      -
      -    // new Option("-moreinfo",                                      "opt.moreinfo") {
           MOREINFO("-moreinfo", null, HIDDEN, BASIC) {
               @Override
               public boolean process(OptionHelper helper, String option) {
      @@ -317,23 +328,6 @@ public enum Option {
           // treat warnings as errors
           WERROR("-Werror", "opt.Werror", STANDARD, BASIC),
       
      -//    // use complex inference from context in the position of a method call argument
      -//    COMPLEXINFERENCE("-complexinference", null, HIDDEN, BASIC),
      -
      -    // generare source stubs
      -    // new HiddenOption("-stubs"),
      -
      -    // relax some constraints to allow compiling from stubs
      -    // new HiddenOption("-relax"),
      -
      -    // output source after translating away inner classes
      -    // new Option("-printflat",                             "opt.printflat"),
      -    // new HiddenOption("-printflat"),
      -
      -    // display scope search details
      -    // new Option("-printsearch",                           "opt.printsearch"),
      -    // new HiddenOption("-printsearch"),
      -
           // prompt after each error
           // new Option("-prompt",                                        "opt.prompt"),
           PROMPT("-prompt", null, HIDDEN, BASIC),
      @@ -342,13 +336,8 @@ public enum Option {
           DOE("-doe", null, HIDDEN, BASIC),
       
           // output source after type erasure
      -    // new Option("-s",                                     "opt.s"),
           PRINTSOURCE("-printsource", null, HIDDEN, BASIC),
       
      -    // output shrouded class files
      -    // new Option("-scramble",                              "opt.scramble"),
      -    // new Option("-scrambleall",                           "opt.scrambleall"),
      -
           // display warnings for generic unchecked operations
           WARNUNCHECKED("-warnunchecked", null, HIDDEN, BASIC) {
               @Override
      @@ -408,18 +397,16 @@ public enum Option {
            * -XDx sets the option x to the value x.
            */
           XD("-XD", null, HIDDEN, BASIC) {
      -        String s;
               @Override
               public boolean matches(String s) {
      -            this.s = s;
                   return s.startsWith(text);
               }
               @Override
               public boolean process(OptionHelper helper, String option) {
      -            s = s.substring(text.length());
      -            int eq = s.indexOf('=');
      -            String key = (eq < 0) ? s : s.substring(0, eq);
      -            String value = (eq < 0) ? s : s.substring(eq+1);
      +            option = option.substring(text.length());
      +            int eq = option.indexOf('=');
      +            String key = (eq < 0) ? option : option.substring(0, eq);
      +            String value = (eq < 0) ? option : option.substring(eq+1);
                   helper.put(key, value);
                   return false;
               }
      @@ -428,8 +415,6 @@ public enum Option {
           // This option exists only for the purpose of documenting itself.
           // It's actually implemented by the CommandLine class.
           AT("@", "opt.arg.file", "opt.AT", STANDARD, INFO) {
      -        { hasSuffix = true; }
      -
               @Override
               public boolean process(OptionHelper helper, String option) {
                   throw new AssertionError("the @ flag should be caught by CommandLine.");
      @@ -445,17 +430,15 @@ public enum Option {
            * name to a separate list.
            */
           SOURCEFILE("sourcefile", null, HIDDEN, INFO) {
      -        String s;
               @Override
               public boolean matches(String s) {
      -            this.s = s;
                   return s.endsWith(".java")  // Java source file
                       || SourceVersion.isName(s);   // Legal type name
               }
               @Override
               public boolean process(OptionHelper helper, String option) {
      -            if (s.endsWith(".java") ) {
      -                File f = new File(s);
      +            if (option.endsWith(".java") ) {
      +                File f = new File(option);
                       if (!f.exists()) {
                           helper.error("err.file.not.found", f);
                           return true;
      @@ -465,9 +448,9 @@ public enum Option {
                           return true;
                       }
                       helper.addFile(f);
      +            } else {
      +                helper.addClassName(option);
                   }
      -            else
      -                helper.addClassName(s);
                   return false;
               }
           };
      @@ -521,7 +504,7 @@ public enum Option {
       
           /** Suffix option (-foo=bar or -foo:bar)
            */
      -    boolean hasSuffix;
      +    final boolean hasSuffix;
       
           /** The kind of choices for this option, if any.
            */
      @@ -535,24 +518,30 @@ public enum Option {
       
           Option(String text, String descrKey,
                   OptionKind kind, OptionGroup group) {
      -        this(text, null, descrKey, kind, group, null, null);
      +        this(text, null, descrKey, kind, group, null, null, false);
           }
       
           Option(String text, String argsNameKey, String descrKey,
                   OptionKind kind, OptionGroup group) {
      -        this(text, argsNameKey, descrKey, kind, group, null, null);
      +        this(text, argsNameKey, descrKey, kind, group, null, null, false);
      +    }
      +
      +    Option(String text, String argsNameKey, String descrKey,
      +            OptionKind kind, OptionGroup group, boolean doHasSuffix) {
      +        this(text, argsNameKey, descrKey, kind, group, null, null, doHasSuffix);
           }
       
           Option(String text, String descrKey,
                   OptionKind kind, OptionGroup group,
                   ChoiceKind choiceKind, Map choices) {
      -        this(text, null, descrKey, kind, group, choiceKind, choices);
      +        this(text, null, descrKey, kind, group, choiceKind, choices, false);
           }
       
           Option(String text, String descrKey,
                   OptionKind kind, OptionGroup group,
                   ChoiceKind choiceKind, String... choices) {
      -        this(text, null, descrKey, kind, group, choiceKind, createChoices(choices));
      +        this(text, null, descrKey, kind, group, choiceKind,
      +                createChoices(choices), false);
           }
           // where
               private static Map createChoices(String... choices) {
      @@ -564,7 +553,8 @@ public enum Option {
       
           private Option(String text, String argsNameKey, String descrKey,
                   OptionKind kind, OptionGroup group,
      -            ChoiceKind choiceKind, Map choices) {
      +            ChoiceKind choiceKind, Map choices,
      +            boolean doHasSuffix) {
               this.text = text;
               this.argsNameKey = argsNameKey;
               this.descrKey = descrKey;
      @@ -573,7 +563,7 @@ public enum Option {
               this.choiceKind = choiceKind;
               this.choices = choices;
               char lastChar = text.charAt(text.length()-1);
      -        hasSuffix = lastChar == ':' || lastChar == '=';
      +        this.hasSuffix = doHasSuffix || lastChar == ':' || lastChar == '=';
           }
       
           public String getText() {
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/model/JavacTypes.java b/langtools/src/share/classes/com/sun/tools/javac/model/JavacTypes.java
      index 40a36019214..83ce128cd35 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/model/JavacTypes.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/model/JavacTypes.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
      + * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
        * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        *
        * This code is free software; you can redistribute it and/or modify it
      @@ -25,11 +25,16 @@
       
       package com.sun.tools.javac.model;
       
      +import java.util.Collections;
      +import java.util.EnumSet;
      +import java.util.HashSet;
      +import java.util.LinkedHashSet;
       import java.util.List;
       import java.util.Set;
      -import java.util.EnumSet;
      +
       import javax.lang.model.element.*;
       import javax.lang.model.type.*;
      +
       import com.sun.tools.javac.code.*;
       import com.sun.tools.javac.code.Symbol.*;
       import com.sun.tools.javac.util.*;
      @@ -301,4 +306,31 @@ public class JavacTypes implements javax.lang.model.util.Types {
                   throw new IllegalArgumentException(o.toString());
               return clazz.cast(o);
           }
      +
      +    public Set getOverriddenMethods(Element elem) {
      +        if (elem.getKind() != ElementKind.METHOD
      +                || elem.getModifiers().contains(Modifier.STATIC)
      +                || elem.getModifiers().contains(Modifier.PRIVATE))
      +            return Collections.emptySet();
      +
      +        if (!(elem instanceof MethodSymbol))
      +            throw new IllegalArgumentException();
      +
      +        MethodSymbol m = (MethodSymbol) elem;
      +        ClassSymbol origin = (ClassSymbol) m.owner;
      +
      +        Set results = new LinkedHashSet();
      +        for (Type t : types.closure(origin.type)) {
      +            if (t != origin.type) {
      +                ClassSymbol c = (ClassSymbol) t.tsym;
      +                for (Scope.Entry e = c.members().lookup(m.name); e.scope != null; e = e.next()) {
      +                    if (e.sym.kind == Kinds.MTH && m.overrides(e.sym, origin, types, true)) {
      +                        results.add((MethodSymbol) e.sym);
      +                    }
      +                }
      +            }
      +        }
      +
      +        return results;
      +    }
       }
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/parser/DocCommentParser.java b/langtools/src/share/classes/com/sun/tools/javac/parser/DocCommentParser.java
      index 4d422058d08..989e42d066e 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/parser/DocCommentParser.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/parser/DocCommentParser.java
      @@ -25,15 +25,12 @@
       
       package com.sun.tools.javac.parser;
       
      -import com.sun.tools.javac.util.Filter;
       import java.text.BreakIterator;
       import java.util.Arrays;
       import java.util.HashMap;
       import java.util.HashSet;
      -import java.util.LinkedList;
       import java.util.Locale;
       import java.util.Map;
      -import java.util.Queue;
       import java.util.Set;
       
       import com.sun.source.doctree.AttributeTree.ValueKind;
      @@ -52,7 +49,6 @@ import com.sun.tools.javac.tree.DCTree.DCText;
       import com.sun.tools.javac.tree.DocTreeMaker;
       import com.sun.tools.javac.tree.JCTree;
       import com.sun.tools.javac.util.DiagnosticSource;
      -import com.sun.tools.javac.util.JCDiagnostic;
       import com.sun.tools.javac.util.List;
       import com.sun.tools.javac.util.ListBuffer;
       import com.sun.tools.javac.util.Log;
      @@ -736,7 +732,9 @@ public class DocCommentParser {
                   nextChar();
                   return m.at(p).Entity(names.fromChars(buf, namep, bp - namep - 1));
               } else {
      -            String code = checkSemi ? "dc.missing.semicolon" : "dc.bad.entity";
      +            String code = checkSemi
      +                    ? "dc.missing.semicolon"
      +                    : "dc.bad.entity";
                   return erroneous(code, p);
               }
           }
      @@ -888,8 +886,10 @@ public class DocCommentParser {
           }
       
           protected void addPendingText(ListBuffer list, int textEnd) {
      -        if (textStart != -1 && textStart <= textEnd) {
      -            list.add(m.at(textStart).Text(newString(textStart, textEnd + 1)));
      +        if (textStart != -1) {
      +            if (textStart <= textEnd) {
      +                list.add(m.at(textStart).Text(newString(textStart, textEnd + 1)));
      +            }
                   textStart = -1;
               }
           }
      @@ -1196,6 +1196,16 @@ public class DocCommentParser {
                                       return m.at(pos).See(html);
                                   break;
       
      +                        case '@':
      +                            if (newline)
      +                                throw new ParseException("dc.no.content");
      +                            break;
      +
      +                        case EOI:
      +                            if (bp == buf.length - 1)
      +                                throw new ParseException("dc.no.content");
      +                            break;
      +
                               default:
                                   if (isJavaIdentifierStart(ch) || ch == '#') {
                                       DCReference ref = reference(true);
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java b/langtools/src/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java
      index 20d3f4b93cd..2c77a712901 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java
      @@ -44,7 +44,7 @@ import static com.sun.tools.javac.util.LayoutCharacters.*;
        */
       public class JavaTokenizer {
       
      -    private static boolean scannerDebug = false;
      +    private static final boolean scannerDebug = false;
       
           /** Allow hex floating-point literals.
            */
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java
      index 90e384c27d8..28f6d8a29eb 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java
      @@ -818,9 +818,7 @@ public class JavacParser implements Parser {
            *                  | "*" | "/" | "%"
            */
           JCExpression term2Rest(JCExpression t, int minprec) {
      -        List savedOd = odStackSupply.elems;
               JCExpression[] odStack = newOdStack();
      -        List savedOp = opStackSupply.elems;
               Token[] opStack = newOpStack();
       
               // optimization, was odStack = new Tree[...]; opStack = new Tree[...];
      @@ -851,8 +849,8 @@ public class JavacParser implements Parser {
                   }
               }
       
      -        odStackSupply.elems = savedOd; // optimization
      -        opStackSupply.elems = savedOp; // optimization
      +        odStackSupply.add(odStack);
      +        opStackSupply.add(opStack);
               return t;
           }
       //where
      @@ -906,23 +904,19 @@ public class JavacParser implements Parser {
               /** optimization: To save allocating a new operand/operator stack
                *  for every binary operation, we use supplys.
                */
      -        ListBuffer odStackSupply = new ListBuffer();
      -        ListBuffer opStackSupply = new ListBuffer();
      +        ArrayList odStackSupply = new ArrayList();
      +        ArrayList opStackSupply = new ArrayList();
       
               private JCExpression[] newOdStack() {
      -            if (odStackSupply.elems == odStackSupply.last)
      -                odStackSupply.append(new JCExpression[infixPrecedenceLevels + 1]);
      -            JCExpression[] odStack = odStackSupply.elems.head;
      -            odStackSupply.elems = odStackSupply.elems.tail;
      -            return odStack;
      +            if (odStackSupply.isEmpty())
      +                return new JCExpression[infixPrecedenceLevels + 1];
      +            return odStackSupply.remove(odStackSupply.size() - 1);
               }
       
               private Token[] newOpStack() {
      -            if (opStackSupply.elems == opStackSupply.last)
      -                opStackSupply.append(new Token[infixPrecedenceLevels + 1]);
      -            Token[] opStack = opStackSupply.elems.head;
      -            opStackSupply.elems = opStackSupply.elems.tail;
      -            return opStack;
      +            if (opStackSupply.isEmpty())
      +                return new Token[infixPrecedenceLevels + 1];
      +            return opStackSupply.remove(opStackSupply.size() - 1);
               }
       
           /**
      @@ -2001,7 +1995,7 @@ public class JavacParser implements Parser {
                       ListBuffer stats =
                               variableDeclarators(mods, t, new ListBuffer());
                       // A "LocalVariableDeclarationStatement" subsumes the terminating semicolon
      -                storeEnd(stats.elems.last(), token.endPos);
      +                storeEnd(stats.last(), token.endPos);
                       accept(SEMI);
                       return stats.toList();
                   }
      @@ -2042,7 +2036,7 @@ public class JavacParser implements Parser {
                       ListBuffer stats =
                               variableDeclarators(mods, t, new ListBuffer());
                       // A "LocalVariableDeclarationStatement" subsumes the terminating semicolon
      -                storeEnd(stats.elems.last(), token.endPos);
      +                storeEnd(stats.last(), token.endPos);
                       accept(SEMI);
                       return stats.toList();
                   } else {
      @@ -2577,7 +2571,7 @@ public class JavacParser implements Parser {
               vdefs.append(variableDeclaratorRest(pos, mods, type, name, reqInit, dc));
               while (token.kind == COMMA) {
                   // All but last of multiple declarators subsume a comma
      -            storeEnd((JCTree)vdefs.elems.last(), token.endPos);
      +            storeEnd((JCTree)vdefs.last(), token.endPos);
                   nextToken();
                   vdefs.append(variableDeclarator(mods, type, reqInit, dc));
               }
      @@ -2632,7 +2626,7 @@ public class JavacParser implements Parser {
               defs.append(resource());
               while (token.kind == SEMI) {
                   // All but last of multiple declarators must subsume a semicolon
      -            storeEnd(defs.elems.last(), token.endPos);
      +            storeEnd(defs.last(), token.endPos);
                   int semiColonPos = token.pos;
                   nextToken();
                   if (token.kind == RPAREN) { // Optional trailing semicolon
      @@ -2710,7 +2704,7 @@ public class JavacParser implements Parser {
               JCTree.JCCompilationUnit toplevel = F.at(firstToken.pos).TopLevel(packageAnnotations, pid, defs.toList());
               if (!consumedToplevelDoc)
                   attach(toplevel, firstToken.comment(CommentStyle.JAVADOC));
      -        if (defs.elems.isEmpty())
      +        if (defs.isEmpty())
                   storeEnd(toplevel, S.prevToken().endPos);
               if (keepDocComments)
                   toplevel.docComments = docComments;
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
      index 061d571478c..498ca34b415 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
      @@ -1336,7 +1336,7 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
               return nodes;
           }
       
      -    private static TreeScanner treeCleaner = new TreeScanner() {
      +    private static final TreeScanner treeCleaner = new TreeScanner() {
                   public void scan(JCTree node) {
                       super.scan(node);
                       if (node != null)
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties
      index 900066bb1f1..1f36e636ccc 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties
      +++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties
      @@ -307,13 +307,17 @@ compiler.err.doesnt.exist=\
       compiler.err.duplicate.annotation=\
           duplicate annotation
       
      +# 0: type
      +compiler.err.duplicate.annotation.invalid.repeated=\
      +    annotation {0} cannot be repeated\nIt does not define a valid containing annotation.
      +
       # 0: name, 1: type
       compiler.err.duplicate.annotation.member.value=\
           duplicate annotation member value {0} in {1}
       
      -# 0: type
      +# 0: type, 1: type
       compiler.err.duplicate.annotation.missing.container=\
      -    duplicate annotation, the declaration of {0} does not have a ContainedBy annotation
      +    duplicate annotation, the declaration of {0} does not have a valid {1} annotation
       
       # 0: type, 1: type
       compiler.err.invalid.container.no.containedby=\
      @@ -2360,6 +2364,9 @@ compiler.err.dc.malformed.html=\
       compiler.err.dc.missing.semicolon=\
           semicolon missing
       
      +compiler.err.dc.no.content=\
      +    no content
      +
       compiler.err.dc.no.tag.name=\
           no tag name after '@'
       
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/resources/javac.properties b/langtools/src/share/classes/com/sun/tools/javac/resources/javac.properties
      index c5de12197f6..5d7e383aa6f 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/resources/javac.properties
      +++ b/langtools/src/share/classes/com/sun/tools/javac/resources/javac.properties
      @@ -138,6 +138,14 @@ javac.opt.Xlint=\
           Enable recommended warnings
       javac.opt.Xlint.suboptlist=\
           Enable or disable specific warnings
      +javac.opt.Xdoclint=\
      +    Enable recommended checks for problems in javadoc comments
      +javac.opt.Xdoclint.subopts = \
      +    (all|[-])[/]
      +javac.opt.Xdoclint.custom=\n\
      +\        Enable or disable specific checks for problems in javadoc comments,\n\
      +\        where  is one of accessibility, html, reference, or syntax,\n\
      +\        and  is one of public, protected, package, or private.
       javac.opt.Xstdout=\
           Redirect standard output
       javac.opt.X=\
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java b/langtools/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java
      index 53b37fb4554..10c0de706a1 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java
      @@ -33,6 +33,7 @@ import com.sun.tools.javac.code.Symbol;
       import com.sun.tools.javac.code.Attribute;
       import com.sun.tools.javac.code.Symtab;
       import com.sun.tools.javac.code.Type;
      +import com.sun.tools.javac.code.Types;
       import com.sun.tools.javac.jvm.ClassReader;
       import com.sun.tools.javac.jvm.ClassWriter;
       import com.sun.tools.javac.jvm.Pool;
      @@ -173,7 +174,8 @@ public class CreateSymbols extends AbstractProcessor {
                                          List.>nil());
       
               Type.moreInfo = true;
      -        Pool pool = new Pool();
      +        Types types = Types.instance(task.getContext());
      +        Pool pool = new Pool(types);
               for (JavaFileObject file : fm.list(jarLocation, "", EnumSet.of(CLASS), true)) {
                   String className = fm.inferBinaryName(jarLocation, file);
                   int index = className.lastIndexOf('.');
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/tree/DCTree.java b/langtools/src/share/classes/com/sun/tools/javac/tree/DCTree.java
      index 81ac170c918..e49cabe0838 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/tree/DCTree.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/tree/DCTree.java
      @@ -36,6 +36,8 @@ import com.sun.tools.javac.util.JCDiagnostic;
       import com.sun.tools.javac.util.JCDiagnostic.SimpleDiagnosticPosition;
       import com.sun.tools.javac.util.List;
       import com.sun.tools.javac.util.Name;
      +import java.io.IOException;
      +import java.io.StringWriter;
       import javax.tools.JavaFileObject;
       
       /**
      @@ -65,6 +67,21 @@ public abstract class DCTree implements DocTree {
               return new SimpleDiagnosticPosition(dc.comment.getSourcePos(pos));
           }
       
      +    /** Convert a tree to a pretty-printed string. */
      +    @Override
      +    public String toString() {
      +        StringWriter s = new StringWriter();
      +        try {
      +            new DocPretty(s).print(this);
      +        }
      +        catch (IOException e) {
      +            // should never happen, because StringWriter is defined
      +            // never to throw any IOExceptions
      +            throw new AssertionError(e);
      +        }
      +        return s.toString();
      +    }
      +
           public static class DCDocComment extends DCTree implements DocCommentTree {
               final Comment comment; // required for the implicit source pos table
       
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/tree/DocPretty.java b/langtools/src/share/classes/com/sun/tools/javac/tree/DocPretty.java
      index 6d4dbc5abe1..0b6faeca22b 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/tree/DocPretty.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/tree/DocPretty.java
      @@ -81,7 +81,7 @@ public class DocPretty implements DocTreeVisitor {
           /**
            * Print list.
            */
      -    protected void print(List list) throws IOException {
      +    public void print(List list) throws IOException {
               for (DocTree t: list) {
                   print(t);
               }
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java b/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java
      index 2e65c5dfa46..269890eeb2b 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java
      @@ -340,15 +340,17 @@ public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition {
                */
               LETEXPR;                         // ala scheme
       
      -        private Tag noAssignTag;
      +        private final Tag noAssignTag;
       
      -        private static int numberOfOperators = MOD.ordinal() - POS.ordinal() + 1;
      +        private static final int numberOfOperators = MOD.ordinal() - POS.ordinal() + 1;
       
               private Tag(Tag noAssignTag) {
                   this.noAssignTag = noAssignTag;
               }
       
      -        private Tag() { }
      +        private Tag() {
      +            this(null);
      +        }
       
               public static int getNumberOfOperators() {
                   return numberOfOperators;
      @@ -1838,8 +1840,8 @@ public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition {
                   /** Toplevel # new */
                   TOPLEVEL(ReferenceMode.NEW, false);
       
      -            ReferenceMode mode;
      -            boolean unbound;
      +            final ReferenceMode mode;
      +            final boolean unbound;
       
                   private ReferenceKind(ReferenceMode mode, boolean unbound) {
                       this.mode = mode;
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java
      index 9b1c85227d9..3daff1d5fee 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java
      @@ -26,6 +26,7 @@
       package com.sun.tools.javac.tree;
       
       
      +
       import com.sun.source.tree.Tree;
       import com.sun.tools.javac.code.*;
       import com.sun.tools.javac.comp.AttrContext;
      @@ -330,6 +331,13 @@ public class TreeInfo {
               return (docComments == null) ? null : docComments.getCommentText(tree);
           }
       
      +    public static DCTree.DCDocComment getCommentTree(Env env, JCTree tree) {
      +        DocCommentTable docComments = (tree.hasTag(JCTree.Tag.TOPLEVEL))
      +                ? ((JCCompilationUnit) tree).docComments
      +                : env.toplevel.docComments;
      +        return (docComments == null) ? null : docComments.getCommentTree(tree);
      +    }
      +
           /** The position of the first statement in a block, or the position of
            *  the block itself if it is empty.
            */
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java
      index ce69edbe3f2..27a2d74feda 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java
      @@ -684,7 +684,7 @@ public class TreeMaker implements JCTree.Factory {
           public JCVariableDecl VarDef(VarSymbol v, JCExpression init) {
               return (JCVariableDecl)
                   new JCVariableDecl(
      -                Modifiers(v.flags(), Annotations(v.getAnnotationMirrors())),
      +                Modifiers(v.flags(), Annotations(v.getRawAttributes())),
                       v.name,
                       Type(v.type),
                       init,
      @@ -800,7 +800,7 @@ public class TreeMaker implements JCTree.Factory {
           public JCMethodDecl MethodDef(MethodSymbol m, Type mtype, JCBlock body) {
               return (JCMethodDecl)
                   new JCMethodDecl(
      -                Modifiers(m.flags(), Annotations(m.getAnnotationMirrors())),
      +                Modifiers(m.flags(), Annotations(m.getRawAttributes())),
                       m.name,
                       Type(mtype.getReturnType()),
                       TypeParams(mtype.getTypeArguments()),
      diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/BaseFileManager.java b/langtools/src/share/classes/com/sun/tools/javac/util/BaseFileManager.java
      index db3d662ba0e..cd27b07d4a7 100644
      --- a/langtools/src/share/classes/com/sun/tools/javac/util/BaseFileManager.java
      +++ b/langtools/src/share/classes/com/sun/tools/javac/util/BaseFileManager.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
      + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
        * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        *
        * This code is free software; you can redistribute it and/or modify it
      @@ -181,7 +181,7 @@ public abstract class BaseFileManager {
               return false;
           }
           // where
      -        private static Set